/* READY214 guides — standalone stylesheet for the static article pages.
   These pages are plain HTML on purpose: they must render fully with no
   JavaScript, so a crawler (and a veteran on a bad connection) gets the whole
   article on first byte. Colors mirror the app's Ivory & Emerald tokens
   (src/index.css); keep them in sync by hand if the brand palette moves. */

:root {
  --sage: #24775a;
  --sage-deep: #175c44;
  --sage-tint: #d7eae1;
  /* Emerald that has to stay legible against the page background. It is a
     token, not a raw value, so a later rule cannot outrank the dark override
     at equal specificity, which is how dark links and eyebrows ended up at
     2.2:1 on the dark ground. */
  --accent: #175c44;
  /* Forest emerald for text sitting on a mint surface. Constant in both modes
     on purpose: the mint itself flips, so one dark ink serves both. */
  --on-mint: #0f4030;
  --brand-navy: #1f2a44;
  --brand-red: #b5312c;
  --amber-bg: #f3e5c3;
  --amber-ink: #7a5a14;
  --bg: #fafaf6;
  --bg2: #f3f3ec;
  --card: #ffffff;
  --pill: #ecebdf;
  --line: #e5e4d8;
  --ink: #1e241f;
  --ink2: #40483f;
  --muted: #606a5c;
  --faint: #616b5d;
}

@media (prefers-color-scheme: dark) {
  :root {
    --sage-tint: #9ccdb9;
    --accent: #9ccdb9;
    --brand-navy: #e8eae5;
    --brand-red: #d26b5b;
    --amber-bg: #3a3223;
    --amber-ink: #d9b96a;
    --bg: #141715;
    --bg2: #181c19;
    --card: #202521;
    --pill: #272d28;
    --line: #2e3530;
    --ink: #e8eae5;
    --ink2: #c5cbc3;
    --muted: #9fa79e;
    --faint: #7f877e;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Albert Sans", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 17px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); font-weight: 600; }
a:hover { text-decoration: none; }

.wrap { max-width: 760px; margin: 0 auto; padding: 0 20px; }

/* Header */
.site-header {
  border-bottom: 1px solid var(--line);
  background: var(--bg2);
  padding: 14px 0;
}
/* Narrow screens: a <details> disclosure is the menu. No JavaScript, keyboard
   and screen-reader friendly out of the box, and it mirrors the app's drawer. */
.site-header details > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  list-style: none;
  cursor: pointer;
}
.site-header details > summary::-webkit-details-marker { display: none; }
.site-header .menu-btn { font-size: 22px; line-height: 1; color: var(--muted); padding: 2px 6px; border-radius: 8px; }
.site-header details[open] .menu-btn { background: var(--pill); color: var(--ink); }
.wordmark {
  font-weight: 800;
  font-size: 20px;
  letter-spacing: -0.02em;
  text-decoration: none;
  color: var(--brand-navy);
}
.wordmark span { color: var(--brand-red); }
.site-header nav { display: flex; flex-direction: column; gap: 4px; padding: 12px 0 4px; font-size: 15px; font-weight: 700; }
.site-header nav a { display: block; padding: 10px 16px; border-radius: 12px; color: var(--muted); text-decoration: none; }
.site-header nav a:hover { background: var(--pill); color: var(--ink); }
.site-header nav a.active { background: var(--sage-tint); color: var(--on-mint); }

/* Article */
main { padding: 40px 0 8px; }

.eyebrow {
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 10px;
}

h1 {
  font-size: 36px;
  line-height: 1.15;
  letter-spacing: -0.025em;
  font-weight: 800;
  margin: 0 0 14px;
}

.standfirst {
  font-size: 19px;
  color: var(--ink2);
  margin: 0 0 18px;
}

.byline {
  font-size: 13px;
  color: var(--faint);
  font-weight: 600;
  border-bottom: 1px solid var(--line);
  padding-bottom: 22px;
  margin-bottom: 30px;
}

h2 {
  font-size: 24px;
  line-height: 1.25;
  letter-spacing: -0.02em;
  font-weight: 800;
  margin: 40px 0 12px;
}

h3 {
  font-size: 18px;
  font-weight: 800;
  margin: 26px 0 8px;
}

p { margin: 0 0 16px; }
ul, ol { margin: 0 0 16px; padding-left: 22px; }
li { margin-bottom: 8px; }

strong { font-weight: 700; }

/* Callouts — tinted background, matching the app's own notice pattern
   (src/screens/Dashboard.tsx uses bg-sage-tint / bg-amber-bg the same way)
   rather than a colored side border. */
.callout {
  background: var(--sage-tint);
  border: 1px solid color-mix(in srgb, var(--sage-deep) 15%, transparent);
  border-radius: 16px;
  padding: 18px 20px;
  margin: 26px 0;
  font-size: 16px;
  color: var(--on-mint);
}
.callout p:last-child { margin-bottom: 0; }
/* Links inside a callout sit on the mint surface, not the page background, so
   they take the same ink as the text around them. Without this they inherit
   --accent, which in dark mode is the very mint they are sitting on: an
   invisible link at 1:1. Warn callouts follow their own amber ink. */
.callout a:not(.cta) { color: var(--on-mint); }
.callout.warn a:not(.cta) { color: var(--amber-ink); }
.callout .label {
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--on-mint);
  display: block;
  margin-bottom: 6px;
}
.callout.warn { background: var(--amber-bg); border-color: color-mix(in srgb, var(--amber-ink) 20%, transparent); }
.callout.warn .label { color: var(--amber-ink); }
.callout.warn, .callout.warn p { color: var(--amber-ink); }

/* Tables */
.table-scroll { overflow-x: auto; margin: 24px 0; }
table {
  border-collapse: collapse;
  width: 100%;
  min-width: 460px;
  font-size: 15px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
}
th, td { text-align: left; padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-weight: 800; background: var(--pill); font-size: 13px; letter-spacing: 0.02em; }
tr:last-child td { border-bottom: 0; }

/* Guide index cards */
.card-grid { display: grid; gap: 16px; margin: 20px 0 36px; }
.toc { display: flex; flex-wrap: wrap; gap: 8px 18px; margin: 24px 0 8px; font-size: 15px; font-weight: 700; }
.toc a { color: var(--sage-deep, var(--sage)); text-decoration: none; }
.toc a:hover { text-decoration: underline; }
h3.group { font-size: 14px; margin: 26px 0 0; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; font-weight: 700; }
@media (min-width: 720px) { .card-grid { grid-template-columns: 1fr 1fr; } }
.card {
  display: block;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 20px 22px;
  text-decoration: none;
  color: inherit;
}
.card:hover { border-color: var(--sage); }
.card h2 { font-size: 18px; margin: 0 0 6px; }
.card p { font-size: 15px; color: var(--muted); margin: 0; }

/* Next / related */
.related {
  background: var(--bg2);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 20px 22px;
  margin: 44px 0 0;
}
.related h2 { font-size: 16px; margin: 0 0 10px; }
.related ul { margin: 0; padding-left: 20px; font-size: 15px; }

.cta {
  display: inline-block;
  background: var(--sage-deep);
  color: #fff;
  font-weight: 700;
  font-size: 15px;
  padding: 12px 22px;
  border-radius: 999px;
  text-decoration: none;
  margin-top: 6px;
}
.cta:hover { background: #0f4030; color: #fff; }

/* Footer */
.site-footer {
  border-top: 1px solid var(--line);
  background: var(--bg2);
  margin-top: 56px;
  padding: 26px 0 40px;
  font-size: 13px;
  color: var(--muted);
}
.site-footer p { margin: 0 0 10px; }
.site-footer nav { display: flex; gap: 16px; flex-wrap: wrap; font-weight: 700; }

@media (max-width: 600px) {
  h1 { font-size: 29px; }
  h2 { font-size: 21px; }
  body { font-size: 16px; }
}

/* In-article ad, injected by /guides/ads.js. Reserve a minimum height so the
   article does not jump when the unit fills. */
.guide-ad {
  margin: 32px 0;
  min-height: 120px;
  background: var(--pill);
  border: 1px dashed var(--line);
  border-radius: 12px;
  overflow: hidden;
}
.guide-ad ins { width: 100%; }
.guide-ad-label {
  width: 100%;
  margin-bottom: 4px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  opacity: 0.65;
}

/* App-matching sidebar. Hidden on narrow screens, where the top header's links
   do the job; on wide screens it mirrors the app shell (src/components/AppShell.tsx)
   so a reader moving between the app and a guide sees one navigation. */
.side-nav { display: none; }
@media (min-width: 960px) {
  body {
    display: grid;
    grid-template-columns: 256px minmax(0, 1fr);
    grid-template-rows: 1fr auto;
  }
  .side-nav {
    display: flex;
    flex-direction: column;
    grid-row: 1 / span 2;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    background: var(--bg2);
    border-right: 1px solid var(--line);
  }
  .side-brand { display: block; padding: 24px; text-decoration: none; }
  .side-brand .wordmark { font-size: 20px; font-weight: 800; letter-spacing: -0.02em; line-height: 1; color: var(--brand-navy); }
  .side-brand .wordmark span { color: var(--brand-red); }
  .side-brand .tagline { display: block; font-size: 11px; font-weight: 600; color: var(--muted); margin-top: 4px; }
  .side-nav nav { display: flex; flex-direction: column; gap: 4px; padding: 8px 16px; }
  .side-nav nav a {
    display: block;
    padding: 10px 16px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 700;
    color: var(--muted);
    text-decoration: none;
    transition: background-color .15s, color .15s;
  }
  .side-nav nav a:hover { background: var(--pill); color: var(--ink); }
  .side-nav nav a.active { background: var(--sage-tint); color: var(--on-mint); }
  /* The sidebar carries the brand and the links, so the top bar would repeat both. */
  .site-header { display: none; }
  main, .site-footer { grid-column: 2; }
  main { padding-left: 24px; padding-right: 24px; }
}
