/* PQ Root Watch — "Night Grid" design system.
   Dark-first flat observatory: hairline ledger rows, two deliberate typefaces,
   the 50-dot grid as the hero. No JS, no gradients, no external requests.
   WCAG AA contrast, prefers-color-scheme, prefers-reduced-motion, focus-visible. */

@font-face {
  font-family: "Sora";
  src: url("fonts/sora-var.woff2") format("woff2");
  font-weight: 100 800;
  font-display: swap;
}
@font-face {
  font-family: "IBM Plex Mono";
  src: url("fonts/ibm-plex-mono-400.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "IBM Plex Mono";
  src: url("fonts/ibm-plex-mono-600.woff2") format("woff2");
  font-weight: 600;
  font-display: swap;
}

:root {
  color-scheme: dark light;
  --bg: #0b0d10;
  --panel: #10141a;
  --ink: #e8ebef;
  --ink-soft: #bfc7d1;
  --muted: #8b95a1;
  --line: #262e38;
  --line-soft: #1b222b;
  --pass: #46c783;
  --pass-bg: rgba(70, 199, 131, .13);
  --fail: #ff8b9e;
  --fail-bg: rgba(255, 139, 158, .13);
  --warn: #d9b44a;
  --warn-bg: rgba(217, 180, 74, .13);
  --accent: #8ab8f5;
  --accent-bg: rgba(138, 184, 245, .13);
  --ease: cubic-bezier(0.23, 1, 0.32, 1);
  --sans: "Sora", ui-sans-serif, system-ui, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}

@media (prefers-color-scheme: light) {
  :root {
    --bg: #f5f6f4;
    --panel: #ffffff;
    --ink: #16181d;
    --ink-soft: #39414b;
    --muted: #5b6470;
    --line: #d9dbd5;
    --line-soft: #e7e8e4;
    --pass: #086f47;
    --pass-bg: rgba(8, 111, 71, .1);
    --fail: #b3001b;
    --fail-bg: rgba(179, 0, 27, .09);
    --warn: #7a5200;
    --warn-bg: rgba(122, 82, 0, .1);
    --accent: #0b5394;
    --accent-bg: rgba(11, 83, 148, .09);
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font: 400 16px/1.65 var(--sans);
  color: var(--ink);
  background: var(--bg);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

main { max-width: 74rem; margin: 0 auto; padding: .7rem 1.4rem 1rem; }

/* data sections sit on hairline rules, not in identical rounded cards */
main > section:not(.hero):not(.sitedrop) {
  border-top: 1px solid var(--line-soft);
  margin-top: 2.2rem;
  padding-top: 1.9rem;
}
main > section:first-child { border-top: 0; margin-top: 0; padding-top: .4rem; }

/* top navigation: quiet mono pills, right-aligned in the page column */
.topnav { display: flex; flex-wrap: wrap; gap: .45rem; justify-content: flex-end; margin: 0 0 1rem;
          font-family: var(--mono); }
.topnav a { margin: 0; }
.topnav a, footer a {
  display: inline-block; padding: .22rem .75rem; margin: .2rem .12rem 0;
  border: 1px solid var(--line); border-radius: 999px; font-weight: 600;
  font-size: .78rem; color: var(--ink-soft);
  transition: transform 160ms var(--ease);
}
.topnav a:active, footer a:active { transform: scale(0.97); }

a { color: var(--accent); text-decoration: none; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
::selection { background: var(--accent-bg); }
.nw { white-space: nowrap; }

/* hover styles sit behind the pointer gate so touch devices get no sticky hover */
@media (hover: hover) and (pointer: fine) {
  a:hover { text-decoration: underline; }
  .topnav a:hover, footer a:hover { border-color: var(--muted); color: var(--ink); text-decoration: none; }
  .srclink:hover { background: var(--accent-bg); color: var(--accent); }
  tbody tr:hover td { background: var(--panel); }
  .root-name a:hover { border-color: var(--ink); text-decoration: none; }
  .dot[data-d]:hover::after { content: attr(data-d); position: absolute; bottom: calc(100% + 9px); left: 50%;
    transform: translateX(-50%); font: 600 .68rem/1 var(--mono); background: var(--ink); color: var(--bg);
    padding: .3rem .45rem; border-radius: 4px; white-space: nowrap; z-index: 3; pointer-events: none; }
}

/* the one collapsible panel keeps a card body; everything else is ruled */
.card { margin-bottom: 0; }
.sitedrop { border: 1px solid var(--line); border-radius: 12px; background: var(--panel);
            padding: 1.1rem 1.35rem; margin-top: 2.2rem; }

h1 { font-size: clamp(1.65rem, 3vw, 2.2rem); font-weight: 700; letter-spacing: -.02em;
     line-height: 1.2; margin: 0 0 1rem; text-wrap: balance; }
h2 { font-size: 1.18rem; font-weight: 700; letter-spacing: -.01em; margin: 0 0 1rem; text-wrap: balance; }
p { text-wrap: pretty; }
.card > p { max-width: 70ch; }

.note { color: var(--muted); font-size: .86rem; font-family: var(--mono); }
.note a { color: var(--accent); font-family: var(--sans); }
.headline { text-align: center; }
.headline .lead { max-width: 60ch; font-size: .95rem; color: var(--ink-soft); margin: 0 auto; }

/* hero: kicker, question, verdict, the giant count, then the grid */
.hero { text-align: center; padding: 1.1rem 1rem 5rem;
        min-height: calc(100vh - 3rem);
        min-height: calc(100svh - 3rem);
        display: flex; flex-direction: column; justify-content: center; }
.hero h1 { font-size: clamp(2.3rem, 5.4vw, 3.2rem); font-weight: 300; letter-spacing: -.025em;
           line-height: 1.05; max-width: 24ch; margin: .7rem auto 0; }
.hero h1 b { font-weight: 700; }
.verdict { font: 400 .95rem/1.7 var(--mono); color: var(--ink-soft); max-width: 56ch; margin: .8rem auto 0; }
.failbadge { display: block; margin: 0 auto 1.2rem; max-width: 34rem; }

.stats { display: flex; flex-wrap: wrap; justify-content: center; align-items: flex-end;
         gap: 1.2rem clamp(2.2rem, 7vw, 5.5rem); margin: 1.2rem 0 0; }
.stat { min-width: 8rem; }
.bignum { font-size: clamp(5rem, 13vw, 6.5rem); font-weight: 700; letter-spacing: -.045em;
       line-height: .85; font-variant-numeric: tabular-nums; color: var(--ink); }
.bignum .den { font-size: .3em; font-weight: 500; color: var(--muted); letter-spacing: -.01em; }
.bignum.zero { color: var(--fail); }
.bignum.partial { color: var(--warn); }
.bignum.full { color: var(--pass); }
.stats .stat + .stat .bignum { font-size: clamp(2.6rem, 6vw, 3.7rem); letter-spacing: -.03em; }
.stats .stat + .stat .bignum .den { color: inherit; }
.slabel { margin: .7rem auto 0; max-width: 17rem; font-size: .78rem; line-height: 1.5;
          color: var(--muted); font-family: var(--mono); }
.ssub { display: block; margin-top: .35rem; font-size: .74rem; line-height: 1.4;
        color: var(--ink-soft); font-family: var(--sans); }
.meter { height: 4px; max-width: 11rem; margin: .95rem auto 0; background: var(--line);
         border-radius: 999px; overflow: hidden; }
.meter-fill { display: block; height: 100%; background: var(--warn); }
.meter[data-state="full"] .meter-fill { background: var(--pass); }
.meter[data-state="zero"] .meter-fill { background: var(--fail); }
.meter[data-state="zero"] { background: color-mix(in srgb, var(--fail) 26%, var(--line)); }
.why { max-width: 60ch; margin: 1.1rem auto 0; font-size: .9rem; line-height: 1.45;
       color: var(--ink-soft); }

/* the grid: one dot per site, lit or dark */
.dotgrid { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center;
           max-width: 36rem; margin: 1.4rem auto .7rem; }
.dot { width: 14px; height: 14px; border-radius: 50%; flex: none; position: relative;
       border: 1.5px solid color-mix(in srgb, var(--muted) 55%, transparent); }
.dot.half { background: var(--warn); border-color: var(--warn); }
.dot.full { background: var(--pass); border-color: var(--pass); }
.gridkey { font: 400 .78rem/1.6 var(--mono); color: var(--muted); margin: 0 auto; }
.keydot { display: inline-block; width: 9px; height: 9px; border-radius: 50%;
          border: 1.5px solid color-mix(in srgb, var(--muted) 55%, transparent);
          vertical-align: -1px; margin: 0 .2rem 0 .35rem; }
.keydot.half { background: var(--warn); border-color: var(--warn); }
.keydot.full { background: var(--pass); border-color: var(--pass); }

/* taller viewports get the relaxed rhythm; short ones keep the tight fold */
@media (min-height: 840px) {
  .hero { padding-top: 2rem; }
  .hero h1 { margin-top: 1.2rem; }
  .verdict { margin-top: 1.4rem; }
  .stats { margin-top: 2rem; }
  .why { margin-top: 1.8rem; }
  .dotgrid { margin-top: 2.4rem; }
}

/* badges: small mono pills on translucent washes */
.badge { display: inline-block; padding: .12rem .55rem; border-radius: 999px;
         font-family: var(--mono); font-size: .72rem; font-weight: 600; white-space: nowrap; }
.badge.warn { background: var(--warn-bg); color: var(--warn); }
.badge.changed { background: var(--accent-bg); color: var(--accent); }
.badge.done { background: var(--pass-bg); color: var(--pass); }
.badge.inprogress { background: var(--warn-bg); color: var(--warn); }
.badge.planned { background: var(--line-soft); color: var(--muted); }
.badge.failbadge { background: var(--fail-bg); color: var(--fail); }
.ok { color: var(--pass); font-weight: 600; }
.bad { color: var(--fail); font-weight: 600; }
.half { color: var(--warn); font-weight: 600; }
.notyet { color: var(--muted); }

/* citations: small corner icon links */
.unclear { color: var(--warn); }
.srclink { display: inline-flex; align-items: center; justify-content: center;
           color: var(--muted); padding: .12rem; border-radius: 6px; vertical-align: -3px;
           transition: transform 160ms var(--ease); }
.srcicon { width: 15px; height: 15px; border-radius: 4px; flex: none; display: block; }
.srclink:active { transform: scale(0.9); }

/* root table: a ledger, single-line rows, whole table in one view */
.tablewrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .92rem; }
thead th {
  font: 400 .72rem/1 var(--mono); color: var(--muted); text-align: left;
  padding: .4rem .55rem .7rem; border-bottom: 1px solid var(--ink);
  white-space: nowrap; position: sticky; top: 0; background: var(--bg);
}
thead th.num { text-align: right; }
tbody td {
  padding: .74rem .55rem; border-bottom: 1px solid var(--line-soft);
  white-space: nowrap; vertical-align: middle;
}
tbody td.count {
  text-align: right; font-variant-numeric: tabular-nums; font-weight: 600;
  font-family: var(--mono); font-size: .84rem; color: var(--ink-soft);
}
tbody tr:last-child td { border-bottom: 0; }
.root-name a { font-weight: 500; color: var(--ink); border-bottom: 1px solid var(--line); }
.eta-cell { max-width: 22rem; overflow: hidden; text-overflow: ellipsis;
            font: 400 .82rem/1.4 var(--mono); color: var(--ink-soft); }

/* browsers: ledger rows spread across the full line */
.bline { display: grid; grid-template-columns: 1.1fr 1fr 2.4fr; align-items: baseline;
         column-gap: 1.5rem; row-gap: .1rem; padding: .7rem 0;
         border-bottom: 1px solid var(--line-soft); }
.bline:last-child { border-bottom: 0; }
.bid { display: inline-flex; align-items: center; gap: .4rem; min-width: 8.5rem; }
.bname { font-weight: 600; font-size: .92rem; line-height: 1.25; }
.bkem { min-width: 7.5rem; font: 600 .78rem/1.4 var(--mono); }
.bcertwrap { min-width: 0; }
.bcert { color: var(--ink-soft); font-size: .78rem; }
.bcert.warn { color: var(--warn); }
.bcert.notyet { color: var(--muted); }

/* folded site mapping */
.sitedrop summary {
  cursor: pointer; font-weight: 700; list-style: none;
  display: flex; align-items: center; gap: .55rem; padding: .2rem 0; flex-wrap: wrap;
}
.sitedrop summary::-webkit-details-marker { display: none; }
.sitedrop summary::before { content: "+"; font-weight: 700; color: var(--accent); width: 1.1rem; }
.sitedrop[open] summary::before { content: "\2013"; }
.sitedrop[open] summary { margin-bottom: .8rem; }
.chip-count { color: var(--muted); font-weight: 400; font-family: var(--mono); font-size: .78rem; }
.site-groups { display: grid; gap: .55rem; }
.sgroup { display: flex; flex-wrap: wrap; gap: .35rem; align-items: center; font-size: .84rem; }
.sgroup b { font-size: .88rem; }
.sgcount {
  font-family: var(--mono); font-size: .72rem; color: var(--muted);
  background: var(--line-soft); border-radius: 999px; padding: .08rem .5rem;
}
.sitechip {
  font-family: var(--mono); font-size: .76rem;
  background: var(--bg); border: 1px solid var(--line);
  border-radius: 6px; padding: .06rem .45rem; color: var(--ink-soft);
}
.sitechip.pq { border-color: color-mix(in srgb, var(--pass) 45%, transparent); }

/* timeline */
ul.timeline { list-style: none; padding: 0; margin: 0; }
.timeline .entry { border-bottom: 1px solid var(--line-soft); padding: .95rem 0; }
.timeline .entry:last-child { border-bottom: 0; }
.entry-head { display: flex; flex-wrap: wrap; gap: .5rem; align-items: baseline; }
.entry .date { color: var(--muted); font-variant-numeric: tabular-nums; font-size: .84rem;
               font-family: var(--mono); }
.entry .strength { color: var(--muted); font-size: .74rem; font-family: var(--mono); }
.entry p { margin: .35rem 0 0; font-size: .92rem; color: var(--ink-soft); max-width: 70ch; }
.entry a { font-weight: 600; }
.announcements .entry > a { display: table; font-size: .98rem; margin-bottom: .15rem; }
.announcements .entry-head { margin-top: .1rem; }
.announcements .entry-head strong { font-weight: 500; font-size: .85rem; color: var(--ink-soft); }
section.roadmap h2, section.announcements h2 { text-align: center; }
section.roadmap ul.timeline, .announcements ul.timeline { max-width: 70ch; margin: 0 auto; }

/* roadmap milestone line */
.mstones { display: flex; list-style: none; margin: .3rem 0 1.3rem; padding: 0; }
.mstones li { flex: 1; position: relative; padding-top: .1rem; }
.mstones li::before {
  content: ""; position: absolute; top: 7px; left: -50%; width: 100%;
  height: 1px; background: var(--line);
}
.mstones li:first-child::before { display: none; }
.mstones .dot {
  position: relative; z-index: 1; display: block;
  width: 11px; height: 11px; margin: 0 auto .3rem; border-radius: 50%;
  background: var(--muted);
}
.mstones li.done .dot { background: var(--pass); }
.mstones li.inprogress .dot { background: var(--warn); }
.mstones li.planned .dot { background: var(--bg); box-shadow: inset 0 0 0 1.5px var(--muted); }
.myear { display: block; text-align: center; font: 600 .72rem/1.4 var(--mono); color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.mlabel { display: block; text-align: center; font-size: .7rem; line-height: 1.35; color: var(--muted); }

footer {
  max-width: 74rem; margin: 0 auto; padding: .8rem 1.4rem 2.6rem;
  color: var(--muted); font-size: .78rem; font-family: var(--mono); text-align: center;
}
footer a { font-family: var(--mono); }

@media (max-width: 1080px) {
  .bline { column-gap: 1rem; grid-template-columns: 1fr 1fr 2fr; }
}

@media (max-width: 640px) {
  main { padding: 1rem 1rem .8rem; }
  .hero { padding: 2.4rem .6rem 1.8rem; }
  .stats { gap: 1.6rem 2rem; margin-top: 2.2rem; }
  .slabel { max-width: 9.5rem; }
  .dotgrid { gap: 9px; margin: 2.4rem auto .9rem; }
  .dot { width: 13px; height: 13px; }
  /* stack the root table into per-root ledger cards */
  .tablewrap { overflow: visible; }
  table, tbody, tr, td { display: block; }
  thead { display: none; }
  tbody td { white-space: normal; border-bottom: 0; padding: .22rem .55rem; }
  tbody tr { border: 1px solid var(--line); border-radius: 10px;
             margin: 0 0 .6rem; padding: .4rem 0; }
  tbody td[data-label]::before {
    content: attr(data-label); display: inline-block; min-width: 7rem;
    margin-right: .6rem; color: var(--muted); font: 400 .68rem/1.6 var(--mono);
  }
  td.count { text-align: left; }
  td.root-name { padding-bottom: .25rem; }
  .root-name a { font-size: .95rem; }
  .bline { display: flex; flex-wrap: wrap; column-gap: 1rem; }
  .bid { min-width: 7rem; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
