:root {
  /* Monokai Dark Soda */
  --bg: #242424;
  --bg-raised: #2c2c2c;
  --bg-panel: #303030;
  --line-hi: #3d3d3d;
  --selection: #403d3d;
  --fg: #f8f8f2;
  --fg-soft: #8c8c8c;
  --fg-muted: #a8a89c;
  --comment: #8c8c8c;
  --pink: #f92672;
  --orange: #fd971f;
  --yellow: #ffee99;
  --green: #a6e22e;
  --cyan: #66d9ef;
  --purple: #cd5ac5;

  --ink: var(--fg);
  --ink-soft: var(--fg-muted);
  --paper: var(--bg);
  --paper-deep: #1c1c1c;
  --glass: rgba(48, 48, 48, 0.72);
  --glass-strong: rgba(48, 48, 48, 0.92);
  --line: rgba(248, 248, 242, 0.1);
  --accent: var(--cyan);
  --accent-deep: #4ec4db;
  --warm: var(--orange);
  --hot: var(--pink);
  --code-bg: #1a1a1a;
  --code-fg: var(--fg);
  --shadow: 0 16px 40px rgba(0, 0, 0, 0.35);
  --radius: 4px;
  --radius-sm: 2px;
  --font-display: "Bricolage Grotesque", "Segoe UI", sans-serif;
  --font-body: "Figtree", "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", "Fira Code", ui-monospace, monospace;
  --max: 72rem;
  color-scheme: dark;

  /* Surface tokens (dark defaults — keep pixel-identical) */
  --bg-top: #2a2a2a;
  --glow-cyan: rgba(102, 217, 239, 0.1);
  --glow-orange: rgba(253, 151, 31, 0.08);
  --glow-pink: rgba(249, 38, 114, 0.07);
  --grid-line: rgba(248, 248, 242, 0.035);
  --grid-mask: rgba(0, 0, 0, 0.55);
  --hero-wash-a: rgba(61, 61, 61, 0.55);
  --hero-wash-b: rgba(36, 36, 36, 0.35);
  --hero-tint-cyan: rgba(102, 217, 239, 0.07);
  --hero-tint-orange: rgba(253, 151, 31, 0.05);
  --hero-orb: rgba(166, 226, 46, 0.16);
  --note-bg: rgba(253, 151, 31, 0.1);
  --code-inline-bg: rgba(102, 217, 239, 0.12);
  --kbd-border: rgba(102, 217, 239, 0.28);
  --kbd-bg: rgba(61, 61, 61, 0.9);
  --kbd-shadow: 0 1px 0 rgba(0, 0, 0, 0.35);
  --pre-inset: inset 0 0 0 1px rgba(255, 255, 255, 0.02);
  --th-bg: rgba(61, 61, 61, 0.65);
  --tr-hover: rgba(64, 61, 61, 0.35);
  --choice-hover-border: rgba(102, 217, 239, 0.45);
  --step-bg: rgba(61, 61, 61, 0.35);
  --timeline-line: rgba(166, 226, 46, 0.4);
  --timeline-glow: 0 0 0 4px rgba(166, 226, 46, 0.15);
  --btn-primary-fg: #fff;
  --btn-primary-hover: #e01e64;
  --toggle-icon-sun: none;
  --toggle-icon-moon: block;
}

/* Complementary light mode — same accent family, inverted paper */
html[data-theme="light"] {
  color-scheme: light;
  --bg: #f3f3ec;
  --bg-raised: #fafaf5;
  --bg-panel: #ffffff;
  --line-hi: #d8d8ce;
  --selection: #e8e4d4;
  --fg: #272822;
  --fg-soft: #6e6e64;
  --fg-muted: #5a5a52;
  --comment: #75715e;
  --pink: #d91a60;
  --orange: #c97812;
  --yellow: #8a7010;
  --green: #6a9a14;
  --cyan: #0e8fb0;
  --purple: #a83da0;

  --ink: var(--fg);
  --ink-soft: var(--fg-muted);
  --paper: var(--bg);
  --paper-deep: #e8e8e0;
  --glass: rgba(255, 255, 255, 0.72);
  --glass-strong: rgba(255, 255, 255, 0.92);
  --line: rgba(39, 40, 34, 0.12);
  --accent: var(--cyan);
  --accent-deep: #0a7a96;
  --warm: var(--orange);
  --hot: var(--pink);
  --code-bg: #2a2a26;
  --code-fg: #f8f8f2;
  --shadow: 0 16px 40px rgba(39, 40, 34, 0.1);

  --bg-top: #fafaf5;
  --glow-cyan: rgba(14, 143, 176, 0.1);
  --glow-orange: rgba(201, 120, 18, 0.09);
  --glow-pink: rgba(217, 26, 96, 0.07);
  --grid-line: rgba(39, 40, 34, 0.045);
  --grid-mask: rgba(0, 0, 0, 0.35);
  --hero-wash-a: rgba(255, 255, 255, 0.7);
  --hero-wash-b: rgba(243, 243, 236, 0.55);
  --hero-tint-cyan: rgba(14, 143, 176, 0.08);
  --hero-tint-orange: rgba(201, 120, 18, 0.06);
  --hero-orb: rgba(106, 154, 20, 0.14);
  --note-bg: rgba(201, 120, 18, 0.1);
  --code-inline-bg: rgba(14, 143, 176, 0.1);
  --kbd-border: rgba(14, 143, 176, 0.3);
  --kbd-bg: rgba(255, 255, 255, 0.95);
  --kbd-shadow: 0 1px 0 rgba(39, 40, 34, 0.12);
  --pre-inset: inset 0 0 0 1px rgba(255, 255, 255, 0.04);
  --th-bg: rgba(232, 232, 224, 0.9);
  --tr-hover: rgba(232, 228, 212, 0.55);
  --choice-hover-border: rgba(14, 143, 176, 0.4);
  --step-bg: rgba(255, 255, 255, 0.65);
  --timeline-line: rgba(106, 154, 20, 0.45);
  --timeline-glow: 0 0 0 4px rgba(106, 154, 20, 0.12);
  --btn-primary-fg: #fff;
  --btn-primary-hover: #c01655;
  --toggle-icon-sun: block;
  --toggle-icon-moon: none;
}

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

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 1.05rem;
  line-height: 1.65;
  background:
    radial-gradient(1100px 560px at 6% -12%, var(--glow-cyan), transparent 55%),
    radial-gradient(900px 480px at 100% 0%, var(--glow-orange), transparent 50%),
    radial-gradient(700px 420px at 75% 110%, var(--glow-pink), transparent 45%),
    linear-gradient(180deg, var(--bg-top) 0%, var(--bg) 38%, var(--paper-deep) 100%);
  background-attachment: fixed;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.28;
  background-image:
    linear-gradient(var(--grid-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: linear-gradient(180deg, var(--grid-mask), transparent 85%);
  z-index: 0;
}

a {
  color: var(--cyan);
  text-decoration-thickness: 1.5px;
  text-underline-offset: 0.18em;
  transition: color 160ms ease, text-decoration-color 160ms ease;
}

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

.site {
  position: relative;
  z-index: 1;
  width: min(100% - 2rem, var(--max));
  margin: 0 auto;
  padding: 1.25rem 0 4rem;
}

.topnav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem 1.1rem;
  margin-bottom: 1.5rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--glass-strong);
  backdrop-filter: blur(14px);
  box-shadow: var(--shadow);
  animation: rise 700ms ease both;
}

.brand {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: -0.02em;
  color: var(--ink);
  text-decoration: none;
}

.brand span {
  color: var(--green);
}

.nav-end {
  display: flex;
  align-items: center;
  gap: 0.75rem 1.1rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.nav-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 1rem;
  font-size: 0.95rem;
}

.nav-links a {
  text-decoration: none;
  color: var(--ink-soft);
  position: relative;
}

.nav-links a::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -0.2em;
  width: 100%;
  height: 2px;
  background: var(--pink);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 220ms ease;
}

.nav-links a:hover,
.nav-links a[aria-current="page"] {
  color: var(--ink);
}

.nav-links a:hover::after,
.nav-links a[aria-current="page"]::after {
  transform: scaleX(1);
}

.theme-toggle {
  display: inline-grid;
  place-items: center;
  width: 2.25rem;
  height: 2.25rem;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: transparent;
  color: var(--ink-soft);
  cursor: pointer;
  flex-shrink: 0;
  transition: color 160ms ease, border-color 160ms ease, background 160ms ease;
}

.theme-toggle:hover {
  color: var(--ink);
  border-color: var(--cyan);
  background: var(--code-inline-bg);
}

.theme-toggle:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 2px;
}

.theme-toggle svg {
  width: 1.1rem;
  height: 1.1rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.theme-toggle .icon-sun {
  display: var(--toggle-icon-sun);
}

.theme-toggle .icon-moon {
  display: var(--toggle-icon-moon);
}

.hero {
  position: relative;
  overflow: hidden;
  padding: clamp(2.5rem, 6vw, 4.5rem) clamp(1.4rem, 4vw, 3rem);
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background:
    linear-gradient(135deg, var(--hero-wash-a), var(--hero-wash-b)),
    linear-gradient(120deg, var(--hero-tint-cyan), var(--hero-tint-orange));
  box-shadow: var(--shadow);
  animation: rise 800ms 80ms ease both;
}

.hero::after {
  content: "";
  position: absolute;
  right: -8%;
  top: -20%;
  width: min(48vw, 420px);
  height: min(48vw, 420px);
  border-radius: 50%;
  background: radial-gradient(circle, var(--hero-orb), transparent 68%);
  animation: drift 12s ease-in-out infinite alternate;
  pointer-events: none;
}

.hero-brand {
  margin: 0 0 0.75rem;
  font-family: var(--font-display);
  font-size: clamp(2.8rem, 8vw, 5.2rem);
  font-weight: 800;
  letter-spacing: -0.05em;
  line-height: 0.95;
  color: var(--ink);
}

.hero-brand em {
  font-style: normal;
  color: var(--green);
}

.hero p {
  margin: 0;
  max-width: 36rem;
  color: var(--ink-soft);
  font-size: 1.12rem;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1.6rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.75rem 1.15rem;
  border-radius: var(--radius);
  border: 1px solid transparent;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.98rem;
  text-decoration: none;
  transition: transform 160ms ease, background 160ms ease, border-color 160ms ease, color 160ms ease;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn-primary {
  background: var(--pink);
  color: var(--btn-primary-fg);
}

.btn-primary:hover {
  background: var(--btn-primary-hover);
  color: var(--btn-primary-fg);
}

.btn-ghost {
  background: transparent;
  border-color: var(--line-hi);
  color: var(--ink);
}

.btn-ghost:hover {
  border-color: var(--cyan);
  color: var(--cyan);
}

.layout {
  display: grid;
  grid-template-columns: 15rem minmax(0, 1fr);
  gap: 1.5rem;
  margin-top: 1.5rem;
}

@media (max-width: 860px) {
  .layout {
    grid-template-columns: 1fr;
  }

  .toc {
    position: static !important;
  }
}

.toc {
  position: sticky;
  top: 1rem;
  align-self: start;
  padding: 1rem;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--glass-strong);
  backdrop-filter: blur(12px);
  animation: rise 700ms 120ms ease both;
}

.toc h2 {
  margin: 0 0 0.7rem;
  font-family: var(--font-display);
  font-size: 0.85rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--comment);
}

.toc ol {
  margin: 0;
  padding-left: 1.1rem;
  display: grid;
  gap: 0.35rem;
  font-size: 0.92rem;
}

.toc a {
  text-decoration: none;
  color: var(--ink-soft);
}

.toc a:hover {
  color: var(--cyan);
}

.content {
  padding: clamp(1.2rem, 3vw, 2rem);
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--glass-strong);
  backdrop-filter: blur(10px);
  box-shadow: var(--shadow);
  animation: rise 800ms 160ms ease both;
}

.page-kicker {
  margin: 0 0 0.35rem;
  color: var(--orange);
  font-weight: 700;
  font-size: 0.85rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.content > h1 {
  margin: 0 0 0.75rem;
  font-family: var(--font-display);
  font-size: clamp(2rem, 4.5vw, 2.8rem);
  letter-spacing: -0.035em;
  line-height: 1.1;
}

.lede {
  margin: 0 0 1.5rem;
  color: var(--ink-soft);
  font-size: 1.08rem;
}

.note {
  margin: 0 0 1.75rem;
  padding: 0.9rem 1rem;
  border-left: 3px solid var(--orange);
  border-radius: 0 var(--radius) var(--radius) 0;
  background: var(--note-bg);
  color: var(--ink-soft);
}

h2 {
  margin: 2.2rem 0 0.8rem;
  padding-top: 0.4rem;
  font-family: var(--font-display);
  font-size: 1.55rem;
  letter-spacing: -0.03em;
  scroll-margin-top: 1.2rem;
  color: var(--fg);
}

h3 {
  margin: 1.5rem 0 0.55rem;
  font-family: var(--font-display);
  font-size: 1.15rem;
  letter-spacing: -0.02em;
  scroll-margin-top: 1.2rem;
  color: var(--yellow);
}

p {
  margin: 0 0 1rem;
}

ul,
ol {
  margin: 0 0 1rem;
  padding-left: 1.2rem;
}

li + li {
  margin-top: 0.3rem;
}

code,
kbd {
  font-family: var(--font-mono);
  font-size: 0.88em;
  padding: 0.12em 0.38em;
  border-radius: var(--radius-sm);
  background: var(--code-inline-bg);
  color: var(--cyan);
}

kbd {
  border: 1px solid var(--kbd-border);
  box-shadow: var(--kbd-shadow);
  color: var(--yellow);
  background: var(--kbd-bg);
}

pre {
  margin: 0 0 1.2rem;
  padding: 1rem 1.1rem;
  overflow-x: auto;
  border-radius: var(--radius);
  background: var(--code-bg);
  color: var(--code-fg);
  border: 1px solid var(--line);
  box-shadow: var(--pre-inset);
}

pre code {
  padding: 0;
  background: none;
  color: var(--green);
  font-size: 0.86rem;
  line-height: 1.55;
}

html[data-theme="light"] pre code {
  color: #a6e22e;
}

.table-wrap {
  margin: 0 0 1.2rem;
  overflow-x: auto;
  border-radius: var(--radius);
  border: 1px solid var(--line);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.96rem;
}

th,
td {
  padding: 0.75rem 0.9rem;
  text-align: left;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

th {
  font-family: var(--font-display);
  font-size: 0.82rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--comment);
  background: var(--th-bg);
}

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

tr:hover td {
  background: var(--tr-hover);
}

.file-path {
  display: inline-block;
  margin-bottom: 0.55rem;
  font-family: var(--font-mono);
  font-size: 0.86rem;
  color: var(--purple);
}

.choice-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr));
  gap: 1rem;
  margin-top: 1.75rem;
}

.choice {
  display: block;
  padding: 1.35rem 1.4rem;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--glass-strong);
  box-shadow: var(--shadow);
  text-decoration: none;
  color: inherit;
  transition: transform 180ms ease, border-color 180ms ease, background 180ms ease;
  animation: rise 750ms ease both;
}

.choice:nth-child(2) {
  animation-delay: 100ms;
}

.choice:hover {
  transform: translateY(-3px);
  border-color: var(--choice-hover-border);
  background: var(--bg-panel);
}

.choice h2 {
  margin: 0 0 0.45rem;
  padding: 0;
  font-size: 1.35rem;
  color: var(--ink);
}

.choice p {
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.98rem;
}

.choice .meta {
  display: inline-block;
  margin-top: 0.9rem;
  font-weight: 700;
  font-size: 0.88rem;
  color: var(--green);
}

.steps {
  counter-reset: step;
  list-style: none;
  padding: 0;
}

.steps li {
  position: relative;
  padding: 0.85rem 0.85rem 0.85rem 3.2rem;
  margin: 0 0 0.65rem;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--step-bg);
}

.steps li::before {
  counter-increment: step;
  content: counter(step);
  position: absolute;
  left: 0.75rem;
  top: 0.85rem;
  width: 1.7rem;
  height: 1.7rem;
  display: grid;
  place-items: center;
  border-radius: var(--radius-sm);
  background: var(--pink);
  color: #fff;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.85rem;
}

.timeline {
  list-style: none;
  padding: 0;
  margin: 0 0 1.2rem;
}

.timeline li {
  position: relative;
  padding: 0.9rem 0 0.9rem 1.4rem;
  border-left: 2px solid var(--timeline-line);
}

.timeline li::before {
  content: "";
  position: absolute;
  left: -0.4rem;
  top: 1.25rem;
  width: 0.7rem;
  height: 0.7rem;
  border-radius: 50%;
  background: var(--green);
  box-shadow: var(--timeline-glow);
}

.timeline strong {
  display: block;
  font-family: var(--font-display);
  margin-bottom: 0.15rem;
  color: var(--cyan);
}

.footer {
  margin-top: 2rem;
  padding: 0 0.4rem;
  color: var(--comment);
  font-size: 0.9rem;
  animation: rise 700ms 200ms ease both;
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes drift {
  from {
    transform: translate3d(0, 0, 0) scale(1);
  }
  to {
    transform: translate3d(-30px, 24px, 0) scale(1.08);
  }
}

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

  html {
    scroll-behavior: auto;
  }
}
