/* =============================================================
   1. Tokens
   ============================================================= */
:root {
  --bg: #fbfaf7;
  --surface: #ffffff;
  --ink: #1b1f1d;
  --muted: #5c6661;
  --line: #e4e2db;
  --accent: #0f766e;
  --accent-ink: #ffffff;
  --accent-soft: #e3f2ef;
  --warn: #b45309;
  --bad: #b42318;
  --good: #15803d;
  --radius: 16px;
  --shadow: 0 1px 2px rgba(20, 30, 25, .04), 0 8px 28px rgba(20, 30, 25, .07);
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --display: "Fraunces", Georgia, "Times New Roman", serif;
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --gutter: clamp(16px, 4vw, 32px);
  --max: 1160px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111513;
    --surface: #181d1b;
    --ink: #eef1ef;
    --muted: #a3ada8;
    --line: #2a312e;
    --accent: #2dd4bf;
    --accent-ink: #062320;
    --accent-soft: #15312d;
    --warn: #f59e0b;
    --bad: #f87171;
    --good: #4ade80;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 28px rgba(0, 0, 0, .35);
  }
}

/* =============================================================
   2. Reset & base
   ============================================================= */
*, *::before, *::after { box-sizing: border-box; margin: 0; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.65;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
}
img, svg { display: block; max-width: 100%; }
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; }
input, select { font: inherit; color: inherit; }
a { color: var(--accent); text-underline-offset: 3px; }
p { text-wrap: pretty; }
h1, h2, h3, h4 { text-wrap: balance; line-height: 1.12; letter-spacing: -0.015em; }
::selection { background: var(--accent); color: var(--accent-ink); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }

/* =============================================================
   3. Utilities
   ============================================================= */
.skip-link {
  position: fixed; top: -100px; left: 1rem; z-index: 9999;
  padding: .6rem 1rem; background: var(--ink); color: var(--bg);
  border-radius: 8px; font-weight: 600;
}
.skip-link:focus { top: 1rem; }
.container { width: 100%; max-width: var(--max); margin: 0 auto; padding: 0 var(--gutter); }
.narrow { max-width: 760px; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
.eyebrow {
  display: inline-block; font-size: .78rem; font-weight: 600; letter-spacing: .08em;
  text-transform: uppercase; color: var(--accent);
}

/* =============================================================
   4. Typography
   ============================================================= */
h1 { font-family: var(--display); font-weight: 600; font-size: clamp(2rem, 5.2vw, 3.4rem); }
h2 { font-family: var(--display); font-weight: 600; font-size: clamp(1.55rem, 3.4vw, 2.2rem); margin-bottom: .6em; }
h3 { font-size: 1.12rem; font-weight: 650; margin-bottom: .35em; }
.lead { font-size: clamp(1.05rem, 2vw, 1.2rem); color: var(--muted); max-width: 46ch; }
.prose p, .prose ul, .prose ol { margin-bottom: 1em; }
.prose ul, .prose ol { padding-left: 1.3em; }
.prose li { margin-bottom: .35em; }
.prose h2 { margin-top: 1.8em; }
.prose h3 { margin-top: 1.4em; }
.prose strong { font-weight: 650; }

/* =============================================================
   5. Components
   ============================================================= */
/* Header */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--line);
}
.site-header .container { display: flex; align-items: center; justify-content: space-between; gap: 1rem; min-height: 60px; }
.logo { display: flex; align-items: center; gap: .55rem; font-weight: 700; color: var(--ink); text-decoration: none; font-size: 1.02rem; }
.logo svg { width: 28px; height: 28px; flex-shrink: 0; }
.nav { display: flex; gap: .25rem; flex-wrap: wrap; justify-content: flex-end; }
.nav a {
  color: var(--muted); text-decoration: none; font-size: .92rem; font-weight: 500;
  padding: .4rem .65rem; border-radius: 8px; transition: color .2s var(--ease-out), background .2s var(--ease-out);
}
.nav a:hover, .nav a[aria-current="page"] { color: var(--ink); background: var(--accent-soft); }
.nav .hide-sm { display: none; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  padding: .8rem 1.25rem; border-radius: 12px; font-weight: 600; text-decoration: none;
  transition: transform .2s var(--ease-out), background .2s var(--ease-out), border-color .2s var(--ease-out);
}
.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { transform: translateY(-1px); }
.btn-ghost { border: 1px solid var(--line); color: var(--ink); background: var(--surface); }
.btn-ghost:hover { border-color: var(--accent); }
.btn-row { display: flex; flex-wrap: wrap; gap: .6rem; margin-top: 1.4rem; }

/* Cards */
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1.25rem; box-shadow: var(--shadow);
}
.grid { display: grid; gap: 1rem; grid-template-columns: 1fr; }
.step-card { display: flex; flex-direction: column; gap: .3rem; text-decoration: none; color: var(--ink); transition: transform .2s var(--ease-out), border-color .2s var(--ease-out); }
.step-card:hover { transform: translateY(-2px); border-color: var(--accent); }
.step-num {
  display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 50%;
  background: var(--accent-soft); color: var(--accent); font-weight: 700; font-size: .9rem; margin-bottom: .3rem;
}
.step-card p { color: var(--muted); font-size: .94rem; }

/* Tool card */
.tool-card { padding: 1.25rem; }
.tool-card h2 { font-family: var(--sans); font-size: 1.15rem; font-weight: 700; margin-bottom: .2rem; letter-spacing: 0; }
.tool-card .tool-sub { color: var(--muted); font-size: .9rem; margin-bottom: 1rem; }
.fields { display: grid; grid-template-columns: 1fr 1fr; gap: .7rem; }
.field { display: flex; flex-direction: column; gap: .25rem; }
.field.full { grid-column: 1 / -1; }
.field label { font-size: .82rem; font-weight: 600; color: var(--muted); }
.field input, .field select {
  width: 100%; padding: .62rem .75rem; border-radius: 10px; border: 1px solid var(--line);
  background: var(--bg); font-size: 1rem; min-height: 44px;
}
.field input:focus, .field select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.results {
  margin-top: 1rem; display: grid; grid-template-columns: 1fr 1fr; gap: .6rem;
  padding-top: 1rem; border-top: 1px dashed var(--line);
}
.result { background: var(--bg); border-radius: 12px; padding: .7rem .8rem; }
.result .r-label { font-size: .76rem; color: var(--muted); font-weight: 600; }
.result .r-value { font-size: 1.25rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.result.big { grid-column: 1 / -1; background: var(--accent-soft); }
.result.big .r-value { font-size: 1.9rem; color: var(--accent); }
.is-bad .r-value { color: var(--bad) !important; }
.verdict { grid-column: 1 / -1; font-size: .92rem; padding: .6rem .8rem; border-radius: 10px; background: var(--bg); }
.verdict.good { color: var(--good); }
.verdict.warn { color: var(--warn); }
.verdict.bad { color: var(--bad); }
.tool-card[data-state="error"] .results { display: none; }
.tool-error { display: none; margin-top: 1rem; color: var(--bad); font-size: .92rem; }
.tool-card[data-state="error"] .tool-error { display: block; }
.tool-actions { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .9rem; }
.tool-actions button { font-size: .88rem; color: var(--muted); padding: .35rem .6rem; border-radius: 8px; border: 1px solid var(--line); }
.tool-actions button:hover { color: var(--ink); border-color: var(--accent); }
.badge-privacy { margin-top: .9rem; font-size: .84rem; color: var(--muted); }
.noscript-msg { padding: 1rem; border-radius: 10px; background: var(--accent-soft); font-size: .92rem; }

/* Ad slots — placeholders only */
.ad-slot {
  display: grid; place-items: center; min-height: 120px; margin: 2rem auto;
  border: 1px dashed var(--line); border-radius: 12px; color: var(--muted);
  font-size: .72rem; letter-spacing: .1em; text-transform: uppercase;
}
.ad-slot.tall { min-height: 280px; }

/* FAQ */
.faq details {
  border: 1px solid var(--line); border-radius: 12px; background: var(--surface);
  padding: .9rem 1.1rem; margin-bottom: .6rem;
}
.faq summary { cursor: pointer; font-weight: 600; list-style: none; display: flex; justify-content: space-between; gap: 1rem; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; color: var(--accent); font-weight: 700; }
.faq details[open] summary::after { content: "−"; }
.faq details p { margin-top: .6rem; color: var(--muted); }

/* Resource cards */
.res-card { display: flex; flex-direction: column; gap: .4rem; }
.res-card .tag {
  align-self: flex-start; font-size: .72rem; font-weight: 600; padding: .2rem .55rem; border-radius: 99px;
  background: var(--accent-soft); color: var(--accent);
}
.res-card p { color: var(--muted); font-size: .94rem; flex: 1; }
.res-card a.res-link { font-weight: 600; font-size: .92rem; }
.res-card.placeholder { border-style: dashed; box-shadow: none; }

/* Callouts */
.callout {
  border-left: 4px solid var(--accent); background: var(--accent-soft);
  padding: .9rem 1.1rem; border-radius: 0 12px 12px 0; margin: 1.2rem 0;
}
.callout.warn { border-left-color: var(--warn); background: color-mix(in srgb, var(--warn) 12%, var(--surface)); }
.checklist { list-style: none; padding-left: 0 !important; }
.checklist li { padding-left: 1.7em; position: relative; }
.checklist li::before { content: "✓"; position: absolute; left: 0; color: var(--accent); font-weight: 700; }
.redflags li::before { content: "✕"; color: var(--bad); }

/* TOC */
.toc { position: relative; }
.toc ol { padding-left: 1.2em; }
.toc li { margin-bottom: .3em; }
.toc a { color: var(--ink); text-decoration: none; }
.toc a:hover, .toc a[aria-current] { color: var(--accent); }
.toc a[aria-current] { font-weight: 600; }

/* Table */
.table-wrap { overflow-x: auto; margin: 1rem 0 1.4rem; border: 1px solid var(--line); border-radius: 12px; }
table { border-collapse: collapse; width: 100%; font-size: .93rem; background: var(--surface); }
th, td { text-align: left; padding: .65rem .8rem; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-weight: 650; background: var(--bg); }
tr:last-child td { border-bottom: 0; }

/* =============================================================
   6. Sections
   ============================================================= */
.hero { padding: 2rem 0 1rem; }
.hero-grid { display: grid; gap: 1.5rem; align-items: start; }
.hero h1 { margin: .4rem 0 .8rem; }
.section { padding: 2.5rem 0; }
.section-head { margin-bottom: 1.4rem; }
.section-head p { color: var(--muted); max-width: 60ch; }
.page-hero { padding: 2.4rem 0 1rem; }
.page-hero h1 { margin: .4rem 0 .7rem; }
.guide-layout { display: grid; gap: 2rem; }
.chapter { scroll-margin-top: 80px; }
.site-footer { border-top: 1px solid var(--line); padding: 2rem 0 2.5rem; margin-top: 2rem; color: var(--muted); font-size: .9rem; }
.footer-grid { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 1rem; }
.footer-links { display: flex; flex-wrap: wrap; gap: .4rem 1.1rem; }
.footer-links a { color: var(--muted); text-decoration: none; }
.footer-links a:hover { color: var(--ink); }
.disclaimer { margin-top: 1rem; font-size: .82rem; max-width: 70ch; }

/* =============================================================
   8. Responsive
   ============================================================= */
@media (min-width: 540px) {
  .grid.cols-2 { grid-template-columns: 1fr 1fr; }
  .nav .hide-sm { display: inline-block; }
}
@media (min-width: 720px) {
  .grid.cols-3 { grid-template-columns: repeat(2, 1fr); }
  .tool-card { padding: 1.6rem; }
}
@media (min-width: 960px) {
  .hero { padding: 3.5rem 0 1.5rem; }
  .hero-grid { grid-template-columns: 1fr 460px; gap: 3rem; }
  .grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
  .guide-layout { grid-template-columns: 250px 1fr; gap: 3rem; }
  .toc { position: sticky; top: 84px; align-self: start; max-height: calc(100vh - 100px); overflow: auto; }
}
@media (max-width: 539px) {
  .logo { white-space: nowrap; font-size: .95rem; }
  .nav { flex-wrap: nowrap; }
  .nav a { padding: .35rem .45rem; font-size: .86rem; white-space: nowrap; }
  .hero { padding-top: 1.25rem; }
  .hero h1 { font-size: 1.85rem; margin: .3rem 0 .5rem; }
  .hero .lead { font-size: 1rem; }
  .hero .btn-row { margin-top: 1rem; flex-wrap: nowrap; }
  .hero .btn { padding: .65rem .8rem; font-size: .9rem; flex: 1; text-align: center; }
}
@media (max-width: 359px) {
  .fields, .results { grid-template-columns: 1fr; }
}
