/*
 * Static pages served alongside the app at nucleartoolkit.com.
 *
 * Tokens mirror data/theme.ts so the site and the app read as one product.
 * Deliberately single-theme: the app is dark-only (control-room instrumentation),
 * so these pages commit to the same ground rather than following the OS.
 * Every colour is stated explicitly — nothing is inherited from the browser.
 */

:root {
  --bg1:  #080b14;   /* page ground   (C.bg1)  */
  --bg2:  #11151f;   /* panel surface (C.bg2)  */
  --bg3:  #222a3a;   /* hairline      (C.bg3)  */
  --t0:   #eef1f8;   /* headings      (C.t0)   */
  --t1:   #c4cbdc;   /* body          (C.t1)   */
  --t2:   #7c8698;   /* secondary     (C.t2)   */
  --t3:   #545e6e;   /* tertiary      (C.t3)   */
  --blue: #5aa2f7;   /* links, accent (C.blue) */
  --navy: #2f63d6;   /* solid action  (C.navy) */
  --amber:#e0901c;   /* live readout  (C.amber)*/
  --green:#23cf72;   /* within tolerance (C.green) */

  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas,
          "Liberation Mono", monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
          "Helvetica Neue", Arial, sans-serif;

  color-scheme: dark;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg1);
  color: var(--t1);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

/* ── Header ─────────────────────────────────────────────────────────────── */

.bar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 22px;
  background: rgba(8, 11, 20, 0.88);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--bg3);
}

.wordmark {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--t0);
  font-weight: 700;
  font-size: 15px;
  letter-spacing: 0.2px;
  text-decoration: none;
}

.wordmark .glyph {
  font-family: var(--mono);
  color: var(--blue);
  font-size: 17px;
}

.bar a.back {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--t2);
  text-decoration: none;
  white-space: nowrap;
}

.bar a.back:hover { color: var(--blue); }

/* ── Layout ─────────────────────────────────────────────────────────────── */

main {
  max-width: 68ch;
  margin: 0 auto;
  padding: 48px 22px 96px;
}

h1 {
  color: var(--t0);
  font-size: clamp(26px, 5vw, 34px);
  line-height: 1.2;
  letter-spacing: -0.4px;
  margin: 0;
  text-wrap: balance;
}

.effective {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--t3);
  margin: 8px 0 0;
}

h2 {
  color: var(--t0);
  font-size: 17px;
  letter-spacing: 0.1px;
  margin: 40px 0 10px;
  padding-top: 20px;
  border-top: 1px solid var(--bg3);
  text-wrap: balance;
}

/* The Terms are a numbered instrument in the app; the numbers are real, so
   they are set as an index rather than decoration. The privacy policy has no
   numbering in the source and gets none here. */
h2 .idx {
  font-family: var(--mono);
  color: var(--blue);
  font-size: 13px;
  margin-right: 8px;
}

p { margin: 0 0 14px; }

ul {
  margin: 0 0 14px;
  padding-left: 0;
  list-style: none;
}

li {
  position: relative;
  padding-left: 20px;
  margin-bottom: 7px;
}

li::before {
  content: "";
  position: absolute;
  left: 4px;
  top: 0.72em;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--bg3);
}

a { color: var(--blue); }
a:hover { color: #7fb8ff; }

code, .mono {
  font-family: var(--mono);
  font-size: 0.92em;
  color: var(--t0);
  background: var(--bg2);
  border: 1px solid var(--bg3);
  border-radius: 5px;
  padding: 1px 6px;
}

strong { color: var(--t0); font-weight: 600; }

/* ── Components ─────────────────────────────────────────────────────────── */

.lede {
  color: var(--t1);
  font-size: 17px;
  margin-top: 22px;
}

.panel {
  background: var(--bg2);
  border: 1px solid var(--bg3);
  border-radius: 12px;
  padding: 20px 22px;
  margin: 24px 0;
}

.panel h2 {
  margin-top: 0;
  padding-top: 0;
  border-top: 0;
  font-size: 15px;
}

.panel p:last-child, .panel ul:last-child { margin-bottom: 0; }

/* Advisory callout — amber left rule, matching the app's assumption banners. */
.note {
  background: rgba(224, 144, 28, 0.06);
  border-left: 3px solid rgba(224, 144, 28, 0.30);
  border-radius: 0 8px 8px 0;
  padding: 14px 18px;
  margin: 24px 0;
  font-size: 14.5px;
  color: var(--t1);
}

.note strong { color: var(--amber); }

.btn {
  display: inline-block;
  background: var(--navy);
  color: #fff;
  font-weight: 700;
  font-size: 14.5px;
  letter-spacing: 0.2px;
  text-decoration: none;
  padding: 12px 22px;
  border-radius: 10px;
  margin-top: 4px;
}

.btn:hover { background: #3a72e8; color: #fff; }

/* Definition rows — label in mono, value in prose. */
.rows { display: grid; gap: 12px; margin: 0; }

.row {
  display: grid;
  grid-template-columns: 8.5rem 1fr;
  gap: 4px 16px;
  align-items: baseline;
}

.row dt {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--t2);
  letter-spacing: 0.3px;
}

.row dd { margin: 0; color: var(--t1); }

@media (max-width: 34rem) {
  .row { grid-template-columns: 1fr; }
}

footer {
  border-top: 1px solid var(--bg3);
  margin-top: 56px;
  padding-top: 22px;
  font-size: 13px;
  color: var(--t3);
}

footer a { color: var(--t2); text-decoration: none; }
footer a:hover { color: var(--blue); }

footer .links {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  margin-bottom: 12px;
  font-family: var(--mono);
  font-size: 12px;
}

:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
  border-radius: 3px;
}

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

/* ── Home page ────────────────────────────────────────────────────────────────
   The app itself lives at /app. This is the page a visitor, a store reviewer,
   or a search engine lands on, so it is wider than the prose pages and leads
   with what the tool actually contains.                                        */

main.home { max-width: 62rem; padding-top: 40px; }

.home h2 {
  font-size: 20px;
  margin: 0 0 18px;
  padding-top: 0;
  border-top: 0;
}

.home section { margin-bottom: 64px; }

.eyebrow {
  font-family: var(--mono);
  font-size: 11.5px;
  letter-spacing: 1.4px;
  color: var(--t3);
  margin: 0 0 14px;
}

.hero { margin-bottom: 40px; }

.hero h1 {
  font-size: clamp(30px, 5.4vw, 46px);
  line-height: 1.12;
  letter-spacing: -0.8px;
  max-width: 20ch;
}

.hero .sub {
  font-size: clamp(16px, 2vw, 18.5px);
  color: var(--t1);
  max-width: 58ch;
  margin: 18px 0 26px;
}

.cta { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }

.btn.ghost {
  background: transparent;
  color: var(--t0);
  border: 1px solid var(--bg3);
}
.btn.ghost:hover { background: var(--bg2); color: var(--t0); border-color: var(--blue); }

.platnote {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--t3);
  margin: 16px 0 0;
}

/* Instrument nameplate: the figures that distinguish this from a formula app. */
.spec {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(9.5rem, 1fr));
  gap: 1px;
  background: var(--bg3);
  border: 1px solid var(--bg3);
  border-radius: 12px;
  overflow: hidden;
  margin: 0 0 64px;
}

.spec > div { background: var(--bg2); padding: 18px 20px; }

.spec dt {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 1.1px;
  color: var(--t3);
  margin-bottom: 6px;
}

.spec dd {
  margin: 0;
  font-family: var(--mono);
  font-size: 21px;
  color: var(--amber);
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
}

.spec dd small {
  display: block;
  font-family: var(--sans);
  font-size: 12px;
  color: var(--t2);
  margin-top: 5px;
  letter-spacing: 0;
}

/* Screenshots scroll rather than shrink — legibility beats fitting them all. */
.shots {
  display: flex;
  gap: 18px;
  overflow-x: auto;
  padding-bottom: 8px;
  scroll-snap-type: x mandatory;
}

.shots figure {
  margin: 0;
  flex: 0 0 auto;
  scroll-snap-align: start;
  width: clamp(200px, 19vw, 244px);
}

.shots img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 14px;
  border: 1px solid var(--bg3);
}

.shots figcaption {
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--t3);
  margin-top: 10px;
  letter-spacing: 0.3px;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr));
  gap: 14px;
}

.tool {
  background: var(--bg2);
  border: 1px solid var(--bg3);
  border-radius: 11px;
  padding: 16px 18px;
}

.tool h3 {
  margin: 0 0 5px;
  font-size: 14.5px;
  color: var(--t0);
  display: flex;
  align-items: baseline;
  gap: 9px;
}

.tool h3 .sym {
  font-family: var(--mono);
  color: var(--blue);
  font-size: 13px;
  min-width: 1.6em;
}

.tool p { margin: 0; font-size: 13px; color: var(--t2); line-height: 1.55; }

/* Provenance: source on the left, what it feeds on the right. */
.src {
  display: grid;
  grid-template-columns: 11rem 1fr;
  gap: 10px 22px;
  padding: 15px 0;
  border-top: 1px solid var(--bg3);
  align-items: baseline;
}

.src:last-of-type { border-bottom: 1px solid var(--bg3); }

.src .who { font-size: 14px; color: var(--t0); font-weight: 600; }
.src .who span { display: block; font-family: var(--mono); font-size: 11px; color: var(--t3); font-weight: 400; margin-top: 3px; letter-spacing: 0.3px; }
.src .what { font-size: 13.5px; color: var(--t2); }

@media (max-width: 40rem) {
  .src { grid-template-columns: 1fr; gap: 4px; }
  .spec dd { font-size: 19px; }
}

/* ── Validation page ──────────────────────────────────────────────────────────
   Generated by scripts/build_validation_page.js from the physics audit. Tables
   are the content here, so the column holds numbers in tabular figures and the
   table, not the page, scrolls sideways on a phone.                            */

main.wide { max-width: 62rem; }

.vsum {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(9.5rem, 1fr));
  gap: 1px;
  background: var(--bg3);
  border: 1px solid var(--bg3);
  border-radius: 12px;
  overflow: hidden;
  margin: 28px 0 8px;
}
.vsum > div { background: var(--bg2); padding: 14px 16px; }
.vsum dt { font-family: var(--mono); font-size: 10.5px; letter-spacing: 1px; color: var(--t3); }
.vsum dd { margin: 4px 0 0; color: var(--t0); font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; }
.vsum dd.good { color: var(--green); }
.vsum dd small { display: block; font-size: 11.5px; font-weight: 400; color: var(--t2); }

.vgroup h3 {
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.3px;
  color: var(--t2);
  margin: 26px 0 8px;
}

.vwrap { overflow-x: auto; border: 1px solid var(--bg3); border-radius: 10px; }

table.v { width: 100%; min-width: 44rem; border-collapse: separate; border-spacing: 0; font-size: 13px; font-variant-numeric: tabular-nums; }
table.v td:first-child { min-width: 13rem; }
table.v th {
  text-align: left; white-space: nowrap;
  font-family: var(--mono); font-size: 10.5px; font-weight: 500; letter-spacing: 0.6px;
  color: var(--t3); background: var(--bg2);
  padding: 8px 12px; border-bottom: 1px solid var(--bg3);
}
table.v th.n { text-align: right; }
table.v td { padding: 7px 12px; border-bottom: 1px solid var(--bg3); color: var(--t1); vertical-align: baseline; }
table.v tr:last-child td { border-bottom: 0; }
table.v td.n { font-family: var(--mono); font-size: 12.5px; text-align: right; white-space: nowrap; }
table.v td.ok { color: var(--green); }
table.v td.vsrc, table.v td.detail { color: var(--t2); }
table.v td.detail { font-family: var(--mono); font-size: 12px; }

.errata { display: grid; gap: 14px; margin: 0; }
.errata > div { display: grid; grid-template-columns: 7.5rem 1fr; gap: 4px 16px; align-items: baseline; }
.errata dt { font-family: var(--mono); font-size: 12px; color: var(--amber); letter-spacing: 0.3px; }
.errata dd { margin: 0; font-size: 14.5px; }
@media (max-width: 34rem) { .errata > div { grid-template-columns: 1fr; } }
.vgroup h2 .count { font-family: var(--mono); font-size: 12px; font-weight: 500; color: var(--t3); margin-left: 6px; }

/* ── Calculator pages (/tools/) ───────────────────────────────────────────────
   Generated by scripts/build_tool_pages.js. Prose width like the other static
   pages; formulas and results in mono, results in amber like the app's live
   readouts.                                                                    */

main.tool-page { max-width: 46rem; }

.crumb { font-family: var(--mono); font-size: 12px; color: var(--t3); margin: 0 0 12px; }
.crumb a { color: var(--t2); text-decoration: none; }
.crumb a:hover { color: var(--blue); }

.tool-page .cta { margin-top: 18px; }
.tool-page .platnote { margin-top: 10px; }

.formula {
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.75;
  color: var(--t0);
  background: var(--bg2);
  border: 1px solid var(--bg3);
  border-radius: 10px;
  padding: 14px 18px;
  margin: 12px 0 18px;
  overflow-x: auto;
  white-space: pre;
}

.result {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr));
  gap: 1px;
  background: var(--bg3);
  border: 1px solid var(--bg3);
  border-radius: 12px;
  overflow: hidden;
  margin: 22px 0;
}
.result > div { background: var(--bg2); padding: 12px 16px; }
.result dt { font-family: var(--mono); font-size: 10.5px; letter-spacing: 0.8px; color: var(--t3); }
.result dd { margin: 4px 0 0; font-family: var(--mono); font-size: 15px; color: var(--amber); font-variant-numeric: tabular-nums; }

table.v.compact { min-width: 0; }
table.v.compact td:first-child { min-width: 0; white-space: nowrap; }
.tool-page .vwrap { margin: 12px 0 16px; }

ul.related li::before { content: '\2192'; }

.rows.tools .row { grid-template-columns: 15rem 1fr; }
.rows.tools dt { font-size: 13px; }
.rows.tools dt a { color: var(--blue); text-decoration: none; }
.rows.tools dt a:hover { text-decoration: underline; }
.rows.tools dd { font-size: 14px; color: var(--t2); }
@media (max-width: 40rem) { .rows.tools .row { grid-template-columns: 1fr; } }
