/* ============================================================
   Design system modelled on privacytools.io:
   dark surface, Inter, heavy display weights, bracketed labels.
   Light theme included — toggle in the masthead.
   ============================================================ */

:root,
:root[data-theme="dark"] {
  --bg: #0a0d12;
  --surface: #10151d;
  --surface-2: #151b25;
  --border: #1e2531;
  --border-hover: #2c3542;

  --text: #e8ebf0;
  --muted: #8b94a3;

  --accent: #4aa3e6;        /* links, active state */
  --accent-strong: #6fbcf5;
  /* Text sitting ON the accent. The accent is bright, so dark text is the
     legible choice here — white on it only reaches 2.7:1. */
  --on-accent: #08111a;
  --bracket: #ff8a5c;       /* the [ ] section labels */
  --ok: #34d399;            /* free / done */
  --warn: #f0b849;          /* paid */
  --info: #7aa7d8;          /* official */

  --tip-bg: #17202b;
  --tip-border: #e8a54e;    /* calmer amber — "note", not "alarm" */
  --tip-label: #e8a54e;

  --page: 84rem;
  --measure: 40rem;
  /* Reading measure for long-form prose. Step text ran ~94 characters per
     line on a wide screen, well past the comfortable range. */
  --measure-prose: 62ch;
}

:root[data-theme="light"] {
  --bg: #ffffff;
  --surface: #f7f9fb;
  --surface-2: #eff3f7;
  --border: #dde3ea;
  --border-hover: #c3ccd6;

  --text: #10151d;
  --muted: #5c6673;

  --accent: #1c6fb0;
  --accent-strong: #14568a;
  --on-accent: #ffffff;   /* light theme's accent is dark enough for white */
  --bracket: #c2521f;
  --ok: #16794c;
  --warn: #855a09;
  --info: #2b5580;

  --tip-bg: #fdf3ee;
  --tip-border: #c98a2e;    /* calmer amber — "note", not "alarm" */
  --tip-label: #8a5a0a;     /* darker so the label text stays AA on cream */
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, sans-serif;
  font-size: 16px;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

.wrap { max-width: var(--page); margin: 0 auto; padding: 0 1.5rem; }

/* ---------- Masthead ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  background: rgba(10, 13, 18, 0.85);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}

:root[data-theme="light"] .topbar { background: rgba(255, 255, 255, 0.88); }

.topbar .wrap {
  display: flex;
  align-items: center;
  gap: 1rem;
  height: 4rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  font-weight: 800;
  font-size: 1.3rem;
  letter-spacing: -0.02em;
  color: var(--text);
  text-decoration: none;
}

/* Dutch stepped gable (trapgevel) — inherits the accent colour from the theme. */
.brand .logo {
  width: 1.85rem;
  height: 1.85rem;
  color: var(--accent);
  flex-shrink: 0;
}

.brand em { font-style: normal; color: var(--accent); }

.top-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* Sized to a comfortable touch target (>=2.5rem tall) rather than to the text
   inside them — these were 29px high, well under any thumb. */
.icon-btn,
.lang-toggle button {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--muted);
  font: inherit;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 0.45rem 0.7rem;
  cursor: pointer;
  line-height: 1;
  min-height: 2.5rem;
  min-width: 2.5rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.icon-btn:hover,
.lang-toggle button:hover { border-color: var(--border-hover); color: var(--text); }

.lang-toggle { display: flex; gap: 0.3rem; }

.lang-toggle button.active {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--on-accent);
}

/* Search collapses to just the icon button until toggled open, so it doesn't
   crowd the topbar next to the theme/language controls. */
.search-wrap {
  overflow: hidden;
  max-width: 0;
  opacity: 0;
  transition: max-width 0.2s ease, opacity 0.15s ease;
}

.topbar.search-open .search-wrap {
  max-width: 14rem;
  opacity: 1;
}

#search-toggle.active {
  border-color: var(--accent);
  color: var(--accent);
}

/* ---------- Hero ---------- */
.hero {
  text-align: center;
  padding: 5rem 0 3.5rem;
}

.kicker {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 1.2rem;
}

.hero h1 {
  font-weight: 800;
  font-size: clamp(2.1rem, 5vw, 3.25rem);
  line-height: 1.1;
  letter-spacing: -0.03em;
  max-width: 20ch;
  margin: 0 auto 1.2rem;
}

.hero h1 .hl { color: var(--accent); }

.hero .intro {
  color: var(--muted);
  max-width: var(--measure);
  margin: 0 auto;
  font-size: 1.05rem;
}

/* ---------- Trust bar (last-checked date + reviewer byline) ----------
   The "*" links down to .trust-disclaimer in the footer, which spells out
   that the date and reviewer are placeholders — see trustBarHTML() in app.js. */
.trust-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 1.2rem auto 0;
  color: var(--muted);
  font-size: 0.82rem;
}

.trust-check { color: var(--ok); flex-shrink: 0; }
.trust-sep { color: var(--border-hover); }

/* Initials monogram, deliberately not a photo — see the comment above
   trustBarHTML() in app.js for why. */
.trust-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 50%;
  background: var(--accent);
  color: var(--on-accent);
  font-size: 0.58rem;
  font-weight: 800;
  letter-spacing: 0.01em;
  flex-shrink: 0;
}

.trust-note {
  color: var(--accent);
  text-decoration: none;
  font-weight: 700;
}
.trust-note:hover { color: var(--accent-strong); text-decoration: underline; }

.trust-disclaimer {
  max-width: 46rem;
  font-size: 0.78rem;
  font-style: italic;
  opacity: 0.75;
  margin-bottom: 0.8rem;
  scroll-margin-top: 4rem;
}

/* ---------- "Was this helpful?" star rating (placeholder, see trustRatingHTML in app.js) ---------- */
.trust-rating {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.3rem;
  margin-top: 0.6rem;
}

.trust-stars {
  position: relative;
  display: flex;
  gap: 0.15rem;
}

.trust-star {
  background: none;
  border: none;
  padding: 0.15rem;
  color: var(--border-hover);
  cursor: pointer;
  line-height: 0;
  transition: color 0.1s ease;
}

.trust-star.filled { color: var(--accent); }
.trust-star:hover { color: var(--accent-strong); }

/* Fixed aggregate fill shown before the visitor votes — see the comment
   above TRUST_RATING_STAR_FILL in app.js. Sits on top of the (empty) star
   buttons, clipped by its own width; pointer-events: none so clicks reach
   the buttons underneath. */
.trust-stars-fill {
  position: absolute;
  inset: 0;
  display: flex;
  gap: 0.15rem;
  overflow: hidden;
  pointer-events: none;
  color: var(--accent);
}

.trust-star-icon {
  display: inline-flex;
  padding: 0.15rem;
  line-height: 0;
  flex-shrink: 0;
}

.trust-rating-text {
  font-size: 0.8rem;
  color: var(--muted);
}
.trust-rating-text strong { color: var(--text); }

.trust-rating-thanks {
  font-size: 0.78rem;
  color: var(--ok);
  font-weight: 600;
}

/* ---------- Bracketed section label ---------- */
.bracket-label {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text);
  margin-bottom: 0.6rem;
}

.bracket-label::before { content: "["; color: var(--bracket); font-weight: 400; font-size: 1.5rem; line-height: 1; }
.bracket-label::after  { content: "]"; color: var(--bracket); font-weight: 400; font-size: 1.5rem; line-height: 1; }

/* ---------- Tracks ---------- */
.track-section { padding-bottom: 2rem; }

.track-section > .wrap > p {
  color: var(--muted);
  font-size: 0.92rem;
  margin-bottom: 1.2rem;
}

.tracks {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0.8rem;
}

.track {
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  text-align: left;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.1rem;
  font: inherit;
  color: var(--muted);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

.track:hover { border-color: var(--border-hover); background: var(--surface-2); }

.track.active {
  border-color: var(--accent);
  background: var(--surface-2);
}

.track .t-name {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text);
  margin-bottom: 0.2rem;
}

.track.active .t-name { color: var(--accent); }

.track .t-desc { font-size: 0.78rem; line-height: 1.4; color: var(--muted); }

.progress-wrap {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  font-size: 0.8rem;
  color: var(--muted);
  white-space: nowrap;
}

.bar {
  width: 7rem;
  height: 4px;
  background: var(--border);
  border-radius: 99px;
  overflow: hidden;
}

.bar span {
  display: block;
  height: 100%;
  width: 0;
  background: var(--accent);
  border-radius: 99px;
  transition: width 0.3s ease;
}

.link-btn {
  background: none;
  border: none;
  font: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--accent);
  cursor: pointer;
  padding: 0;
}

.link-btn:hover { color: var(--accent-strong); }

#site-search {
  width: 14rem;
  padding: 0.45rem 0.7rem 0.45rem 2.1rem;
  font: inherit;
  font-size: 0.85rem;
  color: var(--text);
  background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='15' height='15' viewBox='0 0 24 24' fill='none' stroke='%238b94a3' stroke-width='2.5'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='M20 20l-4-4'/%3E%3C/svg%3E") no-repeat 0.65rem center;
  border: 1px solid var(--border);
  border-radius: 8px;
  outline: none;
}

#site-search:focus { border-color: var(--accent); }
#site-search::placeholder { color: var(--muted); }

/* ---------- Step nav (sidebar) ----------
   The content stays one readable column; the horizontal space goes to
   navigation, not to splitting content into columns. */
.main-grid {
  display: grid;
  grid-template-columns: 14rem minmax(0, 1fr);
  gap: 3rem;
  align-items: start;
}

.cat-nav {
  position: sticky;
  top: 5rem;
  max-height: calc(100vh - 7rem);
  overflow-y: auto;
  scrollbar-width: none;
  padding: 2rem 0;
}

.cat-nav::-webkit-scrollbar { display: none; }

.cat-nav .progress-wrap {
  flex-wrap: wrap;
  gap: 0.5rem 0.7rem;
  margin-bottom: 1.25rem;
}

.cat-nav .bar { width: 100%; }

/* Master switches: hide a content type across the whole site. */
.view-opts {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin-bottom: 1.5rem;
}

.view-label {
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--muted);
}

.view-opts label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--muted);
  cursor: pointer;
}

.view-opts label:hover { color: var(--text); }
.view-opts input { accent-color: var(--accent); cursor: pointer; }

body.hide-must .must,
body.hide-tips .note-group-tip,
body.hide-practice .note-group-practice,
body.hide-tips .tip,
body.hide-tips .agent,
body.hide-practice .practice,
body.hide-checklist .checklist,
body.hide-checklist .step-checklist { display: none; }

#cat-nav {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.cat-nav a {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--muted);
  text-decoration: none;
  padding: 0.35rem 0.6rem;
  border-radius: 6px;
}

.cat-nav a b {
  font-variant-numeric: tabular-nums;
  font-weight: 800;
  color: var(--accent);
}

.cat-nav a:hover { color: var(--text); background: var(--surface); }
.cat-nav a.nav-done { opacity: 0.45; }
.cat-nav a.nav-done b { color: var(--ok); }

.cat-nav a.nav-current {
  color: var(--text);
  background: var(--surface);
  box-shadow: inset 2px 0 0 var(--accent);
}
.cat-nav a.nav-current.nav-done { opacity: 1; }

/* ---------- Steps ---------- */
.category {
  padding: 4rem 0;
  border-bottom: 1px solid var(--border);
  /* Matches the sticky topbar's own height, so jumping to a step doesn't
     leave extra blank space stacked on top of the step's own top padding. */
  scroll-margin-top: 4rem;
}

.category:last-of-type { border-bottom: none; }

.step-label {
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--bracket);
  font-variant-numeric: tabular-nums;
}

.category.step-done .step-label { color: var(--ok); }

.cat-head h2 {
  font-weight: 800;
  font-size: clamp(1.5rem, 2.6vw, 2rem);
  line-height: 1.2;
  letter-spacing: -0.02em;
  margin: 0.4rem 0 0.6rem;
}

.category.step-done .cat-head h2 { color: var(--muted); }

/* The step title doubles as the expand/collapse control. */
.cat-toggle {
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
  width: 100%;
  background: none;
  border: none;
  padding: 0;
  /* Pull the button left by the caret + gap so the title text still
     left-aligns with the step label and description; the caret hangs
     into the gutter instead of indenting the title. */
  margin: 0 0 0 -1.1rem;
  font: inherit;
  color: inherit;
  letter-spacing: inherit;
  text-align: left;
  cursor: pointer;
}

.cat-toggle:hover { color: var(--accent); }

.caret {
  flex: 0 0 auto;
  width: 0;
  height: 0;
  align-self: center;
  border-left: 0.5rem solid currentColor;
  border-top: 0.35rem solid transparent;
  border-bottom: 0.35rem solid transparent;
  color: var(--muted);
  transition: transform 0.15s ease;
}

.category:not(.collapsed) .caret { transform: rotate(90deg); }
.cat-toggle:hover .caret { color: var(--accent); }

/* Collapsed steps show only their header — a compact map of the journey. */
.category.collapsed { padding: 1.5rem 0; }
.category.collapsed .cat-body { display: none; }
.category.collapsed .cat-head > p { margin-bottom: 0; }

/* A search must reveal matches even inside a collapsed step. */
#categories.searching .cat-body { display: block; }

/* Notes (must / tips / practice / agent) can be folded away per step,
   independently of the whole-step collapse, so the tool cards stay in view. */
.category.notes-collapsed .cat-notes,
.category.notes-collapsed .must,
.category.notes-collapsed .step-checklist { display: none; }
/* The notes toggle only makes sense while the step body itself is open. */
.category.collapsed .notes-toggle { display: none; }

.cat-head > p {
  color: var(--muted);
  max-width: var(--measure);
  margin-bottom: 1rem;
}

.count {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  margin-right: 1rem;
}

.done-toggle,
.notes-toggle {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 99px;
  font: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  padding: 0.3rem 0.9rem;
}

.notes-toggle { margin-left: 0.5rem; }

.done-toggle:hover,
.notes-toggle:hover { border-color: var(--border-hover); color: var(--text); }

.done-toggle[aria-pressed="true"] {
  color: var(--ok);
  border-color: var(--ok);
  background: transparent;
}

/* ---------- "What you must know" — the step's key facts, above the tools ---------- */
.must {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: 8px;
  padding: 1.1rem 1.3rem 1.1rem 1.4rem;
  margin: 1.4rem 0 0.4rem;
  max-width: var(--measure-prose);
}

.must-label {
  display: block;
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 0.7rem;
}

.must ul { list-style: none; display: flex; flex-direction: column; gap: 0.6rem; }

.must li {
  position: relative;
  padding-left: 1.1rem;
  font-size: 0.95rem;
  line-height: 1.6;
  color: var(--muted);
}

.must li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.55em;
  width: 0.4rem;
  height: 0.4rem;
  border-radius: 50%;
  background: var(--accent);
}

.must strong { color: var(--text); font-weight: 700; }

/* ---------- Step checklist — pilot: user's own tasks + note per step ----------
   When a step has one, it sits in a right-hand rail next to the step's main
   content instead of stacking inline — .step-main carries every other block
   (must / notes / tools) in column 1, the checklist floats in column 2 and
   stays in view (sticky) while you read/scroll through that step. */
.cat-body:has(.step-checklist) {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 16rem;
  gap: 0 2rem;
  align-items: start;
}

.step-checklist {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.1rem 1.3rem;
  margin-top: 1.4rem;
  position: sticky;
  top: 5rem;
}

.sc-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.6rem;
}

.sc-label {
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--muted);
}

.sc-count { font-size: 0.78rem; color: var(--muted); }

.step-checklist .bar { width: 100%; margin-bottom: 0.8rem; }

.sc-item {
  display: flex;
  gap: 0.7rem;
  padding: 0.45rem 0;
  font-size: 0.89rem;
  line-height: 1.5;
  cursor: pointer;
  align-items: flex-start;
}

.sc-item input {
  margin-top: 0.25rem;
  width: 1rem;
  height: 1rem;
  accent-color: var(--accent);
  flex-shrink: 0;
  cursor: pointer;
}

.sc-item span { color: var(--text); }

.sc-item.done span {
  color: var(--muted);
  text-decoration: line-through;
}

.sc-note {
  display: block;
  width: 100%;
  margin-top: 0.6rem;
  padding: 0.6rem 0.8rem;
  font: inherit;
  font-size: 0.85rem;
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  resize: vertical;
  min-height: 3rem;
  outline: none;
}

.sc-note:focus { border-color: var(--accent); }
.sc-note::placeholder { color: var(--muted); }

/* ---------- Tips ---------- */
/* One heading per group, not per card. A twelve-step track was printing
   "Goed om te weten" 68 times on a single page; the label now works like the
   one on .must — it names the group once and the cards below it are the items. */
.note-group {
  margin: 1.6rem 0;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.note-group .tip-label,
.note-group .practice-label { margin-bottom: 0.1rem; }

.tip {
  background: var(--tip-bg);
  border: 1px solid var(--border);
  border-left: 3px solid var(--tip-border);
  border-radius: 8px;
  padding: 1rem 1.2rem;
  margin: 0;
  max-width: var(--measure-prose);
  font-size: 0.95rem;
  line-height: 1.6;
  color: var(--muted);
}

.tip-label {
  display: block;
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--tip-label);
  margin-bottom: 0.5rem;
}

.tip strong { color: var(--text); font-weight: 700; }

/* Lived experience from buyers — deliberately distinct from the rule-based tips. */
.practice {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--ok);
  border-radius: 8px;
  padding: 1rem 1.2rem;
  margin: 0;
  max-width: var(--measure-prose);
  font-size: 0.95rem;
  line-height: 1.6;
  color: var(--muted);
}

.practice-label {
  display: block;
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--ok);
  margin-bottom: 0.5rem;
}

.practice strong { color: var(--text); font-weight: 700; }

/* What a buying agent (aankoopmakelaar) does at this step — "core" is a task
   that's the main reason people hire one; "optional" is something they
   can also do, but isn't the point of paying for one. */
.agent {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: 8px;
  padding: 1rem 1.2rem;
  margin: 1.5rem 0;
  max-width: 52rem;
  font-size: 0.92rem;
  color: var(--muted);
}

.agent strong { color: var(--text); font-weight: 700; }

.agent-label {
  display: block;
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 0.5rem;
}

.agent-optional {
  border-left-style: dashed;
  opacity: 0.85;
}

.agent-optional .agent-label { color: var(--muted); }

/* ---------- Tool cards ---------- */
.tools {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(16.5rem, 1fr));
  gap: 0.8rem;
  margin-top: 1.8rem;
}

.tool {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.1rem;
  transition: border-color 0.15s, background 0.15s;
}

.tool:hover { border-color: var(--border-hover); background: var(--surface-2); }

.tool h3 { font-size: 0.98rem; font-weight: 700; }

.badges { display: flex; flex-wrap: wrap; gap: 0.45rem; }

.badge {
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.badge.official { color: var(--info); }
.badge.free { color: var(--ok); }
.badge.paid { color: var(--warn); }
.badge.top {
  color: var(--accent-strong);
  background: color-mix(in srgb, var(--accent) 16%, transparent);
  border-radius: 4px;
  padding: 0.1rem 0.4rem;
}

/* The best place to start at this step — lifted out of the grid visually. */
.tool-top {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 7%, var(--surface));
  grid-column: 1 / -1;
}

.tool-top:hover { border-color: var(--accent-strong); }

.tool p {
  font-size: 0.86rem;
  color: var(--muted);
  flex-grow: 1;
}

.tool .visit {
  align-self: flex-start;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--accent);
  text-decoration: none;
}

.tool .visit:hover { color: var(--accent-strong); }

/* ---------- Checklist ---------- */
.checklist {
  margin-top: 2.5rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.5rem;
}

/* Wraps so the title + reset + hide buttons don't overflow on narrow screens. */
.cl-head { display: flex; align-items: center; gap: 0.5rem 1rem; flex-wrap: wrap; }

.cl-head h3 { font-size: 1.15rem; font-weight: 800; letter-spacing: -0.01em; }

#cl-reset,
#cl-toggle {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 99px;
  font: inherit;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  padding: 0.25rem 0.8rem;
}

#cl-reset { margin-left: auto; }
#cl-reset:hover,
#cl-toggle:hover { border-color: var(--border-hover); color: var(--text); }

.checklist.collapsed .cl-body { display: none; }

#cl-reset:hover { border-color: var(--border-hover); color: var(--text); }

.cl-intro { color: var(--muted); font-size: 0.88rem; margin: 0.4rem 0 1rem; }

.cl-progress {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  font-size: 0.78rem;
  color: var(--muted);
  margin-bottom: 1.8rem;
}

.cl-progress .bar { width: 9rem; }

.cl-group { margin-bottom: 1.6rem; }

.cl-group h4 {
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--bracket);
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 0.3rem;
}

.cl-item {
  display: flex;
  gap: 0.75rem;
  padding: 0.6rem 0;
  font-size: 0.89rem;
  line-height: 1.55;
  cursor: pointer;
  align-items: flex-start;
}

.cl-item input {
  margin-top: 0.3rem;
  width: 1rem;
  height: 1rem;
  accent-color: var(--accent);
  flex-shrink: 0;
  cursor: pointer;
}

.cl-item span { color: var(--muted); }
.cl-item strong { color: var(--text); font-weight: 700; }

.cl-item.done span,
.cl-item.done strong {
  opacity: 0.45;
  text-decoration: line-through;
}

/* ---------- Suggest ---------- */
.suggest {
  margin: 4rem 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 2rem;
  max-width: 42rem;
  scroll-margin-top: 8rem;
}

.suggest h2 { font-size: 1.4rem; font-weight: 800; letter-spacing: -0.01em; margin-bottom: 0.5rem; }
.suggest > p { color: var(--muted); margin-bottom: 1.5rem; font-size: 0.92rem; }

.field { margin-bottom: 1.1rem; }

.field label {
  display: block;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 0.35rem;
}

.field input,
.field textarea {
  width: 100%;
  padding: 0.6rem 0.9rem;
  font: inherit;
  font-size: 0.92rem;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  outline: none;
}

.field input:focus,
.field textarea:focus { border-color: var(--accent); }
.field textarea { resize: vertical; }

.btn-primary {
  background: var(--accent);
  color: var(--on-accent);
  border: none;
  border-radius: 8px;
  padding: 0.7rem 1.5rem;
  font: inherit;
  font-size: 0.88rem;
  font-weight: 700;
  cursor: pointer;
}

.btn-primary:hover { background: var(--accent-strong); }

/* ---------- Footer ---------- */
footer {
  border-top: 1px solid var(--border);
  padding: 3rem 0;
  color: var(--muted);
  font-size: 0.85rem;
}

.disclaimer { max-width: 46rem; margin-bottom: 0.8rem; }

/* ---------- Accessibility ---------- */
.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 100;
  background: var(--accent);
  color: var(--on-accent);
  padding: 0.7rem 1.2rem;
  text-decoration: none;
  font-weight: 700;
}

.skip-link:focus { left: 0; }

.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

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

/* ---------- Misc ---------- */
.hidden { display: none !important; }

#no-results { color: var(--muted); padding: 4rem 0; text-align: center; }

/* ---------- Medium screens ----------
   The checklist rail needs real width to be worth having; below this it would
   just squeeze the main content, so it drops back to stacking under it. */
@media (max-width: 64rem) {
  .cat-body:has(.step-checklist) { grid-template-columns: minmax(0, 1fr); }
  .step-checklist { position: static; margin-top: 1.4rem; max-width: 52rem; }
}

/* ---------- Small screens ---------- */
@media (max-width: 48rem) {
  .tracks { grid-template-columns: repeat(2, 1fr); }
  .hero { padding: 3rem 0 2rem; }

  /* Not enough width for brand + all four topbar controls at once; the
     open search box overlays the row instead of squeezing everything. */
  .topbar.search-open .search-wrap {
    position: absolute;
    right: 1.5rem;
    top: 4.5rem;
    max-width: none;
    width: calc(100% - 3rem);
  }

  /* No room for a sidebar — fall back to a horizontal strip above the steps.
     minmax(0, …) is required: a bare 1fr has min-width:auto, so the nowrap
     nav links would blow the column past the viewport instead of scrolling. */
  .main-grid { grid-template-columns: minmax(0, 1fr); gap: 1rem; }
  .cat-nav {
    position: static;
    max-height: none;
    overflow: visible;
    padding: 1rem 0 0;
  }
  .cat-nav .progress-wrap { flex-wrap: nowrap; margin-bottom: 1rem; }
  .cat-nav .bar { width: 7rem; }
  /* The scrollbar is hidden, so without this the strip looks like it ends at
     step 2 — the fade is the only cue that steps 3–12 are there. */
  #cat-nav {
    flex-direction: row;
    gap: 1.2rem;
    overflow-x: auto;
    scrollbar-width: none;
    -webkit-mask-image: linear-gradient(to right, #000 82%, transparent 100%);
    mask-image: linear-gradient(to right, #000 82%, transparent 100%);
    padding-right: 2rem;
  }
  #cat-nav::-webkit-scrollbar { display: none; }
  .cat-nav a { white-space: nowrap; padding: 0.25rem 0; }
}

/* ---------- Phones ---------- */
/* At 390px the brand plus four controls measured 439px wide, so every phone
   scrolled sideways. Reclaim the width from the gutter, the wordmark and the
   gaps rather than dropping a control. */
@media (max-width: 30rem) {
  .wrap { padding: 0 1rem; }

  .topbar .wrap { gap: 0.5rem; }
  .brand { font-size: 1.1rem; gap: 0.4rem; min-width: 0; }
  .brand .logo { width: 1.55rem; height: 1.55rem; }
  .brand span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

  .top-actions { gap: 0.3rem; }
  .icon-btn,
  .lang-toggle button { padding: 0.45rem 0.5rem; }
  .lang-toggle { gap: 0.2rem; }

  .topbar.search-open .search-wrap { right: 1rem; width: calc(100% - 2rem); }

  /* The hero set five separate lines of trust signals before the first real
     content; tightening the scale keeps them without owning the fold. */
  .hero { padding: 2.25rem 0 1.5rem; }
  .trust-bar { font-size: 0.78rem; }
}

/* ---------- Content load failure ---------- */
/* Only rendered by showLoadError() in app.js when content/*.json can't be
   loaded. Nothing here applies on a normal page load. */
.load-error {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--warn);
  border-radius: 10px;
  padding: 1.25rem 1.4rem;
  margin: 2rem 0;
}

.load-error h2 {
  font-size: 1.05rem;
  margin: 0 0 0.5rem;
}

.load-error p {
  margin: 0 0 0.5rem;
  color: var(--muted);
}

.load-error p:last-child { margin-bottom: 0; }

.load-error-detail {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.82em;
  word-break: break-word;
}

/* ---------- First-paint placeholder ---------- */
/* The page is empty until content/*.json arrives, which on a slow connection
   meant a blank screen with only the masthead. This holds the shape of a step
   so there is something to look at and nothing jumps when the real content
   lands. Replaced by render() or showLoadError(); never visible after that. */
.skeleton {
  display: flex;
  flex-direction: column;
  gap: 2.5rem;
  padding: 1rem 0;
}

.sk-step {
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
  max-width: var(--measure-prose);
}

.sk-line,
.sk-block {
  background: var(--surface-2);
  border-radius: 6px;
  animation: sk-pulse 1.6s ease-in-out infinite;
}

.sk-line { height: 0.85rem; }
.sk-title { height: 1.5rem; width: 45%; margin-bottom: 0.4rem; }
.sk-short { width: 62%; }

.sk-block {
  height: 5.5rem;
  border-left: 3px solid var(--border);
  margin-top: 0.6rem;
}

@keyframes sk-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.45; }
}

@media (prefers-reduced-motion: reduce) {
  .sk-line,
  .sk-block { animation: none; }
}
