/* ==========================================================================
   Dream Machine — shared design system
   Self-contained: no remote fonts, no remote images, no CDNs.
   Deliberately single-theme (deep midnight). color-scheme is pinned so form
   controls and scrollbars follow.
   ========================================================================== */

:root {
  color-scheme: dark;

  /* --- ground ------------------------------------------------------------ */
  --void: #05060f;
  --night: #090b1c;
  --indigo: #101334;
  --violet-deep: #1a1244;

  /* --- glass ------------------------------------------------------------- */
  --glass: rgba(255, 255, 255, 0.045);
  --glass-strong: rgba(255, 255, 255, 0.075);
  --edge: rgba(174, 186, 255, 0.14);
  --edge-strong: rgba(174, 186, 255, 0.28);

  /* --- ink --------------------------------------------------------------- */
  --text: #edefff;
  --muted: #b3b8dc;
  --faint: #868cba;

  /* --- accents ----------------------------------------------------------- */
  --cyan: #67e8f9;
  --cyan-dim: #2fb6cc;
  --magenta: #f472d0;
  --violet: #a78bfa;
  --amber: #fbbf24;
  --green: #4ade80;

  /* --- verdicts ---------------------------------------------------------- */
  --accept: #4ade80;
  --reject: #fbbf24;
  --inconclusive: #a78bfa;

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

  --step--1: clamp(0.78rem, 0.75rem + 0.15vw, 0.86rem);
  --step-0: clamp(0.95rem, 0.9rem + 0.22vw, 1.05rem);
  --step-1: clamp(1.1rem, 1rem + 0.45vw, 1.3rem);
  --step-2: clamp(1.35rem, 1.15rem + 0.9vw, 1.85rem);
  --step-3: clamp(1.7rem, 1.3rem + 1.8vw, 2.6rem);
  --step-4: clamp(2.2rem, 1.4rem + 3.4vw, 4.2rem);

  /* --- geometry ---------------------------------------------------------- */
  --radius: 16px;
  --radius-lg: 24px;
  --radius-sm: 10px;
  --measure: 68ch;
  --container: 1140px;
  --gutter: clamp(1.15rem, 4vw, 2.5rem);
  --section-y: clamp(4rem, 9vw, 8rem);

  --shadow-soft: 0 24px 60px -30px rgba(0, 0, 0, 0.9);
  --shadow-glow: 0 0 0 1px var(--edge), 0 30px 70px -40px rgba(103, 232, 249, 0.5);
}

/* ==========================================================================
   Base
   ========================================================================== */

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

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

body {
  margin: 0;
  min-height: 100%;
  background-color: var(--void);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: var(--step-0);
  line-height: 1.65;
  letter-spacing: 0.005em;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

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

h1,
h2,
h3,
h4 {
  margin: 0 0 0.6em;
  line-height: 1.15;
  letter-spacing: -0.02em;
  font-weight: 600;
  text-wrap: balance;
}

h1 {
  font-size: var(--step-4);
  letter-spacing: -0.035em;
}
h2 {
  font-size: var(--step-3);
}
h3 {
  font-size: var(--step-1);
}
h4 {
  font-size: var(--step-0);
}

p {
  margin: 0 0 1.1em;
  max-width: var(--measure);
}

a {
  color: var(--cyan);
  text-decoration-color: rgba(103, 232, 249, 0.35);
  text-underline-offset: 3px;
  transition: color 0.18s ease, text-decoration-color 0.18s ease;
}

a:hover {
  color: #a5f3fc;
  text-decoration-color: currentColor;
}

ul,
ol {
  padding-left: 1.25em;
  max-width: var(--measure);
}

li {
  margin-bottom: 0.4em;
}

code {
  font-family: var(--font-mono);
  font-size: 0.92em;
}

:where(a, button, input, select, summary, [tabindex]):focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 3px;
  border-radius: 6px;
}

::selection {
  background: rgba(167, 139, 250, 0.4);
  color: #fff;
}

.skip-link {
  position: absolute;
  left: 0.75rem;
  top: -100px;
  z-index: 200;
  padding: 0.7rem 1.1rem;
  background: var(--indigo);
  color: var(--text);
  border: 1px solid var(--edge-strong);
  border-radius: var(--radius-sm);
  font-size: var(--step--1);
  transition: top 0.18s ease;
}

.skip-link:focus {
  top: 0.75rem;
}

.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* ==========================================================================
   Cosmic backdrop — nebula + starfield, all CSS/canvas, no images
   ========================================================================== */

.sky {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  overflow: hidden;
  background:
    radial-gradient(120% 90% at 50% -10%, #16183c 0%, rgba(9, 11, 28, 0) 60%),
    linear-gradient(180deg, #070818 0%, var(--void) 45%, #06071a 100%);
}

.sky__stars {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0.85;
}

.nebula {
  position: absolute;
  border-radius: 50%;
  filter: blur(70px);
  opacity: 0.5;
  mix-blend-mode: screen;
  will-change: transform;
}

.nebula--a {
  width: 62vmax;
  height: 62vmax;
  top: -22vmax;
  left: -14vmax;
  background: radial-gradient(
    circle at 40% 40%,
    rgba(120, 88, 255, 0.55),
    rgba(120, 88, 255, 0) 66%
  );
}

.nebula--b {
  width: 50vmax;
  height: 50vmax;
  top: 26vmax;
  right: -18vmax;
  background: radial-gradient(
    circle at 55% 45%,
    rgba(103, 232, 249, 0.36),
    rgba(103, 232, 249, 0) 68%
  );
}

.nebula--c {
  width: 44vmax;
  height: 44vmax;
  bottom: -16vmax;
  left: 18vmax;
  background: radial-gradient(
    circle at 50% 50%,
    rgba(244, 114, 208, 0.3),
    rgba(244, 114, 208, 0) 70%
  );
}

/* horizon glow behind the header */
.sky::after {
  content: "";
  position: absolute;
  inset-inline: 0;
  top: 0;
  height: 60vh;
  background: radial-gradient(
    80% 100% at 50% 0%,
    rgba(103, 232, 249, 0.1),
    rgba(103, 232, 249, 0) 70%
  );
}

/* ==========================================================================
   Layout primitives
   ========================================================================== */

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

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

.section--tight {
  padding-block: clamp(2.5rem, 6vw, 5rem);
}

.section__head {
  margin-bottom: clamp(2rem, 4vw, 3.25rem);
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  margin: 0 0 1rem;
  padding: 0.35rem 0.85rem;
  border: 1px solid var(--edge);
  border-radius: 999px;
  background: var(--glass);
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: var(--step--1);
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.eyebrow::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--cyan);
  box-shadow: 0 0 10px var(--cyan);
}

.lede {
  font-size: var(--step-1);
  color: var(--muted);
  max-width: 62ch;
}

.grid {
  display: grid;
  gap: clamp(1rem, 2.2vw, 1.5rem);
}

.grid--2 {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr));
}

.grid--3 {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr));
}

/* ==========================================================================
   Glass surfaces
   ========================================================================== */

.card {
  position: relative;
  padding: clamp(1.25rem, 2.5vw, 1.85rem);
  border: 1px solid var(--edge);
  border-radius: var(--radius);
  background:
    linear-gradient(180deg, var(--glass-strong), var(--glass)),
    rgba(9, 11, 28, 0.55);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: var(--shadow-soft);
  overflow: hidden;
}

.card::before {
  content: "";
  position: absolute;
  inset-inline: 0;
  top: 0;
  height: 1px;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.3),
    transparent
  );
}

.card p:last-child,
.card ul:last-child {
  margin-bottom: 0;
}

.card ul,
.card ol {
  color: var(--muted);
}

.card li::marker {
  color: var(--cyan-dim);
}

.card__icon {
  display: block;
  width: 38px;
  height: 38px;
  margin-bottom: 1rem;
  color: var(--cyan);
}

/* ==========================================================================
   Header / nav
   ========================================================================== */

.site-header {
  position: sticky;
  top: 0;
  z-index: 60;
  border-bottom: 1px solid transparent;
  transition: background 0.25s ease, border-color 0.25s ease;
}

.site-header.is-stuck {
  background: rgba(6, 7, 20, 0.78);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom-color: var(--edge);
}

.site-header__inner {
  display: flex;
  align-items: center;
  gap: 1rem;
  min-height: 4.25rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  color: var(--text);
  font-weight: 600;
  letter-spacing: -0.01em;
  text-decoration: none;
  flex: 0 0 auto;
}

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

.brand__mark {
  width: 28px;
  height: 28px;
  flex: 0 0 auto;
  color: var(--cyan);
  filter: drop-shadow(0 0 6px rgba(103, 232, 249, 0.55));
}

.brand__text {
  font-size: var(--step-0);
}

.nav {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: clamp(0.35rem, 1.4vw, 1.1rem);
  min-width: 0; /* let the nav scroll internally instead of widening the header */
  overflow-x: auto;
  scrollbar-width: none;
}

.nav::-webkit-scrollbar {
  display: none;
}

.nav a {
  color: var(--muted);
  font-size: var(--step--1);
  text-decoration: none;
  white-space: nowrap;
  padding: 0.4rem 0.2rem;
}

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

.nav a[aria-current="page"] {
  box-shadow: inset 0 -1px 0 0 var(--cyan);
}

/* ==========================================================================
   Buttons
   ========================================================================== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  padding: 0.72rem 1.3rem;
  border-radius: 999px;
  border: 1px solid var(--edge-strong);
  background: var(--glass);
  color: var(--text);
  font: inherit;
  font-size: var(--step--1);
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.16s ease, background 0.18s ease, border-color 0.18s ease;
}

.btn:hover {
  color: var(--text);
  background: var(--glass-strong);
  border-color: rgba(174, 186, 255, 0.45);
  transform: translateY(-1px);
}

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

.btn--primary {
  border-color: transparent;
  background: linear-gradient(120deg, #7c5cff, #2ea9c9 65%, #38bdf8);
  color: #04121a;
  font-weight: 650;
  box-shadow: 0 12px 40px -18px rgba(103, 232, 249, 0.9);
}

.btn--primary:hover {
  color: #04121a;
  background: linear-gradient(120deg, #8f72ff, #37bcdd 65%, #4fc7fb);
}

.btn__icon {
  width: 1em;
  height: 1em;
  flex: 0 0 auto;
}

/* ==========================================================================
   Hero
   ========================================================================== */

.hero {
  position: relative;
  padding-block: clamp(1.25rem, 3.5vw, 2.75rem) clamp(2rem, 5vw, 3.5rem);
}

.hero__title .grad {
  background: linear-gradient(100deg, #a5f3fc 0%, #c4b5fd 45%, #f9a8e8 90%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.hero__lede {
  font-size: var(--step-1);
  color: var(--muted);
  max-width: 58ch;
}

.hero__principle {
  margin: clamp(0.9rem, 2vw, 1.35rem) 0;
  padding: 0.6rem 0 0.6rem 1.25rem;
  border-left: 2px solid var(--edge-strong);
  max-width: 56ch;
  color: var(--text);
  font-size: var(--step-1);
  font-weight: 500;
  line-height: 1.45;
  text-wrap: balance;
}

.hero__principle em {
  font-style: normal;
  color: var(--cyan);
}

.hero__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
  margin-top: 1.1rem;
}

.hero__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.4rem;
  margin-top: 2rem;
  color: var(--faint);
  font-family: var(--font-mono);
  font-size: var(--step--1);
}

/* command pill with copy button */
.cmd {
  display: inline-flex;
  align-items: stretch;
  max-width: 100%;
  border: 1px solid var(--edge-strong);
  border-radius: 999px;
  background: rgba(5, 6, 15, 0.7);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  overflow: hidden;
}

.cmd__text {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.7rem 0.5rem 0.7rem 1.15rem;
  font-family: var(--font-mono);
  font-size: var(--step--1);
  color: var(--text);
  white-space: nowrap;
  overflow-x: auto;
  scrollbar-width: none;
}

.cmd__text::-webkit-scrollbar {
  display: none;
}

.cmd__prompt {
  color: var(--cyan);
  user-select: none;
}

.cmd__btn {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0 1rem;
  border: 0;
  border-left: 1px solid var(--edge);
  background: var(--glass);
  color: var(--muted);
  font: inherit;
  font-size: var(--step--1);
  cursor: pointer;
  transition: background 0.18s ease, color 0.18s ease;
}

.cmd__btn:hover {
  background: var(--glass-strong);
  color: var(--text);
}

.cmd__btn svg {
  width: 15px;
  height: 15px;
}

/* ==========================================================================
   Status banner
   ========================================================================== */

.banner {
  display: flex;
  gap: 0.85rem;
  align-items: flex-start;
  padding: 1rem 1.15rem;
  border: 1px solid rgba(251, 191, 36, 0.32);
  border-radius: var(--radius);
  background: rgba(251, 191, 36, 0.07);
  color: var(--muted);
  font-size: var(--step--1);
}

.banner strong {
  color: var(--text);
}

.banner p {
  margin: 0;
  max-width: none;
}

.banner__dot {
  flex: 0 0 auto;
  width: 8px;
  height: 8px;
  margin-top: 0.55em;
  border-radius: 50%;
  background: var(--amber);
  box-shadow: 0 0 10px var(--amber);
}

/* ==========================================================================
   Scrollytelling pipeline
   ========================================================================== */

.scrolly {
  display: grid;
  grid-template-columns: minmax(0, 0.95fr) minmax(0, 1.05fr);
  gap: clamp(1.5rem, 4vw, 4rem);
  align-items: start;
}

.scrolly__viz {
  position: sticky;
  top: clamp(5rem, 12vh, 7.5rem);
  align-self: start;
}

.scrolly__stage {
  position: relative;
  padding: clamp(1.1rem, 2.4vw, 1.75rem);
  border: 1px solid var(--edge);
  border-radius: var(--radius-lg);
  background: linear-gradient(180deg, rgba(19, 22, 55, 0.72), rgba(7, 9, 24, 0.72));
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: var(--shadow-soft);
}

.orbit {
  display: block;
  width: 100%;
  height: auto;
}

.orbit__ring {
  fill: none;
  stroke: rgba(174, 186, 255, 0.16);
  stroke-width: 1;
}

.orbit__arc {
  fill: none;
  stroke: url(#orbitGrad);
  stroke-width: 2.5;
  stroke-linecap: round;
  transition: stroke-dashoffset 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.orbit__node {
  fill: #0b0d22;
  stroke: rgba(174, 186, 255, 0.4);
  stroke-width: 1.25;
  transition: fill 0.35s ease, stroke 0.35s ease, r 0.35s ease;
}

.orbit__node.is-past {
  fill: rgba(103, 232, 249, 0.25);
  stroke: rgba(103, 232, 249, 0.6);
}

.orbit__node.is-active {
  fill: var(--cyan);
  stroke: #fff;
  filter: url(#orbitGlow);
}

.orbit__center-num {
  fill: var(--cyan);
  font-family: var(--font-mono);
  font-size: 13px;
  letter-spacing: 0.2em;
  text-anchor: middle;
}

.orbit__center-label {
  fill: var(--text);
  font-family: var(--font-sans);
  font-size: 19px;
  font-weight: 600;
  text-anchor: middle;
}

.orbit__center-sub {
  fill: var(--faint);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-anchor: middle;
}

.scrolly__readout {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--edge);
  font-family: var(--font-mono);
  font-size: var(--step--1);
  color: var(--faint);
}

.scrolly__readout output {
  color: var(--cyan);
}

.scrolly__steps {
  display: flex;
  flex-direction: column;
  gap: clamp(1rem, 3vw, 2rem);
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: stage;
}

.stage {
  position: relative;
  padding: clamp(1.25rem, 2.6vw, 1.9rem);
  border: 1px solid var(--edge);
  border-radius: var(--radius);
  background: linear-gradient(180deg, var(--glass-strong), rgba(255, 255, 255, 0.02));
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  transition: opacity 0.5s ease, transform 0.5s ease, border-color 0.5s ease,
    box-shadow 0.5s ease;
  will-change: opacity, transform;
}

/* Only dim the inactive stages when JS is there to un-dim them again. */
.js .stage {
  opacity: 0.45;
  transform: translateY(14px);
}

.stage.is-active {
  opacity: 1;
  transform: translateY(0);
  border-color: var(--edge-strong);
  box-shadow: 0 0 0 1px rgba(103, 232, 249, 0.14),
    0 30px 60px -40px rgba(103, 232, 249, 0.55);
}

.stage__num {
  display: inline-block;
  margin-bottom: 0.7rem;
  font-family: var(--font-mono);
  font-size: var(--step--1);
  letter-spacing: 0.18em;
  color: var(--cyan-dim);
}

.stage.is-active .stage__num {
  color: var(--cyan);
}

.stage h3 {
  margin-bottom: 0.5rem;
}

.stage p {
  margin-bottom: 0;
  color: var(--muted);
}

.stage__tag {
  display: inline-block;
  margin-top: 0.9rem;
  padding: 0.25rem 0.65rem;
  border: 1px solid var(--edge);
  border-radius: 999px;
  background: rgba(167, 139, 250, 0.1);
  color: var(--violet);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.04em;
}

/* mobile: viz becomes a slim sticky bar above the steps */
@media (max-width: 860px) {
  .scrolly {
    grid-template-columns: 1fr;
  }

  .scrolly__viz {
    position: static;
  }

  .orbit {
    max-width: 340px;
    margin-inline: auto;
  }

  .js .stage {
    opacity: 1;
    transform: none;
  }
}

/* ==========================================================================
   Verdicts
   ========================================================================== */

.verdict-card {
  border-top: 2px solid var(--v, var(--edge-strong));
}

.verdict-card--accept {
  --v: var(--accept);
}
.verdict-card--reject {
  --v: var(--reject);
}
.verdict-card--inconclusive {
  --v: var(--inconclusive);
}

.verdict-card h3 {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-family: var(--font-mono);
  font-size: var(--step-0);
  letter-spacing: 0.1em;
  color: var(--v);
}

.verdict-card h3::before {
  content: "";
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--v);
  box-shadow: 0 0 12px var(--v);
}

.verdict-card p {
  color: var(--muted);
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.22rem 0.6rem;
  border: 1px solid var(--v, var(--edge));
  border-radius: 999px;
  background: rgba(174, 186, 255, 0.1);
  background: color-mix(in srgb, var(--v, var(--cyan)) 14%, transparent);
  color: var(--v, var(--cyan));
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  white-space: nowrap;
}

.badge--accept {
  --v: var(--accept);
}
.badge--reject {
  --v: var(--reject);
}
.badge--inconclusive {
  --v: var(--inconclusive);
}

/* ==========================================================================
   Tables
   ========================================================================== */

.table-scroll {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--edge);
  border-radius: var(--radius);
  background: rgba(9, 11, 28, 0.5);
  -webkit-overflow-scrolling: touch;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--step--1);
}

caption {
  padding: 0.9rem 1rem;
  color: var(--faint);
  font-size: var(--step--1);
  text-align: left;
}

th,
td {
  padding: 0.85rem 1rem;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid rgba(174, 186, 255, 0.08);
}

thead th {
  position: sticky;
  top: 0;
  background: rgba(13, 16, 40, 0.95);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.74rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  white-space: nowrap;
}

tbody tr:last-child td {
  border-bottom: 0;
}

tbody tr:hover td {
  background: rgba(103, 232, 249, 0.04);
}

td code {
  color: var(--cyan);
}

/* ==========================================================================
   Code blocks
   ========================================================================== */

.code {
  position: relative;
  margin: 0 0 1.25rem;
  border: 1px solid var(--edge);
  border-radius: var(--radius);
  background: rgba(4, 5, 14, 0.72);
  overflow: hidden;
}

.code__bar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 0.6rem 0.5rem 1rem;
  border-bottom: 1px solid var(--edge);
  background: rgba(255, 255, 255, 0.03);
}

.code__label {
  font-family: var(--font-mono);
  font-size: 0.74rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--faint);
}

.code__copy {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.7rem;
  border: 1px solid var(--edge);
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 0.75rem;
  cursor: pointer;
  transition: background 0.18s ease, color 0.18s ease, border-color 0.18s ease;
}

.code__copy:hover {
  background: var(--glass-strong);
  color: var(--text);
  border-color: var(--edge-strong);
}

.code__copy svg {
  width: 13px;
  height: 13px;
}

.code pre {
  margin: 0;
  padding: 1rem 1.15rem;
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: var(--step--1);
  line-height: 1.7;
  color: #d7dcff;
  tab-size: 2;
}

.code pre .c {
  color: #6f77a6;
}
.code pre .k {
  color: var(--violet);
}
.code pre .s {
  color: #8ee7bd;
}
.code pre .p {
  color: var(--cyan);
}

/* ==========================================================================
   Steps / tutorials
   ========================================================================== */

.steps {
  display: flex;
  flex-direction: column;
  gap: clamp(1.5rem, 3.5vw, 2.75rem);
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: tut;
}

.tut {
  position: relative;
  padding-left: clamp(2.75rem, 5vw, 3.75rem);
  counter-increment: tut;
  scroll-margin-top: 6rem;
}

.tut::before {
  content: counter(tut, decimal-leading-zero);
  position: absolute;
  left: 0;
  top: 0.05em;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.1rem;
  height: 2.1rem;
  border: 1px solid var(--edge-strong);
  border-radius: 50%;
  background: rgba(103, 232, 249, 0.08);
  color: var(--cyan);
  font-family: var(--font-mono);
  font-size: 0.78rem;
}

.tut::after {
  content: "";
  position: absolute;
  left: calc(1.05rem - 1px);
  top: 2.5rem;
  bottom: calc(-1 * clamp(1.5rem, 3.5vw, 2.75rem));
  width: 1px;
  background: linear-gradient(180deg, var(--edge), transparent);
}

.tut:last-child::after {
  display: none;
}

.toc {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding: 0;
  margin: 0 0 clamp(2rem, 4vw, 3rem);
  list-style: none;
  max-width: none;
}

.toc li {
  margin: 0;
}

.toc a {
  display: inline-block;
  padding: 0.45rem 0.9rem;
  border: 1px solid var(--edge);
  border-radius: 999px;
  background: var(--glass);
  color: var(--muted);
  font-size: var(--step--1);
  text-decoration: none;
}

.toc a:hover {
  color: var(--text);
  border-color: var(--edge-strong);
  background: var(--glass-strong);
}

.note {
  padding: 1rem 1.15rem;
  border: 1px solid var(--edge);
  border-left: 2px solid var(--violet);
  border-radius: var(--radius-sm);
  background: rgba(167, 139, 250, 0.07);
  color: var(--muted);
  font-size: var(--step--1);
}

.note p:last-child {
  margin-bottom: 0;
}

.note strong {
  color: var(--text);
}

dl.fields {
  margin: 0;
  display: grid;
  gap: 0.75rem 1.25rem;
  grid-template-columns: minmax(0, max-content) minmax(0, 1fr);
  font-size: var(--step--1);
}

dl.fields dt {
  font-family: var(--font-mono);
  color: var(--cyan);
}

dl.fields dd {
  margin: 0;
  color: var(--muted);
}

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

  dl.fields dd {
    margin-bottom: 0.6rem;
  }
}

/* ==========================================================================
   Dashboard
   ========================================================================== */

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 190px), 1fr));
  gap: clamp(0.75rem, 2vw, 1.25rem);
  margin-bottom: clamp(1.5rem, 3vw, 2.5rem);
}

.stat {
  padding: 1.1rem 1.25rem;
  border: 1px solid var(--edge);
  border-radius: var(--radius);
  background: linear-gradient(180deg, var(--glass-strong), var(--glass));
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.stat__label {
  display: block;
  margin-bottom: 0.35rem;
  color: var(--faint);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.stat__value {
  display: block;
  font-size: var(--step-3);
  font-weight: 600;
  line-height: 1.1;
  letter-spacing: -0.03em;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.stat__value--accept {
  color: var(--accept);
}

.stat__sub {
  display: block;
  margin-top: 0.3rem;
  color: var(--faint);
  font-size: var(--step--1);
}

.dist {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin: 0;
}

.dist__row {
  display: grid;
  grid-template-columns: 8.5rem minmax(0, 1fr) 3.5rem;
  align-items: center;
  gap: 0.75rem;
  font-family: var(--font-mono);
  font-size: var(--step--1);
}

.dist__label {
  color: var(--v, var(--muted));
  letter-spacing: 0.06em;
}

.dist__track {
  height: 8px;
  border-radius: 999px;
  background: rgba(174, 186, 255, 0.1);
  overflow: hidden;
}

.dist__fill {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: var(--v, var(--cyan));
  box-shadow: 0 0 14px -2px var(--v, var(--cyan));
  transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.dist__count {
  text-align: right;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
  margin-bottom: 1.25rem;
}

.filters__group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.chip {
  padding: 0.42rem 0.9rem;
  border: 1px solid var(--edge);
  border-radius: 999px;
  background: var(--glass);
  color: var(--muted);
  font: inherit;
  font-size: var(--step--1);
  cursor: pointer;
  transition: background 0.18s ease, color 0.18s ease, border-color 0.18s ease;
}

.chip:hover {
  color: var(--text);
  border-color: var(--edge-strong);
}

.chip[aria-pressed="true"] {
  background: rgba(103, 232, 249, 0.14);
  border-color: rgba(103, 232, 249, 0.5);
  color: var(--text);
}

.search {
  flex: 1 1 14rem;
  min-width: 0;
  padding: 0.55rem 0.95rem;
  border: 1px solid var(--edge);
  border-radius: 999px;
  background: rgba(5, 6, 15, 0.6);
  color: var(--text);
  font: inherit;
  font-size: var(--step--1);
}

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

.ledger-table td {
  font-size: var(--step--1);
}

.ledger-table .col-finding {
  min-width: 22ch;
  color: var(--muted);
}

.ledger-table .col-date {
  white-space: nowrap;
  font-family: var(--font-mono);
  color: var(--text);
}

.ledger-table .col-surface code {
  color: var(--violet);
}

.ledger-table .col-witness code {
  color: var(--faint);
}

.ledger-table .col-finding p {
  margin: 0;
  max-width: 46ch;
}

.ledger-table .col-surface div {
  margin-top: 0.3rem;
  color: var(--faint);
  font-family: var(--font-mono);
  font-size: 0.74rem;
}

.ledger-table details {
  margin-top: 0.5rem;
}

.ledger-table summary {
  cursor: pointer;
  color: var(--cyan);
  font-size: 0.78rem;
}

.ledger-table summary:hover {
  color: #a5f3fc;
}

.ledger-table details p {
  margin-top: 0.55rem;
  color: var(--faint);
  font-size: 0.78rem;
  line-height: 1.55;
}

.ledger-table details strong {
  color: var(--muted);
  font-weight: 600;
}

.link-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.75rem;
  font-size: var(--step--1);
}

.empty {
  padding: 2.5rem 1rem;
  text-align: center;
  color: var(--faint);
}

.source-note {
  margin-top: 1rem;
  color: var(--faint);
  font-family: var(--font-mono);
  font-size: var(--step--1);
}

/* dashboard table → cards on small screens */
@media (max-width: 780px) {
  .ledger-table thead {
    display: none;
  }

  .ledger-table,
  .ledger-table tbody,
  .ledger-table tr,
  .ledger-table td {
    display: block;
    width: 100%;
  }

  .ledger-table tr {
    margin: 0.75rem;
    border: 1px solid var(--edge);
    border-radius: var(--radius-sm);
    background: var(--glass);
    overflow: hidden;
  }

  .ledger-table td {
    display: grid;
    grid-template-columns: 7.5rem minmax(0, 1fr);
    gap: 0.75rem;
    padding: 0.6rem 0.9rem;
  }

  /* every content child belongs in the value column, not the label column */
  .ledger-table td > * {
    grid-column: 2;
    min-width: 0;
  }

  .ledger-table td::before {
    content: attr(data-label);
    font-family: var(--font-mono);
    font-size: 0.7rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--faint);
    padding-top: 0.2em;
  }

  .table-scroll {
    overflow-x: visible;
    background: transparent;
    border: 0;
  }
}

/* ==========================================================================
   Footer
   ========================================================================== */

.site-footer {
  margin-top: clamp(3rem, 8vw, 6rem);
  padding-block: clamp(2.5rem, 5vw, 4rem);
  border-top: 1px solid var(--edge);
  background: linear-gradient(180deg, rgba(9, 11, 28, 0), rgba(9, 11, 28, 0.7));
}

.site-footer__inner {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem 3rem;
  justify-content: space-between;
  align-items: flex-start;
}

.site-footer h2 {
  font-size: var(--step-0);
  color: var(--muted);
  font-family: var(--font-mono);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.site-footer ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.site-footer li {
  margin-bottom: 0.35rem;
}

.site-footer a {
  font-size: var(--step--1);
}

.site-footer__legal {
  width: 100%;
  margin-top: 1rem;
  padding-top: 1.5rem;
  border-top: 1px solid rgba(174, 186, 255, 0.08);
  color: var(--faint);
  font-size: var(--step--1);
}

.site-footer__legal p {
  margin: 0;
  max-width: none;
}

/* ==========================================================================
   Reveal-on-scroll (progressive; visible by default without JS)
   ========================================================================== */

.js .reveal {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 0.7s ease, transform 0.7s cubic-bezier(0.22, 1, 0.36, 1);
  will-change: opacity, transform;
}

.js .reveal.is-in {
  opacity: 1;
  transform: none;
}

/* ==========================================================================
   Reduced motion — parallax + reveal disabled, content untouched
   ========================================================================== */

@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;
    scroll-behavior: auto !important;
  }

  .js .reveal,
  .stage {
    opacity: 1 !important;
    transform: none !important;
  }

  .nebula {
    transform: none !important;
  }
}

/* ============================================================= dream4d hero */
/* WebGL 4D tesseract backdrop — sits inside .sky, behind all content. */
.sky__gl {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  opacity: 0.5;
  /* keep the copy readable: the canvas is brightest on the right, and fades
     hard across the left half where the hero text sits */
  -webkit-mask-image: radial-gradient(105% 85% at 82% 34%, #000 0%, rgba(0,0,0,0.85) 30%, rgba(0,0,0,0.28) 62%, rgba(0,0,0,0.06) 100%);
  mask-image: radial-gradient(105% 85% at 82% 34%, #000 0%, rgba(0,0,0,0.85) 30%, rgba(0,0,0,0.28) 62%, rgba(0,0,0,0.06) 100%);
  pointer-events: none;
}

/* Startup-style staggered entrance for the hero copy. */
.hero-stage > * {
  animation: dm-rise 0.9s cubic-bezier(0.22, 1, 0.36, 1) both;
}
.hero-stage > *:nth-child(1) { animation-delay: 0.05s; }
.hero-stage > *:nth-child(2) { animation-delay: 0.12s; }
.hero-stage > *:nth-child(3) { animation-delay: 0.20s; }
.hero-stage > *:nth-child(4) { animation-delay: 0.30s; }
.hero-stage > *:nth-child(5) { animation-delay: 0.40s; }
.hero-stage > *:nth-child(6) { animation-delay: 0.50s; }
.hero-stage > *:nth-child(7) { animation-delay: 0.58s; }

@keyframes dm-rise {
  from { opacity: 0; transform: translate3d(0, 18px, 0); filter: blur(6px); }
  to   { opacity: 1; transform: none; filter: none; }
}

/* Living gradient on the headline accent. */
.hero__title .grad {
  background-size: 220% 220%;
  animation: dm-grad 9s ease-in-out infinite;
}
@keyframes dm-grad {
  0%, 100% { background-position: 0% 50%; }
  50%      { background-position: 100% 50%; }
}

/* The 4D narrative chip. */
.dream4d-hud {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  margin: 0.2rem 0 0.4rem;
  padding: 0.35rem 0.8rem 0.35rem 0.5rem;
  border-radius: 999px;
  border: 1px solid rgba(139, 92, 246, 0.28);
  background: linear-gradient(90deg, rgba(34, 211, 238, 0.08), rgba(232, 121, 249, 0.08));
  backdrop-filter: blur(6px);
  font-size: 0.74rem;
  max-width: 100%;
}
.dream4d-hud__ring {
  width: 14px; height: 14px; border-radius: 50%;
  border: 1.5px solid #22d3ee;
  border-top-color: #e879f9;
  animation: dm-spin 3.2s linear infinite;
  flex: none;
}
@keyframes dm-spin { to { transform: rotate(360deg); } }
.dream4d-hud__body { display: inline-flex; align-items: baseline; gap: 0.5rem; min-width: 0; }
.dream4d-hud__k {
  text-transform: uppercase; letter-spacing: 0.14em; font-weight: 700;
  color: #a5b4fc; font-size: 0.66rem; flex: none;
}
.dream4d-hud__t {
  color: var(--fg-dim, #b9b7d0);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* ---- desktop + mobile friendly ---- */
@media (max-width: 720px) {
  .sky__gl {
    opacity: 0.38;
    -webkit-mask-image: radial-gradient(150% 65% at 55% 20%, #000 0%, rgba(0,0,0,0.55) 34%, rgba(0,0,0,0.16) 78%, rgba(0,0,0,0.05) 100%);
    mask-image: radial-gradient(150% 65% at 55% 20%, #000 0%, rgba(0,0,0,0.55) 34%, rgba(0,0,0,0.16) 78%, rgba(0,0,0,0.05) 100%);
  }
  .dream4d-hud { font-size: 0.7rem; }
  .dream4d-hud__t { max-width: 62vw; }
}

@media (prefers-reduced-motion: reduce) {
  .hero-stage > *,
  .hero__title .grad,
  .dream4d-hud__ring { animation: none; }
  .hero-stage > * { opacity: 1; transform: none; filter: none; }
}

/* ---- keep the install command above the fold ---- */
.hero { padding-block: clamp(0.75rem, 2vw, 1.75rem) clamp(1.5rem, 4vw, 2.75rem); }
.hero__title { font-size: clamp(2rem, 1.2rem + 3vw, 3.5rem); line-height: 1.06; margin: 0.15rem 0 0.85rem; }
.hero__lede { font-size: clamp(1rem, 0.95rem + 0.4vw, 1.14rem); line-height: 1.5; max-width: 60ch; }
@media (min-height: 780px) {
  .hero__title { font-size: clamp(2.2rem, 1.4rem + 3.4vw, 4rem); }
}
