/* Termotecnica di Fanni Emanuele — pagina "sito in costruzione" — pannello termocamera */

/* ---------- Pannello termocamera ---------- */

.thermal {
  position: relative;
  container: thermal / inline-size;
  width: 100%;
  margin: 0;
  aspect-ratio: 1 / 1.08;
  min-height: 21rem;
  max-height: 44rem;
  overflow: hidden;
  isolation: isolate;
  border-radius: var(--radius-panel);
  background: radial-gradient(120% 85% at 18% 0%, var(--panel-edge) 0%, var(--panel) 52%, #070e17 100%);
  color: var(--hud);
  box-shadow:
    inset 0 1px 0 rgb(255 255 255 / 0.07),
    0 0 0 1px rgb(8 20 34 / 0.9),
    0 44px 80px -40px rgb(8 20 34 / 0.65);
  box-shadow:
    inset 0 1px 0 rgb(255 255 255 / 0.07),
    0 0 0 1px rgb(8 20 34 / 0.9),
    0 44px 80px -40px rgb(8 20 34 / 0.65),
    0 30px 70px -34px color-mix(in srgb, var(--accent) 55%, transparent);
  transition: box-shadow var(--duration-slow) ease;
}

@media (max-width: 59.99rem) {
  .thermal {
    aspect-ratio: 1 / 1.04;
    /* telefono in orizzontale: il pannello non supera l'altezza dello schermo */
    max-height: min(44rem, calc(100svh - 2rem));
    max-width: calc((100svh - 2rem) * 1.6);
    margin-inline: auto;
  }
}

@media (min-width: 60rem) {
  .thermal {
    aspect-ratio: 1 / 1;
    max-height: min(44rem, calc(100svh - 9.5rem));
  }
}

.thermal__canvas {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  cursor: crosshair;
  touch-action: pan-y pinch-zoom;
  opacity: 0;
  transition: opacity var(--duration-slow) ease;
}

.thermal.is-ready .thermal__canvas {
  opacity: 1;
}

.thermal__hud {
  position: absolute;
  inset: 0;
  pointer-events: none;
  font: 500 var(--text-label) / 1.2 var(--font-mono);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.thermal__hud p {
  margin: 0;
}

.hud-corner {
  position: absolute;
  width: 1.1rem;
  height: 1.1rem;
  border: 0 solid rgb(214 228 244 / 0.42);
}

.hud-corner--tl { top: 0.9rem; left: 0.9rem; border-top-width: 1.5px; border-left-width: 1.5px; }
.hud-corner--bl { bottom: 0.9rem; left: 0.9rem; border-bottom-width: 1.5px; border-left-width: 1.5px; }
.hud-corner--br { bottom: 0.9rem; right: 0.9rem; border-bottom-width: 1.5px; border-right-width: 1.5px; }

.hud-title {
  position: absolute;
  top: 1.45rem;
  left: 2.35rem;
  display: flex;
  align-items: center;
  gap: 0.9rem;
  color: var(--hud-dim);
}

.hud-title__live {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  color: var(--hud);
}

.hud-title__live::before {
  content: "";
  width: 0.45rem;
  height: 0.45rem;
  border-radius: 50%;
  background: #ff5140;
  box-shadow: 0 0 10px #ff5140;
  animation: blink 1.6s steps(2, jump-none) infinite;
}

@keyframes blink {
  50% { opacity: 0.2; }
}

.thermal__hint {
  position: absolute;
  top: 4.1rem;
  left: 50%;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.85rem;
  border-radius: var(--radius-pill);
  background: rgb(7 14 23 / 0.72);
  box-shadow: 0 0 0 1px rgb(214 228 244 / 0.14);
  color: var(--hud);
  white-space: nowrap;
  transform: translateX(-50%);
  visibility: hidden;
  transition: opacity var(--duration-normal) ease, transform var(--duration-normal) var(--ease-out-expo);
}

.thermal__hint svg {
  width: 0.95rem;
  height: 0.95rem;
}

.hint--touch {
  display: none;
}

@media (hover: none) {
  .hint--mouse { display: none; }
  .hint--touch { display: inline; }
}

.thermal.is-touched .thermal__hint {
  opacity: 0;
  transform: translate(-50%, -0.5rem);
}

.hud-bottom {
  position: absolute;
  right: 2.35rem;
  bottom: 1.6rem;
  left: 2.35rem;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
}

.readout {
  display: grid;
  gap: 0.45rem;
}

.readout__label {
  color: var(--hud-dim);
}

.readout__value {
  color: #fff;
  font-size: clamp(1.5rem, 1.1rem + 1.6vw, 2.25rem);
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  letter-spacing: -0.03em;
  text-transform: none;
}

.scale {
  display: grid;
  justify-items: end;
  gap: 0.5rem;
}

.scale__bar {
  position: relative;
  width: clamp(5.5rem, 24cqi, 9.5rem);
  height: 0.5rem;
  overflow: hidden;
  border-radius: var(--radius-pill);
  background: var(--scale-heat);
}

.scale__bar::after {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--scale-cool);
  opacity: 0;
  transition: opacity var(--duration-slow) ease;
}

.scale__labels {
  display: flex;
  justify-content: space-between;
  width: 100%;
  color: var(--hud-dim);
}

:root[data-season="cool"] .scale__bar::after { opacity: 1; }
:root[data-season="cool"] .scale__labels[data-for="heat"],
:root:not([data-season="cool"]) .scale__labels[data-for="cool"] { display: none; }

.season {
  position: absolute;
  top: 0.9rem;
  right: 0.9rem;
  z-index: 2;
  display: flex;
  gap: 2px;
  padding: 4px;
  border: 1px solid rgb(255 255 255 / 0.12);
  border-radius: var(--radius-pill);
  background: rgb(255 255 255 / 0.07);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  visibility: hidden;
}

.has-thermal .season,
.has-thermal .thermal__hint {
  visibility: visible;
}

.season__btn {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  min-height: 2.35rem;
  padding: 0 0.9rem;
  border: 0;
  border-radius: var(--radius-pill);
  background: transparent;
  color: var(--hud);
  font: 500 var(--text-label) / 1 var(--font-mono);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition:
    transform var(--duration-fast) var(--ease-out-expo),
    background-color var(--duration-normal) ease,
    color var(--duration-normal) ease;
}

.season__btn:active {
  transform: scale(0.95);
}

.season__btn svg {
  width: 1rem;
  height: 1rem;
  transition: color var(--duration-normal) ease;
}

.season__btn:hover {
  color: #fff;
}

.season__btn[aria-pressed="true"] {
  background: #fff;
  color: var(--panel);
}

.season__btn[aria-pressed="true"][data-season-button="heat"] svg { color: var(--brand-orange); }
.season__btn[aria-pressed="true"][data-season-button="cool"] svg { color: var(--brand-blue); }

.season__btn:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 2px;
}

@container thermal (max-width: 30rem) {
  .hud-title__text { display: none; }
  .hud-title { left: 2.1rem; }
  .hud-bottom { left: 2.1rem; right: 2.1rem; bottom: 1.35rem; }
}

