/* TERESA — a memory through the watch's glass (js/dialogue-scenes/scene-teresa-watch-memory.js).
   The look of the 0.11 test (css/tereza-watch.css) in the arc. One square stage = the wrist photo
   tereza-watch/base.jpg (1254 square, the dial's box at 35.25 % / 34.85 %, 27.11 % wide); the stage
   is placed so the dial's centre (48.8 % / 48.4 %) is the screen's centre. --side sets its size.
   Under the strip (#overlayDialogue 1000095). */
.twm {
  position: fixed; inset: 0; z-index: 1000040; overflow: hidden; background: #000; pointer-events: none;
  container-type: size; --side: 100cqh;
  opacity: 0; transition: opacity .9s ease;
}
.twm.twm-on { opacity: 1; }
.twm.twm-out { opacity: 0; }
.twm-room {
  position: absolute; inset: -40px; background-position: center; background-size: cover;
  filter: blur(26px) brightness(.42) saturate(.75); transition: opacity 1.4s ease;
}
.twm-dive { position: absolute; inset: 0; transform-origin: 0 0; }
/* no filter, mask or 3D on anything the dive scales: a frame blown up 6–18× with a filter on it is a
   surface the browser drops — the watch went black and the table showed through (2026-10-22) */
.twm-dive.twm-diving { transition: transform 2s cubic-bezier(.6, 0, .35, 1); }
.twm-cam { position: absolute; inset: 0; transform-origin: 50% 50%; transition: transform 2.6s cubic-bezier(.45, 0, .2, 1), translate 1.8s ease; }
.twm-stage {
  position: absolute; width: var(--side); height: var(--side);
  left: calc(50cqw - 0.488 * var(--side)); top: calc(50cqh - 0.484 * var(--side));
}
/* turned over flat, in 2D: it narrows to its edge, the other side comes up */
.twm-flip { position: absolute; inset: 0; transform: scaleX(1); transition: transform .42s cubic-bezier(.5, 0, .5, 1); }
.twm.twm-turning .twm-flip { transform: scaleX(.02); }
.twm-front, .twm-back { position: absolute; inset: 0; }
.twm-back { visibility: hidden; }
.twm.twm-flipped .twm-front { visibility: hidden; }
.twm.twm-flipped .twm-back { visibility: visible; }
.twm-base { position: absolute; left: 0; top: 0; width: 100%; height: 100%; display: block; transition: opacity 1.4s ease; }
.twm-wrist { position: absolute; inset: 0; width: 100%; height: 100%; display: block; opacity: 0; transition: opacity 1.6s ease; }

/* the dial and its glass (as the test: the dial itself, inverted to cream) */
.twm-dial { position: absolute; left: 35.25%; top: 34.85%; width: 27.11%; height: 27.11%; border-radius: 50%; overflow: hidden; }
.twm-glass {
  position: absolute; inset: 0;
  background: url("../assets/images/scenes/tereza-watch/base.jpg") no-repeat;
  background-size: 368.82% 368.82%; background-position: 48.36% 47.81%;
  filter: invert(1) sepia(.55) saturate(.9) brightness(1.02) contrast(.92);
  opacity: 0; transition: opacity 2.2s ease;
}
.twm.twm-lit .twm-glass { opacity: 1; }
.twm-face { position: absolute; inset: 0; transform: rotate(-6.6deg); }
.twm-frag {
  position: absolute; width: 64%; height: 64%;
  transform: translate(-50%, -50%) rotate(6.6deg);
  background-size: cover; background-position: center;
  -webkit-mask-image: radial-gradient(circle at 50% 50%, #000 30%, transparent 68%);
          mask-image: radial-gradient(circle at 50% 50%, #000 30%, transparent 68%);
  filter: sepia(.35) blur(1.4px); opacity: 0;
  transition: opacity 1.6s ease, filter 1.6s ease;
}
.twm-frag.twm-seen { opacity: .38; }
.twm-frag.twm-sharp { opacity: 1; filter: sepia(.12) blur(0); }
.twm-sheen {
  position: absolute; inset: 0; opacity: 0; transition: opacity 2.2s ease;
  background: linear-gradient(128deg, rgba(255,255,255,.18) 0%, rgba(255,255,255,.04) 32%, transparent 48%, rgba(255,240,210,.07) 78%, transparent 100%);
}
.twm.twm-lit .twm-sheen { opacity: 1; }
/* the hands (positions: .tz-hand-* in teresa-transitions.css): dark, so they read on the lit glass */
.twm .tz-hand { opacity: 0; transition: transform 1.7s cubic-bezier(.5, 0, .2, 1), opacity 1.2s ease; }
.twm .tz-hand-second { transition: transform .2s linear, opacity 1.2s ease; }
.twm .tz-cap { opacity: 0; transition: opacity 1.2s ease; }
.twm.twm-lit .tz-hand, .twm.twm-lit .tz-cap { opacity: 1; }
.twm-dive.twm-diving .tz-hand, .twm-dive.twm-diving .tz-cap { opacity: 0 !important; transition: opacity .6s ease .35s; }
.twm.twm-nohands .tz-hand, .twm.twm-nohands .tz-cap { opacity: 0 !important; transition: opacity .8s ease; }
/* the glass going white (the pharmacy coming) */
.twm-white { position: absolute; inset: 0; opacity: 0; transition: opacity 1.1s ease; background: radial-gradient(circle at 45% 40%, #ffffff 0%, #eef6f2 45%, #cfe2da 100%); }
.twm.twm-whiteglass .twm-white { opacity: 1; }

/* the lamp of the room, the corridor's blink */
.twm-lamp { position: absolute; inset: 0; opacity: 0; transition: opacity .9s ease; }
.twm-fluo { position: absolute; inset: 0; opacity: 0; background: radial-gradient(ellipse 80% 70% at 50% 40%, #e2f0ea 0%, #c8e0d8 40%, #7f948e 100%); }
.twm-fluo.twm-blink { animation: twmBlink .5s steps(1, end) 1; }
@keyframes twmBlink { 0% { opacity: .55; } 20% { opacity: .25; } 40% { opacity: .6; } 70% { opacity: .2; } 100% { opacity: 0; } }

/* the memory: up out of the blur behind a feathered vignette that widens to the edges */
.twm-mem {
  position: absolute; inset: 0; opacity: 0;
  filter: sepia(.12) blur(14px);
  -webkit-mask-image: radial-gradient(circle at 50% 50%, #000 32%, transparent 70%);
          mask-image: radial-gradient(circle at 50% 50%, #000 32%, transparent 70%);
  -webkit-mask-size: 70% 70%; mask-size: 70% 70%;
  -webkit-mask-position: center; mask-position: center;
  -webkit-mask-repeat: no-repeat; mask-repeat: no-repeat;
  transition: opacity 1.4s ease, filter 1.6s ease, -webkit-mask-size 2.2s ease, mask-size 2.2s ease;
}
.twm-mem img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; transform: scale(1); transition: opacity 1.6s ease, transform 14s linear; }
.twm-mem .twm-mb { opacity: 0; }
.twm-mem.twm-mem-b .twm-mb { opacity: 1; }
.twm-mem.twm-mem-on { opacity: 1; filter: sepia(.12) blur(0); -webkit-mask-size: 420% 420%; mask-size: 420% 420%; }
.twm-mem.twm-mem-on img { transform: scale(1.04); }
.twm-mem.twm-low img { filter: blur(2.5px); }      /* a small picture until the full one exists */
.twm-mem::after { content: ''; position: absolute; inset: 0; background: radial-gradient(ellipse at 50% 45%, transparent 55%, rgba(0,0,0,.55) 100%); }

/* a watch that can be turned over: it calls */
.twm-ring {
  position: absolute; left: 48.8%; top: 48.4%; width: 38%; height: 38%; border-radius: 50%;
  transform: translate(-50%, -50%); opacity: 0; pointer-events: none;
  box-shadow: 0 0 0 3px rgba(196, 168, 122, .85), 0 0 28px 6px rgba(196, 168, 122, .45);
}
.twm.twm-ready .twm-ring { animation: twmCall 1.8s ease-in-out infinite; }
@keyframes twmCall { 0%, 100% { opacity: .15; transform: translate(-50%, -50%) scale(1); } 50% { opacity: .9; transform: translate(-50%, -50%) scale(1.06); } }
.twm.twm-ready .twm-flip { pointer-events: auto; cursor: pointer; }

.twm-vignette { position: absolute; inset: 0; background: radial-gradient(ellipse 85% 80% at 50% 50%, transparent 55%, rgba(0, 0, 0, .6) 100%); }
.twm:not(.twm-lit) .twm-frag { opacity: 0; }
