:root {
  color-scheme: light dark;
  --font-sans: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  --page: #f7f7f5;
  --surface: #ffffff;
  --surface-soft: #f1f2f4;
  --text: #18202b;
  --text-soft: #4d5968;
  --muted: #596677;
  --border: #dfe2e6;
  --border-strong: #c9ced6;
  --accent: #2457d6;
  --accent-hover: #173e9f;
  --accent-soft: #edf2ff;
  --code: #111827;
  --code-text: #e5e7eb;
  --code-muted: #9ca3af;
  --warning: #8a4b08;
  --warning-soft: #fff7e8;
  --measure: 45rem;
  --shell: 72rem;
  --shell-wide: 88rem;
  --gutter: clamp(1rem, 4vw, 2rem);
  --radius: 0.65rem;
  --header-height: 4.25rem;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --page: #0c1118;
    --surface: #111821;
    --surface-soft: #18212c;
    --text: #edf1f7;
    --text-soft: #bac4d1;
    --muted: #a9b4c3;
    --border: #283343;
    --border-strong: #3a4759;
    --accent: #89a9ff;
    --accent-hover: #b7c9ff;
    --accent-soft: #1c2b4e;
    --code: #080d13;
    --code-text: #e1e7ef;
    --code-muted: #93a0b2;
    --warning: #f0b45f;
    --warning-soft: #2a2115;
  }
}

:root[data-theme="dark"] {
  --page: #0c1118;
  --surface: #111821;
  --surface-soft: #18212c;
  --text: #edf1f7;
  --text-soft: #bac4d1;
  --muted: #a9b4c3;
  --border: #283343;
  --border-strong: #3a4759;
  --accent: #89a9ff;
  --accent-hover: #b7c9ff;
  --accent-soft: #1c2b4e;
  --code: #080d13;
  --code-text: #e1e7ef;
  --code-muted: #93a0b2;
  --warning: #f0b45f;
  --warning-soft: #2a2115;
}

:root[data-theme="light"] { color-scheme: light; }
:root[data-theme="dark"] { color-scheme: dark; }

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

html {
  font-family: var(--font-sans);
  -webkit-text-size-adjust: 100%;
}

body {
  min-width: 20rem;
  margin: 0;
  background: var(--page);
  color: var(--text);
  font-size: 1rem;
  line-height: 1.6;
}

h1,
h2,
h3,
h4 {
  margin: 0;
  color: var(--text);
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1.2;
}

h1 { font-size: clamp(2rem, 5vw, 3.25rem); }
h2 { font-size: clamp(1.4rem, 3vw, 1.8rem); }
h3 { font-size: 1.1rem; }
p { margin: 0 0 1rem; }

a {
  color: var(--accent);
  text-decoration-thickness: 0.08em;
  text-underline-offset: 0.18em;
}

a:hover { color: var(--accent-hover); }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 0.2rem;
}

img,
picture,
svg,
video { max-width: 100%; }

button { font: inherit; }
hr { border: 0; }

.skip-link {
  position: fixed;
  z-index: 100;
  top: 0.75rem;
  left: 0.75rem;
  padding: 0.55rem 0.8rem;
  background: var(--text);
  color: var(--surface);
  transform: translateY(-200%);
}

.skip-link:focus { transform: translateY(0); }

.site-header {
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.site-bar {
  display: grid;
  width: min(var(--shell-wide), 100%);
  min-height: var(--header-height);
  align-items: center;
  gap: 0.5rem 1.25rem;
  grid-template-columns: minmax(0, 1fr) auto;
  margin: 0 auto;
  padding: 0.7rem var(--gutter);
}

.brand {
  display: inline-flex;
  min-width: 0;
  align-items: center;
  gap: 0.65rem;
  color: var(--text);
  text-decoration: none;
}

.site-mark { flex: 0 0 auto; }
.site-mark-plate { fill: var(--text); }
.site-mark-lines {
  fill: none;
  stroke: var(--surface);
  stroke-linecap: round;
  stroke-width: 2.4;
}
.site-mark-dot { fill: var(--accent); }

.brand-text { display: grid; min-width: 0; }
.brand-name {
  overflow: hidden;
  font-weight: 720;
  letter-spacing: -0.02em;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.brand-tagline {
  color: var(--muted);
  font-size: 0.72rem;
  white-space: nowrap;
}

.primary-nav {
  display: flex;
  grid-column: 1 / -1;
  grid-row: 2;
  gap: 0.1rem;
  margin-inline: calc(var(--gutter) * -1);
  padding-inline: var(--gutter);
  overflow-x: auto;
  scrollbar-width: thin;
}

.nav-link {
  padding: 0.35rem 0.6rem;
  border-radius: 0.35rem;
  color: var(--text-soft);
  font-size: 0.88rem;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
}

.nav-link:hover { background: var(--surface-soft); color: var(--text); }
.nav-link.is-current { background: var(--accent-soft); color: var(--accent); }

.theme-toggle {
  display: inline-flex;
  grid-column: 2;
  grid-row: 1;
  width: 2.25rem;
  height: 2.25rem;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: var(--surface);
  color: var(--text-soft);
  cursor: pointer;
}

.theme-toggle:hover { border-color: var(--border-strong); color: var(--text); }
.theme-icon { fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.7; }
.theme-icon-moon { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-icon-sun { display: none; }
  :root:not([data-theme="light"]) .theme-icon-moon { display: block; }
}
:root[data-theme="dark"] .theme-icon-sun { display: none; }
:root[data-theme="dark"] .theme-icon-moon { display: block; }

@media (min-width: 58rem) {
  .site-bar { grid-template-columns: auto minmax(0, 1fr) auto; }
  .primary-nav {
    grid-column: 2;
    grid-row: 1;
    justify-content: flex-end;
    margin: 0;
    padding: 0;
    overflow: visible;
  }
}

.site-main {
  width: min(var(--shell), calc(100% - var(--gutter) * 2));
  margin: clamp(1rem, 3vw, 2rem) auto clamp(2rem, 5vw, 4rem);
}
.site-main-wide { width: min(var(--shell-wide), calc(100% - var(--gutter) * 2)); }
.site-main-narrow { width: min(58rem, calc(100% - var(--gutter) * 2)); }

.document {
  min-width: 0;
  overflow: clip;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

.document-header {
  padding: clamp(1.5rem, 5vw, 3.5rem) clamp(1.25rem, 5vw, 4rem) clamp(1.4rem, 4vw, 2.5rem);
  border-bottom: 1px solid var(--border);
}

.hero { padding-block: clamp(2.25rem, 7vw, 5.5rem); }
.hero h1 { max-width: 16ch; }
.guide h1 { font-size: clamp(1.9rem, 4vw, 2.7rem); }

.eyebrow,
.card-meta,
.post-date,
.footer-title,
.docs-nav-title,
.toc-title {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 650;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.eyebrow { margin-bottom: 0.75rem; }
.lede {
  max-width: 42rem;
  margin: 1rem 0 0;
  color: var(--text-soft);
  font-size: clamp(1.02rem, 2vw, 1.18rem);
  line-height: 1.65;
}

.hero-actions { display: flex; flex-wrap: wrap; gap: 0.6rem; margin-top: 1.5rem; }
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.58rem 0.9rem;
  border: 1px solid var(--accent);
  border-radius: 0.45rem;
  background: var(--accent);
  color: #fff;
  font-size: 0.92rem;
  font-weight: 650;
  text-decoration: none;
}
.button:hover { border-color: var(--accent-hover); background: var(--accent-hover); color: #fff; }
.button-quiet { border-color: var(--border-strong); background: transparent; color: var(--text); }
.button-quiet:hover { border-color: var(--text-soft); background: var(--surface-soft); color: var(--text); }

.prose { min-width: 0; padding: clamp(1.5rem, 5vw, 3.25rem) clamp(1.25rem, 5vw, 4rem); }
.docs-shell .document-header,
.docs-shell .prose,
.docs-shell .document-footer { padding-inline: clamp(1.25rem, 3vw, 2.5rem); }
.prose > :first-child { margin-top: 0; }
.prose > :last-child { margin-bottom: 0; }
.prose p,
.prose li { max-width: var(--measure); line-height: 1.72; }
.prose h2 { margin: 2.75rem 0 0.9rem; padding-top: 1.5rem; border-top: 1px solid var(--border); }
.prose > h2:first-child { margin-top: 0; padding-top: 0; border-top: 0; }
.prose h3 { margin: 2rem 0 0.65rem; }
.prose :is(h2, h3) { scroll-margin-top: 1.5rem; }

.heading-anchor {
  margin-left: 0.4rem;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.8em;
  font-weight: 500;
  opacity: 0;
  text-decoration: none;
}
:is(h2, h3):hover .heading-anchor,
.heading-anchor:focus-visible { opacity: 1; }

.prose > ul,
.prose > ol { margin: 0 0 1rem; padding-left: 1.35rem; }
.prose li { margin-bottom: 0.35rem; padding-left: 0.25rem; }
.prose li ul,
.prose li ol { margin-block: 0.4rem; }
.prose blockquote {
  margin: 1.5rem 0;
  padding: 0.9rem 1rem;
  border-left: 3px solid var(--warning);
  background: var(--warning-soft);
  color: var(--text-soft);
}
.prose blockquote p:last-child { margin-bottom: 0; }
.prose hr { height: 1px; margin: 2.5rem 0; background: var(--border); }

.prose table {
  display: block;
  width: 100%;
  margin: 1.5rem 0;
  overflow-x: auto;
  border-collapse: collapse;
  font-size: 0.92rem;
}
.prose th,
.prose td { padding: 0.65rem 0.75rem; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; }
.prose th { color: var(--text-soft); font-size: 0.82rem; white-space: nowrap; }

code {
  padding: 0.1em 0.3em;
  border-radius: 0.28rem;
  background: var(--surface-soft);
  color: var(--text-soft);
  font-family: var(--font-mono);
  font-size: 0.88em;
  overflow-wrap: break-word;
}
a code { color: inherit; }
.code-block { position: relative; max-width: 100%; min-width: 0; margin: 1.4rem 0; }
.prose pre {
  position: relative;
  margin: 1.4rem 0;
  padding: 2.2rem 1rem 1rem;
  overflow-x: auto;
  border-radius: var(--radius);
  background: var(--code);
  color: var(--code-text);
  font-size: 0.85rem;
  line-height: 1.65;
  tab-size: 2;
}
.code-block pre { margin: 0; }
.prose pre code { padding: 0; background: none; color: inherit; font-size: inherit; }
.prose pre::before {
  position: absolute;
  top: 0.55rem;
  left: 1rem;
  content: "code";
  color: var(--code-muted);
  font-family: var(--font-mono);
  font-size: 0.66rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.prose pre:has(> code.language-sh)::before { content: "shell"; }
.prose pre:has(> code.language-yaml)::before { content: "yaml"; }
.prose pre:has(> code.language-md)::before { content: "markdown"; }
.prose pre:has(> code.language-liquid)::before { content: "liquid"; }
.prose pre:has(> code.language-ts)::before { content: "typescript"; }
.prose pre:has(> code.language-js)::before { content: "javascript"; }
.prose pre:has(> code.language-json)::before { content: "json"; }
.prose pre:has(> code.language-html)::before { content: "html"; }
.prose pre:has(> code.language-css)::before { content: "css"; }
.prose pre:has(> code.language-text)::before { content: "text"; }

.copy-button {
  position: absolute;
  z-index: 1;
  top: 0.45rem;
  right: 0.45rem;
  padding: 0.25rem 0.5rem;
  border: 1px solid #394556;
  border-radius: 0.3rem;
  background: #1c2634;
  color: var(--code-muted);
  font-family: var(--font-mono);
  font-size: 0.68rem;
  cursor: pointer;
}
.copy-button:hover,
.copy-button.is-done { color: var(--code-text); border-color: #66758a; }

figure { margin: 1.75rem 0; }
figcaption { margin-top: 0.6rem; color: var(--muted); font-size: 0.86rem; line-height: 1.55; }
.responsive-swatch,
.mark-demo { padding: 0.75rem; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-soft); }
.responsive-swatch picture,
.responsive-swatch img { display: block; width: 100%; height: clamp(5rem, 13vw, 8rem); border-radius: 0.35rem; object-fit: cover; }
.mark-demo { display: flex; align-items: center; gap: 1rem; }
.mark-demo img { width: 3rem; height: 3rem; flex: 0 0 auto; }
.mark-demo figcaption { margin: 0; }

.callout,
.html-note,
.escape-example {
  margin: 1.5rem 0;
  padding: 1rem 1.1rem;
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  background: var(--surface-soft);
}
.callout p:last-child,
.html-note p:last-child,
.escape-example p:last-child { margin-bottom: 0; }
.html-note h2 { margin: 0 0 0.75rem; padding: 0; border: 0; font-size: 1.3rem; }
.escape-example { border-left-color: var(--warning); background: var(--warning-soft); }
.escape-example code { display: inline-block; max-width: 100%; overflow-wrap: anywhere; }
.footnotes { margin-top: 2.5rem; padding-top: 1rem; border-top: 1px solid var(--border); color: var(--muted); font-size: 0.9rem; }

.feature-grid,
.post-list { display: grid; gap: 0.85rem; margin: 1.25rem 0 0; }
.feature-grid { grid-template-columns: repeat(auto-fit, minmax(min(100%, 17rem), 1fr)); }
.feature-card,
.post-card {
  position: relative;
  padding: 1.15rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}
.feature-card { display: flex; min-height: 11rem; flex-direction: column; }
.feature-card h3,
.post-card h3 { margin: 0.35rem 0 0.4rem; }
.feature-card h3 a,
.post-card h3 a { color: var(--text); text-decoration: none; }
.feature-card h3 a::after,
.post-card h3 a::after { position: absolute; content: ""; inset: 0; }
.feature-card:hover,
.post-card:hover { border-color: var(--border-strong); }
.feature-card:hover h3 a,
.post-card:hover h3 a { color: var(--accent); }
.feature-card p:not(.eyebrow):not(.card-cue),
.post-card > p:not(.card-meta) { color: var(--text-soft); font-size: 0.93rem; line-height: 1.6; }
.card-cue { margin: auto 0 0; color: var(--accent); font-size: 0.86rem; font-weight: 650; }
.card-cue span { margin-left: 0.2rem; }
.card-meta { margin: 0; }
.excerpt-preview { position: relative; z-index: 1; margin-top: 0.9rem; padding-top: 0.8rem; border-top: 1px solid var(--border); }
.post-excerpt { color: var(--text-soft); font-size: 0.9rem; }
.post-excerpt p { margin: 0; }

.pager { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.75rem; margin-top: 2rem; padding-top: 1rem; border-top: 1px solid var(--border); }
.pager-link { padding: 0.4rem 0.7rem; border: 1px solid var(--border); border-radius: 0.4rem; color: var(--text); font-size: 0.88rem; font-weight: 600; text-decoration: none; }
.pager-link.is-disabled { color: var(--muted); }
.pager-status { margin: 0; color: var(--muted); font-size: 0.82rem; }
.related { margin-top: 1.5rem; padding: 1.25rem; border: 1px solid var(--border); border-radius: var(--radius); }
.related-title { font-size: 1.1rem; }
.related .post-list { grid-template-columns: repeat(auto-fit, minmax(min(100%, 20rem), 1fr)); }
.related-more { margin: 1rem 0 0; font-size: 0.9rem; font-weight: 600; }

.docs-shell { display: grid; align-items: start; gap: clamp(1rem, 2.5vw, 2rem); grid-template-columns: minmax(0, 1fr); }
.docs-nav { padding: 1rem; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.docs-nav-heading { margin: 0 0 0.5rem; font-weight: 700; }
.docs-nav-title { margin: 0.9rem 0 0.35rem; }
.docs-nav-list { display: flex; gap: 0.35rem; margin: 0; padding: 0 0 0.2rem; overflow-x: auto; list-style: none; }
.docs-nav-list li { flex: 0 0 auto; }
.docs-nav-list a { display: block; padding: 0.3rem 0.55rem; border: 1px solid var(--border); border-radius: 0.35rem; color: var(--text-soft); font-size: 0.84rem; font-weight: 600; text-decoration: none; white-space: nowrap; }
.docs-nav-list a:hover { border-color: var(--border-strong); color: var(--text); }
.docs-nav-list a[aria-current="page"] { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.docs-aside { display: none; }

@media (min-width: 64rem) {
  .docs-shell { grid-template-columns: 14.5rem minmax(0, 1fr); }
  .docs-nav { position: sticky; top: 1rem; padding: 0.5rem 0; border: 0; background: transparent; }
  .docs-nav-list { display: block; overflow: visible; }
  .docs-nav-list a { padding: 0.3rem 0.6rem; border: 0; border-left: 2px solid transparent; border-radius: 0; white-space: normal; }
  .docs-nav-list a:hover { border-left-color: var(--border-strong); background: var(--surface-soft); }
  .docs-nav-list a[aria-current="page"] { border-left-color: var(--accent); }
}

.toc { position: sticky; top: 1rem; padding-left: 1rem; border-left: 1px solid var(--border); }
.toc[hidden] { display: none; }
.toc-title { margin: 0 0 0.6rem; }
.toc ol { margin: 0; padding: 0; list-style: none; }
.toc-item a { display: block; padding: 0.2rem 0; color: var(--muted); font-size: 0.82rem; line-height: 1.45; text-decoration: none; }
.toc-item a:hover { color: var(--text); }
.toc-item a.is-current { color: var(--accent); font-weight: 650; }
.toc-nested a { padding-left: 0.75rem; font-size: 0.78rem; }
@media (min-width: 80rem) {
  .docs-shell { grid-template-columns: 14.5rem minmax(0, 1fr) 12rem; }
  .docs-aside { display: block; }
}

.document-footer { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.75rem 1.5rem; padding: 1rem clamp(1.25rem, 5vw, 4rem); border-top: 1px solid var(--border); background: var(--surface-soft); color: var(--muted); font-size: 0.84rem; }
.source-note { margin: 0; overflow-wrap: anywhere; }
.document-footer-links { display: flex; flex-wrap: wrap; gap: 0.5rem 1rem; }
.document-footer-links a { font-weight: 600; text-decoration: none; }

.site-footer { width: min(var(--shell-wide), calc(100% - var(--gutter) * 2)); margin: 0 auto 2.5rem; padding-top: 1.75rem; border-top: 1px solid var(--border); color: var(--muted); font-size: 0.86rem; }
.footer-grid { display: grid; gap: 1.5rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 14rem), 1fr)); }
.footer-brand { display: flex; align-items: flex-start; gap: 0.75rem; }
.footer-lede { margin: 0; line-height: 1.55; }
.footer-lede strong { color: var(--text); }
.footer-column { display: flex; flex-direction: column; align-items: flex-start; gap: 0.35rem; }
.footer-title { margin: 0 0 0.15rem; }
.footer-column a { color: var(--text-soft); font-weight: 600; text-decoration: none; }
.footer-note { margin: 1.5rem 0 0; padding-top: 1rem; border-top: 1px solid var(--border); }
.post-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 0.6rem; margin: 0 0 0.75rem; }
.post-meta .eyebrow { margin: 0; }

.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; border: 0; margin: -1px; clip-path: inset(50%); white-space: nowrap; }
[hidden] { display: none !important; }

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

@media print {
  .site-header,
  .docs-nav,
  .docs-aside,
  .site-footer,
  .copy-button,
  .skip-link { display: none !important; }
  .site-main { width: 100%; margin: 0; }
  .document { border: 0; }
  .document-header,
  .prose,
  .document-footer { padding-inline: 0; }
  .prose pre,
  .post-excerpt { border: 1px solid #999; background: #fff; color: #000; }
}
