/* KOVA Fenster & Türen · „Was neue Fenster bringen, sehen Sie am Wärmebild.“ (#check, Klasse hk; Taulant 03.11., docs/50 Punkt 16: ohne
   Zahlen, Arbnors Wahl „Bild statt Beleg“). Ersetzt die Heizkostenabrechnung. Das Gerüst kommt aus abschlagsplan.css (gehaltene Bühne,
   Sätze rechts, Ergebnis, Stempel), die Stufen setzt abschlagsplan.js: ab-z1 Wärme steigt aus den alten Fenstern und die Lupe zeigt Zug,
   ab-z2 das Wärmebild wechselt auf neue Fenster, ab-z3 kein Zug mehr in der Lupe, ab-st Stempel, ab-fertig Ergebnis.
   Der Schirm zeigt das Haus größer als im Bild (hk-welt, Maßstab --s); Punkte im Bild in Prozent des Bildes, Rechnung für den Schirm:
   x = 50 % + (x_Bild − 50 %) · s, y = 50 % + (y_Bild − 50 %) · k · s mit k = Bildhöhe durch Schirmhöhe (Schirm 4 : 3: k = 0,75; am Telefon
   quadratisch: k = 0,5625). Ohne Skript und bei ruhiger Bewegung
   steht der Endstand (neue Fenster, kein Zug, Stempel). Bewegt werden nur transform und opacity. Nur Blau, kein Gold. */

.hk .ab-tisch::before{left:-2%;right:-2%;top:2%;bottom:-6%;background:radial-gradient(closest-side,rgba(125,184,228,.42),rgba(125,184,228,0))}
.hk-tisch{display:flex;flex-direction:column;align-items:center;gap:14px}

/* ── der Schirm ────────────────────────────────────────────────────────────────────────────────────────────────────── */
.hk-sicht{--s:1.6;--k:.75;position:relative;width:min(100%,620px);aspect-ratio:4 / 3;border-radius:8px;overflow:hidden;isolation:isolate;background:#000931;color:#DCEBF7;
  box-shadow:0 0 0 1px rgba(11,26,58,.5),inset 0 0 0 1px rgba(191,221,242,.08),0 2px 4px rgba(11,26,58,.12),0 40px 70px -34px rgba(11,26,58,.62),0 90px 120px -80px rgba(11,26,58,.5)}
.hk-welt{position:absolute;left:0;right:0;top:50%;aspect-ratio:16 / 9;transform:translate3d(0,-50%,0) scale(var(--s))}
.hk-welt img{position:absolute;inset:0;width:100%;height:100%;object-fit:cover}
/* Rand wie im Sucher: die Ecken dunkler, oben ein feiner Glanz */
.hk-schirm{position:absolute;inset:0;z-index:1;pointer-events:none;
  background:radial-gradient(120% 90% at 50% 45%,rgba(0,9,49,0) 58%,rgba(0,6,34,.55) 100%),linear-gradient(180deg,rgba(191,221,242,.06),rgba(191,221,242,0) 30%)}
.hk-schirm::before{content:"";position:absolute;inset:14px;border:1.5px solid rgba(191,221,242,.5);
  -webkit-mask:linear-gradient(#000 0 0) top left / 22px 22px no-repeat,linear-gradient(#000 0 0) top right / 22px 22px no-repeat,
    linear-gradient(#000 0 0) bottom left / 22px 22px no-repeat,linear-gradient(#000 0 0) bottom right / 22px 22px no-repeat;
  mask:linear-gradient(#000 0 0) top left / 22px 22px no-repeat,linear-gradient(#000 0 0) top right / 22px 22px no-repeat,
    linear-gradient(#000 0 0) bottom left / 22px 22px no-repeat,linear-gradient(#000 0 0) bottom right / 22px 22px no-repeat}

/* Wärme, die aus den alten Fenstern steigt (in hk-welt, wächst mit dem Bild) */
.hk-fahnen{position:absolute;inset:0;opacity:0}
.hk-fahnen i{position:absolute;left:var(--x);top:var(--y);width:5.4%;aspect-ratio:1 / 1.7;margin:0 0 0 -2.7%;transform-origin:50% 100%;
  background:radial-gradient(50% 50% at 50% 62%,rgba(236,247,255,.78),rgba(156,198,230,.36) 46%,rgba(125,184,228,0) 100%);
  transform:translate3d(0,-100%,0) scale(.5);opacity:0;will-change:transform,opacity}
@keyframes hk-steigt{0%{transform:translate3d(0,-100%,0) scale(.5);opacity:0}25%{opacity:.85}100%{transform:translate3d(0,-190%,0) scale(1.25);opacity:0}}

/* Ecken um das Fenster, das die Lupe zeigt (Lage im Bild über --fx und --fy, umgerechnet auf den Schirm) */
.hk-ziel{position:absolute;z-index:2;left:calc(50% + (var(--fx) - 50%) * var(--s));top:calc(50% + (var(--fy) - 50%) * var(--k) * var(--s));
  width:calc(5% * var(--s));height:calc(11.5% * var(--k) * var(--s));transform:translate(-50%,-50%);border:1.5px solid rgba(214,235,250,.9);pointer-events:none;
  -webkit-mask:linear-gradient(#000 0 0) top left / 8px 8px no-repeat,linear-gradient(#000 0 0) top right / 8px 8px no-repeat,
    linear-gradient(#000 0 0) bottom left / 8px 8px no-repeat,linear-gradient(#000 0 0) bottom right / 8px 8px no-repeat;
  mask:linear-gradient(#000 0 0) top left / 8px 8px no-repeat,linear-gradient(#000 0 0) top right / 8px 8px no-repeat,
    linear-gradient(#000 0 0) bottom left / 8px 8px no-repeat,linear-gradient(#000 0 0) bottom right / 8px 8px no-repeat}

/* Statuszeile oben links */
.hk-status{position:absolute;z-index:3;left:24px;top:22px;display:flex;align-items:center;gap:8px;padding:6px 11px 6px 9px;border-radius:6px;
  font-size:11px;letter-spacing:.08em;text-transform:uppercase;color:rgba(220,235,247,.92);background:rgba(0,9,49,.55);box-shadow:inset 0 0 0 1px rgba(191,221,242,.16)}
.hk-status>i{flex:none;width:7px;height:7px;border-radius:50%;background:#9CC6E6;box-shadow:0 0 0 3px rgba(156,198,230,.18)}
.hk-wann{position:relative;display:grid;margin-left:10px;color:#FFFFFF}
.hk-wann::before{content:"·";position:absolute;margin-left:-11px;color:rgba(220,235,247,.5)}
.hk-wann span,.hk-lupe-text span{grid-area:1 / 1}

/* Farbskala rechts, wie an einer Wärmebildkamera: oben warm, unten kalt */
.hk-skala{position:absolute;z-index:3;right:24px;top:27%;bottom:27%;display:flex;flex-direction:column;align-items:center;gap:7px;
  font-size:10px;letter-spacing:.08em;text-transform:uppercase;color:rgba(220,235,247,.72)}
.hk-skala i{flex:1;width:6px;border-radius:3px;background:linear-gradient(180deg,#FFFFFF 0%,#BFDDF2 22%,#5A9ED6 48%,#1D4E8C 74%,#06154A 100%);
  box-shadow:0 0 0 1px rgba(191,221,242,.25)}

/* die Lupe unten links: ein Fenster von innen im Dreifachrahmen, Zug zieht durch die Fuge; später dicht */
.hk-lupe{position:absolute;z-index:3;left:4%;bottom:7%;width:22%;aspect-ratio:1;border-radius:50%;
  box-shadow:0 0 0 1.5px rgba(214,235,250,.85),0 0 0 6px rgba(156,198,230,.12),0 18px 34px -12px rgba(0,0,0,.7)}
.hk-lupe svg{display:block;width:100%;height:100%;overflow:visible}
.hk-l-glas{fill:rgba(125,184,228,.16)}
.hk-l-r1,.hk-l-r2,.hk-l-r3{fill:none;stroke:#9CC6E6;stroke-width:1.6}
.hk-l-r2{stroke-opacity:.7}.hk-l-r3{stroke-opacity:.45}
.hk-l-fuge{stroke:#BFDDF2;stroke-width:2.4;stroke-linecap:round;opacity:.95}
.hk-zug{opacity:0}
.hk-zug path{fill:none;stroke:#E6F3FC;stroke-width:2.2;stroke-linecap:round;opacity:0}
@keyframes hk-zieht{0%{transform:translate3d(-8px,0,0);opacity:0}30%{opacity:.95}100%{transform:translate3d(16px,0,0);opacity:0}}
.hk-d-marke{fill:url(#hk-lupe-marke)}
.hk-d-haken{fill:none;stroke:#061433;stroke-width:2.2;stroke-linecap:round;stroke-linejoin:round}
.hk-dicht{transform-box:fill-box;transform-origin:50% 50%}
.hk-l-glanz{fill:none;stroke:rgba(255,255,255,.35);stroke-width:2;stroke-linecap:round}
.hk-lupe-text{position:absolute;z-index:3;left:calc(4% + 22% + 14px);bottom:calc(7% + 4px);display:grid;
  font-size:11px;letter-spacing:.08em;text-transform:uppercase;color:#FFFFFF}

/* Stempel auf dem Bild (Bau aus abschlagsplan.css, hier hell auf Nachtblau) */
.hk .ab-stempel{right:15%;top:10%;color:#D6EBFA;background:rgba(0,9,49,.4);z-index:4}

.hk-legende{font-size:13px;line-height:1.4;color:var(--t3);text-align:center}

/* ── Endstand (ohne Skript, ruhig, am Ende): neue Fenster, kein Zug ───────────────────────────────────────────────── */
.hk-a{opacity:0}

/* ── der Lauf (Klasse ab-spielt von abschlagsplan.js) ─────────────────────────────────────────────────────────────── */
.ab-spielt .hk-neu{transition:opacity .9s ease}
.ab-spielt:not(.ab-z2) .hk-neu{opacity:0}
.ab-spielt .hk-fahnen{transition:opacity .6s ease}
.ab-spielt.ab-z1:not(.ab-z2) .hk-fahnen{opacity:1}
.ab-spielt .hk-fahnen i{animation:hk-steigt 2.6s cubic-bezier(.3,.5,.4,1) var(--d) infinite;animation-play-state:paused}
.ab-spielt.ab-z1:not(.ab-z2) .hk-fahnen i{animation-play-state:running}
.ab-spielt .hk-status .hk-wann span,.ab-spielt .hk-lupe-text span{transition:opacity .5s ease}
.ab-spielt:not(.ab-z2) .hk-wann .hk-a{opacity:1}
.ab-spielt:not(.ab-z2) .hk-wann .hk-b{opacity:0}
/* die Lupe kommt mit der ersten Stufe */
.ab-spielt .hk-lupe,.ab-spielt .hk-ziel,.ab-spielt .hk-lupe-text{transition:opacity .5s ease,transform .7s var(--s-kurve)}
.ab-spielt:not(.ab-z1) :is(.hk-lupe,.hk-ziel,.hk-lupe-text){opacity:0}
.ab-spielt:not(.ab-z1) .hk-lupe{transform:scale(.85)}
/* Zug, bis neue Fenster eingebaut sind und dicht schließen */
.ab-spielt .hk-zug,.ab-spielt .hk-l-fuge{transition:opacity .5s ease}
.ab-spielt:not(.ab-z3) .hk-zug{opacity:1}
.ab-spielt:not(.ab-z3) .hk-l-fuge{opacity:.22}
.ab-spielt .hk-zug path{animation:hk-zieht 1.8s linear var(--d) infinite;animation-play-state:paused}
.ab-spielt.ab-z1:not(.ab-z3) .hk-zug path{animation-play-state:running}
.ab-spielt .hk-dicht{transition:opacity .4s ease,transform .5s cubic-bezier(.2,1.5,.4,1)}
.ab-spielt:not(.ab-z3) .hk-dicht{opacity:0;transform:scale(.5)}
.ab-spielt:not(.ab-z3) .hk-lupe-text .hk-a{opacity:1}
.ab-spielt:not(.ab-z3) .hk-lupe-text .hk-b{opacity:0}

/* ── Telefon und schmale Fenster ───────────────────────────────────────────────────────────────────────────────────── */
@media (max-width:900px){
  .hk-tisch{gap:10px}
  /* am Telefon quadratisch: das Haus größer, der Platz über und unter der Bühne genutzt */
  .hk-sicht{--s:1.8;--k:.5625;width:100%;aspect-ratio:1}
  .hk-lupe{bottom:5%}
  .hk-lupe-text{bottom:calc(5% + 4px)}
  .hk-schirm::before{inset:9px;-webkit-mask-size:14px 14px;mask-size:14px 14px}
  .hk-status{left:14px;top:13px;gap:6px;padding:4px 8px 4px 7px;font-size:9.5px;letter-spacing:.06em}
  .hk-status>i{width:6px;height:6px}
  .hk-wann{margin-left:8px}.hk-wann::before{margin-left:-9px}
  .hk-skala{right:13px;font-size:8.5px;gap:5px}
  .hk-skala i{width:5px}
  .hk-lupe-text{left:calc(4% + 22% + 9px);font-size:9.5px;letter-spacing:.06em}
  .hk .ab-stempel{right:15%;top:8%;font-size:9px;padding:7px 9px 6px;gap:4px}
  .hk .ab-stempel svg{width:16px}
  .hk-legende{font-size:12px}
}
@media (max-width:900px) and (max-height:760px){
  .hk-legende{display:none}
}
