/* FigureRule brand tokens 1.0: ink, active figure (teal, non-text only), product index (cobalt), paper, grid.
   Readings are shown in words, in ink or white; teal marks the active figure only. */
:root {
  --ink: #17324D; --teal: #2B9D93; --cobalt: #2D5BFF; --paper: #FBF9F5; --gridc: #D7E0E7;
  --bg: var(--paper); --panel: #ffffff; --fg: var(--ink); --muted: #4C6378; --line: var(--gridc);
  --accent: var(--cobalt); --accent-soft: #EBF0FF; --tint: #EEF2F5; --s1: var(--cobalt);
  --sans: "Nimbus Sans", "Helvetica Neue", Helvetica, Arial, system-ui, sans-serif;
  --mono: "DejaVu Sans Mono", ui-monospace, Menlo, Consolas, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0F2437; --panel: var(--ink); --fg: #FFFFFF; --muted: #C2CFDB; --line: #2E4B66;
    --accent: #9DB3FF; --accent-soft: #22406A; --tint: #1E3B57; --s1: #9DB3FF; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0F2437; --panel: var(--ink); --fg: #FFFFFF; --muted: #C2CFDB; --line: #2E4B66;
  --accent: #9DB3FF; --accent-soft: #22406A; --tint: #1E3B57; --s1: #9DB3FF; color-scheme: dark;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--fg); font-family: var(--sans); font-size: 15px; line-height: 1.5;
  padding-bottom: env(safe-area-inset-bottom, 0px); }
img { max-width: 100%; }
[hidden] { display: none !important; }
a { color: var(--accent); }
h1, h2, h3 { margin: 0; text-wrap: balance; }
p { margin: 0; max-width: 68ch; }
.muted { color: var(--muted); }
.small { font-size: .86rem; }
.eyebrow { font-family: var(--mono); font-size: .78rem; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.pt { display: inline-block; width: .6em; height: .6em; background: var(--teal); margin-right: .5em; vertical-align: .05em; }

/* Site chrome */
.site { position: sticky; top: 0; z-index: 5; background: var(--panel); border-bottom: 1px solid var(--line); padding-top: env(safe-area-inset-top, 0px); }
.site .in { max-width: 72rem; margin: 0 auto; padding: .5rem 16px; display: flex; align-items: center; justify-content: space-between; gap: .5rem 1rem; flex-wrap: wrap; }
.site .brand { display: inline-flex; padding: 4px 0; }
.site .brand img { height: 42px; width: auto; display: block; }
.site nav { display: flex; gap: .25rem; flex-wrap: wrap; }
.site nav a { color: var(--fg); text-decoration: none; font-weight: 600; font-size: .92rem; padding: .4rem .7rem; border-radius: 6px; }
.site nav a:hover { background: var(--tint); }
.site nav a[aria-current="page"] { box-shadow: inset 0 -3px 0 var(--teal); }
.site nav a:focus-visible, .btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.on-dark { display: none !important; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .on-light { display: none !important; }
  :root:not([data-theme="light"]) .on-dark { display: block !important; }
}

/* Views */
#home, #briefscreen, #portfolio { display: none; }
body.viewing-home #home, body.viewing-brief #briefscreen, body.viewing-clients #portfolio { display: block; }

/* Buttons and cards */
.btn { all: unset; cursor: pointer; padding: .5rem 1rem; border-radius: 6px; border: 1px solid var(--line); font-weight: 600; font-size: .92rem; text-align: center; color: var(--fg); }
.btn:hover { border-color: var(--accent); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--panel); }
.cta { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; margin: 1.4rem 0 .9rem; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 1.25rem 1.4rem; min-width: 0; }
.tag { display: inline-block; font-family: var(--mono); font-size: .72rem; letter-spacing: .04em; text-transform: uppercase; padding: .15rem .5rem; border: 1px solid var(--fg); border-radius: 4px; white-space: nowrap; }
.tag.soon { border-style: dashed; color: var(--muted); border-color: var(--muted); }
.vbadge { display: inline-flex; align-items: center; gap: .4rem; width: fit-content; font-weight: 700; font-size: .8rem; letter-spacing: .06em; text-transform: uppercase; padding: .3rem .7rem; border-radius: 999px; border: 1.5px solid currentColor; color: var(--fg); white-space: nowrap; }
.vbadge.solid { background: var(--fg); color: var(--panel); border-color: var(--fg); }

/* Overview */
.home { max-width: 72rem; margin: 0 auto; padding: 2.5rem 16px 3rem; display: flex; flex-direction: column; gap: 2.75rem; }
.hero { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 2rem; align-items: center; }
.hero h1 { font-size: clamp(2rem, 4.5vw, 3rem); line-height: 1.08; letter-spacing: -.01em; margin: .4rem 0 .8rem; }
.hero .lead { font-size: 1.15rem; color: var(--muted); max-width: 38ch; }
.hero .lockup img { width: 100%; max-width: 520px; height: auto; display: block; }
.home h2 { font-size: 1.5rem; margin: 0 0 1rem; }
.home .card h3 { margin: 0 0 .4rem; font-size: 1.05rem; }
.home .card p { color: var(--muted); }
.grid3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 17rem), 1fr)); gap: 1rem; }
.readings { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 13rem), 1fr)); gap: .75rem; }
.readings .card { display: flex; flex-direction: column; gap: .45rem; }
.caps td, .caps th { white-space: normal; }
.caps + p { margin-top: .75rem; }
.foot-site { border-top: 1px solid var(--line); padding-top: 1.25rem; display: flex; flex-direction: column; gap: .5rem; }

/* Brief and clients */
.paper { max-width: 60rem; margin: 1.25rem auto 3rem; padding: 0 16px; display: flex; flex-direction: column; gap: 1.25rem; }
.paper-inner { display: flex; flex-direction: column; gap: 1.25rem; }
.picker { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; flex-wrap: wrap; }
.seg .btn { border: 0; border-radius: 0; }
.seg .btn[aria-selected="true"] { background: var(--accent); color: var(--panel); }
.brief-lockup { height: 76px; width: auto; margin-bottom: .6rem; }
.btitle { font-size: 2rem; line-height: 1.15; margin: .1rem 0 .2rem; }
.bmeta { font-size: .85rem; color: var(--muted); display: flex; flex-wrap: wrap; gap: .25rem 1rem; }
.verdict { display: grid; grid-template-columns: auto 1fr; gap: 1rem; align-items: start; border-left: 6px solid var(--fg); }
.verdict h2 { font-size: 1.4rem; line-height: 1.25; margin: 0 0 .35rem; }
.verdict p { font-size: 1.02rem; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 12rem), 1fr)); gap: .75rem; }
.kpi { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: .9rem 1rem; display: flex; flex-direction: column; gap: .2rem; min-width: 0; }
.kpi .k { font-size: .74rem; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; font-weight: 600; }
.kpi .v { font-size: 1.6rem; font-variant-numeric: tabular-nums; line-height: 1.2; text-transform: capitalize; }
.kpi .s { font-size: .85rem; color: var(--muted); }
.kpi.alert .v { font-weight: 700; text-decoration: underline; text-decoration-color: var(--teal); text-decoration-thickness: 3px; text-underline-offset: 5px; }
.sect h3 { font-size: 1.15rem; margin: 0 0 .75rem; }
.sect > p + ul { margin-top: .75rem; }
.conds { margin: 0; padding-left: 1.1rem; display: flex; flex-direction: column; gap: .35rem; font-size: .92rem; }
.conds + .conds { margin-top: .75rem; }
ol.actions { margin: 0 0 .6rem; padding: 0; list-style: none; counter-reset: a; display: flex; flex-direction: column; gap: .85rem; }
ol.actions li { counter-increment: a; display: grid; grid-template-columns: 2rem 1fr; gap: .6rem; align-items: start; }
ol.actions li::before { content: counter(a); width: 1.7rem; height: 1.7rem; border-radius: 50%; background: var(--accent-soft); color: var(--accent); font-weight: 700; display: grid; place-items: center; font-size: .9rem; }
ol.actions b { display: block; margin-bottom: .2rem; }
ol.actions .d { color: var(--muted); font-size: .92rem; }
.fine { font-size: .82rem; color: var(--muted); }
.fine + .fine { margin-top: .35rem; }
ul.checks { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .45rem; }
ul.checks li { display: grid; grid-template-columns: 5rem 1fr; gap: .6rem; align-items: start; font-size: .92rem; }
ul.checks .sev { font-size: .72rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; padding-top: 2px; }
.tbl { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: .88rem; }
th, td { text-align: left; padding: .4rem .5rem; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { color: var(--muted); font-weight: 600; font-size: .76rem; text-transform: uppercase; letter-spacing: .03em; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
tr.low td { background: var(--tint); }
tr.pick { cursor: pointer; }
tr.pick:hover td, tr.pick:focus-visible td { background: var(--accent-soft); }
details summary { cursor: pointer; font-weight: 600; }
pre { font-family: var(--mono); font-size: .78rem; overflow: auto; max-height: 28rem; margin: .75rem 0 0; }

/* Chart */
.legend { display: flex; gap: 1.1rem; flex-wrap: wrap; font-size: .85rem; color: var(--muted); margin-bottom: .4rem; }
.legend span { display: inline-flex; align-items: center; gap: .4rem; }
.legend i { display: inline-block; width: 18px; height: 0; border-top: 2px solid; }
.legend .l-cash { border-color: var(--s1); }
.legend .l-floor { border-color: var(--fg); border-top-style: dashed; }
.legend .l-low { width: 10px; height: 10px; border: 0; background: var(--teal); }
.chartwrap svg { display: block; width: 100%; height: auto; overflow: visible; }
.chartwrap .grid { stroke: var(--line); stroke-width: 1; }
.chartwrap .zero { stroke: var(--muted); stroke-width: 1; }
.chartwrap .axis { fill: var(--muted); font-size: 11px; font-family: var(--sans); }
.chartwrap .cash { fill: none; stroke: var(--s1); stroke-width: 2.5; stroke-linejoin: round; }
.chartwrap .dot { fill: var(--s1); }
.chartwrap .floor { stroke: var(--fg); stroke-width: 1.5; stroke-dasharray: 6 4; }
.chartwrap .low { fill: var(--teal); }

@media (max-width: 52rem) {
  .hero { grid-template-columns: 1fr; }
  .verdict { grid-template-columns: 1fr; }
  .site .brand img { height: 36px; }
}
@media print { .site, .picker, details { display: none; } body { background: #fff; } }
