/* ============================================================
   MYTHIK ACCELERATOR — Labyrinth identity
   Light build: papyrus ground, terracotta ink, ochre reserved
   for the dark sections. Add class="dark" to any section to
   flip the tokens (used by the Cave).
   ============================================================ */

:root {
  /* Brand constants */
  --terracotta: #b4552d;
  --deep: #8f3f1e;
  --kiln: #221e19;
  --kiln-deep: #17130f;
  --papyrus: #f5ecdd;
  --paper: #fbf6ec;
  --ochre: #e8b44c;
  --clay: #d98e63;
  --olive: #6e7f6b;
  --sand: #efe2cb;
  --stone: #8a7c6a;
  --ash: #b0a48f;

  /* Semantic tokens — LIGHT (default) */
  --bg: #f5ecdd;
  --bg-alt: #efe2cb;
  --surface: #fbf6ec;
  --fg: #221e19;
  --fg-muted: #5c5142;
  --fg-faint: #8a7c6a;
  --accent: #b4552d;
  --accent-hi: #8f3f1e;
  --line: rgba(180, 85, 45, 0.26);
  --line-soft: rgba(180, 85, 45, 0.16);

  /* Type */
  --display: "Cormorant Garamond", "Iowan Old Style", Georgia, serif;
  --body: "Space Grotesk", "Helvetica Neue", Arial, sans-serif;

  /* Rhythm */
  --gutter: clamp(20px, 5vw, 72px);
  --maxw: 1240px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
}

/* Any block that goes dark flips the same tokens */
.dark {
  --bg: #17130f;
  --bg-alt: #221e19;
  --surface: rgba(44, 38, 32, 0.5);
  --fg: #f5ecdd;
  --fg-muted: #b0a48f;
  --fg-faint: #8a7c6a;
  --accent: #e8b44c;
  --accent-hi: #f2cc7a;
  --line: rgba(232, 180, 76, 0.24);
  --line-soft: rgba(232, 180, 76, 0.14);
  background: var(--bg);
  color: var(--fg);
}

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

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--body);
  font-size: 16px;
  line-height: 1.6;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

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

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

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

::selection {
  background: var(--terracotta);
  color: var(--papyrus);
}

::-webkit-scrollbar {
  width: 10px;
}
::-webkit-scrollbar-track {
  background: var(--sand);
}
::-webkit-scrollbar-thumb {
  background: rgba(180, 85, 45, 0.4);
  border-radius: 99px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--terracotta);
}

/* ---------- Typography ---------- */
h1,
h2,
h3,
h4 {
  font-family: var(--display);
  font-weight: 600;
  line-height: 1.03;
  margin: 0;
  letter-spacing: -0.01em;
  color: var(--fg);
}

.h-xl {
  font-size: clamp(2.35rem, 5.6vw, 5.2rem);
}
.h-lg {
  font-size: clamp(2.3rem, 5.6vw, 4.2rem);
}
.h-md {
  font-size: clamp(1.7rem, 3.2vw, 2.6rem);
}
.h-sm {
  font-size: clamp(1.25rem, 2vw, 1.6rem);
}

p {
  margin: 0 0 1em;
}

.lede {
  font-size: clamp(1.02rem, 1.5vw, 1.24rem);
  line-height: 1.65;
  color: var(--fg-muted);
  max-width: 56ch;
}

.eyebrow {
  font-size: 0.68rem;
  letter-spacing: 0.34em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 12px;
}

.eyebrow::before {
  content: "";
  width: 30px;
  height: 1px;
  background: currentColor;
  opacity: 0.55;
}

.serif-italic {
  font-family: var(--display);
  font-style: italic;
  font-weight: 500;
}

.gold {
  color: var(--accent);
}
.terra {
  color: var(--terracotta);
}
/* Terracotta is too close to the ground inside a dark passage */
.dark .terra {
  color: var(--clay);
}

/* ---------- Layout ---------- */
.wrap {
  width: 100%;
  max-width: var(--maxw);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

section {
  position: relative;
}

.section-pad {
  padding-block: clamp(58px, 8vh, 104px);
}

.section-head {
  margin-bottom: clamp(28px, 4vw, 48px);
}

/* ============================================================
   TORCH — a warm pool of light that follows the cursor.
   Multiplies on the papyrus, screens inside dark sections.
   ============================================================ */
.torch {
  position: fixed;
  top: 0;
  left: 0;
  width: 560px;
  height: 560px;
  margin: -280px 0 0 -280px;
  border-radius: 50%;
  pointer-events: none;
  z-index: 3;
  background: radial-gradient(
    circle,
    rgba(232, 180, 76, 0.26) 0%,
    rgba(217, 142, 99, 0.16) 38%,
    rgba(217, 142, 99, 0) 70%
  );
  mix-blend-mode: multiply;
  opacity: 0;
  transition: opacity 0.6s var(--ease);
  will-change: transform;
}

.torch.lit {
  opacity: 1;
}

.torch.over-dark {
  mix-blend-mode: screen;
  background: radial-gradient(
    circle,
    rgba(232, 180, 76, 0.17) 0%,
    rgba(180, 85, 45, 0.1) 34%,
    rgba(180, 85, 45, 0) 70%
  );
}

/* ============================================================
   NAV
   ============================================================ */
.nav {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 18px var(--gutter);
  transition: background 0.45s var(--ease), backdrop-filter 0.45s var(--ease),
    border-color 0.45s var(--ease), padding 0.45s var(--ease);
  border-bottom: 1px solid transparent;
}

.nav.stuck {
  background: rgba(245, 236, 221, 0.86);
  backdrop-filter: blur(14px) saturate(1.15);
  -webkit-backdrop-filter: blur(14px) saturate(1.15);
  border-bottom-color: var(--line);
  padding-block: 12px;
}

.lockup {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--terracotta);
}

.lockup svg {
  overflow: visible;
}

.lockup .mark path {
  stroke-dasharray: 240;
  stroke-dashoffset: 0;
}

.lockup:hover .mark path {
  animation: redraw 1.4s var(--ease-in-out);
}

@keyframes redraw {
  0% {
    stroke-dashoffset: 240;
  }
  100% {
    stroke-dashoffset: 0;
  }
}

.lockup-text {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.lockup-name {
  font-family: var(--display);
  font-size: 1.3rem;
  font-weight: 600;
  letter-spacing: 0.15em;
  line-height: 1;
  color: var(--kiln);
}

.lockup-sub {
  font-size: 0.44rem;
  letter-spacing: 0.36em;
  color: var(--terracotta);
  font-weight: 500;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: clamp(14px, 2.6vw, 34px);
}

.nav-link {
  font-size: 0.82rem;
  letter-spacing: 0.06em;
  color: var(--fg-muted);
  position: relative;
  padding-block: 4px;
  transition: color 0.3s var(--ease);
}

.nav-link::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  width: 100%;
  height: 1px;
  background: var(--terracotta);
  transform: scaleX(0);
  transform-origin: right;
  transition: transform 0.4s var(--ease);
}

.nav-link:hover {
  color: var(--kiln);
}
.nav-link:hover::after {
  transform: scaleX(1);
  transform-origin: left;
}

@media (max-width: 720px) {
  .nav-links .nav-link {
    display: none;
  }
}

/* ---------- Buttons ---------- */
.btn {
  --btn-bg: var(--terracotta);
  --btn-fg: var(--papyrus);
  --btn-hover-bg: var(--kiln);
  --btn-hover-fg: var(--papyrus);
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 14px 26px;
  border: 1px solid transparent;
  border-radius: 3px;
  background: var(--btn-bg);
  color: var(--btn-fg);
  font-size: 0.86rem;
  font-weight: 500;
  letter-spacing: 0.05em;
  cursor: pointer;
  overflow: hidden;
  isolation: isolate;
  transition: transform 0.35s var(--ease), box-shadow 0.35s var(--ease),
    color 0.35s var(--ease);
  will-change: transform;
}

.btn::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: var(--btn-hover-bg);
  transform: translateY(101%);
  transition: transform 0.45s var(--ease);
}

.btn:hover {
  color: var(--btn-hover-fg);
  box-shadow: 0 14px 32px -16px rgba(34, 30, 25, 0.5);
}

.btn:hover::before {
  transform: translateY(0);
}

.btn:active {
  transform: scale(0.97);
}

.btn .arrow {
  transition: transform 0.4s var(--ease);
}
.btn:hover .arrow {
  transform: translateX(5px);
}

.btn-sm {
  padding: 9px 18px;
  font-size: 0.78rem;
}

.btn-lg {
  padding: 19px 38px;
  font-size: 0.95rem;
}

/* Secondary action: solid ink, not an outline */
.btn-ghost {
  --btn-bg: var(--kiln);
  --btn-fg: var(--papyrus);
  --btn-hover-bg: var(--terracotta);
  --btn-hover-fg: var(--papyrus);
  border-color: transparent;
}

/* Buttons sitting on a dark or terracotta ground */
.dark .btn,
.cta .btn {
  --btn-bg: var(--papyrus);
  --btn-fg: var(--kiln);
  --btn-hover-bg: var(--ochre);
  --btn-hover-fg: var(--kiln);
}

/* On the terracotta band, solid ink still reads as the quieter of the two */
.dark .btn-ghost,
.cta .btn-ghost {
  --btn-bg: var(--kiln);
  --btn-fg: var(--papyrus);
  --btn-hover-bg: var(--kiln-deep);
  --btn-hover-fg: var(--ochre);
  border-color: transparent;
}

/* ============================================================
   HERO
   ============================================================ */
.hero {
  position: relative;
  min-height: 100svh;
  display: flex;
  align-items: center;
  overflow: hidden;
  background: var(--papyrus);
}

#maze-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
}

.hero-vignette {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  /* Nearly solid under the copy, clear over the scene on the right. */
  background: linear-gradient(
      100deg,
      rgba(245, 236, 221, 0.99) 0%,
      rgba(245, 236, 221, 0.97) 26%,
      rgba(245, 236, 221, 0.7) 44%,
      rgba(245, 236, 221, 0.12) 62%,
      rgba(245, 236, 221, 0) 74%
    ),
    linear-gradient(to bottom, rgba(245, 236, 221, 0.92) 0%, rgba(245, 236, 221, 0) 20%),
    radial-gradient(ellipse at 82% 62%, rgba(239, 226, 203, 0.3), transparent 62%);
}

@media (max-width: 940px) {
  .hero-vignette {
    background: linear-gradient(
        to bottom,
        rgba(245, 236, 221, 0.96) 0%,
        rgba(245, 236, 221, 0.9) 46%,
        rgba(245, 236, 221, 0.25) 70%,
        rgba(245, 236, 221, 0) 88%
      );
  }
}

.hero-inner {
  position: relative;
  z-index: 4;
  width: 100%;
  max-width: var(--maxw);
  margin-inline: auto;
  padding: 140px var(--gutter) 110px;
}

.hero-eyebrow {
  opacity: 0;
  transform: translateY(14px);
  animation: rise 1s var(--ease) 0.25s forwards;
}

.hero h1 {
  margin: 22px 0 0;
  max-width: 17ch;
  text-wrap: balance;
}

.hero h1 .line {
  display: block;
  overflow: hidden;
  padding-bottom: 0.1em;
  margin-bottom: -0.1em;
}

.hero h1 .line > span {
  display: block;
  transform: translateY(110%);
  animation: slideUp 1.15s var(--ease) forwards;
}

.hero h1 .line:nth-child(1) > span {
  animation-delay: 0.4s;
}
.hero h1 .line:nth-child(2) > span {
  animation-delay: 0.52s;
}
.hero h1 .line:nth-child(3) > span {
  animation-delay: 0.64s;
}

@keyframes slideUp {
  to {
    transform: translateY(0);
  }
}

@keyframes rise {
  to {
    opacity: 1;
    transform: none;
  }
}

.hero-sub {
  margin-top: 30px;
  max-width: 46ch;
  color: var(--fg-muted);
  font-size: clamp(1rem, 1.4vw, 1.18rem);
  opacity: 0;
  transform: translateY(16px);
  animation: rise 1s var(--ease) 0.95s forwards;
}

.hero-cta {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 40px;
  opacity: 0;
  transform: translateY(16px);
  animation: rise 1s var(--ease) 1.1s forwards;
}

.hero-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 30px;
  margin-top: 52px;
  font-size: 0.76rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--fg-muted);
  opacity: 0;
  animation: rise 1.2s var(--ease) 1.35s forwards;
}

.hero-meta span {
  display: inline-flex;
  align-items: center;
  gap: 9px;
}

.hero-meta span::before {
  content: "";
  width: 5px;
  height: 5px;
  background: var(--terracotta);
  transform: rotate(45deg);
}

.scroll-cue {
  position: absolute;
  left: 50%;
  bottom: 26px;
  z-index: 5;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  font-size: 0.6rem;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--fg-faint);
  opacity: 0;
  animation: rise 1s var(--ease) 1.7s forwards;
}

.scroll-cue .rail {
  width: 1px;
  height: 54px;
  background: linear-gradient(to bottom, rgba(180, 85, 45, 0.45), transparent);
  position: relative;
  overflow: hidden;
}

.scroll-cue .rail::after {
  content: "";
  position: absolute;
  top: -60%;
  left: 0;
  width: 100%;
  height: 60%;
  background: var(--terracotta);
  animation: drip 2.2s var(--ease-in-out) infinite;
}

@keyframes drip {
  0% {
    top: -60%;
  }
  100% {
    top: 110%;
  }
}

/* ============================================================
   MEANDER (Greek key) MARQUEE
   ============================================================ */
.meander-band {
  position: relative;
  overflow: hidden;
  border-block: 1px solid var(--line);
  background: var(--bg-alt);
  padding-block: 15px;
}

.meander-track {
  display: flex;
  width: max-content;
  animation: slide-left 34s linear infinite;
}

.meander-band.reverse .meander-track {
  animation-direction: reverse;
}

.meander-track svg {
  flex: none;
  opacity: 0.9;
}

@keyframes slide-left {
  from {
    transform: translateX(0);
  }
  to {
    transform: translateX(-50%);
  }
}

/* Word marquee */
.word-marquee {
  display: flex;
  width: max-content;
  align-items: center;
  animation: slide-left 44s linear infinite;
}

.word-marquee .item {
  display: inline-flex;
  align-items: center;
  gap: clamp(20px, 3vw, 44px);
  padding-right: clamp(20px, 3vw, 44px);
  font-family: var(--display);
  font-size: clamp(1.5rem, 3.2vw, 2.6rem);
  font-weight: 600;
  color: var(--kiln);
  white-space: nowrap;
}

.word-marquee .item .dot {
  width: 7px;
  height: 7px;
  background: var(--terracotta);
  transform: rotate(45deg);
  flex: none;
}

.word-marquee .item.hollow {
  color: transparent;
  -webkit-text-stroke: 1px rgba(180, 85, 45, 0.7);
}

/* ============================================================
   REVEAL SYSTEM
   ============================================================ */
[data-reveal] {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.9s var(--ease), transform 0.9s var(--ease);
}

[data-reveal="left"] {
  transform: translateX(-34px);
}
[data-reveal="scale"] {
  transform: scale(0.94);
}

[data-reveal].in {
  opacity: 1;
  transform: none;
}

/* Draw-on icons */
.icon-draw path,
.icon-draw circle,
.icon-draw line,
.icon-draw polyline,
.icon-draw rect,
.icon-draw polygon {
  stroke-dasharray: var(--len, 400);
  stroke-dashoffset: var(--len, 400);
  transition: stroke-dashoffset 1.5s var(--ease-in-out);
}

.in .icon-draw path,
.in .icon-draw circle,
.in .icon-draw line,
.in .icon-draw polyline,
.in .icon-draw rect,
.in .icon-draw polygon,
.icon-draw.drawn path,
.icon-draw.drawn circle,
.icon-draw.drawn line,
.icon-draw.drawn polyline,
.icon-draw.drawn rect,
.icon-draw.drawn polygon {
  stroke-dashoffset: 0;
}

/* ============================================================
   THE CAVE — the one dark passage
   ============================================================ */
.cave {
  position: relative;
  overflow: hidden;
}

/* Torch-lit falloff at the top and bottom edges so the dark
   section reads as a passage you walk into and back out of. */
.cave::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(
    ellipse at 68% 42%,
    rgba(180, 85, 45, 0.16),
    transparent 60%
  );
}

.cave > * {
  position: relative;
  z-index: 1;
}

.cave-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: clamp(30px, 6vw, 90px);
  align-items: start;
}

@media (max-width: 900px) {
  .cave-grid {
    grid-template-columns: 1fr;
  }
}

.cave-sticky {
  position: sticky;
  top: 14vh;
  align-self: start;
}

@media (max-width: 900px) {
  .cave-sticky {
    position: relative;
    top: 0;
  }
}

.cave-stage {
  position: relative;
  border: 1px solid rgba(232, 180, 76, 0.3);
  border-radius: 4px;
  overflow: hidden;
  background: #1a1610;
  aspect-ratio: 4 / 3;
}

.cave-stage svg {
  width: 100%;
  height: 100%;
}

.cave-stage .stage-label {
  position: absolute;
  left: 16px;
  bottom: 14px;
  font-size: 0.6rem;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--stone);
  z-index: 3;
}

.cave-stage .stage-label b {
  color: var(--ochre);
  font-weight: 500;
}

/* Three diagrams, one visible per beat, driven by [data-stage] */
.sig {
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 0.7s var(--ease), transform 0.7s var(--ease);
}

[data-stage="0"] .sig-0,
[data-stage="1"] .sig-1,
[data-stage="2"] .sig-2 {
  opacity: 1;
  transform: none;
}

/* I · Team — signal running the ring */
.orbit {
  animation: orbit 11s linear infinite;
  transform-origin: 240px 194px;
}

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

.node-pulse {
  animation: node-pulse 3.4s ease-in-out infinite;
}

@keyframes node-pulse {
  0%,
  100% {
    opacity: 0.5;
  }
  50% {
    opacity: 1;
  }
}

/* II · Product — modules assemble */
.mod {
  stroke-dasharray: 260;
  stroke-dashoffset: 260;
  transition: stroke-dashoffset 0.8s var(--ease-in-out);
}

[data-stage="1"] .mod {
  stroke-dashoffset: 0;
}

.mod-fill {
  opacity: 0;
  transition: opacity 0.7s var(--ease);
}

[data-stage="1"] .mod-fill {
  opacity: 1;
}

/* III · Traction — ground taken and held */
.glow {
  animation: glow 5.6s ease-in-out infinite;
}

@keyframes glow {
  0%,
  100% {
    opacity: 0.55;
  }
  50% {
    opacity: 0.95;
  }
}

/* Light travelling across the face of the shield.
   The skew/rotate lives on the parent <g> — a CSS transform here would
   replace an SVG transform="" attribute rather than compose with it. */
.shimmer {
  animation: shimmer 6s var(--ease-in-out) infinite;
}

@keyframes shimmer {
  0% {
    transform: translateX(-60px);
  }
  46% {
    transform: translateX(380px);
  }
  100% {
    transform: translateX(380px);
  }
}

.pt-live {
  animation: node-pulse 2.6s ease-in-out infinite;
}

.cave-beats {
  display: flex;
  flex-direction: column;
  gap: clamp(60px, 14vh, 150px);
  padding-block: clamp(20px, 8vh, 90px);
}

.beat {
  position: relative;
  border-left: 1px solid var(--line);
  padding-left: clamp(20px, 3vw, 34px);
  opacity: 0.5;
  transform: translateX(-6px);
  transition: opacity 0.65s var(--ease), transform 0.75s var(--ease),
    border-color 0.6s var(--ease);
}

/* A rail of light runs down the active beat */
.beat::before {
  content: "";
  position: absolute;
  left: -1.5px;
  top: 0;
  width: 2.5px;
  height: 100%;
  background: linear-gradient(
    to bottom,
    var(--ochre) 0%,
    var(--ochre) 55%,
    rgba(232, 180, 76, 0) 100%
  );
  transform: scaleY(0);
  transform-origin: top;
  transition: transform 0.85s var(--ease);
}

.beat.active {
  opacity: 1;
  transform: none;
}

.beat.active::before {
  transform: scaleY(1);
}

.beat .num {
  font-family: var(--display);
  font-size: 0.9rem;
  letter-spacing: 0.3em;
  color: var(--clay);
  display: block;
  margin-bottom: 14px;
  opacity: 0.6;
  transform: translateY(5px);
  transition: opacity 0.6s var(--ease), transform 0.6s var(--ease),
    color 0.6s var(--ease);
}

/* …and a rule draws out from the numeral */
.beat .num::after {
  content: "";
  display: inline-block;
  vertical-align: middle;
  width: 0;
  height: 1px;
  margin-left: 12px;
  background: var(--ochre);
  transition: width 0.9s var(--ease) 0.12s;
}

.beat.active .num {
  opacity: 1;
  transform: none;
  color: var(--ochre);
}

.beat.active .num::after {
  width: 38px;
}

.beat h3 {
  margin-bottom: 8px;
  transform: translateY(7px);
  transition: transform 0.75s var(--ease), color 0.6s var(--ease);
}

.beat.active h3 {
  transform: none;
}

.beat p {
  color: var(--fg-muted);
  max-width: 46ch;
  font-size: 0.94rem;
  margin-bottom: 0;
  transform: translateY(7px);
  transition: transform 0.8s var(--ease) 0.06s, color 0.6s var(--ease);
}

.beat.active p {
  transform: none;
  color: var(--sand);
}

.beat .pull {
  font-family: var(--display);
  font-style: italic;
  font-size: 1.15rem;
  color: var(--sand);
  border-top: 1px solid var(--line);
  padding-top: 16px;
  margin-top: 22px;
}

.beat .pull cite {
  display: block;
  font-family: var(--body);
  font-style: normal;
  font-size: 0.66rem;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--fg-faint);
  margin-top: 10px;
}

/* ============================================================
   SECTION HEADS
   ============================================================ */
.section-head {
  display: flex;
  flex-wrap: wrap;
  gap: 26px 60px;
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: clamp(40px, 6vw, 74px);
}

.section-head h2 {
  max-width: 18ch;
}

/* ============================================================
   THESIS CARDS
   ============================================================ */
.thesis {
  background: var(--papyrus);
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
}

.card {
  position: relative;
  background: var(--papyrus);
  padding: clamp(28px, 3vw, 42px);
  overflow: hidden;
  transition: color 0.5s var(--ease);
  min-height: 300px;
  display: flex;
  flex-direction: column;
}

.card::after {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--kiln);
  transform: translateY(100%);
  transition: transform 0.6s var(--ease);
  z-index: 0;
}

.card:hover::after {
  transform: translateY(0);
}

.card > * {
  position: relative;
  z-index: 1;
}

.card:hover {
  color: var(--papyrus);
}

.card:hover h3 {
  color: var(--papyrus);
}

.card .card-icon {
  margin-bottom: 26px;
}

.card .card-icon svg {
  width: 52px;
  height: 52px;
  stroke: var(--terracotta);
  transition: stroke 0.5s var(--ease), transform 0.6s var(--ease);
}

.card:hover .card-icon svg {
  stroke: var(--ochre);
  transform: translateY(-4px) rotate(-4deg);
}

.card h3 {
  margin-bottom: 12px;
  transition: color 0.5s var(--ease);
}

.card p {
  font-size: 0.93rem;
  color: var(--fg-muted);
  transition: color 0.5s var(--ease);
  margin-bottom: 0;
}

.card:hover p {
  color: var(--ash);
}

.card .card-index {
  margin-top: auto;
  padding-top: 24px;
  font-size: 0.64rem;
  letter-spacing: 0.28em;
  color: var(--fg-faint);
}

/* ============================================================
   STATS BAND
   ============================================================ */
.stats {
  background: var(--terracotta);
  color: var(--papyrus);
  position: relative;
  overflow: hidden;
}

.stats h2,
.stats .value {
  color: var(--papyrus);
}

.stats .bg-mark {
  position: absolute;
  right: -90px;
  top: -110px;
  opacity: 0.16;
  pointer-events: none;
  animation: spin-slow 70s linear infinite;
}

@keyframes spin-slow {
  to {
    transform: rotate(360deg);
  }
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: clamp(28px, 4vw, 54px);
  position: relative;
}

.stat .value {
  font-family: var(--display);
  font-size: clamp(2.6rem, 5.4vw, 4.4rem);
  font-weight: 600;
  line-height: 1;
  display: flex;
  align-items: baseline;
  gap: 2px;
}

.stat .label {
  margin-top: 12px;
  font-size: 0.72rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: rgba(245, 236, 221, 0.76);
}

/* ============================================================
   THE LABYRINTH — programme stages
   ============================================================ */
.program {
  background: var(--sand);
  overflow: hidden;
}

.thread-wrap {
  position: relative;
  margin-top: clamp(30px, 5vw, 60px);
}

.thread-svg {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
  overflow: visible;
}

.thread-svg path {
  fill: none;
  stroke: var(--terracotta);
  stroke-width: 2;
  stroke-linecap: round;
  filter: drop-shadow(0 1px 3px rgba(180, 85, 45, 0.35));
}

.stages {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  gap: clamp(22px, 4vw, 40px);
}

.stage {
  display: grid;
  grid-template-columns: 86px 1fr auto;
  gap: clamp(18px, 3vw, 36px);
  align-items: center;
  padding: clamp(22px, 3vw, 34px) clamp(18px, 3vw, 34px);
  border: 1px solid var(--line);
  background: rgba(251, 246, 236, 0.78);
  backdrop-filter: blur(6px);
  transition: transform 0.5s var(--ease), border-color 0.5s var(--ease),
    background 0.5s var(--ease), box-shadow 0.5s var(--ease);
}

.stage:hover {
  transform: translateX(10px);
  border-color: rgba(180, 85, 45, 0.55);
  background: var(--paper);
  box-shadow: 0 18px 40px -28px rgba(34, 30, 25, 0.6);
}

@media (max-width: 760px) {
  .stage {
    grid-template-columns: 60px 1fr;
  }
  .stage .stage-meta {
    grid-column: 1 / -1;
  }
}

.stage-icon {
  width: 66px;
  height: 66px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(180, 85, 45, 0.4);
  border-radius: 50%;
  position: relative;
  flex: none;
  background: var(--paper);
}

.stage-icon svg {
  width: 32px;
  height: 32px;
  stroke: var(--terracotta);
}

.stage-icon::after {
  content: "";
  position: absolute;
  inset: -7px;
  border: 1px solid rgba(180, 85, 45, 0.22);
  border-radius: 50%;
  transform: scale(0.8);
  opacity: 0;
  transition: transform 0.6s var(--ease), opacity 0.6s var(--ease);
}

.stage:hover .stage-icon::after {
  transform: scale(1);
  opacity: 1;
}

.stage h3 {
  margin-bottom: 8px;
}

.stage p {
  margin: 0;
  color: var(--fg-muted);
  font-size: 0.93rem;
  max-width: 60ch;
}

.stage-meta {
  font-size: 0.66rem;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--fg-faint);
  white-space: nowrap;
}

/* ============================================================
   TERMS
   ============================================================ */
.terms {
  background: var(--papyrus);
}

.terms-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
}

.term {
  background: var(--papyrus);
  padding: clamp(24px, 3vw, 38px);
  transition: background 0.5s var(--ease);
}

.term:hover {
  background: var(--paper);
}

.term svg {
  width: 30px;
  height: 30px;
  stroke: var(--terracotta);
  margin-bottom: 20px;
}

.term h4 {
  font-size: 1.22rem;
  margin-bottom: 8px;
}

.term p {
  font-size: 0.88rem;
  color: var(--fg-muted);
  margin: 0;
}

/* ============================================================
   PANTHEON
   ============================================================ */
.pantheon {
  background: var(--sand);
  overflow: hidden;
}

/* ============================================================
   CTA BAND
   ============================================================ */
.cta {
  position: relative;
  background: var(--terracotta);
  color: var(--papyrus);
  text-align: center;
  overflow: hidden;
}

.cta h2 {
  color: var(--papyrus);
  max-width: 20ch;
  margin-inline: auto;
}

.cta .eyebrow {
  color: #f2d3bb;
}

.cta .lede {
  color: #f0cdb5;
  margin-inline: auto;
  margin-top: 22px;
}

#cta-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0.55;
  z-index: 0;
}

.cta .wrap {
  position: relative;
  z-index: 2;
}

.cta .cta-actions {
  margin-top: 40px;
  display: flex;
  justify-content: center;
  gap: 14px;
  flex-wrap: wrap;
}

.cta-note {
  margin-top: 26px;
  font-size: 0.7rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: #eec2a6;
}

/* ============================================================
   FOOTER
   ============================================================ */
.footer {
  background: var(--papyrus);
  border-top: 1px solid var(--line);
  padding-block: clamp(48px, 7vw, 78px) 34px;
}

.footer-top {
  display: flex;
  flex-wrap: wrap;
  gap: 40px;
  justify-content: space-between;
  align-items: flex-start;
}

.footer-quote {
  font-family: var(--display);
  font-size: clamp(1.5rem, 3vw, 2.3rem);
  max-width: 16ch;
  color: var(--kiln);
}

.footer-cols {
  display: flex;
  gap: clamp(30px, 6vw, 80px);
  flex-wrap: wrap;
}

.footer-col h5 {
  font-size: 0.64rem;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--terracotta);
  margin: 0 0 16px;
  font-weight: 500;
  font-family: var(--body);
}

.footer-col a {
  display: block;
  font-size: 0.88rem;
  color: var(--fg-muted);
  padding-block: 5px;
  transition: color 0.3s var(--ease), transform 0.3s var(--ease);
}

.footer-col a:hover {
  color: var(--terracotta);
  transform: translateX(4px);
}

.footer-bottom {
  margin-top: clamp(40px, 6vw, 64px);
  padding-top: 24px;
  border-top: 1px solid var(--line-soft);
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  justify-content: space-between;
  font-size: 0.74rem;
  color: var(--fg-faint);
}

/* ============================================================
   APPLY PAGE
   ============================================================ */
.apply-page {
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  background: var(--papyrus);
}

#apply-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  opacity: 0.6;
}

.apply-shell {
  position: relative;
  z-index: 2;
  flex: 1;
  display: flex;
  align-items: center;
  padding: 120px var(--gutter) 70px;
}

.apply-card {
  width: 100%;
  max-width: 860px;
  margin-inline: auto;
  background: rgba(251, 246, 236, 0.94);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: clamp(28px, 4.4vw, 56px);
  box-shadow: 0 40px 90px -50px rgba(34, 30, 25, 0.55);
}

.apply-head {
  margin-bottom: 34px;
}

.apply-head h1 {
  font-size: clamp(2rem, 4.4vw, 3.1rem);
  margin: 16px 0 12px;
}

.apply-head p {
  color: var(--fg-muted);
  max-width: 52ch;
  margin: 0;
}

/* Progress */
.progress {
  display: flex;
  align-items: center;
  gap: 0;
  margin-bottom: 36px;
}

.progress .node {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: none;
}

.progress .dot {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  font-size: 0.7rem;
  color: var(--fg-faint);
  transition: all 0.45s var(--ease);
  flex: none;
}

.progress .node.done .dot {
  background: var(--terracotta);
  border-color: var(--terracotta);
  color: var(--papyrus);
}

.progress .node.current .dot {
  border-color: var(--terracotta);
  color: var(--terracotta);
  box-shadow: 0 0 0 4px rgba(180, 85, 45, 0.12);
}

.progress .node .name {
  font-size: 0.68rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--fg-faint);
  transition: color 0.4s var(--ease);
}

.progress .node.current .name {
  color: var(--terracotta);
}

@media (max-width: 700px) {
  .progress .node .name {
    display: none;
  }
}

.progress .link {
  flex: 1;
  height: 1px;
  background: var(--line);
  margin: 0 12px;
  position: relative;
  overflow: hidden;
}

.progress .link::after {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--terracotta);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.6s var(--ease);
}

.progress .link.filled::after {
  transform: scaleX(1);
}

/* Steps */
.step {
  display: none;
}

.step.active {
  display: block;
  animation: stepIn 0.55s var(--ease);
}

@keyframes stepIn {
  from {
    opacity: 0;
    transform: translateX(24px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.step-title {
  font-family: var(--display);
  font-size: clamp(1.5rem, 2.6vw, 2rem);
  font-weight: 600;
  margin-bottom: 6px;
}

.step-hint {
  color: var(--fg-faint);
  font-size: 0.86rem;
  margin-bottom: 28px;
}

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}

@media (max-width: 620px) {
  .field-row {
    grid-template-columns: 1fr;
  }
}

.field {
  margin-bottom: 18px;
  position: relative;
}

.field label {
  display: block;
  font-size: 0.66rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--terracotta);
  margin-bottom: 9px;
}

.field input,
.field textarea,
.field select {
  width: 100%;
  background: #fffdf8;
  border: 1px solid var(--line);
  border-radius: 3px;
  padding: 14px 16px;
  color: var(--kiln);
  font-size: 0.95rem;
  transition: border-color 0.35s var(--ease), box-shadow 0.35s var(--ease);
  outline: none;
}

.field textarea {
  min-height: 128px;
  resize: vertical;
  line-height: 1.6;
}

.field select {
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--terracotta) 50%),
    linear-gradient(135deg, var(--terracotta) 50%, transparent 50%);
  background-position: calc(100% - 20px) 22px, calc(100% - 14px) 22px;
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
}

.field input:focus,
.field textarea:focus,
.field select:focus {
  border-color: var(--terracotta);
  box-shadow: 0 0 0 3px rgba(180, 85, 45, 0.14);
}

.field input::placeholder,
.field textarea::placeholder {
  color: #a89b88;
}

.field.invalid input,
.field.invalid textarea,
.field.invalid select {
  border-color: #c2482a;
  box-shadow: 0 0 0 3px rgba(194, 72, 42, 0.13);
}

.field .err {
  font-size: 0.72rem;
  color: #a83c20;
  margin-top: 7px;
  display: none;
}

.field.invalid .err {
  display: block;
}

.counter {
  position: absolute;
  right: 2px;
  top: 0;
  font-size: 0.64rem;
  letter-spacing: 0.14em;
  color: var(--fg-faint);
}

/* Choice chips */
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.chip {
  border: 1px solid var(--line);
  background: #fffdf8;
  color: var(--fg-muted);
  border-radius: 99px;
  padding: 10px 18px;
  font-size: 0.83rem;
  cursor: pointer;
  transition: all 0.35s var(--ease);
}

.chip:hover {
  border-color: var(--terracotta);
  color: var(--kiln);
  transform: translateY(-2px);
}

.chip.selected {
  background: var(--terracotta);
  border-color: var(--terracotta);
  color: var(--papyrus);
}

.step-actions {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  margin-top: 34px;
  padding-top: 26px;
  border-top: 1px solid var(--line);
}

.btn-back {
  --btn-bg: transparent;
  --btn-fg: var(--fg-faint);
  --btn-hover-bg: rgba(34, 30, 25, 0.06);
  --btn-hover-fg: var(--kiln);
  border: 1px solid var(--line);
}

.btn-back:hover {
  box-shadow: none;
}

/* Review list */
.review-list {
  border: 1px solid var(--line);
  border-radius: 4px;
  overflow: hidden;
}

.review-row {
  display: grid;
  grid-template-columns: 190px 1fr;
  gap: 16px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line-soft);
  font-size: 0.9rem;
}

.review-row:last-child {
  border-bottom: 0;
}

.review-row dt {
  font-size: 0.66rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--fg-faint);
  padding-top: 3px;
}

.review-row dd {
  margin: 0;
  color: var(--kiln);
  overflow-wrap: anywhere;
}

@media (max-width: 620px) {
  .review-row {
    grid-template-columns: 1fr;
    gap: 5px;
  }
}

/* Success */
.success {
  display: none;
  text-align: center;
  padding-block: 20px;
}

.success.show {
  display: block;
  animation: stepIn 0.7s var(--ease);
}

.success .seal {
  width: 116px;
  height: 116px;
  margin: 0 auto 30px;
}

.success .seal path,
.success .seal circle {
  stroke-dasharray: 500;
  stroke-dashoffset: 500;
  animation: draw-seal 2s var(--ease-in-out) 0.2s forwards;
}

@keyframes draw-seal {
  to {
    stroke-dashoffset: 0;
  }
}

.success h2 {
  margin-bottom: 14px;
}

.success p {
  color: var(--fg-muted);
  max-width: 46ch;
  margin-inline: auto;
}

/* ============================================================
   HERO — split layout with the shield medallion
   ============================================================ */
.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 0.92fr) minmax(0, 1.08fr);
  gap: clamp(24px, 4vw, 56px);
  align-items: center;
}

@media (max-width: 940px) {
  .hero-grid {
    grid-template-columns: 1fr;
    gap: 30px;
  }
  .hero-scene {
    max-width: 560px;
    margin-inline: auto;
  }

  /* Once it stacks, stop forcing three lines — let the headline flow,
     otherwise short words get stranded on lines of their own. */
  .hero h1 {
    max-width: 22ch;
    margin-top: 18px;
  }
  .hero h1 .line,
  .hero h1 .line > span {
    display: inline;
    overflow: visible;
    transform: none;
    animation: none;
    padding: 0;
    margin: 0;
  }
  .hero-inner {
    padding-block: 112px 64px;
  }
  .hero-sub {
    margin-top: 22px;
  }
  .hero-cta {
    margin-top: 28px;
  }
  .trust-line {
    margin-top: 22px;
    gap: 8px 16px;
    font-size: 0.72rem;
  }
  .hero {
    min-height: auto;
  }
  .scroll-cue {
    display: none;
  }
}

@media (max-width: 560px) {
  .hero-cta .btn {
    flex: 1 1 100%;
    justify-content: center;
  }
}

/* ---------- The horse at the gates ---------- */
.hero-scene {
  position: relative;
  width: 100%;
  opacity: 0;
  animation: rise 1.3s var(--ease) 0.65s forwards;
}

.hero-scene svg {
  width: 100%;
  height: auto;
  overflow: visible;
}

/* Smoke rolling up from behind the walls */
.smoke {
  animation: smoke 11s ease-in-out infinite;
  transform-origin: center bottom;
  opacity: 0;
}
.smoke.s2 {
  animation-duration: 14s;
  animation-delay: -3.5s;
}
.smoke.s3 {
  animation-duration: 9.5s;
  animation-delay: -7s;
}
.smoke.s4 {
  animation-duration: 16s;
  animation-delay: -11s;
}

@keyframes smoke {
  0% {
    transform: translate(0, 26px) scale(0.72);
    opacity: 0;
  }
  18% {
    opacity: 0.5;
  }
  70% {
    opacity: 0.26;
  }
  100% {
    transform: translate(-26px, -128px) scale(1.5);
    opacity: 0;
  }
}

/* Embers lifting off the braziers */
.ember {
  animation: ember 6s linear infinite;
  opacity: 0;
}
.ember.e2 {
  animation-duration: 7.5s;
  animation-delay: -2s;
}
.ember.e3 {
  animation-duration: 5.2s;
  animation-delay: -4s;
}
.ember.e4 {
  animation-duration: 8s;
  animation-delay: -6s;
}

@keyframes ember {
  0% {
    transform: translate(0, 0) scale(1);
    opacity: 0;
  }
  12% {
    opacity: 0.95;
  }
  100% {
    transform: translate(-16px, -104px) scale(0.35);
    opacity: 0;
  }
}

/* Storm cloud drift */
.cloud {
  animation: cloud 34s ease-in-out infinite;
}
.cloud.c2 {
  animation-duration: 46s;
  animation-delay: -12s;
}
.cloud.c3 {
  animation-duration: 40s;
  animation-delay: -24s;
  animation-direction: reverse;
}

@keyframes cloud {
  0%,
  100% {
    transform: translateX(0);
  }
  50% {
    transform: translateX(26px);
  }
}

/* The sun burning through behind the line */
.backlight {
  animation: backlight 6.5s var(--ease-in-out) infinite;
  transform-origin: 268px 214px;
}

@keyframes backlight {
  0%,
  100% {
    opacity: 0.82;
    transform: scale(1);
  }
  50% {
    opacity: 1;
    transform: scale(1.06);
  }
}

/* ---------- The warship ---------- */
/* One stroke period drives the oars and the rowers together. */
.ship {
  animation: ship-bob 6.5s ease-in-out infinite;
  transform-origin: 400px 380px;
}

@keyframes ship-bob {
  0%,
  100% {
    transform: translateY(-6px) rotate(-0.75deg);
  }
  50% {
    transform: translateY(6px) rotate(0.75deg);
  }
}

.oar {
  animation: oar 2.6s ease-in-out infinite;
}

@keyframes oar {
  0%,
  100% {
    transform: rotate(-14deg);
  }
  50% {
    transform: rotate(12deg);
  }
}

.rower {
  animation: row 2.6s ease-in-out infinite;
}

@keyframes row {
  0%,
  100% {
    transform: translateX(3px) rotate(7deg);
  }
  50% {
    transform: translateX(-3px) rotate(-7deg);
  }
}

.sail-bil {
  animation: sail 7.5s ease-in-out infinite;
  transform-origin: 430px 152px;
}

@keyframes sail {
  0%,
  100% {
    transform: skewX(0deg) scaleX(1);
  }
  50% {
    transform: skewX(-2.4deg) scaleX(1.035);
  }
}

.swell {
  animation: swell 13s ease-in-out infinite;
}
.swell.w2 {
  animation-duration: 17s;
  animation-direction: reverse;
}
.swell.w3 {
  animation-duration: 21s;
  animation-delay: -6s;
}

@keyframes swell {
  0%,
  100% {
    transform: translateX(0);
  }
  50% {
    transform: translateX(-26px);
  }
}

.foam {
  animation: foam 3.4s ease-in-out infinite;
}
.foam.f-b {
  animation-duration: 4.6s;
  animation-delay: -1.5s;
}

@keyframes foam {
  0%,
  100% {
    opacity: 0.45;
    transform: translateY(0) scaleX(1);
  }
  50% {
    opacity: 0.9;
    transform: translateY(-3px) scaleX(1.05);
  }
}

/* Capes and pennants caught in the wind */
.cape {
  animation: cape 4.4s ease-in-out infinite;
}
.cape.k2 {
  animation-duration: 5.6s;
  animation-delay: -1.5s;
}
.cape.k3 {
  animation-duration: 6.3s;
  animation-delay: -3.2s;
}

@keyframes cape {
  0%,
  100% {
    transform: skewX(0deg) scaleX(1);
  }
  50% {
    transform: skewX(-7deg) scaleX(1.06);
  }
}

/* Going over the edge */
.fall {
  animation: fall 5.5s ease-in infinite;
  opacity: 0;
}
.fall.f2 {
  animation-duration: 7s;
  animation-delay: -2.4s;
}
.fall.f3 {
  animation-duration: 6.2s;
  animation-delay: -4.1s;
}
.fall.f4 {
  animation-duration: 8s;
  animation-delay: -6.3s;
}

@keyframes fall {
  0% {
    transform: translate(0, -26px) rotate(-8deg);
    opacity: 0;
  }
  14% {
    opacity: 1;
  }
  78% {
    opacity: 1;
  }
  100% {
    transform: translate(-46px, 190px) rotate(-104deg);
    opacity: 0;
  }
}

/* Debris kicked off the lip */
.shard {
  animation: shard 4.4s linear infinite;
  opacity: 0;
}
.shard.d2 {
  animation-duration: 5.8s;
  animation-delay: -1.9s;
}
.shard.d3 {
  animation-duration: 3.9s;
  animation-delay: -3.1s;
}

@keyframes shard {
  0% {
    transform: translate(0, 0) rotate(0deg);
    opacity: 0;
  }
  15% {
    opacity: 0.9;
  }
  100% {
    transform: translate(-30px, 168px) rotate(180deg);
    opacity: 0;
  }
}

/* Spears shifting in the ranks */
.rank-bob {
  animation: rank-bob 4.6s ease-in-out infinite;
}
.rank-bob.r2 {
  animation-duration: 5.8s;
  animation-delay: -1.4s;
}
.rank-bob.r3 {
  animation-duration: 6.6s;
  animation-delay: -2.9s;
}

@keyframes rank-bob {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-2.5px);
  }
}

/* Gate mouth glow */
.gate-glow {
  animation: gate-glow 4.2s ease-in-out infinite;
  transform-origin: 622px 470px;
}

@keyframes gate-glow {
  0%,
  100% {
    opacity: 0.5;
    transform: scale(1);
  }
  50% {
    opacity: 0.85;
    transform: scale(1.08);
  }
}

.birds {
  animation: birds 26s linear infinite;
}

@keyframes birds {
  0% {
    transform: translate(0, 0);
  }
  50% {
    transform: translate(60px, -16px);
  }
  100% {
    transform: translate(0, 0);
  }
}

.hero .hero-inner {
  padding-block: 132px 88px;
}

/* ============================================================
   SHIELD WALL
   ============================================================ */
.shields {
  background: var(--bg-alt);
}

.shield-wall {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(168px, 1fr));
  gap: clamp(14px, 2vw, 26px);
}

.shield {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 12px;
  padding: 20px 12px 22px;
  border: 1px solid transparent;
  border-radius: 4px;
  transition: background 0.45s var(--ease), border-color 0.45s var(--ease),
    transform 0.45s var(--ease);
}

.shield:hover {
  background: var(--paper);
  border-color: var(--line);
  transform: translateY(-6px);
}

.shield .disc {
  width: clamp(88px, 12vw, 124px);
  height: clamp(88px, 12vw, 124px);
  /* colour is inherited into the <use> shadow tree, so the rim can react */
  color: rgba(180, 85, 45, 0.75);
  transition: transform 0.7s var(--ease), color 0.45s var(--ease);
}

.shield:hover .disc {
  transform: rotate(-8deg) scale(1.05);
  color: var(--terracotta);
}

.shield h3 {
  font-size: clamp(1.05rem, 1.6vw, 1.32rem);
  letter-spacing: 0.02em;
}

.shield p {
  margin: 0;
  font-size: 0.82rem;
  line-height: 1.5;
  color: var(--fg-muted);
  max-width: 22ch;
}

.shield .rank {
  font-size: 0.58rem;
  letter-spacing: 0.3em;
  color: var(--fg-faint);
}

/* ============================================================
   PUZZLE — rotating maze tiles
   ============================================================ */
.puzzle {
  background: var(--papyrus);
}

.puzzle-grid {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 0;
  border: 1px solid var(--line);
  background: var(--line);
  max-width: 100%;
  overflow: hidden;
  border-radius: 4px;
}

@media (max-width: 860px) {
  .puzzle-grid {
    grid-template-columns: repeat(5, 1fr);
  }
}

@media (max-width: 520px) {
  .puzzle-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

.tile {
  aspect-ratio: 1;
  background: var(--paper);
  border: 0;
  padding: 0;
  cursor: pointer;
  display: grid;
  place-items: center;
  outline-offset: -3px;
  transition: background 0.35s var(--ease);
}

.tile:hover {
  background: var(--sand);
}

.tile svg {
  width: 100%;
  height: 100%;
  transition: transform 0.5s var(--ease);
  stroke: var(--terracotta);
  stroke-width: 6;
  fill: none;
}

.tile.solved svg {
  stroke: var(--deep);
}

.tile.solved {
  background: #f7e9d5;
}

.puzzle-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-top: 18px;
  font-size: 0.72rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--fg-faint);
}

.puzzle-foot b {
  color: var(--terracotta);
  font-weight: 500;
}

/* ============================================================
   THE CAVE — compact
   ============================================================ */
.cave-beats {
  gap: clamp(26px, 4vh, 44px);
  padding-block: 0;
}

/* ============================================================
   THE VOYAGE — sea chart
   ============================================================ */
.voyage {
  background: var(--bg-alt);
  overflow: hidden;
}

.chart {
  position: relative;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: linear-gradient(180deg, #f7efe2 0%, #efe2cb 100%);
  overflow: hidden;
}

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

.wave {
  animation: wave-drift 9s ease-in-out infinite;
}
.wave:nth-of-type(2n) {
  animation-duration: 11s;
  animation-direction: reverse;
}

@keyframes wave-drift {
  0%,
  100% {
    transform: translateX(0);
  }
  50% {
    transform: translateX(14px);
  }
}

#route-drawn {
  stroke-dasharray: var(--route-len, 2000);
  stroke-dashoffset: var(--route-len, 2000);
}

.port-label {
  font-family: var(--body);
  font-size: 11px;
  letter-spacing: 2.6px;
  text-transform: uppercase;
  fill: #6b5a45;
}

.port-num {
  font-family: var(--display);
  font-size: 15px;
  font-weight: 600;
  fill: var(--papyrus);
}

.port {
  cursor: default;
  transition: opacity 0.5s var(--ease);
}

.port .isle {
  transition: fill 0.5s var(--ease), transform 0.5s var(--ease);
}

.port.reached .isle {
  fill: var(--terracotta);
}

.port.reached .port-label {
  fill: var(--kiln);
}

.legs {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(158px, 1fr));
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
  border-top: 0;
}

.leg {
  background: var(--papyrus);
  padding: 18px 16px 20px;
  transition: background 0.45s var(--ease);
}

.leg:hover,
.leg.reached {
  background: var(--paper);
}

.leg .leg-num {
  font-family: var(--display);
  font-size: 0.78rem;
  letter-spacing: 0.3em;
  color: var(--terracotta);
  display: block;
  margin-bottom: 8px;
}

.leg h4 {
  font-size: 1.12rem;
  margin-bottom: 6px;
}

.leg p {
  margin: 0;
  font-size: 0.8rem;
  line-height: 1.5;
  color: var(--fg-muted);
}

.leg .leg-when {
  display: block;
  margin-top: 10px;
  font-size: 0.58rem;
  letter-spacing: 0.26em;
  text-transform: uppercase;
  color: var(--fg-faint);
}

/* ---------- Chart motion ---------- */
/* Marching ants along the leg that hasn't been sailed yet */
.ants {
  animation: ants 2.4s linear infinite;
}

@keyframes ants {
  to {
    stroke-dashoffset: -26;
  }
}

/* NOTE: a CSS transform replaces an SVG transform="" attribute outright, so
   anything animated must sit in its own group with the translate on the parent. */
.rose-spin {
  animation: spin-slow 150s linear infinite;
  transform-origin: 0 0;
}

/* The hull lifts and heels while it sails */
.ship-lift {
  animation: ship-lift 3.4s ease-in-out infinite;
}

@keyframes ship-lift {
  0%,
  100% {
    transform: translateY(-3px) rotate(-2.5deg);
  }
  50% {
    transform: translateY(3px) rotate(2.5deg);
  }
}

.sail-luff {
  animation: sail-luff 2.8s ease-in-out infinite;
  transform-origin: 16px 14px;
}

@keyframes sail-luff {
  0%,
  100% {
    transform: scaleX(1);
  }
  50% {
    transform: scaleX(0.86);
  }
}

/* Wake shed behind the hull */
.trail {
  animation: trail 1.8s linear infinite;
}
.trail.t2 {
  animation-delay: -0.6s;
}
.trail.t3 {
  animation-delay: -1.2s;
}

@keyframes trail {
  0% {
    transform: translateX(0);
    opacity: 0.8;
  }
  100% {
    transform: translateX(-46px);
    opacity: 0;
  }
}

/* Landfall reached — a ping goes out */
.port .ping {
  opacity: 0;
}

.port.reached .ping {
  animation: ping 2.6s var(--ease-in-out) infinite;
}

@keyframes ping {
  0% {
    transform: scale(0.7);
    opacity: 0.65;
  }
  70% {
    opacity: 0;
  }
  100% {
    transform: scale(2.4);
    opacity: 0;
  }
}

.port .isle,
.port circle {
  transition: fill 0.5s var(--ease);
}

.gulls {
  animation: gulls 30s linear infinite;
}

@keyframes gulls {
  0% {
    transform: translate(0, 0);
  }
  50% {
    transform: translate(90px, -12px);
  }
  100% {
    transform: translate(0, 0);
  }
}

/* ============================================================
   TERM TILES — compact
   ============================================================ */
.terms-grid {
  grid-template-columns: repeat(auto-fit, minmax(168px, 1fr));
}

.term {
  padding: clamp(18px, 2.2vw, 26px);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.term svg {
  width: 26px;
  height: 26px;
  margin-bottom: 12px;
}

.term h4 {
  font-size: 1.12rem;
  margin-bottom: 2px;
}

.term p {
  font-size: 0.8rem;
  line-height: 1.45;
}

/* ============================================================
   STATS — tighter
   ============================================================ */
.stats {
  padding-block: clamp(40px, 5vw, 62px);
}

/* ============================================================
   TRUST LINE
   ============================================================ */
.trust-line {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 22px;
  margin-top: 28px;
  font-size: 0.76rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--fg-muted);
  opacity: 0;
  animation: rise 1.2s var(--ease) 1.3s forwards;
}

.trust-line span {
  display: inline-flex;
  align-items: center;
  gap: 9px;
}

.trust-line span::before {
  content: "";
  width: 5px;
  height: 5px;
  background: var(--terracotta);
  transform: rotate(45deg);
  flex: none;
}

/* ============================================================
   SPLIT TEXT BLOCK
   ============================================================ */
.split {
  display: grid;
  grid-template-columns: minmax(0, 0.92fr) minmax(0, 1.08fr);
  gap: clamp(26px, 5vw, 72px);
  align-items: start;
}

@media (max-width: 860px) {
  .split {
    grid-template-columns: 1fr;
  }
}

.split .body p {
  color: var(--fg-muted);
  font-size: 1rem;
  max-width: 58ch;
}

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

.pull-rule {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 22px 0;
}

/* Three signals, spelled out — one full-width row, evenly divided */
.about-foot {
  margin-top: clamp(30px, 4vw, 48px);
}

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

.mini-fact {
  background: var(--bg);
  padding: clamp(20px, 2.6vw, 30px) clamp(16px, 2vw, 28px);
  display: flex;
  flex-direction: column;
  gap: 2px;
  transition: background 0.45s var(--ease);
}

.mini-fact:hover {
  background: var(--paper);
}

.mf-num {
  font-family: var(--display);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.26em;
  color: var(--terracotta);
  margin-bottom: 14px;
}

.mini-fact svg {
  width: 30px;
  height: 30px;
  stroke: var(--terracotta);
  margin-bottom: 16px;
}

.mini-fact span:last-child {
  display: block;
  font-family: var(--display);
  font-size: clamp(1.1rem, 1.6vw, 1.35rem);
  font-weight: 600;
  line-height: 1.2;
  color: var(--kiln);
  max-width: 14ch;
}

@media (max-width: 620px) {
  .mini-facts {
    grid-template-columns: 1fr;
  }
}

/* ============================================================
   TERMS TABLE
   ============================================================ */
.term-table {
  border: 1px solid var(--line);
  border-radius: 4px;
  overflow: hidden;
  background: var(--paper);
}

.term-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 16px;
  align-items: baseline;
  padding: 15px clamp(16px, 2.4vw, 26px);
  border-bottom: 1px solid var(--line-soft);
  transition: background 0.4s var(--ease);
}

.term-row:last-child {
  border-bottom: 0;
}

.term-row:hover {
  background: var(--sand);
}

.term-row dt {
  font-size: 0.68rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--fg-faint);
}

.term-row dd {
  margin: 0;
  font-family: var(--display);
  font-size: clamp(1.25rem, 2.2vw, 1.7rem);
  font-weight: 600;
  color: var(--kiln);
  line-height: 1.1;
}

/* ============================================================
   NOTE CARD — the application-fee explainer
   ============================================================ */
.note-card {
  border: 1px solid var(--line);
  border-left: 3px solid var(--terracotta);
  border-radius: 4px;
  background: var(--paper);
  padding: clamp(20px, 3vw, 30px);
}

.note-card h4 {
  font-size: 1.2rem;
  margin-bottom: 10px;
}

.note-card p {
  font-size: 0.9rem;
  color: var(--fg-muted);
  margin-bottom: 0.8em;
}

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

.note-card .seal-mini {
  width: 30px;
  height: 30px;
  stroke: var(--terracotta);
  fill: none;
  margin-bottom: 14px;
}

/* ============================================================
   FAQ
   ============================================================ */
.faq {
  background: var(--bg-alt);
}

.faq-list {
  border-top: 1px solid var(--line);
}

.faq-item {
  border-bottom: 1px solid var(--line);
}

.faq-item summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  padding: 20px 4px;
  font-family: var(--display);
  font-size: clamp(1.12rem, 1.9vw, 1.42rem);
  font-weight: 600;
  color: var(--kiln);
  transition: color 0.35s var(--ease);
}

.faq-item summary::-webkit-details-marker {
  display: none;
}

.faq-item summary:hover {
  color: var(--terracotta);
}

.faq-item .sign {
  flex: none;
  width: 22px;
  height: 22px;
  margin-top: 6px;
  position: relative;
}

.faq-item .sign::before,
.faq-item .sign::after {
  content: "";
  position: absolute;
  inset: 50% 0 auto 0;
  height: 1.5px;
  background: var(--terracotta);
  transition: transform 0.4s var(--ease);
}

.faq-item .sign::after {
  transform: rotate(90deg);
}

.faq-item[open] .sign::after {
  transform: rotate(0deg);
}

.faq-item .answer {
  padding: 0 4px 24px;
  max-width: 68ch;
  color: var(--fg-muted);
  font-size: 0.94rem;
  animation: faqIn 0.45s var(--ease);
}

.faq-item .answer p {
  margin-bottom: 0;
}

@keyframes faqIn {
  from {
    opacity: 0;
    transform: translateY(-6px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

/* ============================================================
   SECTOR MARQUEE
   ============================================================ */
.sectors {
  background: var(--papyrus);
  overflow: hidden;
}

/* ============================================================
   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;
  }
  [data-reveal] {
    opacity: 1 !important;
    transform: none !important;
  }
  .hero h1 .line > span {
    transform: none;
  }
  .hero-eyebrow,
  .hero-sub,
  .hero-cta,
  .hero-meta,
  .scroll-cue {
    opacity: 1 !important;
    transform: none !important;
  }
  .torch {
    display: none;
  }
  /* Smoke animates from opacity 0, so hold it visible when motion is off */
  .smoke {
    opacity: 0.4 !important;
  }
  .ember {
    opacity: 0 !important;
  }
  .hero-scene {
    opacity: 1 !important;
  }
}
