/* ==========================================================================
   Exile Tools — Components
   Layout primitives, site chrome, controls, data display, feedback.
   ========================================================================== */

/* --------------------------------------------------------------------------
   Layout primitives
   -------------------------------------------------------------------------- */
.container {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.site-main {
  flex: 1 0 auto;
  padding-block: var(--space-7) var(--space-9);
}
.site-main--flush { padding-block: 0; }
.site-main--hero { padding-top: 0; }

.page-head {
  display: grid;
  gap: var(--space-4);
  padding-bottom: var(--space-6);
  margin-bottom: var(--space-7);
}
.page-head p { color: var(--text-muted); font-size: var(--fs-lead); line-height: 1.45; }

.section + .section { margin-top: var(--space-8); }
.section__title { margin-bottom: var(--space-4); }

.stack > * + * { margin-top: var(--space-4); }

.icon {
  width: 20px;
  height: 20px;
  flex: none;
  fill: currentColor;
}
.icon--stroke { fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: square; stroke-linejoin: miter; }
.icon--sm { width: 16px; height: 16px; }

/* --------------------------------------------------------------------------
   Site header — floating navigation
   No bar, no shadow, no rule. The navigation floats over whatever is behind it
   (the hero artwork on home), carried by a soft vertical scrim that fades from
   the top edge to transparent. It sits under the league bar and is sticky:
   the banner scrolls away with the page, the navigation stays at the top. Once
   the page scrolls (site.js sets .is-compact) it settles into a compact state —
   lower, smaller logo, and a slightly denser, blurred scrim that still dissolves
   downwards, so it stays legible over changing backgrounds without turning
   back into a bar.
   The header's box has a constant height and a negative bottom margin of the
   same size, so it never takes space in the flow: the compact state, the open
   mobile menu (position: fixed) — nothing below it moves. Pages leave room for
   it with a top margin on <main>; on home the hero runs underneath it.
   -------------------------------------------------------------------------- */
body:not(.page-home) .site-main { margin-top: var(--header-h); }

.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  isolation: isolate;
  height: var(--header-h);
  margin-bottom: calc(-1 * var(--header-h));
  color: var(--text);
  pointer-events: none; /* the box is taller than the compact bar: let clicks through the empty part */
}
.site-header__bar > * { pointer-events: auto; }
/* Scrim, floating state: a tall, very soft falloff from the top edge */
.site-header::before,
.site-header::after {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  z-index: -1;
  pointer-events: none;
  transition: opacity var(--motion-medium) var(--ease-ui);
}
.site-header::before {
  height: calc(var(--header-h) + 88px);
  background: linear-gradient(180deg,
    var(--header-scrim) 0%,
    color-mix(in srgb, var(--header-scrim) 55%, transparent) 42%,
    color-mix(in srgb, var(--header-scrim) 18%, transparent) 72%,
    transparent 100%);
}
/* Scrim, compact state: denser and blurred, but masked so it still ends in nothing */
.site-header::after {
  height: calc(var(--header-h-compact) + 40px);
  background: linear-gradient(180deg, var(--header-scrim-compact) 0%, var(--header-scrim-compact) 55%, transparent 100%);
  -webkit-backdrop-filter: blur(12px) saturate(1.1);
  backdrop-filter: blur(12px) saturate(1.1);
  -webkit-mask-image: linear-gradient(180deg, #000 0%, #000 52%, transparent 100%);
  mask-image: linear-gradient(180deg, #000 0%, #000 52%, transparent 100%);
  opacity: 0;
}
.site-header.is-compact::before { opacity: 0; }
.site-header.is-compact::after { opacity: 1; }

.site-header__bar {
  display: flex;
  align-items: center;
  gap: var(--space-6);
  min-height: var(--header-h);
  transition: min-height var(--motion-medium) var(--ease-ui);
}
.site-header.is-compact .site-header__bar { min-height: var(--header-h-compact); }

.brand {
  display: inline-flex;
  align-items: center;
  flex: none;
  padding-block: var(--space-2);
}
/* The logo is the largest piece of chrome; compact, it scales down (transform only, no reflow) */
.brand img {
  width: 196px;
  height: auto;
  transform-origin: 0 50%;
  transition: transform var(--motion-medium) var(--ease-ui);
}
.site-header.is-compact .brand img { transform: scale(0.74); }
.brand__logo--on-dark { display: block; }
.brand__logo--on-light { display: none; }
:root[data-theme="light"] .brand__logo--on-dark { display: none; }
:root[data-theme="light"] .brand__logo--on-light { display: block; }

/* Main navigation — Familjen Grotesk labels (readable at a glance); the active page is marked by a small cut facet
   (the gem / waypoint motif of the artwork) under the label, hover previews it */
.site-nav { margin-left: auto; }
.site-nav__list {
  display: flex;
  align-items: stretch;
  gap: var(--space-1);
  margin: 0;
  padding: 0;
  list-style: none;
}
.site-nav__link {
  position: relative;
  display: flex;
  align-items: center;
  min-height: var(--header-h);
  padding-inline: var(--space-4);
  font-family: var(--font-head);
  font-size: var(--fs-nav);
  font-weight: 600;
  letter-spacing: 0.01em;
  color: var(--text-muted);
  text-decoration: none;
  text-shadow: 0 1px 14px var(--bg);
  transition:
    color var(--motion-fast) var(--ease-ui),
    min-height var(--motion-medium) var(--ease-ui);
}
.site-header.is-compact .site-nav__link { min-height: var(--header-h-compact); }
.site-nav__link::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 22px;
  width: 7px;
  height: 7px;
  background: var(--border-strong);
  opacity: 0;
  transform: translate(-50%, 3px) rotate(45deg) scale(0.6);
  transition:
    opacity var(--motion-fast) var(--ease-ui),
    transform var(--motion-fast) var(--ease-ui),
    background-color var(--motion-fast) var(--ease-ui),
    bottom var(--motion-medium) var(--ease-ui);
}
.site-header.is-compact .site-nav__link::after { bottom: 8px; }
.site-nav__link:hover { color: var(--text); }
.site-nav__link:hover::after { opacity: 1; transform: translate(-50%, 0) rotate(45deg) scale(0.75); }
.site-nav__link[aria-current="page"] { color: var(--text); }
.site-nav__link[aria-current="page"]::after {
  opacity: 1;
  background: var(--accent);
  box-shadow: 0 0 12px 1px color-mix(in srgb, var(--accent) 55%, transparent);
  transform: translate(-50%, 0) rotate(45deg);
}
.site-nav__link:focus-visible { outline-offset: -10px; }

.site-header__tools {
  display: flex;
  align-items: center;
  gap: var(--space-1);
}

.icon-link,
.icon-button {
  display: inline-grid;
  place-items: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 0;
  border-radius: var(--radius);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  text-decoration: none;
  transition: color var(--motion-fast) var(--ease-ui), background-color var(--motion-fast) var(--ease-ui);
}
.icon-link:hover,
.icon-button:hover { color: var(--text); background: color-mix(in srgb, var(--surface-raised) 72%, transparent); }
.icon-button:active { background: var(--surface); }

/* Theme switch: shows the theme you would switch to */
.theme-toggle .icon-sun { display: none; }
:root[data-theme="dark"] .theme-toggle .icon-sun,
:root:not([data-theme]) .theme-toggle .icon-sun { display: block; }
:root[data-theme="dark"] .theme-toggle .icon-moon,
:root:not([data-theme]) .theme-toggle .icon-moon { display: none; }

.menu-toggle {
  display: none;
  align-items: center;
  gap: var(--space-2);
  margin-left: auto;
  min-height: 44px;
  padding: 0 var(--space-3) 0 var(--space-2);
  border: 0;
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--surface-raised) 64%, transparent);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  font-family: var(--font-head);
  font-size: 17px;
  font-weight: 600;
  cursor: pointer;
  transition: background-color var(--motion-fast) var(--ease-ui);
}
.menu-toggle:hover { background: var(--surface-raised); }
.menu-toggle .icon-close { display: none; }
.menu-toggle[aria-expanded="true"] .icon-open { display: none; }
.menu-toggle[aria-expanded="true"] .icon-close { display: block; }

@media (max-width: 960px) {
  .site-header__bar { gap: var(--space-4); }
  .site-nav__link { padding-inline: var(--space-3); }
  .brand img { width: 176px; }
}

@media (max-width: 860px) {
  :root { --header-h: 72px; --header-h-compact: 56px; }
  .brand img { width: 168px; }
  .site-header.is-compact .brand img { transform: scale(0.8); }
  .menu-toggle { display: inline-flex; }
  .site-header__bar { flex-wrap: wrap; gap: 0 var(--space-3); }
  .site-nav,
  .site-header__tools { display: none; width: 100%; }
  /* Open menu: a full panel (the one place the navigation gets a surface), large entries,
     the facet moves to the left. Fixed to the viewport while open (its box leaves no gap in the flow). */
  .site-header.is-open {
    position: fixed;
    inset: 0;
    height: auto;
    pointer-events: auto;
    min-height: 100svh; /* the open menu takes the whole screen: no half-covered artwork below it */
    max-height: 100svh;
    overflow-y: auto;
    overscroll-behavior: contain;
    background: var(--header-menu-bg);
  }
  .site-header.is-open::before,
  .site-header.is-open::after { opacity: 0; }
  .site-header.is-open .site-nav,
  .site-header.is-open .site-header__tools { display: flex; }
  .site-header.is-open .site-nav { animation: quiet-reveal var(--motion-medium) var(--ease-ui) both; }
  .site-nav { margin-left: 0; padding-top: var(--space-3); }
  .site-nav__list { flex-direction: column; width: 100%; gap: var(--space-1); }
  .site-nav__link,
  .site-header.is-compact .site-nav__link {
    min-height: 52px;
    padding-inline: var(--space-6) var(--space-3);
    font-size: 24px;
    color: var(--text);
    text-shadow: none;
  }
  .site-nav__link:hover { background: var(--surface); }
  .site-nav__link::after,
  .site-header.is-compact .site-nav__link::after { left: var(--space-2); bottom: auto; top: 50%; transform: translate(0, -50%) rotate(45deg) scale(0.6); }
  .site-nav__link:hover::after { transform: translate(0, -50%) rotate(45deg) scale(0.8); }
  .site-nav__link[aria-current="page"]::after { transform: translate(0, -50%) rotate(45deg); }
  .site-header__tools {
    padding: var(--space-4) 0 var(--space-5);
    justify-content: flex-start;
  }
}

@media (prefers-reduced-motion: reduce) {
  .site-header::before,
  .site-header::after,
  .site-header__bar,
  .brand img,
  .site-nav__link,
  .site-nav__link::after { transition: none; }
}

/* --------------------------------------------------------------------------
   League bar (home/league.html) — one compact line above the navigation, on
   every page: the league name, the time left, a link. Warm anthracite in both
   themes, no artwork, no pills, no rules. One accent: a coral signal light
   before the league name that breathes slowly (opacity + glow, 3.6 s — still
   under reduced motion) and leads the eye along the line to the countdown.
   A soft coral scrim (#D95C65) falls from the top edge and has faded out
   completely before the bottom — warm light, not a red bar.
   The name speaks in the display voice; the figures stay in Instrument Sans,
   tabular, in fixed-width cells (Orbitron has no tabular figures), so ticking
   never shifts the line. It scrolls away with the page; the sticky navigation
   below is unaffected. Fixed height (--league-h) — on small screens two fixed
   lines — so it never shifts the layout.
   -------------------------------------------------------------------------- */
:root { --league-h: 52px; }

.league-bar {
  --lb-bg: #1C191B;
  --lb-ink: #F2ECE6;
  --lb-muted: #ADA5A1;          /* 7:1 on --lb-bg */
  --lb-accent: var(--coral-primary);
  --lb-accent-text: var(--coral-soft);
  position: relative;
  z-index: 41; /* above the sticky navigation's scrim while both are on screen */
  height: var(--league-h);
  overflow: hidden;
  background:
    linear-gradient(180deg,
      rgb(217 92 101 / 0.17) 0%,
      rgb(217 92 101 / 0.07) 45%,
      rgb(217 92 101 / 0) 100%),
    var(--lb-bg);
  color: var(--lb-muted);
  font-size: var(--fs-ui-sm);
  line-height: 1;
}

.league-bar__inner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-5);
  height: 100%;
  max-width: var(--container); /* not the paragraph measure */
  white-space: nowrap;
}

.league-bar__name {
  display: inline-flex;
  align-items: center;
  gap: var(--space-3);
  font-family: var(--font-display);
  font-size: var(--fs-ui-sm);
  font-weight: var(--display-weight);
  letter-spacing: 0.04em;
  color: var(--lb-ink);
}
.league-bar__name [data-countdown-live] { margin-left: -0.3em; color: var(--lb-accent-text); }

/* The signal: a coral point with a soft halo; breathes, never blinks, never moves */
.league-bar__signal {
  flex: none;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--lb-accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--lb-accent) 18%, transparent), 0 0 12px 1px color-mix(in srgb, var(--lb-accent) 55%, transparent);
  animation: league-signal 3.6s var(--ease-drift) infinite;
}
@keyframes league-signal {
  0%, 100% { opacity: 0.55; box-shadow: 0 0 0 2px color-mix(in srgb, var(--lb-accent) 10%, transparent), 0 0 6px 0 color-mix(in srgb, var(--lb-accent) 30%, transparent); }
  50%      { opacity: 1;    box-shadow: 0 0 0 4px color-mix(in srgb, var(--lb-accent) 20%, transparent), 0 0 16px 2px color-mix(in srgb, var(--lb-accent) 60%, transparent); }
}

.league-bar__item { display: inline-flex; align-items: center; gap: var(--space-5); }
.league-bar__item::before { content: "·"; color: var(--lb-muted); opacity: 0.6; }
.league-bar__item[hidden] { display: none; }

.league-bar__label { margin-right: calc(-1 * var(--space-3)); }
.league-bar__clock {
  color: var(--lb-ink);
  font-size: var(--fs-ui);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.01em;
}
.league-bar__clock .num { display: inline-block; min-width: 2ch; text-align: right; }
.league-bar__clock > span[aria-hidden] { margin: 0 0.3em 0 0.08em; color: var(--lb-muted); font-size: var(--fs-meta); font-weight: 500; }
.league-bar__clock > span[aria-hidden]:last-of-type { margin-right: 0; }

.league-bar__link {
  min-height: 32px;
  color: var(--lb-muted);
  font-weight: 500;
  text-decoration: underline;
  text-decoration-color: transparent;
  text-underline-offset: 4px;
  transition: color var(--motion-fast) var(--ease-ui), text-decoration-color var(--motion-fast) var(--ease-ui);
}
.league-bar__link .icon {
  width: 14px;
  height: 14px;
  margin-left: calc(-1 * var(--space-5) + 6px);
  color: var(--lb-accent);
  transition: translate var(--motion-fast) var(--ease-ui);
}
.league-bar__link:hover,
.league-bar__link:focus-visible { color: var(--lb-ink); text-decoration-color: color-mix(in srgb, var(--lb-accent) 70%, transparent); }
.league-bar__link:hover .icon { translate: 2px 0; }

@media (max-width: 860px) {
  .league-bar__inner,
  .league-bar__item { gap: var(--space-4); }
  .league-bar__label { margin-right: calc(-1 * var(--space-2)); }
  .league-bar__link .icon { margin-left: calc(-1 * var(--space-4) + 6px); }
}

/* Small screens: two fixed lines — the name above, countdown and link below */
@media (max-width: 640px) {
  :root { --league-h: 60px; }
  .league-bar__inner {
    flex-wrap: wrap;
    align-content: center;
    gap: var(--space-2) var(--space-4);
  }
  .league-bar__name { flex: 0 0 100%; justify-content: center; font-size: 13px; }
  .league-bar__item::before { content: none; }
  .league-bar__label { display: none; }
  .league-bar__clock { font-size: var(--fs-ui-sm); }
  .league-bar__link { min-height: 24px; font-size: var(--fs-meta); }
  .league-bar__link .icon { margin-left: calc(-1 * var(--space-4) + 4px); }
}
@media (max-width: 360px) {
  .league-bar__link-more { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .league-bar__signal { animation: none; opacity: 1; }
  .league-bar__link,
  .league-bar__link .icon { transition: none; }
}

/* --------------------------------------------------------------------------
   Buttons
   -------------------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-height: 44px;
  padding: 0 var(--space-5);
  border: var(--rule) solid transparent;
  border-radius: var(--radius);
  font-family: var(--font-ui);
  font-size: var(--fs-ui);
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: 0.005em;
  text-align: center;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition:
    background-color var(--motion-fast) var(--ease-ui),
    border-color var(--motion-fast) var(--ease-ui),
    color var(--motion-fast) var(--ease-ui),
    transform var(--motion-fast) var(--ease-ui);
}
.btn:hover:not(:disabled):not([aria-busy="true"]) { transform: translateY(-1px); }
.btn:active:not(:disabled) { transform: translateY(0); }

.btn--primary { background: var(--btn-primary-bg); color: var(--on-accent); }
.btn--primary:hover { background: var(--btn-primary-hover); color: var(--on-accent); }
.btn--primary:active { background: var(--btn-primary-active); }

.btn--secondary { background: transparent; color: var(--text); border-color: var(--border-strong); }
.btn--secondary:hover { border-color: var(--text); color: var(--text); }
.btn--secondary:active { background: var(--surface-raised); }

.btn--text {
  min-height: 0;
  padding: var(--space-1) 0;
  background: none;
  color: var(--text);
  text-decoration: underline;
  text-decoration-color: var(--accent);
  text-underline-offset: 0.25em;
}
.btn--text:hover { color: var(--accent-text); }

.btn--sm { min-height: 34px; padding: 0 var(--space-3); font-size: var(--fs-ui-sm); }

.btn:disabled,
.btn[aria-disabled="true"] {
  opacity: 0.45;
  cursor: not-allowed;
}
.btn[aria-busy="true"] { cursor: progress; opacity: 0.75; }

.btn .icon { width: 16px; height: 16px; }

.button-row { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-3) var(--space-5); }

/* --------------------------------------------------------------------------
   Forms
   -------------------------------------------------------------------------- */
.field { display: grid; gap: var(--space-2); }
.field__label { font-size: var(--fs-ui-sm); font-weight: 600; color: var(--text); }
.field__help { font-size: var(--fs-meta); color: var(--text-muted); }

.input,
.select {
  width: 100%;
  min-height: 48px;
  padding: 0 var(--space-4);
  border: var(--rule) solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  font-size: var(--fs-body);
  transition: border-color var(--motion-fast) var(--ease-ui), background-color var(--motion-fast) var(--ease-ui);
}
.input::placeholder { color: var(--text-muted); opacity: 1; }
.input:hover, .select:hover { border-color: var(--text-muted); }
.input:focus-visible, .select:focus-visible { border-color: var(--focus); outline: 2px solid var(--focus); outline-offset: 0; }
.input[aria-invalid="true"] { border-color: var(--status-danger); }

.select {
  min-height: 36px;
  padding: 0 34px 0 var(--space-3);
  font-size: var(--fs-ui-sm);
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, currentColor 50%), linear-gradient(135deg, currentColor 50%, transparent 50%);
  background-position: calc(100% - 17px) 50%, calc(100% - 12px) 50%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
}

.check {
  display: inline-flex;
  align-items: flex-start;
  gap: var(--space-3);
  cursor: pointer;
  line-height: 1.4;
}
.check input[type="checkbox"] {
  flex: none;
  width: 18px;
  height: 18px;
  margin: 2px 0 0;
  accent-color: var(--accent);
  cursor: pointer;
}
.check input:disabled { cursor: not-allowed; }

/* --------------------------------------------------------------------------
   Row cards — the one surface + hover system for lists of entries
   Every entry is its own flat, wide surface a step above the page (--surface-row),
   separated by space (--row-gap), never by a rule. Interactive rows (.row-card--live)
   lift 2px under the pointer or keyboard focus, brighten one step and deepen their
   shadow; a row that carries a gem colour (--gem) lets it flow in as a faint tint,
   a light behind the icon (.row-card__icon) and a coloured shadow. Static data rows
   only brighten. State that is not hover (selected, changed, taken) is drawn by the
   component itself and stays visible without hover.
   -------------------------------------------------------------------------- */
.row-cards { display: grid; gap: var(--row-gap); margin: 0; padding: 0; list-style: none; }

.row-card {
  position: relative;
  background: var(--surface-row);
  border-radius: var(--radius-surface);
  box-shadow: var(--shadow-row);
  transition:
    background-color var(--motion-surface) var(--ease-ui),
    box-shadow var(--motion-surface) var(--ease-ui),
    translate var(--motion-surface) var(--ease-ui);
}
.row-card--live:hover,
.row-card--live:focus-within {
  background: var(--surface-row-hover);
  box-shadow: var(--shadow-row-hover);
  translate: 0 var(--lift);
}
/* gem rows carry their gem colour as a thin edge on the left, always visible
   (--gem-edge at rest, --gem-edge-hover under the pointer, which also lets a faint
   light of it reach a few pixels into the row: --gem-edge-light). Inset shadows, so
   the edge follows the corner radius. Declared on the row, where --gem is known;
   data-table rows (the Gem Plan) use them too. On hover the colour also flows into
   the surface and the shadow. */
:where(.row-card--gem, .data-table tbody tr) {
  --gem-edge: inset var(--gem-edge-w) 0 0 color-mix(in srgb, var(--gem, var(--gem-none)) var(--gem-edge-rest), transparent);
  --gem-edge-hover: inset var(--gem-edge-w) 0 0 var(--gem, var(--gem-none));
  --gem-edge-light: inset 10px 0 12px -8px color-mix(in srgb, var(--gem, var(--gem-none)) var(--gem-edge-glow), transparent);
}
.row-card--gem {
  box-shadow: var(--shadow-row), var(--gem-edge);
}
.row-card--gem:hover,
.row-card--gem:focus-within {
  background: color-mix(in srgb, var(--gem, var(--gem-none)) var(--gem-tint), var(--surface-row-hover));
  box-shadow:
    var(--gem-edge-hover),
    var(--gem-edge-light),
    var(--shadow-row-hover),
    0 10px 22px -16px color-mix(in srgb, var(--gem, var(--gem-none)) 55%, transparent);
}
/* a diffuse light in the gem colour behind the icon (.row-card__icon), following its shape */
.row-card__icon { transition: filter var(--motion-surface) var(--ease-ui); }
.row-card--gem:hover .row-card__icon,
.row-card--gem:focus-within .row-card__icon {
  filter: drop-shadow(0 0 7px color-mix(in srgb, var(--gem, var(--gem-none)) var(--gem-glow), transparent));
}

/* --------------------------------------------------------------------------
   Data table — rows are row cards: the cells carry the surface, rounded at the
   ends, with border-spacing as the gap. The shadow is a filter on the row
   (--drop-row), so it follows all cells as one surface. Interactive tables add
   .data-table--live for the lift.
   -------------------------------------------------------------------------- */
.table-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding-inline: 2px; /* room for the cards' soft edges inside the scroller */
  margin-inline: -2px;
}

.data-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0 var(--row-gap);
  font-size: var(--fs-ui-sm);
  font-variant-numeric: tabular-nums;
}
.data-table th,
.data-table td {
  padding: var(--space-3) var(--space-4);
  text-align: left;
  vertical-align: middle;
}
.data-table thead th {
  padding-block: 0;
  font-size: var(--fs-meta);
  font-weight: 600;
  color: var(--text-muted);
  white-space: nowrap;
}
.data-table tbody tr {
  --row-bg: var(--surface-row);
  --row-drop: var(--drop-row);
  filter: var(--row-drop);
  transition:
    filter var(--motion-surface) var(--ease-ui),
    translate var(--motion-surface) var(--ease-ui);
}
.data-table tbody td,
.data-table tbody th {
  background: var(--row-bg);
  transition: background-color var(--motion-surface) var(--ease-ui);
}
.data-table tbody tr > :first-child { border-radius: var(--radius-surface) 0 0 var(--radius-surface); }
.data-table tbody tr > :last-child { border-radius: 0 var(--radius-surface) var(--radius-surface) 0; }
.data-table tbody tr:hover { --row-bg: var(--surface-row-hover); }
.data-table--live tbody tr:hover,
.data-table--live tbody tr:focus-within { --row-bg: var(--surface-row-hover); --row-drop: var(--drop-row-hover); translate: 0 var(--lift); }
.data-table--compact { border-spacing: 0 var(--row-gap-dense); }
.data-table--compact th,
.data-table--compact td { padding-block: var(--space-2); }

/* --------------------------------------------------------------------------
   Disclosure (<details>) — a quiet panel; consecutive panels stack with a gap
   -------------------------------------------------------------------------- */
.disclosure {
  padding-inline: var(--space-4);
  background: var(--surface-row);
  border-radius: var(--radius-surface);
  transition: background-color var(--motion-surface) var(--ease-ui);
}
.disclosure + .disclosure { margin-top: var(--row-gap); }
.disclosure > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  min-height: 48px;
  padding-block: var(--space-2);
  font-weight: 600;
  cursor: pointer;
  list-style: none;
}
.disclosure > summary::-webkit-details-marker { display: none; }
.disclosure > summary::after {
  content: "";
  flex: none;
  width: 8px;
  height: 8px;
  margin-right: var(--space-1);
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: translateY(-2px) rotate(45deg);
  transition: transform var(--motion-fast) var(--ease-ui);
}
.disclosure[open] > summary::after { transform: translateY(2px) rotate(-135deg); }
.disclosure > summary:hover { color: var(--accent-text); }
.disclosure__body { padding-bottom: var(--space-4); }
.disclosure[open] > .disclosure__body { animation: quiet-reveal var(--motion-medium) var(--ease-ui) both; }

/* Reduced motion: surfaces still brighten, nothing lifts */
@media (prefers-reduced-motion: reduce) {
  .row-card--live:hover,
  .row-card--live:focus-within,
  .data-table--live tbody tr:hover,
  .data-table--live tbody tr:focus-within { translate: none; }
}

/* --------------------------------------------------------------------------
   Notices and toasts
   -------------------------------------------------------------------------- */
.notice {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-3) var(--space-4);
  padding: var(--space-4) var(--space-5);
  border-left: 3px solid var(--accent); /* the notice's mark, not decoration */
  border-radius: 0 var(--radius-surface) var(--radius-surface) 0;
  background: var(--surface);
}
.notice--quiet { border-left-color: var(--border-strong); }

.toasts {
  position: fixed;
  left: var(--space-4);
  bottom: var(--space-4);
  z-index: 50;
  display: grid;
  gap: var(--space-3);
  width: min(420px, calc(100vw - 2 * var(--space-4)));
  margin: 0;
  padding: 0;
  list-style: none;
}
.toast {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: start;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-3) var(--space-4) var(--space-5);
  border-left: 3px solid var(--border-strong); /* the status mark, not decoration */
  border-radius: 0 var(--radius-surface) var(--radius-surface) 0;
  background: var(--surface-raised);
  box-shadow: 0 12px 32px rgb(0 0 0 / 0.28);
  font-size: var(--fs-ui-sm);
  animation: quiet-reveal var(--motion-medium) var(--ease-ui) both;
}
.toast--error { border-left-color: var(--status-danger); }
.toast--warning { border-left-color: var(--status-warning); }
.toast--success { border-left-color: var(--status-success); }
.toast__close { width: 32px; height: 32px; margin-top: -6px; }

/* --------------------------------------------------------------------------
   Prose (legal and long-form pages)
   -------------------------------------------------------------------------- */
.prose { max-width: var(--measure); }
.prose > * + * { margin-top: var(--space-4); }
.prose h2 { margin-top: var(--space-7); font-size: var(--fs-h3); }
.prose h3 { margin-top: var(--space-6); font-size: var(--fs-h4); }
.prose p, .prose li { color: var(--text); }
.prose ul, .prose ol { padding-left: var(--space-5); }
.prose li + li { margin-top: var(--space-2); }
.prose pre {
  white-space: pre-wrap;
  font-family: var(--font-ui);
  font-size: var(--fs-body);
  margin: var(--space-4) 0;
  padding: var(--space-3) var(--space-4);
  background: var(--surface-row);
  border-radius: var(--radius-surface);
}
.prose code { font-family: inherit; }
.prose address { font-style: normal; }

/* --------------------------------------------------------------------------
   TraXile promo strip (above the footer on every page except home)
   -------------------------------------------------------------------------- */
.promo {
  margin-top: var(--space-9);
  background: var(--surface);
}
.promo__inner {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: var(--space-3) var(--space-7);
  padding-block: var(--space-5);
}
.promo__name {
  font-family: var(--font-display);
  font-size: clamp(20px, 2.2vw, 30px);
  font-weight: var(--display-weight);
  line-height: 1.3;
  letter-spacing: var(--display-tracking);
}
.promo__name span { color: var(--accent-text); }
.promo__text { color: var(--text-muted); font-size: var(--fs-ui); }
@media (max-width: 760px) {
  .promo__inner { grid-template-columns: 1fr; }
}

/* --------------------------------------------------------------------------
   Footer
   -------------------------------------------------------------------------- */
.site-footer {
  flex: none;
  padding-block: var(--space-8) var(--space-6);
  background: var(--footer-bg);
  font-size: var(--fs-ui-sm);
}
.site-footer__grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: var(--space-6) var(--space-7);
  align-items: start;
}
.site-footer__brand img { width: 120px; }
.site-footer__brand p { margin-top: var(--space-3); color: var(--text-muted); max-width: 36ch; }
.footer-nav { display: flex; flex-wrap: wrap; gap: var(--space-2) var(--space-5); margin: 0; padding: 0; list-style: none; }
.footer-nav a { text-decoration: none; color: var(--text); }
.footer-nav a:hover { color: var(--accent-text); text-decoration: underline; }
.site-footer__social { display: flex; gap: var(--space-1); margin-top: var(--space-4); margin-left: calc(-1 * var(--space-2)); }
.site-footer__legal {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: var(--space-2) var(--space-5);
  margin-top: var(--space-8);
  color: var(--text-muted);
}
.site-footer__legal a { color: var(--text-muted); }
.site-footer__legal a:hover { color: var(--text); }
.site-footer__legal ul { display: flex; gap: var(--space-5); margin: 0; padding: 0; list-style: none; }
@media (max-width: 760px) {
  .site-footer__grid { grid-template-columns: 1fr; }
}
