/* LE RADAR — Embed Solitaire
   ═══════════════════════════════════════════════════════════
   Barre bureau du site :
   · gauche : EN ONDES · dial · prev/next · play · volume inline
   · droite : module « À l'antenne » (grille 2 colonnes)
   L’iframe est souvent < 1100 px : look + logique bureau forcés.
   Hauteur 62 px = padding 10 + contrôles 42.
*/

html[data-embed="tuner"] {
  --pad: 12px;
  --embed-bar-h: 62px;
  --embed-ctrl: 42px;
  --embed-play: 42px;
  --embed-gap: 7px;
  /* Volume compact — le dial a besoin de la place */
  --embed-vol-track: 72px;
  /* Gauche (synthé) dominante : le dial ne doit jamais être écrasé */
  --embed-cols: minmax(0, 2.1fr) minmax(160px, 0.9fr);
  --tuner-onair-live: #ff7d6e;
  --tuner-onair-idle: rgba(255, 255, 255, 0.42);
  color-scheme: dark;
  background: transparent;
  overflow: hidden;
  height: var(--embed-bar-h);
  max-height: var(--embed-bar-h);
}

html[data-embed="tuner"] body {
  margin: 0;
  background: transparent;
  overflow: hidden;
  height: var(--embed-bar-h);
  max-height: var(--embed-bar-h);
  color: #fff;
  -webkit-font-smoothing: antialiased;
}

/* Barre pleine largeur — silhouette sticky du site (sans double chrome) */
html[data-embed="tuner"] .tuner {
  position: static;
  top: auto;
  z-index: 1;
  /* Même fond que --tuner-bg du site, intégré dans la pastille Solitaire */
  background: transparent;
  color: #fff;
  box-shadow: none;
  border: 0;
  border-radius: 0;
  overflow: hidden;
  height: var(--embed-bar-h);
  max-height: var(--embed-bar-h);
  min-height: var(--embed-bar-h);
  box-sizing: border-box;
}

html[data-embed="tuner"] .tuner-inner {
  max-width: none;
  margin: 0;
  /* Synthé ~2/3 · antenne ~1/3 (les contrôles fixes mangent la gauche) */
  padding: 10px 6px;
  gap: 12px;
  height: 100%;
  box-sizing: border-box;
  overflow: hidden;
  display: grid;
  grid-template-columns: var(--embed-cols);
  align-items: center;
}

html[data-embed="tuner"] .tuner-controls {
  grid-column: 1;
  gap: var(--embed-gap);
  flex: unset;
  min-width: 0;
  width: 100%;
  max-width: 100%;
  align-items: center;
  container-type: inline-size;
  container-name: tuner-controls;
}

/* ── EN ONDES + crédit source (badge bureau) ──────────────── */
html[data-embed="tuner"] .tuner-label {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 2px;
  flex-shrink: 0;
  min-width: 0;
  line-height: 1;
}

html[data-embed="tuner"] .tuner-onair {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.14em;
  color: var(--tuner-onair-idle);
  white-space: nowrap;
}

html[data-embed="tuner"] .tuner-onair::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.25);
  transition: background 200ms ease;
}

html[data-embed="tuner"] .tuner.is-playing .tuner-onair {
  color: var(--tuner-onair-live);
}

html[data-embed="tuner"] .tuner.is-playing .tuner-onair::before {
  background: #c8102e;
  animation: onairPulse 1.6s ease-out infinite;
}

/* Attribution — 📡 + le-radar.ca (bleu radio, contraste avec coral EN ONDES) */
html[data-embed="tuner"] .tuner-embed-credit {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  margin: 0;
  padding: 0 0 0 13px; /* aligne sous le texte EN ONDES, pas sous le point */
  font-family: var(--sans, Inter, system-ui, sans-serif);
  font-size: 8.5px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: lowercase;
  text-decoration: none;
  color: rgba(120, 168, 255, 0.78);
  white-space: nowrap;
  line-height: 1.1;
  transition: color 140ms ease, opacity 140ms ease;
}

html[data-embed="tuner"] .tuner-embed-credit-emoji,
html[data-embed="tuner"] .tuner-embed-credit .app-emoji {
  width: 11px;
  height: 11px;
  display: block;
  object-fit: contain;
  /* Légèrement plus visible que le texte, reste discret */
  opacity: 0.92;
  flex-shrink: 0;
}

html[data-embed="tuner"] .tuner-embed-credit-text {
  min-width: 0;
}

html[data-embed="tuner"] .tuner-embed-credit:hover,
html[data-embed="tuner"] .tuner-embed-credit:focus-visible {
  color: rgba(160, 198, 255, 0.95);
  text-decoration: none;
  outline: none;
}

html[data-embed="tuner"] .tuner-embed-credit:hover .tuner-embed-credit-emoji,
html[data-embed="tuner"] .tuner-embed-credit:focus-visible .tuner-embed-credit-emoji {
  opacity: 1;
}

/* Reste bleu en lecture (ne pas virer coral comme EN ONDES) */
html[data-embed="tuner"] .tuner.is-playing .tuner-embed-credit {
  color: rgba(120, 168, 255, 0.82);
}

html[data-embed="tuner"] .tuner.is-playing .tuner-embed-credit:hover,
html[data-embed="tuner"] .tuner.is-playing .tuner-embed-credit:focus-visible {
  color: rgba(180, 210, 255, 1);
}

/* ── Prev / next — 42 px comme le bureau ──────────────────── */
html[data-embed="tuner"] .tuner-step {
  width: var(--embed-ctrl);
  height: var(--embed-ctrl);
  min-width: var(--embed-ctrl);
  border-radius: 10px;
  box-shadow: 0 4px 12px -4px rgba(0, 0, 0, 0.45);
  flex-shrink: 0;
}

html[data-embed="tuner"] .tuner-step svg {
  width: 20px;
  height: 20px;
}

/* ── Dial (2 lignes : poste · acronyme / slogan) ───────────── */
html[data-embed="tuner"] .tuner-dial {
  flex: 1 1 auto;
  min-width: 140px; /* ne plus s’écraser en « in pos / Univer: » */
  width: 0;
  max-width: none;
}

html[data-embed="tuner"] .tuner-now {
  min-height: var(--embed-ctrl);
  height: var(--embed-ctrl);
  padding: 3px 22px 3px 11px;
  border-radius: 9px;
  box-sizing: border-box;
  justify-content: center;
  gap: 0;
  width: 100%;
  min-width: 0;
  overflow: hidden;
}

html[data-embed="tuner"] .tuner-now-name {
  font-size: 13px;
  line-height: 1.15;
  font-weight: 600;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

html[data-embed="tuner"] .tuner-now-sub {
  font-size: 10.5px;
  line-height: 1.2;
  color: rgba(255, 255, 255, 0.5);
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

html[data-embed="tuner"] .tuner-now-sub-rotate {
  min-height: 1.2em;
  min-width: 0;
  width: 100%;
  overflow: hidden;
}

/*
 * Défilement doux (marquee) autorisé sur le dial embed.
 * Le panneau latéral « À l'antenne » garde ellipsis (style.css).
 */
html[data-embed="tuner"] .tuner-now .is-marquee {
  text-overflow: clip;
}

html[data-embed="tuner"] .tuner-now .is-marquee > .tuner-now-sub-text {
  display: inline-block;
  white-space: nowrap;
  animation: tunerMarquee var(--marquee-duration, 12s) linear infinite alternate;
  will-change: transform;
  backface-visibility: hidden;
  transform: translateZ(0);
}

@media (prefers-reduced-motion: reduce) {
  html[data-embed="tuner"] .tuner-now .is-marquee {
    text-overflow: ellipsis;
  }
  html[data-embed="tuner"] .tuner-now .is-marquee > .tuner-now-sub-text {
    animation: none !important;
    transform: none !important;
  }
}

/* Lecture : contour coral (site tous formats) */
html[data-embed="tuner"] .tuner.is-playing .tuner-now {
  border-color: rgba(255, 125, 110, 0.7);
  background: rgba(200, 16, 46, 0.1);
  box-shadow: 0 0 0 1px rgba(200, 16, 46, 0.22);
}

html[data-embed="tuner"] .tuner.is-playing .tuner-dial:hover .tuner-now {
  border-color: rgba(255, 125, 110, 0.85);
  background: rgba(200, 16, 46, 0.14);
}

html[data-embed="tuner"] .tuner.is-external .tuner-now {
  border-color: rgba(93, 155, 224, 0.55);
  background: rgba(0, 61, 165, 0.1);
  box-shadow: none;
}

/* ── Actions (play + volume inline bureau) ────────────────── */
html[data-embed="tuner"] .tuner-actions {
  gap: 9px;
  align-self: center;
  align-items: center;
  min-height: var(--embed-ctrl);
  margin-left: 0;
  flex-shrink: 0;
}

html[data-embed="tuner"] .tuner-play {
  width: var(--embed-play);
  height: var(--embed-play);
  min-width: var(--embed-play);
  flex-shrink: 0;
  box-shadow: 0 6px 18px -6px rgba(200, 16, 46, 0.7);
}

html[data-embed="tuner"] .tuner-play svg {
  width: 20px;
  height: 20px;
}

/* Volume toujours en ligne (comme ≥1100 px du site) */
html[data-embed="tuner"] .tuner-vol {
  display: flex;
  align-items: center;
  align-self: center;
  gap: 0;
  height: var(--embed-ctrl);
  position: relative;
  overflow: visible;
  flex: 0 0 auto;
  max-width: calc(var(--embed-ctrl) + var(--embed-vol-track));
  min-width: 0;
}

html[data-embed="tuner"] .tuner-vol-btn {
  flex-shrink: 0;
  width: var(--embed-ctrl);
  height: var(--embed-ctrl);
  padding: 0;
  margin: 0;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.06);
  color: rgba(255, 255, 255, 0.72);
  cursor: pointer;
  transition: background 120ms ease, border-color 120ms ease, color 120ms ease, transform 120ms ease;
}

html[data-embed="tuner"] .tuner-vol-btn:hover {
  color: rgba(255, 255, 255, 0.95);
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.28);
}

html[data-embed="tuner"] .tuner-vol-btn:active {
  transform: scale(0.93);
}

html[data-embed="tuner"] .tuner-vol-btn .ico-vol,
html[data-embed="tuner"] .tuner-vol-btn .ico-vol-mute {
  width: 20px;
  height: 20px;
}

html[data-embed="tuner"] .tuner.is-boosted .tuner-vol-btn {
  color: #ff7d6e;
  border-color: rgba(255, 125, 110, 0.35);
}

html[data-embed="tuner"] .tuner-vol-slot {
  display: flex;
  align-items: center;
  height: var(--embed-ctrl);
  overflow: visible;
  position: static;
  opacity: 1;
  transform: none;
  pointer-events: auto;
  width: auto;
  flex: 0 0 auto;
  max-width: var(--embed-vol-track);
  min-width: 0;
  padding: 0;
  background: transparent;
  border: none;
  border-radius: 0;
  box-shadow: none;
}

html[data-embed="tuner"] .tuner-vol-slot::before {
  display: none;
}

html[data-embed="tuner"] .tuner-vol-popover {
  display: contents;
}

html[data-embed="tuner"] .tuner-vol-mute-btn {
  display: none !important;
}

html[data-embed="tuner"] .tuner-vol.is-open .tuner-vol-slot {
  opacity: 1;
  transform: none;
  pointer-events: auto;
}

html[data-embed="tuner"] .tuner-vol-track {
  width: var(--embed-vol-track);
  max-width: var(--embed-vol-track);
  min-width: 56px;
  flex: 0 0 var(--embed-vol-track);
  height: var(--embed-ctrl);
  justify-content: center;
  gap: 0;
  position: relative;
  overflow: visible;
}

html[data-embed="tuner"] .tuner-vol-slider {
  min-height: 0;
  height: 100%;
  width: 100%;
}

html[data-embed="tuner"] .tuner-vol-labels {
  display: none !important;
}

/* Cast / EQ : hors barre embed */
html[data-embed="tuner"] .tuner-cast--bar,
html[data-embed="tuner"] .tuner-cast--mobile,
html[data-embed="tuner"] .tuner-cast--popover,
html[data-embed="tuner"] .tuner-cast--popover:not(.hidden) {
  display: none !important;
}

html[data-embed="tuner"] .tuner-eq {
  display: none !important;
}

/* ── Module « À l'antenne » — hauteur = dial, largeur plafonnée ── */
html[data-embed="tuner"] .tuner-nowair,
html[data-embed="tuner"] .tuner-nowair.hidden {
  grid-column: 2;
  display: flex !important;
  flex-direction: row;
  /* Top-align so « À l'antenne » sits on the first line (title), not mid-stack */
  align-items: flex-start;
  gap: 10px;
  flex: unset;
  width: 100%;
  max-width: 280px; /* ne pas dominer le dial */
  min-width: 0;
  height: var(--embed-ctrl);
  min-height: var(--embed-ctrl);
  margin-left: 0;
  justify-self: stretch;
  padding: 3px 10px 3px 4px;
  border: none;
  border-radius: 9px;
  background: transparent;
  align-self: center;
  opacity: 1;
  pointer-events: auto;
  box-sizing: border-box;
  transition: opacity 0.3s ease;
  overflow: hidden;
}

html[data-embed="tuner"] .tuner-nowair.is-swapping {
  opacity: 0;
}

html[data-embed="tuner"] .tuner-nowair-label {
  flex-shrink: 0;
  /* Optical align with .tuner-nowair-title (13px / line-height 1.15) first line */
  margin-top: 2px;
  font-size: 10px; /* même échelle que EN ONDES */
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  /* Même poids visuel que EN ONDES (pas plus pâle) */
  color: var(--tuner-onair-idle);
  white-space: nowrap;
  writing-mode: horizontal-tb;
  line-height: 1.15;
}

html[data-embed="tuner"] .tuner-nowair-body {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
  justify-content: center;
  overflow: hidden;
}

html[data-embed="tuner"] .tuner-nowair-title {
  margin: 0;
  font-family: var(--serif, "Source Serif 4", Georgia, serif);
  font-size: 13px;
  font-weight: 600;
  line-height: 1.15;
  color: var(--radio-bright, #8eb8ff);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

html[data-embed="tuner"] .tuner-nowair-sub {
  margin: 0;
  font-size: 10.5px;
  font-weight: 500;
  line-height: 1.2;
  color: rgba(255, 255, 255, 0.48);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

/* Statuts — même saturation que EN ONDES (pas de labels « lavés ») */
html[data-embed="tuner"] .tuner-nowair.is-live .tuner-nowair-label,
html[data-embed="tuner"] .tuner-nowair.is-live .tuner-nowair-title {
  color: var(--tuner-onair-live);
}

/* À VENIR : ambre plein (poids équivalent au coral EN ONDES) */
html[data-embed="tuner"] .tuner-nowair.is-upcoming .tuner-nowair-label,
html[data-embed="tuner"] .tuner-nowair.is-upcoming .tuner-nowair-title {
  color: #f0c14e;
}

html[data-embed="tuner"] .tuner-nowair.is-upcoming .tuner-nowair-sub {
  color: rgba(240, 193, 78, 0.78);
}

html[data-embed="tuner"] .tuner-nowair.is-empty .tuner-nowair-title {
  font-style: italic;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.55);
}

html[data-embed="tuner"] .toast {
  position: fixed;
  bottom: 8px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 80;
  max-width: calc(100% - 16px);
}

/* ── Largeurs : compresser volume / masquer antenne si trop serré ── */
@container tuner-controls (max-width: 480px) {
  .tuner-vol-track {
    width: 72px;
    max-width: 72px;
    flex-basis: 72px;
    min-width: 56px;
  }
}

@container tuner-controls (max-width: 380px) {
  .tuner-label {
    display: none !important;
  }

  .tuner-vol-track {
    width: 56px;
    max-width: 56px;
    flex-basis: 56px;
    min-width: 48px;
  }
}

/* Iframe < ~640 px : une seule colonne (synthé), antenne masquée */
@media (max-width: 639.98px) {
  html[data-embed="tuner"] {
    --embed-cols: minmax(0, 1fr);
    --embed-vol-track: 72px;
  }

  html[data-embed="tuner"] .tuner-inner {
    grid-template-columns: var(--embed-cols);
    padding: 10px 4px;
    gap: 0;
  }

  html[data-embed="tuner"] .tuner-nowair,
  html[data-embed="tuner"] .tuner-nowair.hidden {
    display: none !important;
  }

  html[data-embed="tuner"] .tuner-label {
    display: none !important;
  }
}

@media (max-width: 479.98px) {
  html[data-embed="tuner"] {
    --embed-vol-track: 56px;
    --embed-gap: 5px;
  }

  html[data-embed="tuner"] .tuner-inner {
    padding: 10px 2px;
  }
}

/* Pastille large : synthé toujours prioritaire, antenne plafonnée */
@media (min-width: 720px) {
  html[data-embed="tuner"] {
    --embed-cols: minmax(0, 2.2fr) minmax(180px, 1fr);
    --embed-vol-track: 84px;
    --embed-gap: 8px;
  }

  html[data-embed="tuner"] .tuner-dial {
    min-width: 180px;
  }

  html[data-embed="tuner"] .tuner-nowair,
  html[data-embed="tuner"] .tuner-nowair.hidden {
    max-width: 300px;
  }
}

@media (min-width: 900px) {
  html[data-embed="tuner"] {
    --embed-cols: minmax(0, 2.4fr) minmax(200px, 1fr);
    --embed-vol-track: 96px;
  }

  html[data-embed="tuner"] .tuner-dial {
    min-width: 200px;
  }
}
