/* Regia Discovery: canvas 16:9 a sinistra, Discovery 9:16 a destra. */

/* Nelle altre modalità la struttura ibrida resta trasparente. */
.tv-hybrid-layout { display: contents; }
.tv-hybrid-empty,
.tv-hybrid-ticker { display: none; }
.tv-hybrid-portrait { display: contents; }

.tv-root.tv-hybrid {
  min-height: 100vh;
}

.tv-root.tv-hybrid .tv-frame {
  width: min(1700px, 96vw, calc((100vh - 28px) * 16 / 9));
  height: min(96vh, calc(96vw * 9 / 16));
  max-height: 96vh;
  aspect-ratio: 16 / 9;
  padding: clamp(8px, 1.2vw, 18px);
}

.tv-root.tv-hybrid .tv-hybrid-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(245px, 31%);
  grid-template-rows: minmax(0, 1fr) auto;
  gap: clamp(10px, 1.25vw, 20px);
  width: 100%;
  height: 100%;
}

.tv-root.tv-hybrid .tv-hybrid-empty {
  position: relative;
  display: flex;
  min-width: 0;
  min-height: 0;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  aspect-ratio: 16 / 9;
  border: 1px solid rgba(232, 194, 106, 0.28);
  border-radius: var(--tv-rad);
  background:
    linear-gradient(135deg, rgba(255,255,255,.035), transparent 45%),
    repeating-linear-gradient(135deg, rgba(232,194,106,.045) 0 1px, transparent 1px 18px),
    #101016;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.025), 0 18px 40px rgba(0,0,0,.25);
}

.tv-hybrid-empty-copy {
  display: grid;
  gap: 8px;
  max-width: 30ch;
  padding: 24px;
  color: rgba(246,239,226,.58);
  text-align: center;
}
.tv-hybrid-empty-copy strong {
  color: var(--tv-gold);
  font-size: clamp(1rem, 1.8vw, 1.45rem);
  letter-spacing: .08em;
  text-transform: uppercase;
}
.tv-hybrid-empty-copy span {
  font-size: clamp(.78rem, 1.1vw, .95rem);
  line-height: 1.45;
}

.tv-root.tv-hybrid .tv-hybrid-portrait {
  display: grid;
  min-width: 0;
  min-height: 0;
  place-items: center;
}
.tv-root.tv-hybrid .tv-hybrid-portrait .tv-stage {
  width: auto;
  height: 100%;
  max-width: 100%;
  max-height: none;
  aspect-ratio: 9 / 16;
  border-radius: var(--tv-rad);
}

/* Nel pannello verticale Discovery il contenuto parte dall’alto. Il QR ha
   una zona propria in basso e non può coprire titolo o descrizione. */
.tv-root.tv-hybrid .tv-hybrid-portrait .tv-content {
  justify-content: flex-start;
  gap: 10px;
  padding: clamp(16px, 2vw, 28px);
  padding-bottom: clamp(104px, 13vw, 148px);
  overflow-y: auto;
  scrollbar-width: none;
}
.tv-root.tv-hybrid .tv-hybrid-portrait .tv-content::-webkit-scrollbar { display: none; }
.tv-root.tv-hybrid .tv-hybrid-portrait .tv-hero {
  width: 100%;
  max-width: 100%;
  margin-top: 0;
}
.tv-root.tv-hybrid .tv-hybrid-portrait .tv-title {
  font-size: clamp(1.22rem, 2.75vw, 2.15rem);
  line-height: 1.05;
  overflow-wrap: anywhere;
}
.tv-root.tv-hybrid .tv-hybrid-portrait .tv-postcard-title,
.tv-root.tv-hybrid .tv-hybrid-portrait .tv-tradition-title,
.tv-root.tv-hybrid .tv-hybrid-portrait .tv-route-title {
  font-size: clamp(1.18rem, 2.6vw, 2.05rem);
  line-height: 1.06;
}
.tv-root.tv-hybrid .tv-hybrid-portrait .tv-subtitle {
  max-width: none;
  font-size: clamp(.95rem, 1.55vw, 1.14rem);
  line-height: 1.34;
}
.tv-root.tv-hybrid .tv-hybrid-portrait .tv-card,
.tv-root.tv-hybrid .tv-hybrid-portrait .tv-place-context {
  max-width: none;
}
.tv-root.tv-hybrid .tv-hybrid-portrait .tv-route {
  padding: clamp(12px, 1.7vw, 20px);
  padding-bottom: clamp(88px, 11vw, 112px);
  overflow-y: auto;
  scrollbar-width: none;
}
.tv-root.tv-hybrid .tv-hybrid-portrait .tv-route::-webkit-scrollbar { display: none; }
.tv-root.tv-hybrid .tv-hybrid-portrait .tv-route-map {
  flex-basis: clamp(76px, 13vh, 126px);
  margin: 10px 0 8px;
}
.tv-root.tv-hybrid .tv-hybrid-portrait .tv-route-stops {
  grid-template-columns: 1fr;
  gap: 6px;
}
.tv-root.tv-hybrid .tv-hybrid-portrait .tv-stop {
  padding: 9px;
}
.tv-root.tv-hybrid .tv-hybrid-portrait .tv-stop-name {
  margin: 3px 0;
  font-size: clamp(.86rem, 1.35vw, 1.08rem);
}
.tv-root.tv-hybrid .tv-hybrid-portrait .tv-stop-desc {
  font-size: clamp(.66rem, 1vw, .78rem);
}
.tv-root.tv-hybrid .tv-hybrid-portrait .tv-qr {
  right: clamp(10px, 1.4vw, 18px);
  bottom: clamp(10px, 1.4vw, 18px);
}
.tv-root.tv-hybrid .tv-hybrid-portrait .tv-outro {
  display: none;
}

.tv-root.tv-hybrid .tv-hybrid-ticker {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) minmax(0, 1.2fr) auto;
  align-items: center;
  gap: clamp(10px, 1.5vw, 24px);
  min-width: 0;
  min-height: clamp(48px, 5vw, 72px);
  padding: 10px clamp(14px, 2vw, 26px);
  border: 1px solid rgba(232, 194, 106, .32);
  border-radius: 14px;
  background: rgba(22, 19, 28, .92);
  box-shadow: 0 14px 34px rgba(0,0,0,.25);
}
.tv-hybrid-ticker-kicker {
  color: var(--tv-gold);
  font-size: clamp(.62rem, .9vw, .78rem);
  font-weight: 900;
  letter-spacing: .12em;
  white-space: nowrap;
}
.tv-hybrid-ticker-title {
  min-width: 0;
  overflow: hidden;
  color: var(--tv-cream);
  font-size: clamp(.9rem, 1.45vw, 1.2rem);
  text-overflow: ellipsis;
  white-space: nowrap;
}
.tv-hybrid-ticker-meta {
  min-width: 0;
  overflow: hidden;
  color: rgba(246,239,226,.72);
  font-size: clamp(.72rem, 1vw, .9rem);
  text-overflow: ellipsis;
  white-space: nowrap;
}
.tv-hybrid-ticker-prompt {
  color: rgba(246,239,226,.52);
  font-size: clamp(.66rem, .9vw, .78rem);
  white-space: nowrap;
}

/* Il selettore resta riconoscibile anche prima del primo movimento. */
#tvPage .tv-format-picker {
  position: relative;
  z-index: 20;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
#tvPage .tv-format-share {
  margin-left: auto;
}
.tv-format-share-url {
  max-width: min(42vw, 420px);
  overflow: hidden;
  color: rgba(246,239,226,.58);
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: .7rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.tv-format-share-status {
  min-width: 8ch;
  color: #2f8f68;
  font-size: .78rem;
  font-weight: 800;
}

@media (max-width: 840px) {
  .tv-root.tv-hybrid .tv-frame {
    width: 100%;
    height: auto;
    min-height: 100vh;
    aspect-ratio: auto;
    padding: 8px;
  }
  .tv-root.tv-hybrid .tv-hybrid-layout {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto auto auto;
    align-items: start;
  }
  .tv-root.tv-hybrid .tv-hybrid-empty {
    width: 100%;
    min-height: min(58vw, 390px);
  }
  .tv-root.tv-hybrid .tv-hybrid-portrait {
    width: min(100%, 420px);
    justify-self: center;
  }
  .tv-root.tv-hybrid .tv-hybrid-portrait .tv-stage {
    width: 100%;
    height: auto;
    max-height: none;
  }
}

@media (max-width: 560px) {
  .tv-root.tv-hybrid .tv-hybrid-layout {
    gap: 10px;
  }
  .tv-root.tv-hybrid .tv-hybrid-ticker {
    grid-template-columns: 1fr;
    gap: 3px;
    min-height: 0;
    padding: 10px 12px;
  }
  .tv-hybrid-ticker-meta,
  .tv-hybrid-ticker-prompt {
    white-space: normal;
  }
  #tvPage .tv-format-share {
    margin-left: 0;
  }
}
