:root {
  color-scheme: light;
  --bg: #f6f4ef;
  --surface: #fffefa;
  --surface-2: #f0f5f3;
  --ink: #161a20;
  --muted: #667085;
  --line: #d9ded8;
  --line-strong: #bcc7c1;
  --accent: #187a5a;
  --accent-2: #2458d3;
  --accent-3: #b7791f;
  --accent-soft: #e7f5ef;
  --code-bg: #121820;
  --code-ink: #edf5ff;
  --warn-bg: #fff4d8;
  --warn-line: #d6a63d;
  --good: #0f766e;
  --bad: #b42318;
  --shadow: 0 18px 45px rgba(22, 26, 32, .08);
  --radius: 8px;
  --wrap: min(1180px, calc(100% - 32px));
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #101316;
  --surface: #171b20;
  --surface-2: #1e2527;
  --ink: #eef2f0;
  --muted: #a5b1ad;
  --line: #30383a;
  --line-strong: #495356;
  --accent: #35c995;
  --accent-2: #89a7ff;
  --accent-3: #f0c46c;
  --accent-soft: #14382d;
  --code-bg: #070b10;
  --code-ink: #f2f7ff;
  --warn-bg: #332817;
  --warn-line: #9f7628;
  --good: #5eead4;
  --bad: #fda29b;
  --shadow: 0 20px 52px rgba(0, 0, 0, .32);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at 12% 0%, color-mix(in srgb, var(--accent) 16%, transparent), transparent 25rem),
    radial-gradient(circle at 88% 8%, color-mix(in srgb, var(--accent-2) 15%, transparent), transparent 22rem),
    var(--bg);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.55;
}

a {
  color: inherit;
}

.skip-link {
  position: absolute;
  left: 16px;
  top: -48px;
  z-index: 20;
  padding: 10px 12px;
  border-radius: var(--radius);
  background: var(--ink);
  color: var(--surface);
  text-decoration: none;
}

.skip-link:focus {
  top: 16px;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: blur(18px);
}

.nav-wrap,
.wrap {
  width: var(--wrap);
  margin: 0 auto;
}

.nav-wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 68px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  text-decoration: none;
  font-weight: 800;
  letter-spacing: 0;
}

.brand img {
  width: 34px;
  height: 34px;
  border-radius: 8px;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 8px;
}

.site-nav a,
.icon-button,
.button {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--surface) 72%, transparent);
  color: var(--ink);
  text-decoration: none;
  font: inherit;
  font-weight: 700;
}

.site-nav a,
.button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
}

.site-nav a[aria-current="page"],
.button.primary {
  border-color: color-mix(in srgb, var(--accent) 42%, var(--line));
  background: var(--accent-soft);
  color: var(--accent);
}

.icon-button {
  display: inline-grid;
  place-items: center;
  width: 38px;
  cursor: pointer;
}

.icon {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.hero {
  padding: 64px 0 28px;
}

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(280px, .75fr);
  gap: 28px;
  align-items: end;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 14px;
  color: var(--accent);
  font-size: .82rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .08em;
}

h1,
h2,
h3,
p {
  overflow-wrap: anywhere;
}

h1 {
  max-width: 900px;
  margin: 0;
  font-size: clamp(2.25rem, 6vw, 4.75rem);
  line-height: 1;
  letter-spacing: 0;
}

.subtitle {
  max-width: 800px;
  margin: 18px 0 0;
  color: var(--muted);
  font-size: 1.08rem;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 24px;
}

.hero-panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--surface) 82%, transparent);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.terminal-top {
  display: flex;
  align-items: center;
  gap: 6px;
  border-bottom: 1px solid var(--line);
  padding: 10px 12px;
}

.dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
}

.dot.red { background: #ef6a5b; }
.dot.yellow { background: #f0bd4f; }
.dot.green { background: #57c785; }

.terminal-lines {
  margin: 0;
  padding: 16px;
  background: var(--code-bg);
  color: var(--code-ink);
  font-size: .9rem;
  line-height: 1.6;
}

.page {
  padding: 28px 0 64px;
}

.sheet-layout {
  display: grid;
  grid-template-columns: 250px minmax(0, 1fr);
  gap: 24px;
  align-items: start;
}

.toc {
  position: sticky;
  top: 92px;
  max-height: calc(100vh - 116px);
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  box-shadow: var(--shadow);
}

.toc-title {
  margin: 0;
  padding: 14px 14px 8px;
  color: var(--muted);
  font-size: .76rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .08em;
}

.toc nav {
  display: grid;
  padding: 6px;
}

.toc a {
  border-radius: 6px;
  padding: 8px 10px;
  color: var(--muted);
  text-decoration: none;
  font-size: .94rem;
  font-weight: 650;
}

.toc a:hover,
.toc a.is-active {
  background: var(--accent-soft);
  color: var(--accent);
}

.sheet-header {
  padding: 54px 0 26px;
  border-bottom: 1px solid var(--line);
}

.sheet-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 18px;
}

.pill,
.badge {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  border-radius: 999px;
  border: 1px solid var(--line);
  padding: 3px 9px;
  background: color-mix(in srgb, var(--surface) 78%, transparent);
  color: var(--muted);
  font-size: .82rem;
  font-weight: 750;
}

.badge {
  border-color: color-mix(in srgb, var(--accent) 34%, var(--line));
  background: var(--accent-soft);
  color: var(--accent);
}

.sheet-section {
  scroll-margin-top: 92px;
  margin: 0 0 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--surface) 90%, transparent);
  box-shadow: var(--shadow);
  padding: 20px;
}

.sheet-section h2 {
  margin: 0 0 16px;
  font-size: 1.42rem;
  line-height: 1.2;
  letter-spacing: 0;
}

.sheet-section h3 {
  margin: 18px 0 8px;
  color: color-mix(in srgb, var(--ink) 92%, var(--accent));
  font-size: 1.03rem;
  letter-spacing: 0;
}

.sheet-section p {
  margin: 6px 0 14px;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(270px, 1fr));
  gap: 12px;
}

.card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 16px;
}

.card h3:first-child {
  margin-top: 0;
}

.callout {
  margin: 14px 0;
  border: 1px solid var(--warn-line);
  border-radius: var(--radius);
  background: var(--warn-bg);
  padding: 14px 16px;
}

code,
pre,
kbd {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
}

code {
  font-size: .92em;
}

p code,
li code,
td code,
.inline {
  border: 1px solid color-mix(in srgb, var(--line) 72%, transparent);
  border-radius: 6px;
  background: var(--surface-2);
  color: var(--ink);
  padding: .12rem .34rem;
}

pre {
  margin: 10px 0 16px;
  border: 1px solid color-mix(in srgb, var(--line-strong) 48%, transparent);
  border-radius: var(--radius);
  background: var(--code-bg);
  color: var(--code-ink);
  overflow-x: auto;
  padding: 14px 16px;
  font-size: .9rem;
  line-height: 1.5;
}

pre code {
  color: inherit;
  font-size: inherit;
}

table {
  width: 100%;
  margin: 12px 0 16px;
  border-collapse: separate;
  border-spacing: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

th,
td {
  border-bottom: 1px solid var(--line);
  border-right: 1px solid var(--line);
  padding: 10px 11px;
  text-align: left;
  vertical-align: top;
}

th:last-child,
td:last-child {
  border-right: 0;
}

tr:last-child td {
  border-bottom: 0;
}

th {
  background: var(--surface-2);
  color: var(--muted);
  font-size: .76rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .08em;
}

ul,
ol {
  padding-left: 1.25rem;
}

li {
  margin: .28rem 0;
}

.good {
  color: var(--good);
  font-weight: 800;
}

.bad {
  color: var(--bad);
  font-weight: 800;
}

.cols-2 {
  columns: 2 320px;
  column-gap: 28px;
}

.sheet-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 14px;
  margin-top: 22px;
}

.sheet-card {
  display: grid;
  gap: 12px;
  min-height: 210px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  text-decoration: none;
  padding: 18px;
  box-shadow: var(--shadow);
}

.sheet-card:hover {
  border-color: color-mix(in srgb, var(--accent) 44%, var(--line));
}

.sheet-card h2 {
  margin: 0;
  font-size: 1.25rem;
}

.sheet-card p {
  margin: 0;
  color: var(--muted);
}

.sheet-card-footer {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 12px;
  margin-top: auto;
}

.empty-card {
  min-height: 210px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--surface) 55%, transparent);
  padding: 18px;
}

.footer {
  border-top: 1px solid var(--line);
  padding: 24px 0 36px;
  color: var(--muted);
  font-size: .92rem;
}

@media (max-width: 860px) {
  .nav-wrap {
    min-height: 62px;
  }

  .site-nav a {
    display: none;
  }

  .hero {
    padding-top: 42px;
  }

  .hero-grid,
  .sheet-layout {
    grid-template-columns: 1fr;
  }

  .toc {
    position: static;
    max-height: none;
  }

  .toc nav {
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  }

  .sheet-header {
    padding-top: 38px;
  }

  .sheet-section {
    padding: 16px;
  }
}

@media (max-width: 640px) {
  :root {
    --wrap: min(100% - 24px, 1180px);
  }

  h1 {
    font-size: clamp(2rem, 13vw, 3.2rem);
  }

  table {
    display: block;
    overflow-x: auto;
    white-space: nowrap;
  }

  th,
  td {
    white-space: normal;
    min-width: 160px;
  }
}

@media print {
  :root {
    color-scheme: light;
  }

  body {
    background: #fff;
  }

  .site-header,
  .toc,
  .hero-actions,
  .footer {
    display: none;
  }

  .sheet-layout {
    display: block;
  }

  .sheet-section {
    box-shadow: none;
    break-inside: avoid;
  }

  pre {
    white-space: pre-wrap;
  }
}
