:root {
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, system-ui, sans-serif;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
  --bg: #f7f7f5;
  --surface: #ffffff;
  --surface-2: #efefeb;
  --border: #e2e2dd;
  --text: #1c1c1a;
  --muted: #62625c;
  --accent: #0f6f5c;
  --accent-soft: #e3f1ed;
  --safe: #1f7a4d;
  --safe-bg: #e5f3ea;
  --rebuild: #3b5b9a;
  --rebuild-bg: #e7ecf7;
  --review: #9a5b00;
  --review-bg: #fbf0dc;
  --max: 1080px;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1b1b1a;
    --surface: #232322;
    --surface-2: #2a2a28;
    --border: #363633;
    --text: #ecece8;
    --muted: #a6a69f;
    --accent: #3fb59a;
    --accent-soft: #1f3a33;
    --safe: #6fd39c;
    --safe-bg: #1d3327;
    --rebuild: #9db7ee;
    --rebuild-bg: #232d42;
    --review: #f0b35a;
    --review-bg: #3a2c16;
  }
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.6 var(--font);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-underline-offset: 3px; }
a:focus-visible, button:focus-visible, summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }
img { max-width: 100%; height: auto; display: block; }
code, pre { font-family: var(--mono); font-size: 0.88em; }
:not(pre) > code { background: var(--surface-2); padding: 1px 5px; border-radius: 4px; }
pre {
  background: #161615;
  color: #e8e8e3;
  border-radius: 10px;
  padding: 18px 20px;
  overflow-x: auto;
  line-height: 1.55;
}
pre .c { color: #8d8d86; }
.wrap { max-width: var(--max); margin: 0 auto; padding: 0 16px; }
@media (min-width: 640px) { .wrap { padding: 0 24px; } }

.skip { position: absolute; left: -999px; }
.skip:focus { left: 16px; top: 8px; background: var(--surface); padding: 8px 12px; z-index: 10; }

/* nav */
.nav { border-bottom: 1px solid var(--border); background: var(--surface); }
.nav .wrap { display: flex; align-items: center; gap: 12px; height: 60px; }
.logo { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 17px; color: var(--text); text-decoration: none; margin-right: auto; }
.logo img { width: 28px; height: 28px; }
/* Links keep a 44px hit area; the visible text stays small. */
.nav a:not(.logo):not(.btn) { color: var(--muted); text-decoration: none; font-size: 15px; display: inline-flex; align-items: center; min-height: 44px; padding: 0 8px; }
.logo { min-height: 44px; }
.nav a:not(.logo):not(.btn):hover { color: var(--text); }
@media (max-width: 480px) { .nav a.hide-sm:not(.logo):not(.btn) { display: none; } }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 44px; padding: 0 20px; border-radius: 8px;
  background: var(--accent); color: #fff; font-weight: 600; font-size: 15px; text-decoration: none;
  border: 1px solid var(--accent);
}
@media (prefers-color-scheme: dark) { .btn { color: #0d1f1a; } }
.btn:hover { filter: brightness(1.08); }
.btn.secondary { background: transparent; color: var(--text); border-color: var(--border); }
.btn.small { height: 40px; padding: 0 14px; font-size: 14px; }

/* hero */
.hero { padding: 72px 0 40px; }
.hero h1 { font-size: clamp(34px, 6vw, 56px); line-height: 1.07; letter-spacing: -0.03em; margin: 0 0 20px; max-width: 16ch; }
.hero .lede { font-size: clamp(17px, 2.2vw, 20px); color: var(--muted); max-width: 60ch; margin: 0 0 28px; }
.cta { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.fine { color: var(--muted); font-size: 14px; margin-top: 14px; }
.shot {
  margin: 48px 0 0; border-radius: 12px; overflow: hidden;
  border: 1px solid var(--border);
  box-shadow: 0 30px 60px -20px rgb(0 0 0 / 0.25), 0 2px 6px rgb(0 0 0 / 0.06);
}
figcaption { font-size: 14px; color: var(--muted); padding: 10px 14px; background: var(--surface); border-top: 1px solid var(--border); }

/* sections */
section { padding: 72px 0; }
section + section { border-top: 1px solid var(--border); }
h2 { font-size: clamp(26px, 3.6vw, 36px); line-height: 1.15; letter-spacing: -0.02em; margin: 0 0 14px; }
h3 { font-size: 18px; margin: 0 0 6px; }
.intro { color: var(--muted); font-size: 18px; max-width: 62ch; margin: 0 0 36px; }
.cols { display: grid; gap: 32px; grid-template-columns: 1fr; }
@media (min-width: 800px) { .cols { grid-template-columns: repeat(3, 1fr); } .cols.two { grid-template-columns: 1fr 1fr; align-items: center; } }
.cols p { margin: 0; color: var(--muted); }
.kind { padding-top: 16px; border-top: 2px solid var(--accent); }
.steps { counter-reset: s; list-style: none; padding: 0; margin: 0; display: grid; gap: 28px; }
@media (min-width: 800px) { .steps { grid-template-columns: repeat(3, 1fr); } }
.steps li { counter-increment: s; }
.steps li::before { content: counter(s); display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); font-weight: 700; margin-bottom: 12px; }
.steps p { color: var(--muted); margin: 0; }

.levels { display: grid; gap: 0; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); overflow: hidden; }
.levels > div { display: grid; grid-template-columns: 92px 1fr; gap: 16px; padding: 18px 20px; align-items: start; }
.levels > div + div { border-top: 1px solid var(--border); }
.levels p { margin: 0; color: var(--muted); }
.levels .badge { justify-self: start; }
.badge { display: inline-block; font-size: 13px; font-weight: 700; padding: 2px 10px; border-radius: 12px; }
.badge.safe { color: var(--safe); background: var(--safe-bg); }
.badge.rebuild { color: var(--rebuild); background: var(--rebuild-bg); }
.badge.review { color: var(--review); background: var(--review-bg); }
.checks { list-style: none; padding: 0; margin: 24px 0 0; display: grid; gap: 10px; }
@media (min-width: 800px) { .checks { grid-template-columns: 1fr 1fr; } }
.checks li { padding-left: 26px; position: relative; }
.checks li::before { content: ""; position: absolute; left: 2px; top: 8px; width: 12px; height: 7px; border-left: 2px solid var(--accent); border-bottom: 2px solid var(--accent); transform: rotate(-45deg); }

.catalog { display: grid; gap: 28px; grid-template-columns: 1fr; }
@media (min-width: 800px) { .catalog { grid-template-columns: repeat(3, 1fr); } }
.catalog ul { margin: 0; padding-left: 18px; color: var(--muted); }
.catalog li { margin: 3px 0; }

details { border-bottom: 1px solid var(--border); }
details:first-of-type { border-top: 1px solid var(--border); }
summary { cursor: pointer; font-weight: 600; font-size: 17px; list-style-position: outside; padding: 14px 0; }
details p { color: var(--muted); margin: 0 0 16px; max-width: 70ch; }

.final { text-align: center; }
.final .cta { justify-content: center; }
footer { border-top: 1px solid var(--border); padding: 32px 0 48px; color: var(--muted); font-size: 14px; }
footer .wrap { display: flex; flex-wrap: wrap; gap: 20px; justify-content: space-between; }
footer nav { display: flex; gap: 4px 18px; flex-wrap: wrap; }
footer nav a { display: inline-flex; align-items: center; min-height: 44px; }
footer a { color: var(--muted); }

/* docs / prose pages */
.page { display: grid; grid-template-columns: minmax(0, 1fr); gap: 40px; padding: 48px 0 80px; }
@media (min-width: 900px) { .page { grid-template-columns: 220px minmax(0, 1fr); } .toc { position: sticky; top: 24px; align-self: start; } }
.toc ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; font-size: 15px; }
.toc a { color: var(--muted); text-decoration: none; display: block; padding: 4px 0; }
@media (max-width: 899px) { .toc ul { grid-template-columns: 1fr 1fr; gap: 0 16px; } .toc a { padding: 11px 0; } }
.toc a:hover { color: var(--text); }
.prose { max-width: 72ch; min-width: 0; overflow-wrap: anywhere; }
.prose h1 { font-size: clamp(32px, 5vw, 44px); letter-spacing: -0.02em; line-height: 1.1; margin: 0 0 16px; }
.prose h2 { font-size: 26px; margin: 48px 0 12px; scroll-margin-top: 24px; }
.prose h3 { margin: 28px 0 8px; }
.prose p, .prose li { color: var(--text); }
.prose .muted { color: var(--muted); }
.prose table { border-collapse: collapse; width: 100%; font-size: 15px; display: block; overflow-x: auto; }
.prose th, .prose td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--border); vertical-align: top; }
.prose th { font-weight: 600; }
.note { border-left: 3px solid var(--review); background: var(--review-bg); padding: 12px 16px; border-radius: 0 8px 8px 0; }
