:root {
  --bg: #ffffff;
  --mint: #e6f2ef;
  --mint-2: #f3f9f7;
  --teal: #0b5550;
  --teal-2: #137a72;
  --text: #1d2b2a;
  --muted: #4e615f;
  --coral: #c2412d;
  --line: #d3e2df;
  --font: "Gill Sans", "Gill Sans MT", Calibri, "Trebuchet MS", sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --gutter: clamp(16px, 3vw, 40px);
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 24px; -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 400 1.125rem/1.65 var(--font); }
[hidden] { display: none !important; }
a { color: var(--teal-2); text-underline-offset: 0.18em; }
a:hover { color: var(--teal); }
h1, h2, h3 { margin: 0; line-height: 1.15; color: var(--teal); font-weight: 600; }
p { margin: 0 0 1rem; }
ul { margin: 0 0 1rem; padding-left: 1.25rem; }
li { margin-bottom: 0.35rem; }
:focus-visible { outline: 3px solid var(--coral); outline-offset: 2px; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; }
.skip { position: absolute; left: var(--gutter); top: -80px; z-index: 20; background: var(--teal); color: #fff; padding: 0.6rem 1rem; }
.skip:focus { top: 12px; }

/* Header */
.site-header {
  display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 1.5rem;
  padding: 16px var(--gutter); border-bottom: 1px solid var(--line); background: var(--bg);
}
.brand { display: inline-flex; align-items: center; gap: 0.6rem; text-decoration: none; color: var(--teal); font-weight: 600; font-size: 1.3rem; }
.brand svg { width: 32px; height: 32px; }
.tld { color: var(--coral); }
.tagline { margin: 0; color: var(--muted); font-size: 0.95rem; padding-left: 1.5rem; border-left: 1px solid var(--line); }
.site-header nav { margin-left: auto; }
.site-header ul { display: flex; gap: 0.25rem; margin: 0; padding: 0; list-style: none; }
.site-header li { margin: 0; }
.site-header nav a { display: block; padding: 0.4rem 0.8rem; border-radius: 6px; text-decoration: none; color: var(--text); }
.site-header nav a:hover { background: var(--mint); color: var(--teal); }

/* Layout */
.layout { display: grid; grid-template-columns: 280px minmax(0, 1fr); max-width: 1240px; margin: 0 auto; }
.layout > * { min-width: 0; }
.toc { border-right: 1px solid var(--line); background: var(--mint-2); }
.toc-details { position: sticky; top: 0; padding: 28px 20px 28px var(--gutter); max-height: 100vh; overflow-y: auto; }
.toc summary { font-size: 0.8rem; font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); cursor: pointer; list-style: none; margin-bottom: 0.75rem; }
.toc summary::-webkit-details-marker { display: none; }
.toc ol { list-style: none; margin: 0; padding: 0; counter-reset: toc; }
.toc li { counter-increment: toc; margin: 0; }
.toc a {
  display: flex; gap: 0.6rem; padding: 0.45rem 0.6rem; border-radius: 6px; border-left: 3px solid transparent;
  text-decoration: none; color: var(--text); font-size: 1rem; line-height: 1.35;
}
.toc a::before { content: counter(toc); color: var(--muted); font-variant-numeric: tabular-nums; min-width: 1ch; }
.toc a:hover { background: var(--mint); }
.toc a[aria-current="true"] { background: var(--mint); border-left-color: var(--coral); color: var(--teal); font-weight: 600; }

.doc { padding: clamp(32px, 5vw, 64px) clamp(16px, 5vw, 72px) 80px; max-width: 860px; min-width: 0; }
.doc-head { margin-bottom: 2rem; }
.eyebrow { font-size: 0.85rem; font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase; color: var(--coral); margin-bottom: 0.75rem; }
.doc h1 { font-size: clamp(2.1rem, 5vw, 3.3rem); letter-spacing: -0.01em; margin-bottom: 1rem; }
.lede { font-size: 1.3rem; color: var(--muted); line-height: 1.5; }
.meta { font-size: 0.95rem; color: var(--muted); border-top: 1px solid var(--line); padding-top: 0.75rem; }

.callout { background: var(--mint); border-left: 4px solid var(--teal); padding: 1rem 1.25rem; border-radius: 0 8px 8px 0; margin-bottom: 2.5rem; }
.callout p { margin: 0; }

.doc section { padding-top: 2.25rem; margin-top: 2.25rem; border-top: 1px solid var(--line); }
.doc h2 { display: flex; align-items: baseline; gap: 0.75rem; font-size: clamp(1.55rem, 3.2vw, 2.1rem); margin-bottom: 1rem; }
.n {
  flex: none; display: inline-grid; place-items: center; width: 2rem; height: 2rem; border-radius: 50%;
  background: var(--coral); color: #fff; font-size: 1rem; transform: translateY(-0.15rem);
}
.doc h3 { font-size: 1.25rem; margin-bottom: 0.5rem; }
.note { font-size: 0.95rem; color: var(--muted); background: var(--mint-2); padding: 0.6rem 0.9rem; border-radius: 6px; }

.table-wrap { overflow-x: auto; margin: 0 0 1.25rem; border: 1px solid var(--line); border-radius: 10px; }
table { width: 100%; border-collapse: collapse; font-size: 1rem; min-width: 520px; }
th, td { text-align: left; padding: 0.75rem 0.9rem; border-bottom: 1px solid var(--line); vertical-align: top; }
thead th { background: var(--teal); color: #fff; font-weight: 600; }
tbody th { color: var(--teal); font-weight: 600; background: var(--mint-2); width: 30%; }
tbody tr:last-child th, tbody tr:last-child td { border-bottom: 0; }

.cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; margin-bottom: 1rem; }
.card { border: 1px solid var(--line); border-top: 4px solid var(--teal-2); border-radius: 10px; padding: 1.1rem 1.2rem; }
.card p { margin: 0; color: var(--muted); }

.ticks { list-style: none; padding: 0; }
.ticks li { position: relative; padding-left: 2rem; margin-bottom: 0.8rem; }
.ticks li::before {
  content: ""; position: absolute; left: 0; top: 0.35rem; width: 1.15rem; height: 1.15rem; border-radius: 4px;
  background: var(--mint) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M3.5 8.5l3 3 6-7' fill='none' stroke='%230b5550' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / 80% no-repeat;
}

.template { border: 1px solid var(--teal); border-radius: 10px; overflow: hidden; margin-bottom: 0.5rem; }
.template-bar { display: flex; justify-content: space-between; align-items: center; gap: 1rem; background: var(--teal); color: #fff; padding: 0.5rem 0.6rem 0.5rem 1rem; font: 500 0.85rem/1 var(--mono); }
.template pre { margin: 0; padding: 1.1rem 1.2rem; overflow-x: auto; background: var(--mint-2); font: 400 0.9rem/1.6 var(--mono); color: var(--text); white-space: pre-wrap; }
.btn-small { border: 1px solid #fff; background: transparent; color: #fff; font: 600 0.85rem/1 var(--font); padding: 0.5rem 0.8rem; border-radius: 6px; cursor: pointer; }
.btn-small:hover { background: #fff; color: var(--teal); }
.btn-small:focus-visible { outline-color: #fff; }
.sr-status { min-height: 1.4em; font-size: 0.95rem; color: var(--teal-2); }

.progress-wrap { display: flex; align-items: center; gap: 1rem; margin: 0.5rem 0 1rem; }
.progress { flex: 1; height: 10px; border-radius: 999px; background: var(--mint); overflow: hidden; }
.progress span { display: block; height: 100%; width: 0; background: var(--teal-2); border-radius: inherit; transition: width 0.3s ease; }
#progress-text { margin: 0; font-weight: 600; color: var(--teal); white-space: nowrap; }
.checklist { list-style: none; padding: 0; border: 1px solid var(--line); border-radius: 10px; }
.checklist li { display: flex; gap: 0.85rem; align-items: flex-start; padding: 0.8rem 1rem; margin: 0; border-bottom: 1px solid var(--line); }
.checklist li:last-child { border-bottom: 0; }
.checklist input { flex: none; width: 1.3rem; height: 1.3rem; margin: 0.2rem 0 0; accent-color: var(--teal-2); cursor: pointer; }
.checklist label { cursor: pointer; }
.checklist input:checked + label { color: var(--muted); text-decoration: line-through; text-decoration-color: var(--coral); }
.checklist-actions { display: flex; flex-wrap: wrap; gap: 0.75rem; }
.btn { border: 2px solid var(--teal); background: var(--teal); color: #fff; font: 600 1rem/1 var(--font); padding: 0.8rem 1.2rem; border-radius: 8px; cursor: pointer; }
.btn:hover { background: var(--teal-2); border-color: var(--teal-2); }
.btn-ghost { background: transparent; color: var(--teal); }
.btn-ghost:hover { background: var(--mint); color: var(--teal); border-color: var(--teal); }

details:not(.toc-details) { border-bottom: 1px solid var(--line); padding: 0.9rem 0; }
details:not(.toc-details) summary { cursor: pointer; font-weight: 600; color: var(--teal); }
details:not(.toc-details) p { margin: 0.6rem 0 0; color: var(--muted); }

.site-footer {
  border-top: 1px solid var(--line); background: var(--teal); color: #e9f4f2;
  padding: 1.75rem var(--gutter); display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0.5rem 2rem; font-size: 0.95rem;
}
.site-footer p { margin: 0; }
.site-footer a { color: #fff; }
.site-footer :focus-visible { outline-color: #fff; }

@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; }
  .toc { border-right: 0; border-bottom: 1px solid var(--line); }
  .toc-details { position: static; max-height: none; padding: 14px var(--gutter); }
  .toc summary { margin: 0; padding: 0.4rem 0; }
  .toc summary::after { content: " ▾"; }
  .toc-details[open] summary { margin-bottom: 0.5rem; }
  .tagline { display: none; }
}
@media (max-width: 600px) {
  .cards { grid-template-columns: 1fr; }
  .site-header nav { margin-left: 0; width: 100%; }
  .site-header nav a { padding: 0.4rem 0.6rem; }
  .progress-wrap { flex-direction: column; align-items: stretch; gap: 0.4rem; }
}

@media print {
  .site-header, .toc, .site-footer, .callout, .checklist-actions, .skip, .template-bar button { display: none !important; }
  .layout { display: block; }
  .doc { padding: 0; max-width: none; }
  body { font-size: 11pt; }
  a { color: inherit; }
  body.print-checklist .doc > *:not(#checklist) { display: none !important; }
  body.print-checklist #checklist { border: 0; margin: 0; padding: 0; }
}

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