/* ════════════════════════════════════════════════════ */
/* CHAPTER 08 — ПАВЕЛ                                    */
/* Scoped under #chapter-08                              */
/* ════════════════════════════════════════════════════ */

#chapter-08 {
  /* Voice color overrides for ch8 dissolution */
  --bg-tape: #0a0a0c;
  --tape-color: #9b7fd4;
  --nasti: #39dede;
  --soch: #87c240;
  --hige: #e05a45;
  --merge: #c4a44a;
  --scream: #ffffff;
  --whisper: rgba(200, 195, 188, 0.22);
}

/* ── Title ── */
#chapter-08 .chapter-title h1 {
  color: var(--tape-color); opacity: 0.7;
}

/* ════════════════════════════════════════════ */
/* TAPE SECTION                                 */
/* ════════════════════════════════════════════ */
#chapter-08 .tape-section {
  padding: 80px 0; position: relative; overflow: hidden;
}
#chapter-08 .tape-content {
  max-width: 900px; margin: 0 auto; padding: 0 40px;
  position: relative; z-index: 3;
}
#chapter-08 .tape-line {
  font-family: 'IBM Plex Mono', monospace;
  font-size: clamp(14px, 1.5vw, 17px);
  line-height: 1.9; color: var(--tape-color);
  opacity: 0; transform: translateY(15px);
  margin-bottom: 0.3em;
}
#chapter-08 .tape-line.revealed {
  opacity: 1; transform: translateY(0);
  transition: opacity 0.8s ease, transform 0.6s ease;
}
#chapter-08 .tape-line em { font-style: italic; }
#chapter-08 .tape-line.pause {
  color: var(--fg); font-style: italic;
  font-size: 0.85em; margin: 1.5em 0;
}
#chapter-08 .tape-line.narr {
  color: var(--fg); font-family: 'Titillium Web', sans-serif;
  font-size: clamp(16px, 1.8vw, 20px);
  font-style: normal; margin: 1.8em 0 0.5em;
}
#chapter-08 .tape-divider {
  text-align: center; color: var(--fg-dim);
  margin: 3em 0; letter-spacing: 1em; font-size: 14px;
  opacity: 0;
}
#chapter-08 .tape-divider.revealed { opacity: 1; transition: opacity 1.5s ease; }

/* ════════════════════════════════════════════ */
/* BRIDGE SECTION                               */
/* ════════════════════════════════════════════ */
#chapter-08 .bridge-section { padding: 30px 0 100px; position: relative; }
#chapter-08 .bridge-content {
  max-width: 900px; margin: 0 auto; padding: 0 40px;
}
#chapter-08 .bridge-block {
  margin-bottom: 1.8em; opacity: 0; transform: translateY(20px);
}
#chapter-08 .bridge-block.revealed {
  opacity: 1; transform: translateY(0);
  transition: opacity 0.8s ease, transform 0.6s ease;
}
#chapter-08 .bridge-block.instability-1 { animation: ch8-tremor1 4s ease-in-out infinite; }
#chapter-08 .bridge-block.instability-2 { animation: ch8-tremor2 2.5s ease-in-out infinite; }
#chapter-08 .bridge-block.instability-3 { animation: ch8-tremor3 3.6s ease-in-out infinite; }

@keyframes ch8-tremor1 {
  0%, 100% { transform: translate(0); }
  50% { transform: translate(0.5px, 0); }
}
@keyframes ch8-tremor2 {
  0%, 100% { transform: translate(0); }
  25% { transform: translate(0.8px, -0.3px); }
  75% { transform: translate(-0.6px, 0.3px); }
}
@keyframes ch8-tremor3 {
  0%, 100% { transform: translate(0); }
  15% { transform: translate(0.5px, -0.25px); }
  35% { transform: translate(-0.4px, 0.2px); }
  55% { transform: translate(0.35px, 0.25px); }
  75% { transform: translate(-0.5px, -0.15px); }
}

#chapter-08 .shimmer-word {
  color: var(--merge); font-style: italic;
  animation: ch8-shimmer-drift 6s ease-in-out infinite;
}
@keyframes ch8-shimmer-drift {
  0%, 100% { opacity: 0.8; letter-spacing: 0; }
  50% { opacity: 1; letter-spacing: 0.025em; }
}

#chapter-08 .heartbeat-text {
  animation: ch8-heartbeat-pulse 1.2s ease-in-out infinite;
}
@keyframes ch8-heartbeat-pulse {
  0%, 100% { opacity: 0.7; }
  30% { opacity: 1; } 35% { opacity: 0.7; } 45% { opacity: 1; }
}

#chapter-08 .rhythm-line {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.9em; color: var(--hige); letter-spacing: 0.1em;
}

/* ── FINGER DRUMMING (percussive) ── */
#chapter-08 .drum-container {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.9em;
  color: var(--hige);
  letter-spacing: 0.1em;
}
#chapter-08 .drum-line {
  margin-bottom: 0.3em;
}
#chapter-08 .drum-beat {
  display: inline-block;
  opacity: 0.7;
  will-change: transform, opacity;
}
#chapter-08 .drum-beat.tap {
  animation: ch8-drum-tap 0.2s cubic-bezier(0.22, 0.68, 0.36, 1.1) forwards;
}
@keyframes ch8-drum-tap {
  0%  { transform: translateY(0); opacity: 0.7; }
  35% { transform: translateY(2.5px); opacity: 1; }
  100% { transform: translateY(0); opacity: 0.85; }
}
#chapter-08 .drum-beat.tap-heavy {
  animation: ch8-drum-tap-heavy 0.18s cubic-bezier(0.22, 0.68, 0.36, 1.1) forwards;
}
@keyframes ch8-drum-tap-heavy {
  0%  { transform: translateY(0); opacity: 0.7; }
  30% { transform: translateY(3.5px); opacity: 1; }
  100% { transform: translateY(0); opacity: 0.85; }
}

#chapter-08 .bridge-emphasis {
  display: block; margin: 2em 0; font-weight: 600;
  font-size: 1.1em; text-align: center; color: var(--merge);
}

/* ════════════════════════════════════════════ */
/* DISSOLUTION SECTION                          */
/* ════════════════════════════════════════════ */
#chapter-08 .dissolution-section {
  padding: 60px 0 40px; position: relative; overflow: hidden;
}
#chapter-08 .dissolution-section::after {
  content: '';
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 200px;
  background: linear-gradient(to bottom, transparent, var(--bg, #0a0a0c));
  pointer-events: none;
  z-index: 6;
}
#chapter-08 .diss-content {
  max-width: 900px; margin: 0 auto; padding: 0 40px;
  position: relative; z-index: 5;
}
#chapter-08 .diss-separator {
  text-align: center; color: var(--fg-dim);
  letter-spacing: 0.8em; margin: 4em 0 3em;
  font-size: 18px; opacity: 0;
}
#chapter-08 .diss-separator.revealed { opacity: 1; transition: opacity 1.5s ease; }

#chapter-08 .diss-block {
  position: relative; margin-bottom: 1.4em;
  min-height: 1.8em; opacity: 0; transform: translateY(15px);
}
#chapter-08 .diss-block.revealed {
  opacity: 1; transform: translateY(0);
  transition: opacity 0.5s ease, transform 0.4s ease;
}

/* Voice colors */
#chapter-08 .v-nasti { color: var(--nasti); }
#chapter-08 .v-soch { color: var(--soch); }
#chapter-08 .v-hige { color: var(--hige); }
#chapter-08 .v-merge { color: var(--merge); }

/* ── CRASH: each char flies in individually ── */
#chapter-08 .crash {
  display: inline;
  font-weight: 900;
  color: var(--scream);
  position: relative;
  opacity: 0;
}
#chapter-08 .crash .fly-char {
  display: inline-block;
  will-change: transform, opacity;
  backface-visibility: hidden;
}

/* ── SCREAM: chromatic aberration ── */
#chapter-08 .diss-block.scream {
  font-weight: 900; font-size: 1.15em;
  color: var(--scream); text-align: center;
  letter-spacing: 0.08em; margin: 1.5em 0;
  position: relative;
}
#chapter-08 .diss-block.scream::before,
#chapter-08 .diss-block.scream::after {
  content: attr(data-text);
  position: absolute; top: 0; left: 0;
  width: 100%; height: 100%;
  text-align: center;
  pointer-events: none;
  opacity: 0;
}
#chapter-08 .diss-block.scream::before { color: #ff0040; }
#chapter-08 .diss-block.scream::after { color: #00e5ff; }
#chapter-08 .diss-block.scream.revealed::before {
  opacity: 0.6;
  animation: ch8-glitch-before 0.65s ease-out 2, ch8-glitch-idle 7.15s 1.3s ease-in-out infinite;
}
#chapter-08 .diss-block.scream.revealed::after {
  opacity: 0.6;
  animation: ch8-glitch-after 0.65s ease-out 2, ch8-glitch-idle-reverse 7.15s 1.3s ease-in-out infinite;
}
@keyframes ch8-glitch-before {
  0% { transform: translate(10px, -3px); opacity: 0.9; }
  100% { transform: translate(2px, 0); opacity: 0.5; }
}
@keyframes ch8-glitch-after {
  0% { transform: translate(-10px, 3px); opacity: 0.9; }
  100% { transform: translate(-2px, 0); opacity: 0.5; }
}
@keyframes ch8-glitch-idle {
  0%, 100% { transform: translate(1.5px, 0); }
  25% { transform: translate(-1px, 0.5px); }
  50% { transform: translate(2px, -0.5px); }
  75% { transform: translate(-1.5px, 0); }
}
@keyframes ch8-glitch-idle-reverse {
  0%, 100% { transform: translate(-1.5px, 0); }
  25% { transform: translate(1px, -0.5px); }
  50% { transform: translate(-2px, 0.5px); }
  75% { transform: translate(1.5px, 0); }
}

/* ── WHISPER: fades through ── */
#chapter-08 .whisper {
  color: var(--nasti); font-style: italic;
  font-size: 0.85em; display: inline; opacity: 0;
}
#chapter-08 .whisper.active {
  animation: ch8-whisper-phase 0.6s ease-in-out infinite;
}
@keyframes ch8-whisper-phase {
  0%, 100% { opacity: 0.1; }
  50% { opacity: 0.85; }
}

#chapter-08 .stutter { display: inline; opacity: 0.5; }

/* ── FLY-THROUGH: 3D perspective ── */
#chapter-08 .fly-through-stage {
  perspective: 600px;
  position: relative; min-height: 160px;
  margin: 2em 0; overflow: visible;
}
#chapter-08 .fly-frag {
  position: absolute;
  white-space: nowrap;
  font-weight: 600;
  will-change: transform, opacity;
  transform-style: preserve-3d;
  left: 0; top: 50%;
  text-shadow: 0 0 15px currentColor;
}

/* ── GOAWAY SWARM ── */
#chapter-08 .swarm-container {
  position: relative;
  width: 100%; height: 250px;
  margin: 2em 0; overflow: hidden;
}
#chapter-08 .swarm-char {
  position: absolute;
  font-weight: 900;
  color: var(--nasti);
  will-change: transform, opacity;
  pointer-events: none;
  backface-visibility: hidden;
  transform: translateZ(0);
}

/* ── MULTIPLY ECHOES ── */
#chapter-08 .multiply-container {
  position: relative;
  min-height: 120px;
  display: flex; align-items: center; justify-content: center;
  margin: 2em 0;
}
#chapter-08 .multiply-echo {
  position: absolute;
  font-weight: 900; color: var(--nasti);
  white-space: nowrap; pointer-events: none; opacity: 0;
}

/* ── Ghost echoes floating behind ── */
#chapter-08 .ghost-layer {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  pointer-events: none; z-index: 1;
  overflow: hidden;
}
#chapter-08 .ghost-echo {
  position: absolute;
  font-family: 'IBM Plex Mono', monospace;
  font-weight: 600;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  will-change: transform, opacity;
  backface-visibility: hidden;
  transform: translateZ(0);
}

/* ── Canvas displacement overlay ── */
#chapter-08 #displacement-canvas {
  position: fixed;
  top: 0; left: 0; width: 100%; height: 100%;
  pointer-events: none; z-index: 4;
  mix-blend-mode: overlay;
  opacity: 0;
}

/* ── Screen flash ── */
#chapter-08 #screen-flash {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  pointer-events: none; z-index: 200;
  opacity: 0;
}

/* ── Noise grain ── */
#chapter-08 #grain-canvas {
  position: fixed;
  top: 0; left: 0; width: 100%; height: 100%;
  pointer-events: none; z-index: 3;
  mix-blend-mode: overlay; opacity: 0;
}

/* ── Interleave ── */
#chapter-08 .interleave { line-height: 2.2; }
#chapter-08 .interleave .frag {
  display: inline; margin: 0 2px;
  padding: 0 3px; border-radius: 2px;
}
#chapter-08 .frag.v-soch { background: rgba(218, 165, 32, 0.08); }
#chapter-08 .frag.v-hige { background: rgba(224, 90, 69, 0.08); }
#chapter-08 .frag.v-nasti { background: rgba(78, 205, 196, 0.08); }

#chapter-08 .diss-block.meta {
  font-style: italic; color: var(--fg-dim);
  text-align: center; margin: 2em 0;
}
#chapter-08 .diss-block.vulnerable {
  color: var(--fg); opacity: 0.7; font-style: italic;
}
#chapter-08 .counting-num {
  font-family: 'IBM Plex Mono', monospace;
  font-weight: 600; font-size: 1.3em;
  color: var(--soch); margin-right: 0.3em;
}

/* ════════════════════════════════════════════ */
/* GENTLE EFFECTS — calm voice text              */
/* ════════════════════════════════════════════ */

/* STACCATO — word by word fade-in */
#chapter-08 .staccato-fx { display: inline; }
#chapter-08 .staccato-fx .stac-word {
  display: inline-block;
  opacity: 0;
  transform: translateY(4px);
  will-change: transform, opacity;
}

/* BLURWALK — starts blurred, sharpens */
#chapter-08 [data-fx="blurwalk"] {
  display: inline;
  filter: blur(6px);
  opacity: 0.3;
  transition: none;
}

/* TYPEWRITER — char by char */
#chapter-08 .typewrite-fx { display: inline; }
#chapter-08 .typewrite-fx .tw-char {
  display: inline;
  opacity: 0;
}

/* TREMBLE — jittering words */
#chapter-08 .tremble-fx { display: inline; }
#chapter-08 .tremble-fx .trem-word {
  display: inline-block;
  opacity: 0;
  will-change: transform;
}

/* FADESLIDE — slide up with fade */
#chapter-08 [data-fx="fadeslide"] {
  display: inline;
  opacity: 0;
  transform: translateY(12px);
}

/* GHOSTWRITE — faint → solid */
#chapter-08 [data-fx="ghostwrite"] {
  display: inline;
  opacity: 0;
  color: rgba(212,208,203,0.1);
}

/* UNSCRAMBLE — masked blocks clear */
#chapter-08 .unscramble-fx { display: inline; }
#chapter-08 .unscramble-fx .us-word {
  display: inline-block;
  position: relative;
}
#chapter-08 .unscramble-fx .us-mask {
  position: absolute;
  inset: 0;
  background: currentColor;
  opacity: 0.7;
}

/* DRIPREVEAL — chars weep into place */
#chapter-08 .dripreveal-fx { display: inline; }
#chapter-08 .dripreveal-fx .drip-char {
  display: inline-block;
  opacity: 0;
  will-change: transform;
}

/* ════════════════════════════════════════════ */
/* AGGRESSIVE EFFECTS — interruptions            */
/* ════════════════════════════════════════════ */

/* STAMP — slams in from scale */
#chapter-08 .stamp-fx {
  display: inline; font-weight: 900; opacity: 0;
  transform-origin: center center;
}

/* BLEED — blur-to-sharp */
#chapter-08 .bleed-fx {
  display: inline; font-weight: 900; opacity: 0; filter: blur(18px);
}

/* GLITCH — chromatic slice */
#chapter-08 .glitch-fx {
  display: inline; font-weight: 900; position: relative; opacity: 0;
}
#chapter-08 .glitch-fx::before, #chapter-08 .glitch-fx::after {
  content: attr(data-text);
  position: absolute; left: 0; top: 0; opacity: 0; pointer-events: none;
}
#chapter-08 .glitch-fx::before { color: #ff3366; }
#chapter-08 .glitch-fx::after  { color: #33ffcc; }
#chapter-08 .glitch-fx.glitching::before { animation: ch8-fx-glitch-r 0.08s steps(2) 6 alternate; }
#chapter-08 .glitch-fx.glitching::after  { animation: ch8-fx-glitch-l 0.06s steps(3) 8 alternate; }
@keyframes ch8-fx-glitch-r {
  0%   { clip-path: inset(10% 0 60% 0); transform: translateX(4px); opacity: 0.8; }
  50%  { clip-path: inset(40% 0 20% 0); transform: translateX(-3px); opacity: 0.6; }
  100% { clip-path: inset(70% 0 5% 0);  transform: translateX(6px); opacity: 0.7; }
}
@keyframes ch8-fx-glitch-l {
  0%   { clip-path: inset(50% 0 10% 0); transform: translateX(-5px); opacity: 0.7; }
  50%  { clip-path: inset(15% 0 50% 0); transform: translateX(3px); opacity: 0.6; }
  100% { clip-path: inset(80% 0 0% 0);  transform: translateX(-4px); opacity: 0.8; }
}

/* DECODE — cipher scramble */
#chapter-08 .decode-fx { display: inline; font-weight: 900; }
#chapter-08 .decode-fx .dc-char { display: inline-block; opacity: 0; will-change: opacity; }

/* DROP — bounce from above */
#chapter-08 .drop-fx { display: inline; font-weight: 900; opacity: 0; }
#chapter-08 .drop-fx .drop-char { display: inline-block; will-change: transform, opacity; }

/* SCATTER — explode then reform */
#chapter-08 .scatter-fx { display: inline; font-weight: 900; position: relative; }
#chapter-08 .scatter-fx .sc-char { display: inline-block; will-change: transform, opacity; opacity: 0; }

/* REDACT — black bars peel off */
#chapter-08 .redact-fx { display: inline; font-weight: 900; position: relative; }
#chapter-08 .redact-fx .rd-word { display: inline-block; position: relative; }
#chapter-08 .redact-fx .rd-bar {
  position: absolute; inset: -2px -4px;
  background: #d4d0cb; z-index: 1; transform-origin: left center;
}

/* TYPEFORCE — aggressive typewriter */
#chapter-08 .typeforce-fx { display: inline; font-weight: 900; }
#chapter-08 .typeforce-fx .tf-char { display: inline-block; opacity: 0; will-change: opacity; }
#chapter-08 .typeforce-fx .tf-cursor {
  display: inline-block; width: 2px; height: 1.1em;
  vertical-align: text-bottom; margin-left: 1px;
  animation: ch8-tf-blink 0.12s steps(1) infinite; opacity: 0;
}
@keyframes ch8-tf-blink { 0%, 49% { opacity: 1; } 50%, 100% { opacity: 0; } }

/* TEXTILLATE wrapper */
#chapter-08 .tlt-fx { display: inline; font-weight: 900; }
#chapter-08 .tlt-fx.tlt-hidden { opacity: 0; }

/* ════════════════════════════════════════════ */
/* CALM SECTION                                 */
/* ════════════════════════════════════════════ */
#chapter-08 .calm-section { padding: 40px 0 200px; }
#chapter-08 .calm-content {
  max-width: 900px; margin: 0 auto; padding: 0 40px;
}
#chapter-08 .calm-block {
  margin-bottom: 2.5em; opacity: 0;
  transform: translateY(20px); text-align: center;
}
#chapter-08 .calm-block.revealed {
  opacity: 1; transform: translateY(0);
  transition: opacity 1.5s ease, transform 1s ease;
}
#chapter-08 .calm-block.final {
  margin-top: 2em; font-style: italic; color: var(--fg-dim);
}

/* ════════════════════════════════════════════ */
/* SVG TURBULENCE FILTER                        */
/* ════════════════════════════════════════════ */
#chapter-08 .turb-target {
  filter: url(#live-turbulence);
}
#chapter-08 [data-mild] {
  filter: none !important;
}
