/* Hallmark · genre: editorial (product data pages) · design-system: DESIGN.md
 * shared.css — chrome + the five components every data page reuses:
 *   topbar · page head · answer card · data table · source block · handoff · footer
 * Pages add only their macrostructure-specific CSS on top.
 */

@import url("./tokens.css");

*, *::before, *::after { box-sizing: border-box; }
html { overflow-x: clip; }          /* gate 34 — clip, not hidden */
body { overflow-x: clip; }

body {
  margin: 0;
  background: var(--color-paper);
  color: var(--color-ink);
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: var(--leading-body);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-style: normal;              /* never italic — gate 38a */
  font-weight: 600;
  line-height: var(--leading-tight);
  letter-spacing: -0.02em;
  margin: 0;
}

a { color: var(--color-accent-deep); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 2px; }
a:active { color: var(--color-accent); }

:focus-visible {
  outline: var(--rule-thick) solid var(--color-focus);
  outline-offset: 2px;             /* no transition — the ring appears instantly */
}

code, .mono {
  font-family: var(--font-mono);
  font-size: 0.85em;
  background: var(--color-paper-sunk);
  padding: var(--space-3xs) var(--space-2xs);
  border-radius: var(--radius-sm);
  overflow-wrap: anywhere;
}

.shell { max-width: var(--page-max); margin: 0 auto; padding: 0 var(--space-lg); }

.skip {
  position: absolute; left: var(--space-md); top: var(--space-md);
  background: var(--color-paper-raised); color: var(--color-ink);
  padding: var(--space-xs) var(--space-sm);
  border: var(--rule-hair) solid var(--color-rule-strong);
  border-radius: var(--radius-sm);
  transform: translateY(-200%);
  z-index: var(--z-raised);
}
.skip:focus { transform: none; }

/* ─────────────────────────── TOPBAR ─────────────────────────── */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-md);
  flex-wrap: wrap;
  padding: var(--space-sm) 0;
  font-size: var(--text-xs);
}
.topbar__lang { display: flex; align-items: center; gap: var(--space-xs); color: var(--color-muted); }
.topbar__lang a { color: var(--color-accent-deep); white-space: nowrap; }

.crumbs { list-style: none; display: flex; flex-wrap: wrap; gap: var(--space-xs); margin: 0; padding: 0; color: var(--color-muted); }
.crumbs li { min-width: 0; }
.crumbs li::after { content: "/"; margin-left: var(--space-xs); color: var(--color-rule-strong); }
.crumbs li:last-child::after { content: ""; }
.crumbs a { color: var(--color-muted); }
.crumbs a:hover { color: var(--color-accent-deep); }
.crumbs [aria-current] { color: var(--color-ink-2); }

.theme-btn {
  font-family: var(--font-mono);
  font-size: var(--text-2xs);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-ink-2);
  background: transparent;
  border: var(--rule-hair) solid var(--color-rule-strong);
  border-radius: var(--radius-sm);
  padding: var(--space-2xs) var(--space-sm);
  cursor: pointer;
  white-space: nowrap;
  transition: border-color var(--dur-micro) var(--ease-out), color var(--dur-micro) var(--ease-out);
}
.theme-btn:hover { border-color: var(--color-accent); color: var(--color-accent-deep); }
.theme-btn:active { transform: translateY(1px); }

/* ─────────────────────────── PAGE HEAD ─────────────────────────── */
/* Left-aligned, rule-separated. The old site centred this block; the
   centred-everything header is the landing-page tell (gate 6). */
.page-head {
  padding: var(--space-lg) 0 var(--space-xl);
  border-bottom: var(--rule-hair) solid var(--color-rule-strong);
  margin-bottom: var(--space-xl);
}
.page-head h1 {
  font-size: clamp(1.75rem, 3vw + 0.75rem, 2.75rem);
  max-width: 28ch;
  overflow-wrap: anywhere;
  min-width: 0;
}
.page-head__sub {
  margin: var(--space-sm) 0 0;
  max-width: var(--measure);
  color: var(--color-ink-2);
  font-size: var(--text-md);
  line-height: 1.55;
}
.page-head__meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm) var(--space-lg);
  margin-top: var(--space-md);
  font-family: var(--font-mono);
  font-size: var(--text-2xs);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-muted);
}
.page-head__meta span { white-space: nowrap; }

/* ─────────────────────────── ANSWER CARD ─────────────────────────── */
/* Four cells separated by hairlines. Not four cards — no nested boxes. */
.answer {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 9rem), 1fr));
  border-top: var(--rule-thick) solid var(--color-ink);
  border-bottom: var(--rule-hair) solid var(--color-rule-strong);
  margin-bottom: var(--space-xl);
}
.answer__cell {
  padding: var(--space-md) var(--space-md) var(--space-md) 0;
  min-width: 0;
}
.answer__cell + .answer__cell {
  border-left: var(--rule-hair) solid var(--color-rule);
  padding-left: var(--space-md);
}
.answer__k {
  display: block;
  font-family: var(--font-mono);
  font-size: var(--text-2xs);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--color-muted);
  margin-bottom: var(--space-2xs);
}
.answer__v {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: var(--text-xl);
  letter-spacing: -0.025em;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
  min-width: 0;
}
/* The lead figure is never a bare number — the unit and a word ride beside it. */
.answer__v small {
  display: block;
  font-family: var(--font-body);
  font-size: var(--text-xs);
  font-weight: 400;
  letter-spacing: 0;
  color: var(--color-muted);
  margin-top: var(--space-3xs);
}

/* ─────────────────────────── SECTION ─────────────────────────── */
.section { margin-bottom: var(--space-2xl); }
.section__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-md);
  flex-wrap: wrap;
  padding-bottom: var(--space-xs);
  border-bottom: var(--rule-hair) solid var(--color-rule-strong);
  margin-bottom: var(--space-lg);
}
.section__head h2 { font-size: var(--text-lg); }
.section__head .hint {
  font-family: var(--font-mono);
  font-size: var(--text-2xs);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-muted);
}
.section p { margin: 0 0 var(--space-md); max-width: var(--measure); }
.section p:last-child { margin-bottom: 0; }

/* ─────────────────────────── DATA TABLE ─────────────────────────── */
.table-wrap {
  overflow-x: auto;               /* the table scrolls, the page never does */
  border-bottom: var(--rule-hair) solid var(--color-rule-strong);
}
table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-sm);
  font-variant-numeric: tabular-nums;
}
table.data caption {
  caption-side: top;
  text-align: left;
  font-family: var(--font-mono);
  font-size: var(--text-2xs);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--color-muted);
  padding-bottom: var(--space-xs);
}
table.data th {
  position: sticky;
  top: 0;
  background: var(--color-paper);
  text-align: left;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: var(--text-xs);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--color-ink-2);
  padding: var(--space-sm) var(--space-md) var(--space-xs) 0;
  border-bottom: var(--rule-thick) solid var(--color-ink);
  white-space: nowrap;
}
table.data th .sort-btn {
  appearance: none;
  border: 0;
  padding: 0;
  margin: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  letter-spacing: inherit;
  text-transform: inherit;
  cursor: pointer;
  text-align: inherit;
}
table.data th .sort-btn:hover { color: var(--color-accent-deep); }
table.data th .sort-btn:focus-visible { outline: var(--rule-thick) solid var(--color-focus); outline-offset: 2px; }
table.data td {
  padding: var(--space-sm) var(--space-md) var(--space-sm) 0;
  border-bottom: var(--rule-hair) solid var(--color-rule);
  color: var(--color-ink-2);
  vertical-align: top;
}
table.data tbody tr:hover td { background: var(--color-paper-sunk); }
table.data td:first-child, table.data th:first-child { padding-left: var(--space-2xs); }
table.data .num { text-align: right; padding-right: var(--space-md); }
table.data td.num { color: var(--color-ink); }
table.data tr.is-lead td { background: var(--color-accent-tint); color: var(--color-ink); }

/* ─────────────────────────── SOURCE BLOCK ─────────────────────────── */
/* Three rows, always in this order, always in the same place. */
.source {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 16rem), 1fr));
  gap: var(--space-lg);
  padding: var(--space-lg) 0;
  border-top: var(--rule-thick) solid var(--color-ink);
  border-bottom: var(--rule-hair) solid var(--color-rule-strong);
  margin-bottom: var(--space-xl);
}
.source__row { min-width: 0; }
.source__k {
  display: block;
  font-family: var(--font-mono);
  font-size: var(--text-2xs);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--color-muted);
  margin-bottom: var(--space-2xs);
}
.source__v { font-size: var(--text-sm); color: var(--color-ink-2); line-height: 1.6; }
.source__v a { color: var(--color-accent-deep); }

/* ─────────────────────────── HANDOFF ─────────────────────────── */
/* Workflow handoff, not "related links". */
.handoff { margin-bottom: var(--space-2xl); }
.handoff__k {
  font-family: var(--font-mono);
  font-size: var(--text-2xs);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--color-muted);
  margin-bottom: var(--space-md);
}
.handoff ol { list-style: none; margin: 0; padding: 0; counter-reset: step; }
.handoff li {
  counter-increment: step;
  display: grid;
  grid-template-columns: 2.5rem minmax(0, 1fr);
  gap: var(--space-md);
  padding: var(--space-sm) 0;
  border-bottom: var(--rule-hair) solid var(--color-rule);
  align-items: baseline;
}
.handoff li::before {
  content: counter(step);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--color-accent);
}
/* Link and its gloss share one cell — without the wrapper the span would
   fall into an implicit second grid row inside the 2.5rem counter column. */
.handoff li > div { min-width: 0; }
.handoff li a { color: var(--color-ink); font-weight: 500; white-space: nowrap; }
.handoff li span { color: var(--color-muted); font-size: var(--text-sm); }

/* ─────────────────────────── NOT MODELED ─────────────────────────── */
.not-modeled {
  font-size: var(--text-sm);
  color: var(--color-ink-2);
  padding-left: var(--space-md);
  border-left: var(--rule-thick) solid var(--color-rule-strong);
  margin-bottom: var(--space-xl);
}
.not-modeled strong { font-weight: 600; color: var(--color-ink); }

/* ─────────────────────────── CHIPS ─────────────────────────── */
.chip {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: var(--text-2xs);
  letter-spacing: 0.06em;
  padding: var(--space-3xs) var(--space-2xs);
  border: var(--rule-hair) solid var(--color-rule-strong);
  border-radius: var(--radius-sm);
  color: var(--color-ink-2);
  white-space: nowrap;
}
.chip--go   { border-color: var(--color-accent-line); color: var(--color-accent-deep); background: var(--color-accent-tint); }
.chip--wait { border-color: var(--color-wait); color: var(--color-ink-2); background: var(--color-wait-tint); }
.chip--stop { border-color: var(--color-stop); color: var(--color-ink-2); background: var(--color-stop-tint); }

/* ─────────────────────────── FOOTER (Ft1) ─────────────────────────── */
.site-foot {
  border-top: var(--rule-thick) solid var(--color-ink);
  padding: var(--space-xl) 0 var(--space-2xl);
  margin-top: var(--space-2xl);
}
.site-foot__mark {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-weight: 700;
  letter-spacing: -0.03em;
  overflow-wrap: anywhere;
  min-width: 0;
}
.site-foot__tag { margin: var(--space-2xs) 0 0; font-size: var(--text-sm); color: var(--color-muted); }
.site-foot__row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-md) var(--space-xl);
  margin-top: var(--space-lg);
  font-size: var(--text-xs);
  color: var(--color-muted);
}
.site-foot__row div { min-width: 0; max-width: 32ch; overflow-wrap: anywhere; }
.site-foot__row b {
  display: block;
  font-family: var(--font-mono);
  font-size: var(--text-2xs);
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--color-ink-2);
  margin-bottom: var(--space-2xs);
}
.site-foot a { color: var(--color-ink-2); white-space: nowrap; }
.site-foot a:hover { color: var(--color-accent-deep); }

/* ─────────────────────────── MOCKUP BANNER ─────────────────────────── */
/* Design-review chrome. Removed before these pages go to production. */
.mockup-note {
  background: var(--color-paper-sunk);
  border-bottom: var(--rule-hair) solid var(--color-rule-strong);
  padding: var(--space-xs) 0;
  font-family: var(--font-mono);
  font-size: var(--text-2xs);
  letter-spacing: 0.06em;
  color: var(--color-muted);
}
.mockup-note b { color: var(--color-ink-2); font-weight: 500; }

/* ─────────────────────────── RESPONSIVE ─────────────────────────── */
@media (max-width: 640px) {
  .shell { padding: 0 var(--space-md); }
  .answer__cell + .answer__cell {
    border-left: none;
    border-top: var(--rule-hair) solid var(--color-rule);
    padding-left: 0;
  }
  .handoff li { grid-template-columns: 1.75rem minmax(0, 1fr); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 150ms !important;
    transition-duration: 150ms !important;
  }
}
