/* ==========================================================================
   Live Streaming Portatile — stile condiviso
   Palette e tipografia derivate da privacy.html (identità Amo Montesarchio)
   ========================================================================== */

:root {
  --cream: #f7f3ec;
  --ink: #1a1612;
  --rust: #8b3a2a;
  --rust-bright: #b8492f;
  --gold: #c4923a;
  --muted: #6b5f52;
  --divider: #d9d0c4;
  --bg-card: #fffdf9;
  --offline: #5a5248;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-tap-highlight-color: transparent; }

body {
  font-family: 'DM Sans', -apple-system, sans-serif;
  font-weight: 300;
  background: var(--ink);
  color: var(--cream);
  height: 100dvh;
  overflow: hidden;
}

.font-display {
  font-family: 'Cormorant Garamond', serif;
}

.eyebrow {
  font-size: 0.68rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--gold);
}

/* Accessibilità: focus visibile */
button:focus-visible, a:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 3px;
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}

/* ==========================================================================
   BROADCASTER — mobile-first, schermo intero, minimale
   ========================================================================== */

.broadcast-shell {
  position: relative;
  height: 100dvh;
  width: 100%;
  background: #000;
  overflow: hidden;
}

.broadcast-shell video#preview {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scaleX(-1); /* specchio per fotocamera frontale, default */
}
.broadcast-shell video#preview.rear { transform: none; }

.hud-top {
  position: absolute;
  top: 0; left: 0; right: 0;
  padding: max(1rem, env(safe-area-inset-top)) 1.1rem 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: linear-gradient(to bottom, rgba(0,0,0,0.55), transparent);
  z-index: 5;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0.8rem 0.35rem 0.6rem;
  border-radius: 999px;
  background: rgba(26, 22, 18, 0.55);
  backdrop-filter: blur(6px);
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  font-weight: 500;
}

.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--offline); flex-shrink: 0; }
.status-pill.live .dot {
  background: var(--rust-bright);
  animation: pulse 1.4s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(184,73,47,0.55); }
  50% { box-shadow: 0 0 0 6px rgba(184,73,47,0); }
}

.timer {
  font-family: 'Cormorant Garamond', serif;
  font-variant-numeric: tabular-nums;
  font-size: 1.3rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  color: var(--cream);
  opacity: 0.9;
}

.hud-bottom {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  padding: 2.5rem 1.5rem max(1.75rem, env(safe-area-inset-bottom));
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.5rem;
  background: linear-gradient(to top, rgba(0,0,0,0.65), transparent);
  z-index: 5;
}

.btn-primary {
  font-family: 'DM Sans', sans-serif;
  font-size: 0.95rem;
  font-weight: 500;
  letter-spacing: 0.03em;
  color: var(--cream);
  background: var(--rust);
  border: none;
  padding: 0.95rem 2.1rem;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
}
.btn-primary:active { transform: scale(0.97); }
.btn-primary.stop { background: var(--offline); }

.btn-icon {
  width: 3rem;
  height: 3rem;
  border-radius: 50%;
  border: 1px solid rgba(247,243,236,0.35);
  background: rgba(26,22,18,0.5);
  backdrop-filter: blur(6px);
  color: var(--cream);
  font-size: 1.2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.btn-icon:active { transform: scale(0.93); }

.broadcast-idle {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1.25rem;
  text-align: center;
  padding: 2rem;
  background: var(--ink);
  z-index: 10;
}
.broadcast-idle h1 {
  font-family: 'Cormorant Garamond', serif;
  font-size: 2rem;
  font-weight: 400;
}
.broadcast-idle h1 em { color: var(--gold); font-style: italic; }
.broadcast-idle p {
  color: var(--muted);
  font-size: 0.9rem;
  max-width: 30ch;
  line-height: 1.6;
}
.broadcast-idle p.error { color: var(--rust-bright); }

.hidden { display: none !important; }

/* ==========================================================================
   VIEWER — desktop / TV-first, stile palinsesto
   ========================================================================== */

.viewer-shell {
  position: relative;
  height: 100dvh;
  width: 100%;
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.viewer-shell video#remote {
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: #000;
}

.viewer-overlay {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  padding: 1.75rem 2rem 1.5rem;
  background: linear-gradient(to top, rgba(0,0,0,0.75), transparent 85%);
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1.5rem;
  z-index: 5;
}

.viewer-title {
  font-family: 'Cormorant Garamond', serif;
  font-size: clamp(1.3rem, 2.6vw, 1.9rem);
  font-weight: 600;
}

.viewer-offline {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  text-align: center;
  padding: 2rem;
  z-index: 10;
  background: var(--ink);
}
.viewer-offline h1 {
  font-family: 'Cormorant Garamond', serif;
  font-size: clamp(1.6rem, 4vw, 2.6rem);
  font-weight: 400;
}
.viewer-offline h1 em { color: var(--gold); font-style: italic; }
.viewer-offline p { color: var(--muted); max-width: 34ch; font-size: 0.92rem; line-height: 1.6; }

.tap-to-play {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.55);
  z-index: 8;
  cursor: pointer;
}
.tap-to-play .btn-primary { font-size: 1rem; padding: 1.1rem 2.4rem; }
