/* shell.css — the page furniture both / and /analytics/ wear: the sticky
 * header with its nav and theme switch, the shared type scale, the metric and
 * table primitives, the footer, and the dark palette.
 *
 * Loaded after toolforge-ds.css, so every value here is a ToolForge token.
 * THE DARK RULE: dark mode adds no colour. It re-points the surface tokens at
 * values the design system already publishes for reversed surfaces
 * (ink-sunken, ink-raised, ink-line, code-rev, muted-rev), so the palette is
 * still the same 27 and nothing had to be invented for a second theme.
 */
* { box-sizing: border-box; }
body.tf { overflow-x: hidden; margin: 0; background: var(--tf-canvas); }

/* ---------------------------------------------------------------- the dark
 * theme. Only the neutrals move. Red and yellow keep their published values,
 * because they are signal, not surface, and a signal that changes meaning
 * between themes is not a signal. */
:root[data-theme="dark"] {
  --tf-canvas: #141414;   /* ink-sunken  — the page behind everything */
  --tf-paper:  #1A1A1A;   /* ink-raised  — cards, panel, header */
  --tf-ink:    #F1EFEA;   /* canvas      — type and every 2px border */
  --tf-ink-60: #D8D4CE;   /* code-rev    — secondary type */
  --tf-muted:  #B8B4AE;   /* muted-rev   — tertiary type */
  --tf-line:   #262626;   /* ink-line    — hairlines and tracks */
  --tf-divider:#262626;
  --tf-zebra:  #141414;
  --tf-disabled: #5E5E5E; /* pipe-dark */
  /* Anything painted ON --tf-ink is now dark-on-light and needs the inverse. */
  --tf-on-ink-body: #45423D;
}
/* The theme is chosen before first paint by the inline script in <head>, so
 * there is no flash. This only smooths the click that changes it. */
@media (prefers-reduced-motion: no-preference) {
  body.tf { transition: background-color 120ms linear, color 120ms linear; }
}

.c-wrap { max-width: 1280px; margin: 0 auto; padding: 0 var(--tf-s5) var(--tf-s8); width: 100%; }

/* ---- the sticky header. It stays put while the page scrolls, so the nav and
   the theme switch are always reachable. ---- */
.c-top {
  position: sticky; top: 0; z-index: 40;
  background: var(--tf-paper); border-bottom: 3px solid var(--tf-ink);
}
.c-top__in { max-width: 1280px; margin: 0 auto; padding: var(--tf-s3) var(--tf-s5); }
.c-top__row { display: flex; align-items: center; gap: var(--tf-s4); flex-wrap: wrap; }
.c-mark { display: flex; align-items: center; gap: var(--tf-s3); flex: 0 0 auto; }
/* The lockup is an anchor to toolforge.ai. `.tf a` (0,0,1,1) paints every anchor red and
   underlined, which would repaint the wordmark; these two lines hold it at ink. */
.tf a.c-mark, .tf a.c-mark:hover { color: var(--tf-ink); text-decoration: none; }
.c-mark svg { width: 30px; height: auto; display: block; }
/* The mark ships with fill="#0B0B0B" baked into the path. On a dark header that
   is a black square on a black bar, so the fill is taken over by the token.
   NOT a border-radius: the mark carries its own 5.8% corner inside the path,
   and the design system forbids adding radius to its container. */
.c-mark svg path { fill: var(--tf-ink); }
.c-mark b { font-family: var(--tf-sans); font-weight: 600; font-size: 19px; letter-spacing: -0.025em; }

/* ---- nav + theme switch. Both are square segmented controls: one 2px box,
   2px between the segments, the active one reversed. `color: var(--tf-paper)`
   on an ink ground is what makes them self-inverting — in dark, ink is light
   and paper is dark, and the same two lines still read correctly. ---- */
.c-nav, .c-theme { display: flex; border: 2px solid var(--tf-ink); flex: 0 0 auto; }
.c-theme { margin-left: auto; }
.tf .c-nav a, .c-theme__b {
  display: flex; align-items: center; justify-content: center;
  min-height: 36px; padding: 0 14px;
  font-family: var(--tf-label); font-weight: 700; letter-spacing: 0.12em;
  text-transform: uppercase; text-decoration: none;
  background: var(--tf-paper); color: var(--tf-ink); border: 0; cursor: pointer;
}
.tf .c-nav a { font-size: 12px; }
.c-theme__b { font-size: 11px; color: var(--tf-ink-60); padding: 0 12px; }
.tf .c-nav a + a, .c-theme__b + .c-theme__b { border-left: 2px solid var(--tf-ink); }
.tf .c-nav a:hover, .c-theme__b:hover { background: var(--tf-yellow-tint); color: var(--tf-on-yellow-body); }
.tf .c-nav a[aria-current="page"], .c-theme__b[aria-pressed="true"] {
  background: var(--tf-ink); color: var(--tf-paper);
}
.tf .c-nav a:focus-visible, .c-theme__b:focus-visible { outline: 3px solid var(--tf-yellow); outline-offset: 2px; }

/* The control labels are for a screen reader only. Without this rule they
   paint as ordinary text in the flex row. */
.tf-sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
}

/* ---- page furniture ---- */
.c-head { padding: var(--tf-s7) 0 var(--tf-s5); }
.c-eyebrow { font-family: var(--tf-label); font-size: 13px; font-weight: 700; letter-spacing: 0.18em;
  text-transform: uppercase; color: var(--tf-muted); margin: 0 0 var(--tf-s2); }
h1.c-h1 { font-family: var(--tf-sans); font-size: 40px; font-weight: 600; letter-spacing: -0.025em;
  line-height: 1.15; margin: 0 0 var(--tf-s3); text-wrap: balance; color: var(--tf-ink); }
h2.c-h2 { font-family: var(--tf-sans); font-size: 28px; font-weight: 600; letter-spacing: -0.02em;
  line-height: 1.25; margin: 0 0 var(--tf-s3); color: var(--tf-ink); }
h3.c-h3 { font-family: var(--tf-sans); font-size: 20px; font-weight: 600; letter-spacing: -0.01em;
  margin: 0 0 var(--tf-s3); color: var(--tf-ink); }
p.c-p { font-family: var(--tf-sans); font-size: 16px; line-height: 1.7; margin: 0 0 var(--tf-s4);
  max-width: 70ch; color: var(--tf-ink); }
.c-sec { padding: var(--tf-s6) 0; border-top: 2px solid var(--tf-line); }
.c-note { font-family: var(--tf-sans); font-size: 14px; line-height: 1.6; color: var(--tf-ink-60);
  max-width: 74ch; margin: 0 0 var(--tf-s4); }

/* ---- metrics ---- */
.c-metrics { display: grid; grid-template-columns: repeat(auto-fit, minmax(168px, 1fr)); gap: var(--tf-s3); }
.c-metric { background: var(--tf-paper); border: 2px solid var(--tf-ink); padding: var(--tf-s4); }
.c-metric__v { display: block; font-family: var(--tf-sans); font-size: 34px; font-weight: 600;
  letter-spacing: -0.03em; line-height: 1; color: var(--tf-ink); font-variant-numeric: tabular-nums; }
.c-metric__l { display: block; margin-top: 8px; font-family: var(--tf-label); font-size: 12px;
  font-weight: 700; letter-spacing: 0.13em; text-transform: uppercase; color: var(--tf-ink-60); }
.c-metric__note { display: block; margin-top: 6px; font-family: var(--tf-sans); font-size: 13px;
  color: var(--tf-muted); }

/* ---- tables ---- */
.c-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.c-table { border-collapse: collapse; width: 100%; background: var(--tf-paper);
  border: 2px solid var(--tf-ink); font-family: var(--tf-sans); font-size: 14px; min-width: 520px;
  color: var(--tf-ink); }
.c-table th { font-family: var(--tf-label); font-size: 12px; font-weight: 700; letter-spacing: 0.11em;
  text-transform: uppercase; text-align: left; padding: 10px 12px; border-bottom: 2px solid var(--tf-ink);
  white-space: nowrap; }
.c-table td { padding: 9px 12px; border-bottom: 1px solid var(--tf-hairline-soft); vertical-align: top; }
.c-table tbody tr:nth-child(even) { background: var(--tf-row-zebra); }
.c-num { font-family: var(--tf-mono); font-size: 13px; white-space: nowrap;
  font-variant-numeric: tabular-nums; }

/* ---- footer ---- */
.c-foot { border-top: 3px solid var(--tf-ink); background: var(--tf-ink); color: var(--tf-on-ink-body);
  padding: var(--tf-s6) 0; margin-top: var(--tf-s7); }
.c-foot .c-wrap { padding-bottom: 0; }
.c-foot p { font-family: var(--tf-sans); font-size: 14px; line-height: 1.7; margin: 0 0 8px; }
.tf .c-foot a { color: var(--tf-paper); }
.c-foot code { font-family: var(--tf-mono); font-size: 13px; color: var(--tf-paper); }

@media (max-width: 720px) {
  h1.c-h1 { font-size: 30px; }
  h2.c-h2 { font-size: 23px; }
  .c-wrap { padding-left: var(--tf-s4); padding-right: var(--tf-s4); }
  .c-top__in { padding-left: var(--tf-s4); padding-right: var(--tf-s4); }
  .c-top__row { gap: var(--tf-s3); }
  .tf .c-nav a { padding: 0 10px; letter-spacing: 0.08em; }
  .c-theme__b { padding: 0 9px; letter-spacing: 0.08em; }
}
