:root {
  --bg0: #0b1418;
  --bg1: #122026;
  --bg2: #1a2e36;
  --ink: #e8f0f2;
  --muted: #9bb0b8;
  --accent: #e2a66a;
  --accent-2: #3db8a0;
  --line: rgba(232, 240, 242, 0.12);
  --serif: "Instrument Serif", Georgia, serif;
  --sans: "DM Sans", system-ui, sans-serif;
  --max: 1120px;
  --nav: 240px;
}

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

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: var(--sans);
  color: var(--ink);
  background: var(--bg0);
  line-height: 1.6;
  font-size: 1.05rem;
}

.skip {
  position: absolute;
  left: -999px;
  top: 0;
  background: var(--accent);
  color: #111;
  padding: 0.5rem 1rem;
  z-index: 100;
}
.skip:focus {
  left: 1rem;
  top: 1rem;
}

/* —— Hero —— */
.hero {
  position: relative;
  min-height: 88vh;
  display: grid;
  place-items: end start;
  padding: clamp(2rem, 6vw, 5rem);
  overflow: hidden;
  border-bottom: 1px solid var(--line);
}

.hero-bg {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 80% 60% at 15% 20%, rgba(61, 184, 160, 0.28), transparent 55%),
    radial-gradient(ellipse 70% 50% at 85% 30%, rgba(226, 166, 106, 0.22), transparent 50%),
    linear-gradient(165deg, #0d1a1f 0%, #132830 45%, #0b1418 100%);
  animation: drift 18s ease-in-out infinite alternate;
}

.hero-bg::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.08'/%3E%3C/svg%3E");
  opacity: 0.35;
  pointer-events: none;
}

@keyframes drift {
  from {
    transform: scale(1) translate(0, 0);
  }
  to {
    transform: scale(1.05) translate(-1.5%, 1%);
  }
}

.hero-inner {
  position: relative;
  max-width: 40rem;
  animation: rise 0.9s ease-out both;
}

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

.brand {
  font-size: 0.85rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent-2);
  margin: 0 0 1.25rem;
  font-weight: 600;
}

.hero h1 {
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(2.8rem, 8vw, 4.6rem);
  line-height: 1.05;
  margin: 0 0 1.25rem;
  letter-spacing: -0.02em;
}

.hero h1 em {
  font-style: italic;
  color: var(--accent);
}

.lede {
  color: var(--muted);
  font-size: 1.15rem;
  max-width: 34rem;
  margin: 0 0 1.75rem;
}

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

.btn {
  display: inline-flex;
  align-items: center;
  padding: 0.7rem 1.15rem;
  border-radius: 999px;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.95rem;
  transition: transform 0.2s ease, background 0.2s ease, color 0.2s ease;
}
.btn:hover {
  transform: translateY(-1px);
}
.btn.primary {
  background: var(--accent);
  color: #1a1208;
}
.btn.ghost {
  border: 1px solid var(--line);
  color: var(--ink);
  background: rgba(255, 255, 255, 0.03);
}

/* —— Layout —— */
.shell {
  display: grid;
  grid-template-columns: var(--nav) minmax(0, 1fr);
  gap: 2.5rem;
  max-width: var(--max);
  margin: 0 auto;
  padding: 2.5rem clamp(1.25rem, 4vw, 2.5rem) 5rem;
}

.nav {
  position: sticky;
  top: 1.5rem;
  align-self: start;
  max-height: calc(100vh - 3rem);
  overflow: auto;
  padding-right: 0.5rem;
}

.nav-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
  margin: 0 0 0.75rem;
}

.nav a {
  display: block;
  color: var(--muted);
  text-decoration: none;
  font-size: 0.92rem;
  padding: 0.35rem 0;
  border-left: 2px solid transparent;
  padding-left: 0.65rem;
  transition: color 0.15s ease, border-color 0.15s ease;
}
.nav a:hover,
.nav a.active {
  color: var(--ink);
  border-left-color: var(--accent-2);
}

main {
  min-width: 0;
}

.topic {
  padding: 2.25rem 0 2.75rem;
  border-bottom: 1px solid var(--line);
  scroll-margin-top: 1.5rem;
}
.topic:last-child {
  border-bottom: 0;
}

.topic h2 {
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(1.9rem, 4vw, 2.5rem);
  margin: 0 0 0.35rem;
  letter-spacing: -0.02em;
}

.kicker {
  color: var(--accent-2);
  font-size: 0.9rem;
  font-weight: 600;
  margin: 0 0 1.25rem;
}

.topic h3 {
  font-size: 1.15rem;
  margin: 1.75rem 0 0.6rem;
  font-weight: 650;
}

.topic h4 {
  margin: 0 0 0.5rem;
  font-size: 0.95rem;
  color: var(--accent);
}

.topic p {
  margin: 0 0 1rem;
  color: #d2dee3;
}

.bullets,
.check {
  margin: 0 0 1.25rem;
  padding-left: 1.2rem;
  color: #d2dee3;
}
.bullets li,
.check li {
  margin-bottom: 0.45rem;
}

.callout,
.example {
  margin: 1.5rem 0;
  padding: 1.1rem 1.25rem;
  border-radius: 4px;
  border-left: 3px solid var(--accent-2);
  background: linear-gradient(90deg, rgba(61, 184, 160, 0.1), transparent 80%);
}
.example {
  border-left-color: var(--accent);
  background: linear-gradient(90deg, rgba(226, 166, 106, 0.12), transparent 80%);
}

pre {
  margin: 1rem 0 1.5rem;
  padding: 1rem 1.15rem;
  overflow-x: auto;
  border-radius: 8px;
  background: #071014;
  border: 1px solid var(--line);
  font-size: 0.86rem;
  line-height: 1.5;
}
code {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 0.9em;
}
p code,
li code {
  background: rgba(255, 255, 255, 0.06);
  padding: 0.1em 0.35em;
  border-radius: 4px;
}

.grid-links {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(11rem, 1fr));
  gap: 0.65rem;
}
.grid-links a {
  display: block;
  padding: 0.85rem 1rem;
  text-decoration: none;
  color: var(--ink);
  background: var(--bg2);
  border: 1px solid var(--line);
  border-radius: 8px;
  font-weight: 550;
  font-size: 0.95rem;
  transition: border-color 0.15s ease, transform 0.15s ease;
}
.grid-links a:hover {
  border-color: var(--accent-2);
  transform: translateY(-2px);
}

.qa {
  margin: 0 0 1.75rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px dashed var(--line);
}
.qa:last-of-type {
  border-bottom: 0;
}
.qa h3 {
  font-family: var(--serif);
  font-weight: 400;
  font-size: 1.35rem;
  margin-top: 0;
}
.listen {
  color: var(--muted);
  font-size: 0.92rem;
  font-style: italic;
}

.footer-note {
  margin-top: 2.5rem;
  color: var(--muted);
  font-size: 0.9rem;
}
.footer-note a {
  color: var(--accent-2);
}

@media (max-width: 860px) {
  .shell {
    grid-template-columns: 1fr;
  }
  .nav {
    position: relative;
    top: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem 0.75rem;
    max-height: none;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--line);
  }
  .nav-label {
    width: 100%;
  }
  .nav a {
    border-left: 0;
    padding-left: 0;
    padding: 0.25rem 0;
  }
  .hero {
    min-height: 78vh;
    place-items: center start;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  .hero-bg,
  .hero-inner {
    animation: none;
  }
}
