/* Permafrost Game Guide — shared site stylesheet
   Loaded by every page after nothing else (single stylesheet).
   Sections: 1 fonts · 2 tokens · 3 base · 4 shell (header/footer) · 5 home hero
             6 home sections · 7 reusable content components · 8 utilities */

/* 1. Fonts (self-hosted, SIL OFL 1.1 — see /assets/fonts/LICENSE-*.txt) */
@font-face {
  font-family: "Archivo";
  src: url("/assets/fonts/archivo-latin-wdth-normal.woff2") format("woff2-variations"),
       url("/assets/fonts/archivo-latin-wdth-normal.woff2") format("woff2");
  font-weight: 100 900;
  font-stretch: 62% 125%;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Source Serif 4";
  src: url("/assets/fonts/source-serif-4-latin-standard-normal.woff2") format("woff2-variations"),
       url("/assets/fonts/source-serif-4-latin-standard-normal.woff2") format("woff2");
  font-weight: 200 900;
  font-style: normal;
  font-display: swap;
}

/* 2. Tokens */
:root {
  --ink: #14263a;          /* night sky — text, header */
  --ink-soft: #3c5468;     /* secondary text */
  --frost: #eef4f8;        /* page background */
  --snow: #fbfdfe;         /* raised surfaces */
  --strata-1: #9fd3ea;     /* top ground layer */
  --strata-2: #5c9ec2;
  --strata-3: #2f6a8f;     /* deepest layer, also link colour */
  --ember: #b8621c;        /* warnings / "as of" — text-safe on frost */
  --ember-wash: #fbeee2;
  --rule: #c9dbe6;

  --font-ui: "Archivo", "Arial Narrow", system-ui, sans-serif;
  --font-read: "Source Serif 4", Georgia, "Times New Roman", serif;

  --step--1: 0.875rem;
  --step-0: 1.0625rem;     /* body */
  --step-1: 1.25rem;
  --step-2: 1.5625rem;
  --step-3: 2rem;
  --step-4: clamp(2.25rem, 5.4vw, 3.75rem);

  --measure: 68ch;
  --wide: 72rem;
  --gutter: clamp(1rem, 4vw, 2.5rem);
  --space-s: 0.75rem;
  --space-m: 1.5rem;
  --space-l: 3rem;
  --space-xl: 4.5rem;
  --radius: 6px;
  --header-h: 3.75rem;
}

/* 3. Base */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--header-h) + 0.75rem); }
@media (prefers-reduced-motion: no-preference) { html { scroll-behavior: smooth; } }
body {
  margin: 0;
  background: var(--frost);
  color: var(--ink);
  font-family: var(--font-read);
  font-size: var(--step-0);
  line-height: 1.7;
  font-optical-sizing: auto;
}
img { max-width: 100%; height: auto; display: block; }
h1, h2, h3 {
  font-family: var(--font-ui);
  font-stretch: 78%;
  line-height: 1.12;
  letter-spacing: -0.01em;
  margin: 0;
  text-wrap: balance;
}
p { margin: 0 0 1em; }
a { color: var(--strata-3); text-decoration-thickness: 1px; text-underline-offset: 0.18em; }
a:hover { color: var(--ink); text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--ember); outline-offset: 3px; border-radius: 2px; }
code {
  font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
  font-size: 0.9em;
  background: var(--snow);
  border: 1px solid var(--rule);
  border-radius: 4px;
  padding: 0.05em 0.35em;
  white-space: nowrap;
}
.skip-link {
  position: absolute; left: -999px; top: 0.5rem; z-index: 50;
  background: var(--snow); color: var(--ink); padding: 0.5rem 0.75rem; font-family: var(--font-ui);
}
.skip-link:focus { left: 0.5rem; }

/* 4. Site shell */
.site-header {
  position: sticky; top: 0; z-index: 20;
  background: var(--ink);
  color: var(--snow);
  border-bottom: 3px solid var(--strata-2);
}
.site-header__inner {
  max-width: var(--wide); margin: 0 auto; padding: 0 var(--gutter);
  min-height: var(--header-h);
  display: flex; align-items: center; gap: var(--space-m);
}
.brand { display: flex; align-items: center; gap: 0.6rem; color: inherit; text-decoration: none; margin-right: auto; }
.brand:hover { color: inherit; }
.brand__mark { width: 36px; height: 36px; flex: none; }
.brand__name { font-family: var(--font-ui); font-weight: 700; font-stretch: 85%; font-size: 1.125rem; line-height: 1.1; }
.brand__tag { display: block; font-weight: 400; font-stretch: 100%; font-size: 0.75rem; color: var(--strata-1); letter-spacing: 0.01em; }
.site-nav ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 0.25rem 1.1rem; }
.site-nav a {
  font-family: var(--font-ui); font-size: var(--step--1); font-weight: 500;
  color: var(--strata-1); text-decoration: none; padding: 0.35rem 0;
  border-bottom: 2px solid transparent;
}
.site-nav a:hover { color: var(--snow); border-bottom-color: var(--strata-1); }

.site-footer {
  background: var(--ink); color: #c8d9e5;
  font-family: var(--font-ui); font-size: var(--step--1); line-height: 1.6;
  margin-top: var(--space-xl);
}
.site-footer__inner {
  max-width: var(--wide); margin: 0 auto; padding: var(--space-l) var(--gutter) var(--space-m);
  display: grid; gap: var(--space-m) var(--space-l);
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
}
.site-footer p { margin: 0 0 0.6em; }
.site-footer a { color: var(--strata-1); }
.site-footer a:hover { color: var(--snow); }
.footer-brand { display: flex; align-items: center; gap: 0.5rem; color: var(--snow); font-weight: 700; font-stretch: 85%; font-size: 1rem; margin-bottom: 0.6rem; }
.footer-brand img { width: 28px; height: 28px; }
.footer-links { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 0.35rem 1.25rem; }
.footer-check { grid-column: 1 / -1; border-top: 1px solid #2c4560; padding-top: var(--space-s); color: #9fb6c6; }

/* External link marker (00B 4B.1): visible ↗ plus screen-reader text */
.ext { white-space: normal; }
.ext__icon { display: inline-block; margin-left: 0.15em; font-size: 0.85em; text-decoration: none; }

/* 5. Home hero: answer beside the uncropped screenshot, frozen-ground strata as the edge */
.hero { background: var(--ink); color: var(--snow); }
.hero__inner {
  max-width: var(--wide); margin: 0 auto; padding: var(--space-l) var(--gutter) var(--space-m);
  display: grid; grid-template-columns: minmax(0, 0.95fr) minmax(0, 1.25fr); gap: var(--space-l); align-items: center;
}
.hero h1 { font-size: var(--step-4); font-weight: 800; font-stretch: 72%; color: var(--snow); }
.hero__answer { font-size: var(--step-1); line-height: 1.6; margin: var(--space-m) 0 0; color: #e6f0f6; }
.hero__answer strong { color: #fff; font-weight: 650; }
.hero__meta { font-family: var(--font-ui); font-size: var(--step--1); line-height: 1.5; color: var(--strata-1); margin: var(--space-s) 0 0; }
.hero__jump { margin: var(--space-m) 0 0; display: flex; flex-wrap: wrap; gap: 0.6rem; }
.hero__figure { margin: 0; }
.hero__figure img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; border-radius: var(--radius); }
.hero__figure figcaption { font-family: var(--font-ui); font-size: 0.75rem; color: #9fb6c6; margin-top: 0.45rem; }
.hero__strata { display: block; width: 100%; height: clamp(2.75rem, 6vw, 5.5rem); }
.jump-link {
  font-family: var(--font-ui); font-weight: 600; font-size: var(--step--1);
  display: inline-block; padding: 0.55rem 0.95rem; border-radius: var(--radius);
  background: var(--snow); color: var(--ink); text-decoration: none;
}
.jump-link--quiet { background: transparent; color: var(--snow); box-shadow: inset 0 0 0 1.5px var(--strata-1); }
.jump-link:hover { background: var(--strata-1); color: var(--ink); }

/* 6. Home sections */
.section { max-width: var(--wide); margin: 0 auto; padding: var(--space-l) var(--gutter) 0; }
.hero + .section { padding-top: var(--space-m); }
.section + .section { padding-top: var(--space-xl); }
.section__head { max-width: var(--measure); margin-bottom: var(--space-m); }
.section h2 { font-size: var(--step-3); font-weight: 750; }
.section__lede { margin: 0.6rem 0 0; color: var(--ink-soft); font-size: var(--step-1); line-height: 1.55; }
.section h3 { font-size: var(--step-1); font-weight: 700; font-stretch: 82%; margin: 0 0 0.5rem; }
.as-of {
  display: inline-block; font-family: var(--font-ui); font-size: var(--step--1); font-weight: 600;
  color: var(--ember); background: var(--ember-wash); border-radius: 999px; padding: 0.1rem 0.7rem; margin-top: 0.75rem;
}

/* Status ledger: label/value rows, not cards */
.ledger { margin: 0; border-top: 2px solid var(--ink); max-width: 56rem; }
.ledger__row { display: grid; grid-template-columns: 11rem minmax(0, 1fr); gap: var(--space-m); padding: 0.85rem 0; border-bottom: 1px solid var(--rule); }
.ledger dt { font-family: var(--font-ui); font-weight: 700; font-stretch: 85%; }
.ledger dd { margin: 0; }
.ledger dd small { display: block; color: var(--ink-soft); font-size: var(--step--1); line-height: 1.5; margin-top: 0.25rem; }

/* Two-column split used by EA now/planned */
.split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: var(--space-l); align-items: start; }
.split > * { min-width: 0; }

/* Roadmap: genuinely ordered (Update 1 → 4) */
.roadmap { list-style: none; margin: 0; padding: 0; counter-reset: upd; border-left: 3px solid var(--strata-1); }
.roadmap li { counter-increment: upd; position: relative; padding: 0 0 1.1rem 1.4rem; }
.roadmap li::before {
  content: counter(upd); position: absolute; left: -0.85rem; top: 0.1rem;
  width: 1.55rem; height: 1.55rem; border-radius: 50%;
  background: var(--strata-3); color: var(--snow); font: 700 0.8rem/1.55rem var(--font-ui); text-align: center;
}
.roadmap b { font-family: var(--font-ui); font-stretch: 85%; }

/* 7. Reusable content components (homepage-verified only; article skeleton pending) */
.prose { max-width: var(--measure); }
.prose ul, .prose ol { padding-left: 1.4em; margin: 0 0 1em; }
.prose li { margin-bottom: 0.35em; }
.prose li::marker { color: var(--strata-3); }
.prose .section__lede { margin-bottom: var(--space-s); }

.figure { margin: 0; }
.figure img { border-radius: var(--radius); background: #cfdde6; }
.figure figcaption { font-family: var(--font-ui); font-size: 0.8125rem; color: var(--ink-soft); margin-top: 0.45rem; line-height: 1.45; }

.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; max-width: 56rem; border-top: 2px solid var(--ink); }
.data-table { width: 100%; border-collapse: collapse; font-size: var(--step--1); line-height: 1.5; font-family: var(--font-ui); min-width: 34rem; }
.data-table caption { text-align: left; font-weight: 600; padding: 0 0 0.5rem; caption-side: top; color: var(--ink-soft); }
.data-table th, .data-table td { text-align: left; vertical-align: top; padding: 0.7rem 0.9rem 0.7rem 0; border-bottom: 1px solid var(--rule); }
.data-table thead th { font-weight: 700; font-stretch: 85%; color: var(--ink-soft); }
.data-table tbody th { font-weight: 700; font-stretch: 85%; width: 9rem; }

.note {
  max-width: var(--measure); margin: var(--space-m) 0;
  padding: 0.9rem 1.1rem; border-left: 4px solid var(--strata-2); background: var(--snow);
  border-radius: 0 var(--radius) var(--radius) 0;
}
.note--warn { border-left-color: var(--ember); background: var(--ember-wash); }
.note p:last-child, .note ol:last-child { margin-bottom: 0; }
.note__title { font-family: var(--font-ui); font-weight: 700; display: block; margin-bottom: 0.25rem; }


/* 8. Utilities */
.mt-m { margin-top: var(--space-m); }
.mt-l { margin-top: var(--space-l); }
.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* Stacked tables on narrow screens: every cell keeps its column name */
@media (max-width: 640px) {
  .data-table--stack { min-width: 0; }
  .data-table--stack thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .data-table--stack tr { display: block; padding: 0.75rem 0; border-bottom: 1px solid var(--rule); }
  .data-table--stack th, .data-table--stack td { display: block; border: 0; padding: 0.15rem 0; width: auto; }
  .data-table--stack tbody th { font-size: var(--step-0); margin-bottom: 0.25rem; width: auto; }
  .data-table--stack td::before { content: attr(data-label) ": "; font-weight: 700; color: var(--ink-soft); }
}

/* Responsive */
@media (max-width: 900px) {
  .hero__inner { grid-template-columns: minmax(0, 1fr); gap: var(--space-m); padding-top: var(--space-m); }
  .hero__figure { order: -1; }
}
@media (max-width: 860px) {
  .split { grid-template-columns: minmax(0, 1fr); gap: var(--space-m); }
  .site-footer__inner { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 720px) {
  .site-header { position: static; }
  html { scroll-padding-top: 0.75rem; }
  .site-header__inner { flex-wrap: wrap; padding-top: 0.6rem; padding-bottom: 0.5rem; gap: 0.4rem var(--space-m); }
  .site-nav { width: 100%; }
  .site-nav ul { gap: 0.1rem 1rem; }
  .ledger__row { grid-template-columns: minmax(0, 1fr); gap: 0.15rem; }
  .section { padding-top: var(--space-l); }
  body { font-size: 1.0625rem; line-height: 1.68; }
}

/* 9. Content-page skeleton (first used by trust pages and /fix-crashes/) */
.article { max-width: var(--wide); margin: 0 auto; padding: var(--space-l) var(--gutter) 0; }
.breadcrumb { font-family: var(--font-ui); font-size: var(--step--1); color: var(--ink-soft); margin: 0 0 var(--space-s); }
.breadcrumb ol { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 0.25rem 0.5rem; }
.breadcrumb li + li::before { content: "/"; margin-right: 0.5rem; color: var(--rule); }
.article__header { max-width: var(--measure); padding-bottom: var(--space-m); border-bottom: 3px solid var(--strata-1); margin-bottom: var(--space-l); }
.article__header h1 { font-size: clamp(2rem, 4.4vw, 3rem); font-weight: 800; font-stretch: 74%; }
.article__lede { font-size: var(--step-1); line-height: 1.6; color: var(--ink-soft); margin: var(--space-s) 0 0; }
.article__body { max-width: 56rem; }
.article__body > p, .article__body > ul, .article__body > ol, .article__body > h2, .article__body > h3,
.article__body > .note, .article__body > dl { max-width: var(--measure); }
.article__body > ul, .article__body > ol { padding-left: 1.4em; margin: 0 0 1em; }
.article__body li { margin-bottom: 0.4em; }
.article__body li::marker { color: var(--strata-3); }
.article__body > h2 { font-size: var(--step-2); font-weight: 750; margin: var(--space-l) 0 var(--space-s); }
.article__body > h2:first-child { margin-top: 0; }
.article__body > h3 { font-size: var(--step-1); font-weight: 700; font-stretch: 82%; margin: var(--space-m) 0 0.4rem; }
.article__body > .figure { margin: var(--space-m) 0; max-width: 46rem; }
.article__body > .table-wrap { margin: var(--space-s) 0 var(--space-m); }
.article__updated { font-family: var(--font-ui); font-size: var(--step--1); color: var(--ink-soft); margin-top: var(--space-l); }
.related { max-width: var(--measure); margin-top: var(--space-l); padding-top: var(--space-m); border-top: 1px solid var(--rule); }
.related h2 { font-size: var(--step-1); font-stretch: 82%; margin-bottom: 0.5rem; }
.related ul { margin: 0; padding-left: 1.2em; }
.site-nav a[aria-current="page"] { color: var(--snow); border-bottom-color: var(--strata-1); }

/* 10. 404 */
.notfound { max-width: var(--measure); margin: 0 auto; padding: var(--space-xl) var(--gutter) var(--space-l); }
.notfound__code { font-family: var(--font-ui); font-weight: 800; font-stretch: 72%; font-size: 1rem; color: var(--ember); margin: 0 0 0.5rem; }
.notfound h1 { font-size: clamp(2rem, 4.4vw, 3rem); font-weight: 800; font-stretch: 74%; }
.notfound ul { padding-left: 1.2em; }
