/* ── Tokens ── */
:root {
  --bg:          #0a1216;
  --bg-surface:  #0f1b21;
  --bg-card:     #15242c;
  --bg-card-alt: #122028;
  --border:      #22363f;
  --text:        #e6efee;
  --text-muted:  #8aa0a3;
  --text-faint:  #4c6268;
  --accent:      #f2b544;   /* the logo's node amber */
  --accent-2:    #e8730c;   /* the app's orange */
  --teal:        #7fd1c7;   /* the logo's contour lines */
  --contour:     127, 209, 199;
  --contour-hi:  242, 181, 68;
  /* Node category colours, as in the editor */
  --cat-generator: #3a7d44;
  --cat-filter:    #3b5b92;
  --cat-combiner:  #8a5a1f;
  --cat-erosion:   #7a3b8f;
  --cat-function:  #2e7d7a;
  --cat-output:    #9c2f2f;
  --btn-text:    #0a1216;
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg:          #f3f0e8;
    --bg-surface:  #ebe7dc;
    --bg-card:     #e2ddd0;
    --bg-card-alt: #e7e2d6;
    --border:      #cbc5b6;
    --text:        #12201f;
    --text-muted:  #56676a;
    --text-faint:  #a3ada9;
    --accent:      #b5700a;
    --accent-2:    #c25f06;
    --teal:        #237a70;
    --contour:     35, 122, 112;
    --contour-hi:  194, 95, 6;
    --btn-text:    #fffaf0;
  }
}

:root[data-theme="dark"] {
  --bg:          #0a1216;
  --bg-surface:  #0f1b21;
  --bg-card:     #15242c;
  --bg-card-alt: #122028;
  --border:      #22363f;
  --text:        #e6efee;
  --text-muted:  #8aa0a3;
  --text-faint:  #4c6268;
  --accent:      #f2b544;
  --accent-2:    #e8730c;
  --teal:        #7fd1c7;
  --contour:     127, 209, 199;
  --contour-hi:  242, 181, 68;
  --btn-text:    #0a1216;
}

:root[data-theme="light"] {
  --bg:          #f3f0e8;
  --bg-surface:  #ebe7dc;
  --bg-card:     #e2ddd0;
  --bg-card-alt: #e7e2d6;
  --border:      #cbc5b6;
  --text:        #12201f;
  --text-muted:  #56676a;
  --text-faint:  #a3ada9;
  --accent:      #b5700a;
  --accent-2:    #c25f06;
  --teal:        #237a70;
  --contour:     35, 122, 112;
  --contour-hi:  194, 95, 6;
  --btn-text:    #fffaf0;
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', system-ui, sans-serif;
  font-size: clamp(16px, 1.4vw, 18px);
  line-height: 1.65;
  overflow-x: hidden;
}
img { max-width: 100%; display: block; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
code {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.88em;
  color: var(--teal);
}

/* ── Type scale ── */
.display {
  font-family: 'JetBrains Mono', monospace;
  font-weight: 800;
  letter-spacing: -0.03em;
  text-wrap: balance;
  line-height: 0.95;
}
.eyebrow {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--teal);
  margin-bottom: 0.9rem;
}
.lead {
  color: var(--text-muted);
  max-width: 60ch;
  margin-bottom: 0;
}

/* ── Theme toggle ── */
#theme-toggle {
  position: fixed;
  top: 1.25rem;
  right: 1.25rem;
  z-index: 200;
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 0.4rem 0.8rem;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
}
#theme-toggle:hover { color: var(--text); border-color: var(--accent); }

/* ── Hero ── */
#hero {
  position: relative;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: clamp(2rem, 5vw, 4rem);
  overflow: hidden;
}
#hero-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}
/* Fade the contours out behind the text. */
#hero::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, var(--bg) 0%, color-mix(in srgb, var(--bg) 70%, transparent) 40%, transparent 85%);
  pointer-events: none;
}
.hero-inner {
  position: relative;
  z-index: 1;
  max-width: 1400px;
}
.hero-brand {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  margin-bottom: 1.25rem;
}
.hero-logo {
  width: 56px;
  height: 56px;
  border: 1px solid var(--border);
}
.hero-kicker {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.8rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.hero-title {
  font-size: clamp(3.5rem, 15vw, 15rem);
  color: var(--text);
  margin-bottom: 1.5rem;
}
.hero-title span { color: var(--accent); }
.hero-lede {
  font-size: clamp(1.1rem, 2vw, 1.45rem);
  max-width: 44ch;
  color: var(--text-muted);
  margin-bottom: 2rem;
}
.hero-actions { justify-content: flex-start; margin-bottom: 2.5rem; }
.hero-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 1.75rem;
  border-top: 1px solid var(--border);
  padding-top: 1rem;
  max-width: 680px;
}
.hero-meta .pill {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.85rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.hero-meta .pill strong { color: var(--accent); font-weight: 700; }
.hero-scroll {
  position: absolute;
  bottom: 2rem;
  right: clamp(2rem, 5vw, 4rem);
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.65rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-faint);
}
.hero-scroll-line {
  width: 1px;
  height: 48px;
  background: linear-gradient(to bottom, var(--text-faint), transparent);
  animation: scroll-pulse 2s ease-in-out infinite;
}
@keyframes scroll-pulse {
  0%, 100% { opacity: 0.4; transform: scaleY(1); }
  50% { opacity: 1; transform: scaleY(0.6); }
}
@media (max-width: 640px) { .hero-scroll { display: none; } }

/* ── Sections ── */
.section-band {
  background: var(--bg-surface);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}
.section {
  padding: clamp(4rem, 8vw, 7rem) clamp(1rem, 5vw, 4rem);
  max-width: 1400px;
  margin: 0 auto;
}
.section-full {
  padding: clamp(4rem, 8vw, 7rem) clamp(1rem, 5vw, 4rem);
  background: var(--bg-surface);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}
.section-full.plain { background: var(--bg); border-color: var(--bg); }
.section-full-inner {
  max-width: 1400px;
  margin: 0 auto;
}
.section-title {
  font-size: clamp(2.2rem, 5vw, 4.5rem);
  color: var(--text);
  margin-bottom: 1.5rem;
}
.section-title.accent, .section-title .accent { color: var(--accent); }

/* ── Reveal animation ── */
.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.7s ease, transform 0.7s ease;
}
.reveal.visible { opacity: 1; transform: none; }
.reveal-delay-1 { transition-delay: 0.1s; }
.reveal-delay-2 { transition-delay: 0.2s; }
.reveal-delay-3 { transition-delay: 0.3s; }

@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; transition: none; }
  .hero-scroll-line { animation: none; }
}

/* ── Two-column layout ── */
.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: clamp(2rem, 5vw, 5rem);
  align-items: center;
}
.two-col.flip { direction: rtl; }
.two-col.flip > * { direction: ltr; }
@media (max-width: 860px) {
  .two-col { grid-template-columns: 1fr; }
  .two-col.flip { direction: ltr; }
}

/* ── Premise ── */
.premise-body {
  font-size: clamp(1rem, 1.5vw, 1.15rem);
  line-height: 1.75;
  max-width: 56ch;
  color: var(--text-muted);
}
.premise-body p + p { margin-top: 1em; }
.premise-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
}
.stat {
  background: var(--bg-card);
  padding: 1.5rem 1.5rem 1.25rem;
}
.stat-value {
  font-family: 'JetBrains Mono', monospace;
  font-size: clamp(2rem, 4vw, 3.25rem);
  font-weight: 800;
  color: var(--accent);
  line-height: 1;
  margin-bottom: 0.35rem;
}
.stat-label {
  font-size: 0.75rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
}

/* ── Screenshots ── */
.shot {
  border: 1px solid var(--border);
  background: var(--bg-card);
  padding: 6px;
  box-shadow: 0 30px 80px -30px rgba(0, 0, 0, 0.6);
}
.section-full-inner > .shot { margin-top: 2.5rem; }
.shot img { width: 100%; height: auto; }

/* ── Features ── */
.feature-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  margin-top: 1rem;
}
@media (max-width: 960px) { .feature-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 600px) { .feature-grid { grid-template-columns: 1fr; } }
.feature {
  background: var(--bg-card);
  padding: 2rem 1.75rem 2.25rem;
}
.feature p { color: var(--text-muted); font-size: 0.95rem; }
.feature-icon {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  font-family: 'JetBrains Mono', monospace;
  font-size: 1.25rem;
  font-weight: 700;
  color: #fff;
  background: var(--cat);
  margin-bottom: 1.25rem;
}
.feature-title {
  font-family: 'JetBrains Mono', monospace;
  font-size: 1.05rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

/* Category colours */
.cat-generator { --cat: var(--cat-generator); }
.cat-filter    { --cat: var(--cat-filter); }
.cat-combiner  { --cat: var(--cat-combiner); }
.cat-erosion   { --cat: var(--cat-erosion); }
.cat-function  { --cat: var(--cat-function); }
.cat-output    { --cat: var(--cat-output); }

/* ── Steps ── */
.steps { display: flex; flex-direction: column; }
.step {
  display: grid;
  grid-template-columns: 3rem 1fr;
  gap: 1rem;
  padding: 1.15rem 0;
  border-bottom: 1px solid var(--border);
  align-items: start;
}
.step:last-child { border-bottom: none; }
.step-num {
  font-family: 'JetBrains Mono', monospace;
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-faint);
  padding-top: 0.15rem;
}
.step-title {
  font-family: 'JetBrains Mono', monospace;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--teal);
  margin-bottom: 0.2rem;
}
.step-body { font-size: 0.95rem; color: var(--text-muted); }

/* ── Pullquote ── */
.pullquote {
  padding: clamp(3rem, 6vw, 6rem) clamp(1rem, 5vw, 4rem);
  text-align: center;
  border-bottom: 1px solid var(--border);
}
.pullquote-text {
  font-family: 'JetBrains Mono', monospace;
  font-weight: 500;
  font-size: clamp(1.2rem, 3vw, 2.1rem);
  line-height: 1.4;
  letter-spacing: -0.01em;
  max-width: 900px;
  margin: 0 auto 1rem;
}
.pullquote-text em { font-style: normal; color: var(--accent); }
.pullquote-attribution {
  font-size: 0.75rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-faint);
}

/* ── Nodes ── */
.node-groups {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
  margin-top: 2rem;
}
@media (max-width: 480px) { .node-groups { grid-template-columns: 1fr; } }
.node-group {
  background: var(--bg-card);
  border: 1px solid var(--border);
}
.node-group h3 {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #fff;
  background: var(--cat);
  padding: 0.35rem 0.75rem;
}
.node-group ul {
  list-style: none;
  padding: 0.6rem 0.75rem 0.75rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.15rem 0.9rem;
  font-size: 0.9rem;
  color: var(--text-muted);
}

/* ── Formats ── */
.format-strip {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  margin-top: 1rem;
}
@media (max-width: 860px) { .format-strip { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 520px) { .format-strip { grid-template-columns: repeat(2, 1fr); } }
.format {
  background: var(--bg-card);
  padding: 1.5rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}
.format-ext {
  font-family: 'JetBrains Mono', monospace;
  font-size: clamp(1.4rem, 2.5vw, 2rem);
  font-weight: 800;
  color: var(--accent);
}
.format-depth { font-size: 0.85rem; color: var(--text-muted); }
.note {
  margin-top: 2rem;
  color: var(--text-muted);
  max-width: 70ch;
}

/* ── CTA ── */
.cta-section {
  padding: clamp(5rem, 10vw, 9rem) clamp(1rem, 5vw, 4rem);
  text-align: center;
  position: relative;
  overflow: hidden;
  background: var(--bg-surface);
  border-top: 1px solid var(--border);
}
.cta-section::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 80% 60% at 50% 100%, color-mix(in srgb, var(--accent-2) 12%, transparent), transparent);
  pointer-events: none;
}
.cta-title {
  font-size: clamp(2.4rem, 6vw, 6rem);
  margin-bottom: 1.25rem;
  position: relative;
}
.cta-body {
  max-width: 540px;
  margin: 0 auto 2.5rem;
  color: var(--text-muted);
  position: relative;
}
.btn-group {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
  position: relative;
}
.btn {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.9rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  padding: 0.85rem 1.75rem;
  border: 1px solid;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  text-decoration: none;
}
.btn-primary {
  background: var(--accent-2);
  border-color: var(--accent-2);
  color: var(--btn-text);
}
.btn-primary:hover {
  background: color-mix(in srgb, var(--accent-2) 82%, white);
  border-color: color-mix(in srgb, var(--accent-2) 82%, white);
  text-decoration: none;
}
.btn-secondary {
  background: transparent;
  border-color: var(--border);
  color: var(--text-muted);
}
.btn-secondary:hover { border-color: var(--text-muted); color: var(--text); text-decoration: none; }

/* ── Footer ── */
footer {
  padding: 2rem clamp(1rem, 5vw, 4rem);
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  background: var(--bg);
}
.footer-name {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-muted);
}
.footer-copy { font-size: 0.75rem; color: var(--text-faint); }
