/* Page-level rules, and the only stylesheet this repository writes by hand.
   Every colour, size, weight and space below is read from a --ds-* custom
   property that ferrisoft_design_system emits; the viewport unit, the zeroed
   margins and padding, the shell's one grid track and the layout keywords are
   layout instructions rather than design values, which is why they are the
   only literals here. Components bring their own rules with
   `components::styles()`. Every row wraps rather than scrolls, and a word too
   long for its line, an e-mail address say, breaks anywhere rather than widen
   the page, which together hold the 375 px floor. */

body {
  margin: 0;
  background: var(--ds-surface-0);
  color: var(--ds-text-primary);
  font-family: var(--ds-font-family);
  font-size: var(--ds-text-body-size);
}

.drum-shell {
  min-height: 100dvh;
  padding: var(--ds-space-5);
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-content: start;
  gap: var(--ds-space-4);
}

/* A card's content, one item under the other. */
.drum-stack {
  display: grid;
  gap: var(--ds-space-3);
}

.drum-stack > * {
  margin: 0;
}

/* A row of a title and what goes with it, the title taking the room. */
.drum-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--ds-space-3);
}

.drum-bar > :first-child {
  margin-inline-end: auto;
}

.drum-title {
  margin: 0;
  font-size: var(--ds-text-title-size);
  font-weight: var(--ds-text-title-weight);
}

.drum-heading {
  margin: 0;
  font-size: var(--ds-text-heading-size);
  font-weight: var(--ds-text-heading-weight);
}

.drum-subtitle {
  margin: 0;
  color: var(--ds-text-secondary);
  font-size: var(--ds-text-body-size);
}

.drum-title,
.drum-heading,
.drum-subtitle,
.drum-notice,
.drum-zone > span {
  overflow-wrap: anywhere;
  min-width: 0;
}

/* A refusal or a fault, said as an alert. */
.drum-notice {
  margin: 0;
  color: var(--ds-danger);
}

.drum-zones {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: var(--ds-space-2);
}

.drum-zone {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--ds-space-2);
  min-height: var(--ds-target-min);
}

/* Google draws its button into this at a size of its own choosing, which
   stretches to the slot's width unless the slot keeps to its content's. */
.drum-google-button {
  justify-self: start;
  min-height: var(--ds-target-min);
}

/* The page, and on a deployment that is not production its tint: a stripe
   in the warning colour across the top of every page, beside the chip. */
.drum-page {
  min-height: 100dvh;
}

.drum-page--marked {
  border-top: var(--ds-space-1) solid var(--ds-warning);
}

.drum-environment {
  margin: 0;
  padding: var(--ds-space-3) var(--ds-space-5) 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--ds-space-2);
}

.drum-home-link {
  display: inline-flex;
  align-items: center;
  min-height: var(--ds-target-min);
  color: inherit;
  text-decoration: none;
}

.drum-subheading {
  margin: 0;
  font-size: var(--ds-text-subheading-size);
  font-weight: var(--ds-text-subheading-weight);
}

/* A link the pointer or a finger can hit: as tall as a target. */
.drum-link {
  display: inline-flex;
  align-items: center;
  min-height: var(--ds-target-min);
  color: var(--ds-accent);
}

.drum-link[aria-current] {
  color: var(--ds-text-primary);
  font-weight: var(--ds-text-body-strong-weight);
}

.drum-views {
  display: flex;
  flex-wrap: wrap;
  gap: var(--ds-space-3);
}

/* A label over its control, or beside it. */
.drum-field {
  display: grid;
  gap: var(--ds-space-1);
  min-width: 0;
}

.drum-field--inline {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--ds-space-2);
}

.drum-field--grow {
  flex: 1 1 auto;
}

.drum-fieldset {
  margin: 0;
  padding: 0;
  border: 0;
  min-width: 0;
}

/* A fieldset's legend lines up with the labels around it. */
.drum-fieldset > legend {
  padding: 0;
}

/* An address keeps whole: its table scrolls in place instead. */
.drum-address {
  white-space: nowrap;
}

/* A row's controls, which keep to their start; and a dialog's two buttons,
   apart. */
.drum-controls {
  gap: var(--ds-space-2);
}

.drum-controls > :first-child,
.drum-apart > :first-child {
  margin-inline-end: 0;
}

.drum-apart {
  justify-content: space-between;
}

/* The context timeline (issue 88): one scroller in both directions, its axis
   on top and its titles on the left sticky while the chart moves under them.
   Rows are placed in pixels the timeline's layout computes, which is why
   their offsets are written on each element rather than here; the title
   column is a share of the viewport, capped at the design system's largest
   spacing step four times over, so a phone keeps most of its width for the
   chart. A row's bar is half its height, its plan a rule under it, and
   today a line through the middle of today's cell; the chart is as tall as
   its rows, at most seven tenths of the viewport, and a scroll that reaches
   its end carries on to the page. */
.drum-timeline {
  --drum-timeline-title: min(40vw, calc(4 * var(--ds-space-8)));
  position: relative;
  overflow: auto;
  max-height: 70dvh;
  border-radius: var(--ds-radius-md);
  background: var(--ds-surface-0);
  font-size: var(--ds-text-caption-size);
}

.drum-timeline:focus-visible {
  outline: calc(var(--ds-space-1) / 2) solid var(--ds-accent);
}

.drum-timeline__axis {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  background: var(--ds-surface-1);
}

.drum-timeline__rows {
  position: relative;
}

.drum-timeline__row {
  position: absolute;
  left: 0;
  display: flex;
}

.drum-timeline__corner,
.drum-timeline__title {
  position: sticky;
  left: 0;
  z-index: 1;
  flex: none;
  box-sizing: border-box;
  width: var(--drum-timeline-title);
  display: flex;
  align-items: center;
  padding-inline: var(--ds-space-2);
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  border-inline-end: calc(var(--ds-space-1) / 4) solid var(--ds-border);
  background: var(--ds-surface-0);
}

.drum-timeline__corner {
  color: var(--ds-text-secondary);
  font-weight: var(--ds-text-body-strong-weight);
  background: var(--ds-surface-1);
}

/* A block, so that a long title ends in an ellipsis, centred in its row. */
.drum-timeline__title {
  display: block;
  align-content: center;
}

.drum-timeline__track {
  position: relative;
  flex: none;
}

.drum-timeline__tick {
  position: absolute;
  top: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  padding-inline-start: var(--ds-space-1);
  border-inline-start: calc(var(--ds-space-1) / 4) solid var(--ds-border);
  color: var(--ds-text-secondary);
  white-space: nowrap;
}

.drum-timeline__bar {
  position: absolute;
  top: 25%;
  height: 50%;
  border-radius: var(--ds-radius-sm);
  background: var(--ds-accent);
}

.drum-timeline__plan {
  position: absolute;
  top: 80%;
  height: calc(var(--ds-space-1) / 2);
  background: var(--ds-text-secondary);
}

.drum-timeline__today {
  position: absolute;
  top: 0;
  bottom: 0;
  width: calc(var(--ds-space-1) / 2);
  background: var(--ds-text-primary);
}

.drum-timeline__note {
  position: absolute;
  top: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  padding-inline-start: var(--ds-space-2);
  color: var(--ds-text-secondary);
  white-space: nowrap;
}

/* A task's plan (issue 89). A member who keeps the zone's schedule opens it
   from the task's title, a button that reads as the title and fills its cell,
   so on touch the row's height is its target; a long press on the row opens
   it too, which no text selection or callout may take on a planner's row, a
   viewer's titles staying selectable. Under a fine pointer a
   bar grabs: its edges, a fraction of a row wide, resize it, and the handle
   just past its end, shown while the row is hovered or a gesture is in hand,
   draws a link. A pinned bar carries a dot over its start and a late one a
   red stripe down its start; the dry run outlines where a task would go and
   marks with a dashed stripe the ones it would make late. Links draw under
   the bars, from a predecessor's end to its successor's start, on a layer
   that takes no pointer. */
.drum-timeline__row--plans {
  user-select: none;
  -webkit-touch-callout: none;
}

/* The two ends of a sheet that keep the focus inside it: focusable, and seen
   by nothing but the keyboard's focus passing through them. */
.drum-sentinel {
  position: absolute;
  inline-size: 0;
  block-size: 0;
  overflow: hidden;
}

.drum-timeline__name {
  display: block;
  inline-size: 100%;
  block-size: 100%;
  margin: 0;
  padding: 0;
  border: none;
  background: none;
  color: inherit;
  font: inherit;
  text-align: start;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  cursor: pointer;
}

.drum-timeline__name:focus-visible {
  outline: calc(var(--ds-space-1) / 2) solid var(--ds-accent);
  outline-offset: calc(var(--ds-space-1) / -2);
}

.drum-timeline__bar--draggable {
  cursor: grab;
}

/* A summary spans its children (issue 91): a thinner bar in the secondary text colour, which no gesture takes. */
.drum-timeline__bar--summary {
  top: 35%;
  height: 30%;
  background: var(--ds-text-secondary);
}

/* A child sits one level under its summary, its title stepped in. */
.drum-timeline__title--child {
  padding-inline-start: var(--ds-space-5);
}

.drum-timeline__bar--held {
  cursor: grabbing;
  opacity: 0.8;
}

.drum-timeline__edge {
  position: absolute;
  top: 0;
  bottom: 0;
  cursor: ew-resize;
}

.drum-timeline__edge--start {
  left: 0;
}

.drum-timeline__edge--end {
  right: 0;
}

.drum-timeline__handle {
  position: absolute;
  top: 50%;
  left: 100%;
  inline-size: var(--ds-space-2);
  block-size: var(--ds-space-2);
  margin-inline-start: var(--ds-space-1);
  transform: translateY(-50%);
  border-radius: var(--ds-radius-sm);
  background: var(--ds-accent);
  cursor: crosshair;
  opacity: 0;
}

.drum-timeline__row:hover .drum-timeline__handle,
.drum-timeline[data-held="true"] .drum-timeline__handle {
  opacity: 1;
}

.drum-timeline__pin {
  position: absolute;
  top: calc(var(--ds-space-1) * -1);
  left: 0;
  inline-size: var(--ds-space-2);
  block-size: var(--ds-space-2);
  border-radius: var(--ds-radius-sm);
  background: var(--ds-text-primary);
  pointer-events: none;
}

.drum-timeline__late {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  inline-size: var(--ds-space-1);
  background: var(--ds-danger);
  pointer-events: none;
}

.drum-timeline__late--previewed {
  top: 25%;
  bottom: auto;
  block-size: 50%;
  background: none;
  border-inline-start: var(--ds-space-1) dashed var(--ds-danger);
}

.drum-timeline__ghost {
  position: absolute;
  top: 25%;
  block-size: 50%;
  box-sizing: border-box;
  border: calc(var(--ds-space-1) / 4) dashed var(--ds-accent);
  border-radius: var(--ds-radius-sm);
  pointer-events: none;
}

.drum-timeline__links {
  position: absolute;
  top: 0;
  left: var(--drum-timeline-title);
  pointer-events: none;
}

.drum-timeline__links svg {
  display: block;
  overflow: visible;
}

.drum-timeline__links path {
  fill: none;
  stroke: var(--ds-text-secondary);
  stroke-width: calc(var(--ds-space-1) / 4);
}

.drum-timeline__links .drum-timeline__drawing {
  stroke: var(--ds-accent);
  stroke-dasharray: var(--ds-space-1);
}

/* A zone's contexts on the home, each a link to its timeline, on a line of
   their own under the zone's name and role. */
.drum-zone__contexts {
  flex-basis: 100%;
  display: flex;
  flex-wrap: wrap;
  gap: var(--ds-space-3);
}

/* The task sheet's duration (issue 22): the free entry beside its taps, wide
   enough for three digits and its spinner. */
.drum-days {
  inline-size: calc(var(--ds-space-6) * 2);
}

/* A linked item's icon on its task's bar (issue 90): its status mark and its
   number on a chip over the bar, or a stack's count where several share a day
   or, below day zoom, the bar. One whose day lies outside the bar sits at its
   nearer end, a triangle pointing out; a chip on the bar's first or last day
   keeps inside the edges that resize it, its triangle taking no pointer, a bar
   too narrow for its chip has it beside its end, and a chip hides while its
   bar is dragged. Its glyph's strokes are the glyph's own geometry. */
.drum-issue {
  position: absolute;
  top: 25%;
  block-size: 50%;
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  gap: calc(var(--ds-space-1) / 2);
  margin: 0;
  padding-block: 0;
  padding-inline: calc(var(--ds-space-1) / 2);
  border: calc(var(--ds-space-1) / 4) solid var(--ds-border);
  border-radius: var(--ds-radius-sm);
  background: var(--ds-surface-0);
  color: var(--ds-text-primary);
  font: inherit;
  font-size: var(--ds-text-micro-size);
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
}

span.drum-issue {
  cursor: default;
}

/* A link drawn as a button, GitHub's connection, reads and measures as the
   button: its box holds its padding and its label sits in its middle. */
a.ds-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  text-decoration: none;
}

.drum-issue:focus-visible {
  outline: calc(var(--ds-space-1) / 2) solid var(--ds-accent);
}

.drum-issue--held {
  visibility: hidden;
}

/* Beside the note of a task not routed, which has no bar to carry it: in the
   note's own row of items, after its words or its button. */
.drum-issue--noted {
  position: static;
  margin-inline-start: var(--ds-space-2);
}

.drum-issue__mark {
  flex: none;
  inline-size: var(--ds-space-3);
  block-size: var(--ds-space-3);
}

.drum-issue--open .drum-issue__mark {
  color: var(--ds-success);
}

.drum-issue--closed .drum-issue__mark {
  color: var(--ds-accent);
}

.drum-issue--not-planned .drum-issue__mark {
  color: var(--ds-text-secondary);
}

.drum-issue--stale .drum-issue__mark {
  color: var(--ds-warning);
}

.drum-issue--waiting .drum-issue__mark {
  color: var(--ds-text-secondary);
}

.drum-issue--attention .drum-issue__mark {
  color: var(--ds-danger);
}

.drum-issue--end {
  translate: -100% 0;
}

/* Past the end of a bar too narrow for its chip, and past the link handle
   there: the handle's own margin and width, and its margin again. */
.drum-issue--beyond {
  margin-inline-start: calc(var(--ds-space-1) * 2 + var(--ds-space-2));
}

.drum-issue--before::before,
.drum-issue--after::after {
  content: "";
  position: absolute;
  top: 50%;
  translate: 0 -50%;
  border-block: var(--ds-space-1) solid transparent;
  pointer-events: none;
}

.drum-issue--before::before {
  right: 100%;
  border-inline-end: var(--ds-space-1) solid var(--ds-text-secondary);
}

.drum-issue--after::after {
  left: 100%;
  border-inline-start: var(--ds-space-1) solid var(--ds-text-secondary);
}

/* A task's issues in its plan (issue 90), each a link on a line of its own,
   tall enough to take a finger, its status beside it. */
.drum-issues {
  display: flex;
  flex-direction: column;
  gap: var(--ds-space-1);
  margin: 0;
  padding: 0;
  list-style: none;
}

.drum-issues__item {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  column-gap: var(--ds-space-2);
}

.drum-issues__item > a {
  display: inline-flex;
  align-items: center;
  min-block-size: var(--ds-target-min);
}

/* The inbox (issue 21): one column of cards that keeps a readable width on a
   wide screen, ten of the design system's largest spacing steps, and the bar
   of the last change, sticky at the top of the viewport over the cards that
   scroll under it, so that a card settled far down the list keeps its undo in
   view. A card's actions wrap, a rejection apart from the others, and a
   rework's reasons are labels as tall as a target, which a finger takes. */
.drum-inbox {
  width: 100%;
  max-width: calc(10 * var(--ds-space-8));
}

.drum-inbox__bar {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--ds-surface-0);
}

.drum-inbox__bar:has(button, .drum-notice, [role="status"]:not(:empty)) {
  padding-block: var(--ds-space-1);
}

/* From the page's first settlement on the bar keeps the room of its undo,
   which stays in it hidden while nothing is offered, so that no card moves
   under a finger as the bar fills and empties; and a control the keyboard
   reaches scrolls clear of the bar, whose height the undo's target and its
   spacing bound. */
.drum-inbox--working .drum-inbox__bar {
  padding-block: var(--ds-space-1);
}

.drum-inbox__undo--idle {
  visibility: hidden;
}

html:has(.drum-inbox--working) {
  scroll-padding-block-start: calc(var(--ds-target-min) + 2 * var(--ds-space-3));
}

/* A control whose answer is out says so to the eye too. */
.drum-inbox [aria-disabled="true"] {
  cursor: progress;
  background: var(--ds-surface-3);
  border-color: var(--ds-border);
  color: var(--ds-text-secondary);
}

.drum-inbox__list {
  display: grid;
  gap: var(--ds-space-3);
  margin: 0;
  padding: 0;
  list-style: none;
}

.drum-inbox__item {
  border-radius: var(--ds-radius-md);
  overflow-wrap: anywhere;
  min-width: 0;
}

.drum-inbox__item:focus-visible {
  outline: calc(var(--ds-space-1) / 2) solid var(--ds-accent);
}

.drum-inbox__ask {
  font-weight: var(--ds-text-body-strong-weight);
}

.drum-inbox__actions,
.drum-inbox__reasons {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--ds-space-2);
}

.drum-inbox__reject {
  margin-inline-start: auto;
}

.drum-inbox__reason {
  display: inline-flex;
  align-items: center;
  gap: var(--ds-space-1);
  min-block-size: var(--ds-target-min);
}

/* What waits on the reader in GitHub (issue 92): a strip above the inbox's
   cards, its entries a list of links each as tall as a target, their parts
   wrapping, the key the one part underlined, a draft marked in the secondary
   text's colour, and the title, mirrored content from GitHub, in a block a
   rule on its start marks off; under a coarse pointer a toggle as wide as the
   column shows the count and opens the entries. */
.drum-waiting {
  border-block-end: calc(var(--ds-space-1) / 4) solid var(--ds-border);
  padding-block-end: var(--ds-space-3);
}

.drum-waiting__list {
  display: grid;
  gap: var(--ds-space-1);
  margin: 0;
  padding: 0;
  list-style: none;
}

.drum-waiting__link {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: var(--ds-space-1) var(--ds-space-2);
  min-block-size: var(--ds-target-min);
  padding-block: var(--ds-space-1);
  overflow-wrap: anywhere;
  text-decoration: none;
}

.drum-waiting__link .drum-address {
  text-decoration: underline;
}

.drum-waiting__kind {
  font-weight: var(--ds-text-body-strong-weight);
}

.drum-waiting__draft {
  color: var(--ds-text-secondary);
}

.drum-waiting__mirrored {
  border-inline-start: calc(var(--ds-space-1) / 2) solid var(--ds-border);
  padding-inline-start: var(--ds-space-2);
  color: var(--ds-text-primary);
}

.drum-waiting__toggle {
  inline-size: 100%;
  justify-content: flex-start;
}

/* The entries a closed toggle hides, which the stack's grid would draw all
   the same, an author's display outranking the attribute's own. */
.drum-waiting [hidden] {
  display: none;
}

/* The task list (issue 24): its rows in a column that keeps a readable width
   on a wide screen, as the inbox's does, and the rework rate's card beside
   them where the line holds both, after them on a narrow screen, where the
   card wraps below the rows rather than push them down; the filters a strip
   of links as tall as a target that wraps rather than scrolls, the one shown
   marked as the design system marks a tab; each row divided from the next by
   a rule, its title, its status with who does it and its dates, and where it
   lives stacked, the row a link names marked by the accent's edge. */
.drum-tasks {
  width: 100%;
  max-width: calc(16 * var(--ds-space-8));
}

.drum-tasks__layout {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: var(--ds-space-5);
}

.drum-tasks__main {
  flex: 1 1 calc(8 * var(--ds-space-8));
  max-width: calc(10 * var(--ds-space-8));
  min-width: 0;
}

.drum-tasks__rate {
  flex: 1 1 calc(4 * var(--ds-space-8));
  max-width: calc(10 * var(--ds-space-8));
  min-width: 0;
}

.drum-tasks__filters {
  display: flex;
  flex-wrap: wrap;
  column-gap: var(--ds-space-1);
  border-block-end: calc(var(--ds-space-1) / 4) solid var(--ds-border);
}

.drum-tasks__filter {
  display: inline-flex;
  align-items: center;
  gap: var(--ds-space-1);
  min-block-size: var(--ds-target-min);
  padding-inline: var(--ds-space-2);
  border-block-end: calc(var(--ds-space-1) / 2) solid transparent;
  color: var(--ds-text-secondary);
  text-decoration: none;
}

.drum-tasks__filter[aria-current] {
  color: var(--ds-text-primary);
  font-weight: var(--ds-text-body-strong-weight);
  border-block-end-color: var(--ds-accent);
}

.drum-tasks__filter:focus-visible,
.drum-tasks__item:focus-visible {
  outline: calc(var(--ds-space-1) / 2) solid var(--ds-accent);
}

.drum-tasks__count {
  font-variant-numeric: tabular-nums;
}

.drum-tasks__list {
  display: grid;
  margin: 0;
  padding: 0;
  list-style: none;
}

.drum-tasks__item {
  display: grid;
  gap: var(--ds-space-1);
  padding-block: var(--ds-space-3);
  border-block-end: calc(var(--ds-space-1) / 4) solid var(--ds-border);
  overflow-wrap: anywhere;
  min-width: 0;
}

.drum-tasks__item[aria-current] {
  padding-inline-start: var(--ds-space-3);
  border-inline-start: var(--ds-space-1) solid var(--ds-accent);
}

.drum-tasks__item > p,
.drum-tasks__rate p {
  margin: 0;
}

.drum-tasks__title {
  justify-self: start;
  font-weight: var(--ds-text-body-strong-weight);
}

.drum-tasks__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--ds-space-2);
}

.drum-tasks__kind,
.drum-tasks__headline {
  margin: 0;
  font-size: var(--ds-text-body-size);
  font-weight: var(--ds-text-body-strong-weight);
}
