:root {
  --site-art-filter: none;
  --site-nav-surface: rgba(244, 235, 221, 0.82);
  --site-hero-glow: rgba(79, 111, 134, 0.2);
  --site-grid-line: rgba(87, 63, 41, 0.09);
  --site-ink-soft: color-mix(in srgb, var(--ink) 76%, var(--muted));
}

:root[data-theme="dark"] {
  --site-art-filter: invert(1) brightness(1.2) contrast(0.92);
  --site-nav-surface: rgba(15, 20, 25, 0.84);
  --site-hero-glow: rgba(131, 168, 196, 0.18);
  --site-grid-line: rgba(226, 230, 224, 0.07);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --site-art-filter: invert(1) brightness(1.2) contrast(0.92);
    --site-nav-surface: rgba(15, 20, 25, 0.84);
    --site-hero-glow: rgba(131, 168, 196, 0.18);
    --site-grid-line: rgba(226, 230, 224, 0.07);
  }
}

html {
  scroll-padding-top: 76px;
}

.site-nav {
  position: sticky;
  top: 0;
  z-index: 80;
  display: flex;
  min-height: 64px;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 10px clamp(18px, 4vw, 56px);
  border-bottom: 1px solid var(--line);
  background: var(--site-nav-surface);
  backdrop-filter: blur(18px) saturate(1.15);
  -webkit-backdrop-filter: blur(18px) saturate(1.15);
}

.site-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  font-family: var(--display);
  font-size: 1.22rem;
  font-weight: 700;
  text-decoration: none;
}

.site-brand-mark {
  display: inline-grid;
  width: 27px;
  height: 27px;
  grid-template-columns: repeat(3, 1fr);
  align-items: end;
  gap: 3px;
  padding: 5px;
  border: 1px solid color-mix(in srgb, var(--river) 54%, var(--line));
  border-radius: 50%;
}

.site-brand-mark i {
  display: block;
  width: 100%;
  border-radius: 999px;
  background: var(--river);
}

.site-brand-mark i:nth-child(1) {
  height: 40%;
}

.site-brand-mark i:nth-child(2) {
  height: 100%;
  background: var(--moss);
}

.site-brand-mark i:nth-child(3) {
  height: 65%;
  background: var(--copper);
}

.site-nav-links {
  display: flex;
  align-items: center;
  gap: clamp(8px, 1.5vw, 22px);
}

.site-nav-links a,
.site-theme-toggle {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  color: var(--site-ink-soft);
  border: 0;
  background: transparent;
  box-shadow: none;
  font-family: var(--ui);
  font-size: 0.86rem;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
}

.site-nav-links a:hover,
.site-theme-toggle:hover {
  color: var(--ink);
  filter: none;
  transform: none;
}

.site-nav-links a[aria-current="page"] {
  color: var(--ink);
}

.site-nav a:focus-visible,
.landing-primary-action:focus-visible,
.landing-text-action:focus-visible,
.landing-scroll-cue:focus-visible,
.glossary-path-card:focus-visible,
.site-footer a:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--river) 34%, transparent);
  outline-offset: 4px;
}

.site-nav-links .site-nav-cta {
  padding-inline: 16px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  color: var(--ink);
  background: color-mix(in srgb, var(--surface-strong) 72%, transparent);
}

.site-theme-toggle {
  min-width: 62px;
  padding-inline: 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
}

/* ── View toggle: landing ↔ builder ────────────────────── */
body[data-view="landing"] .landing-page  { display: block; }
body[data-view="landing"] .builder-header,
body[data-view="landing"] .app-shell      { display: none; }

body[data-view="builder"] .landing-page  { display: none; }
body[data-view="builder"] .builder-header { display: grid; animation: viewFadeIn 320ms ease-out; }
body[data-view="builder"] .app-shell      { display: block; animation: viewFadeIn 320ms ease-out; }

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

/* Back-to-home link in builder header */
.builder-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-decoration: none;
  text-transform: uppercase;
  transition: color 180ms ease;
}

.builder-back:hover,
.builder-back:focus-visible {
  color: var(--ink);
}

.builder-back span {
  font-size: 1.1em;
  transition: transform 180ms ease;
}

.builder-back:hover span {
  transform: translateX(-3px);
}

.landing-page {
  position: relative;
  z-index: 1;
  overflow: clip;
}

.landing-page::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  opacity: 0.62;
  background-image:
    linear-gradient(var(--site-grid-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--site-grid-line) 1px, transparent 1px);
  background-size: 64px 64px;
  mask-image: linear-gradient(to bottom, black 0%, transparent 32%, transparent 100%);
  pointer-events: none;
}

.landing-hero {
  position: relative;
  width: min(100%, 1680px);
  min-height: calc(100svh - 64px);
  display: grid;
  grid-template-columns: minmax(0, 1.02fr) minmax(420px, 0.98fr);
  align-items: center;
  gap: clamp(36px, 6vw, 110px);
  margin: 0 auto;
  padding: clamp(64px, 9vw, 138px) clamp(24px, 7vw, 116px) clamp(82px, 10vw, 142px);
}

.landing-hero::after {
  content: "";
  position: absolute;
  top: 8%;
  right: -8%;
  width: min(52vw, 780px);
  aspect-ratio: 1;
  border-radius: 50%;
  background: radial-gradient(circle, var(--site-hero-glow), transparent 67%);
  filter: blur(12px);
  pointer-events: none;
}

.landing-hero-copy {
  position: relative;
  z-index: 2;
  display: grid;
  justify-items: start;
  gap: clamp(20px, 2.5vw, 34px);
}

.landing-eyebrow,
.landing-section-index {
  margin: 0;
  color: var(--river);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.landing-hero h1,
.landing-purpose h2,
.landing-section-head h2,
.landing-glossary-callout h2,
.landing-final h2,
.glossary-hero h1 {
  margin: 0;
  color: var(--ink);
  font-family: var(--display);
  font-weight: 700;
  letter-spacing: -0.045em;
}

.landing-hero h1 {
  max-width: 920px;
  font-size: clamp(3.5rem, 6.7vw, 7.5rem);
  line-height: 0.86;
}

.landing-hero h1 em,
.landing-final h2 em {
  color: var(--copper);
  font-weight: inherit;
}

.landing-lede {
  max-width: 650px;
  margin: 0;
  color: var(--site-ink-soft);
  font-size: clamp(1.05rem, 1.45vw, 1.35rem);
  line-height: 1.62;
}

.landing-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 24px;
}

.landing-primary-action,
.landing-text-action {
  min-height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  color: var(--ink);
  font-size: 0.92rem;
  font-weight: 800;
  text-decoration: none;
}

.landing-primary-action {
  min-width: 178px;
  padding: 0 20px;
  border: 1px solid color-mix(in srgb, var(--river) 68%, var(--line));
  border-radius: 999px;
  color: var(--button-ink);
  background: linear-gradient(180deg, var(--button-top), var(--button-bottom));
  box-shadow: 0 14px 34px color-mix(in srgb, var(--river) 20%, transparent);
}

.landing-primary-action span {
  transition: transform 180ms ease;
}

.landing-primary-action:hover span {
  transform: translateY(3px);
}

.landing-text-action {
  min-width: 0;
  border-bottom: 1px solid var(--line-strong);
}

.landing-hero-visual {
  position: relative;
  z-index: 1;
  min-width: 0;
  aspect-ratio: 0.92;
  display: grid;
  place-items: center;
}

.landing-cycle-orbit {
  position: absolute;
  inset: 4% 0 17%;
  border: 1px solid color-mix(in srgb, var(--river) 34%, var(--line));
  border-radius: 50%;
  transform: rotate(-8deg);
}

.landing-cycle-orbit::before,
.landing-cycle-orbit::after {
  content: "";
  position: absolute;
  inset: 9%;
  border: 1px dashed color-mix(in srgb, var(--moss) 34%, transparent);
  border-radius: inherit;
}

.landing-cycle-orbit::after {
  inset: 24%;
  border-style: solid;
  border-color: color-mix(in srgb, var(--copper) 20%, transparent);
}

.landing-cycle-label {
  position: absolute;
  top: 8%;
  left: 50%;
  padding: 6px 10px;
  color: var(--muted);
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  font-family: var(--mono);
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  transform: translateX(-50%) rotate(8deg);
}

.landing-orbit-ticks {
  position: absolute;
  inset: -5px;
  transform-origin: center;
  animation: landing-orbit-turn 28s linear infinite;
}

.landing-orbit-ticks i {
  position: absolute;
  width: 10px;
  height: 10px;
  border: 2px solid var(--bg);
  border-radius: 50%;
  background: var(--river);
  transform: translate(-50%, -50%);
}

.landing-orbit-ticks i:nth-child(1) { top: 0; left: 50%; }
.landing-orbit-ticks i:nth-child(2) { top: 15%; left: 85%; }
.landing-orbit-ticks i:nth-child(3) { top: 50%; left: 100%; }
.landing-orbit-ticks i:nth-child(4) { top: 85%; left: 85%; }
.landing-orbit-ticks i:nth-child(5) { top: 100%; left: 50%; }
.landing-orbit-ticks i:nth-child(6) { top: 85%; left: 15%; }
.landing-orbit-ticks i:nth-child(7) { top: 50%; left: 0; }
.landing-orbit-ticks i:nth-child(8) { top: 15%; left: 15%; }

.landing-hand-scene {
  position: relative;
  z-index: 2;
  width: 84%;
  height: 64%;
  transform: translateY(-3%);
}

.landing-hand {
  position: absolute;
  display: block;
  filter: var(--site-art-filter);
  opacity: 0.9;
}

.landing-hand-upper {
  top: 3%;
  left: 15%;
  width: 67%;
  transform: rotate(-4deg);
  transform-origin: 45% 78%;
  animation: landing-hand-strike 3.8s cubic-bezier(0.2, 0.75, 0.22, 1) infinite;
}

.landing-hand-lower {
  right: 3%;
  bottom: 8%;
  width: 78%;
  transform: rotate(-4deg) scale(0.88);
}

.landing-contact-pulse {
  position: absolute;
  left: 47%;
  bottom: 34%;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--copper);
  box-shadow: 0 0 0 0 color-mix(in srgb, var(--copper) 46%, transparent);
  animation: landing-contact-pulse 3.8s ease-out infinite;
}

.landing-phrase-route {
  position: absolute;
  right: 1%;
  bottom: 2%;
  left: 1%;
  z-index: 3;
  display: grid;
  gap: 8px;
}

.landing-route-label {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.landing-route-track {
  position: relative;
  height: 54px;
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: color-mix(in srgb, var(--surface-strong) 62%, transparent);
  backdrop-filter: blur(10px);
}

.landing-route-track > i {
  border-right: 1px solid var(--line);
}

.landing-route-phrase,
.landing-route-landing {
  position: absolute;
  top: 7px;
  bottom: 7px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  color: #f6f1e8;
  font-family: var(--mono);
  font-size: 0.7rem;
  font-style: normal;
}

.landing-route-phrase {
  background: var(--moss);
}

.landing-route-phrase-one {
  left: 4%;
  width: 31%;
}

.landing-route-phrase-two {
  left: 39%;
  width: 31%;
}

.landing-route-landing {
  right: 4%;
  width: 22%;
  color: var(--ink);
  background: var(--copper-soft);
}

.landing-scroll-cue {
  position: absolute;
  bottom: 28px;
  left: clamp(24px, 7vw, 116px);
  display: inline-flex;
  align-items: center;
  gap: 14px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-decoration: none;
  text-transform: uppercase;
}

.landing-scroll-cue i {
  position: relative;
  width: 42px;
  height: 1px;
  overflow: hidden;
  background: var(--line-strong);
}

.landing-scroll-cue i::after {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--river);
  transform: translateX(-100%);
  animation: landing-scroll-line 2.2s ease-in-out infinite;
}

.landing-purpose,
.landing-story,
.landing-modes,
.landing-glossary-callout,
.landing-final,
.glossary-main {
  width: min(calc(100% - 48px), 1480px);
  margin-inline: auto;
}

.landing-purpose {
  min-height: 64svh;
  display: grid;
  grid-template-columns: minmax(160px, 0.28fr) minmax(0, 1fr);
  align-items: center;
  gap: clamp(30px, 7vw, 120px);
  padding-block: clamp(90px, 12vw, 180px);
  border-top: 1px solid var(--line);
}

.landing-purpose > div {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(260px, 0.75fr);
  align-items: end;
  gap: clamp(28px, 5vw, 80px);
}

.landing-purpose h2 {
  max-width: 930px;
  font-size: clamp(2.7rem, 5.2vw, 6.2rem);
  line-height: 0.97;
}

.landing-purpose > div > p,
.landing-section-head > p:last-child,
.landing-glossary-copy > p {
  margin: 0;
  color: var(--site-ink-soft);
  font-size: 1.02rem;
  line-height: 1.72;
}

.landing-story,
.landing-modes {
  padding-block: clamp(84px, 10vw, 150px);
  border-top: 1px solid var(--line);
}

.landing-section-head {
  display: grid;
  grid-template-columns: minmax(150px, 0.3fr) minmax(0, 1fr) minmax(230px, 0.45fr);
  align-items: end;
  gap: clamp(24px, 4vw, 64px);
  margin-bottom: clamp(56px, 8vw, 110px);
}

.landing-section-head h2 {
  font-size: clamp(2.8rem, 5.4vw, 6.4rem);
  line-height: 0.92;
}

.landing-story-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(320px, 0.65fr);
  gap: clamp(48px, 8vw, 130px);
  align-items: start;
}

.landing-story-sticky {
  position: sticky;
  top: 108px;
  min-width: 0;
}

.landing-story-instrument {
  position: relative;
  min-height: min(68vh, 690px);
  display: grid;
  align-content: center;
  gap: clamp(18px, 2.4vw, 32px);
  padding: clamp(24px, 4vw, 58px);
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: 30px 6px 30px 6px;
  background:
    radial-gradient(circle at 84% 14%, color-mix(in srgb, var(--river-soft) 26%, transparent), transparent 28%),
    color-mix(in srgb, var(--surface-strong) 92%, transparent);
  box-shadow: var(--shadow);
}

.landing-story-instrument::before {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0.54;
  background: repeating-linear-gradient(90deg, transparent 0 7.8%, var(--site-grid-line) 7.8% 8%);
  pointer-events: none;
}

.story-cycle-head,
.story-visual-caption {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.story-cycle-head span,
.story-visual-caption span {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.story-cycle-head strong,
.story-visual-caption strong {
  color: var(--ink);
  font-family: var(--mono);
  font-size: 0.8rem;
}

.story-cycle-head i {
  padding-inline: 7px;
  color: var(--copper);
  font-style: normal;
}

.story-cycle-grid {
  position: relative;
  z-index: 1;
  height: 118px;
  display: grid;
  grid-template-columns: repeat(32, minmax(2px, 1fr));
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: 5px;
  background: color-mix(in srgb, var(--track-surface) 82%, transparent);
}

.story-cycle-grid span {
  position: relative;
  border-right: 1px solid var(--line);
}

.story-cycle-grid span[data-beat] {
  border-left: 3px solid color-mix(in srgb, var(--ink) 50%, transparent);
}

.story-cycle-grid span[data-beat]::before {
  content: attr(data-beat);
  position: absolute;
  top: 9px;
  left: 6px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.68rem;
  font-weight: 800;
}

.story-phrase-layer {
  position: relative;
  z-index: 2;
  height: 70px;
  display: grid;
  grid-template-columns: 6fr 2fr 6fr 2fr 6fr;
  gap: 4px;
  transition: transform 420ms ease;
}

.story-phrase-block,
.story-gap {
  border-radius: 999px;
  transition: opacity 320ms ease, transform 420ms ease, background 320ms ease;
}

.story-phrase-block {
  display: grid;
  place-items: center;
  color: #f6f1e8;
  background: var(--moss);
  font-family: var(--mono);
  font-size: 0.74rem;
  font-weight: 800;
}

.story-gap {
  margin-block: 10px;
  background: var(--copper-soft);
}

.story-landing-pin {
  position: absolute;
  right: 0;
  bottom: -28px;
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--copper);
  font-family: var(--mono);
  font-size: 0.68rem;
  font-weight: 800;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 300ms ease, transform 300ms ease;
}

.story-landing-pin i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--copper);
}

.story-hand-cue {
  position: relative;
  z-index: 1;
  min-height: 132px;
  display: grid;
  grid-template-columns: minmax(100px, 0.42fr) minmax(0, 1fr);
  grid-template-rows: auto auto 1fr;
  align-items: center;
  column-gap: 22px;
  padding: 14px 18px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.story-hand-cue img {
  grid-row: 1 / 4;
  width: 100%;
  max-height: 118px;
  object-fit: contain;
  filter: var(--site-art-filter);
  opacity: 0.82;
  transition: transform 460ms cubic-bezier(0.2, 0.75, 0.22, 1);
}

.story-hand-cue > span {
  align-self: end;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.story-hand-cue > strong {
  align-self: start;
  font-family: var(--display);
  font-size: 1.45rem;
}

.story-hand-cue > div {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}

.story-hand-cue > div i {
  height: 7px;
  border-radius: 999px;
  background: var(--line);
  transition: background 260ms ease, transform 260ms ease;
}

.story-hand-cue > div i.is-active {
  background: var(--river);
  transform: scaleY(1.5);
}

.story-visual-caption {
  align-items: end;
}

.story-visual-caption strong {
  color: var(--river);
}

.landing-story-instrument[data-active-step="1"] .story-phrase-layer {
  transform: scale(1.025);
}

.landing-story-instrument[data-active-step="1"] .story-phrase-block {
  background: color-mix(in srgb, var(--moss) 82%, var(--river));
}

.landing-story-instrument[data-active-step="1"] .story-hand-cue img {
  transform: translateY(-7px) rotate(-3deg);
}

.landing-story-instrument[data-active-step="1"] .story-hand-cue > div i:nth-child(-n+2) {
  background: var(--river);
  transform: scaleY(1.5);
}

.landing-story-instrument[data-active-step="2"] .story-landing-pin {
  opacity: 1;
  transform: translateY(0);
}

.landing-story-instrument[data-active-step="2"] .story-p3 {
  background: var(--copper);
  transform: translateX(3px);
}

.landing-story-instrument[data-active-step="2"] .story-hand-cue img {
  transform: translateY(5px) rotate(2deg);
}

.landing-story-instrument[data-active-step="2"] .story-hand-cue > div i {
  background: var(--river);
  transform: scaleY(1.5);
}

.landing-story-steps {
  display: grid;
}

.landing-story-step {
  min-height: 64vh;
  display: grid;
  align-content: center;
  gap: 18px;
  padding-block: 40px;
  opacity: 0.36;
  transition: opacity 320ms ease, transform 420ms ease;
}

.landing-story-step.is-active {
  opacity: 1;
  transform: translateX(-8px);
}

.landing-story-step > span {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  color: var(--river);
  font-family: var(--mono);
  font-size: 0.72rem;
  font-weight: 800;
}

.landing-story-step h3,
.landing-mode-card h3,
.glossary-card h2,
.glossary-path-card h2 {
  margin: 0;
  font-family: var(--display);
  font-weight: 700;
}

.landing-story-step h3 {
  max-width: 490px;
  font-size: clamp(2rem, 3.4vw, 4.2rem);
  line-height: 0.98;
}

.landing-story-step p {
  max-width: 520px;
  margin: 0;
  color: var(--site-ink-soft);
  font-size: 1rem;
  line-height: 1.72;
}

.landing-mode-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1px;
  border: 1px solid var(--line);
  background: var(--line);
}

.landing-mode-card {
  position: relative;
  min-height: 440px;
  display: grid;
  grid-template-rows: auto 1fr auto auto;
  gap: 26px;
  padding: clamp(24px, 3vw, 46px);
  overflow: hidden;
  background: color-mix(in srgb, var(--surface-strong) 86%, transparent);
}

.landing-mode-number {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.72rem;
}

.landing-mode-mark {
  align-self: center;
  display: flex;
  align-items: end;
  justify-content: center;
  gap: 6px;
  min-height: 138px;
}

.landing-mode-mark i {
  display: block;
  border-radius: 999px;
  background: var(--river);
  transition: transform 400ms ease;
}

.landing-mode-card:hover .landing-mode-mark i {
  transform: translateY(-8px);
}

.landing-mode-mark-tala i {
  width: 15%;
  height: 38%;
}

.landing-mode-mark-tala i:nth-child(2) { height: 82%; background: var(--moss); }
.landing-mode-mark-tala i:nth-child(3) { height: 58%; background: var(--copper); }
.landing-mode-mark-tala i:nth-child(4) { height: 100%; }

.landing-mode-mark-theermanam {
  align-items: center;
}

.landing-mode-mark-theermanam i {
  width: 25%;
  height: 42px;
  background: var(--moss);
}

.landing-mode-mark-theermanam i:nth-child(2) {
  width: 12%;
  height: 16px;
  background: var(--copper-soft);
}

.landing-mode-mark-korvai {
  align-items: center;
}

.landing-mode-mark-korvai i {
  width: 15%;
  height: var(--shape-height, 40px);
  border-radius: 4px;
  background: var(--river);
}

.landing-mode-mark-korvai i:nth-child(1) { --shape-height: 30px; }
.landing-mode-mark-korvai i:nth-child(2) { --shape-height: 48px; background: var(--moss); }
.landing-mode-mark-korvai i:nth-child(3) { --shape-height: 70px; background: var(--copper); }
.landing-mode-mark-korvai i:nth-child(4) { --shape-height: 48px; background: var(--moss); }
.landing-mode-mark-korvai i:nth-child(5) { --shape-height: 30px; }

.landing-mode-card h3 {
  font-size: 2rem;
}

.landing-mode-card p {
  margin: 0;
  color: var(--site-ink-soft);
  line-height: 1.62;
}

.landing-glossary-callout {
  min-height: 72svh;
  display: grid;
  grid-template-columns: minmax(0, 0.8fr) minmax(380px, 1.2fr);
  align-items: center;
  gap: clamp(50px, 9vw, 150px);
  padding-block: clamp(90px, 12vw, 180px);
  border-top: 1px solid var(--line);
}

.landing-glossary-copy {
  display: grid;
  justify-items: start;
  gap: 24px;
}

.landing-glossary-callout h2 {
  font-size: clamp(3rem, 5vw, 6rem);
  line-height: 0.94;
}

.landing-term-stack {
  position: relative;
  min-height: 430px;
  perspective: 1000px;
}

.landing-term-stack > span {
  position: absolute;
  top: calc(var(--term-order) * 82px);
  right: calc(var(--term-order) * 2%);
  left: calc(var(--term-order) * 4%);
  min-height: 128px;
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
  padding: 24px 28px;
  border: 1px solid var(--line-strong);
  border-radius: 6px 26px 6px 26px;
  color: var(--ink);
  background: color-mix(in srgb, var(--surface-strong) 92%, transparent);
  box-shadow: 0 18px 36px rgba(0, 0, 0, 0.08);
  font-family: var(--display);
  font-size: clamp(1.7rem, 3vw, 3rem);
  transform: rotateX(3deg) translateZ(calc(var(--term-order) * 8px));
}

.landing-term-stack small {
  color: var(--muted);
  font-family: var(--ui);
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.landing-final {
  min-height: 78svh;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 34px;
  padding-block: 120px;
  border-top: 1px solid var(--line);
  text-align: center;
}

.landing-final h2 {
  font-size: clamp(3.6rem, 8.5vw, 10rem);
  line-height: 0.83;
}

.builder-header {
  padding-top: clamp(18px, 3vw, 38px);
  border-top: 1px solid var(--line);
}

.motion-ready .reveal {
  opacity: 0;
  transform: translateY(28px);
  transition: opacity 720ms cubic-bezier(0.2, 0.72, 0.2, 1), transform 720ms cubic-bezier(0.2, 0.72, 0.2, 1);
}

.motion-ready .reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.landing-hero-copy .reveal:nth-child(2) { transition-delay: 80ms; }
.landing-hero-copy .reveal:nth-child(3) { transition-delay: 150ms; }
.landing-hero-copy .reveal:nth-child(4) { transition-delay: 220ms; }

@keyframes landing-orbit-turn {
  to { transform: rotate(360deg); }
}

@keyframes landing-hand-strike {
  0%, 18%, 100% { transform: translateY(-22px) rotate(-7deg); }
  38% { transform: translateY(22px) rotate(-1deg); }
  52% { transform: translateY(-5px) rotate(-4deg); }
}

@keyframes landing-contact-pulse {
  0%, 30%, 100% { opacity: 0; box-shadow: 0 0 0 0 color-mix(in srgb, var(--copper) 46%, transparent); }
  38% { opacity: 1; box-shadow: 0 0 0 4px color-mix(in srgb, var(--copper) 30%, transparent); }
  58% { opacity: 0; box-shadow: 0 0 0 22px transparent; }
}

@keyframes landing-scroll-line {
  0% { transform: translateX(-100%); }
  50%, 100% { transform: translateX(100%); }
}

/* Glossary */
.glossary-page {
  position: relative;
  z-index: 1;
  min-height: 100vh;
}

.glossary-hero {
  width: min(calc(100% - 48px), 1480px);
  min-height: 62svh;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 0.58fr);
  align-items: end;
  gap: clamp(40px, 8vw, 130px);
  margin-inline: auto;
  padding-block: clamp(90px, 12vw, 170px) clamp(70px, 9vw, 120px);
  border-bottom: 1px solid var(--line);
}

.glossary-hero-copy {
  display: grid;
  gap: 24px;
}

.glossary-hero h1 {
  max-width: 1000px;
  font-size: clamp(4rem, 9vw, 10rem);
  line-height: 0.82;
}

.glossary-hero h1 em {
  display: block;
  color: var(--river);
  font-weight: inherit;
}

.glossary-hero-copy > p:last-child,
.glossary-hero-aside p {
  max-width: 720px;
  margin: 0;
  color: var(--site-ink-soft);
  font-size: 1.08rem;
  line-height: 1.68;
}

.glossary-hero-aside {
  display: grid;
  gap: 18px;
  padding-left: 24px;
  border-left: 3px solid var(--copper);
}

.glossary-hero-aside strong {
  font-family: var(--display);
  font-size: 1.6rem;
}

.glossary-main {
  padding-block: clamp(60px, 8vw, 120px) 120px;
}

.glossary-path {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 1px;
  margin-bottom: clamp(70px, 9vw, 130px);
  border: 1px solid var(--line);
  background: var(--line);
}

.glossary-path-card {
  position: relative;
  min-height: 210px;
  display: grid;
  align-content: space-between;
  gap: 24px;
  padding: 24px;
  color: var(--ink);
  background: var(--surface-strong);
  text-decoration: none;
}

.glossary-path-card::after {
  content: "";
  position: absolute;
  right: -7px;
  top: 50%;
  z-index: 2;
  width: 12px;
  height: 12px;
  border-top: 1px solid var(--line-strong);
  border-right: 1px solid var(--line-strong);
  background: var(--surface-strong);
  transform: translateY(-50%) rotate(45deg);
}

.glossary-path-card:last-child::after {
  display: none;
}

.glossary-path-card > span {
  color: var(--river);
  font-family: var(--mono);
  font-size: 0.7rem;
  font-weight: 800;
}

.glossary-path-card h2 {
  font-size: 1.55rem;
}

.glossary-path-card p {
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.5;
}

.glossary-browser {
  display: grid;
  gap: 32px;
}

.glossary-browser-head {
  display: grid;
  grid-template-columns: minmax(0, 0.78fr) minmax(320px, 1.22fr);
  align-items: end;
  gap: clamp(32px, 6vw, 100px);
}

.glossary-browser-head h2 {
  margin: 8px 0 0;
  font-family: var(--display);
  font-size: clamp(2.7rem, 5vw, 5.8rem);
  line-height: 0.94;
}

.glossary-tools {
  display: grid;
  gap: 12px;
}

.glossary-search {
  position: relative;
}

.glossary-search label {
  position: absolute;
  top: 50%;
  left: 18px;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  transform: translateY(-50%);
}

.glossary-search input {
  min-height: 58px;
  padding: 10px 18px 10px 108px;
  border-radius: 999px;
  font-size: 16px;
}

.glossary-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.glossary-filter {
  min-height: 38px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: transparent;
  box-shadow: none;
  font-size: 0.78rem;
}

.glossary-filter.is-active {
  border-color: var(--river);
  color: var(--button-ink);
  background: var(--river);
}

.glossary-results-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding-block: 12px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.82rem;
}

.glossary-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.glossary-card {
  scroll-margin-top: 84px;
  min-height: 280px;
  display: grid;
  grid-template-rows: auto auto 1fr auto;
  gap: 16px;
  padding: clamp(22px, 2.5vw, 34px);
  border: 1px solid var(--line);
  border-radius: 5px;
  background: color-mix(in srgb, var(--surface-strong) 82%, transparent);
  transition: border-color 180ms ease, transform 180ms ease, background 180ms ease;
}

.glossary-card:hover {
  border-color: color-mix(in srgb, var(--river) 54%, var(--line));
  transform: translateY(-3px);
}

.glossary-card[hidden] {
  display: none;
}

.glossary-card-category {
  color: var(--river);
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

.glossary-card h2 {
  font-size: 1.75rem;
  line-height: 1;
}

.glossary-card p {
  margin: 0;
  color: var(--site-ink-soft);
  line-height: 1.62;
}

.glossary-card-note {
  align-self: end;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.72rem;
  line-height: 1.5;
}

.glossary-empty {
  min-height: 220px;
  place-items: center;
  padding: 40px;
  border: 1px dashed var(--line-strong);
  color: var(--muted);
  text-align: center;
}

.glossary-empty:not([hidden]) {
  display: grid;
}

.site-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 28px clamp(24px, 5vw, 70px);
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.82rem;
}

.site-footer a {
  color: var(--ink);
  font-weight: 700;
  text-decoration: none;
}

@media (max-width: 1180px) {
  .landing-hero {
    grid-template-columns: minmax(0, 1fr) minmax(360px, 0.82fr);
    gap: 36px;
    padding-inline: clamp(24px, 5vw, 64px);
  }

  .landing-hero h1 {
    font-size: clamp(3.8rem, 7.5vw, 6.2rem);
  }

  .landing-purpose > div {
    grid-template-columns: 1fr;
    align-items: start;
  }

  .landing-section-head {
    grid-template-columns: minmax(130px, 0.25fr) minmax(0, 1fr);
  }

  .landing-section-head > p:last-child {
    grid-column: 2;
  }

  .landing-story-layout {
    grid-template-columns: minmax(0, 1fr) minmax(290px, 0.54fr);
    gap: 44px;
  }

  .landing-story-instrument {
    padding: 28px;
  }

  .glossary-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .glossary-path {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .glossary-path-card:nth-child(3)::after {
    display: none;
  }
}

@media (max-width: 920px) {
  .help-popup {
    top: 76px;
  }
}

@media (max-width: 820px) {
  .site-nav-links > a:first-child {
    display: none;
  }

  .landing-hero {
    min-height: auto;
    grid-template-columns: 1fr;
    gap: 32px;
    padding: 72px 24px 100px;
  }

  .landing-hero-copy {
    gap: 20px;
  }

  .landing-hero h1 {
    font-size: clamp(3.35rem, 13vw, 6rem);
  }

  .landing-hero-visual {
    width: min(100%, 620px);
    justify-self: center;
    aspect-ratio: 1.1;
  }

  .landing-scroll-cue {
    display: none;
  }

  .landing-purpose,
  .landing-story,
  .landing-modes,
  .landing-glossary-callout,
  .landing-final,
  .glossary-main,
  .glossary-hero {
    width: min(calc(100% - 36px), 720px);
  }

  .landing-purpose {
    min-height: auto;
    grid-template-columns: 1fr;
    gap: 24px;
    padding-block: 90px;
  }

  .landing-purpose > div {
    gap: 24px;
  }

  .landing-purpose h2,
  .landing-section-head h2 {
    font-size: clamp(2.75rem, 12vw, 5rem);
  }

  .landing-section-head {
    grid-template-columns: 1fr;
    align-items: start;
    gap: 18px;
    margin-bottom: 48px;
  }

  .landing-section-head > p:last-child {
    grid-column: auto;
  }

  .landing-story-layout {
    grid-template-columns: 1fr;
    gap: 20px;
  }

  .landing-story-sticky {
    position: relative;
    top: auto;
  }

  .landing-story-instrument {
    min-height: auto;
    border-radius: 22px 5px 22px 5px;
  }

  .landing-story-steps {
    gap: 1px;
    border: 1px solid var(--line);
    background: var(--line);
  }

  .landing-story-step {
    min-height: auto;
    padding: 34px 24px;
    opacity: 1;
    background: var(--surface-strong);
  }

  .landing-story-step.is-active {
    transform: none;
  }

  .landing-story-step h3 {
    font-size: 2rem;
  }

  .landing-mode-grid {
    grid-template-columns: 1fr;
  }

  .landing-mode-card {
    min-height: 340px;
    grid-template-columns: auto minmax(0, 1fr);
    grid-template-rows: auto 1fr auto;
    align-items: end;
  }

  .landing-mode-mark {
    grid-column: 1 / -1;
    grid-row: 2;
  }

  .landing-mode-card h3 {
    grid-column: 1;
  }

  .landing-mode-card p {
    grid-column: 2;
  }

  .landing-glossary-callout {
    grid-template-columns: 1fr;
    gap: 54px;
  }

  .landing-term-stack {
    min-height: 390px;
  }

  .glossary-hero {
    min-height: auto;
    grid-template-columns: 1fr;
    align-items: start;
    padding-block: 88px 72px;
  }

  .glossary-browser-head {
    grid-template-columns: 1fr;
    align-items: start;
  }

  .glossary-path {
    grid-template-columns: 1fr;
  }

  .glossary-path-card::after,
  .glossary-path-card:nth-child(3)::after {
    top: auto;
    right: 50%;
    bottom: -7px;
    display: block;
    transform: translateX(50%) rotate(135deg);
  }

  .glossary-path-card:last-child::after {
    display: none;
  }
}

@media (max-width: 560px) {
  .site-nav {
    min-height: 58px;
    gap: 10px;
    padding: 8px 14px;
  }

  .site-brand {
    font-size: 1.08rem;
  }

  .site-brand-mark {
    width: 25px;
    height: 25px;
  }

  .site-nav-links {
    gap: 6px;
  }

  .site-nav-links > a:not(.site-nav-cta) {
    display: none;
  }

  .site-nav-links .site-nav-cta {
    min-height: 40px;
    padding-inline: 12px;
    font-size: 0.76rem;
  }

  .site-theme-toggle {
    min-width: 52px;
    min-height: 40px;
    padding-inline: 9px;
    font-size: 0.76rem;
  }

  .help-popup {
    top: 68px;
  }

  .landing-page::before {
    background-size: 42px 42px;
  }

  .landing-hero {
    padding: 58px 18px 82px;
  }

  .landing-hero h1 {
    font-size: clamp(3.15rem, 16vw, 4.9rem);
    line-height: 0.88;
  }

  .landing-lede {
    font-size: 1rem;
  }

  .landing-actions,
  .landing-primary-action {
    width: 100%;
  }

  .landing-text-action {
    justify-self: center;
  }

  .landing-hero-visual {
    aspect-ratio: 0.94;
  }

  .landing-cycle-orbit {
    inset: 2% -7% 17%;
  }

  .landing-hand-scene {
    width: 100%;
  }

  .landing-phrase-route {
    right: -4%;
    left: -4%;
  }

  .landing-purpose,
  .landing-story,
  .landing-modes,
  .landing-glossary-callout,
  .landing-final,
  .glossary-main,
  .glossary-hero {
    width: calc(100% - 28px);
  }

  .landing-purpose,
  .landing-story,
  .landing-modes,
  .landing-glossary-callout {
    padding-block: 76px;
  }

  .landing-purpose h2,
  .landing-section-head h2,
  .landing-glossary-callout h2 {
    font-size: clamp(2.6rem, 13vw, 4rem);
  }

  .landing-story-instrument {
    gap: 18px;
    padding: 18px 14px 22px;
  }

  .story-cycle-head {
    align-items: start;
    flex-direction: column;
    gap: 5px;
  }

  .story-cycle-grid {
    height: 92px;
  }

  .story-cycle-grid span[data-beat]::before {
    left: 3px;
    font-size: 0.58rem;
  }

  .story-phrase-layer {
    height: 54px;
  }

  .story-hand-cue {
    min-height: 108px;
    grid-template-columns: 92px minmax(0, 1fr);
    padding-inline: 6px;
  }

  .story-hand-cue > strong {
    font-size: 1.2rem;
  }

  .story-visual-caption {
    align-items: start;
    flex-direction: column;
    gap: 5px;
  }

  .landing-mode-card {
    min-height: 320px;
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr auto auto;
    align-items: end;
  }

  .landing-mode-card h3,
  .landing-mode-card p {
    grid-column: 1;
  }

  .landing-term-stack {
    min-height: 330px;
  }

  .landing-term-stack > span {
    top: calc(var(--term-order) * 62px);
    min-height: 104px;
    padding: 18px;
    font-size: 1.65rem;
  }

  .landing-final {
    min-height: 68svh;
    padding-block: 90px;
  }

  .landing-final h2 {
    font-size: clamp(3.4rem, 17vw, 5.7rem);
  }

  .glossary-hero h1 {
    font-size: clamp(3.5rem, 18vw, 6rem);
  }

  .glossary-grid {
    grid-template-columns: 1fr;
  }

  .glossary-card {
    min-height: 250px;
  }

  .glossary-search label {
    position: static;
    display: block;
    margin: 0 0 7px 3px;
    transform: none;
  }

  .glossary-search input {
    padding-left: 16px;
  }

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

@media (prefers-reduced-motion: reduce) {
  .landing-orbit-ticks,
  .landing-hand-upper,
  .landing-contact-pulse,
  .landing-scroll-cue i::after {
    animation: none;
  }

  .motion-ready .reveal,
  .motion-ready .reveal.is-visible,
  .landing-story-step,
  .landing-story-step.is-active {
    opacity: 1;
    transform: none;
    transition: none;
  }
}
