/* --- w5: server-rack scrollytelling ─────────────────────────────
   Sticky-Pin über 300vh ("scroll wheel lock"-Gefühl ohne Wheel-Hijack).
   rack.js schreibt .is-in/.is-active-Klassen; alles darunter ist
   Compositor-only (transform/opacity). Bei prefers-reduced-motion:
   kein Pin, fertiges statisches Rack. */

#rack-stage {
  height: 300vh;
  position: relative;
}
.rack-sticky {
  position: sticky;
  top: 0;
  height: 100vh;
  height: 100svh;
  overflow: hidden;
  display: flex;
  align-items: stretch;
}
.rack-grid {
  flex: 1;
  display: grid;
  grid-template-columns: minmax(320px, 1fr) minmax(360px, 640px);
  gap: 48px;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 40px;
  align-items: center;
}

/* ── Text-Stufen (links) ─────────────────────────────────────── */
.rack-copy { position: relative; min-height: 340px; }
.rack-step {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 14px;
  opacity: 0;
  transform: translateY(18px);
  transition: opacity var(--dur-morph, 0.45s) ease, transform var(--dur-morph, 0.45s) ease;
  pointer-events: none;
}
.rack-step.is-active { opacity: 1; transform: none; }
.rack-eyebrow {
  font-family: 'Geist Mono', ui-monospace, monospace;
  font-size: 12px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: #8FB5FF; /* helle Akzent-Stufe — 12px-Mono braucht mehr als 4.5:1 */
}
.rack-step h2 {
  font-size: clamp(26px, 3vw, 38px);
  line-height: 1.12;
  margin: 0;
  color: var(--t-ink, #F5F5F7);
  font-weight: 650;
  text-wrap: balance;
}
.rack-step p { margin: 0; max-width: 44ch; color: var(--t-ink-2, #A1A1AA); font-size: 16.5px; line-height: 1.6; }

.rack-progress { position: absolute; left: 0; bottom: 0; display: flex; gap: 8px; }
.rack-progress i {
  width: 28px; height: 3px; border-radius: 2px;
  background: rgba(255,255,255,.12);
  transition: background var(--dur-morph, 0.3s) ease;
}
.rack-progress i.is-active { background: var(--t-accent, #3D7BFF); }

/* ── Rack-Schrank (rechts) ───────────────────────────────────── */
.rack-visual { perspective: 1400px; }
.rack-cabinet {
  position: relative;
  transform: rotateY(-7deg) rotateX(1.5deg);
  transform-style: preserve-3d;
  background: linear-gradient(180deg, #131316, #0C0C0E);
  border: 1px solid rgba(255,255,255,.09);
  border-radius: 10px;
  padding: 26px 30px 0;
  box-shadow:
    -24px 40px 80px rgba(0,0,0,.55),
    inset 0 1px 0 rgba(255,255,255,.05);
  display: flex;
  flex-direction: column;
  gap: 12px;
}
/* Montage-Rails mit U-Löchern */
.rack-rail {
  position: absolute; top: 18px; bottom: 46px; width: 12px;
  background:
    repeating-linear-gradient(180deg,
      transparent 0 6px, rgba(0,0,0,.85) 6px 10px, transparent 10px 22px),
    linear-gradient(90deg, #26262B, #17171A);
  border-radius: 2px;
}
.rack-rail-l { left: 10px; }
.rack-rail-r { right: 10px; }

/* ── Chassis ─────────────────────────────────────────────────── */
.rack-unit {
  position: relative;
  height: 64px;
  border-radius: 5px;
  border: 1px solid rgba(255,255,255,.10);
  border-bottom-color: rgba(0,0,0,.8);
  background:
    linear-gradient(180deg,
      #3A3A41 0%, #232328 8%, #17171B 30%, #121215 70%, #1D1D22 94%, #060607 100%);
  box-shadow: 0 3px 10px rgba(0,0,0,.5), inset 0 1px 0 rgba(255,255,255,.10);
  /* Kein CSS-Transition: rack.js scrubbt transform/opacity direkt am
     Scroll-Fortschritt (AirPods-Stil, rückwärts = Demontage). Ohne JS
     bleiben die Chassis voll sichtbar (Progressive Enhancement). */
  will-change: transform, opacity;
}

/* Griffe links/rechts */
.ru-handle {
  position: absolute; left: 10px; top: 14px; bottom: 14px; width: 9px;
  border: 1.5px solid rgba(255,255,255,.22);
  border-radius: 4px;
  background: linear-gradient(90deg, rgba(255,255,255,.07), transparent);
}
.ru-handle.r { left: auto; right: 10px; }

/* Lüftungsgitter: feine vertikale Schlitze */
.ru-vents {
  position: absolute; left: 32px; top: 12px; bottom: 12px; width: 34%;
  background: repeating-linear-gradient(90deg,
    rgba(0,0,0,.65) 0 2px, rgba(255,255,255,.05) 2px 3px, transparent 3px 6px);
  border-radius: 2px;
  opacity: .8;
}

/* Drive-Bays */
.ru-bays { position: absolute; left: calc(32px + 36%); top: 16px; bottom: 16px; display: flex; gap: 5px; }
.ru-bays i {
  width: 26px; border-radius: 2px;
  background: linear-gradient(180deg, #1C1C21, #101013);
  border: 1px solid rgba(255,255,255,.08);
  position: relative;
}
.ru-bays i::after {
  content: ""; position: absolute; right: 3px; top: 3px; width: 3px; height: 3px;
  border-radius: 50%; background: rgba(61,123,255,.55);
}

/* LEDs */
.ru-leds { position: absolute; right: 34px; top: 50%; transform: translateY(-50%); display: flex; gap: 7px; }
.led { width: 6px; height: 6px; border-radius: 50%; }
.led.ok  { background: #22C55E; box-shadow: 0 0 6px 1px rgba(34,197,94,.65); }
.led.act { background: #FFB020; box-shadow: 0 0 6px 1px rgba(255,176,32,.55); }
.rack-unit.is-in .led.ok  { animation: ledPulse 2.6s ease-in-out infinite; }
.rack-unit.is-in .led.act { animation: ledFlicker 1.1s steps(2, jump-none) infinite; }
.rack-unit[data-u="2"] .led.act { animation-duration: .7s; }
.rack-unit[data-u="3"] .led.act { animation-duration: 1.6s; }
@keyframes ledPulse   { 0%,100% { opacity: 1; } 50% { opacity: .45; } }
@keyframes ledFlicker { 0% { opacity: 1; } 100% { opacity: .25; } }

/* Chassis-Beschriftung */
.ru-label {
  position: absolute; left: 32px; bottom: 6px; right: 60px;
  font-family: 'Geist Mono', ui-monospace, monospace;
  font-size: 11.5px;
  letter-spacing: .04em;
  color: rgba(245,245,247,.92);
  line-height: 1;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* Sockel-Zeile */
.rack-base {
  font-family: 'Geist Mono', ui-monospace, monospace;
  font-size: 10.5px;
  letter-spacing: .12em;
  color: rgba(120,163,255,.95);
  text-align: center;
  padding: 14px 0 16px;
  border-top: 1px solid rgba(255,255,255,.07);
}

/* ── Responsive ──────────────────────────────────────────────── */
@media (max-width: 900px) {
  #rack-stage { height: 220vh; }
  .rack-grid { grid-template-columns: 1fr; gap: 20px; padding: 24px 20px; align-content: center; }
  .rack-copy { min-height: 220px; }
  .rack-cabinet { transform: none; padding: 18px 20px 0; }
  .rack-unit { height: 52px; }
  .ru-label { font-size: 10px; right: 52px; }
  .rack-visual { perspective: none; }
}

/* ── Reduced Motion: kein Pin, fertiges Rack ─────────────────── */
@media (prefers-reduced-motion: reduce) {
  #rack-stage { height: auto; }
  .rack-sticky { position: static; height: auto; overflow: visible; padding: 80px 0; }
  .rack-copy { min-height: 0; display: flex; flex-direction: column; gap: 40px; }
  .rack-step { position: static; opacity: 1; transform: none; }
  .rack-unit { opacity: 1; transform: none; }
  .led.ok, .led.act,
  .rack-unit.is-in .led.ok, .rack-unit.is-in .led.act { animation: none; }
  .rack-progress { display: none; }
}
