/* ============================================================
   CADENCE — parts.css (the page-specific pieces)
   Every colour here is a token from assets/hub.css. Nothing in this file defines a new
   colour, so the contrast gate (tools/theme-contrast.js, which reads hub.css) stays true
   for every page that uses these rules. The rules themselves are copied from the measured
   house sheet (mothyfamily-site/assets/parts.css + base.css), trimmed to what CADENCE uses.

   The phone rules at the end quote the measurements that made them. Check with
   node tools/mobile-probe.js 390 844  (and 320 844).
   ============================================================ */

/* ---------- the page nav strip ----------
   `aria-current="page"` marks the page you are on. The strip scrolls sideways inside itself
   (overflow-x:auto), so a long list never widens the page. Measured: a nav strip that
   overflowed the body pushed the phone page sideways; a scroller inside the strip keeps
   the page at 0px overflow. */
nav.site { display: flex; gap: 4px; overflow-x: auto; padding: 0 0 10px; scrollbar-width: thin }
nav.site a {
  color: var(--text-dim); text-decoration: none; font-size: 14.5px;
  padding: 6px 11px; border-radius: 999px; white-space: nowrap;
  border: 1px solid transparent; transition: .16s;
}
nav.site a:hover { color: var(--text); background: var(--panel-2); border-color: var(--line-soft) }
nav.site a[aria-current="page"] {
  color: var(--on-amber); background: var(--amber); border-color: var(--amber); font-weight: 600;
}
[data-theme="light"] nav.site a[aria-current="page"] { color: #fff9ef }

/* ---------- tables ----------
   Wide tables are the one thing a phone cannot fit. The scroller is the fix; the zebra
   strip is what keeps a reader on the row they are scanning. The 62% tint changes no
   colour pair, so the measured ratios are untouched. */
.tbl-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; overscroll-behavior-x: contain }
.tbl { width: 100%; border-collapse: collapse; margin: 18px 0; font-size: 16px }
.tbl th, .tbl td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line-soft); vertical-align: top }
.tbl th { font-size: 12px; letter-spacing: .12em; text-transform: uppercase; color: var(--text-mute) }
.tbl tr:hover { background: var(--panel-2) }
.tbl tbody tr:nth-child(even) { background: color-mix(in srgb, var(--panel-2) 62%, var(--panel)) }
.tbl td b { color: var(--lamp) }
[data-mode="light"] .tbl td b { color: var(--amber-deep) }
.tbl td.num { font-family: var(--font-mono); font-size: 14.5px; white-space: nowrap }

/* ---------- key/value rows ---------- */
.kv { display: grid; grid-template-columns: minmax(110px, 180px) 1fr; gap: 0 16px; margin: 14px 0 }
.kv > div { padding: 8px 0; border-bottom: 1px solid var(--line-soft); font-size: 16.5px }
.kv .k { color: var(--text-mute); font-size: 12.5px; letter-spacing: .1em; text-transform: uppercase; padding-top: 12px }
.kv .v b { color: var(--lamp) }

/* ---------- callout boxes ----------
   A 4px strip is decoration: identification rides on the label, which clears 4.5:1. */
.note, .warn, .good, .ask {
  border-radius: var(--radius-sm); padding: 14px 18px; margin: 18px 0;
  border: 1px solid var(--line); background: var(--panel-2);
}
.note { border-left: 4px solid var(--teal) }
.warn { border-left: 4px solid var(--rose) }
.good { border-left: 4px solid var(--green) }
.ask  { border-left: 4px solid var(--violet) }
.note b, .warn b, .good b, .ask b { display: block; margin-bottom: 4px; font-size: 13px; letter-spacing: .12em; text-transform: uppercase }
.note b { color: var(--teal) } .warn b { color: var(--rose) }
.good b { color: var(--green) } .ask b { color: var(--violet) }
.note p, .warn p, .good p, .ask p { margin: 6px 0; font-size: 16.5px }

/* ---------- formulas and code ----------
   A design document has numbers. Monospace, on a real background, wrapping (a long formula
   that scrolls sideways is a formula nobody reads). */
.formula, .code {
  font-family: var(--font-mono); font-size: 14.5px; line-height: 1.55;
  background: var(--code-bg); border: 1px solid var(--line-soft);
  border-radius: var(--radius-sm); padding: 12px 14px; margin: 12px 0;
  overflow-x: auto; white-space: pre-wrap; word-break: break-word; color: var(--text);
}
code { font-family: var(--font-mono); font-size: .92em; color: var(--lamp) }
[data-mode="light"] code { color: var(--amber-deep) }

/* ---------- the bar model (the game's meters) ----------
   A bar is a UI object, not text: the fill carries no information on its own, each bar has
   its WORD and its NUMBER beside it, so identification never depends on the fill. */
.bars { display: grid; gap: 10px; margin: 16px 0 }
.bar-row { display: grid; grid-template-columns: 1fr auto; gap: 6px 12px; align-items: center }
.bar-row .nm { font-size: 15.5px; color: var(--text-dim) }
.bar-row .nm b { color: var(--text) }
.bar-row .val { font-family: var(--font-mono); font-size: 14px; color: var(--text-mute) }
.bar { height: 7px; border-radius: 999px; background: var(--ink-3); overflow: hidden; border: 1px solid var(--line-soft) }
.bar > i { display: block; height: 100%; background: linear-gradient(90deg, var(--amber-deep), var(--amber)); border-radius: 999px }

/* ---------- the season timeline ---------- */
.timeline { position: relative; margin: 24px 0; padding-left: 36px }
.timeline::before {
  content: ""; position: absolute; left: 12px; top: 8px; bottom: 8px; width: 2px;
  background: linear-gradient(180deg, var(--amber), var(--line) 78%);
}
.ph { position: relative; margin: 0 0 24px }
.ph::before {
  content: ""; position: absolute; left: -30px; top: 8px; width: 12px; height: 12px;
  border-radius: 50%; background: var(--ink); border: 2.5px solid var(--line);
}
.ph.done::before { background: var(--green); border-color: var(--green) }
.ph.now::before { background: var(--amber); border-color: var(--amber); box-shadow: 0 0 0 4px color-mix(in srgb, var(--amber) 22%, transparent) }
.ph h3 { margin: 0 0 4px; font-size: 20px }
.ph .when { font-size: 12.5px; letter-spacing: .12em; text-transform: uppercase; color: var(--text-mute) }
.ph p { margin: 8px 0 0; font-size: 16.5px; color: var(--text-dim) }

/* ---------- the theme sheet: a theme page's own accent ----------
   Each theme page sets --svc on itself; the strip, the tile, and the accent word follow it,
   all from tokens already measured in hub.css. */
.a-ancient { --svc: var(--amber) }
.a-space   { --svc: var(--teal) }
.a-deep    { --svc: var(--violet) }
.a-frontier{ --svc: var(--green) }
.a-neon    { --svc: var(--rose) }
.a-ancient, .a-space, .a-deep, .a-frontier, .a-neon { border-left-color: var(--svc) }
.svc-word { color: var(--svc) }
.hero .theme-badge {
  display: inline-flex; align-items: center; gap: 8px; font-size: 12.5px; font-weight: 700;
  letter-spacing: .16em; text-transform: uppercase; color: var(--svc);
  border: 1px solid color-mix(in srgb, var(--svc) 45%, transparent);
  background: color-mix(in srgb, var(--svc) 12%, transparent);
  padding: 4px 12px; border-radius: 999px; margin: 0 0 12px;
}

/* ---------- print ---------- */
@media print {
  header.site, .theme-ctl, .cta-row, nav.site, .tag, .tile { display: none !important }
  body { background: #fff; color: #111; font-size: 11pt; line-height: 1.4 }
  .wrap { max-width: 100%; padding: 0 }
  h1 { font-size: 22pt }
  .tbl th, .tbl td { border-color: #999; font-size: 10pt }
  .formula, .code { border-color: #999; background: #fff; font-size: 9.5pt }
  .card, .plain, .note, .warn, .good, .ask, .ph { break-inside: avoid; box-shadow: none; border-color: #999 }
  a::after { content: " — " attr(href); font-size: 9pt; color: #555 }
}

/* ---------- the phone ----------
   Rules copied from the measured house sheet; the measurements are quoted there and were
   re-measured on this site with tools/mobile-probe.js. */
@media (max-width: 720px), (pointer: coarse) {
  nav.site a, a.cta, .card .go, .brand { min-height: 44px; display: inline-flex; align-items: center }
  nav.site a { padding: 11px 14px; font-size: 15px }
  .brand .who span { display: none }
  .brand img { width: 34px; height: 34px; flex-basis: 34px }
  .brand .who b { font-size: 17px }
  .brand-row { padding: 6px 0 2px; gap: 10px }
  .hero { padding: 16px 0 10px }
  .hero h1 { font-size: clamp(27px, 7.5vw, 38px) }
  .lede { font-size: 17.5px }
  section { margin: 26px 0 }
  .tbl th, .tbl td { padding: 9px 9px }
  .wrap { padding-left: max(16px, env(safe-area-inset-left)); padding-right: max(16px, env(safe-area-inset-right)) }
  header.site { padding-top: env(safe-area-inset-top) }
  nav.site { padding: 0 0 8px; gap: 6px }
}

@media (hover: none) {
  a.card:hover, a.cta:hover { transform: none }
  .tbl tr:hover { background: transparent }
  nav.site a:hover { background: transparent }
}

a, button { touch-action: manipulation }

/* A text link inside a paragraph measured 22px tall at 320px: a thumb lands on the words, not
   the target. Every text link in a prose block gets its own band. Ungated on purpose. */
.plain a, .body-sm a, .sub a, .note a, .warn a, .good a, .ask a, .ph p a, footer.site a {
  display: inline-block; min-height: 22px; padding: 12px 2px; line-height: 1.35
}
