* {
  box-sizing: border-box;
}

:root {
  --ladder-bg: #0f1712;
  --ladder-surface: #17231b;
  --ladder-surface-2: #1d2b22;
  --ladder-ink: #f3f5ee;
  --ladder-muted: rgba(232, 235, 226, 0.68);
  --ladder-soft: rgba(232, 235, 226, 0.10);
  --ladder-rule: rgba(169, 200, 163, 0.22);
  --ladder-sage: #a9c8a3;
  --ladder-green: #6f9a68;
  --ladder-gold: #c9a44a;
  --ladder-amber: #b98432;
  --ladder-cosmos: #315e74;
  --ladder-black: #09100c;
  --footer-bg: #1a1a1a;
  --footer-text: #dde5dd;
}

html {
  background: var(--ladder-bg);
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ladder-ink);
  background:
    linear-gradient(180deg, rgba(15, 23, 18, 0.98), rgba(9, 16, 12, 1)),
    repeating-linear-gradient(90deg, rgba(169, 200, 163, 0.026) 0 1px, transparent 1px 120px);
  font-family: Inter, var(--sans), system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
}

.ladder-shell {
  width: min(1220px, calc(100% - 32px));
  margin: 0 auto;
  padding: 78px 0 64px;
}

.ladder-hero {
  max-width: 900px;
  margin-bottom: 28px;
}

.eyebrow,
.micro-label {
  margin: 0;
  color: var(--ladder-gold);
  font-family: "Courier New", var(--mono), monospace;
  font-size: 0.78rem;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2 {
  font-family: "Playfair Display", Georgia, serif;
  letter-spacing: 0;
}

h1 {
  max-width: 980px;
  margin: 12px 0 0;
  font-size: clamp(2.15rem, 4.6vw, 4.25rem);
  line-height: 1;
}

.lede {
  max-width: 760px;
  margin: 18px 0 0;
  color: var(--ladder-muted);
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.08rem, 2vw, 1.38rem);
}

.ladder-lab {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  grid-template-areas:
    "prologue panel"
    "visual panel";
  gap: 18px;
  align-items: stretch;
}

.prologue,
.ladder-visual,
.scene-panel,
.control-panel,
.step-panel {
  border: 1px solid var(--ladder-rule);
  border-radius: 8px;
  background: rgba(249, 251, 249, 0.045);
  box-shadow: 0 18px 54px rgba(0, 0, 0, 0.18);
}

.prologue {
  grid-area: prologue;
  padding: 18px 20px;
}

.prologue h2 {
  margin: 6px 0 6px;
  font-size: clamp(1.45rem, 2.6vw, 2rem);
  line-height: 1.08;
}

.prologue p {
  max-width: 760px;
  margin: 0;
  color: var(--ladder-muted);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.03rem;
}

.visual-stack {
  grid-area: visual;
  display: grid;
  gap: 6px;
}

.ladder-visual {
  position: relative;
  min-height: 250px;
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(23, 35, 27, 0.96), rgba(10, 16, 12, 0.98)),
    repeating-linear-gradient(0deg, transparent 0 39px, rgba(169, 200, 163, 0.035) 40px);
}

.unit-ribbon {
  position: absolute;
  top: 16px;
  left: 16px;
  z-index: 4;
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 7px 11px;
  border: 1px solid rgba(201, 164, 74, 0.40);
  border-radius: 999px;
  background: rgba(9, 16, 12, 0.78);
  color: var(--ladder-gold);
  font-family: "Courier New", var(--mono), monospace;
  font-size: 0.78rem;
  backdrop-filter: blur(8px);
}

.rail-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.rail-base,
.rail-complete,
.rail-active-segment,
.handoff-line {
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.rail-base {
  stroke: rgba(232, 235, 226, 0.14);
  stroke-width: 7;
}

.rail-complete {
  stroke: rgba(169, 200, 163, 0.55);
  stroke-width: 7;
}

.rail-active-segment {
  stroke: var(--ladder-gold);
  stroke-width: 9;
  filter: drop-shadow(0 0 12px rgba(201, 164, 74, 0.34));
}

.handoff-line {
  opacity: 0;
  stroke: var(--ladder-gold);
  stroke-width: 4;
  stroke-dasharray: 12 14;
  filter: drop-shadow(0 0 16px rgba(201, 164, 74, 0.55));
  transition: opacity 0.18s ease;
}

.handoff-line.is-visible {
  opacity: 1;
  animation: handoff-dash 0.6s ease-out both;
}

.step-marks {
  position: absolute;
  inset: 0;
  z-index: 3;
  margin: 0;
  padding: 0;
  list-style: none;
}

.step-mark {
  position: absolute;
  transform: translate(-50%, -50%);
}

.step-mark button {
  display: grid;
  grid-template-columns: 28px max-content;
  gap: 8px;
  align-items: center;
  max-width: 190px;
  padding: 6px 8px 6px 6px;
  border: 1px solid rgba(232, 235, 226, 0.13);
  border-radius: 999px;
  background: rgba(9, 16, 12, 0.76);
  color: rgba(232, 235, 226, 0.62);
  cursor: pointer;
  font: inherit;
  font-size: 0.78rem;
  line-height: 1.1;
  text-align: left;
  transition: border-color 0.18s ease, background-color 0.18s ease, color 0.18s ease, transform 0.18s ease;
  backdrop-filter: blur(8px);
}

.step-mark button:hover,
.step-mark button:focus-visible {
  border-color: rgba(201, 164, 74, 0.72);
  color: var(--ladder-ink);
  outline: 0;
}

.step-mark button:focus-visible {
  box-shadow: 0 0 0 3px rgba(201, 164, 74, 0.26);
}

.step-number {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(232, 235, 226, 0.11);
  color: inherit;
  font-family: "Courier New", var(--mono), monospace;
  font-size: 0.78rem;
}

.step-name {
  min-width: 0;
  overflow-wrap: anywhere;
}

.step-mark.is-past button {
  border-color: rgba(169, 200, 163, 0.42);
  background: rgba(74, 103, 65, 0.20);
  color: rgba(232, 235, 226, 0.82);
}

.step-mark.is-past .step-number {
  background: rgba(169, 200, 163, 0.22);
  color: var(--ladder-sage);
}

.step-mark.is-active button {
  border-color: rgba(201, 164, 74, 0.88);
  background: rgba(201, 164, 74, 0.15);
  color: var(--ladder-ink);
  transform: translateY(-2px);
}

.step-mark.is-active .step-number {
  background: var(--ladder-gold);
  color: var(--ladder-black);
}

.bridge-slot {
  display: flex;
  align-items: stretch;
  min-height: 38px;
}

.bridge-note {
  width: 100%;
  max-width: none;
  min-height: 36px;
  padding: 8px 11px;
  border: 1px solid rgba(201, 164, 74, 0.42);
  border-radius: 8px;
  background: rgba(9, 16, 12, 0.86);
  color: var(--ladder-ink);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 0.92rem;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.bridge-note.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.scene-panel {
  min-height: 286px;
  overflow: hidden;
  background: #101914;
}

.method-scene {
  min-height: 286px;
}

.scene-svg {
  display: block;
  width: 100%;
  height: 286px;
}

.scene-bg {
  fill: #101914;
}

.scene-rule {
  stroke: rgba(169, 200, 163, 0.18);
  stroke-width: 1;
}

.sage-fill {
  fill: var(--ladder-sage);
}

.green-fill {
  fill: var(--ladder-green);
}

.gold-fill {
  fill: var(--ladder-gold);
}

.cosmos-fill {
  fill: var(--ladder-cosmos);
}

.muted-fill {
  fill: rgba(232, 235, 226, 0.34);
}

.dark-fill {
  fill: #0a100c;
}

.sage-stroke {
  stroke: var(--ladder-sage);
}

.gold-stroke {
  stroke: var(--ladder-gold);
}

.cosmos-stroke {
  stroke: var(--ladder-cosmos);
}

.muted-stroke {
  stroke: rgba(232, 235, 226, 0.36);
}

.thin {
  stroke-width: 2;
}

.medium {
  stroke-width: 4;
}

.thick {
  stroke-width: 7;
}

.scene-text {
  fill: rgba(232, 235, 226, 0.74);
  font-family: "Courier New", var(--mono), monospace;
  font-size: 14px;
  letter-spacing: 0;
}

.scene-title {
  fill: var(--ladder-ink);
  font-family: "Playfair Display", Georgia, serif;
  font-size: 24px;
}

.pulse-star {
  transform-origin: center;
  animation: pulse-star 2.2s ease-in-out infinite;
}

.venus-dot {
  animation: venus-transit 4.8s ease-in-out infinite;
}

.parallax-target {
  animation: parallax-shift 2.8s ease-in-out infinite;
}

.supernova-core {
  transform-origin: center;
  animation: supernova-flash 3.4s ease-in-out infinite;
}

.spectrum-shift {
  animation: spectrum-shift 3.8s ease-in-out infinite;
}

.control-panel {
  padding: 16px 20px 18px;
}

.control-panel label {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
  color: var(--ladder-ink);
  font-weight: 700;
}

.control-panel label span {
  color: var(--ladder-sage);
  font-family: "Courier New", var(--mono), monospace;
  font-size: 0.86rem;
  font-weight: 400;
}

.control-panel input[type="range"] {
  width: 100%;
  accent-color: var(--ladder-gold);
}

.range-caption {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-top: 8px;
  color: var(--ladder-muted);
  font-family: "Courier New", var(--mono), monospace;
  font-size: 0.72rem;
  text-transform: uppercase;
}

.range-caption span:nth-child(2),
.range-caption span:nth-child(3) {
  text-align: center;
}

.range-caption span:last-child {
  text-align: right;
}

.step-panel {
  grid-area: panel;
  align-self: stretch;
  padding: 24px;
}

.step-panel h2 {
  margin: 8px 0 8px;
  font-size: clamp(2rem, 3vw, 3rem);
  line-height: 1;
}

.distance {
  margin: 0 0 18px;
  color: var(--ladder-sage);
  font-family: "Courier New", var(--mono), monospace;
  font-size: clamp(1rem, 2.4vw, 1.45rem);
}

.step-facts {
  display: grid;
  gap: 10px;
  margin: 0 0 20px;
}

.step-facts div {
  padding: 12px;
  border: 1px solid rgba(232, 235, 226, 0.10);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.14);
}

.step-facts dt {
  margin-bottom: 3px;
  color: var(--ladder-muted);
  font-family: "Courier New", var(--mono), monospace;
  font-size: 0.72rem;
  text-transform: uppercase;
}

.step-facts dd {
  margin: 0;
  color: var(--ladder-ink);
  font-weight: 700;
}

.step-copy,
.step-bridge {
  margin: 0;
  color: var(--ladder-muted);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.05rem;
}

.step-bridge {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid rgba(201, 164, 74, 0.24);
  color: var(--ladder-ink);
}

.step-bridge::before {
  content: "Entrega";
  display: block;
  margin-bottom: 5px;
  color: var(--ladder-gold);
  font-family: "Courier New", var(--mono), monospace;
  font-size: 0.72rem;
  text-transform: uppercase;
}

@keyframes handoff-dash {
  from {
    stroke-dashoffset: 52;
  }
  to {
    stroke-dashoffset: 0;
  }
}

@keyframes pulse-star {
  0%,
  100% {
    transform: scale(0.94);
    opacity: 0.68;
  }
  50% {
    transform: scale(1.08);
    opacity: 1;
  }
}

@keyframes venus-transit {
  0%,
  100% {
    transform: translateX(-72px);
  }
  50% {
    transform: translateX(72px);
  }
}

@keyframes parallax-shift {
  0%,
  100% {
    transform: translateX(-10px);
  }
  50% {
    transform: translateX(10px);
  }
}

@keyframes supernova-flash {
  0%,
  72%,
  100% {
    transform: scale(0.82);
    opacity: 0.66;
  }
  82% {
    transform: scale(1.36);
    opacity: 1;
  }
}

@keyframes spectrum-shift {
  0%,
  100% {
    transform: translateX(-8px);
  }
  50% {
    transform: translateX(22px);
  }
}

@media (max-width: 1040px) {
  .ladder-lab {
    grid-template-columns: 1fr;
    grid-template-areas:
      "prologue"
      "visual"
      "panel";
  }

  .step-panel {
    padding: 22px;
  }

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

@media (max-width: 760px) {
  .ladder-shell {
    width: min(100% - 24px, 1220px);
    padding-top: 84px;
  }

  .ladder-hero {
    margin-bottom: 22px;
  }

  .ladder-lab,
  .visual-stack {
    gap: 14px;
  }

  .prologue,
  .control-panel,
  .step-panel {
    padding: 16px;
  }

  .ladder-visual {
    min-height: 220px;
  }

  .step-mark button {
    grid-template-columns: 26px;
    padding: 5px;
  }

  .step-number {
    width: 26px;
    height: 26px;
  }

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

  .bridge-note {
    font-size: 0.9rem;
  }

  .scene-panel,
  .method-scene {
    min-height: 260px;
  }

  .scene-svg {
    height: 260px;
  }

  .step-facts {
    grid-template-columns: 1fr;
  }

  .range-caption {
    gap: 6px;
    font-size: 0.62rem;
  }
}

@media (max-width: 460px) {
  .control-panel label {
    display: block;
  }

  .control-panel label span {
    display: block;
    margin-top: 3px;
  }

  .unit-ribbon {
    max-width: calc(100% - 32px);
    white-space: normal;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}
