/* TERESA — the arc's code frames (js/dialogue-scenes/scene-teresa-transitions.js,
   spec IFBClaudeFIles/teresa/TERESA_VISUAL_TRANSITIONS.md). Light, lines and
   colour only; never a face. Two warmths, two cities: the Coronet's lamp is
   yellow-brown and low, Miami's warm is amber and brighter; Miami's
   fluorescent (cold green-white, flicker) belongs to Miami alone. */

/* ── §1 #teresaScar — the restaurant, a watch, a line ─────────────── */

/* the watch line: the room goes half a tone colder over the paper */
#teresaMetalTint {
  position: fixed; inset: 0; z-index: 1000030; pointer-events: none;
  background: rgba(118, 132, 146, 0.13);
  opacity: 0; transition: opacity .3s ease;
}
#teresaMetalTint.tm-on { opacity: 1; }

/* the frame: under a second, no text, no sound */
#teresaScar {
  position: fixed; inset: 0; z-index: 1000045; pointer-events: none;
  overflow: hidden; opacity: 1;
}
#teresaScar.ts-out { opacity: 0; transition: opacity .2s ease; }
/* 1. warm, muted, low — the restaurant, nearly skin */
#teresaScar .ts-base {
  position: absolute; inset: 0;
  background:
    radial-gradient(ellipse 70% 55% at 50% 52%, #603e22 0%, #34200f 55%, #140b06 100%);
}
/* 2. metal — a cold grey wash */
#teresaScar .ts-metal {
  position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(150, 160, 172, 0.9), rgba(120, 130, 142, 0.9));
  opacity: 0; transition: opacity .3s ease;
}
/* 3. the line — the hammer's hairline under the hood (#ch2Hood .hh-click:
   2px, rgba(225,225,230,.9)), laid on its side. No fade in. */
#teresaScar .ts-line {
  position: absolute; left: 20%; width: 60%; top: 56%; height: 2px;
  background: rgba(225, 225, 230, 0.9);
  opacity: 0;
}
/* 4. red, under the line — blurred, it soaks and stops */
#teresaScar .ts-red {
  position: absolute; left: 26%; width: 48%; top: calc(56% + 1px); height: 42px;
  background: radial-gradient(ellipse 60% 100% at 50% 0%, rgba(139, 0, 0, 0.95) 0%, rgba(110, 0, 0, 0.5) 45%, transparent 75%);
  filter: blur(5px);
  opacity: 0; transition: opacity .4s ease;
}

/* ── §2 #teresaBandage — room 304, her hands on his arm; Miami under the strips ── */
#teresaBandage {
  position: fixed; inset: 0; z-index: 1000040; overflow: hidden; background: #000; pointer-events: none;
}
/* 1. the lamp: one bulb on the ceiling, yellow-brown, low, uneven */
#teresaBandage .tb-lamp {
  position: absolute; inset: 0; opacity: 0; transition: opacity .8s ease;
  background: radial-gradient(ellipse 60% 55% at 46% 30%, rgba(176, 128, 66, 0.9) 0%, rgba(92, 62, 30, 0.95) 45%, #1c130b 100%);
}
#teresaBandage.tb-on .tb-lamp { opacity: 1; }
#teresaBandage.tb-miami .tb-lamp { opacity: 0; }
/* 4. Miami: cold green-white fluorescent, flickering (Miami only) */
#teresaBandage .tb-fluo {
  position: absolute; inset: 0; opacity: 0; transition: opacity .8s ease;
  background: radial-gradient(ellipse 80% 70% at 50% 40%, #e2f0ea 0%, #c8e0d8 40%, #7f948e 100%);
}
#teresaBandage.tb-miami .tb-fluo { opacity: .8; animation: tbFlicker .1s steps(2) infinite; }
#teresaBandage.tb-back .tb-fluo { opacity: 0; transition: opacity .6s ease; animation: none; }
@keyframes tbFlicker { 0% { filter: brightness(1); } 50% { filter: brightness(.9); } }
/* 2. the strips: gauze, laid left to right; 3. the red under each */
#teresaBandage .tb-strips { position: absolute; left: 6%; right: 6%; top: 14%; bottom: 22%; }
#teresaBandage .tb-strip {
  position: absolute; left: 0; right: 0; height: 9%;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0) 0%, rgba(246, 242, 232, 0.42) 30%, rgba(246, 242, 232, 0.48) 70%, rgba(255, 255, 255, 0) 100%);
  filter: blur(1.5px);
  clip-path: inset(0 100% 0 0); transition: clip-path .6s ease;
}
#teresaBandage .tb-strip.tb-laid { clip-path: inset(0 0 0 0); }
#teresaBandage .tb-red {
  position: absolute; left: 18%; right: 18%; height: 7%; opacity: 0; transition: opacity .9s ease;
  background: radial-gradient(ellipse 50% 100% at 50% 0%, rgba(139, 0, 0, 0.9), rgba(110, 0, 0, 0.35) 50%, transparent 80%);
  filter: blur(4px);
}
#teresaBandage .tb-red.tb-soak { opacity: .4; }
/* in Miami the red stops standing and runs */
#teresaBandage.tb-miami .tb-red.tb-soak { opacity: .65; animation: tbRun 2.4s linear infinite; }
#teresaBandage.tb-back .tb-red.tb-soak { opacity: .4; animation: none; transform: none; }
@keyframes tbRun { 0% { transform: translateY(0) scaleY(1); } 100% { transform: translateY(26px) scaleY(1.8); } }
/* 5. the belt: one dark band across the field, there at once */
#teresaBandage .tb-belt { position: absolute; left: 0; right: 0; top: 47%; height: 5%; background: linear-gradient(180deg, #120d08, #2a1d12 50%, #120d08); opacity: 0; }
#teresaBandage.tb-miami .tb-belt { opacity: .92; }
#teresaBandage.tb-back .tb-belt { opacity: 0; transition: opacity .6s ease; }
/* his hands: no tone, only the shape of pressure against the corridor's light */
#teresaBandage .tb-press { position: absolute; top: 44%; width: 40%; height: 11%; background: linear-gradient(90deg, rgba(8, 8, 7, 0) 0%, rgba(8, 8, 7, 0.85) 45%, rgba(8, 8, 7, 0.95) 100%); filter: blur(9px); opacity: 0; transition: opacity .3s ease; }
#teresaBandage .tb-press.l { left: -4%; border-radius: 0 60% 60% 0; transform: rotate(-4deg); }
#teresaBandage .tb-press.r { right: -4%; border-radius: 60% 0 0 60%; transform: rotate(4deg) scaleX(-1); }
#teresaBandage.tb-miami .tb-press { opacity: .75; }
#teresaBandage.tb-back .tb-press { opacity: 0; }
/* 6. the watch on her right wrist: only on the zoom */
#teresaBandage .tb-stage {
  position: absolute; left: 50%; top: 46%; width: min(34vh, 34vw); height: min(34vh, 34vw);
  transform: translate(-50%, -50%) scale(1); transform-origin: 48.8% 48.4%; opacity: 0;
  transition: opacity .4s ease, transform 1.2s cubic-bezier(.5, 0, .2, 1);
  -webkit-mask-image: radial-gradient(circle at 48.8% 48.4%, #000 14%, transparent 24%);
          mask-image: radial-gradient(circle at 48.8% 48.4%, #000 14%, transparent 24%);
}
#teresaBandage .tb-stage img.tb-base { position: absolute; inset: 0; width: 100%; height: 100%; }
#teresaBandage.tb-miami .tb-stage { opacity: 1; transform: translate(-50%, -50%) scale(4); filter: blur(.6px); }
#teresaBandage.tb-back .tb-stage { opacity: 0; transform: translate(-50%, -50%) scale(1); transition: opacity 1s ease, transform 1s ease; }
#teresaBandage .tb-dial { position: absolute; left: 35.25%; top: 34.85%; width: 27.11%; height: 27.11%; border-radius: 50%; overflow: hidden; }
#teresaBandage .tb-face, #teresaWatch .tw2-face { position: absolute; inset: 0; transform: rotate(-6.6deg); }
.tz-hand { position: absolute; display: block; filter: drop-shadow(0 0.4px 0.6px rgba(0,0,0,0.45)); }
.tz-hand-hour   { left: 47.37%; top: 24%;  width: 5.26%; height: 28.63%; transform-origin: 50% 90.82%; }
.tz-hand-minute { left: 47.66%; top: 7%;   width: 4.67%; height: 45.30%; transform-origin: 50% 94.85%; }
.tz-hand-second { left: 48.13%; top: 5%;   width: 3.73%; height: 51.81%; transform-origin: 50% 86.85%; }
.tz-cap { position: absolute; left: 50%; top: 50%; width: 4%; height: 4%; border-radius: 50%; transform: translate(-50%, -50%); background: #1a1714; }
#teresaBandage.tb-out { opacity: 0; transition: opacity .9s ease; }

/* ── §3 #teresaGrip — half a second: her hand, already curved for the grip ── */
#teresaGrip { position: fixed; inset: 0; z-index: 1000045; pointer-events: none; overflow: hidden;
  background: radial-gradient(ellipse 70% 60% at 50% 55%, rgba(214, 150, 70, 0.95), rgba(120, 70, 24, 0.97) 60%, #2a1608 100%); filter: blur(0); }
#teresaGrip img { position: absolute; left: 50%; top: 40%; width: min(46vh, 46vw); transform: translate(-50%, 45%) scale(.8); filter: blur(1px) brightness(1.08) sepia(.2);
  animation: tgReach .5s ease-in forwards; }
/* from below, up and toward the camera; gone in the last 100 ms */
@keyframes tgReach { 0% { transform: translate(-50%, 45%) scale(.8); opacity: 1; } 80% { opacity: 1; } 100% { transform: translate(-50%, -6%) scale(1.1); opacity: 0; } }

/* ── §4 #teresaWatch — Sunday, the table, the nineteen-dollar watch ── */
#teresaWatch { position: fixed; inset: 0; z-index: 1000040; overflow: hidden; pointer-events: none; background: #000; transition: opacity .9s ease; }
#teresaWatch .tw2-base { position: absolute; inset: 0; opacity: 0; transition: opacity .6s ease; background: linear-gradient(180deg, #8d8f92 0%, #77797c 100%); }
#teresaWatch.tw2-on .tw2-base { opacity: 1; }
#teresaWatch .tw2-stage {
  position: absolute; left: 50%; top: 50%; width: 43vh; height: 43vh; opacity: 0;
  transform: translate(-50%, -50%) scale(1); transform-origin: 48.8% 48.4%;
  transition: opacity .6s ease, transform 1.5s cubic-bezier(.5, 0, .2, 1);
  -webkit-mask-image: radial-gradient(circle at 48.8% 48.4%, #000 17%, transparent 23%);
          mask-image: radial-gradient(circle at 48.8% 48.4%, #000 17%, transparent 23%);
}
#teresaWatch.tw2-on .tw2-stage { opacity: 1; }
#teresaWatch .tw2-stage img.tw2-photo { position: absolute; inset: 0; width: 100%; height: 100%; filter: grayscale(.35) brightness(.95); }
#teresaWatch.tw2-zoom .tw2-stage { transform: translate(-50%, -50%) scale(7.4); }
#teresaWatch .tw2-dial { position: absolute; left: 35.25%; top: 34.85%; width: 27.11%; height: 27.11%; border-radius: 50%; overflow: hidden; }
#teresaWatch .tw2-state { position: absolute; inset: 0; opacity: 0; transition: opacity .4s ease; mix-blend-mode: screen; }
#teresaWatch .tw2-state.tw2-in { opacity: .85; }
/* 7 — the Coronet: dim hotel, grey metal, one cold spot */
#teresaWatch .tw2-s7 { background: radial-gradient(circle at 35% 35%, rgba(170, 186, 200, 0.55), transparent 35%), linear-gradient(180deg, #4b4e52, #2a2c2f); }
/* 10:30 — the pier: sodium, black verticals */
#teresaWatch .tw2-s1030 { background: repeating-linear-gradient(90deg, rgba(0, 0, 0, 0.75) 0 9%, transparent 9% 22%), radial-gradient(circle at 50% 40%, #ffb34a, #a85a10 70%); }
/* 12 — Sunday: the same grey as the room, the one honest reflection */
#teresaWatch .tw2-s12 { background: linear-gradient(180deg, #8d8f92, #77797c); }
/* 1 — the lamp, white strips, red under them; Miami for a moment under it all */
#teresaWatch .tw2-s1 { background:
  repeating-linear-gradient(180deg, transparent 0 9%, rgba(246, 242, 232, 0.8) 9% 15%, rgba(139, 0, 0, 0.35) 15% 18%, transparent 18% 22%),
  radial-gradient(circle at 46% 30%, #b08042, #5c3e1e 70%); }
#teresaWatch .tw2-flash { position: absolute; inset: 0; background: #e2f0ea; opacity: 0; }
#teresaWatch .tw2-flash.tw2-blink { animation: tw2Blink .3s steps(2) 1; }
@keyframes tw2Blink { 0% { opacity: .85; } 100% { opacity: 0; } }
#teresaWatch .tz-hand-second { transition: transform .25s linear; }
/* the pharmacy: fluorescent, the whole frame, white; nothing drawn but the light */
#teresaWatch .tw2-fluo { position: absolute; inset: 0; opacity: 0; transition: opacity .3s ease; background: radial-gradient(ellipse 90% 80% at 50% 45%, #f4faf7, #d6e8e0 70%, #b9cdc5); }
#teresaWatch.tw2-pharmacy .tw2-fluo { opacity: 1; animation: tbFlicker .12s steps(2) infinite; }
#teresaWatch.tw2-back .tw2-fluo { opacity: 0; transition: opacity .8s ease; animation: none; }
#teresaWatch .tw2-line { position: absolute; left: 0; right: 0; top: 40%; text-align: center; font-family: 'Courier Prime', 'Courier New', Courier, monospace; font-size: 30px; letter-spacing: 3px; color: #2a2a28; }
#teresaWatch.tw2-out { opacity: 0; }

/* ── §5 #teresaGone — Monday, Bridge Route: one grey blur, going north ── */
#teresaGone { position: fixed; inset: 0; z-index: 1000040; overflow: hidden; pointer-events: none; opacity: 0; transition: opacity .8s ease;
  background: linear-gradient(180deg, #b5b19f 0%, #a19c88 48%, #8a8676 49%, #6f6c61 100%); }
#teresaGone.tg-in { opacity: 1; }
#teresaGone .tg-car { position: absolute; left: 50%; top: 78%; width: 34vw; height: 18vw; border-radius: 40%; background: radial-gradient(ellipse, #6f7176 0%, rgba(111, 113, 118, 0.6) 45%, transparent 70%); filter: blur(6px);
  transform: translate(-50%, -50%) scale(1); transition: transform 2.5s cubic-bezier(.4, 0, .6, 1), top 2.5s cubic-bezier(.4, 0, .6, 1), opacity .3s ease; }
#teresaGone.tg-going .tg-car { top: 50%; transform: translate(-50%, -50%) scale(.3); }
#teresaGone.tg-turned .tg-car { transform: translate(260%, -50%) scale(.28); opacity: 0; transition: transform .3s ease-in, opacity .3s ease-in; }
#teresaGone .tg-light { position: absolute; top: 44%; width: 6px; height: 14px; }
#teresaGone .tg-light::before, #teresaGone .tg-light::after { content: ''; position: absolute; left: 0; width: 6px; height: 6px; border-radius: 50%; background: #5a2a24; }
#teresaGone .tg-light::before { top: 0; }
#teresaGone .tg-light::after { top: 8px; background: #2b3a2c; }
#teresaGone .tg-light.tg-green::after { background: #6fe08a; box-shadow: 0 0 8px #6fe08a; }
#teresaGone .tg-l1 { left: 46%; } #teresaGone .tg-l2 { left: 55%; top: 43%; }
#teresaGone.tg-out { opacity: 0; transition: opacity 1.2s ease; }

/* ── §6 the ceiling of 304 — the night, the light off. Horizontal, plaster,
   one stain, the dark; the only thing that moves is the rail line's light ── */
#teresaCeiling { position: fixed; inset: 0; z-index: 1000040; overflow: hidden; pointer-events: none; background: #060606; opacity: 0; transition: opacity 1.6s ease; }
#teresaCeiling.tc-in { opacity: 1; }
/* 1. plaster: an uneven dark grey, nearly black */
#teresaCeiling .tc-plaster { position: absolute; inset: -4%;
  background:
    radial-gradient(ellipse 60% 40% at 30% 35%, rgba(40, 40, 38, 0.9), transparent 70%),
    radial-gradient(ellipse 50% 45% at 72% 62%, rgba(32, 31, 30, 0.85), transparent 70%),
    radial-gradient(circle at 18% 80%, rgba(26, 26, 25, 0.8), transparent 40%),
    repeating-radial-gradient(circle at 40% 30%, rgba(255, 255, 255, 0.012) 0 2px, transparent 2px 5px),
    linear-gradient(180deg, #161615 0%, #0f0f0e 60%, #0a0a09 100%); }
/* 2. the stain: a touch warmer, a touch darker, barely there — the one he aimed at */
#teresaCeiling .tc-stain { position: absolute; left: 57%; top: 34%; width: 12%; height: 9%;
  border-radius: 48% 52% 44% 56% / 55% 45% 55% 45%; transform: rotate(-9deg);
  background: radial-gradient(ellipse at 45% 50%, rgba(22, 18, 14, 0.55) 0%, rgba(26, 21, 16, 0.35) 55%, rgba(26, 21, 16, 0.0) 78%); }
/* 3. the train: a cold white-yellow band across the ceiling, left to right, 2.6 s */
#teresaCeiling .tc-train { position: absolute; top: -10%; bottom: -10%; width: 26%; left: -30%; opacity: 0;
  background: linear-gradient(90deg, transparent 0%, rgba(232, 236, 214, 0.08) 25%, rgba(240, 238, 210, 0.26) 50%, rgba(232, 236, 214, 0.08) 75%, transparent 100%);
  transform: skewX(-14deg); mix-blend-mode: screen; }
#teresaCeiling .tc-train.tc-pass { animation: tcPass 2.6s cubic-bezier(.45, .05, .55, .95) forwards; }
@keyframes tcPass { 0% { left: -30%; opacity: 0; } 12% { opacity: 1; } 88% { opacity: 1; } 100% { left: 108%; opacity: 0; } }
/* the grip, in the train's light: her hand up from below toward the camera; cold, lit only where the band is */
#teresaCeiling .tc-grip { position: absolute; left: 50%; top: 40%; width: min(46vh, 46vw); opacity: 0; transform: translate(-50%, 45%) scale(.8);
  filter: grayscale(.55) brightness(.75) contrast(1.1); }
#teresaCeiling .tc-grip.tc-reach { animation: tcReach .55s ease-in forwards; }
@keyframes tcReach { 0% { transform: translate(-50%, 45%) scale(.8); opacity: .95; } 80% { opacity: .95; } 100% { transform: translate(-50%, -6%) scale(1.1); opacity: 0; } }
/* the reel: two frames for the night's footage (files awaited; a missing one shows its marked placeholder) */
#teresaCeiling .tc-reel { position: absolute; left: 50%; top: 46%; width: min(62vw, 92vh); transform: translate(-50%, -50%); opacity: 0; transition: opacity 1.2s ease; pointer-events: auto; }
#teresaCeiling .tc-reel.on { opacity: 1; }
#teresaCeiling.tc-out { opacity: 0; transition: opacity 1.4s ease; }
