:root {
  color-scheme: dark;
  --ink: #f5f2ea;
  --paper: #141b22;
  --paper-deep: #1c2630;
  --coral: #ff927a;
  --coral-bright: #ed654c;
  --blue: #86c4e5;
  --gold: #e5bd72;
  --line: rgba(245, 242, 234, 0.22);
  --orbit-line: rgba(245, 242, 234, 0.12);
  --muted: #bac4cb;
  --grid: rgba(245, 242, 234, 0.025);
  --card-surface: rgba(255, 255, 255, 0.035);
  --orbit-surface: rgba(255, 255, 255, 0.035);
  --stack-ink: #17202a;
  --stack-shadow: rgba(0, 0, 0, 0.25);
  --code-paper: #0e141a;
  --code-ink: #f5f2ea;
  --code-muted: #c4cbd0;
  --serif: Georgia, "Times New Roman", serif;
  --sans: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

:root[data-theme="light"] {
  color-scheme: light;
  --ink: #17202a;
  --paper: #f5f2ea;
  --paper-deep: #e9e3d7;
  --coral: #ae3925;
  --blue: #276e8d;
  --gold: #8b6118;
  --line: rgba(23, 32, 42, 0.2);
  --orbit-line: rgba(23, 32, 42, 0.04);
  --muted: #505a63;
  --grid: rgba(23, 32, 42, 0.025);
  --card-surface: rgba(255, 255, 255, 0.4);
  --orbit-surface: rgba(255, 255, 255, 0.35);
  --stack-shadow: rgba(23, 32, 42, 0.09);
  --code-paper: #17202a;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  color: var(--ink);
  background:
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px),
    var(--paper);
  background-size: 32px 32px;
  font-family: var(--sans);
  line-height: 1.6;
}
a { color: inherit; text-underline-offset: 0.2em; }
a:hover { color: var(--coral); }
a:focus-visible, input:focus-visible, select:focus-visible { outline: 3px solid var(--blue); outline-offset: 5px; }
p { margin: 0 0 1em; }
p:last-child { margin-bottom: 0; }
h1, h2, h3 { text-wrap: balance; }
section[id] { scroll-margin-top: 24px; }
.site-header, main, footer { width: min(1240px, calc(100% - 64px)); margin-inline: auto; }
.reading-width { max-width: 820px; }
.skip-link { position: absolute; left: 20px; top: -100px; z-index: 10; padding: 12px 20px; background: var(--paper); }
.skip-link:focus { top: 12px; }

.site-header { min-height: 88px; display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 28px; border-bottom: 1px solid var(--line); }
.site-header nav { justify-content: flex-end; }
.theme-control { justify-self: end; min-height: 40px; max-width: 100%; padding: 7px 8px; border: 1px solid var(--muted); border-radius: 4px; color: var(--ink); background: var(--paper-deep); font: 650 0.8rem var(--sans); cursor: pointer; }
.wordmark { display: inline-flex; align-items: center; gap: 12px; font-weight: 750; text-decoration: none; white-space: nowrap; letter-spacing: -0.02em; }
.wordmark-icon { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 50%; color: var(--paper); background: var(--ink); font-size: 0.7rem; letter-spacing: 0.04em; }
nav { display: flex; flex-wrap: wrap; gap: 12px 26px; }
nav a { color: var(--muted); font-size: 0.86rem; font-weight: 650; text-decoration: none; }

.hero { display: grid; grid-template-columns: 1.05fr 1fr; align-items: center; gap: 32px; padding: 76px 0 80px; }
.eyebrow { margin: 0 0 16px; color: var(--coral); font-size: 0.74rem; font-weight: 750; letter-spacing: 0.13em; text-transform: uppercase; }
h1 { margin: 0; font: 700 clamp(3.2rem, 5.8vw, 5.3rem) / 1 var(--serif); letter-spacing: -0.055em; }
h1 em { display: block; color: var(--coral); font-weight: 400; }
.lede { margin: 28px 0 0; max-width: 600px; color: var(--muted); font-size: 1.075rem; }
.actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 28px; }
.button { display: inline-flex; align-items: center; justify-content: center; gap: 12px; min-height: 48px; padding: 11px 22px; border: 1px solid var(--ink); font-size: 0.9rem; font-weight: 700; text-decoration: none; }
.button.primary { color: var(--paper); background: var(--ink); }
.button.secondary { background: var(--paper); }
.button:hover { color: var(--paper); background: var(--coral); border-color: var(--coral); }
.blog-link { margin: 26px 0 0; max-width: 520px; font-size: 0.87rem; color: var(--muted); }
.blog-link a { color: var(--ink); }

.hero-visual { position: relative; display: flex; flex-direction: column; align-items: center; margin: 0; min-width: 0; }
.orbit-scene { --ring-outer: 9.1%; --ring-middle: 14.5%; --ring-inner: 18.4%; position: relative; width: 100%; max-width: 560px; aspect-ratio: 1; order: 0; overflow: clip; }
.orbit-scene::before, .orbit-scene::after, .orbit::before { content: ""; position: absolute; border: 1px solid var(--orbit-line); border-radius: 50%; inset: var(--ring-outer); }
.orbit::before { inset: var(--ring-middle); }
.orbit-scene::after { inset: var(--ring-inner); }
.architecture { position: absolute; z-index: 1; top: 50%; left: 50%; transform: translate(-50%, -50%); width: 148px; border: 1px solid var(--ink); box-shadow: 0 12px 30px var(--stack-shadow); }
.layer { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 59px; padding: 8px 6px; background: var(--paper); }
.layer + .layer { border-top: 1px solid var(--ink); }
.layer strong { font: 700 1.35rem var(--serif); }
.layer span { margin-top: 2px; font-size: 0.64rem; }
.hermit-layer { color: var(--stack-ink); background: var(--coral-bright); }
.orbit { position: absolute; inset: 0; margin: 0; padding: 0; list-style: none; }
.entropy { position: absolute; inset: calc(var(--ring-inset) + 1px); pointer-events: none; animation: orbit-turn var(--ring-period) linear infinite; }
.ring-outer { --ring-inset: var(--ring-outer); --ring-period: 108s; }
.ring-middle { --ring-inset: var(--ring-middle); --ring-period: 72s; }
.ring-inner { --ring-inset: var(--ring-inner); --ring-period: 54s; }
.entropy-label { position: absolute; transform: translate(-50%, -50%); display: block; color: var(--coral); font-size: 0.73rem; font-weight: 650; line-height: 1.3; text-align: center; white-space: nowrap; pointer-events: auto; animation: label-turn var(--ring-period) linear infinite; }
.entropy-1 .entropy-label { left: 50%; top: 0; }
.entropy-2 .entropy-label { left: 93.3%; top: 25%; }
.entropy-3 .entropy-label { left: 50%; top: 100%; }
.entropy-4 .entropy-label { left: 6.7%; top: 75%; }
.entropy-5 .entropy-label { left: 6.7%; top: 25%; }
.entropy-6 .entropy-label { left: 93.3%; top: 75%; }
@keyframes orbit-turn { to { transform: rotate(360deg); } }
@keyframes label-turn { from { transform: translate(-50%, -50%) rotate(0deg); } to { transform: translate(-50%, -50%) rotate(-360deg); } }
.motion-toggle { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
.motion-control { order: 1; display: inline-flex; align-items: center; gap: 7px; padding: 5px 8px; margin-bottom: 12px; font-size: 0.76rem; cursor: pointer; }
.motion-control::before { content: ""; width: 13px; height: 13px; border: 1px solid var(--muted); border-radius: 2px; }
.motion-toggle:checked + .motion-control::before { background: var(--ink); box-shadow: inset 0 0 0 2px var(--paper); }
.motion-toggle:focus-visible + .motion-control { outline: 3px solid var(--blue); outline-offset: 3px; }
.motion-toggle:checked ~ .orbit-scene .entropy, .motion-toggle:checked ~ .orbit-scene .entropy-label { animation-play-state: paused; }
figcaption { order: 2; max-width: 410px; color: var(--muted); font-size: 0.82rem; text-align: center; }

.section { padding: 76px 0; border-top: 1px solid var(--line); }
.section-heading { max-width: 820px; margin-bottom: 32px; }
h2 { margin: 0 0 22px; font: 700 clamp(2.2rem, 4vw, 3.6rem) / 1.08 var(--serif); letter-spacing: -0.035em; }
.section-heading > p:last-child { color: var(--muted); font-size: 1.06rem; }
h3 { margin: 0 0 16px; font: 700 1.65rem / 1.18 var(--serif); letter-spacing: -0.02em; }
.use-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 32px; }
.use-grid article { padding-top: 20px; border-top: 2px solid var(--coral); }
.use-grid h3 { font-size: 1.5rem; }
.use-grid p, .reading-width p { color: var(--muted); }
.context-note { max-width: 940px; margin: 32px 0 0; padding-left: 18px; border-left: 3px solid var(--blue); color: var(--muted); font-size: 0.91rem; }
.command-example { margin: 0 0 26px; padding: 26px 30px; color: var(--code-ink); background: var(--code-paper); }
.command-label { color: var(--code-muted); font-size: 0.76rem; }
pre { margin: 10px 0 0; overflow-x: auto; padding-bottom: 8px; font-size: 1rem; }
code { font-family: ui-monospace, "Cascadia Code", "Source Code Pro", monospace; font-size: 0.92em; }
.replay-panel { margin-top: 40px; display: grid; grid-template-columns: 0.7fr 1.7fr; gap: 32px; padding: 30px; border: 1px solid var(--line); background: var(--paper-deep); }
.replay-panel .eyebrow { margin-bottom: 8px; }
.replay-panel p { font-size: 0.95rem; }
.replay-panel h3 { font-size: 1.85rem; }
.text-links { display: flex; flex-wrap: wrap; gap: 12px 24px; font-size: 0.86rem; font-weight: 700; }

.card-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.tool-card, .example-card { display: flex; flex-direction: column; padding: 30px; border: 1px solid var(--line); background: var(--card-surface); }
.tool-card, .example-card { border-top: 3px solid var(--accent); }
.accent-coral { --accent: var(--coral); }
.accent-blue { --accent: var(--blue); }
.accent-gold { --accent: var(--gold); }
.tool-card .eyebrow { color: var(--accent); font-size: 0.66rem; }
.tool-card h3 { font-size: 2.15rem; margin: 12px 0 20px; }
.tool-card > p:not(.eyebrow), .example-card p { color: var(--muted); font-size: 0.95rem; }
.card-links { display: flex; flex-wrap: wrap; gap: 12px 22px; margin-top: auto; padding-top: 28px; font-size: 0.85rem; font-weight: 700; }
.compatibility { padding-inline: 40px; background: var(--paper-deep); }
.compatibility .button { margin-top: 28px; }
.compat-highlights { margin: 26px 0; padding-left: 22px; max-width: 850px; }
.compat-highlights li { margin-bottom: 12px; }
#examples .section-heading { max-width: none; }
.example-card { background: color-mix(in srgb, var(--accent) 8%, var(--paper)); }
.example-card h3 { font-size: 1.7rem; }
footer { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 24px; padding: 34px 0 44px; border-top: 1px solid var(--line); }
.footer-brand { font-weight: 750; text-decoration: none; }
footer nav a { font-size: 0.8rem; }

@media (max-width: 1100px) {
  .site-header { grid-template-columns: 1fr auto; gap: 14px 12px; padding-block: 20px; }
  .site-header nav { grid-column: 1 / -1; grid-row: 2; justify-content: flex-start; }
  .hero { grid-template-columns: 1fr; gap: 30px; padding-top: 56px; }
  .hero-copy { max-width: 780px; }
  h1 { max-width: 740px; font-size: clamp(3.6rem, 8vw, 5.3rem); }
  .lede { max-width: 700px; }
  .hero-visual { width: min(100%, 560px); margin-inline: auto; }
  .tool-card, .example-card { padding: 24px; }
}
@media (max-width: 800px) {
  .site-header, main, footer { width: calc(100% - 40px); }
  .card-grid, .use-grid { grid-template-columns: 1fr; }
  .use-grid { gap: 24px; }
  .section { padding-block: 56px; }
  .compatibility { padding-inline: 24px; }
  .replay-panel { grid-template-columns: 1fr; gap: 12px; padding: 24px; }
  .replay-panel h3 { margin-bottom: 8px; }
}
@media (max-width: 600px) {
  .site-header, main, footer { width: calc(100% - 32px); }
  nav { gap: 10px 20px; }
  nav a { font-size: 0.8rem; }
  .hero { padding: 44px 0 48px; }
  h1 { font-size: clamp(2.6rem, 10.8vw, 4rem); }
  .lede { font-size: 1rem; }
  .hero-visual { margin-top: 12px; }
  .orbit-scene { display: flex; flex-direction: column; align-items: center; aspect-ratio: auto; padding: 24px 12px; border: 1px solid var(--line); background: var(--orbit-surface); }
  .orbit-scene::before, .orbit-scene::after, .orbit::before { display: none; }
  .architecture { position: static; transform: none; margin-bottom: 26px; width: 170px; }
  .orbit { position: static; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); width: 100%; gap: 8px; }
  .entropy { position: static; animation: none; }
  .entropy-label { position: static; transform: none; display: flex; align-items: center; justify-content: center; min-height: 45px; height: 100%; animation: none; white-space: normal; }
  .entropy-label br { display: none; }
  .motion-control, .motion-toggle { display: none; }
  figcaption { margin-top: 18px; }
  .command-example { padding: 20px; }
  pre { font-size: 0.89rem; }
  .compatibility { padding-inline: 20px; }
  footer { align-items: flex-start; flex-direction: column; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .entropy, .entropy-label { animation: none; }
  .motion-control, .motion-toggle { display: none; }
}
