/* ==========================================================================
   Modback — marketing site
   Zero dependencies. Dark-first. Brand gradient borrowed from studio/globals.css
   (emerald 142 76% 36%  ->  teal 178 60% 48%).
   Section flow mirrors nuvai.dev: hero diagram -> stack -> get started ->
   region strip -> final CTA -> footer.
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Tokens
   -------------------------------------------------------------------------- */

:root {
  /* Brand ramp */
  --brand-300: #5eead4;
  --brand-400: #2dd4bf;
  --brand-500: #14b87a;
  --brand-600: #059669;
  --brand-700: #047857;

  /* Dark theme (default) */
  --bg: #060a11;
  --bg-elevated: #0b1220;
  --surface: rgba(255, 255, 255, 0.03);
  --surface-hover: rgba(255, 255, 255, 0.06);
  --border: rgba(255, 255, 255, 0.09);
  --border-strong: rgba(255, 255, 255, 0.16);
  --text: #dce5ee;
  --text-muted: #94a3b8;
  /* #64748b measured 4.17:1 here — just under the 4.5 AA floor. */
  --text-faint: #7d8ea6;

  /* Green used *as text/icon colour*. On the dark background the bright end of
     the ramp reads well; see the light theme below for the inverse. */
  --brand-text: var(--brand-300);
  --grad-1: var(--brand-300);
  --grad-2: var(--brand-400);
  --grad-3: #7dd3fc;

  /* Syntax highlighting. Pastels read well on a dark editor; the light theme
     needs the 700-weight versions of the same hues. */
  --tok-k: #c084fc;
  --tok-f: #7dd3fc;
  --tok-p: #fbbf24;

  /* Accents used by the aurora field */
  --glow-1: rgba(20, 184, 122, 0.5);
  --glow-2: rgba(45, 212, 191, 0.35);
  --glow-3: rgba(56, 132, 255, 0.28);

  /* Diagram */
  --node-bg: rgba(255, 255, 255, 0.05);
  --node-stroke: rgba(255, 255, 255, 0.16);
  --edge: rgba(45, 212, 191, 0.4);

  /* Geometry */
  --radius-sm: 8px;
  --radius: 14px;
  --radius-lg: 22px;
  --radius-full: 999px;

  --container: 1180px;
  --gutter: clamp(1.15rem, 4vw, 2rem);
  --section-y: clamp(4.5rem, 11vw, 8.5rem);

  /* Motion */
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-spring: cubic-bezier(0.34, 1.4, 0.5, 1);
  --dur: 0.45s;

  /* Type */
  --font-sans: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI",
    Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, "SF Mono",
    Menlo, Consolas, "Liberation Mono", monospace;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow: 0 18px 40px -18px rgba(0, 0, 0, 0.75);
  --shadow-lg: 0 40px 90px -32px rgba(0, 0, 0, 0.85);
  --shadow-brand: 0 20px 60px -18px rgba(20, 184, 122, 0.45);
}

[data-theme="light"] {
  /* Softer than pure white — a bright field behind a bright aurora glares. */
  --bg: #f1f5f3;
  --bg-elevated: #ffffff;
  --surface: rgba(2, 20, 14, 0.03);
  --surface-hover: rgba(2, 20, 14, 0.06);
  --border: rgba(2, 20, 14, 0.11);
  --border-strong: rgba(2, 20, 14, 0.2);
  --text: #08130f;
  --text-muted: #45564f;
  --text-faint: #5f6f6a;

  /* The mint/teal end of the ramp scores 1.4–2.5:1 against a light background,
     which is unreadable. These deep greens hold 6.4–7.5:1 while staying the
     same hue, so the green identity survives the flip. */
  --brand-text: #065f46;
  --grad-1: #065f46;
  --grad-2: #0f766e;
  --grad-3: #0369a1;

  --tok-k: #6b21a8;
  --tok-f: #075985;
  --tok-p: #92400e;

  --glow-1: rgba(20, 184, 122, 0.2);
  --glow-2: rgba(45, 212, 191, 0.15);
  --glow-3: rgba(56, 132, 255, 0.09);

  --node-bg: rgba(255, 255, 255, 0.9);
  --node-stroke: rgba(2, 20, 14, 0.16);
  --edge: rgba(5, 150, 105, 0.45);

  --shadow-sm: 0 1px 2px rgba(2, 20, 14, 0.06);
  --shadow: 0 18px 40px -20px rgba(2, 20, 14, 0.18);
  --shadow-lg: 0 40px 90px -32px rgba(2, 20, 14, 0.22);
  --shadow-brand: 0 20px 60px -22px rgba(20, 184, 122, 0.4);
}

/* --------------------------------------------------------------------------
   2. Reset
   -------------------------------------------------------------------------- */

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

* {
  margin: 0;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: 6rem;
}

body {
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.65;
  color: var(--text);
  background-color: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

body.nav-open {
  overflow: hidden;
}

img,
svg {
  display: block;
  max-width: 100%;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input {
  font: inherit;
  color: inherit;
}

button {
  background: none;
  border: 0;
  cursor: pointer;
}

ul,
ol {
  list-style: none;
  padding: 0;
}

:focus-visible {
  outline: 2px solid var(--brand-400);
  outline-offset: 3px;
  border-radius: 4px;
}

::selection {
  background: var(--brand-500);
  color: #04110c;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* --------------------------------------------------------------------------
   3. Layout primitives
   -------------------------------------------------------------------------- */

.container {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.section {
  position: relative;
  padding-block: var(--section-y);
}

.skip-link {
  position: absolute;
  left: 50%;
  top: 0;
  translate: -50% -120%;
  z-index: 200;
  padding: 0.7rem 1.2rem;
  background: var(--brand-500);
  color: #04110c;
  font-weight: 600;
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  transition: translate 0.2s var(--ease-out);
}

.skip-link:focus {
  translate: -50% 0;
}

/* --------------------------------------------------------------------------
   4. Ambient background — aurora blobs + grid + cursor spotlight
   -------------------------------------------------------------------------- */

.bg-field {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
}

.bg-field__blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.85;
  will-change: transform;
}

.bg-field__blob--a {
  width: 46rem;
  height: 46rem;
  top: -18rem;
  left: -12rem;
  background: var(--glow-1);
  animation: drift-a 26s var(--ease-out) infinite alternate;
}

.bg-field__blob--b {
  width: 38rem;
  height: 38rem;
  top: 6rem;
  right: -14rem;
  background: var(--glow-2);
  animation: drift-b 32s var(--ease-out) infinite alternate;
}

.bg-field__blob--c {
  width: 42rem;
  height: 42rem;
  bottom: -20rem;
  left: 30%;
  background: var(--glow-3);
  animation: drift-c 38s var(--ease-out) infinite alternate;
}

@keyframes drift-a {
  to {
    transform: translate3d(8rem, 5rem, 0) scale(1.15);
  }
}

@keyframes drift-b {
  to {
    transform: translate3d(-7rem, 9rem, 0) scale(0.88);
  }
}

@keyframes drift-c {
  to {
    transform: translate3d(-9rem, -6rem, 0) scale(1.12);
  }
}

.bg-field__grid {
  position: absolute;
  inset: 0;
  background-image: linear-gradient(var(--border) 1px, transparent 1px),
    linear-gradient(90deg, var(--border) 1px, transparent 1px);
  background-size: 64px 64px;
  mask-image: radial-gradient(ellipse 80% 60% at 50% 0%, #000 20%, transparent 78%);
  -webkit-mask-image: radial-gradient(
    ellipse 80% 60% at 50% 0%,
    #000 20%,
    transparent 78%
  );
  opacity: 0.55;
}

.spotlight {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.4s ease;
  background: radial-gradient(
    420px circle at var(--mx, 50%) var(--my, 50%),
    rgba(45, 212, 191, 0.09),
    transparent 62%
  );
}

body.has-pointer .spotlight {
  opacity: 1;
}

/* --------------------------------------------------------------------------
   5. Typography
   -------------------------------------------------------------------------- */

h1,
h2,
h3,
h4 {
  line-height: 1.1;
  letter-spacing: -0.028em;
  font-weight: 640;
  text-wrap: balance;
}

h1 {
  font-size: clamp(2.5rem, 6.2vw, 4.35rem);
}

h2 {
  font-size: clamp(1.85rem, 4vw, 2.75rem);
}

h3 {
  font-size: 1.1rem;
  letter-spacing: -0.015em;
}

p {
  text-wrap: pretty;
}

.lede {
  font-size: clamp(1.02rem, 1.9vw, 1.19rem);
  color: var(--text-muted);
  max-width: 58ch;
}

.gradient-text {
  background: linear-gradient(100deg, var(--grad-1), var(--grad-2) 42%, var(--grad-3));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.section-head {
  max-width: 62ch;
  margin-bottom: clamp(2.5rem, 5vw, 4rem);
}

.section-head p {
  margin-top: 1rem;
}

.section-head--center {
  margin-inline: auto;
  text-align: center;
}

.section-head--center .lede {
  margin-inline: auto;
}

/* --------------------------------------------------------------------------
   6. Pills, badges, buttons
   -------------------------------------------------------------------------- */

.pill {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.38rem 0.85rem 0.38rem 0.6rem;
  font-size: 0.79rem;
  font-weight: 520;
  color: var(--text-muted);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.pill__dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--brand-400);
  box-shadow: 0 0 0 0 var(--brand-400);
  animation: pulse 2.4s ease-out infinite;
}

@keyframes pulse {
  70% {
    box-shadow: 0 0 0 7px rgba(45, 212, 191, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(45, 212, 191, 0);
  }
}

.btn {
  --btn-bg: var(--surface);
  --btn-fg: var(--text);
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  padding: 0.78rem 1.35rem;
  font-size: 0.93rem;
  font-weight: 570;
  white-space: nowrap;
  color: var(--btn-fg);
  background: var(--btn-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  transition: transform var(--dur) var(--ease-out),
    background-color 0.25s ease, border-color 0.25s ease, box-shadow 0.3s ease,
    opacity 0.25s ease;
}

.btn:hover {
  transform: translateY(-2px);
  border-color: var(--border-strong);
  background: var(--surface-hover);
}

.btn:active {
  transform: translateY(0);
}

.btn--primary {
  --btn-fg: #04110c;
  background: linear-gradient(135deg, var(--brand-400), var(--brand-500) 55%, var(--brand-600));
  border-color: transparent;
  box-shadow: var(--shadow-brand);
}

.btn--primary:hover {
  background: linear-gradient(135deg, var(--brand-300), var(--brand-400) 55%, var(--brand-500));
  box-shadow: 0 26px 70px -20px rgba(20, 184, 122, 0.6);
}

.btn--lg {
  padding: 0.95rem 1.7rem;
  font-size: 1rem;
}

.btn svg {
  width: 17px;
  height: 17px;
  flex: none;
}

/* --------------------------------------------------------------------------
   7. Header / nav
   -------------------------------------------------------------------------- */

.header {
  position: sticky;
  top: 0;
  z-index: 100;
  transition: background-color 0.3s ease, border-color 0.3s ease,
    backdrop-filter 0.3s ease;
  border-bottom: 1px solid transparent;
}

.header.is-stuck {
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  border-bottom-color: var(--border);
  backdrop-filter: blur(16px) saturate(180%);
  -webkit-backdrop-filter: blur(16px) saturate(180%);
}

.nav {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  height: 68px;
  transition: height 0.3s var(--ease-out);
}

.header.is-stuck .nav {
  height: 60px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  font-weight: 660;
  font-size: 1.06rem;
  letter-spacing: -0.02em;
  margin-right: auto;
}

.brand__mark {
  width: 30px;
  height: 30px;
  flex: none;
  border-radius: 9px;
  background: linear-gradient(135deg, var(--brand-400), var(--brand-600));
  display: grid;
  place-items: center;
  box-shadow: var(--shadow-brand);
}

.brand__mark svg {
  width: 17px;
  height: 17px;
  color: #04110c;
}

.nav__links {
  display: flex;
  align-items: center;
  gap: 0.15rem;
}

.nav__link {
  position: relative;
  padding: 0.5rem 0.8rem;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  transition: color 0.2s ease, background-color 0.2s ease;
}

.nav__link:hover {
  color: var(--text);
  background: var(--surface);
}

/* .is-active is set by main.js for in-page sections; aria-current="page" is
   authored into each content page's own nav link. */
.nav__link.is-active,
.nav__link[aria-current="page"] {
  color: var(--text);
}

.nav__link.is-active::after,
.nav__link[aria-current="page"]::after {
  content: "";
  position: absolute;
  left: 0.8rem;
  right: 0.8rem;
  bottom: 0.18rem;
  height: 2px;
  border-radius: 2px;
  background: linear-gradient(90deg, var(--brand-400), var(--brand-600));
}

.nav__actions {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.icon-btn {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  transition: color 0.2s ease, background-color 0.2s ease,
    border-color 0.2s ease, transform 0.2s var(--ease-out);
}

.icon-btn:hover {
  color: var(--text);
  background: var(--surface-hover);
  border-color: var(--border-strong);
  transform: translateY(-1px);
}

.icon-btn svg {
  width: 18px;
  height: 18px;
}

.theme-toggle .icon-sun {
  display: none;
}

[data-theme="light"] .theme-toggle .icon-sun {
  display: block;
}

[data-theme="light"] .theme-toggle .icon-moon {
  display: none;
}

.nav__toggle {
  display: none;
}

.drawer {
  position: fixed;
  inset: 0;
  z-index: 99;
  display: grid;
  align-content: start;
  gap: 0.25rem;
  padding: 5.5rem var(--gutter) 2rem;
  background: color-mix(in srgb, var(--bg) 96%, transparent);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  opacity: 0;
  visibility: hidden;
  translate: 0 -1rem;
  transition: opacity 0.3s ease, translate 0.35s var(--ease-out),
    visibility 0.3s;
}

body.nav-open .drawer {
  opacity: 1;
  visibility: visible;
  translate: 0;
}

.drawer a {
  padding: 0.95rem 0;
  font-size: 1.22rem;
  font-weight: 560;
  letter-spacing: -0.02em;
  border-bottom: 1px solid var(--border);
  color: var(--text-muted);
  transition: color 0.2s ease, padding-left 0.25s var(--ease-out);
}

.drawer a:hover {
  color: var(--text);
  padding-left: 0.5rem;
}

/* --------------------------------------------------------------------------
   8. Hero
   -------------------------------------------------------------------------- */

.hero {
  position: relative;
  padding-block: clamp(3.5rem, 9vw, 6.5rem) clamp(3rem, 7vw, 5rem);
}

.hero__copy {
  display: grid;
  gap: 1.4rem;
  justify-items: center;
  text-align: center;
  margin-bottom: clamp(2.75rem, 6vw, 4.5rem);
}

.hero__copy .lede {
  margin-inline: auto;
}

.hero__cta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  justify-content: center;
}

.hero__trust {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.5rem 1.5rem;
  font-size: 0.85rem;
  color: var(--text-faint);
}

.hero__trust span {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.hero__trust svg {
  width: 15px;
  height: 15px;
  color: var(--brand-text);
}

/* --------------------------------------------------------------------------
   9. Diagram / code viewer (hero visual)
   -------------------------------------------------------------------------- */

.viewer {
  position: relative;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  background: color-mix(in srgb, var(--bg-elevated) 82%, transparent);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

.viewer::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--brand-400), transparent);
  opacity: 0.7;
}

.viewer__bar {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.7rem 0.9rem;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.viewer__dots {
  display: flex;
  gap: 0.4rem;
}

.viewer__dots i {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--border-strong);
}

.viewer__dots i:first-child {
  background: #f87171;
}
.viewer__dots i:nth-child(2) {
  background: #fbbf24;
}
.viewer__dots i:last-child {
  background: var(--brand-400);
}

.viewer__toggle {
  display: flex;
  gap: 0.2rem;
  margin-inline: auto;
  padding: 0.22rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  background: var(--bg-elevated);
}

.viewer__toggle .tab {
  padding: 0.32rem 0.95rem;
  font-size: 0.8rem;
  font-weight: 540;
  white-space: nowrap;
  color: var(--text-muted);
  border: 0;
  border-radius: var(--radius-full);
  background: transparent;
  transition: color 0.2s ease, background-color 0.25s ease;
}

.viewer__toggle .tab:hover {
  color: var(--text);
}

.viewer__toggle .tab[aria-selected="true"] {
  color: #04110c;
  background: linear-gradient(135deg, var(--brand-300), var(--brand-500));
}

.viewer__panels {
  position: relative;
}

.viewer__panels > [role="tabpanel"][hidden] {
  display: none;
}

/* -- Diagram -- */

.diagram {
  padding: 1.1rem 1rem 1.35rem;
}

.diagram__canvas {
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: thin;
}

/* Direct child only — a bare `.diagram svg` also matches the pipeline arrows
   and (higher specificity) would stretch them to full width. */
.diagram__canvas > svg {
  width: 100%;
  height: auto;
  overflow: visible;
}

/* Below this width the node labels stop being readable, so let the diagram
   scroll sideways instead of shrinking further. */
@media (max-width: 640px) {
  .diagram__canvas > svg {
    width: auto;
    min-width: 610px;
  }
}

/* SVG node + edge styling, themed via CSS custom properties */
.node-box {
  fill: var(--node-bg);
  stroke: var(--node-stroke);
  stroke-width: 1.2;
}

.node-label {
  fill: var(--text);
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 500;
  text-anchor: middle;
  dominant-baseline: middle;
}

.node--accent .node-box {
  fill: rgba(20, 184, 122, 0.16);
  stroke: rgba(45, 212, 191, 0.55);
}

.node--accent .node-label {
  fill: var(--brand-300);
}

.edge {
  fill: none;
  stroke: var(--edge);
  stroke-width: 1.3;
  stroke-dasharray: 5 6;
  animation: flow 2.6s linear infinite;
}

@keyframes flow {
  to {
    stroke-dashoffset: -22;
  }
}

.column-label {
  fill: var(--text-faint);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  text-anchor: middle;
}

/* -- Pipeline under the graph -- */

.pipeline {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  margin-top: 1.4rem;
  padding-top: 1.35rem;
  border-top: 1px solid var(--border);
}

.pipeline__step {
  padding: 0.34rem 0.75rem;
  font-family: var(--font-mono);
  font-size: 0.76rem;
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  background: var(--bg-elevated);
}

.pipeline__step--live {
  color: #04110c;
  font-weight: 600;
  border-color: transparent;
  background: linear-gradient(135deg, var(--brand-300), var(--brand-500));
}

.pipeline__arrow {
  width: 13px;
  height: 13px;
  color: var(--text-faint);
  flex: none;
}

/* -- Code panel -- */

.code {
  margin: 0;
  padding: 1.3rem 1.4rem 1.5rem;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  line-height: 1.85;
  overflow-x: auto;
  tab-size: 2;
  scrollbar-width: thin;
}

.code code {
  display: block;
  white-space: pre;
}

.tok-c {
  color: var(--text-faint);
}
.tok-k {
  color: var(--tok-k);
}
.tok-s {
  color: var(--brand-text);
}
.tok-f {
  color: var(--tok-f);
}
.tok-p {
  color: var(--tok-p);
}

.copy-btn {
  position: absolute;
  top: 0.85rem;
  right: 0.9rem;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.4rem 0.7rem;
  font-size: 0.75rem;
  font-weight: 520;
  color: var(--text-muted);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  backdrop-filter: blur(10px);
  transition: color 0.2s ease, border-color 0.2s ease,
    background-color 0.2s ease;
}

.copy-btn:hover {
  color: var(--text);
  border-color: var(--border-strong);
  background: var(--surface-hover);
}

.copy-btn svg {
  width: 14px;
  height: 14px;
}

.copy-btn.is-copied {
  color: var(--brand-text);
  border-color: rgba(45, 212, 191, 0.5);
}

.copy-btn .icon-check {
  display: none;
}

.copy-btn.is-copied .icon-check {
  display: block;
}

.copy-btn.is-copied .icon-copy {
  display: none;
}

/* --------------------------------------------------------------------------
   10. The Modback Stack — numbered product cards
   -------------------------------------------------------------------------- */

.stack-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(235px, 1fr));
}

@media (min-width: 1000px) {
  .stack-grid {
    grid-template-columns: repeat(6, 1fr);
  }
  .stack-grid > :nth-child(1),
  .stack-grid > :nth-child(2),
  .stack-grid > :nth-child(3) {
    grid-column: span 2;
  }
  .stack-grid > :nth-child(4),
  .stack-grid > :nth-child(5) {
    grid-column: span 3;
  }
}

.stack-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
  padding: 1.5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  overflow: hidden;
  isolation: isolate;
  transition: border-color 0.3s ease, transform var(--dur) var(--ease-out),
    background-color 0.3s ease;
}

.stack-card::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  opacity: 0;
  transition: opacity 0.4s ease;
  background: radial-gradient(
    340px circle at var(--cx, 50%) var(--cy, 50%),
    rgba(45, 212, 191, 0.13),
    transparent 60%
  );
}

.stack-card:hover {
  transform: translateY(-4px);
  border-color: var(--border-strong);
  background: var(--surface-hover);
}

.stack-card:hover::before {
  opacity: 1;
}

.stack-card__top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.stack-card__icon {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 11px;
  color: var(--brand-text);
  background: rgba(20, 184, 122, 0.13);
  border: 1px solid rgba(20, 184, 122, 0.22);
}

.stack-card__icon svg {
  width: 20px;
  height: 20px;
}

.stack-card__num {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-faint);
}

/* The "break / see" keyword pair */
.keywords {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-family: var(--font-mono);
  font-size: 0.73rem;
  letter-spacing: 0.03em;
  color: var(--text-faint);
}

.keywords b {
  font-weight: 500;
  color: var(--brand-text);
}

.stack-card p {
  font-size: 0.9rem;
  color: var(--text-muted);
}

.stack-card__meta {
  margin-top: auto;
  padding-top: 0.35rem;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-faint);
}

.stack-foot {
  display: flex;
  justify-content: center;
  margin-top: clamp(2rem, 4vw, 3rem);
}

/* --------------------------------------------------------------------------
   11. Get started — numbered onboarding steps
   -------------------------------------------------------------------------- */

.steps {
  display: grid;
  gap: 0.85rem;
  counter-reset: step;
}

.step {
  display: grid;
  gap: 1.1rem;
  padding: 1.5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  transition: border-color 0.3s ease, background-color 0.3s ease;
}

@media (min-width: 860px) {
  .step {
    grid-template-columns: auto minmax(0, 1fr) minmax(0, 1.15fr);
    align-items: center;
    gap: 1.75rem;
    padding: 1.6rem 1.75rem;
  }
}

.step:hover {
  border-color: var(--border-strong);
  background: var(--surface-hover);
}

.step__num {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  flex: none;
  font-family: var(--font-mono);
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--brand-text);
  border: 1px solid rgba(45, 212, 191, 0.32);
  border-radius: var(--radius);
  background: rgba(20, 184, 122, 0.1);
}

.step__body h3 {
  margin-bottom: 0.3rem;
}

.step__body p {
  font-size: 0.9rem;
  color: var(--text-muted);
}

.step__code {
  position: relative;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-elevated);
  overflow: hidden;
}

.step__code .code {
  padding: 0.9rem 1.05rem;
  font-size: 0.78rem;
  line-height: 1.75;
}

.step__code .copy-btn {
  top: 0.5rem;
  right: 0.5rem;
  padding: 0.3rem 0.55rem;
  font-size: 0.7rem;
}

/* --------------------------------------------------------------------------
   12. Region + brand strip
   -------------------------------------------------------------------------- */

.strip {
  padding-block: clamp(2rem, 4vw, 3rem);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.regions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.6rem 1.75rem;
  margin-bottom: 1.6rem;
  font-family: var(--font-mono);
  font-size: 0.76rem;
  letter-spacing: 0.08em;
  color: var(--text-faint);
}

.regions span {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
}

.regions span::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--brand-400);
}

.marquee {
  overflow: hidden;
  mask-image: linear-gradient(
    90deg,
    transparent,
    #000 12%,
    #000 88%,
    transparent
  );
  -webkit-mask-image: linear-gradient(
    90deg,
    transparent,
    #000 12%,
    #000 88%,
    transparent
  );
}

.marquee__track {
  display: flex;
  width: max-content;
  animation: marquee 30s linear infinite;
}

.marquee__track span {
  padding-inline: 1.6rem;
  font-size: clamp(1.6rem, 4.2vw, 2.6rem);
  font-weight: 680;
  letter-spacing: -0.03em;
  white-space: nowrap;
  color: transparent;
  -webkit-text-stroke: 1px var(--border-strong);
}

.marquee__track span:nth-child(odd) {
  background: linear-gradient(120deg, var(--grad-1), var(--grad-2));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-stroke: 0;
}

@keyframes marquee {
  to {
    transform: translateX(-50%);
  }
}

/* --------------------------------------------------------------------------
   13. Final CTA
   -------------------------------------------------------------------------- */

.cta {
  position: relative;
  text-align: center;
  padding: clamp(2.75rem, 6vw, 4.5rem) clamp(1.5rem, 5vw, 3.5rem);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: radial-gradient(
      ellipse 70% 130% at 50% 0%,
      rgba(20, 184, 122, 0.16),
      transparent 68%
    ),
    var(--surface);
  overflow: hidden;
  display: grid;
  justify-items: center;
  gap: 1.4rem;
}

.cta h2 {
  max-width: 20ch;
}

.cta .lede {
  text-align: center;
  margin-inline: auto;
}

.cta__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  justify-content: center;
}

.socials {
  display: flex;
  gap: 0.6rem;
  margin-top: 0.5rem;
}

.socials a {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  background: var(--surface);
  transition: color 0.2s ease, border-color 0.2s ease,
    transform 0.25s var(--ease-out), background-color 0.2s ease;
}

.socials a:hover {
  color: var(--brand-text);
  border-color: rgba(45, 212, 191, 0.45);
  background: var(--surface-hover);
  transform: translateY(-2px);
}

.socials svg {
  width: 18px;
  height: 18px;
}

/* --------------------------------------------------------------------------
   14. Footer
   -------------------------------------------------------------------------- */

.footer {
  border-top: 1px solid var(--border);
  margin-top: clamp(3rem, 7vw, 6rem);
  padding-block: 3.25rem 2rem;
}

.footer__grid {
  display: grid;
  gap: 2.25rem;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}

/* Grid items default to min-width:auto, which lets long unbreakable content
   (the newsletter email placeholder) force a track wider than the viewport. */
.footer__grid > * {
  min-width: 0;
}

.footer__brand {
  display: grid;
  gap: 0.9rem;
  align-content: start;
}

.footer__brand p {
  font-size: 0.87rem;
  color: var(--text-muted);
  max-width: 28ch;
}

.footer h4 {
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-faint);
  margin-bottom: 0.95rem;
}

.footer ul {
  display: grid;
  gap: 0.6rem;
}

.footer ul a {
  font-size: 0.89rem;
  color: var(--text-muted);
  transition: color 0.2s ease;
}

.footer ul a:hover {
  color: var(--brand-text);
}

/* Newsletter */

.newsletter {
  display: grid;
  gap: 0.6rem;
}

.newsletter p {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.newsletter__form {
  display: flex;
  gap: 0.5rem;
}

.newsletter__input {
  flex: 1;
  min-width: 0;
  padding: 0.6rem 0.85rem;
  font-size: 0.87rem;
  color: var(--text);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition: border-color 0.2s ease;
}

.newsletter__input::placeholder {
  color: var(--text-faint);
}

.newsletter__input:focus {
  outline: none;
  border-color: rgba(45, 212, 191, 0.55);
}

.newsletter__form .btn {
  padding: 0.6rem 1rem;
  font-size: 0.87rem;
}

.newsletter__status {
  font-size: 0.8rem;
  color: var(--brand-text);
  min-height: 1.2em;
}

.footer__bottom {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 2.75rem;
  padding-top: 1.6rem;
  border-top: 1px solid var(--border);
  font-size: 0.83rem;
  color: var(--text-faint);
}

.footer__legal {
  display: flex;
  flex-wrap: wrap;
  gap: 1.25rem;
}

.footer__legal a:hover {
  color: var(--brand-text);
}

/* --------------------------------------------------------------------------
   14b. Content pages (download, stack, docs, about)
   -------------------------------------------------------------------------- */

.page-hero {
  padding-block: clamp(2.5rem, 6vw, 4rem) clamp(1.5rem, 3vw, 2.25rem);
}

.breadcrumb {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-faint);
}

.breadcrumb a {
  transition: color 0.2s ease;
}

.breadcrumb a:hover {
  color: var(--brand-text);
}

.breadcrumb span {
  opacity: 0.5;
}

.page-hero h1 {
  font-size: clamp(2rem, 4.8vw, 3.1rem);
  max-width: 20ch;
}

.page-hero .lede {
  margin-top: 1rem;
}

.section--tight {
  padding-block: clamp(2.25rem, 4.5vw, 3.5rem);
}

/* Two-column docs layout with a sticky table of contents */

.doc-grid {
  display: grid;
  gap: 2.5rem;
}

/* As with .footer__grid: min-width:auto on a grid item lets its content widen
   the track past the viewport once the layout collapses to one column. */
.doc-grid > * {
  min-width: 0;
}

@media (min-width: 960px) {
  .doc-grid {
    grid-template-columns: 208px minmax(0, 1fr);
    gap: 3.5rem;
    align-items: start;
  }
}

.doc-side {
  align-self: start;
}

@media (min-width: 960px) {
  .doc-side {
    position: sticky;
    top: 6rem;
  }
}

.doc-side h4 {
  margin-bottom: 0.85rem;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--text-faint);
}

.doc-side ul {
  display: grid;
  gap: 0.1rem;
}

.doc-side a {
  display: block;
  padding: 0.42rem 0.75rem;
  font-size: 0.87rem;
  color: var(--text-muted);
  border-left: 2px solid var(--border);
  transition: color 0.2s ease, border-color 0.2s ease,
    background-color 0.2s ease;
}

.doc-side a:hover {
  color: var(--text);
  border-left-color: var(--brand-500);
  background: var(--surface);
}

/* Long-form text */

.prose {
  max-width: 68ch;
}

.prose > * + * {
  margin-top: 1rem;
}

.prose h2 {
  margin-top: 2.75rem;
  padding-top: 1.75rem;
  font-size: 1.5rem;
  border-top: 1px solid var(--border);
  scroll-margin-top: 6rem;
}

.prose h2:first-child {
  margin-top: 0;
  padding-top: 0;
  border-top: 0;
}

.prose h3 {
  margin-top: 1.9rem;
  font-size: 1.06rem;
  scroll-margin-top: 6rem;
}

.prose p,
.prose li {
  font-size: 0.94rem;
  color: var(--text-muted);
}

.prose ul {
  display: grid;
  gap: 0.5rem;
  padding-left: 1.15rem;
  list-style: disc;
}

.prose li::marker {
  color: var(--brand-500);
}

.prose a {
  color: var(--brand-text);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.prose code {
  padding: 0.15em 0.42em;
  font-family: var(--font-mono);
  font-size: 0.85em;
  color: var(--brand-text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 5px;
}

.prose .code {
  margin-top: 1.1rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.note {
  display: flex;
  gap: 0.75rem;
  margin-top: 1.25rem;
  padding: 1rem 1.15rem;
  font-size: 0.9rem;
  color: var(--text-muted);
  background: rgba(20, 184, 122, 0.08);
  border: 1px solid rgba(45, 212, 191, 0.3);
  border-radius: var(--radius);
}

.note svg {
  width: 17px;
  height: 17px;
  margin-top: 0.2rem;
  flex: none;
  color: var(--brand-text);
}

/* Small card grid + definition list */

.card-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.mini-card {
  padding: 1.4rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  transition: border-color 0.3s ease, background-color 0.3s ease,
    transform var(--dur) var(--ease-out);
}

.mini-card:hover {
  transform: translateY(-3px);
  border-color: var(--border-strong);
  background: var(--surface-hover);
}

.mini-card h3 {
  margin-bottom: 0.4rem;
}

.mini-card p {
  font-size: 0.89rem;
  color: var(--text-muted);
}

.spec {
  display: grid;
  gap: 1px;
  margin-top: 1.25rem;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.spec__row {
  display: grid;
  grid-template-columns: 170px minmax(0, 1fr);
  gap: 1rem;
  padding: 0.85rem 1.15rem;
  background: var(--bg);
  font-size: 0.9rem;
}

.spec__row dt {
  color: var(--text-muted);
}

.spec__row dd {
  font-family: var(--font-mono);
  font-size: 0.83rem;
  color: var(--text);
}

@media (max-width: 560px) {
  .spec__row {
    grid-template-columns: 1fr;
    gap: 0.2rem;
  }
}

.status {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.22rem 0.62rem;
  font-size: 0.72rem;
  font-weight: 600;
  font-family: var(--font-mono);
  border-radius: var(--radius-full);
  border: 1px solid;
}

.status--done {
  color: var(--brand-text);
  border-color: rgba(45, 212, 191, 0.35);
  background: rgba(20, 184, 122, 0.1);
}

.status--planned {
  color: var(--text-faint);
  border-color: var(--border);
  background: var(--surface);
}

/* Prev / next links at the foot of a content page */

.page-nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 1rem;
  margin-top: clamp(3rem, 6vw, 4.5rem);
  padding-top: 1.75rem;
  border-top: 1px solid var(--border);
}

.page-nav a {
  display: grid;
  gap: 0.2rem;
  max-width: 45%;
  transition: color 0.2s ease;
}

.page-nav a:hover .page-nav__title {
  color: var(--brand-text);
}

.page-nav__label {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-faint);
}

.page-nav__title {
  font-size: 0.95rem;
  font-weight: 560;
  color: var(--text);
  transition: color 0.2s ease;
}

.page-nav a:last-child {
  text-align: right;
  margin-left: auto;
}

/* --------------------------------------------------------------------------
   15. Scroll reveal
   -------------------------------------------------------------------------- */

.reveal {
  opacity: 0;
  translate: 0 22px;
  transition: opacity 0.7s var(--ease-out), translate 0.7s var(--ease-out);
  transition-delay: var(--delay, 0ms);
}

.reveal.is-visible {
  opacity: 1;
  translate: 0;
}

.no-js .reveal {
  opacity: 1;
  translate: 0;
}

/* --------------------------------------------------------------------------
   16. Responsive
   -------------------------------------------------------------------------- */

@media (max-width: 900px) {
  .nav__links {
    display: none;
  }

  .nav__toggle {
    display: grid;
  }
}

@media (max-width: 700px) {
  /* The signup field needs the full row once the footer stacks. */
  .newsletter {
    grid-column: 1 / -1;
  }
}

@media (max-width: 560px) {
  .hero__cta .btn {
    width: 100%;
  }

  .viewer__toggle .tab {
    padding-inline: 0.7rem;
    font-size: 0.76rem;
  }

  .footer__bottom {
    flex-direction: column;
    align-items: flex-start;
  }
}

/* --------------------------------------------------------------------------
   17. Motion preferences
   -------------------------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }

  .reveal {
    opacity: 1;
    translate: none;
  }

  .spotlight {
    display: none;
  }

  /* The marquee relies on translateX to loop; freezing it mid-track would
     clip the wordmark, so pin it back to the start. */
  .marquee__track {
    transform: none !important;
  }
}
