/* „Ein Tag über Dresden“ — Tagesverlauf aus vier Schlüsselbildern
   Farben aus dem Designsystem (Bauauftrag 1.2). Alle Maße der Szene in Prozent des 2752 × 1536-Bildes. */

.tv {
  --tanne: #234B43;
  --tanne-nacht: #0F2521;
  --messing: #C19A5B;
  --messing-tief: #7E5E2C;
  --messing-hell: #D8BD8C;
  --leinen: #EFE9DE;
  --papier: #F7F4EE;
  --sand: #CFC3AE;
  --tinte: #1A1F1D;
  --tinte-2: #4A524E;
  --tinte-3: #646B67;
  --tv-bildx: 57%;   /* Bildschwerpunkt waagerecht (Handy-Anschnitt) */
  --tv-bildy: 62%;   /* Bildschwerpunkt senkrecht (sehr breite Bildschirme) */
  font-family: "Instrument Sans", system-ui, sans-serif;
  color: var(--tinte);
}

/* ---------- Szene ---------- */
.tv-szene {
  position: relative;
  margin: 0;
  width: 100%;
  aspect-ratio: 2752 / 1536;
  max-height: min(88vh, 1180px);
  overflow: hidden;
  background: #cfd6d8;
  isolation: isolate;
  border-top: 1px solid var(--messing);
  border-bottom: 1px solid var(--sand);
}
@media (max-width: 719px) {
  .tv-szene { aspect-ratio: 4 / 5; max-height: none; }
}

/* Die Bildfläche hat immer exakt das Bildformat; JS legt Größe und Lage fest (wie object-fit: cover). */
.tv-bild {
  position: absolute;
  left: 0; top: 0;
  width: 100%;
  aspect-ratio: 2752 / 1536;
}

.tv-kf {
  position: absolute; inset: 0;
  opacity: 0;
  will-change: opacity;
}
.tv-kf[data-kf="2"] { opacity: 1; }           /* ohne JavaScript: Mittag */
.tv-kf > img { position: absolute; display: block; }
.tv-kf > img:first-child { inset: 0; width: 100%; height: 100%; }
.tv-abdeckung { height: auto; pointer-events: none; }
.tv-sonnenabdeckung { display: none; }
.tv--aktiv .tv-sonnenabdeckung { display: block; }

.tv--ruhig .tv-kf, .tv--start .tv-kf { transition: opacity .7s ease; }

/* Sonne, Sterne: nur im Himmel sichtbar (Maske), Lichthof darüber ohne Maske */
/* Ebenen: Bilder 0–2 (per JS), Lichthof 3, Himmel 4, Stromspur 5, Zonen 6, Punkte 7 */
.tv-himmel, .tv-lichthof {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  pointer-events: none;
  mix-blend-mode: screen;
}
.tv-lichthof { z-index: 3; }
.tv-himmel {
  z-index: 4;
  -webkit-mask-image: url("../../assets/tagesverlauf/himmel-maske.png");
          mask-image: url("../../assets/tagesverlauf/himmel-maske.png");
  -webkit-mask-size: 100% 100%;
          mask-size: 100% 100%;
  -webkit-mask-repeat: no-repeat;
          mask-repeat: no-repeat;
}
.tv--ruhig .tv-himmel, .tv--ruhig .tv-lichthof { transition: opacity .7s ease; }

/* ---------- Hover-Zonen und Punkte ---------- */
.tv-strom { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 5; pointer-events: none; }
.tv-zonen { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 6; }
.tv-zonen polygon { fill: transparent; cursor: pointer; }

.tv-punkt {
  position: absolute;
  width: 44px; height: 44px;
  margin: -22px 0 0 -22px;
  padding: 0; border: 0; background: none;
  border-radius: 50%;
  cursor: pointer;
  z-index: 7;
  -webkit-tap-highlight-color: transparent;
}
.tv-punkt::before, .tv-punkt::after {
  content: "";
  position: absolute; left: 50%; top: 50%;
  width: 12px; height: 12px;
  margin: -6px 0 0 -6px;
  border-radius: 50%;
  box-sizing: border-box;
}
.tv-punkt::before {           /* Pulsring */
  border: 2px solid rgba(247, 244, 238, .95);
  box-shadow: 0 0 0 1px rgba(35, 75, 67, .28);
  opacity: 0;
  animation: tv-puls 2.4s cubic-bezier(.2, .6, .3, 1) infinite;
  animation-delay: var(--tv-d, 0s);
}
.tv-punkt::after {            /* Punkt */
  background: var(--leinen);
  border: 2px solid var(--tanne);
  box-shadow: 0 1px 3px rgba(26, 31, 29, .40);
  transition: transform .22s cubic-bezier(.2, .7, .1, 1), background-color .6s ease;
}
.tv--nacht .tv-punkt::after { background: var(--messing-hell); }
.tv-punkt.ist-aktiv::after { transform: scale(1.3); }
.tv-punkt.ist-aktiv::before { animation: none; opacity: 0; }
.tv-punkt:focus { outline: none; }
.tv-punkt:focus-visible::after { box-shadow: 0 0 0 3px var(--papier), 0 0 0 5px var(--messing-tief); }
.tv--angehalten .tv-punkt::before { animation-play-state: paused; }

@keyframes tv-puls {
  0%   { transform: scale(1);   opacity: .55; }
  100% { transform: scale(2.6); opacity: 0; }
}

/* ---------- Pop-up (Mechanik wie die Leistungskarten auf arcturis.de) ---------- */
.tv-pop {
  position: absolute; left: 0; top: 0;
  width: min(400px, 88vw, calc(100% - 24px));
  z-index: 5;
  pointer-events: none;
  will-change: transform;
  visibility: hidden;
  transition: visibility 0s .16s;
}
.tv-pop.ist-offen { visibility: visible; transition: visibility 0s; }
.tv-pop-innen {
  position: relative;
  padding: 28px 32px;
  border-radius: 16px;
  border: 1px solid rgba(35, 75, 67, .22);
  background: rgba(247, 244, 238, .98);
  box-shadow: 0 24px 60px -20px rgba(26, 31, 29, .30), 0 2px 6px rgba(26, 31, 29, .06);
  opacity: 0;
  transform: translateY(8px) scale(.97);
  transform-origin: 0 100%;
  transition: opacity .16s ease, transform .16s ease;
}
.tv-pop.ist-offen .tv-pop-innen {
  opacity: 1;
  transform: none;
  transition: opacity .22s cubic-bezier(.2, .7, .1, 1), transform .22s cubic-bezier(.2, .7, .1, 1);
}
.tv-pop.ist-fest { pointer-events: auto; }
.tv-pop-dach {
  margin: 0;
  font-size: 12px; font-weight: 600; letter-spacing: .22em; text-transform: uppercase;
  color: var(--messing-tief);
}
.tv-pop-linie { height: 1px; background: var(--sand); margin: 14px 0 16px; }
.tv-pop-text { margin: 0; font-size: 16px; line-height: 1.6; color: var(--tinte-2); }
.tv-pop-wert {
  margin: 16px 0 0;
  font-size: 16px; font-weight: 600; color: var(--tanne);
  font-variant-numeric: tabular-nums;
}
.tv-pop-link {
  display: inline-block;
  margin-top: 14px;
  font-size: 15px; font-weight: 600;
  color: var(--tanne);
  text-decoration: underline;
  text-decoration-color: var(--messing);
  text-underline-offset: 4px;
  text-decoration-thickness: 1px;
}
.tv-pop-link:hover { text-decoration-thickness: 2px; }
.tv-pop-link:focus-visible { outline: 2px solid var(--messing-tief); outline-offset: 3px; border-radius: 2px; }
.tv-pop-zu {
  display: none;
  position: absolute; right: 6px; top: 6px;
  width: 44px; height: 44px;
  border: 0; background: none; cursor: pointer;
  color: var(--tinte-2);
}
.tv-pop-zu::before, .tv-pop-zu::after {
  content: ""; position: absolute; left: 50%; top: 50%;
  width: 16px; height: 1.5px; margin: -.75px 0 0 -8px;
  background: currentColor;
  transform: rotate(45deg);
}
.tv-pop-zu::after { transform: rotate(-45deg); }
.tv-pop-zu:focus-visible { outline: 2px solid var(--messing-tief); outline-offset: -6px; border-radius: 4px; }
.tv-pop.ist-fest .tv-pop-zu { display: block; }
.tv-pop.ist-fest .tv-pop-dach { padding-right: 36px; }

/* Handy: Karte über der Szene, volle Breite minus Rand */
.tv-pop.ist-karte {
  left: 12px !important; right: 12px; top: auto !important; bottom: 12px;
  width: auto;
  transform: none !important;
}
.tv-pop.ist-karte.ist-oben { top: 12px !important; bottom: auto; }
.tv-pop.ist-karte.ist-oben .tv-pop-innen { transform-origin: 50% 0; }
.tv-pop.ist-karte .tv-pop-innen { padding: 22px 22px 20px; transform-origin: 50% 100%; }

/* ---------- Beschriftungen in der Szene ---------- */
.tv-uhr, .tv-pause {
  position: absolute;
  z-index: 4;
  margin: 0;
  padding: 8px 12px;
  border-radius: 2px;
  background: rgba(247, 244, 238, .88);
  -webkit-backdrop-filter: blur(6px);
          backdrop-filter: blur(6px);
  font-size: 13px; font-weight: 500; letter-spacing: .03em;
  color: var(--tinte-2);
  font-variant-numeric: tabular-nums;
}
.tv-uhr { left: 20px; top: 18px; }
.tv-uhr b { font-weight: 600; color: var(--tanne); }
.tv-pause {
  right: 20px; bottom: 18px;
  border: 0; cursor: pointer;
  display: inline-flex; align-items: center; gap: 9px;
  font-family: inherit;
}
.tv-pause i {
  display: inline-block; width: 9px; height: 11px;
  border-left: 3px solid currentColor; border-right: 3px solid currentColor;
  box-sizing: border-box;
}
.tv--angehalten .tv-pause i {
  width: 0; height: 0;
  border-left: 9px solid currentColor; border-right: 0;
  border-top: 6px solid transparent; border-bottom: 6px solid transparent;
}
.tv-pause:hover { color: var(--tanne); }
.tv-pause:focus-visible { outline: 2px solid var(--messing-tief); outline-offset: 2px; }

/* ---------- Unter der Szene: Status und Umschalter ---------- */
.tv-unten {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px 48px;
  align-items: start;
  margin-top: 24px;
}
.tv-status { margin: 0; font-size: 20px; line-height: 1.5; max-width: 38em; min-height: 3em; }
.tv-status b { font-weight: 600; color: var(--tanne); }
.tv-hinweis { margin: 6px 0 0; font-size: 13px; color: var(--tinte-3); }
.tv-reiter { display: flex; gap: 28px; margin: 0; padding: 0; }
.tv-reiter button {
  padding: 8px 0 7px;
  border: 0; border-bottom: 2px solid transparent;
  background: none; cursor: pointer;
  font: 500 15px/1.2 "Instrument Sans", system-ui, sans-serif;
  color: var(--tinte-2);
  white-space: nowrap;
}
.tv-reiter button:hover { color: var(--tanne); }
.tv-reiter button[aria-pressed="true"] { color: var(--tanne); font-weight: 600; border-bottom-color: var(--messing); }
.tv-reiter button:focus-visible { outline: 2px solid var(--messing-tief); outline-offset: 3px; }

@media (max-width: 959px) {
  .tv-unten { grid-template-columns: 1fr; }
  .tv-status { font-size: 18px; min-height: 0; }
}
@media (max-width: 719px) {
  .tv-uhr { left: 12px; top: auto; bottom: 12px; font-size: 12px; padding: 7px 10px; }
  .tv-pause { right: 12px; bottom: 12px; font-size: 12px; padding: 7px 10px; }
  .tv-pause span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .tv-reiter {
    order: -1;
    overflow-x: auto; scrollbar-width: none;
    gap: 22px;
    margin: 0 -16px; padding: 0 16px;
    -webkit-mask-image: linear-gradient(90deg, #000 85%, transparent);
            mask-image: linear-gradient(90deg, #000 85%, transparent);
  }
  .tv-reiter::-webkit-scrollbar { display: none; }
  .tv-reiter button { padding: 12px 0 11px; }   /* 44 px Zielhöhe */
  .tv-unten { margin-top: 12px; gap: 12px; }
  .tv-status { font-size: 17px; }
  /* Pop-up erscheint als Karte; Pause-Knopf weicht aus, solange sie offen ist */
  .tv--karte-offen .tv-pause, .tv--karte-offen .tv-uhr { opacity: 0; pointer-events: none; }
}

/* Ohne JavaScript: nur das Mittagsbild, keine Bedienelemente */
.tv:not(.tv--js) .tv-punkt, .tv:not(.tv--js) .tv-pause, .tv:not(.tv--js) .tv-reiter { display: none; }

.tv-sr {
  position: absolute !important;
  width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

@media (prefers-reduced-motion: reduce) {
  .tv-punkt::before { animation: none; }
  .tv-pop-innen, .tv-pop.ist-offen .tv-pop-innen { transition: opacity .12s linear; transform: none; }
}
