/* ════════════════════════════════════════════ */
/* CHAPTER 09 — Ascension                       */
/* ════════════════════════════════════════════ */

#chapter-09 {
  --hige: #e05a45;
  --nasti: #4ecdc4;
  --soch: #87c240;
  --merge: #c4a44a;
  --thought-merge: #9a8235;
  --thought-border-merge: rgba(196, 164, 74, 0.4);
}

#chapter-09 .chapter-title h1 {
  color: var(--merge); opacity: 0.7;
}

#chapter-09 .story-section:last-of-type { padding-bottom: 40vh; }

/* ════════════════════════════════════════════ */
/* THOUGHT BLOCKS (merged consciousness)        */
/* ════════════════════════════════════════════ */
#chapter-09 .thought-block {
  background: rgba(196, 164, 74, 0.06);
  padding: 0.6em 1.2em;
  border-radius: 2px;
  font-style: italic;
  color: var(--merge);
}

/* ════════════════════════════════════════════ */
/* EFFECT 1: THOUGHT INTRUSIONS                 */
/* ════════════════════════════════════════════ */
#chapter-09 .thought-intrusion {
  color: var(--merge);
  font-weight: 600;
  position: relative;
  opacity: 0;
}
#chapter-09 .thought-intrusion.pulsed {
  opacity: 1;
  animation: ch9-intrusion-pulse 0.6s ease-out;
}
@keyframes ch9-intrusion-pulse {
  0%   { opacity: 0; text-shadow: 0 0 20px var(--merge); }
  30%  { opacity: 1; text-shadow: 0 0 12px var(--merge); }
  100% { opacity: 1; text-shadow: none; }
}

/* The intentional "Up." — clearer, stronger */
#chapter-09 #up-word {
  font-size: 1.15em;
  text-align: center;
}
#chapter-09 #up-word em {
  color: var(--merge);
  font-weight: 700;
  font-style: normal;
}
#chapter-09 #up-word.pulsed em {
  animation: ch9-up-pulse 1s ease-out;
}
@keyframes ch9-up-pulse {
  0%   { opacity: 0; text-shadow: 0 0 30px rgba(212, 208, 203, 0.8); }
  40%  { opacity: 1; text-shadow: 0 0 15px rgba(212, 208, 203, 0.4); }
  100% { opacity: 1; text-shadow: none; }
}

/* ════════════════════════════════════════════ */
/* EFFECT 2: RHYTHMIC STEPS                     */
/* ════════════════════════════════════════════ */
#chapter-09 .rhythm-step {
  text-align: center;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.95em;
  letter-spacing: 0.15em;
  color: var(--merge);
  margin-bottom: 1.2em;
  opacity: 0; transform: translateY(10px);
}
#chapter-09 .rhythm-step[data-dir="left"]   { transform: translateX(-160px); }
#chapter-09 .rhythm-step[data-dir="center"] { transform: translateY(10px); }
#chapter-09 .rhythm-step[data-dir="right"]  { transform: translateX(160px); }
#chapter-09 .rhythm-step.revealed {
  opacity: 1; transform: translateX(0) translateY(0);
  transition: opacity 7.5s ease, transform 6s ease;
}

/* ════════════════════════════════════════════ */
/* EFFECT 3: IDENTITY WORDS                     */
/* ════════════════════════════════════════════ */
#chapter-09 .identity-word {
  font-weight: 600;
  font-size: 1.15em;
  letter-spacing: 0.3em;
}
#chapter-09 .identity-word[data-owner="hige"] { color: var(--hige); }
#chapter-09 .identity-word[data-owner="nasti"] { color: var(--nasti); }
#chapter-09 .identity-word[data-owner="soch"] { color: var(--soch); }
#chapter-09 .identity-word[data-dir="left"]   { transform: translateX(-160px); }
#chapter-09 .identity-word[data-dir="center"] { transform: translateY(10px); }
#chapter-09 .identity-word[data-dir="right"]  { transform: translateX(160px); }
#chapter-09 .identity-word.revealed {
  transform: translateX(0) translateY(0);
  transition: opacity 7.5s ease, transform 6s ease;
}

/* ════════════════════════════════════════════ */
/* EFFECT 4: NAME RETURNS                       */
/* ════════════════════════════════════════════ */
#chapter-09 .name-return {
  font-weight: 500;
}
#chapter-09 .name-return[data-owner="hige"].revealed {
  transition: opacity 1s ease, transform 0.8s ease;
}
#chapter-09 .name-return[data-owner="soch"].revealed {
  transition: opacity 1s ease, transform 0.8s ease;
}

/* ════════════════════════════════════════════ */
/* EFFECT 6: CHEERS                             */
/* ════════════════════════════════════════════ */
#chapter-09 #cheers.revealed {
  transition: opacity 1.5s ease, transform 1s ease;
}

/* ════════════════════════════════════════════ */
/* EFFECT 7: MECH TERMINAL (CRT) — ALERTAMENTE  */
/* ════════════════════════════════════════════ */
#chapter-09 .mech-terminal {
  font-family: 'SF Mono', 'Cascadia Code', 'Fira Code', 'Courier New', monospace;
  font-size: 0.78rem;
  line-height: 1.8;
  color: var(--mech-amber);
  background: var(--mech-bg);
  padding: 1.5em 2em;
  border-radius: 8px;
  position: relative;
  overflow: hidden;
  margin: 1.5em 0;
  opacity: 0; transform: translateY(20px);
  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);
}
#chapter-09 .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;
}
#chapter-09 .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;
}
#chapter-09 .terminal-scanbar {
  position: absolute;
  top: -8px; left: 0; right: 0;
  height: 8px;
  background: linear-gradient(to bottom, transparent, rgba(255,176,0,0.06), transparent);
  pointer-events: none;
  z-index: 7;
  animation: ch9-scanbar-move 4s linear infinite;
}
@keyframes ch9-scanbar-move {
  0% { top: -8px; }
  100% { top: 100%; }
}
#chapter-09 .mech-terminal.ready .terminal-line {
  visibility: hidden;
}
#chapter-09 .terminal-line {
  min-height: 1.8em;
  position: relative;
  z-index: 2;
}
#chapter-09 .terminal-cursor {
  display: none;
  width: 0.55em; height: 1.1em;
  background: var(--mech-amber);
  vertical-align: text-bottom;
  animation: ch9-cursor-blink 0.8s step-end infinite;
  position: relative;
  z-index: 2;
}
#chapter-09 .terminal-cursor.active {
  display: inline-block;
}
@keyframes ch9-cursor-blink {
  0%, 50% { opacity: 1; }
  51%, 100% { opacity: 0; }
}
#chapter-09 .mech-terminal.flicker {
  animation: ch9-terminal-flicker 0.2s ease;
}
@keyframes ch9-terminal-flicker {
  0% { opacity: 0.3; }
  20% { opacity: 1; }
  40% { opacity: 0.7; }
  60% { opacity: 1; }
  80% { opacity: 0.85; }
  100% { opacity: 1; }
}

/* ════════════════════════════════════════════ */
/* EFFECT 8: NASTI EJECTION                     */
/* ════════════════════════════════════════════ */
#chapter-09 .ejection-container {
  position: relative;
  overflow: visible;
}
#chapter-09 .nasti-eject {
  display: inline-block;
  font-weight: 600;
  will-change: transform;
  backface-visibility: hidden;
}
#chapter-09 .ejection-gap {
  display: inline-block;
}

#chapter-09 #final-line.revealed {
  transition: opacity 2s ease 0.8s, transform 1.5s ease 0.8s;
}

@media (max-width: 600px) {
  #chapter-09 .identity-word {
    font-size: 1em;
    letter-spacing: 0.2em;
  }
  #chapter-09 .mech-terminal {
    font-size: 0.7rem;
    padding: 1em 1.2em;
  }
}
