:root {
  --ink: #14202b;
  --ink-soft: #4a5a6b;
  --ink-faint: #7a8694;
  --paper: #fbfaf6;
  --paper-warm: #f7f3e7;
  --rule: #d9d4c7;
  --accent: #1d6f5c;
  --accent-soft: #2a8a72;
  --code-bg: #f3efe2;
  --code-ink: #1a2530;
  --btn-bg: #1d6f5c;
  --btn-ink: #fbfaf6;
  --btn-bg-hover: #185c4c;
  --btn-bg-ok: #2a8a72;
  --callout-bg: #f3efe2;
  --callout-border: #cabf9b;
}

@media (prefers-color-scheme: dark) {
  :root {
    --ink: #ece7d8;
    --ink-soft: #9aa4b1;
    --ink-faint: #6b7480;
    --paper: #14171c;
    --paper-warm: #1b1f26;
    --rule: #2e3540;
    --accent: #5fc8ad;
    --accent-soft: #45c6a6;
    --code-bg: #1b1f26;
    --code-ink: #d8d2c0;
    --btn-bg: #2f9e83;
    --btn-ink: #0e1116;
    --btn-bg-hover: #38b094;
    --btn-bg-ok: #45c6a6;
    --callout-bg: #1b1f26;
    --callout-border: #3a4252;
  }
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--paper);
  color: var(--ink);
}

body {
  font: 18px/1.65 ui-serif, Georgia, "Iowan Old Style", "Apple Garamond", "Palatino Linotype", serif;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
}
a:hover { text-decoration-thickness: 2px; }

/* Site chrome */
.site-header {
  border-bottom: 1px solid var(--rule);
  background: var(--paper);
}
.site-header-inner {
  max-width: 46rem;
  margin: 0 auto;
  padding: 1.1rem 1.5rem;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1.5rem;
  flex-wrap: wrap;
}
.brand {
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: -0.005em;
  color: var(--ink);
  text-decoration: none;
}
.brand:hover { text-decoration: none; }
.nav {
  display: flex;
  gap: 1.25rem;
  font-size: 0.95rem;
}
.nav a {
  color: var(--ink-soft);
  text-decoration: none;
}
.nav a:hover {
  color: var(--accent);
  text-decoration: underline;
}
.nav a.current {
  color: var(--accent);
  font-weight: 600;
}

main {
  max-width: 44rem;
  margin: 0 auto;
  padding: 3rem 1.5rem 3rem;
  flex: 1;
  width: 100%;
}

footer {
  border-top: 1px solid var(--rule);
  margin-top: 3rem;
  font-size: 0.85rem;
  color: var(--ink-soft);
  background: var(--paper);
}
.site-footer-inner {
  max-width: 46rem;
  margin: 0 auto;
  padding: 1.5rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.25rem;
  justify-content: space-between;
}

/* Typography */
h1 {
  font-size: clamp(2rem, 5vw, 2.75rem);
  line-height: 1.15;
  letter-spacing: -0.012em;
  margin: 0 0 0.6rem;
}
h2 {
  font-size: 1.45rem;
  letter-spacing: -0.005em;
  margin: 2.75rem 0 0.75rem;
  line-height: 1.25;
}
h3 {
  font-size: 1.15rem;
  margin: 2rem 0 0.5rem;
  color: var(--ink-soft);
  font-weight: 600;
}
p { margin: 0 0 1.25rem; }
ol, ul { padding-left: 1.4rem; margin: 0 0 1.25rem; }
li { margin-bottom: 0.4rem; }
hr {
  border: 0;
  border-top: 1px solid var(--rule);
  margin: 2.5rem 0;
}

blockquote {
  margin: 1.25rem 0;
  padding: 0.5rem 1rem;
  border-left: 3px solid var(--accent);
  color: var(--ink-soft);
  font-style: italic;
}
blockquote p:last-child { margin-bottom: 0; }

code {
  font: 0.92em ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
  background: var(--code-bg);
  padding: 0.1em 0.35em;
  border-radius: 3px;
}

table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5rem 0 2rem;
  font-size: 0.95rem;
}
th, td {
  text-align: left;
  padding: 0.55rem 0.75rem;
  border-bottom: 1px solid var(--rule);
  vertical-align: top;
}
th {
  font-weight: 700;
  color: var(--ink);
  background: var(--paper-warm);
}

/* Tagline / page lead */
.tagline {
  font-size: 1.2rem;
  color: var(--ink-soft);
  margin: 0 0 2rem;
  font-style: italic;
  line-height: 1.45;
}

/* Spec / code block with copy button */
.spec-wrap {
  position: relative;
  margin: 1rem 0 2rem;
  border: 1px solid var(--rule);
  border-radius: 6px;
  background: var(--code-bg);
  overflow: hidden;
}
.spec-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.5rem 0.75rem 0.5rem 1rem;
  border-bottom: 1px solid var(--rule);
  background: var(--code-bg);
  font: 0.85rem ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
  color: var(--ink-soft);
}
.copy-btn {
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  background: var(--btn-bg);
  color: var(--btn-ink);
  border: none;
  border-radius: 4px;
  padding: 0.4rem 0.9rem;
  cursor: pointer;
  transition: background 120ms ease;
}
.copy-btn:hover { background: var(--btn-bg-hover); }
.copy-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.copy-btn.ok { background: var(--btn-bg-ok); }
.copy-btn[disabled] { opacity: 0.6; cursor: progress; }
.copy-btn.large {
  font-size: 1rem;
  padding: 0.65rem 1.4rem;
}

pre.spec {
  margin: 0;
  padding: 1rem 1.25rem;
  max-height: 28rem;
  overflow: auto;
  font: 0.85rem/1.5 ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
  color: var(--code-ink);
  background: var(--code-bg);
  white-space: pre;
  tab-size: 2;
}
pre.spec.loading { color: var(--ink-soft); font-style: italic; }
pre.spec.tall { max-height: 36rem; }

/* Callout cards */
.callout {
  margin: 2rem 0;
  padding: 1.1rem 1.25rem;
  background: var(--callout-bg);
  border: 1px solid var(--callout-border);
  border-radius: 6px;
}
.callout p:last-child { margin-bottom: 0; }
.callout .callout-title {
  font-weight: 700;
  margin: 0 0 0.4rem;
  color: var(--ink);
}

/* Video embed */
.video-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  margin: 0 0 2rem;
  border-radius: 6px;
  overflow: hidden;
  background: #000;
  border: 1px solid var(--rule);
}
.video-wrap iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

/* Guide index */
.guide-list {
  list-style: none;
  padding: 0;
  margin: 1.5rem 0 2rem;
}
.guide-list li {
  padding: 1.1rem 0;
  border-bottom: 1px solid var(--rule);
  margin: 0;
}
.guide-list li:last-child { border-bottom: 0; }
.guide-list a {
  color: var(--ink);
  text-decoration: none;
  font-size: 1.15rem;
  font-weight: 600;
  letter-spacing: -0.005em;
}
.guide-list a:hover { color: var(--accent); }
.guide-list .situation {
  color: var(--ink-soft);
  font-size: 0.98rem;
  font-style: italic;
  margin-top: 0.2rem;
  display: block;
}
.guide-list .stub {
  color: var(--ink-faint);
  font-size: 0.8rem;
  font-style: normal;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-left: 0.5rem;
}
.guide-list li.stub-item a {
  color: var(--ink-faint);
  font-weight: 500;
  cursor: default;
  pointer-events: none;
}

/* Prose: tighten lists inside numbered guide steps */
.prose ol li > p { margin-bottom: 0.4rem; }
.prose strong { color: var(--ink); }
.prose em { color: var(--ink); }

/* CTA blocks */
.cta {
  margin: 3rem 0 1rem;
  text-align: center;
}
.cta-button {
  display: inline-block;
  background: var(--btn-bg);
  color: var(--btn-ink);
  padding: 0.85rem 1.6rem;
  border-radius: 6px;
  text-decoration: none;
  font-weight: 600;
  font-size: 1.05rem;
}
.cta-button:hover {
  background: var(--btn-bg-hover);
  text-decoration: none;
}

.disclaimer {
  margin-top: 2.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--rule);
  font-size: 0.9rem;
  color: var(--ink-soft);
}
.disclaimer p { margin-bottom: 0.6rem; }
