/* numen.css: the one stylesheet every Numen document links.
   Dark is the house look; add class="light" on <html> for the light variant.
   Tokens follow the open-design DESIGN.md schema names (--bg, --surface, --fg, --accent ...).
   Running header/footer: set --run-head / --run-foot (CSS strings) on :root in the page.
   See ../DESIGN.md for the rules behind every value. */
@import url("fonts/numen-fonts.css");

:root {
  /* identity (numen-site body[data-theme=dark]) */
  --bg: #1E1A16; --bg-alt: #241F1A; --surface: #2A2520; --surface-warm: #3A2B20; --stage: #17130F;
  --fg: #F3EDE2; --fg-2: #CBBFAF; --muted: #9A8E80; --meta: #D98A66;
  --border: #352E27; --border-soft: #2A2520; --rule: #54493D;
  --accent: #D98A66; --accent-on: #1E1A16; --clay: #D9C6AE; --fig: #6B4A3F;
  /* severity, fleet-wide fixed (fills); -ink variants are text-on-dark tints */
  --info: #5E8C5A; --warning: #C9861F; --urgent: #A23425;
  --info-ink: #9FCB97; --warning-ink: #E8B55A; --urgent-ink: #E07A66;
  --success: var(--info); --warn: var(--warning); --danger: var(--urgent);
  /* chart palette, in order */
  --chart-1: #D98A66; --chart-2: #D9C6AE; --chart-3: #5E8C5A; --chart-4: #C9861F;
  --chart-5: #A23425; --chart-6: #9A8E80; --chart-7: #A9C0DE; --chart-8: #54493D;
  /* root-cause lines under briefing findings (Root cause / Context / Fix) */
  --cause-root: #7D98B3; --cause-context: #8FA98A; --cause-fix: var(--accent);
  /* type */
  --font-display: 'Newsreader', Georgia, serif;
  --font-body: 'Karla', -apple-system, 'Helvetica Neue', sans-serif;
  --font-mono: 'SF Mono', ui-monospace, Menlo, monospace;
  --text-xs: 9px; --text-sm: 11px; --text-base: 12.5px; --text-lg: 15px;
  --text-xl: 21px; --text-2xl: 30px; --text-3xl: 46px;
  --leading-body: 1.5; --leading-tight: 1.02; --tracking-display: -0.018em;
  /* space + shape */
  --space-1: 4px; --space-2: 8px; --space-3: 12px; --space-4: 16px; --space-5: 20px;
  --space-6: 24px; --space-8: 32px; --space-12: 48px;
  --radius-sm: 4px; --radius-md: 8px; --radius-lg: 12px; --radius-pill: 9999px;
  --page-x: 0.6in;   /* side margin, applied as body padding so screen and print share one width */
  --run-head: ""; --run-foot: "";
}
html.light {
  --bg: #F7F2E9; --bg-alt: #FFFDF8; --surface: #FFFDF8; --surface-warm: #EFE5D6; --stage: #F7F2E9;
  --fg: #2E2A26; --fg-2: #4A423B; --muted: #7A6E62; --meta: #C96F4A;
  --border: #E2D8C9; --border-soft: #EFE7DB; --rule: #D9C6AE;
  --accent: #C96F4A; --accent-on: #FFFDF8; --fig: #6B4A3F;
  --info-ink: #4B7548; --warning-ink: #9A6412; --urgent-ink: #A23425;
  --chart-2: #B9A486; --chart-8: #6B4A3F;
  --cause-root: #4A6585; --cause-context: #55704F;
}

/* ── page + running chrome ─────────────────────────────────────────────── */
@page {
  size: Letter; margin: 0.62in 0; background: var(--bg);
  @top-left { content: var(--run-head); padding-left: var(--page-x); color: var(--muted);
    font: 700 7.5px/1 var(--font-body); letter-spacing: 0.22em; text-transform: uppercase; }
  @bottom-left { content: var(--run-foot); padding-left: var(--page-x); color: var(--muted); font: 7.5px/1.3 var(--font-body); }
  @bottom-right { content: counter(page) " / " counter(pages); padding-right: var(--page-x); color: var(--muted);
    font: 7.5px/1 var(--font-body); width: 0.9in; text-align: right; }
}
@page :first { margin-top: 0; }   /* the hero sits flush with the top edge */
@page slide { size: Letter landscape; margin: 0; @top-left { content: none } @bottom-left { content: none } @bottom-right { content: none } }

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--fg); }
body { padding: 0 var(--page-x); font: var(--text-base)/var(--leading-body) var(--font-body);
  -webkit-print-color-adjust: exact; print-color-adjust: exact; }

/* ── type ──────────────────────────────────────────────────────────────── */
h1, h2, h3, .display { font-family: var(--font-display); font-weight: 500; letter-spacing: var(--tracking-display); color: var(--fg); }
h1 { font-size: var(--text-2xl); line-height: var(--leading-tight); margin: 0 0 var(--space-3); }
h2 { font-size: var(--text-xl); line-height: 1.15; margin: var(--space-6) 0 var(--space-3); padding-bottom: var(--space-2);
  border-bottom: 1px solid var(--rule); break-after: avoid; }
h3 { font-size: var(--text-lg); margin: var(--space-5) 0 var(--space-2); break-after: avoid; }
h1 em, h2 em, h3 em { font-style: italic; font-weight: 400; color: var(--accent); }
p { margin: 0 0 var(--space-3); orphans: 3; widows: 3; }
.lede { font-size: var(--text-lg); color: var(--fg-2); max-width: 62ch; }
.muted, small { color: var(--muted); }
.eyebrow { font-size: var(--text-xs); font-weight: 700; letter-spacing: 0.3em; text-transform: uppercase; color: var(--accent); margin: 0 0 var(--space-2); }
a { color: var(--accent); text-decoration: none; }
strong { color: var(--fg); font-weight: 700; }
ul, ol { margin: 0 0 var(--space-3); padding-left: 1.2em; }
li { margin: 0 0 var(--space-1); }
li::marker { color: var(--accent); }
code { font: 0.88em var(--font-mono); color: var(--clay); background: var(--surface); padding: 0.05em 0.3em; border-radius: var(--radius-sm); }
pre { font: 10.5px/1.55 var(--font-mono); background: var(--stage); color: var(--fg-2); border: 1px solid var(--border);
  border-radius: var(--radius-md); padding: var(--space-3) var(--space-4); white-space: pre-wrap; break-inside: avoid; }
pre .cmt { color: var(--muted); } pre .ok { color: var(--info-ink); } pre .var { color: var(--accent); }
html.light code { color: var(--fig); }

/* ── hero: the dark stage with the wordmark (first thing in <body>) ────── */
.hero { margin: 0 calc(-1 * var(--page-x)) var(--space-6); padding: 0.55in var(--page-x) 0.4in;
  background: radial-gradient(120% 90% at 85% 10%, #3A2B20 0%, #211B16 45%, #17130F 100%); border-bottom: 3px solid var(--accent); }
html.light .hero { background: radial-gradient(120% 90% at 85% 10%, #FFFDF8 0%, #F7F2E9 55%, #EFE5D6 100%); }
.hero .logo { width: 112px; height: auto; display: block; margin-bottom: var(--space-6); }
.logo text { fill: var(--fg); } .logo path { stroke: var(--accent); }   /* inline wordmark follows the theme */
.hero h1 { font-size: var(--text-3xl); line-height: 0.98; letter-spacing: -0.03em; max-width: 18ch; margin: 0; }
.hero .dek { font-size: 13.5px; color: var(--fg-2); max-width: 58ch; margin: var(--space-3) 0 0; }
.hero .window { font-size: var(--text-xs); letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); margin: var(--space-4) 0 0; }
.masthead { display: flex; justify-content: space-between; align-items: flex-end; gap: var(--space-6); }

/* ── tables ────────────────────────────────────────────────────────────── */
table { width: 100%; border-collapse: collapse; font-size: 11.5px; margin: 0 0 var(--space-4); }
thead { display: table-header-group; }   /* repeats on every page a table spans */
th { text-align: left; font-size: 8.5px; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted);
  background: var(--bg-alt); border-bottom: 1px solid var(--rule); padding: 0.5em 0.7em; }
td { border-bottom: 1px solid var(--border); padding: 0.36em 0.7em; vertical-align: top; }
th:first-child, td:first-child { padding-left: 0.2em; }
tr { break-inside: avoid; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
td.money, td.big { font-family: var(--font-display); font-size: 14px; font-weight: 500; text-align: right; white-space: nowrap; padding-right: 1em; }
td.big { text-align: right; width: 2.2em; }
td.sig, td.code { font: 10px var(--font-mono); color: var(--fg); }
td.nowrap { white-space: nowrap; }
tr.total td { font-weight: 700; border-top: 2px solid var(--accent); border-bottom: none; }

/* ── kpi cards, cards, callouts ────────────────────────────────────────── */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: var(--space-3); margin: 0 0 var(--space-5); break-inside: avoid; }
.kpi, .card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md); padding: var(--space-3) var(--space-4); break-inside: avoid; }
.kpi .label { font-size: var(--text-xs); font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); }
.kpi .value { font: 500 28px/1.1 var(--font-display); letter-spacing: var(--tracking-display); margin-top: var(--space-1); }
.kpi .delta { font-size: var(--text-sm); color: var(--muted); margin-top: 2px; }
.up { color: var(--info-ink); } .down { color: var(--urgent-ink); }
.kpi.urgent .value { color: var(--urgent-ink); } .kpi.warning .value { color: var(--warning-ink); } .kpi.info .value { color: var(--info-ink); }
.card h3 { margin-top: 0; }
.callout { border-left: 3px solid var(--accent); background: var(--surface); border-radius: 0 var(--radius-md) var(--radius-md) 0;
  padding: var(--space-3) var(--space-4); margin: 0 0 var(--space-4); break-inside: avoid; }
.callout.info { border-color: var(--info); } .callout.warning { border-color: var(--warning); } .callout.urgent { border-color: var(--urgent); }
.callout > :last-child { margin-bottom: 0; }
.quote { font: 400 italic 17px/1.45 var(--font-display); color: var(--fg); }

/* ── chips: .sev = severity fill, .urg = outlined rank tag, .chip = neutral ─ */
.chip, .sev { display: inline-block; font-size: 8.5px; font-weight: 700; letter-spacing: 0.04em; padding: 0.15em 0.6em;
  border-radius: var(--radius-pill); white-space: nowrap; margin-right: 0.25em; background: var(--surface); color: var(--fg-2); border: 1px solid var(--border); }
.sev { border: 0; color: #FFF8F2; }
.sev.urgent { background: var(--urgent); } .sev.warning { background: var(--warning); color: #2E2A26; } .sev.info { background: var(--info); }
.urg { display: inline-block; font: 700 8px/1.4 var(--font-body); letter-spacing: 0.08em; text-transform: uppercase; padding: 0.1em 0.5em;
  border-radius: 3px; border: 1px solid currentColor; white-space: nowrap; vertical-align: 0.15em; }
.urg.critical, .urg.high, .urg.urgent { color: var(--urgent-ink); } .urg.medium, .urg.warning { color: var(--warning-ink); } .urg.low, .urg.info { color: var(--info-ink); }

/* ── chart frame: fixed-height wrapper, canvas fills it ────────────────── */
figure, .figure { margin: 0 0 var(--space-4); break-inside: avoid; }
.chart { position: relative; width: 100%; }   /* set height inline: style="height:260px" */
figcaption { font-size: var(--text-sm); color: var(--muted); margin-top: var(--space-2); }

/* ── bar-split: horizontal 100% stacked bar in plain HTML (prints crisp, no canvas) ─
   <figure class="bar-split"><div class="bar"><span class="seg [on-dark]" style="width:40%;background:#D98A66">40%</span>..</div>
   <div class="legend"><span><i class="key" style="background:#D98A66"></i><b>Label</b> $1,200, 40%</span>..</div></figure>
   Small rows: <figure class="bar-split rows"><div class="row"><div class="name">atlas<small>..</small></div><div class="bar">..</div></div>..</figure> */
.bar-split .bar { display: flex; width: 100%; height: 28px; border-radius: var(--radius-sm); overflow: hidden; background: var(--surface); }
.bar-split .seg { display: flex; align-items: center; justify-content: center; flex: none; overflow: hidden; white-space: nowrap;
  font: 700 9.5px/1 var(--font-body); color: #1E1A16; box-shadow: inset -1px 0 0 var(--bg); }
.bar-split .seg:last-child { box-shadow: none; }
.bar-split .seg.on-dark { color: #F3EDE2; }
.bar-split .legend { display: flex; flex-wrap: wrap; gap: 3px 16px; margin-top: var(--space-2); font-size: 10.5px; color: var(--fg-2); }
.bar-split .legend b { color: var(--fg); font-weight: 700; margin-right: 0.2em; }
.bar-split .key { display: inline-block; width: 9px; height: 9px; border-radius: 2px; margin-right: 5px; vertical-align: -1px; }
.bar-split.rows .row { display: grid; grid-template-columns: 10em 1fr; gap: var(--space-3); align-items: center; margin: 0 0 6px; break-inside: avoid; }
.bar-split.rows .bar { height: 16px; }
.bar-split.rows .seg { font-size: 8.5px; }
.bar-split .name { font-size: 11px; line-height: 1.15; color: var(--fg); }
.bar-split .name small { display: block; font-size: 9px; color: var(--muted); }

/* ── layout helpers ────────────────────────────────────────────────────── */
.two { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-6); align-items: start; }
.three { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--space-4); align-items: start; }
.two > *, .three > * { min-width: 0; }
.two h3, .three h3 { margin-top: 0; }
.keep { break-inside: avoid; }
.break { break-before: page; }
.closing { border-top: 3px solid var(--accent); padding-top: var(--space-3); margin-top: var(--space-8); font-size: var(--text-sm); color: var(--fg-2); break-inside: avoid; }
.ranked { list-style: none; padding: 0; margin: 0; }
.ranked > li { padding: var(--space-3) 0; border-bottom: 1px solid var(--border); break-inside: avoid; margin: 0; }
.ranked > li:last-child { border-bottom: 0; }
.ranked .head { font: 500 14.5px/1.3 var(--font-display); margin: 0 0 var(--space-1); }
.ranked .head .n { color: var(--accent); margin-right: 0.35em; }
.ranked .line { margin: 0; }
.ranked .meta { margin: var(--space-1) 0 0; font-size: 10.5px; color: var(--muted); }

/* ── root-cause lines (briefings): three short coloured lines under a finding ── */
.cause { margin: var(--space-1) 0 var(--space-2); padding-left: var(--space-3); border-left: 1px solid var(--rule);
  font-size: 10.5px; line-height: 1.45; break-inside: avoid; overflow-wrap: anywhere; }
.cause p { margin: 1px 0; }
.cause b { font-weight: 700; margin-right: 0.3em; }
.cause-root { color: var(--cause-root); }
.cause-context { color: var(--cause-context); }
.cause-fix { color: var(--cause-fix); }
.cause .cat { font: 9px/1 var(--font-mono); letter-spacing: 0.02em; border: 1px solid currentColor; border-radius: var(--radius-pill);
  padding: 1px 5px; margin-right: 0.3em; white-space: nowrap; }
.cause .seen { color: var(--muted); margin-left: 0.4em; white-space: nowrap; }
li > .cause { margin-top: 2px; }
.ranked > li.has-causes { break-inside: auto; }   /* a client with several caused items may span pages; each .cause block stays whole */
.ranked > li.has-causes .line { break-after: avoid; }
@media screen and (max-width: 480px) {   /* narrow panes (Dev Center, 360px): slimmer side margin, tighter cause indent; print is unaffected */
  :root { --page-x: 14px; }
  .cause { padding-left: var(--space-2); font-size: 11px; }
}

/* ── slides (deck template): one landscape page per <section class="slide"> ─ */
body.deck { padding: 0; }
.slide { page: slide; position: relative; width: 11in; height: 8.5in; overflow: hidden; padding: 0.75in 0.9in;
  display: flex; flex-direction: column; justify-content: center; break-after: page; background: var(--bg); }
.slide:last-child { break-after: auto; }
.slide h1 { font-size: 54px; line-height: 1; max-width: 18ch; }
.slide h2 { font-size: 36px; border: 0; margin: 0 0 var(--space-4); max-width: 24ch; }
.slide .body { font-size: 20px; color: var(--fg-2); max-width: 56ch; }
.slide .card { padding: var(--space-5); } .slide .card h3 { font-size: 22px; } .slide .card p { font-size: 15px; }
.slide .stat { font: 500 140px/1 var(--font-display); color: var(--accent); letter-spacing: -0.04em; margin: var(--space-3) 0; }
.slide .logo { position: absolute; left: 0.9in; bottom: 0.45in; width: 80px; }
.slide .count { position: absolute; right: 0.9in; bottom: 0.5in; font-size: 10px; color: var(--muted); letter-spacing: 0.2em; }
.slide.stage { background: radial-gradient(120% 90% at 85% 10%, #3A2B20 0%, #211B16 45%, #17130F 100%); }
