:root {
  --teal: #1f6b5f;
  --teal-ink: #143b36;
  --teal-soft: #e6f0ed;
  --rose: #c8706b;
  --bg: #f5f8f6;
  --surface: #ffffff;
  --text: #1d2b29;
  --muted: #5b6d69;
  --border: #dbe5e1;
  --link: #1f6b5f;
  --radius: 14px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --teal: #5aa596;
    --teal-ink: #d7ebe6;
    --teal-soft: #17302c;
    --bg: #0e1715;
    --surface: #14201e;
    --text: #e2ebe8;
    --muted: #9db1ac;
    --border: #253633;
    --link: #7cc4b4;
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; scroll-padding-top: 80px; -webkit-text-size-adjust: 100%; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.65 var(--font);
}

a { color: var(--link); text-underline-offset: 2px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 2px solid var(--teal); outline-offset: 2px; border-radius: 4px; }

.skip {
  position: absolute; left: 16px; top: -48px;
  background: var(--teal); color: #fff; padding: 8px 12px; border-radius: 8px; z-index: 20;
}
.skip:focus { top: 12px; }

.wrap { max-width: 1080px; margin: 0 auto; padding: 0 16px; }

/* ---------------------------------------------------------------- header */
.masthead {
  position: sticky; top: 0; z-index: 10;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(10px);
  -webkit-backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--border);
}
.masthead__inner { display: flex; align-items: center; justify-content: space-between; height: 60px; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--teal-ink); font-weight: 700; font-size: 18px; text-decoration: none; }
.print {
  font: inherit; font-size: 14px; color: var(--teal-ink);
  background: var(--surface); border: 1px solid var(--border); border-radius: 999px;
  padding: 6px 14px; cursor: pointer;
}
.print:hover { border-color: var(--teal); }

/* ---------------------------------------------------------------- layout */
.layout { display: grid; grid-template-columns: 1fr; gap: 32px; padding-top: 32px; padding-bottom: 64px; }
@media (min-width: 900px) { .layout { grid-template-columns: 220px minmax(0, 1fr); gap: 48px; } }

.toc { display: none; }
@media (min-width: 900px) {
  .toc { display: block; position: sticky; top: 92px; align-self: start; max-height: calc(100vh - 110px); overflow: auto; }
}
.toc__title { margin: 0 0 8px; font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.toc ol { list-style: none; margin: 0; padding: 0; border-left: 1px solid var(--border); }
.toc a {
  display: block; padding: 5px 0 5px 14px; margin-left: -1px;
  font-size: 14px; line-height: 1.4; color: var(--muted); text-decoration: none;
  border-left: 2px solid transparent;
}
.toc a:hover { color: var(--text); }
.toc a[aria-current="true"] { color: var(--teal); border-left-color: var(--teal); font-weight: 600; }

/* --------------------------------------------------------------- content */
.doc { max-width: 720px; min-width: 0; }
.doc h1 { margin: 0; font-size: clamp(30px, 5vw, 40px); line-height: 1.15; color: var(--teal-ink); letter-spacing: -0.01em; }
.meta { margin: 8px 0 24px; color: var(--muted); font-size: 14px; }
.lead { font-size: 18px; color: var(--text); }

.doc section { margin-top: 40px; }
.doc h2 { margin: 0 0 12px; font-size: 22px; line-height: 1.3; color: var(--teal-ink); }
.doc h3 { margin: 24px 0 8px; font-size: 16px; color: var(--teal-ink); }
.doc p, .doc ul, .doc ol { margin: 0 0 14px; }
.doc ul, .doc ol { padding-left: 22px; }
.doc li { margin-bottom: 6px; }
.doc li::marker { color: var(--teal); }

.summary {
  background: var(--teal-soft); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 20px 22px 8px;
}
.summary h2 { font-size: 18px; }

.data { margin: 0 0 14px; display: grid; gap: 10px; }
.data > div { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; }
.data dt { font-weight: 600; color: var(--teal-ink); }
.data dd { margin: 4px 0 0; color: var(--text); }

.note {
  border-left: 3px solid var(--rose); background: var(--surface);
  padding: 12px 16px; border-radius: 0 var(--radius) var(--radius) 0; color: var(--text);
}

table { width: 100%; border-collapse: collapse; margin: 0 0 14px; font-size: 15px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
th, td { text-align: left; vertical-align: top; padding: 10px 12px; border-bottom: 1px solid var(--border); }
th { font-size: 13px; font-weight: 600; color: var(--muted); background: var(--teal-soft); }
tbody tr:last-child td { border-bottom: 0; }

/* Tables stack into cards on narrow screens so the page never scrolls sideways. */
@media (max-width: 600px) {
  table, thead, tbody, tr, td { display: block; }
  thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  tr { padding: 10px 12px; border-bottom: 1px solid var(--border); }
  tbody tr:last-child { border-bottom: 0; }
  td { padding: 2px 0; border: 0; }
  td:first-child { font-weight: 600; color: var(--teal-ink); }
  td:nth-child(2)::before { content: "Uses: "; color: var(--muted); }
  td:nth-child(3)::before { content: "Basis: "; color: var(--muted); }
}

.steps li { margin-bottom: 10px; }

@media (min-width: 900px) { .layout--single { grid-template-columns: minmax(0, 720px); justify-content: center; } }
a.print { text-decoration: none; }

.button {
  display: inline-block; padding: 12px 20px; border-radius: 999px;
  background: var(--teal); color: #fff; font-weight: 600; text-decoration: none;
}
.button:hover { filter: brightness(1.08); text-decoration: none; }
@media (prefers-color-scheme: dark) { .button { color: #0e1715; } }
@media (min-width: 600px) { .cols { columns: 2; column-gap: 32px; } .cols li { break-inside: avoid; } }

address { font-style: normal; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; }

/* ---------------------------------------------------------------- footer */
.footer { border-top: 1px solid var(--border); padding: 20px 0; color: var(--muted); font-size: 14px; }

.top {
  position: fixed; right: 16px; bottom: 16px; width: 44px; height: 44px; border-radius: 50%;
  border: 1px solid var(--border); background: var(--surface); color: var(--teal-ink);
  font-size: 18px; cursor: pointer; box-shadow: 0 4px 14px rgb(20 59 54 / .12);
}
.top:hover { border-color: var(--teal); }

/* ----------------------------------------------------------------- print */
@media print {
  .masthead, .toc, .footer, .top, .skip { display: none !important; }
  body { background: #fff; color: #000; font-size: 11pt; }
  .layout { display: block; padding: 0; }
  .doc { max-width: none; }
  .summary, .data > div, .note, table, address { background: none; border-color: #bbb; }
  a { color: inherit; }
  section { break-inside: avoid-page; }
}
