/* ─────────────────────────────────────────────────────────────────────────
   Gazelle Design System — DOCUMENTATION SITE CHROME
   ─────────────────────────────────────────────────────────────────────────
   This file styles the site that DOCUMENTS the design system. It is not part
   of the design system itself and is deliberately NOT imported into
   styles.css — consumers of the design system should never receive it.

   It consumes only the canonical token layer (--color-*, --space-*,
   --radius-*, --shadow-*) and the .gz-text-* type classes. No legacy
   aliases, no hardcoded px for spacing/colour.
   ───────────────────────────────────────────────────────────────────────── */

:root {
  /* Chrome-only measurements (not design tokens — they describe this site) */
  --nav-h: 60px;
  --subnav-h: 52px;
  --wrap-max: 1280px;
  /* Gutter of .wrap and the two sticky bars; narrows on small screens. Full-
     bleed elements inside .wrap cancel it with a negative inline margin. */
  --wrap-pad: var(--space-8);
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

*, *::before, *::after { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  /* Anchor targets must clear both sticky bars */
  scroll-padding-top: calc(var(--nav-h) + var(--subnav-h) + var(--space-4));
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

body {
  margin: 0;
  background: var(--color-surface-oyster);
  font-family: var(--font-brand);
  color: var(--color-fg-primary);
  -webkit-font-smoothing: antialiased;
}

.wrap {
  max-width: var(--wrap-max);
  margin: 0 auto;
  padding-inline: var(--wrap-pad);
}

/* Skip link ------------------------------------------------------------- */
.skip-link {
  position: absolute;
  left: var(--space-4);
  top: calc(-1 * var(--space-16));
  z-index: 100;
  background: var(--color-surface-brand);
  color: var(--color-fg-inverse);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-sm);
  text-decoration: none;
  transition: top 120ms ease;
}
.skip-link:focus { top: var(--space-4); }

/* ── Primary navbar ───────────────────────────────────────────────────── */
.site-nav {
  position: sticky;
  top: 0;
  z-index: 20;
  height: var(--nav-h);
  display: flex;
  align-items: center;
  background: var(--color-surface-card);
  border-bottom: 1px solid var(--color-border-subtle);
}
.site-nav__inner {
  max-width: var(--wrap-max);
  margin: 0 auto;
  padding-inline: var(--wrap-pad);
  width: 100%;
  display: flex;
  align-items: center;
  gap: var(--space-10);
}
.site-nav__brand {
  display: flex;
  align-items: center;
  text-decoration: none;
}
.site-nav__logo,
.site-nav__logo img {
  display: block;
  width: 140px;
  height: 21.8368px;
}
.site-nav__menu-toggle { display: none; }
.site-nav__links { display: flex; gap: var(--space-6); align-items: center; }
.site-nav__meta {
  margin: 0 0 0 auto;
  color: var(--color-fg-muted);
  font-size: var(--text-12);
  white-space: nowrap;
}
.site-nav__link {
  color: var(--color-fg-primary);
  text-decoration: none;
  padding: var(--space-2) 0;
  border-bottom: 2px solid transparent;
}
.site-nav__link:hover { color: var(--color-fg-link); }
.site-nav__link[aria-current="page"] {
  color: var(--color-fg-brand);
  border-bottom-color: var(--color-surface-brand);
}

/* ── Section subnav (scrollspy) ───────────────────────────────────────── */
.subnav {
  position: sticky;
  top: var(--nav-h);
  z-index: 19;
  height: var(--subnav-h);
  display: flex;
  align-items: center;
  background: var(--color-surface-card);
  border-bottom: 1px solid var(--color-border-subtle);
  overflow-x: auto;
}
.subnav__inner {
  max-width: var(--wrap-max);
  margin: 0 auto;
  padding-inline: var(--wrap-pad);
  width: 100%;
  display: flex;
  gap: var(--space-6);
  align-items: center;
}
.subnav__link {
  font-size: var(--text-14);
  font-weight: var(--font-weight-medium);
  line-height: var(--leading-100);
  color: var(--color-fg-muted);
  text-decoration: none;
  white-space: nowrap;
  padding: var(--space-2) 0;
  border-bottom: 2px solid transparent;
}
.subnav__link:hover { color: var(--color-fg-primary); }
.subnav__link.is-active {
  color: var(--color-fg-brand);
  border-bottom-color: var(--color-surface-brand);
}

/* ── Page header ──────────────────────────────────────────────────────── */
.page-head { padding-block: var(--space-12) var(--space-6); }
.page-head .eyebrow { color: var(--color-fg-brand); margin-bottom: var(--space-3); }
.lede { max-width: 62ch; color: var(--color-fg-muted); margin: var(--space-3) 0 0; }

/* Breadcrumb eyebrow on a sub-page (parent link → current). */
.crumbs { display: flex; align-items: center; gap: var(--space-2); }
.crumbs a { color: var(--color-fg-brand); text-decoration: none; }
.crumbs a:hover { text-decoration: underline; }
.crumbs__sep { color: var(--color-fg-muted); }
.crumbs [aria-current="page"] { color: var(--color-fg-muted); }

/* ── Overview landing grid ────────────────────────────────────────────── */
.overview-grid {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: var(--space-4);
}
.overview-card {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  height: 100%;
  background: var(--color-surface-card);
  border: 1px solid var(--color-border-subtle);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  padding: var(--space-6);
  text-decoration: none;
  color: var(--color-fg-primary);
  transition: border-color 120ms ease, box-shadow 120ms ease, transform 120ms ease;
}
.overview-card:hover {
  border-color: var(--color-surface-brand);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}
.overview-card__title { display: flex; align-items: center; gap: var(--space-2); }
.overview-card__title::after {
  content: "→";
  color: var(--color-fg-brand);
  transition: transform 120ms ease;
}
.overview-card:hover .overview-card__title::after { transform: translateX(3px); }
.overview-card__desc { color: var(--color-fg-muted); }

@media (prefers-reduced-motion: reduce) {
  .overview-card,
  .overview-card__title::after { transition: none; }
  .overview-card:hover { transform: none; }
}

/* ── Sections ─────────────────────────────────────────────────────────── */
main { padding-bottom: var(--space-20); }
.docs-section { padding-top: var(--space-12); }
.section-head {
  padding-bottom: var(--space-3);
  border-bottom: 1px solid var(--color-border-subtle);
  margin-bottom: var(--space-6);
}
.section-note { color: var(--color-fg-muted); margin: var(--space-2) 0 0; max-width: 68ch; }
.subsection-title {
  margin: var(--space-10) 0 var(--space-4);
  font-size: var(--text-18);
  font-weight: var(--font-weight-bold);
  line-height: var(--leading-125);
}
.group-label {
  font-size: var(--text-14);
  font-weight: var(--font-weight-medium);
  color: var(--color-fg-muted);
  margin: var(--space-6) 0 var(--space-3);
}

/* ── Cards ────────────────────────────────────────────────────────────── */
.card {
  background: var(--color-surface-card);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  padding: var(--space-6);
  margin-bottom: var(--space-4);
}
.card-top {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-3);
  margin-bottom: var(--space-4);
  padding-bottom: var(--space-3);
  border-bottom: 1px solid var(--color-border-subtle);
}
.role {
  font-size: var(--text-14);
  font-weight: var(--font-weight-bold);
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
}
.cls {
  font-family: var(--mono);
  font-size: var(--text-12);
  color: var(--color-fg-brand);
  background: var(--color-surface-muted);
  padding: 2px var(--space-2);
  border-radius: var(--radius-sm);
}
.sample { overflow-wrap: anywhere; }
.usage { color: var(--color-fg-muted); font-size: var(--text-14); margin-top: var(--space-3); }

.tokens {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-top: var(--space-4);
  padding-top: var(--space-3);
  border-top: 1px dashed var(--color-border-subtle);
}
.tok {
  font-family: var(--mono);
  font-size: 11px;
  line-height: var(--leading-150);
  color: var(--color-fg-muted);
  background: var(--color-surface-oyster);
  border-radius: var(--radius-sm);
  padding: 2px var(--space-2);
  white-space: nowrap;
}
.tok b { color: var(--color-fg-primary); font-weight: var(--font-weight-medium); }

.grid-3 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: var(--space-4);
}

/* ── Colour swatches ──────────────────────────────────────────────────── */
.swatch-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(148px, 1fr));
  gap: var(--space-4);
}
/* Full 11-step ramps (e.g. theme-pink-50…950) — fixed columns so the whole
   scale reads as one row instead of wrapping like the smaller groups. */
.swatch-grid--scale {
  grid-template-columns: repeat(11, minmax(0, 1fr));
  gap: var(--space-2);
}
.swatch-grid--scale .chip { height: 48px; }
.swatch-grid--scale .swatch__name { font-size: 11px; }
.swatch-grid--scale .swatch__value { font-size: 10px; }
.swatch { min-width: 0; }

/* Semantic-role swatches read as roles, not raw colour chips — give them
   an actual card shell (surface, border, radius, shadow) instead of a
   bare chip + label stack. */
.swatch-grid--cards .swatch {
  background: var(--color-surface-card);
  border: 1px solid var(--color-border-subtle);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  padding: var(--space-3);
}
.swatch-grid--cards .chip { box-shadow: none; }
.chip {
  height: 64px;
  border-radius: var(--radius-sm);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.06);
}
.swatch__name {
  font-family: var(--mono);
  font-size: var(--text-12);
  margin-top: var(--space-2);
  overflow-wrap: anywhere;
}
.swatch__value {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--color-fg-muted);
  margin-top: 2px;
  overflow-wrap: anywhere;
}

/* ── Continuous opacity (black/white — not a stepped scale) ─────────────── */
.alpha-row { display: flex; gap: var(--space-4); }
.alpha-bar { flex: 1; min-width: 0; }
.alpha-checker {
  height: 64px;
  border-radius: var(--radius-sm);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.06);
  position: relative;
  overflow: hidden;
  background-color: #fff;
  background-image:
    linear-gradient(45deg, #ccc 25%, transparent 25%, transparent 75%, #ccc 75%),
    linear-gradient(45deg, #ccc 25%, transparent 25%, transparent 75%, #ccc 75%);
  background-size: 16px 16px;
  background-position: 0 0, 8px 8px;
}
.alpha-fade { position: absolute; inset: 0; }
.alpha-fade--black { background: linear-gradient(to right, rgb(0 0 0 / 0%), rgb(0 0 0 / 100%)); }
.alpha-fade--white { background: linear-gradient(to right, rgb(255 255 255 / 0%), rgb(255 255 255 / 100%)); }
.alpha-ticks {
  display: flex;
  justify-content: space-between;
  margin-top: var(--space-2);
  font-family: var(--mono);
  font-size: 11px;
  color: var(--color-fg-muted);
}

/* ── Spacing bars ─────────────────────────────────────────────────────── */
.space-row {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding-block: var(--space-2);
}
.space-bar {
  height: 20px;
  background: var(--color-theme-light-blue-500);
  border-radius: var(--radius-sm);
  flex: none;
}
.space-meta { font-family: var(--mono); font-size: var(--text-12); }
.space-meta b { font-weight: var(--font-weight-medium); }

/* ── Shape & elevation demos ──────────────────────────────────────────── */
.shape-row { display: flex; flex-wrap: wrap; gap: var(--space-6); }
.shape-item { text-align: center; }
.shape-box {
  width: 120px;
  height: 64px;
  background: var(--color-surface-oyster);
  box-shadow: inset 0 0 0 1px var(--color-surface-brand);
}
.shape-caption {
  font-family: var(--mono);
  font-size: var(--text-12);
  margin-top: var(--space-2);
}
.elev-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--space-6);
}
.elev-box {
  background: var(--color-surface-card);
  border-radius: var(--radius-md);
  height: 96px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--mono);
  font-size: var(--text-12);
  color: var(--color-fg-muted);
}

/* ── Token mapping tables ─────────────────────────────────────────────── */
.table-wrap {
  overflow-x: auto;
  background: var(--color-surface-card);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  margin-bottom: var(--space-6);
}
.token-table {
  border-collapse: collapse;
  width: 100%;
  min-width: 780px;
  font-size: var(--text-14);
}
.token-table caption {
  caption-side: top;
  text-align: left;
  padding: var(--space-4) var(--space-5) 0;
  font-size: var(--text-14);
  color: var(--color-fg-muted);
}
.token-table th,
.token-table td {
  text-align: left;
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--color-border-subtle);
  vertical-align: middle;
}
.token-table thead th {
  background: var(--color-surface-muted);
  font-size: var(--text-12);
  font-weight: var(--font-weight-bold);
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  white-space: nowrap;
}
.token-table tbody tr:last-child td { border-bottom: 0; }
.token-table code {
  font-family: var(--mono);
  font-size: var(--text-12);
  overflow-wrap: anywhere;
}
.token-table .t-css code { color: var(--color-fg-brand); }
.token-table .t-val { font-family: var(--mono); font-size: var(--text-12); white-space: nowrap; }
.token-table .t-muted { color: var(--color-fg-muted); }
.token-table .t-gap { color: var(--color-fg-muted); font-style: italic; }
.token-table .t-swatch {
  display: inline-block;
  width: 14px;
  height: 14px;
  border-radius: 3px;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.12);
  margin-right: var(--space-2);
  vertical-align: -2px;
}
/* Group divider rows inside a table */
.token-table .t-group td {
  background: var(--color-surface-oyster);
  font-size: var(--text-12);
  font-weight: var(--font-weight-bold);
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  color: var(--color-fg-muted);
}

/* ── Callout ──────────────────────────────────────────────────────────── */
.callout {
  border-left: 3px solid var(--color-surface-brand);
  background: var(--color-surface-card);
  border-radius: var(--radius-sm);
  padding: var(--space-4) var(--space-5);
  margin: var(--space-4) 0 var(--space-6);
  font-size: var(--text-14);
  line-height: var(--leading-150);
  color: var(--color-fg-muted);
}
.callout strong { color: var(--color-fg-primary); }
.callout code { font-family: var(--mono); font-size: var(--text-12); }

/* ── Empty state (Icons / Specs) ──────────────────────────────────────── */
.empty-state {
  margin-top: var(--space-8);
  border: 2px dashed var(--color-border-subtle);
  border-radius: var(--radius-md);
  background: var(--color-surface-card);
  padding: var(--space-16) var(--space-8);
  text-align: center;
}
.empty-state__glyph {
  width: 56px;
  height: 56px;
  margin: 0 auto var(--space-5);
  border-radius: var(--radius-full);
  background: var(--color-surface-oyster);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-fg-brand);
}
.empty-state__body {
  max-width: 46ch;
  margin: var(--space-3) auto 0;
  color: var(--color-fg-muted);
}

/* ── Inline link ──────────────────────────────────────────────────────── */
.link {
  color: var(--color-fg-link);
  text-underline-offset: 2px;
  text-decoration-thickness: 1px;
}
.link:hover { color: var(--color-fg-brand); }

/* ── Code block ───────────────────────────────────────────────────────── */
.code-block {
  background: var(--color-surface-oyster);
  border-radius: var(--radius-sm);
  padding: var(--space-4);
  margin: 0 0 var(--space-3);
  overflow-x: auto;
}
.code-block code {
  font-family: var(--mono);
  font-size: var(--text-12);
  line-height: var(--leading-150);
  white-space: pre;
}

/* ── External reference card ──────────────────────────────────────────── */
.ext-card {
  display: flex;
  align-items: flex-start;
  gap: var(--space-4);
  background: var(--color-surface-card);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  padding: var(--space-5) var(--space-6);
  margin-bottom: var(--space-4);
  text-decoration: none;
  color: inherit;
  transition: box-shadow 120ms ease;
}
.ext-card:hover { box-shadow: var(--shadow-md); }
.ext-card:hover .ext-card__title { color: var(--color-fg-link); }
.ext-card__glyph {
  flex: none;
  width: 44px;
  height: 44px;
  border-radius: var(--radius-full);
  background: var(--color-surface-oyster);
  color: var(--color-fg-brand);
  display: flex;
  align-items: center;
  justify-content: center;
}
.ext-card__body { display: block; }
.ext-card__title {
  display: block;
  font-size: var(--text-16);
  font-weight: var(--font-weight-bold);
}
.ext-card__note {
  display: block;
  margin-top: var(--space-1);
  font-size: var(--text-14);
  line-height: var(--leading-150);
  color: var(--color-fg-muted);
  max-width: 62ch;
}
.ext-card__arrow { flex: none; margin-left: auto; color: var(--color-fg-muted); }

/* ── Icon library: form controls ──────────────────────────────────────── */
.icon-toolbar {
  position: sticky;
  top: calc(var(--nav-h) + var(--subnav-h));
  z-index: 18;
  /* Full-bleed across the wrap gutter so nothing shows through while stuck. */
  margin-inline: calc(-1 * var(--wrap-pad));
  padding: var(--space-4) var(--wrap-pad);
  background: var(--color-surface-oyster);
  border-bottom: 1px solid var(--color-border-subtle);
}
.icon-toolbar__row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-3);
}
.icon-toolbar__row + .icon-toolbar__row { margin-top: var(--space-3); }

.field-label {
  font-size: var(--text-12);
  font-weight: var(--font-weight-bold);
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  color: var(--color-fg-muted);
}

.icon-search {
  position: relative;
  flex: 1 1 260px;
  display: flex;
  align-items: center;
}
.icon-search__glyph {
  position: absolute;
  left: var(--space-3);
  color: var(--color-fg-muted);
  pointer-events: none;
}
.icon-search__input {
  width: 100%;
  height: 40px;
  padding-inline: calc(var(--space-8) + var(--space-1)) var(--space-8);
  padding-block: 0;
  font-family: inherit;
  font-size: var(--text-14);
  color: var(--color-fg-primary);
  background: var(--color-surface-card);
  border: 1px solid var(--color-border-subtle);
  border-radius: var(--radius-sm);
  appearance: none;
}
.icon-search__input::-webkit-search-decoration,
.icon-search__input::-webkit-search-cancel-button { appearance: none; }
.icon-search__clear {
  position: absolute;
  right: var(--space-2);
  display: flex;
  padding: var(--space-1);
  border: 0;
  border-radius: var(--radius-full);
  background: transparent;
  color: var(--color-fg-muted);
  cursor: pointer;
}
.icon-search__clear:hover { color: var(--color-fg-primary); background: var(--color-surface-muted); }
.icon-search__clear[hidden] { display: none; }

.field-select {
  height: 40px;
  padding: 0 var(--space-4);
  font-family: inherit;
  font-size: var(--text-14);
  color: var(--color-fg-primary);
  background: var(--color-surface-card);
  border: 1px solid var(--color-border-subtle);
  border-radius: var(--radius-sm);
  cursor: pointer;
}

.segmented {
  display: inline-flex;
  padding: 2px;
  background: var(--color-surface-muted);
  border-radius: var(--radius-full);
}
.segmented button {
  border: 0;
  background: transparent;
  color: var(--color-fg-muted);
  font-family: inherit;
  font-size: var(--text-14);
  font-weight: var(--font-weight-medium);
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-full);
  cursor: pointer;
}
.segmented button:hover { color: var(--color-fg-primary); }
.segmented button[aria-checked="true"] {
  background: var(--color-surface-card);
  color: var(--color-fg-brand);
  box-shadow: var(--shadow-sm);
}

.icon-count {
  margin-left: auto;
  font-size: var(--text-14);
  color: var(--color-fg-muted);
  white-space: nowrap;
}
.icon-note {
  margin: var(--space-3) 0 0;
  font-size: var(--text-14);
  line-height: var(--leading-150);
  color: var(--color-fg-muted);
  max-width: 72ch;
}

/* Shared focus treatment for every control on this screen. */
.icon-search__input:focus-visible,
.field-select:focus-visible,
.segmented button:focus-visible,
.icon-search__clear:focus-visible,
.icon-tile__glyph:focus-visible,
.icon-tile__name:focus-visible,
.ext-card:focus-visible {
  outline: 2px solid var(--color-focus-ring);
  outline-offset: 2px;
}

/* ── Icon library: grid ───────────────────────────────────────────────── */
.icon-grid {
  list-style: none;
  margin: var(--space-6) 0 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(112px, 1fr));
  gap: var(--space-3);
}
.icon-tile {
  /* Off-screen tiles skip layout and paint — the grid holds 1,383 of them. */
  content-visibility: auto;
  contain-intrinsic-size: 112px;
  display: flex;
  flex-direction: column;
  background: var(--color-surface-card);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition: box-shadow 120ms ease;
}
.icon-tile:hover { box-shadow: var(--shadow-md); }
.icon-tile__glyph {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 68px;
  padding: var(--space-4) var(--space-2) var(--space-2);
  border: 0;
  background: transparent;
  color: var(--color-fg-primary);
  cursor: pointer;
}
.icon-tile__name {
  border: 0;
  border-top: 1px solid transparent;
  background: transparent;
  color: var(--color-fg-muted);
  font-family: var(--mono);
  font-size: 10px;
  line-height: var(--leading-150);
  padding: var(--space-2) var(--space-2) var(--space-3);
  cursor: pointer;
  overflow-wrap: anywhere;
}
.icon-tile__name:hover {
  color: var(--color-fg-link);
  background: var(--color-surface-oyster);
  border-top-color: var(--color-border-subtle);
}

/* Copy confirmation — the tile itself answers, the toast names what landed. */
.icon-tile.is-copied {
  box-shadow: inset 0 0 0 2px var(--color-functional-green-500);
}
.icon-tile.is-copied .icon-tile__glyph { color: var(--color-fg-brand); }

.icon-toast {
  position: fixed;
  left: 50%;
  bottom: var(--space-6);
  z-index: 40;
  transform: translate(-50%, var(--space-4));
  background: var(--color-fg-primary);
  color: var(--color-fg-inverse);
  font-family: var(--mono);
  font-size: var(--text-12);
  padding: var(--space-3) var(--space-5);
  border-radius: var(--radius-full);
  box-shadow: var(--shadow-lg);
  opacity: 0;
  pointer-events: none;
  transition: opacity 140ms ease, transform 140ms ease;
}
.icon-toast.is-visible { opacity: 1; transform: translate(-50%, 0); }
@media (prefers-reduced-motion: reduce) {
  .icon-toast { transition: opacity 140ms ease; transform: translate(-50%, 0); }
}

/* ── Icon sizing reference ────────────────────────────────────────────── */
.icon-scale {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: var(--space-4);
}
.icon-scale__box {
  /* Tall enough to leave air around the 64 px step. */
  height: 84px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-surface-oyster);
  border-radius: var(--radius-sm);
  color: var(--color-fg-brand);
}
.icon-scale__size {
  font-family: var(--mono);
  font-size: var(--text-12);
  margin-top: var(--space-2);
}
.icon-scale__tag {
  font-family: var(--font-brand);
  font-size: 10px;
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  color: var(--color-fg-brand);
  background: var(--color-surface-muted);
  border-radius: var(--radius-full);
  padding: 1px var(--space-2);
}
.icon-scale__stroke {
  display: inline-block;
  font-family: var(--mono);
  font-size: 10px;
  color: var(--color-fg-brand);
  background: var(--color-surface-muted);
  border-radius: var(--radius-sm);
  padding: 1px var(--space-2);
}
.icon-scale__use {
  font-size: var(--text-12);
  line-height: var(--leading-150);
  color: var(--color-fg-muted);
  margin-top: var(--space-1);
}

/* ── Component demos (typography section) ─────────────────────────────── */
.demo-row { display: flex; flex-wrap: wrap; gap: var(--space-3); align-items: center; }
.btn {
  background: var(--color-surface-brand);
  color: var(--color-fg-inverse);
  border: 0;
  border-radius: var(--radius-full);
  padding: var(--space-3) var(--space-6);
  cursor: pointer;
}
.btn-secondary {
  background: transparent;
  color: var(--color-fg-primary);
  box-shadow: inset 0 0 0 1px var(--color-border-default);
}
.nav-demo { display: flex; gap: var(--space-6); flex-wrap: wrap; }
.nav-demo a { color: var(--color-fg-primary); text-decoration: none; padding-bottom: var(--space-1); }
.nav-demo a.is-active { box-shadow: inset 0 -2px 0 0 var(--color-surface-brand); }
.nav-demo a:hover { color: var(--color-fg-link); }
.badge {
  display: inline-block;
  background: var(--color-surface-muted);
  border-radius: var(--radius-full);
  padding: var(--space-1) var(--space-3);
  text-transform: uppercase;
}
.badge-score { background: var(--color-functional-green-200); text-transform: none; }
table.specs { border-collapse: collapse; width: 100%; }
table.specs tr + tr { border-top: 1px solid var(--color-border-subtle); }
table.specs td { padding: var(--space-3) var(--space-4) var(--space-3) 0; text-align: left; }
table.specs td:last-child { text-align: right; padding-right: 0; }

/* ── Specs screen — file tree ─────────────────────────────────────────── */
.spec-toolbar {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  margin-bottom: var(--space-8);
}
.spec-count {
  font-family: var(--mono);
  font-size: var(--text-12);
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  color: var(--color-fg-muted);
  white-space: nowrap;
}

.spec-section[hidden] { display: none; }

.spec-list__head {
  display: flex;
  align-items: baseline;
  gap: var(--space-2);
  margin-bottom: var(--space-3);
}
.spec-list__dot {
  width: 8px;
  height: 8px;
  border-radius: var(--radius-sm);
  background: var(--color-fg-brand);
  transform: translateY(1px);
}
.spec-list__path {
  font-family: var(--mono);
  font-size: var(--text-14);
  font-weight: var(--font-weight-bold);
  color: var(--color-fg-primary);
}
.spec-list__count {
  font-family: var(--mono);
  font-size: var(--text-12);
  color: var(--color-fg-muted);
}

.spec-rows {
  border: 1px solid var(--color-border-subtle);
  border-radius: var(--radius-md);
  background: var(--color-surface-card);
  overflow: hidden;
}
.spec-row {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  width: 100%;
  padding: var(--space-4) var(--space-5);
  text-align: left;
  background: transparent;
  border: 0;
  border-top: 1px solid var(--color-border-subtle);
  cursor: pointer;
  font-family: inherit;
  color: inherit;
}
.spec-row:first-child { border-top: 0; }
.spec-row[hidden] { display: none; }
.spec-row:hover { background: var(--color-surface-oyster); }
.spec-row:focus-visible {
  outline: 2px solid var(--color-focus-ring);
  outline-offset: -2px;
}
.spec-row.is-copied { box-shadow: inset 0 0 0 2px var(--color-functional-green-500); }

.spec-row__branch {
  font-family: var(--mono);
  font-size: var(--text-12);
  color: var(--color-fg-muted);
  user-select: none;
  padding-top: 2px;
}
.spec-row__body { flex: 1 1 auto; min-width: 0; }
.spec-row__top {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: var(--space-1) var(--space-3);
}
.spec-row__name {
  font-family: var(--mono);
  font-size: var(--text-12);
  color: var(--color-fg-link);
}
.spec-row__title {
  font-size: var(--text-14);
  font-weight: var(--font-weight-medium);
  color: var(--color-fg-primary);
}
.spec-row__summary {
  display: block;
  margin-top: var(--space-1);
  max-width: 68ch;
  font-size: var(--text-12);
  line-height: var(--leading-150);
  color: var(--color-fg-muted);
}

.spec-row__meta {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: var(--space-1);
  text-align: right;
}
.spec-row__words {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--color-fg-muted);
  white-space: nowrap;
}
.spec-row__copy {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  color: var(--color-fg-muted);
  opacity: 0;
  transition: opacity 120ms ease, color 120ms ease;
}
.spec-row:hover .spec-row__copy,
.spec-row:focus-visible .spec-row__copy { opacity: 1; }
.spec-row.is-copied .spec-row__copy { color: var(--color-fg-brand); opacity: 1; }
@media (prefers-reduced-motion: reduce) {
  .spec-row__copy { transition: none; }
}

/* ── Atoms screen — showcase ──────────────────────────────────────────────
   Storybook-style chrome around the button atom: an interactive playground and
   the full variant matrix. The button itself lives in components/button.css. */
.atom-block { margin-top: var(--space-8); }
.atom-block__body { margin-top: var(--space-4); }
.atom-spec-ref {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: var(--space-2);
  margin-top: var(--space-3);
  color: var(--color-fg-muted);
}
.atom-spec-ref code {
  font-family: var(--mono);
  font-size: var(--text-12);
}

/* Playground -------------------------------------------------------------- */
.pg {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: var(--space-5);
  align-items: start;
}
.pg-canvas { display: flex; flex-direction: column; gap: var(--space-4); min-width: 0; }

.pg-stage {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 220px;
  padding: var(--space-8);
  border: 1px solid var(--color-border-subtle);
  border-radius: var(--radius-md);
  background: var(--color-surface-card);
  transition: background 160ms ease, border-color 160ms ease;
}
.pg-stage--dark {
  background: var(--color-brand-blue-gazelle-950);
  border-color: var(--color-brand-blue-gazelle-950);
}
.pg-preview { display: flex; }

/* Forced pseudo-states for the static showcase. The copied component markup stays clean. */
:is(.pg-stage, .vm-cell)[data-preview-state="hover"][data-preview-style="primary"] button,
:is(.pg-stage, .vm-cell)[data-preview-state="focus"][data-preview-style="primary"] button,
:is(.pg-stage, .vm-cell)[data-preview-state="hover"][data-preview-style="white"] button,
:is(.pg-stage, .vm-cell)[data-preview-state="focus"][data-preview-style="white"] button {
  color: var(--color-fg-inverse);
  background: var(--color-brand-blue-gazelle-600);
  border-color: var(--color-brand-blue-gazelle-600);
}
:is(.pg-stage, .vm-cell)[data-preview-state="hover"][data-preview-style="secondary"] button,
:is(.pg-stage, .vm-cell)[data-preview-state="focus"][data-preview-style="secondary"] button {
  background: var(--color-oyster-800);
  border-color: var(--color-oyster-800);
}
:is(.pg-stage, .vm-cell)[data-preview-state="hover"][data-preview-style="tertiary"] button,
:is(.pg-stage, .vm-cell)[data-preview-state="focus"][data-preview-style="tertiary"] button {
  background: rgb(255 255 255 / 20%);
}
:is(.pg-stage, .vm-cell)[data-preview-state="hover"][data-preview-style="tertiary"] button {
  border-color: var(--color-oyster-800);
}
:is(.pg-stage, .vm-cell)[data-preview-state="hover"][data-preview-style="link"] button,
:is(.pg-stage, .vm-cell)[data-preview-state="focus"][data-preview-style="link"] button {
  color: var(--color-brand-blue-gazelle-600);
}
:is(.pg-stage, .vm-cell)[data-preview-state="focus"] button {
  box-shadow:
    0 0 0 2px var(--color-surface-page),
    0 0 0 3px var(--color-focus-ring);
}
:is(.pg-stage, .vm-cell)[data-preview-state="focus"][data-preview-style="tertiary"] button {
  box-shadow:
    0 0 0 2px var(--color-neutral-white),
    0 0 0 3px var(--color-focus-ring);
}
.vm-cell[data-preview-state="hover"][data-preview-kind] > label > input + span {
  border-color: var(--color-surface-brand);
}
.vm-cell[data-preview-state="hover"][data-preview-kind] > label > input + span::before {
  opacity: 1;
}

/* Code panel */
.pg-code {
  border: 1px solid var(--color-border-subtle);
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--color-brand-blue-gazelle-950);
}
.pg-code__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-3) var(--space-2) var(--space-4);
  border-bottom: 1px solid rgb(255 255 255 / 12%);
}
.pg-code__title { color: var(--color-neutral-grey-300); }
.pg-code__requirement {
  margin-right: auto;
  font-family: var(--font-brand);
  font-size: 10px;
  color: var(--color-neutral-grey-400);
}
.pg-code__copy {
  font-family: var(--font-brand);
  font-size: 10px;
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  color: var(--color-neutral-grey-100);
  background: rgb(255 255 255 / 10%);
  border: 0;
  border-radius: var(--radius-full);
  padding: var(--space-1) var(--space-3);
  cursor: pointer;
  transition: background 120ms ease;
}
.pg-code__copy:hover { background: rgb(255 255 255 / 20%); }
.pg-code__pre {
  margin: 0;
  padding: var(--space-4);
  overflow-x: auto;
  font-family: var(--mono);
  font-size: var(--text-12);
  line-height: var(--leading-150);
  color: var(--color-neutral-grey-100);
}

/* Controls */
.pg-controls {
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
  padding: var(--space-5);
  background: var(--color-surface-card);
  border: 1px solid var(--color-border-subtle);
  border-radius: var(--radius-md);
}
.pg-field { display: flex; flex-direction: column; gap: var(--space-2); min-width: 0; }
.pg-field--inline { flex-direction: row; align-items: center; gap: var(--space-2); }
.pg-field__label { color: var(--color-fg-muted); }
.pg-field.is-disabled { opacity: 0.45; }

.pg-seg {
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
  padding: 2px;
  background: var(--color-surface-muted);
  border-radius: var(--radius-full);
}
.pg-seg__btn {
  flex: 1 1 auto;
  font-family: var(--font-brand);
  font-size: var(--text-12);
  color: var(--color-fg-muted);
  background: transparent;
  border: 0;
  border-radius: var(--radius-full);
  padding: var(--space-2) var(--space-3);
  cursor: pointer;
  white-space: nowrap;
  transition: background 120ms ease, color 120ms ease;
}
.pg-seg__btn:hover:not(.is-active):not(:disabled) { color: var(--color-fg-primary); }
.pg-seg__btn.is-active {
  color: var(--color-fg-brand);
  background: var(--color-surface-card);
  box-shadow: var(--shadow-sm);
  font-weight: var(--font-weight-medium);
}
.pg-seg__btn:disabled { cursor: not-allowed; }
.pg-seg__btn:focus-visible {
  outline: 2px solid var(--color-focus-ring);
  outline-offset: 1px;
}

.pg-toggles { display: flex; gap: var(--space-5); flex-wrap: wrap; }
.pg-check { width: 16px; height: 16px; accent-color: var(--color-brand-blue-gazelle-600); cursor: pointer; }
.pg-field--inline { cursor: pointer; }

.pg-input {
  font-family: var(--font-brand);
  font-size: var(--text-14);
  color: var(--color-fg-primary);
  background: var(--color-surface-page);
  border: 1px solid var(--color-border-subtle);
  border-radius: var(--radius-sm);
  padding: var(--space-2) var(--space-3);
}
.pg-input:focus-visible {
  outline: 2px solid var(--color-focus-ring);
  outline-offset: 1px;
  border-color: transparent;
}

/* Variant matrix ---------------------------------------------------------- */
.vm { display: flex; flex-direction: column; gap: var(--space-4); }
.vm-group {
  padding: var(--space-5) var(--space-6) var(--space-6);
  background: var(--color-surface-card);
  border: 1px solid var(--color-border-subtle);
  border-radius: var(--radius-md);
}
.vm-group--dark {
  background: var(--color-brand-blue-gazelle-950);
  border-color: var(--color-brand-blue-gazelle-950);
}
.vm-group__head { margin-bottom: var(--space-4); }
.vm-group__title { color: var(--color-fg-primary); }
.vm-group--dark .vm-group__title { color: var(--color-neutral-grey-50); }

.vm-table {
  display: grid;
  grid-template-columns: max-content repeat(var(--vm-cols, 3), minmax(0, 1fr));
  gap: var(--space-3) var(--space-4);
  align-items: center;
}
.vm-cell { display: flex; align-items: center; justify-content: center; min-width: 0; }
.vm-cell--corner { min-height: 0; }
.vm-cell--colhead { color: var(--color-fg-muted); justify-content: center; }
.vm-cell--rowhead { color: var(--color-fg-muted); justify-content: flex-start; }
/* Choice matrix: left-align the control cells and their column header. */
.vm-table--start .vm-cell,
.vm-table--start .vm-cell--colhead { justify-content: flex-start; }
.vm-group--dark .vm-cell--colhead,
.vm-group--dark .vm-cell--rowhead { color: var(--color-neutral-grey-300); }

/* ── Narrow screens ──────────────────────────────────────────────────── */
@media (max-width: 720px) {
  :root { --wrap-pad: var(--space-5); }
  .site-nav__inner {
    position: relative;
    gap: var(--space-5);
  }
  .site-nav__logo,
  .site-nav__logo img {
    width: 110px;
    height: 17px;
  }
  .site-nav__menu-toggle {
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    margin-left: auto;
    padding: 0;
    color: var(--color-fg-primary);
    background: transparent;
    border: 0;
    border-radius: var(--radius-md);
    cursor: pointer;
  }
  .site-nav__menu-toggle:hover { background: var(--color-surface-muted); }
  .site-nav__menu-toggle:focus-visible {
    outline: 2px solid var(--color-focus-ring);
    outline-offset: 2px;
  }
  .site-nav__menu-toggle svg {
    display: block;
    width: 24px;
    height: 24px;
  }
  .site-nav__links {
    display: none;
    position: absolute;
    top: calc(var(--nav-h) - 1px);
    left: 0;
    right: 0;
    z-index: 1;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: var(--space-2) var(--wrap-pad) var(--space-3);
    background: var(--color-surface-card);
    border-bottom: 1px solid var(--color-border-subtle);
    box-shadow: var(--shadow-md);
  }
  .site-nav__inner.is-menu-open .site-nav__links { display: flex; }
  .site-nav__link {
    padding: var(--space-4) 0;
    border-bottom-color: var(--color-border-subtle);
  }
  .site-nav__link:last-child { border-bottom-color: transparent; }
  .site-nav__link[aria-current="page"] {
    border-bottom-color: var(--color-surface-brand);
  }

  .icon-toolbar__row { gap: var(--space-2); }
  .icon-search { flex-basis: 100%; }
  .icon-scale { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ext-card { flex-wrap: wrap; }

  .spec-toolbar { flex-wrap: wrap; }
  .spec-row__copy { opacity: 1; }

  .pg { grid-template-columns: minmax(0, 1fr); }
  .vm-table { gap: var(--space-3); }
}

@media (max-width: 960px) {
  .site-nav__meta { display: none; }
}
