:root {
  --bg: oklch(0.13 0.012 29);
  --surface: oklch(0.17 0.014 29);
  --line: oklch(0.28 0.02 29);
  --ink: oklch(0.96 0.005 29);
  --ink-dim: oklch(0.74 0.014 29);
  --ember: oklch(0.62 0.19 29.2);
  --ember-deep: oklch(0.45 0.17 29.2);
  --serif: "Zodiak", Georgia, "Times New Roman", serif;
  --mono: "Fragment Mono", ui-monospace, "SF Mono", Menlo, monospace;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 1.0625rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

::selection { background: var(--ember-deep); color: var(--ink); }

.skip-link {
  position: fixed;
  top: 0.8rem;
  left: 0.8rem;
  z-index: 5;
  font-family: var(--mono);
  font-size: 0.78rem;
  color: oklch(0.13 0.012 29);
  background: var(--ink);
  border-radius: 6px;
  padding: 0.45rem 0.7rem;
  text-decoration: none;
  transform: translateY(-160%);
  transition: transform 0.35s cubic-bezier(0.22, 1, 0.36, 1);
}

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

#scene {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
}

/* ---------- nav ---------- */

.nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 3;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: clamp(1.1rem, 2.5vw, 1.8rem) clamp(1.25rem, 4vw, 3rem);
  background: oklch(0.13 0.012 29 / 0.84);
  border-bottom: 1px solid oklch(0.28 0.02 29 / 0.38);
  backdrop-filter: blur(14px);
}

.wordmark {
  font-family: var(--serif);
  font-weight: 700;
  font-size: 1.35rem;
  letter-spacing: 0;
  color: var(--ink);
  text-decoration: none;
}

.nav-links { display: flex; gap: 1.75rem; }

.nav-links a {
  font-family: var(--mono);
  font-size: 0.85rem;
  color: var(--ink-dim);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: color 0.25s cubic-bezier(0.22, 1, 0.36, 1);
}

.nav-links a:hover, .nav-links a:focus-visible { color: var(--ember); }

/* ---------- hero ---------- */

main { position: relative; z-index: 1; }

.hero {
  position: relative;
  min-height: 100vh;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: clamp(1.25rem, 4vw, 3rem);
}

.hero-fallback {
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: 2;
  transform: translate(-50%, -58%);
  font-size: clamp(2.6rem, 9vw, 5.75rem);
  font-weight: 700;
  letter-spacing: 0;
  white-space: nowrap;
  color: var(--ink);
  text-shadow: 0 2px 28px oklch(0.45 0.17 29.2 / 0.34);
  opacity: 1;
  transition: opacity 0.5s 0.25s ease;
}

.no-scene .hero-fallback { opacity: 1; }

.scene-ok .hero-fallback { opacity: 0; pointer-events: none; }

.hero-foot {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 2rem;
}

.hero-intro {
  max-width: 34ch;
  color: var(--ink-dim);
  text-shadow: 0 1px 6px oklch(0.13 0.012 29 / 0.8);
  text-wrap: pretty;
}

.scroll-hint {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.6rem;
  flex: none;
}

.scroll-hint span {
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--ink-dim);
}

.scroll-hint i {
  display: block;
  width: 1px;
  height: 38px;
  background: var(--ember);
  transform-origin: top;
  animation: hint 2.2s cubic-bezier(0.76, 0, 0.24, 1) infinite;
}

@keyframes hint {
  0% { transform: scaleY(0); }
  45% { transform: scaleY(1); transform-origin: top; }
  46% { transform-origin: bottom; }
  90%, 100% { transform: scaleY(0); transform-origin: bottom; }
}

/* ---------- content bands ---------- */

.band {
  padding: clamp(7rem, 24vh, 13rem) clamp(1.25rem, 4vw, 3rem);
  background: linear-gradient(90deg,
    oklch(0.13 0.012 29 / 0.92) 0%,
    oklch(0.13 0.012 29 / 0.85) 55%,
    oklch(0.13 0.012 29 / 0) 100%);
}

.col {
  max-width: 620px;
  margin-left: clamp(0rem, 6vw, 5rem);
}

h2 {
  font-size: clamp(1.9rem, 4.2vw, 3.1rem);
  font-weight: 700;
  letter-spacing: 0;
  line-height: 1.12;
  margin-bottom: 1.1rem;
  text-wrap: balance;
}

.band p { color: var(--ink-dim); max-width: 58ch; }

.band p + p { margin-top: 0.9rem; }

/* ---------- code panes ---------- */

.pane {
  margin-top: 2.25rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.pane-out { margin-top: 1rem; }

.pane figcaption {
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--ink-dim);
  padding: 0.6rem 1.1rem;
  border-bottom: 1px solid var(--line);
}

.pane pre {
  padding: 1.1rem 1.2rem 1.25rem;
  overflow-x: auto;
}

.pane code {
  font-family: var(--mono);
  font-size: 0.88rem;
  line-height: 1.65;
  color: var(--ink);
}

.pane .k { color: var(--ember); }
.pane .s { color: oklch(0.78 0.09 55); }
.pane .n { color: oklch(0.78 0.06 29); }
.pane .c { color: var(--ink-dim); }

code.inline {
  font-family: var(--mono);
  font-size: 0.9em;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 0.1em 0.4em;
}

.pipeline {
  font-family: var(--mono);
  font-size: clamp(0.78rem, 1.6vw, 0.95rem);
  color: var(--ink);
  margin-top: 2.25rem;
  letter-spacing: 0.01em;
}

.pipeline span { color: var(--ember); padding: 0 0.35em; }

.facts {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px;
  margin-top: 1.4rem;
  max-width: min(100%, 760px);
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--line);
}

.facts div {
  min-width: 0;
  background: oklch(0.15 0.014 29 / 0.9);
  padding: 0.82rem 0.9rem 0.92rem;
}

.facts dt {
  font-family: var(--mono);
  font-size: 0.68rem;
  line-height: 1.2;
  color: var(--ink-dim);
  text-transform: uppercase;
}

.facts dd {
  margin-top: 0.32rem;
  font-family: var(--mono);
  font-size: clamp(0.72rem, 1.4vw, 0.9rem);
  line-height: 1.35;
  color: var(--ink);
  overflow-wrap: anywhere;
}

.aside { margin-top: 2.25rem; }

/* ---------- finale ---------- */

.finale {
  min-height: 100vh;
  min-height: 100svh;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: clamp(1.25rem, 4vw, 3rem);
}

.finale > .reveal {
  width: min(100%, 760px);
}

.finale-head {
  font-size: clamp(2.3rem, 6.5vw, 4.6rem);
  margin-bottom: 2.5rem;
}

.install {
  display: inline-flex;
  align-items: stretch;
  width: min(100%, 760px);
  max-width: 100%;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.install code {
  font-family: var(--mono);
  font-size: 0.85rem;
  color: var(--ink);
  padding: 0.85rem 1.2rem;
  min-width: 0;
  flex: 1 1 auto;
  white-space: nowrap;
  overflow-x: auto;
}

#copy-btn {
  font-family: var(--mono);
  font-size: 0.8rem;
  color: oklch(0.13 0.012 29);
  background: var(--ember);
  border: none;
  padding: 0 1.2rem;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.25s cubic-bezier(0.22, 1, 0.36, 1);
}

#copy-btn:hover, #copy-btn:focus-visible { background: oklch(0.68 0.19 29.2); }

.finale-links {
  margin-top: 2.25rem;
  display: flex;
  justify-content: center;
  gap: 2.5rem;
  flex-wrap: wrap;
}

.finale-links a, .colophon a {
  color: var(--ink);
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-color: var(--ember-deep);
  transition: color 0.25s cubic-bezier(0.22, 1, 0.36, 1);
}

.finale-links a:hover, .finale-links a:focus-visible,
.colophon a:hover, .colophon a:focus-visible { color: var(--ember); }

.colophon {
  margin-top: 4.5rem;
  font-size: 0.9rem;
  color: var(--ink-dim);
}

/* ---------- reveals ---------- */

.will-reveal {
  opacity: 0;
  transform: translateY(28px);
  filter: blur(8px);
  transition: opacity 0.7s cubic-bezier(0.22, 1, 0.36, 1),
              transform 0.7s cubic-bezier(0.22, 1, 0.36, 1),
              filter 0.7s cubic-bezier(0.22, 1, 0.36, 1);
}

.will-reveal.in { opacity: 1; transform: none; filter: none; }

/* ---------- small screens ---------- */

@media (max-width: 720px) {
  .band {
    background: linear-gradient(90deg,
      oklch(0.13 0.012 29 / 0.93) 0%,
      oklch(0.13 0.012 29 / 0.86) 100%);
  }
  .col { margin-left: 0; }
  .hero-foot { flex-direction: column; align-items: flex-start; }
  .scroll-hint { align-self: center; }
  .pane pre {
    overflow-x: hidden;
    white-space: pre-wrap;
  }
  .pane code {
    overflow-wrap: anywhere;
  }
  .facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .install { flex-direction: column; }
  .install code {
    overflow-x: hidden;
    overflow-wrap: anywhere;
    white-space: normal;
  }
  #copy-btn { padding: 0.7rem 1.2rem; }
  .finale-links { gap: 1.25rem; flex-direction: column; }
}

/* ---------- reduced motion ---------- */

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .scroll-hint i { animation: none; transform: none; }
  .will-reveal { opacity: 1; transform: none; transition: none; }
  .hero-fallback { transition: none; }
}

/* ---------- 404 ---------- */

.page-404 {
  min-height: 100svh;
  background:
    radial-gradient(circle at 50% 32%, oklch(0.28 0.08 29 / 0.45), transparent 28rem),
    var(--bg);
}

.not-found {
  min-height: 100svh;
  display: grid;
  align-content: center;
  justify-items: center;
  text-align: center;
  padding: clamp(1.5rem, 4vw, 3rem);
}

.not-found-mark {
  position: fixed;
  top: clamp(1.1rem, 2.5vw, 1.8rem);
  left: clamp(1.25rem, 4vw, 3rem);
}

.not-found-code {
  font-family: var(--mono);
  color: var(--ember);
  font-size: 0.78rem;
  margin-bottom: 1rem;
}

.not-found h1 {
  max-width: 11ch;
  font-size: clamp(3rem, 9vw, 7.2rem);
  line-height: 0.95;
  letter-spacing: 0;
}

.not-found p:not(.not-found-code) {
  max-width: 42ch;
  margin-top: 1.4rem;
  color: var(--ink-dim);
}

.not-found-links {
  display: flex;
  gap: 1.5rem;
  flex-wrap: wrap;
  justify-content: center;
  margin-top: 2.4rem;
  font-family: var(--mono);
  font-size: 0.82rem;
}

.not-found-links a {
  color: var(--ink);
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-color: var(--ember-deep);
}
