:root {
  color-scheme: light;
  --bg: #eae3d7;
  --card: #fffdf8;
  --ink: #24374b;
  --muted: #665b4d;
  --accent: #ac4638;
  --line: #d8cdbc;
}
html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #171e26;
  --card: #232d38;
  --ink: #f7efe3;
  --muted: #c0b8ac;
  --accent: #f39a84;
  --line: #4b5663;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font:
    16px/1.65 system-ui,
    sans-serif;
}
header {
  padding: 20px 5%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
}
a {
  color: var(--accent);
}
.brand {
  font-size: 20px;
  font-weight: 750;
  text-decoration: none;
  color: var(--ink);
}
main {
  max-width: 1180px;
  margin: auto;
  padding: 48px 24px;
}
h1 {
  font-size: clamp(40px, 8vw, 84px);
  line-height: 1.08;
  letter-spacing: -3px;
  margin: 16px 0 24px;
}
h2 {
  font-size: clamp(26px, 4vw, 40px);
  line-height: 1.2;
}
h3 {
  margin: 8px 0;
  font-size: 21px;
}
.eyebrow {
  letter-spacing: 3px;
  font-size: 12px;
  font-weight: 750;
  color: var(--accent);
}
.intro {
  max-width: 740px;
  font-size: 20px;
  color: var(--muted);
}
nav {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin: 32px 0;
}
button {
  font: inherit;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 10px 18px;
  color: var(--ink);
  background: var(--card);
  cursor: pointer;
}
button[aria-pressed="true"],
#advance {
  background: var(--accent);
  color: var(--bg);
  border-color: var(--accent);
}
button:focus-visible,
a:focus-visible,
input:focus-visible,
summary:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 4px;
}
.chapter {
  padding: 24px 0;
  animation: arrive 0.3s ease;
}
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 270px), 1fr));
  gap: 20px;
  margin: 24px 0;
}
article,
.turn,
details {
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--card);
  padding: 24px;
}
p {
  color: var(--muted);
}
.number {
  font-size: 32px;
  color: var(--accent);
  font-weight: 700;
}
.diagram {
  width: 100%;
  max-height: 400px;
  background: #f4ead8;
  border-radius: 20px;
  padding: 12px;
}
.badge {
  display: inline-block;
  color: var(--accent);
  font-family: monospace;
  font-weight: 700;
}
.buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}
.rail {
  display: flex;
  gap: 8px;
  margin: 24px 0;
}
.rail i {
  width: 20%;
  height: 8px;
  border-radius: 8px;
  background: var(--line);
  transition: background 0.2s;
}
.rail i.active {
  background: var(--accent);
}
input[type="range"] {
  width: 100%;
  accent-color: var(--accent);
  margin-top: 20px;
}
details {
  margin-top: 24px;
}
summary {
  cursor: pointer;
  font-weight: 700;
}
pre {
  font-size: 14px;
  overflow-x: auto;
  white-space: pre;
  padding-top: 16px;
}
code {
  font-size: 0.9em;
  overflow-wrap: anywhere;
}
li {
  padding: 8px 0;
}
footer {
  margin-top: 48px;
  border-top: 1px solid var(--line);
  padding-top: 24px;
  color: var(--muted);
}
@keyframes arrive {
  from {
    opacity: 0.5;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}
[hidden] {
  display: none !important;
}
.diagram-scroll {
  max-width: 100%;
  overflow-x: auto;
  border-radius: 20px;
}
.diagram {
  min-width: 1040px;
}
