/*
 * The components.
 *
 * Every value here is a `var(--gw-*)`. There is no color, no font size, no radius
 * and no duration written literally in this file — which is what lets one adapter
 * move all of it onto Material, Carbon or Primer without touching a rule.
 *
 * Layout uses logical properties throughout (`inline-start`, `padding-inline`), so
 * right-to-left is a `dir` attribute rather than a rewrite.
 *
 * Load order: tokens → contract.css → adapters/<system>.css → this file.
 */

/* ------------------------------------------------------------------ */
/* `hidden` means hidden                                               */
/* ------------------------------------------------------------------ */

/*
 * `[hidden] { display: none }` is a UA rule, and any author `display` outranks
 * the entire UA stylesheet — so every component below that sets a `display`
 * would render while carrying `hidden`. Measured on `.gw-selection`, which
 * offered its Clear and Move buttons with nothing selected.
 *
 * `!important` is load bearing: without it the next `display` declaration in
 * this file wins again, which is the defect rather than a workaround for it.
 * Toggle visibility with `el.hidden`, and this rule is what makes that work.
 */
[hidden] {
  display: none !important;
}

/* ------------------------------------------------------------------ */
/* The surfaces the browser paints                                     */
/* ------------------------------------------------------------------ */

/*
 * Selection, the caret, the scrollbar, and the accent on native controls.
 *
 * Every one of these has a browser default that belongs to no design system, and
 * a page that themes fifty custom properties and then highlights text in the
 * operating system's blue is the cheapest tell there is that it was built rather
 * than assembled. This library adapts onto eleven systems and left all four at
 * their defaults on every one of them.
 *
 * No new tokens. `--gw-action` and `--gw-action-ink` are already in the contract,
 * already remapped by every adapter, and already carry the obligation
 * `--gw-action-ink on --gw-action >= 4.5` that the contrast gate proves in light
 * and dark against all twelve themes — so selected text is legible by the same
 * proof that makes a primary button legible, rather than by a new promise nobody
 * measured.
 *
 * `:where()` gives every rule here zero specificity, so a product that wants its
 * own selection color writes one ordinary declaration and wins. These are
 * defaults for an axis nobody set, not decisions being taken away.
 */
:where(::selection) {
  background: var(--gw-action);
  color: var(--gw-action-ink);
}

:where(:root) {
  /* Checkboxes, radios and the rest of the controls the browser finishes for
     you. Set once at the root rather than per component, which is how it was:
     one rule reached the switch and nothing else. */
  accent-color: var(--gw-action);
  /* Thumb, then track. Firefox reads this directly; Chromium reads it since 121.
     Deliberately not the ::-webkit-scrollbar pseudo-elements, which replace the
     scrollbar wholesale and take its platform behavior with it. */
  scrollbar-color: var(--gw-border-strong) transparent;
}

:where(.gw-input, .gw-select, .gw-textarea) {
  caret-color: var(--gw-action);
}

/* ------------------------------------------------------------------ */
/* Outcome notice                                                      */
/* ------------------------------------------------------------------ */

.gw-notice {
  display: flex;
  gap: var(--gw-space-3);
  padding: var(--gw-space-3) var(--gw-space-4);
  /* The stripe is on the leading edge, which is where every system that has an
     inline notification puts it, and where it survives a language change. */
  border-inline-start: 3px solid var(--gw-tone-refused-edge);
  border-radius: var(--gw-radius-1);
  background: var(--gw-tone-refused-fill);
  color: var(--gw-tone-refused-ink);
  font: var(--gw-weight-normal, 400) var(--gw-size-body) / var(--gw-line) var(--gw-font);
}

/* An empty live region stays mounted so that the next outcome is announced. A
   region inserted at the same moment as its text is often not read at all. */
.gw-notice:empty {
  display: none;
}

.gw-notice[data-tone="done"] {
  border-inline-start-color: var(--gw-tone-done-edge);
  background: var(--gw-tone-done-fill);
  color: var(--gw-tone-done-ink);
}
.gw-notice[data-tone="waiting"] {
  border-inline-start-color: var(--gw-tone-waiting-edge);
  background: var(--gw-tone-waiting-fill);
  color: var(--gw-tone-waiting-ink);
}
.gw-notice[data-tone="mixed"] {
  border-inline-start-color: var(--gw-tone-mixed-edge);
  background: var(--gw-tone-mixed-fill);
  color: var(--gw-tone-mixed-ink);
}
.gw-notice[data-tone="refused"] {
  border-inline-start-color: var(--gw-tone-refused-edge);
  background: var(--gw-tone-refused-fill);
  color: var(--gw-tone-refused-ink);
}
.gw-notice[data-tone="faulted"] {
  border-inline-start-color: var(--gw-tone-faulted-edge);
  background: var(--gw-tone-faulted-fill);
  color: var(--gw-tone-faulted-ink);
}

/* The icon is a second channel, never the only one — the word beside it says the
   same thing. `currentColor` keeps it on the ink the adapter chose. */
.gw-notice__mark {
  flex: none;
  inline-size: 20px;
  block-size: 20px;
  margin-block-start: 2px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.gw-notice__body {
  min-inline-size: 0;
}

.gw-notice__headline {
  margin: 0;
  font-size: var(--gw-size-body);
  font-weight: var(--gw-weight-strong);
}

.gw-notice__guidance {
  margin: var(--gw-space-1) 0 0;
  font-size: var(--gw-size-datum);
  /* Not --gw-text-muted: the notice has its own ink, and a muted gray derived
     against the page would be landing on a tinted fill it was never measured on. */
  opacity: 0.9;
}

.gw-notice__breakdown {
  margin: var(--gw-space-3) 0 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: var(--gw-space-1);
  font-size: var(--gw-size-small);
}

.gw-notice__row {
  display: flex;
  gap: var(--gw-space-2);
  align-items: baseline;
}

.gw-notice__key {
  font-family: var(--gw-font-mono);
  font-size: var(--gw-size-micro);
  /* A key is an identifier people compare character by character. Wrapping it
     anywhere is how a serial gets misread. */
  white-space: nowrap;
}

.gw-notice__more {
  margin: var(--gw-space-2) 0 0;
  font-size: var(--gw-size-small);
  opacity: 0.9;
}

/* ------------------------------------------------------------------ */
/* Destructive confirmation                                            */
/* ------------------------------------------------------------------ */

.gw-confirm {
  display: grid;
  gap: var(--gw-space-3);
  padding: var(--gw-space-4);
  border: 1px solid var(--gw-border);
  border-radius: var(--gw-radius-2);
  background: var(--gw-surface-raised);
  color: var(--gw-text);
  font-family: var(--gw-font);
  font-size: var(--gw-size-body);
}

/* The facts come first, before the control — both of them, because the rule being
   enforced asks how many *and* whether it can be undone. */
.gw-confirm__facts {
  margin: 0;
  font-weight: var(--gw-weight-strong);
}

.gw-confirm__targets {
  margin: 0;
  padding: 0;
  list-style: none;
  /* The list grows with the selection, so it crosses its own ceiling while
     somebody is reading it. Reserve the gutter rather than shift the names. */
  scrollbar-gutter: stable;
  display: grid;
  gap: var(--gw-space-1);
  max-block-size: 12rem;
  overflow-y: auto;
  padding: var(--gw-space-2);
  border-radius: var(--gw-radius-1);
  background: var(--gw-surface-sunken);
  font-family: var(--gw-font-mono);
  font-size: var(--gw-size-small);
}

.gw-confirm__instruction {
  margin: 0;
  font-size: var(--gw-size-datum);
  color: var(--gw-text-muted);
}

.gw-confirm__phrase {
  font-family: var(--gw-font-mono);
  font-weight: var(--gw-weight-strong);
  /* Selectable on purpose is wrong here — the phrase exists to be typed. */
  user-select: none;
}

.gw-field {
  display: grid;
  gap: var(--gw-space-1);
}

.gw-field__label {
  font-size: var(--gw-size-datum);
  font-weight: var(--gw-weight-strong);
}

.gw-input {
  min-block-size: var(--gw-control-height);
  padding: 0 var(--gw-space-3);
  border: 1px solid var(--gw-border-strong);
  border-radius: var(--gw-radius-1);
  /* Most systems fill a field with something that is not the page surface —
     Carbon's $field-01, Material's surface-container-highest. The contract
     carries it so the difference survives an adapter swap. */
  background: var(--gw-field);
  color: var(--gw-text);
  font-family: var(--gw-font-mono);
  /* 16px on a coarse pointer, or iOS zooms the page on focus. */
  font-size: var(--gw-size-body);
}

@media (pointer: coarse) {
  .gw-input {
    font-size: max(16px, var(--gw-size-body));
  }
}

.gw-input:focus-visible {
  outline: 2px solid var(--gw-focus);
  outline-offset: 1px;
}

/* ------------------------------------------------------------------ */
/* Buttons                                                             */
/* ------------------------------------------------------------------ */

.gw-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--gw-space-2);
  min-block-size: var(--gw-control-height);
  padding-inline: var(--gw-space-4);
  border: 1px solid var(--gw-border-strong);
  border-radius: var(--gw-radius-1);
  background: var(--gw-surface);
  color: var(--gw-text);
  font: var(--gw-weight-strong) var(--gw-size-body) / 1 var(--gw-font);
  cursor: pointer;
  position: relative;
  /* A button is the micro tier: pressed fifty times an hour, so the fast step. */
  transition: background var(--gw-duration-fast) var(--gw-ease);
}

/* The hit area is padded out to the target minimum without inflating the control,
   so a 32px Primer button is still comfortable on a phone. */
.gw-button::after {
  content: "";
  position: absolute;
  inset: 50% 0 auto;
  translate: 0 -50%;
  block-size: max(100%, var(--gw-target-min));
}

/* Hover and pressed are state layers: the button's own ink at 8% and 10% over
   its resting fill — Material's construction, and a faithful approximation of
   every other system's hover ramp. One rule covers every emphasis, and no
   fill needs hover tokens beside it. The layer sits above the label at an
   opacity the eye reads as a tint, not a veil. */
.gw-button::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: currentColor;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--gw-duration-fast) var(--gw-ease);
}

.gw-button:hover:not(:disabled)::before {
  opacity: 0.08;
}

.gw-button:active:not(:disabled)::before {
  opacity: 0.1;
}

.gw-button:focus-visible {
  outline: 2px solid var(--gw-focus);
  outline-offset: 2px;
}

/* THE action of the view. The collection and form components never emit one —
   which button is primary is the screen's decision, and there is one per view. */
.gw-button[data-emphasis="primary"] {
  border-color: transparent;
  background: var(--gw-action);
  color: var(--gw-action-ink);
}

/* A quiet button: no fill until touched. For the actions a screen must offer
   but should not advertise. */
.gw-button[data-emphasis="quiet"] {
  border-color: transparent;
  background: transparent;
  color: var(--gw-link);
}

.gw-button[data-emphasis="quiet"]:hover:not(:disabled) {
  background: var(--gw-hover);
}

.gw-button[data-emphasis="danger"] {
  border-color: var(--gw-tone-faulted-edge);
  background: var(--gw-tone-faulted-fill);
  color: var(--gw-tone-faulted-ink);
}

.gw-button:disabled {
  cursor: not-allowed;
  opacity: 0.38;
}

/* ------------------------------------------------------------------ */
/* Lists                                                               */
/* ------------------------------------------------------------------ */

.gw-list {
  display: grid;
  gap: var(--gw-space-3);
  font-family: var(--gw-font);
  font-size: var(--gw-size-body);
  color: var(--gw-text);
}

/* The empty states. Three of them, and they are different screens. */
.gw-empty {
  display: grid;
  gap: var(--gw-space-2);
  justify-items: center;
  text-align: center;
  padding: var(--gw-space-6) var(--gw-space-4);
  border: 1px dashed var(--gw-border);
  border-radius: var(--gw-radius-2);
  background: var(--gw-surface-sunken);
}

.gw-empty__headline {
  margin: 0;
  font-size: var(--gw-size-title);
  font-weight: var(--gw-weight-strong);
}

.gw-empty__guidance {
  margin: 0;
  max-inline-size: 44ch;
  color: var(--gw-text-muted);
  font-size: var(--gw-size-datum);
}

/* A refresh that failed keeps its rows and says so. Blanking the screen loses the
   reader's place and tells them less than leaving it there. */
.gw-stale {
  display: flex;
  align-items: center;
  gap: var(--gw-space-2);
  padding: var(--gw-space-2) var(--gw-space-3);
  border-inline-start: 3px solid var(--gw-tone-mixed-edge);
  border-radius: var(--gw-radius-1);
  background: var(--gw-tone-mixed-fill);
  color: var(--gw-tone-mixed-ink);
  font-size: var(--gw-size-datum);
}

/* Skeletons belong only to a list that has never been shown. */
.gw-skeleton {
  display: grid;
  gap: var(--gw-space-2);
}

.gw-skeleton__row {
  block-size: var(--gw-control-height);
  border-radius: var(--gw-radius-1);
  background: var(--gw-surface-sunken);
  animation: gw-pulse 1.6s var(--gw-ease) infinite;
}

@keyframes gw-pulse {
  50% {
    opacity: 0.55;
  }
}

.gw-page {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--gw-space-3);
  color: var(--gw-text-muted);
  font-size: var(--gw-size-datum);
}

/* ------------------------------------------------------------------ */
/* Selection                                                           */
/* ------------------------------------------------------------------ */

.gw-selection {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--gw-space-3);
  padding: var(--gw-space-2) var(--gw-space-3);
  border: 1px solid var(--gw-border);
  border-radius: var(--gw-radius-1);
  background: var(--gw-surface-sunken);
  font-size: var(--gw-size-datum);
}

.gw-selection__count {
  font-weight: var(--gw-weight-strong);
}

/* The escalation from "this page" to "everything matching". It is a button and not
   a link because it changes state rather than navigating, and it names the number
   it is offering so the two selections are told apart before the choice, not after
   the delete. */
.gw-selection__escalate {
  border: 0;
  padding: 0;
  background: none;
  color: inherit;
  font: inherit;
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
}

.gw-selection__escalate:focus-visible {
  outline: 2px solid var(--gw-focus);
  outline-offset: 2px;
}

.gw-selection__actions {
  margin-inline-start: auto;
  display: flex;
  /* Wraps, because two ordinary labels are wider than a phone: measured at
     320px, where an unwrapped row came to 333px and took the whole document
     sideways with it (SC 1.4.10). The bar around this already wrapped; the row
     inside it did not, which is the half nobody checks. */
  flex-wrap: wrap;
  gap: var(--gw-space-2);
}

/* ------------------------------------------------------------------ */
/* Field problems                                                      */
/* ------------------------------------------------------------------ */

/* A rejected field is marked at the input, not collected into a banner where the
   reader has to carry it back across the form. */
.gw-field__problem {
  display: flex;
  align-items: baseline;
  gap: var(--gw-space-1);
  font-size: var(--gw-size-small);
  color: var(--gw-tone-faulted-edge);
}

.gw-field__help {
  font-size: var(--gw-size-small);
  color: var(--gw-text-muted);
}

.gw-field[data-invalid="true"] .gw-input {
  border-color: var(--gw-tone-faulted-edge);
  border-width: 2px;
}

/* ------------------------------------------------------------------ */
/* Motion                                                              */
/* ------------------------------------------------------------------ */

@media (prefers-reduced-motion: reduce) {
  /* Movement goes; opacity stays, so a loading row is still visibly a loading row. */
  .gw-skeleton__row {
    animation-duration: 3s;
  }
  .gw-button {
    transition: none;
  }
}

/* Text that only a screen reader needs. */
.gw-sr-only {
  position: absolute;
  inline-size: 1px;
  block-size: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* ------------------------------------------------------------------ */
/* Field problems and the save control                                 */
/* ------------------------------------------------------------------ */

/*
 * A field message is drawn in the faulted ink and NOT on a faulted fill.
 *
 * A tinted box under every rejected input turns a form with four problems into a
 * page of red blocks, and the reader's eye then has to find the *inputs* inside the
 * decoration. The mark is a thick leading edge on the message and, where the product
 * wires it, on the control — one line, unmissable, and it costs no space.
 */
.gw-field-problem {
  margin-block: var(--gw-space-1) 0;
  padding-inline-start: var(--gw-space-2);
  border-inline-start: 2px solid var(--gw-tone-faulted-edge);
  color: var(--gw-tone-faulted-ink);
  font: var(--gw-size-small) / var(--gw-line) var(--gw-font);
}

.gw-save {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--gw-space-3);
  margin-block-start: var(--gw-space-4);
}

/*
 * The note that stands where a save button is not.
 *
 * It reads as text rather than as a warning: the button is gone, which is the loud
 * part, and painting the explanation in an alarm color on top of that is saying the
 * same thing twice at a volume the situation has not earned.
 */
.gw-save__note {
  margin: 0;
  max-inline-size: 52ch;
  color: var(--gw-text-muted);
  font: var(--gw-size-small) / var(--gw-line) var(--gw-font);
}

/* ------------------------------------------------------------------ */
/* Timeline                                                            */
/* ------------------------------------------------------------------ */

.gw-timeline {
  display: flex;
  flex-direction: column;
  gap: var(--gw-space-5);
}

.gw-timeline__heading {
  margin: 0 0 var(--gw-space-2);
  color: var(--gw-text-muted);
  font: var(--gw-weight-strong) var(--gw-size-small) / var(--gw-line) var(--gw-font);
  /* Sticky so the day a reader is in stays named while they scroll it. The offset is
     zero because the product owns whatever chrome is above this. */
  position: sticky;
  inset-block-start: 0;
  background: var(--gw-surface);
  padding-block: var(--gw-space-1);
}

.gw-timeline__rows {
  margin: 0;
  padding: 0;
  list-style: none;
  /* The spine. One line down the leading edge with the rows hung off it — the shape
     that makes a timeline read as one sequence rather than as a stack of cards. */
  border-inline-start: 1px solid var(--gw-border);
  padding-inline-start: var(--gw-space-4);
}

.gw-timeline__row {
  position: relative;
  padding-block: var(--gw-space-2);
}

.gw-timeline__row + .gw-timeline__row {
  border-block-start: 1px solid var(--gw-border);
}

/* The dot on the spine. Decorative, and sized so it reads at 200% zoom. */
.gw-timeline__row::before {
  content: "";
  position: absolute;
  inset-inline-start: calc(var(--gw-space-4) * -1 - 4px);
  inset-block-start: calc(var(--gw-space-2) + 0.55em);
  inline-size: 7px;
  block-size: 7px;
  border-radius: 50%;
  background: var(--gw-border-strong);
}

.gw-timeline__what {
  margin: 0;
  color: var(--gw-text);
  font: var(--gw-size-body) / var(--gw-line) var(--gw-font);
}

.gw-timeline__count,
.gw-timeline__meta {
  color: var(--gw-text-muted);
  font-size: var(--gw-size-small);
}

.gw-timeline__detail {
  margin: var(--gw-space-1) 0 0;
  color: var(--gw-text-muted);
  font: var(--gw-size-small) / var(--gw-line) var(--gw-font);
}

.gw-timeline__lines {
  margin: var(--gw-space-1) 0 0;
  padding-inline-start: var(--gw-space-4);
  color: var(--gw-text-muted);
  font: var(--gw-size-small) / var(--gw-line) var(--gw-font);
}

.gw-timeline__meta {
  margin: var(--gw-space-1) 0 0;
  font-family: var(--gw-font);
}

.gw-timeline__note {
  margin: var(--gw-space-1) 0 0;
  color: var(--gw-text-faint);
  font: var(--gw-size-micro) / var(--gw-line) var(--gw-font);
}

/*
 * A withheld row.
 *
 * Muted, not hidden, and not styled as an error — nothing has gone wrong. The dot
 * stays on the spine at full strength, because the point of keeping the row is that
 * the reader can see there is something between Tuesday and Friday.
 */
.gw-timeline__row--withheld .gw-timeline__what {
  color: var(--gw-text-muted);
  font-style: italic;
}

/* ------------------------------------------------------------------ */
/* Primitives                                                          */
/* ------------------------------------------------------------------ */

/*
 * Below this line the components stop rendering view models and start rendering
 * whatever the product hands them. That is a real change of kind, and it is worth
 * naming: everything above is a decision this library made, and everything here is
 * a surface the library merely draws consistently across eleven design systems.
 *
 * The rule that keeps it honest is that no primitive introduces a color pair the
 * contract has not already proved. One was added for the progress track and is
 * declared in contract.css like the rest; every other rule below reuses a pair that
 * was already verified against every adapter in both modes.
 */

.gw-card {
  display: flex;
  flex-direction: column;
  gap: var(--gw-space-3);
  padding: var(--gw-space-4);
  border: 1px solid var(--gw-border);
  border-radius: var(--gw-radius-2);
  background: var(--gw-surface-raised);
  color: var(--gw-text);
  font: var(--gw-weight-normal, 400) var(--gw-size-body) / var(--gw-line) var(--gw-font);
}

.gw-card__heading {
  margin: 0;
  font-size: var(--gw-size-title);
  font-weight: var(--gw-weight-strong);
}

/* The one-line description under a heading. Muted, so the heading still leads. */
.gw-card__lede {
  margin: 0;
  color: var(--gw-text-muted);
  font-size: var(--gw-size-small);
}

.gw-card__footer {
  display: flex;
  gap: var(--gw-space-2);
  align-items: center;
  margin-block-start: auto;
}

/* ------------------------------------------------------------------ badge */

/*
 * The five tones are the same five the notice uses, and that is the point: a row
 * marked "refused" in a table and a notice announcing a refusal must not be two
 * different colors, or the reader learns two vocabularies for one fact.
 */
.gw-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--gw-space-1);
  padding: 0 var(--gw-space-2);
  border: 1px solid var(--gw-tone-waiting-edge);
  border-radius: var(--gw-radius-1);
  background: var(--gw-tone-waiting-fill);
  color: var(--gw-tone-waiting-ink);
  font: var(--gw-weight-strong) var(--gw-size-micro) / calc(var(--gw-space-5)) var(--gw-font);
  white-space: nowrap;
}

.gw-badge[data-tone="done"] {
  border-color: var(--gw-tone-done-edge);
  background: var(--gw-tone-done-fill);
  color: var(--gw-tone-done-ink);
}

.gw-badge[data-tone="mixed"] {
  border-color: var(--gw-tone-mixed-edge);
  background: var(--gw-tone-mixed-fill);
  color: var(--gw-tone-mixed-ink);
}

.gw-badge[data-tone="refused"] {
  border-color: var(--gw-tone-refused-edge);
  background: var(--gw-tone-refused-fill);
  color: var(--gw-tone-refused-ink);
}

.gw-badge[data-tone="faulted"] {
  border-color: var(--gw-tone-faulted-edge);
  background: var(--gw-tone-faulted-fill);
  color: var(--gw-tone-faulted-ink);
}

/* Neutral is not a tone. It is the absence of one, and it must not read as done. */
.gw-badge[data-tone="neutral"] {
  border-color: var(--gw-border-strong);
  background: var(--gw-surface-sunken);
  color: var(--gw-text);
}

/* ------------------------------------------------------------------ divider */

.gw-divider {
  border: 0;
  border-block-start: 1px solid var(--gw-border);
  margin-block: var(--gw-space-4);
}

/* A labeled divider is a rule with a word in it, so the rule is drawn by the
   pseudo-elements and the element itself carries the text. */
.gw-divider--labelled {
  display: flex;
  align-items: center;
  gap: var(--gw-space-3);
  border-block-start: 0;
  color: var(--gw-text-muted);
  font: var(--gw-weight-strong) var(--gw-size-micro) / 1 var(--gw-font);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.gw-divider--labelled::before,
.gw-divider--labelled::after {
  content: "";
  flex: 1;
  border-block-start: 1px solid var(--gw-border);
}

/* ------------------------------------------------------------------ progress */

.gw-progress {
  display: flex;
  flex-direction: column;
  gap: var(--gw-space-1);
  font: var(--gw-weight-normal, 400) var(--gw-size-micro) / var(--gw-line) var(--gw-font);
  color: var(--gw-text-muted);
}

/* The line under the bar: "412 of 900 rows". A percentage with no denominator is
   the same defect as a rate with no count. */
.gw-progress__note {
  color: var(--gw-text-muted);
}

.gw-progress__track {
  block-size: var(--gw-space-2);
  border-radius: var(--gw-radius-1);
  background: var(--gw-surface-sunken);
  overflow: hidden;
}

.gw-progress__fill {
  block-size: 100%;
  background: var(--gw-action);
  /* The macro tier: a bar that moves on its own, so the slow step. */
  transition: inline-size var(--gw-duration-slow) var(--gw-ease);
}

/*
 * Indeterminate is a genuinely different statement — "working, length unknown" —
 * and drawing it as a full bar would say "finished". It animates, so it is the one
 * rule in this file that has to answer prefers-reduced-motion.
 */
.gw-progress[data-determinate="false"] .gw-progress__fill {
  inline-size: 40%;
  animation: gw-progress-slide 1.6s var(--gw-ease) infinite;
}

@keyframes gw-progress-slide {
  from {
    transform: translateX(-100%);
  }
  to {
    transform: translateX(250%);
  }
}

@media (prefers-reduced-motion: reduce) {
  .gw-progress[data-determinate="false"] .gw-progress__fill {
    animation: none;
    /* Still visibly partial, so it does not read as complete. */
    inline-size: 40%;
  }

  .gw-progress__fill {
    transition: none;
  }
}

/* ------------------------------------------------------------------ avatar */

.gw-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  inline-size: var(--gw-space-6);
  block-size: var(--gw-space-6);
  border-radius: 50%;
  background: var(--gw-action);
  color: var(--gw-action-ink);
  font: var(--gw-weight-strong) var(--gw-size-micro) / 1 var(--gw-font);
  overflow: hidden;
  user-select: none;
}

.gw-avatar__image {
  inline-size: 100%;
  block-size: 100%;
  object-fit: cover;
}

/* ------------------------------------------------------------------ breadcrumb */

.gw-breadcrumb {
  font: var(--gw-weight-normal, 400) var(--gw-size-small) / var(--gw-line) var(--gw-font);
}

.gw-breadcrumb__list {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--gw-space-2);
  margin: 0;
  padding: 0;
  list-style: none;
}

.gw-breadcrumb__item {
  display: flex;
  align-items: center;
  gap: var(--gw-space-2);
  color: var(--gw-text-muted);
}

/* The separator is a pseudo-element so it is never read aloud as a word. */
.gw-breadcrumb__item + .gw-breadcrumb__item::before {
  content: "/";
  color: var(--gw-text-faint);
}

.gw-breadcrumb__link {
  color: var(--gw-link);
  text-decoration: underline;
}

.gw-breadcrumb__link:focus-visible {
  outline: 2px solid var(--gw-focus);
  outline-offset: 2px;
}

/* The last crumb is where you are, so it is text rather than a link. */
.gw-breadcrumb__current {
  color: var(--gw-text);
  font-weight: var(--gw-weight-strong);
}

/* ------------------------------------------------------------------ pairs */

.gw-pairs {
  display: grid;
  grid-template-columns: minmax(0, auto) minmax(0, 1fr);
  gap: var(--gw-space-2) var(--gw-space-4);
  margin: 0;
  font: var(--gw-weight-normal, 400) var(--gw-size-body) / var(--gw-line) var(--gw-font);
}

.gw-pairs__term {
  color: var(--gw-text-muted);
  font-size: var(--gw-size-datum);
  font-weight: var(--gw-weight-strong);
}

.gw-pairs__detail {
  margin: 0;
  color: var(--gw-text);
  /* Stored text: a pasted URL must not pin the column open. */
  overflow-wrap: anywhere;
}

/* ------------------------------------------------------------------ table */

.gw-table-wrap {
  inline-size: 100%;
  overflow-x: auto;
}

.gw-table {
  inline-size: 100%;
  border-collapse: collapse;
  font: var(--gw-weight-normal, 400) var(--gw-size-body) / var(--gw-line) var(--gw-font);
  color: var(--gw-text);
}

.gw-table__caption {
  text-align: start;
  padding-block-end: var(--gw-space-2);
  color: var(--gw-text-muted);
  font-size: var(--gw-size-small);
}

.gw-table__head-cell {
  padding: var(--gw-space-2) var(--gw-space-3);
  border-block-end: 1px solid var(--gw-border-strong);
  text-align: start;
  font-size: var(--gw-size-datum);
  font-weight: var(--gw-weight-strong);
  white-space: nowrap;
}

.gw-table__cell {
  padding: var(--gw-space-2) var(--gw-space-3);
  border-block-end: 1px solid var(--gw-border);
  text-align: start;
  overflow-wrap: anywhere;
}

/* Numbers line up on the right, and only numbers do. A right-aligned word is a
   typo the reader has to check. */
.gw-table__head-cell[data-align="end"],
.gw-table__cell[data-align="end"] {
  text-align: end;
  font-variant-numeric: tabular-nums;
}

.gw-table__row:hover .gw-table__cell {
  background: var(--gw-hover);
}

/* The column of checkboxes carries no data, so it takes no more width than the
   control in it, and its header is a name for a screen reader rather than a
   word on the screen -- a column headed "Select" above a column of boxes says
   twice what the boxes already say. */
/*
 * The identity cell's link to its record. WCAG 2.2 SC 2.5.8 wants 24x24, and
 * the spacing exception cannot rescue this one: measured 2026-09-11 in the
 * scaffolded app at 375px, the link was 138x19 with another target 2px away,
 * because the stacked record puts its checkbox directly above the name. Text
 * that is 19px tall needs the target grown around it rather than the text
 * enlarged, which is why this sets a block size and not a font size.
 */
.gw-table__link {
  display: inline-flex;
  align-items: center;
  min-block-size: 24px;
}

.gw-table__select {
  inline-size: 1px;
  white-space: nowrap;
  padding: var(--gw-space-2) var(--gw-space-3);
  border-block-end: 1px solid var(--gw-border);
  vertical-align: middle;
}

thead .gw-table__select {
  border-block-end: 1px solid var(--gw-border-strong);
}

/* A value is read digit against digit whatever the alignment, so the KIND of
   value decides this rather than which edge it sits against. A time and an id
   are numbers for this purpose and for no other: they are compared, never
   summed. */
.gw-table__cell[data-type="number"],
.gw-table__cell[data-type="time"],
.gw-table__cell[data-type="id"] {
  font-variant-numeric: tabular-nums;
}

/* The identity cell is a <th> in the body, so it arrives carrying the UA's bold
   and centered defaults. Say what it should be rather than inheriting an answer
   nobody chose: aligned with every other cell, and weighted because it is what
   tells the reader which row this is. */
th.gw-table__cell {
  text-align: start;
  font-weight: var(--gw-weight-strong);
}

th.gw-table__cell[data-align="end"] {
  text-align: end;
}

/* ABSENCE is a state with words behind it, and it must be visible to a reader
   who is not using the words: a blank cell says nothing, and says it in a way
   that reads as zero. A dash for a value that is known to be missing, a hollow
   box for one that has not arrived yet. */
.gw-table__cell [data-absent="null"]::after {
  content: "\2014";
  color: var(--gw-text-muted);
}

.gw-table__cell [data-absent="pending"]::after {
  content: "";
  display: inline-block;
  vertical-align: middle;
  inline-size: 2.5ch;
  block-size: 1em;
  border: 1px dashed var(--gw-border);
}

/* ------------------------------------------------------------------ pagination */

.gw-pagination {
  display: flex;
  align-items: center;
  gap: var(--gw-space-3);
  font: var(--gw-weight-normal, 400) var(--gw-size-small) / var(--gw-line) var(--gw-font);
  color: var(--gw-text-muted);
}

.gw-pagination__summary {
  font-variant-numeric: tabular-nums;
}

.gw-pagination__step {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-inline-size: var(--gw-target-min);
  min-block-size: var(--gw-target-min);
  padding-inline: var(--gw-space-3);
  border: 1px solid var(--gw-border-strong);
  border-radius: var(--gw-radius-1);
  background: var(--gw-surface);
  color: var(--gw-text);
  font-weight: var(--gw-weight-strong);
  text-decoration: none;
  transition: background-color var(--gw-duration-fast) var(--gw-ease);
}

.gw-pagination__step:hover {
  background: var(--gw-hover);
}

/* The step is an <a>, so it gets no ::before state layer the way .gw-button
   does -- it paints its own. Pressed is the state that fires at the moment
   the control is actually used, and on a touch screen, where there is no
   hover at all, it is the only feedback there is. */
.gw-pagination__step:active {
  background: var(--gw-active);
}

.gw-pagination__step:focus-visible {
  outline: 2px solid var(--gw-focus);
  outline-offset: 2px;
}

/*
 * At the first or last page the step is a <span>, not a disabled <a>. A disabled
 * link is not a thing HTML has, and the ARIA imitation of one is skipped by some
 * screen readers and read as a live link by others.
 */
.gw-pagination__step--spent {
  border-style: dashed;
  background: var(--gw-surface-sunken);
  color: var(--gw-text-muted);
}

/* ------------------------------------------------------------------ toolbar */

.gw-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--gw-space-2);
  padding: var(--gw-space-2);
  border: 1px solid var(--gw-border);
  border-radius: var(--gw-radius-1);
  background: var(--gw-surface-sunken);
}

/* Everything after this pushes to the far end: the destructive action lives away
   from the ones pressed all day. */
.gw-toolbar__gap {
  flex: 1;
}

.gw-cluster {
  display: inline-flex;
  align-items: center;
}

/* A group of buttons is one control to the eye, so the seams collapse. */
.gw-cluster > .gw-button {
  border-radius: 0;
  margin-inline-start: -1px;
}

.gw-cluster > .gw-button:first-child {
  border-start-start-radius: var(--gw-radius-1);
  border-end-start-radius: var(--gw-radius-1);
  margin-inline-start: 0;
}

.gw-cluster > .gw-button:last-child {
  border-start-end-radius: var(--gw-radius-1);
  border-end-end-radius: var(--gw-radius-1);
}

/* Raise the focused button so its ring is not clipped by the next one. */
.gw-cluster > .gw-button:focus-visible {
  z-index: 1;
}

/* ------------------------------------------------------------------ controls */

.gw-select,
.gw-textarea {
  min-block-size: var(--gw-control-height);
  padding: var(--gw-space-2) var(--gw-space-3);
  border: 1px solid var(--gw-border-strong);
  border-radius: var(--gw-radius-1);
  background: var(--gw-field);
  color: var(--gw-text);
  font-family: var(--gw-font);
  font-size: var(--gw-size-body);
}

.gw-textarea {
  font-family: var(--gw-font-mono);
  resize: vertical;
}

@media (pointer: coarse) {
  .gw-select,
  .gw-textarea {
    font-size: max(16px, var(--gw-size-body));
  }
}

.gw-select:focus-visible,
.gw-textarea:focus-visible {
  outline: 2px solid var(--gw-focus);
  outline-offset: 1px;
}

/*
 * The tick and the switch keep the real <input>, visible to the accessibility tree
 * and to the keyboard. Nothing here hides it behind a div: `appearance: none` on a
 * live checkbox keeps the semantics and takes only the paint.
 */
.gw-choice {
  display: flex;
  align-items: center;
  gap: var(--gw-space-3);
  min-block-size: var(--gw-target-min);
  color: var(--gw-text);
  font: var(--gw-weight-normal, 400) var(--gw-size-body) / var(--gw-line) var(--gw-font);
  cursor: pointer;
}

.gw-choice__control {
  flex: none;
  inline-size: var(--gw-space-4);
  block-size: var(--gw-space-4);
  accent-color: var(--gw-action);
}

.gw-choice__control:focus-visible {
  outline: 2px solid var(--gw-focus);
  outline-offset: 2px;
}

.gw-choice__text {
  display: block;
}

.gw-choice__note {
  display: block;
  color: var(--gw-text-muted);
  font-size: var(--gw-size-small);
}

/*
 * A switch is a checkbox that says its state is already in force — "on", not "will
 * be on when you save". That is a semantic difference, so it is role="switch" and
 * not a restyled checkbox with a different word next to it.
 */
.gw-switch__control {
  flex: none;
  inline-size: calc(var(--gw-space-6) + var(--gw-space-1));
  block-size: var(--gw-space-5);
  padding: 2px;
  border: 1px solid var(--gw-border-strong);
  border-radius: var(--gw-space-5);
  background: var(--gw-surface-sunken);
  cursor: pointer;
  transition: background var(--gw-duration-fast) var(--gw-ease);
}

.gw-switch__control[aria-checked="true"] {
  border-color: var(--gw-action);
  background: var(--gw-action);
}

.gw-switch__thumb {
  display: block;
  inline-size: calc(var(--gw-space-5) - 6px);
  block-size: calc(var(--gw-space-5) - 6px);
  border-radius: 50%;
  background: var(--gw-surface);
  transition: transform var(--gw-duration-fast) var(--gw-ease);
}

.gw-switch__control[aria-checked="true"] .gw-switch__thumb {
  background: var(--gw-action-ink);
  transform: translateX(100%);
}

.gw-switch__control:focus-visible {
  outline: 2px solid var(--gw-focus);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  .gw-switch__control,
  .gw-switch__thumb {
    transition: none;
  }
}

/* ------------------------------------------------------------------ */
/* The interactive layer                                               */
/* ------------------------------------------------------------------ */

/*
 * Presentation for the six surfaces in `packages/react/src/interactive.ts`. The
 * behavior is not here and cannot be: a focus trap is not a style. What IS here is
 * everything a keyboard contract needs the page to actually do — a panel that
 * paints over the page rather than beside it, a menu that is not clipped by its
 * own row, a focus ring that is not cropped by the strip it sits in.
 *
 * The same two rules as the rest of this file: every value is a `var(--gw-*)`, and
 * layout is in logical properties so `dir="rtl"` needs no second stylesheet.
 */

.gw-scrim {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  padding: var(--gw-space-4);
  background: var(--gw-scrim);
  /* Centered for a dialog; a sheet pins itself to an edge below. */
  align-items: center;
  justify-content: center;
}

.gw-scrim[data-variant="sheet"] {
  padding: 0;
  align-items: stretch;
  justify-content: flex-end;
}

.gw-dialog {
  display: flex;
  flex-direction: column;
  /* min() rather than a media query: the panel is the smaller of its comfortable
     width and the viewport, so at 320px it is still inside the screen with the
     scrim's padding intact, and at 1600px it does not become a page. */
  inline-size: min(36rem, 100%);
  max-block-size: 100%;
  border: 1px solid var(--gw-border);
  border-radius: var(--gw-radius-2);
  background: var(--gw-surface);
  color: var(--gw-text);
  font-family: var(--gw-font);
  font-size: var(--gw-size-body);
}

.gw-dialog[data-variant="sheet"] {
  inline-size: min(28rem, 100%);
  max-block-size: none;
  block-size: 100%;
  border-radius: 0;
  border-block: 0;
  border-inline-end: 0;
}

/* A sheet arrives from the side on a pointer and from the BOTTOM on a touch
   screen, and that is one component with one variant rather than two.

   The rule was that `sheet` meant the inline edge at every size, which on a
   phone is a full-width panel sliding in from the right — the far corner from
   where a thumb rests, and an entrance no touch platform uses. The edge is a
   property of the hand, so the query is `pointer: coarse` and not a width: this
   contract carries no width breakpoints at all, on purpose, because the design
   system on top of it owns those numbers and they are not the same number
   twice. Centauri's surface layer then restates this at its own 600px, which is
   the value its nav and its table already share.

   `dvh` rather than `vh`: on a phone the URL bar is part of the viewport by the
   `vh` definition and not by the visible one, so `85vh` puts the sheet's
   actions under the browser chrome exactly while somebody reaches for them. */
@media (pointer: coarse) {
  .gw-scrim[data-variant="sheet"] {
    align-items: flex-end;
  }

  .gw-dialog[data-variant="sheet"] {
    inline-size: 100%;
    block-size: auto;
    max-block-size: 85dvh;
    border-block-start: 1px solid var(--gw-border);
    border-inline: 0;
    border-radius: var(--gw-radius-2) var(--gw-radius-2) 0 0;
    padding-block-end: env(safe-area-inset-bottom, 0px);
  }
}

/* The container is focusable so a panel with nothing tabbable in it still takes
   focus. It is focusable by script only, so the ring appears when focus was PUT
   there and never on a pointer press. */
.gw-dialog:focus-visible {
  outline: 2px solid var(--gw-focus);
  outline-offset: -4px;
}

.gw-dialog__head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: var(--gw-space-2);
  padding: var(--gw-space-4);
  border-block-end: 1px solid var(--gw-border);
}

.gw-dialog__heading {
  flex: 1 1 auto;
  margin: 0;
  font-size: var(--gw-size-title);
  font-weight: var(--gw-weight-strong);
  line-height: var(--gw-line);
}

.gw-dialog__lede {
  flex: 1 1 100%;
  margin: 0;
  color: var(--gw-text-muted);
  font-size: var(--gw-size-small);
}

.gw-dialog__close {
  flex: none;
  min-inline-size: var(--gw-target-min);
  min-block-size: var(--gw-target-min);
  border: 1px solid transparent;
  border-radius: var(--gw-radius-1);
  background: none;
  color: var(--gw-text-muted);
  font: inherit;
  cursor: pointer;
}

.gw-dialog__close:hover {
  background: var(--gw-hover);
  color: var(--gw-text);
  transition: background var(--gw-duration-fast) var(--gw-ease),
              color var(--gw-duration-fast) var(--gw-ease);
}

/* The close button is the one control in a dialog everybody reaches for, and
   it had one of the two states a pointer can express. `--gw-active` is the
   token the contract already carries for exactly this. */
.gw-dialog__close:active {
  background: var(--gw-active);
  color: var(--gw-text);
}

.gw-dialog__close:focus-visible {
  outline: 2px solid var(--gw-focus);
  outline-offset: 2px;
}

.gw-dialog__body {
  /* The one scrolling region, so the head and the foot stay put. `min-block-size`
     is what makes it scroll at all: a flex child's minimum is its content, so
     without this the panel grows past the viewport instead. */
  flex: 1 1 auto;
  min-block-size: 0;
  overflow-y: auto;
  scrollbar-gutter: stable;
  padding: var(--gw-space-4);
}

.gw-dialog__foot {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: var(--gw-space-2);
  padding: var(--gw-space-4);
  border-block-start: 1px solid var(--gw-border);
}

/* Menu ------------------------------------------------------------------- */

/* A panel that `useAnchored` has promoted to the top layer. It is out of every
   clipping and transformed ancestor up the tree, which is the whole point, and
   the price is that it is now positioned against the VIEWPORT — so the anchoring
   the rules below express as `inset-block-start: 100%` no longer means anything
   and the hook writes physical left/top instead.

   Kept in its own rule rather than folded into each panel: `:popover-open` is
   unknown to a browser without the Popover API, and an unknown pseudo-class
   invalidates the selector it appears in. On its own it takes only this block
   down with it, and every panel keeps the absolute positioning it has today. */
.gw-menu__list:popover-open,
.gw-popover__panel:popover-open,
.gw-combobox__list:popover-open {
  position: fixed;
  inset: auto;
  margin: 0;
  overflow-y: auto;
  /* Reserved either way, so a panel that grows past its ceiling does not shove
     its own content sideways at the moment the scrollbar appears. */
  scrollbar-gutter: stable;
  /* The UA stylesheet gives `[popover]` its own border; each panel already
     declares one, and two would read as a double rule. */
  border-width: 1px;
}

.gw-menu {
  position: relative;
  display: inline-block;
}

.gw-menu__list {
  position: absolute;
  z-index: 50;
  inset-block-start: calc(100% + var(--gw-space-1));
  inset-inline-start: 0;
  min-inline-size: 12rem;
  max-block-size: 20rem;
  overflow-y: auto;
  scrollbar-gutter: stable;
  padding: var(--gw-space-1);
  border: 1px solid var(--gw-border);
  border-radius: var(--gw-radius-1);
  background: var(--gw-surface-raised);
}

.gw-menu__item {
  display: block;
  inline-size: 100%;
  min-block-size: var(--gw-target-min);
  padding-inline: var(--gw-space-3);
  padding-block: var(--gw-space-2);
  border: 0;
  border-radius: var(--gw-radius-1);
  background: none;
  color: var(--gw-text);
  font: inherit;
  text-align: start;
  cursor: pointer;
}

.gw-menu__item:hover:not(:disabled) {
  background: var(--gw-hover);
}

.gw-menu__item:active:not(:disabled) {
  background: var(--gw-active);
}

.gw-menu__item[data-tone="critical"] {
  color: var(--gw-tone-faulted-ink);
}

.gw-menu__item:disabled {
  color: var(--gw-text-muted);
  cursor: not-allowed;
}

/* Inset, because the ring is drawn inside a panel that scrolls: an outset ring on
   the first item is cropped by the panel's own overflow. */
.gw-menu__item:focus-visible {
  outline: 2px solid var(--gw-focus);
  outline-offset: -2px;
}

/* Popover ----------------------------------------------------------------- */

.gw-popover {
  position: relative;
  display: inline-block;
}

.gw-popover__panel {
  position: absolute;
  z-index: 50;
  inset-block-start: calc(100% + var(--gw-space-1));
  inset-inline-start: 0;
  inline-size: max-content;
  max-inline-size: min(24rem, 90vw);
  padding: var(--gw-space-3);
  border: 1px solid var(--gw-border);
  border-radius: var(--gw-radius-1);
  background: var(--gw-surface-raised);
  color: var(--gw-text);
}

/* Tabs -------------------------------------------------------------------- */

.gw-tabs__list {
  display: flex;
  gap: var(--gw-space-1);
  /* Scrolls rather than wraps: a tab strip that wraps to a second line stops
     reading as one control, and the roving arrow keys then move in an order the
     eye cannot follow. */
  overflow-x: auto;
  border-block-end: 1px solid var(--gw-border);
}

.gw-tabs__tab {
  flex: none;
  min-block-size: var(--gw-target-min);
  padding-inline: var(--gw-space-3);
  border: 0;
  /* The selected marker is a rule, drawn on the tab rather than on the strip, so
     it moves with the tab when the strip scrolls. */
  border-block-end: 2px solid transparent;
  background: none;
  color: var(--gw-text-muted);
  font: inherit;
  cursor: pointer;
}

.gw-tabs__tab[aria-selected="true"] {
  border-block-end-color: var(--gw-action);
  color: var(--gw-text);
  font-weight: var(--gw-weight-strong);
}

.gw-tabs__tab:hover:not(:disabled) {
  background: var(--gw-hover);
  transition: background var(--gw-duration-fast) var(--gw-ease);
}

.gw-tabs__tab:active:not(:disabled) {
  background: var(--gw-active);
}

.gw-tabs__tab:disabled {
  color: var(--gw-text-faint);
  cursor: not-allowed;
}

/* Inset again, and for a measured reason: an outset ring on a tab inside a strip
   with `overflow-x: auto` is drawn outside the strip's padding box and clipped,
   which is a real defect found in a browser rather than a hypothesis. */
.gw-tabs__tab:focus-visible {
  outline: 2px solid var(--gw-focus);
  outline-offset: -3px;
}

.gw-tabs__panel {
  padding-block: var(--gw-space-4);
}

.gw-tabs__panel:focus-visible {
  outline: 2px solid var(--gw-focus);
  outline-offset: -2px;
}

/* Navigation -------------------------------------------------------------- */

.gw-nav {
  display: flex;
  background: var(--gw-shell);
}

/* The list carries the row, so the layout lands on one element a nav layer can
   redirect into a column. The anchors used to be direct children of `.gw-nav`
   and every layer that made the nav a rail had to undo their growth by hand.

   A GRID of equal columns rather than a flex row of growing items, and that is
   the whole reason this holds up inside a rail. Equal seats written as
   `flex: 1 1 0` on the item mean equal HEIGHTS the moment a layer turns the
   list into a column — the same defect moved down one element — whereas
   `grid-auto-columns` simply stops applying, because a layer that wants a
   column says `display: flex` and a grid property on a flex container is inert.
   `.centauri-nav ul` is one class and one type, so it outranks this whatever
   the load order, which is what makes the override reliable rather than lucky. */
.gw-nav__list {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  flex: 1 1 auto;
  gap: var(--gw-space-1);
  margin: 0;
  padding: 0;
  list-style: none;
}

/* No growth here on purpose — see above. The item is a box for the link. */
.gw-nav__item {
  display: flex;
  min-inline-size: 0;
}

.gw-nav__link {
  display: flex;
  flex: 1 1 auto;
  align-items: center;
  justify-content: center;
  gap: var(--gw-space-2);
  min-block-size: var(--gw-target-min);
  padding-inline: var(--gw-space-3);
  color: var(--gw-shell-ink-muted);
  font-size: var(--gw-size-small);
  text-decoration: none;
}

/* The collapse control. Square, so it is the same target collapsed or not, and
   transparent, because it is chrome on chrome rather than a thing to press. */
.gw-nav__toggle {
  display: inline-flex;
  flex: none;
  align-items: center;
  justify-content: center;
  inline-size: var(--gw-target-min);
  min-block-size: var(--gw-target-min);
  border: 0;
  background: transparent;
  color: var(--gw-shell-ink-muted);
  cursor: pointer;
}

.gw-nav__toggle:hover {
  background: var(--gw-shell-hover);
  color: var(--gw-shell-ink);
  transition: background var(--gw-duration-fast) var(--gw-ease),
              color var(--gw-duration-fast) var(--gw-ease);
}

.gw-nav__toggle:focus-visible {
  outline: 2px solid var(--gw-shell-accent);
  outline-offset: -3px;
}

.gw-nav__link:hover {
  background: var(--gw-shell-hover);
  color: var(--gw-shell-ink);
  /* A state that arrives in one frame reads as a repaint rather than as a
     response. `--gw-duration-fast` is the rung this library gives an in-place
     color change, and it is the same one `.gw-button::before` takes. */
  transition: background var(--gw-duration-fast) var(--gw-ease),
              color var(--gw-duration-fast) var(--gw-ease);
}

/* PRESSED, drawn the way every other control here draws it: a `currentColor`
   layer at an opacity, not a second background token. A pointer can reach two
   states and most generated navigation ships one of them, so the link goes
   dead under the finger at the moment it is being used. The idiom is
   `.gw-button::before` above — same construction, same opacities, no new token
   and so nothing new for the contrast gate to measure. */
.gw-nav__link,
.gw-nav__toggle {
  position: relative;
  isolation: isolate;
}

.gw-nav__link::before,
.gw-nav__toggle::before {
  content: "";
  position: absolute;
  inset: 0;
  background: currentColor;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--gw-duration-fast) var(--gw-ease);
}

/* The pressed state says the same two things hover says — this is the ground
   under the pointer, and this is the ink on it — and then the layer below
   deepens it. Both halves on purpose: the background is what a checker and a
   high-contrast mode can both see, and the layer is the 10% Material 3 gives
   pressed over hover's 8%, which is the difference a finger feels.

   Written out per selector rather than grouped: `craft_lint.py` reads a rule's
   whole selector list as one string, so `a:active, b:active` is a press state
   for neither of them as far as it can tell. */
.gw-nav__link:active {
  background: var(--gw-shell-hover);
  color: var(--gw-shell-ink);
}

.gw-nav__toggle:active {
  background: var(--gw-shell-hover);
  color: var(--gw-shell-ink);
}

.gw-nav__link:active::before,
.gw-nav__toggle:active::before {
  opacity: 0.1;
}

/* Where the reader is, marked in the markup by `aria-current` and read from it
   here — so the mark cannot drift out of step with what a screen reader says. */
.gw-nav__link[aria-current="page"] {
  color: var(--gw-shell-ink);
  box-shadow: inset 0 -2px 0 0 var(--gw-shell-accent);
}

.gw-nav__link:focus-visible {
  outline: 2px solid var(--gw-shell-accent);
  outline-offset: -3px;
}

/* Combobox ---------------------------------------------------------------- */

.gw-combobox {
  position: relative;
  display: block;
}

.gw-combobox__label {
  display: block;
  margin-block-end: var(--gw-space-1);
  color: var(--gw-text-muted);
  font-size: var(--gw-size-small);
}

.gw-combobox__input {
  inline-size: 100%;
  min-block-size: var(--gw-control-height);
  padding-inline: var(--gw-space-2);
  border: 1px solid var(--gw-border-strong);
  border-radius: var(--gw-radius-1);
  background: var(--gw-field);
  color: var(--gw-text);
  font: inherit;
}

.gw-combobox__input:focus-visible {
  outline: 2px solid var(--gw-focus);
  outline-offset: 1px;
}

.gw-combobox__list {
  position: absolute;
  z-index: 50;
  inset-block-start: 100%;
  inset-inline: 0;
  max-block-size: 16rem;
  overflow-y: auto;
  /* A combobox list filters as somebody types, so it crosses its own ceiling
     mid-interaction — the one panel where the scrollbar genuinely appears and
     vanishes under the reader's eyes. */
  scrollbar-gutter: stable;
  margin: var(--gw-space-1) 0 0;
  padding: var(--gw-space-1);
  border: 1px solid var(--gw-border);
  border-radius: var(--gw-radius-1);
  background: var(--gw-surface-raised);
  list-style: none;
}

.gw-combobox__option {
  padding-inline: var(--gw-space-2);
  padding-block: var(--gw-space-2);
  border-radius: var(--gw-radius-1);
  cursor: pointer;
}

/* The ACTIVE option, which is not the focused element — focus never leaves the
   input. This is the only visual difference between "the arrow keys are here" and
   "this is your value", and dropping it is what makes an accessible combobox
   unusable for everyone who can see it. */
.gw-combobox__option[aria-selected="true"] {
  background: var(--gw-action-muted);
  color: var(--gw-action-muted-ink);
}

.gw-combobox__option[aria-disabled="true"] {
  color: var(--gw-text-muted);
  cursor: not-allowed;
}

/* Workbench --------------------------------------------------------------- */

.gw-workbench {
  display: flex;
  flex-direction: column;
  gap: var(--gw-space-3);
}

.gw-workbench__toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--gw-space-2);
}

/* Sticky so a selection of four thousand rows does not scroll away from the bar
   that acts on it. `inset-block-start` is mandatory — `position: sticky` with no
   inset never sticks, and nothing warns. */
.gw-workbench__selection {
  position: sticky;
  inset-block-start: 0;
  z-index: 10;
}

.gw-workbench__list {
  min-block-size: 0;
}

/* An empty selection region stays in the accessibility tree.
   `display: none` and the `hidden` attribute both remove it, and a live region
   that is not in the tree before its text arrives is frequently not announced —
   so it is clipped instead, which leaves it present and takes no space. */
.gw-workbench__selection[data-selected="false"] {
  position: absolute;
  inline-size: 1px;
  block-size: 1px;
  padding: 0;
  border: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
