:root {
  --ink: #17201f; --muted: #5b6664; --paper: #fbf8f2; --card: #ffffff; --line: #e3ddd1;
  --brand: #0f3d3e; --brand-2: #1f6f6b; --accent: #c8553d; --soft: #eef4f1; --focus: #e0a526;
  --radius: 14px; --max: 1120px;
  --sans: ui-sans-serif, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
}
@media (prefers-color-scheme: dark) {
  :root { --ink: #ecebe6; --muted: #a9b2b0; --paper: #111716; --card: #182120; --line: #2a3634; --brand: #8fd1c4; --brand-2: #6fc1b3; --soft: #1b2928; }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 17px/1.6 var(--sans); }
a { color: var(--brand-2); text-underline-offset: 2px; }
a:focus-visible, button:focus-visible, input:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.wrap { max-width: var(--max); margin: 0 auto; padding: 0 20px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; } .skip:focus { left: 12px; top: 12px; background: var(--card); padding: 8px 12px; z-index: 10; }
h1, h2, h3 { font-family: var(--serif); line-height: 1.2; letter-spacing: -0.01em; }
h1 { font-size: clamp(2rem, 4.5vw, 3.1rem); margin: 0.2em 0 0.3em; }
h2 { font-size: 1.55rem; margin: 1.6em 0 0.5em; }
.lede { font-size: 1.15rem; color: var(--muted); max-width: 46em; }
.muted { color: var(--muted); }
.eyebrow { text-transform: uppercase; letter-spacing: 0.14em; font-size: 0.78rem; font-weight: 700; color: var(--accent); margin: 0; }

/* header */
.site-header { background: var(--card); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
.header-inner { display: flex; align-items: center; gap: 20px; padding-top: 12px; padding-bottom: 8px; }
.logo { font-family: var(--serif); font-weight: 700; font-size: 1.45rem; color: var(--ink); text-decoration: none; display: flex; align-items: center; gap: 8px; }
.logo-mark { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 8px; background: var(--brand); color: var(--paper); font-family: var(--sans); font-size: 1.3rem; line-height: 1; }
.header-search { margin-left: auto; flex: 0 1 340px; position: relative; }
.header-search input { width: 100%; padding: 9px 14px; border: 1px solid var(--line); border-radius: 999px; background: var(--paper); color: var(--ink); font: inherit; font-size: 0.95rem; }
.nav { display: flex; gap: 4px; overflow-x: auto; padding-bottom: 8px; scrollbar-width: none; }
.nav a { color: var(--muted); text-decoration: none; padding: 6px 12px; border-radius: 999px; font-size: 0.93rem; font-weight: 600; white-space: nowrap; }
.nav a:hover { background: var(--soft); color: var(--ink); }
.nav a[aria-current="page"] { background: var(--brand); color: var(--paper); }
.nav-saved { margin-left: auto; }

/* hero + search */
.hero { padding: 64px 0 40px; background: radial-gradient(1200px 400px at 10% -10%, var(--soft), transparent); }
.big-search { display: flex; gap: 10px; max-width: 760px; margin: 22px 0 12px; position: relative; }
.big-search input { flex: 1; min-width: 0; padding: 16px 20px; font: inherit; font-size: 1.08rem; border: 2px solid var(--brand); border-radius: var(--radius); background: var(--card); color: var(--ink); }
.big-search button, .inline-search button { padding: 0 24px; border: 0; border-radius: var(--radius); background: var(--brand); color: var(--paper); font: inherit; font-weight: 700; cursor: pointer; }
.examples { color: var(--muted); font-size: 0.95rem; display: flex; flex-wrap: wrap; gap: 6px 4px; align-items: center; }
.examples a { background: var(--card); border: 1px solid var(--line); padding: 3px 11px; border-radius: 999px; text-decoration: none; color: var(--ink); font-size: 0.9rem; }
.has-ac { position: relative; }
.ac { position: absolute; top: calc(100% + 4px); left: 0; right: 0; list-style: none; margin: 0; padding: 6px; background: var(--card); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 12px 30px rgba(0,0,0,.12); z-index: 20; }
.ac a { display: block; padding: 8px 12px; border-radius: 8px; text-decoration: none; color: var(--ink); }
.ac li[aria-selected="true"] a, .ac a:hover { background: var(--soft); }
.inline-search { display: flex; gap: 8px; max-width: 520px; margin: 8px 0 24px; position: relative; }
.inline-search input { flex: 1; min-width: 0; padding: 11px 14px; border: 1px solid var(--line); border-radius: 12px; font: inherit; background: var(--card); color: var(--ink); }

/* browse + cards */
.browse-grid { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; }
.browse-grid a { display: flex; flex-direction: column; gap: 4px; height: 100%; padding: 18px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); text-decoration: none; color: var(--ink); }
.browse-grid a:hover, .cards a:hover { border-color: var(--brand-2); }
.browse-grid strong { font-family: var(--serif); font-size: 1.25rem; }
.browse-grid span { color: var(--muted); font-size: 0.93rem; }
.browse-grid em { margin-top: auto; padding-top: 6px; font-style: normal; font-size: 0.85rem; font-weight: 700; color: var(--brand-2); }
.cards { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.cards a { display: flex; flex-direction: column; gap: 4px; height: 100%; padding: 16px 18px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); text-decoration: none; color: var(--ink); }
.card-cat { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.1em; font-weight: 700; color: var(--accent); }
.card-title { font-family: var(--serif); font-size: 1.15rem; font-weight: 700; }
.card-desc { color: var(--muted); font-size: 0.92rem; }
.steps { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; counter-reset: s; }
.steps li { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; display: flex; flex-direction: column; counter-increment: s; }
.steps li::before { content: counter(s); font-family: var(--serif); font-size: 1.6rem; color: var(--accent); }
.steps span { color: var(--muted); font-size: 0.93rem; }
.how { padding-bottom: 32px; }

/* pages */
.page { padding: 28px 20px 48px; }
.crumbs { font-size: 0.88rem; color: var(--muted); margin-top: 20px; }
.crumbs a { color: var(--muted); }
.cat-block h2 a { color: var(--ink); text-decoration: none; }
.az { columns: 3 220px; padding-left: 1.1em; }
.prose { max-width: 760px; }
.prose ul { padding-left: 1.2em; }

/* search page */
.filters { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0; }
.filters a { padding: 5px 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--card); color: var(--ink); text-decoration: none; font-size: 0.9rem; }
.filters a[aria-pressed="true"] { background: var(--brand); color: var(--paper); border-color: var(--brand); }
.search-tip { font-size: 0.85rem; color: var(--muted); }
.corrected { margin: 12px 0 0; }
.count { color: var(--muted); }
.results { list-style: none; padding: 0; display: grid; gap: 12px; max-width: 820px; }
.results a { display: flex; flex-direction: column; gap: 3px; padding: 16px 18px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); text-decoration: none; color: var(--ink); }
.results a:hover { border-color: var(--brand-2); }
.r-title { font-family: var(--serif); font-size: 1.25rem; font-weight: 700; color: var(--brand-2); }
.r-desc { color: var(--muted); }
.chips { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.chips a { display: inline-block; padding: 6px 14px; border-radius: 999px; background: var(--soft); text-decoration: none; color: var(--ink); }

/* guide */
.guide { padding-bottom: 48px; }
.guide-head { max-width: 820px; padding: 8px 0 12px; border-bottom: 1px solid var(--line); }
.guide-meta { display: flex; flex-wrap: wrap; gap: 8px 18px; align-items: center; color: var(--muted); font-size: 0.9rem; }
.save-btn { margin-left: auto; border: 1px solid var(--brand-2); background: transparent; color: var(--brand-2); border-radius: 999px; padding: 6px 14px; font: inherit; font-size: 0.88rem; font-weight: 700; cursor: pointer; }
.save-btn[aria-pressed="true"] { background: var(--brand-2); color: var(--paper); }
.guide-grid { display: grid; grid-template-columns: 230px minmax(0, 1fr); gap: 40px; }
.toc { position: sticky; top: 130px; align-self: start; font-size: 0.9rem; padding-top: 26px; }
.toc p { font-weight: 700; margin: 0 0 6px; }
.toc ol { list-style: none; padding: 0; margin: 0; border-left: 2px solid var(--line); }
.toc a { display: block; padding: 4px 12px; color: var(--muted); text-decoration: none; }
.toc a:hover { color: var(--ink); }
.guide-body { max-width: 760px; }
.guide-body section { scroll-margin-top: 140px; }
.guide-body ul { padding-left: 1.2em; }
.guide-body li { margin: 0.35em 0; }
.glance { background: var(--soft); border-radius: var(--radius); padding: 4px 24px 12px; margin-top: 24px; }
.glance h2 { margin-top: 0.8em; }
.terms div { padding: 10px 0; border-bottom: 1px solid var(--line); }
.terms dt { font-weight: 700; }
.terms dd { margin: 2px 0 0; color: var(--muted); }
.qs li::marker { content: "? "; color: var(--accent); font-weight: 700; }
.sources li { margin: 0.5em 0; }
.med-box { margin-top: 24px; background: var(--card); border: 1px solid var(--line); border-left: 5px solid var(--brand-2); border-radius: var(--radius); padding: 16px 20px; }
.med-box dl { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 10px; margin: 0; }
.med-box dt { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); font-weight: 700; }
.med-box dd { margin: 0; font-weight: 600; }
.med-note { font-size: 0.9rem; color: var(--muted); margin: 12px 0 0; }
.updated { margin-top: 32px; font-size: 0.9rem; color: var(--muted); border-top: 1px solid var(--line); padding-top: 14px; }

/* footer */
.site-footer { border-top: 1px solid var(--line); background: var(--card); padding: 28px 0; font-size: 0.9rem; color: var(--muted); }
.footer-note { max-width: 60em; }
.footer-links { display: flex; flex-wrap: wrap; gap: 6px 18px; }
.footer-links a { color: var(--ink); }

@media (max-width: 820px) {
  .guide-grid { grid-template-columns: 1fr; gap: 0; }
  .toc { display: none; }
  .header-inner { flex-wrap: wrap; }
  .header-search { flex: 1 1 100%; order: 3; }
  .site-header { position: static; }
  .big-search { flex-direction: column; }
  .big-search button { padding: 14px; }
  .hero { padding-top: 36px; }
}
@media print {
  .site-header, .site-footer, .toc, .save-btn, .related { display: none; }
  body { background: #fff; color: #000; }
}
