/* TERESA · DAY 20 · the scar, half a year on (js/dialogue-scenes/scene-teresa-scar-flashback.js).
   The white line is the way in; it turns onto her scar in the author's picture
   (scar_city.jpg, 1672×941). Coordinates are the picture's own pixels: the
   layer is a size container and --s is the cover scale. Under the strip
   (#overlayDialogue 1000095). */
#teresaScarBack {
  position: fixed; inset: 0; z-index: 1000040; pointer-events: none; overflow: hidden;
  background: #0b0806; container-type: size;
  opacity: 0;
}
#teresaScarBack > * { position: absolute; inset: 0; --s: max(calc(100cqw / 1672), calc(100cqh / 941)); }
#teresaScarBack.tsb-in { opacity: 1; transition: opacity .3s ease; }
#teresaScarBack.tsb-out { opacity: 0; transition: opacity 1.1s ease; }

/* the restaurant, cooled half a tone (the watch line's tint hands over to it) */
#teresaScarBack .tsb-cold {
  background:
    linear-gradient(180deg, rgba(150, 160, 172, 0.32), rgba(120, 130, 142, 0.32)),
    radial-gradient(ellipse 70% 55% at 50% 52%, #603e22 0%, #34200f 55%, #140b06 100%);
}
/* a better city: a hotel's warm, a lamp off to the left */
#teresaScarBack .tsb-warm {
  background: radial-gradient(ellipse 80% 70% at 36% 28%, #8e6034 0%, #4a2d16 48%, #160c06 100%);
  opacity: 0; transition: opacity 1.4s ease;
}
#teresaScarBack.tsb-city .tsb-warm { opacity: 1; }

/* the camera: leans in toward her hand the whole time the picture is up */
#teresaScarBack .tsb-cam {
  transform-origin: calc(50% + (930 - 836) * var(--s)) calc(50% + (420 - 470.5) * var(--s));
  transform: scale(1);
}
#teresaScarBack.tsb-photo-on .tsb-cam { transform: scale(1.07); transition: transform 24s linear; }
#teresaScarBack .tsb-cam.tsb-kick { animation: tsbKick .32s ease-out; }
@keyframes tsbKick { 0% { translate: 0 0; } 22% { translate: calc(-3 * var(--s)) calc(-8 * var(--s)); } 100% { translate: 0 0; } }
#teresaScarBack .tsb-photo {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: 50% 50%;
  opacity: 0; transition: opacity 1.8s ease;
}
#teresaScarBack.tsb-photo-on .tsb-photo { opacity: 1; }

/* the line — the hammer's hairline under the hood, on its side; no fade in.
   On the city it turns onto the painted scar: centre (867, 282), 122 px, 56.5° (fitted to the painted scar) */
#teresaScarBack .tsb-line {
  position: absolute; inset: auto; left: 50%; top: 56%; width: 60%; height: 2px;
  background: rgba(225, 225, 230, 0.92);
  transform: translate(-50%, -50%) rotate(0deg);
  box-shadow: 0 0 6px rgba(240, 236, 228, 0.35);
}
#teresaScarBack.tsb-city .tsb-line {
  left: calc(50% + (867 - 836) * var(--s)); top: calc(50% + (282 - 470.5) * var(--s));
  width: calc(122 * var(--s));
  transform: translate(-50%, -50%) rotate(56.5deg);
  transition: left 1.6s cubic-bezier(.5, 0, .2, 1), top 1.6s cubic-bezier(.5, 0, .2, 1), width 1.6s cubic-bezier(.5, 0, .2, 1), transform 1.6s cubic-bezier(.5, 0, .2, 1);
}
#teresaScarBack.tsb-line-off .tsb-line { opacity: 0; transition: opacity 1.4s ease; }
/* red, under the line — blurred, it soaks and stops */
#teresaScarBack .tsb-red {
  position: absolute; left: 10%; width: 80%; top: 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 .5s ease;
}
#teresaScarBack.tsb-red-on .tsb-red { opacity: .5; }
#teresaScarBack.tsb-city .tsb-red { opacity: 0; transition: opacity .25s ease; }

/* the lamp over the picture: warm on the skin, the steel stays steel */
#teresaScarBack .tsb-lamp {
  background: radial-gradient(ellipse 70% 80% at 30% 20%, rgba(255, 184, 110, 0.55) 0%, rgba(214, 140, 70, 0.2) 45%, transparent 75%);
  mix-blend-mode: soft-light;
  opacity: 0; transition: opacity 1.8s ease;
}
#teresaScarBack.tsb-photo-on .tsb-lamp { opacity: 1; }
/* the towel: the warm goes dark over it */
#teresaScarBack .tsb-towel {
  background: radial-gradient(ellipse 90% 80% at 56% 52%, rgba(26, 16, 9, 0.55) 0%, rgba(12, 8, 5, 0.92) 70%);
  opacity: 0; transition: opacity 2.4s ease;
}
#teresaScarBack.tsb-towel-on .tsb-towel { opacity: .85; }
#teresaScarBack .tsb-vignette { background: radial-gradient(ellipse 85% 80% at 50% 50%, transparent 55%, rgba(0, 0, 0, 0.6) 100%); }
