/* ════════════════════════════════════════════ */
/* CHAPTER 1 — DESCENT                         */
/* Scoped styles and effects                   */
/* ════════════════════════════════════════════ */

/* Section spacing */
#chapter-01 .story-section { padding: 80px 0; }
#chapter-01 .story-section:has(+ .story-section) { padding-bottom: 0; }
#chapter-01 .story-section + .story-section { padding-top: 0; }

/* ════════════════════════════════════════════ */
/* EFFECT 1: SOCHEREL EJECTION                  */
/* ════════════════════════════════════════════ */
.ejection-container {
  position: relative;
  overflow: visible;
}
.ejected-word {
  display: inline-block;
  font-weight: 600;
  will-change: transform;
  backface-visibility: hidden;
}
.ejection-gap {
  display: inline-block;
}

/* ════════════════════════════════════════════ */
/* EFFECT 2: FORGE VANISHING                    */
/* ════════════════════════════════════════════ */
.forge-word {
  display: inline;
  transition: opacity 0.4s ease;
}
.forge-first {
  position: relative;
  min-height: 1em;
}
.forge-first.forge-vanished::after {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: linear-gradient(90deg, transparent, var(--shimmer-glow), transparent);
  animation: forge-shimmer 4s ease-in-out infinite;
  pointer-events: none;
}
@keyframes forge-shimmer {
  0%, 100% { opacity: 0.03; transform: translateX(-10%); }
  50% { opacity: 0.08; transform: translateX(10%); }
}
.forge-repeat {
  font-style: italic;
  opacity: 0.92;
}

/* ════════════════════════════════════════════ */
/* EFFECT 3: HUM TREMOR                         */
/* ════════════════════════════════════════════ */
.hum-1 { animation: hum-tremor-1 3s ease-in-out infinite; }
.hum-2 { animation: hum-tremor-2 2.5s ease-in-out infinite; }
.hum-3 { animation: hum-tremor-3 2s ease-in-out infinite; }

@keyframes hum-tremor-1 {
  0%, 100% { transform: translate(0); }
  50% { transform: translate(0.3px, 0); }
}
@keyframes hum-tremor-2 {
  0%, 100% { transform: translate(0); }
  25% { transform: translate(0.5px, 0); }
  75% { transform: translate(-0.4px, 0); }
}
@keyframes hum-tremor-3 {
  0%, 100% { transform: translate(0); }
  15% { transform: translate(0.8px, -0.3px); }
  35% { transform: translate(-0.6px, 0.2px); }
  55% { transform: translate(0.5px, 0.3px); }
  75% { transform: translate(-0.8px, -0.2px); }
}

/* ════════════════════════════════════════════ */
/* EFFECT 4: AIRBORNE FLOAT                     */
/* ════════════════════════════════════════════ */
.airborne-float {
  animation: airborne-drift 4s ease-in-out infinite;
}
@keyframes airborne-drift {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-2.5px); }
}

/* ════════════════════════════════════════════ */
/* EFFECT 5: SALT SLAM                          */
/* ════════════════════════════════════════════ */
.salt-slam {
  font-style: italic;
}
.salt-word {
  display: inline-block;
  will-change: transform, opacity;
  backface-visibility: hidden;
  margin-right: 0.3em;
}
.salt-period {
  letter-spacing: 0.2em;
  font-weight: 600;
}

/* ════════════════════════════════════════════ */
/* EFFECT 6: MECH TERMINAL (CRT)                */
/* ════════════════════════════════════════════ */
.mech-terminal {
  font-family: 'SF Mono', 'Cascadia Code', 'Fira Code', 'Courier New', monospace;
  font-size: 0.78rem;
  line-height: 1.8;
  color: var(--mech-green);
  background: var(--mech-bg);
  padding: 1.5em 2em;
  border-radius: 8px;
  position: relative;
  overflow: hidden;
  margin: 1.5em 0;
  box-shadow:
    inset 0 0 100px rgba(0,0,0,0.7),
    0 0 12px rgba(0,255,65,0.15),
    0 0 30px rgba(0,255,65,0.05);
  text-shadow:
    0 0 4px rgba(0,255,65,0.6),
    0 0 11px rgba(0,255,65,0.25),
    0 0 22px rgba(0,255,65,0.08);
}
.mech-terminal.amber {
  color: var(--mech-amber);
  box-shadow:
    inset 0 0 100px rgba(0,0,0,0.7),
    0 0 12px rgba(255,176,0,0.15),
    0 0 30px rgba(255,176,0,0.05);
  text-shadow:
    0 0 4px rgba(255,176,0,0.6),
    0 0 11px rgba(255,176,0,0.25),
    0 0 22px rgba(255,176,0,0.08);
}
.mech-terminal::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: repeating-linear-gradient(
    to bottom,
    transparent 0px,
    transparent 2px,
    rgba(0,0,0,0.15) 2px,
    rgba(0,0,0,0.15) 4px
  );
  pointer-events: none;
  z-index: 5;
}
.mech-terminal::after {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: radial-gradient(ellipse at center, transparent 45%, rgba(0,0,0,0.4) 100%);
  pointer-events: none;
  z-index: 6;
}
.terminal-scanbar {
  position: absolute;
  top: -8px; left: 0; right: 0;
  height: 8px;
  background: linear-gradient(to bottom, transparent, rgba(0,255,65,0.06), transparent);
  pointer-events: none;
  z-index: 7;
  animation: scanbar-move 4s linear infinite;
}
.mech-terminal.amber .terminal-scanbar {
  background: linear-gradient(to bottom, transparent, rgba(255,176,0,0.06), transparent);
}
@keyframes scanbar-move {
  0% { top: -8px; }
  100% { top: 100%; }
}
.mech-terminal.ready .terminal-line {
  visibility: hidden;
}
.terminal-line {
  min-height: 1.8em;
  position: relative;
  z-index: 2;
}
.terminal-cursor {
  display: none;
  width: 0.55em; height: 1.1em;
  background: var(--mech-green);
  vertical-align: text-bottom;
  animation: cursor-blink 0.8s step-end infinite;
  position: relative;
  z-index: 2;
}
.mech-terminal.amber .terminal-cursor {
  background: var(--mech-amber);
}
.terminal-cursor.active {
  display: inline-block;
}
@keyframes cursor-blink {
  0%, 50% { opacity: 1; }
  51%, 100% { opacity: 0; }
}
.mech-terminal.flicker {
  animation: terminal-flicker 0.2s ease;
}
@keyframes terminal-flicker {
  0% { opacity: 0.3; }
  20% { opacity: 1; }
  40% { opacity: 0.7; }
  60% { opacity: 1; }
  80% { opacity: 0.85; }
  100% { opacity: 1; }
}
.terminal-line.terminal-warning { color: #ff4444; text-shadow: 0 0 4px rgba(255,68,68,0.6), 0 0 11px rgba(255,68,68,0.25); }
@keyframes terminal-bounce {
  0% { transform: translateY(-4px); }
  40% { transform: translateY(1px); }
  70% { transform: translateY(-1.5px); }
  100% { transform: translateY(0); }
}

/* ════════════════════════════════════════════ */
/* EFFECT 7: DREAM STATIC                       */
/* ════════════════════════════════════════════ */
.dream-block {
  position: relative;
  overflow: hidden;
}
.dream-static-canvas {
  position: absolute;
  top: 0; left: 0; width: 100%; height: 100%;
  pointer-events: none;
  mix-blend-mode: overlay;
  opacity: 0;
  z-index: 0;
}
.dream-block .dream-text {
  position: relative;
  z-index: 1;
}
.dream-fade {
  display: inline;
  transition: opacity 2s ease;
}
.dream-fade.fading { opacity: 0; }

/* ════════════════════════════════════════════ */
/* EFFECT 8: BREATHING SEQUENCE                 */
/* ════════════════════════════════════════════ */
.breathing-sequence {
  opacity: 1 !important; transform: translateY(0) !important;
}
.breathing-line {
  opacity: 0; transform: translateY(10px);
}
.breathing-line.revealed {
  opacity: 1; transform: translateY(0);
  transition: opacity 1s ease, transform 0.8s ease;
}

/* ════════════════════════════════════════════ */
/* EFFECT 9: VINYL SKIP                         */
/* ════════════════════════════════════════════ */
.vinyl-skip {
  will-change: transform;
  backface-visibility: hidden;
}
.vinyl-drift-text .drift-char {
  display: inline-block;
  will-change: transform;
  backface-visibility: hidden;
}

/* ════════════════════════════════════════════ */
/* EFFECT 10: LAUGHTER                          */
/* ════════════════════════════════════════════ */
.laughter-block {
  will-change: transform;
}
.fell-apart-words {
  display: inline;
}

/* ════════════════════════════════════════════ */
/* EFFECT 11: DREAM WORD (dissipated)           */
/* ════════════════════════════════════════════ */
.dream-word {
  display: inline-block;
}
@keyframes dream-drift {
  0%, 100% { transform: translate(0, 0); filter: blur(0); opacity: 1; }
  30% { transform: translate(var(--drift-x), var(--drift-y)); filter: blur(0.4px); opacity: 0.85; }
  70% { transform: translate(calc(var(--drift-x) * -0.7), calc(var(--drift-y) * -0.6)); filter: blur(0.2px); opacity: 0.9; }
}
.dream-word.unstable {
  animation: dream-drift 2.5s ease-in-out infinite;
  --drift-x: 2px;
  --drift-y: -1px;
}

/* ════════════════════════════════════════════ */
/* EFFECT 12: EERIE QUESTION                    */
/* ════════════════════════════════════════════ */
.eerie-question {
  display: block;
}
.eerie-segment {
  opacity: 0;
  transition: opacity 1.5s ease;
}
.eerie-segment.visible {
  opacity: 1;
}
.eerie-segment.faded {
  opacity: 0.45;
}
