/* ================================================================
   BELSA TV — Styles
   Vert · Rouge ★ · Jaune — toujours dans cet ordre
   ================================================================ */

:root {
    /* Couleurs de la marque */
    --vert:  #00875F;
    --rouge: #E3202F;
    --jaune: #FCD116;

    /* Interface : base noire, comme le fond du logo */
    --blanc:   #FFFFFF;    /* texte et icônes uniquement */
    --bg:      #0B0E0D;
    --bg-2:    #121614;
    --line:    rgba(255, 255, 255, .10);
    --text:    #F4F5F4;
    --muted:   #B2B8B4;
    --faint:   #7F8782;

    --font: "Montserrat", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    --wrap: 1200px;
    --gutter: 24px;
    --header-h: 64px;
    --radius: 16px;
    --ease: cubic-bezier(.2, .8, .2, 1);
}

/* ─── Base ─── */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
[hidden] { display: none !important; }

html {
    color-scheme: dark;
    scroll-behavior: smooth;
    scroll-padding-top: calc(var(--header-h) + 12px);
    -webkit-text-size-adjust: 100%;
}

body {
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    font-family: var(--font);
    font-size: 16px;
    line-height: 1.6;
    color: var(--text);
    background-color: var(--bg);
    background-image:
        radial-gradient(60% 50% at 0% 0%, rgba(0, 135, 95, .30), transparent 70%),
        radial-gradient(45% 35% at 50% 0%, rgba(227, 32, 47, .12), transparent 70%),
        radial-gradient(60% 50% at 100% 0%, rgba(252, 209, 22, .14), transparent 70%);
    background-repeat: no-repeat;
}

a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
svg { display: block; }
:focus-visible { outline: 2px solid var(--jaune); outline-offset: 2px; border-radius: 6px; }

.wrap {
    width: 100%;
    max-width: var(--wrap);
    margin-inline: auto;
    padding-inline: var(--gutter);
}

.ico { width: 22px; height: 22px; flex: none; }

/* ─── Marque ─── */
.brand { display: inline-flex; align-items: center; gap: 10px; }
.brand .emblem { width: 34px; height: 34px; flex: none; }
.wordmark {
    font-size: 1.25rem;
    font-weight: 800;
    letter-spacing: .04em;
    line-height: 1;
    white-space: nowrap;
}
.wordmark span { font-weight: 400; margin-left: .22em; }

/* ─── Bande aux couleurs de la marque : vert · rouge ★ · jaune ─── */
.junction { display: flex; height: 3px; }
.junction > * { flex: 1; }
.j-g { background: var(--vert); }
.j-r { background: var(--rouge); }
.j-y { background: var(--jaune); }

/* L'étoile jaune, centrée sur la bande rouge */
.j-star { position: relative; }
.j-star svg {
    position: absolute;
    left: 50%;
    top: 50%;
    width: 18px;
    height: 18px;
    transform: translate(-50%, -50%);
    fill: var(--jaune);
    filter: drop-shadow(0 0 6px rgba(252, 209, 22, .55));
}
.junction--lg { height: 4px; }
.junction--lg .j-star svg { width: 26px; height: 26px; }

/* ═════════════ EN-TÊTE ═════════════ */
.site-header {
    position: sticky;
    top: 0;
    z-index: 50;
    background: rgba(11, 14, 13, .84);
    backdrop-filter: blur(16px) saturate(1.4);
    -webkit-backdrop-filter: blur(16px) saturate(1.4);
}

.header-inner {
    height: var(--header-h);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
}

.nav { display: flex; gap: 4px; }
.nav a {
    padding: 8px 16px;
    border-radius: 999px;
    font-size: .9rem;
    font-weight: 600;
    color: var(--muted);
    transition: color .2s, background .2s;
}
.nav a:hover { color: var(--blanc); background: rgba(255, 255, 255, .07); }

.on-air {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 13px 6px 11px;
    border-radius: 999px;
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, .06);
    color: var(--muted);
    font-size: .72rem;
    font-weight: 800;
    letter-spacing: .1em;
    text-transform: uppercase;
    white-space: nowrap;
    transition: background .3s, color .3s;
}
.on-air i { width: 8px; height: 8px; border-radius: 50%; background: var(--faint); }

body[data-live="on"] .on-air { background: var(--rouge); border-color: transparent; color: var(--blanc); }
body[data-live="on"] .on-air i { background: var(--jaune); animation: pulse 1.6s ease-in-out infinite; }
body[data-live="loading"] .on-air i { background: var(--jaune); animation: blink 1s ease-in-out infinite; }

/* ═════════════ DIRECT ═════════════ */
.hero { flex: 1; padding: 28px 0 56px; }

.player {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    isolation: isolate;
    background: #000;
    border-radius: var(--radius);
    box-shadow:
        0 0 0 1px var(--line),
        0 30px 80px -24px rgba(0, 0, 0, .85),
        0 0 70px -24px rgba(0, 135, 95, .5);
    user-select: none;
    -webkit-user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.player video,
.player iframe {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: 0;
    background: #000;
    object-fit: contain;
}

.player:fullscreen { width: 100%; height: 100%; border-radius: 0; box-shadow: none; }
.player:-webkit-full-screen { width: 100%; height: 100%; border-radius: 0; box-shadow: none; }

.player[data-state="live"]:not(.ui-on) { cursor: none; }

/* Badge EN DIRECT */
.p-badge {
    position: absolute;
    top: 14px;
    left: 14px;
    z-index: 3;
    display: none;
    align-items: center;
    gap: 7px;
    padding: 5px 11px 5px 9px;
    border-radius: 6px;
    background: var(--rouge);
    color: var(--blanc);
    font-size: .7rem;
    font-weight: 800;
    letter-spacing: .1em;
    text-transform: uppercase;
    box-shadow: 0 4px 14px rgba(227, 32, 47, .45);
    pointer-events: none;
}
.p-badge i { width: 7px; height: 7px; border-radius: 50%; background: var(--jaune); animation: pulse 1.6s ease-in-out infinite; }

/* Bouton « Activer le son » (lecture auto en muet) */
.p-unmute {
    position: absolute;
    top: 12px;
    right: 12px;
    z-index: 5;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 15px 8px 12px;
    border-radius: 999px;
    background: var(--jaune);
    color: var(--bg);
    font-size: .85rem;
    font-weight: 800;
    box-shadow: 0 6px 20px rgba(0, 0, 0, .45);
    animation: nudge 2.4s ease-in-out infinite;
}
.p-unmute .ico { width: 18px; height: 18px; }

/* Chargement */
.p-spinner {
    position: absolute;
    left: 50%;
    top: 50%;
    z-index: 2;
    display: none;
    width: 46px;
    height: 46px;
    margin: -23px 0 0 -23px;
    border-radius: 50%;
    border: 3px solid rgba(255, 255, 255, .18);
    border-top-color: var(--jaune);
    animation: spin .8s linear infinite;
    pointer-events: none;
}

/* Grand bouton lecture */
.p-bigplay {
    position: absolute;
    inset: 0;
    z-index: 2;
    display: none;
    place-items: center;
    background: rgba(11, 14, 13, .35);
}
.p-bigplay span {
    width: 76px;
    height: 76px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: var(--rouge);
    color: var(--blanc);
    box-shadow: 0 10px 40px rgba(227, 32, 47, .55);
    transition: transform .2s var(--ease);
}
.p-bigplay:hover span { transform: scale(1.07); }
.p-bigplay svg { width: 34px; height: 34px; margin-left: 4px; }

/* Écran hors antenne / interlude animé
   --beat et --level sont mis à jour par script.js au rythme de la musique */
.p-offline {
    --emblem: 70px;
    position: absolute;
    inset: 0;
    z-index: 3;
    display: none;
    place-items: center;
    padding: 24px;
    text-align: center;
    overflow: hidden;
    background: var(--bg);
}
.player.is-fs .p-offline { --emblem: clamp(56px, 10vh, 120px); }
.p-offline:has(.p-ivol[data-audio="pending"]) { cursor: pointer; }

/* Canvas : halo de fréquences, onde sonore, particules */
.p-interlude-bg {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
}

/* Bandes colorées qui défilent, plus vives quand la musique monte */
.p-interlude-bands {
    position: absolute;
    inset: 0;
    z-index: 0;
    overflow: hidden;
    pointer-events: none;
    opacity: calc(.6 + var(--level, 0) * 1.2);
}
.p-interlude-bands .band {
    position: absolute;
    width: 200%;
    height: 5px;
    opacity: .3;
    filter: blur(2px);
    animation: band-slide 8s linear infinite;
}
.band-green {
    background: linear-gradient(90deg, transparent, var(--vert), transparent);
    top: 28%;
    animation-delay: 0s;
}
.band-red {
    background: linear-gradient(90deg, transparent, var(--rouge), transparent);
    top: 50%;
    animation-delay: -2.6s;
}
.band-yellow {
    background: linear-gradient(90deg, transparent, var(--jaune), transparent);
    top: 72%;
    animation-delay: -5.2s;
}

/* Logo qui bat au rythme de la musique (le halo est dessiné autour, sur le canvas) */
.p-interlude-logo {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto calc(var(--emblem) * .62);
    transform: scale(calc(1 + var(--beat, 0) * .1));
}
.p-offline .p-interlude-logo .emblem {
    width: var(--emblem);
    height: var(--emblem);
    position: relative;
    z-index: 2;
    animation: logo-breathe 3s ease-in-out infinite;
    filter: drop-shadow(0 0 18px rgba(252, 209, 22, .4));
}

.p-offline-inner {
    position: relative;
    z-index: 2;
    max-width: 480px;
    text-shadow: 0 2px 14px rgba(0, 0, 0, .85);
}
.p-offline h2 { font-size: clamp(1.05rem, .9rem + 1vw, 1.6rem); font-weight: 800; line-height: 1.25; }
.p-offline p { margin-top: 6px; color: var(--muted); font-size: clamp(.82rem, .78rem + .3vw, 1rem); }
.p-offline .p-detail { margin-top: 12px; color: var(--faint); font-size: .78rem; }

/* Scrolling news ticker at bottom */
.p-ticker {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 2;
    height: 36px;
    overflow: hidden;
    background: linear-gradient(90deg, var(--vert), var(--rouge) 50%, var(--jaune));
    display: flex;
    align-items: center;
}
.p-ticker-track {
    display: flex;
    white-space: nowrap;
    animation: ticker-scroll 20s linear infinite;
}
.p-ticker-track span {
    display: inline-block;
    padding: 0 2em;
    font-size: .82rem;
    font-weight: 800;
    letter-spacing: .04em;
    color: var(--blanc);
    text-shadow: 0 1px 3px rgba(0, 0, 0, .3);
}

/* Son de l'interlude : bouton + réglage du volume */
.p-ivol {
    position: absolute;
    top: 14px;
    right: 14px;
    z-index: 5;
    display: flex;
    align-items: center;
    height: 40px;
    padding: 0 4px;
    border-radius: 999px;
    background: rgba(0, 0, 0, .45);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, .16);
    color: var(--blanc);
    cursor: auto;
    transition: background .2s, color .2s;
}
.p-ivol-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-width: 32px;
    height: 32px;
    border-radius: 999px;
    transition: background .2s;
}
.p-ivol-btn:hover { background: rgba(255, 255, 255, .14); }
.p-ivol-btn .ico { width: 20px; height: 20px; }
.p-ivol-label { display: none; font-size: .85rem; font-weight: 800; white-space: nowrap; }
.p-ivol input { width: 92px; margin: 0 12px 0 6px; }

.p-ivol .i-sound-off,
.p-ivol[data-audio="pending"] .i-sound-on,
.p-ivol[data-audio="muted"] .i-sound-on { display: none; }
.p-ivol[data-audio="pending"] .i-sound-off,
.p-ivol[data-audio="muted"] .i-sound-off { display: block; }

/* Avant le premier clic, le navigateur bloque le son : on invite à l'activer */
.p-ivol[data-audio="pending"] {
    background: var(--jaune);
    border-color: transparent;
    color: var(--bg);
    box-shadow: 0 6px 20px rgba(0, 0, 0, .45);
    animation: nudge 2.4s ease-in-out infinite;
}
.p-ivol[data-audio="pending"] .p-ivol-btn { padding: 0 12px 0 8px; }
.p-ivol[data-audio="pending"] .p-ivol-btn:hover { background: transparent; }
.p-ivol[data-audio="pending"] .p-ivol-label { display: inline; }
.p-ivol[data-audio="pending"] input { display: none; }

@media (pointer: coarse) {
    .p-ivol input::-webkit-slider-thumb { width: 18px; height: 18px; }
    .p-ivol input::-moz-range-thumb { width: 18px; height: 18px; }
}

/* Interlude-specific keyframes */
@keyframes band-slide {
    0% { transform: translateX(-50%); }
    100% { transform: translateX(0%); }
}
@keyframes logo-breathe {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.06); }
}
@keyframes ticker-scroll {
    0% { transform: translateX(0); }
    100% { transform: translateX(-50%); }
}

/* Barre de contrôles */
.p-controls {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 4;
    display: none;
    align-items: center;
    gap: 2px;
    padding: 48px 10px 10px;
    background: linear-gradient(to top, rgba(0, 0, 0, .8), rgba(0, 0, 0, 0));
    opacity: 0;
    transform: translateY(8px);
    pointer-events: none;
    transition: opacity .25s var(--ease), transform .25s var(--ease);
}

.p-btn {
    width: 44px;
    height: 44px;
    display: grid;
    place-items: center;
    border-radius: 10px;
    color: var(--blanc);
    transition: background .2s;
}
.p-btn:hover { background: rgba(255, 255, 255, .14); }
.p-btn .ico { width: 24px; height: 24px; }
.p-spacer { flex: 1; }

.p-volume { display: flex; align-items: center; }
.p-volume input {
    width: 0;
    opacity: 0;
    transition: width .25s var(--ease), opacity .2s, margin .25s var(--ease);
}
.p-volume:hover input,
.p-volume:focus-within input { width: 84px; opacity: 1; margin: 0 8px 0 4px; }

input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    height: 4px;
    border-radius: 4px;
    background: linear-gradient(to right, var(--jaune) var(--v, 100%), rgba(255, 255, 255, .3) var(--v, 100%));
    cursor: pointer;
}
input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 13px;
    height: 13px;
    border: 0;
    border-radius: 50%;
    background: var(--jaune);
}
input[type="range"]::-moz-range-thumb {
    width: 13px;
    height: 13px;
    border: 0;
    border-radius: 50%;
    background: var(--jaune);
}

.p-live {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    height: 32px;
    margin-left: 6px;
    padding: 0 10px;
    border-radius: 6px;
    color: var(--blanc);
    font-size: .72rem;
    font-weight: 800;
    letter-spacing: .1em;
    text-transform: uppercase;
    transition: background .2s, color .2s;
}
.p-live:hover { background: rgba(255, 255, 255, .14); }
.p-live i { width: 8px; height: 8px; border-radius: 50%; background: var(--rouge); box-shadow: 0 0 0 3px rgba(227, 32, 47, .3); }
.player.is-behind .p-live { color: var(--muted); }
.player.is-behind .p-live i { background: var(--faint); box-shadow: none; }

/* Icônes alternées */
.i-pause, .i-muted, .i-fs-exit { display: none; }
.player[data-state="live"] .i-play { display: none; }
.player[data-state="live"] .i-pause { display: block; }
.player.is-muted .i-vol { display: none; }
.player.is-muted .i-muted { display: block; }
.player.is-fs .i-fs { display: none; }
.player.is-fs .i-fs-exit { display: block; }

/* ─── Affichage selon l'état du lecteur ─── */
.player[data-state="loading"] .p-spinner,
.player[data-state="live"].is-waiting .p-spinner { display: block; }

.player[data-state="paused"] .p-bigplay { display: grid; }

.player[data-state="offline"] .p-offline,
.player[data-state="error"] .p-offline,
.player.is-retrying[data-state="loading"] .p-offline { display: grid; }

.player[data-state="live"] .p-badge,
.player[data-state="paused"] .p-badge { display: inline-flex; }

.player[data-state="live"] .p-controls,
.player[data-state="paused"] .p-controls { display: flex; }

.player.ui-on .p-controls,
.player[data-state="paused"] .p-controls { opacity: 1; transform: none; pointer-events: auto; }

.player:not([data-state="live"]):not([data-state="paused"]) .p-unmute { display: none; }

/* Mode lecteur intégré (iframe MediaCP) : il a ses propres contrôles */
.player.is-iframe .p-badge,
.player.is-iframe .p-controls,
.player.is-iframe .p-bigplay,
.player.is-iframe .p-spinner,
.player.is-iframe .p-unmute { display: none !important; }

/* ─── Sous le lecteur ─── */
.now {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 16px 24px;
    margin-top: 22px;
}
.now h1 {
    font-size: clamp(1.2rem, 1rem + 1vw, 1.65rem);
    font-weight: 800;
    line-height: 1.2;
    letter-spacing: -.01em;
}
.now h1 span { font-weight: 400; color: var(--muted); }
.now p { margin-top: 4px; color: var(--muted); font-size: .95rem; }

.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    height: 42px;
    padding: 0 18px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: rgba(255, 255, 255, .05);
    font-size: .9rem;
    font-weight: 700;
    transition: background .2s, color .2s, border-color .2s;
}
.btn:hover { background: var(--jaune); border-color: var(--jaune); color: var(--bg); }
.btn .ico { width: 18px; height: 18px; }

/* ═════════════ PIED DE PAGE ═════════════ */
.site-footer { background: var(--bg-2); }

.footer-grid {
    display: grid;
    grid-template-columns: 1.3fr 1fr 1fr;
    gap: 40px 56px;
    padding-block: 56px 44px;
}

.f-brand .emblem { width: 40px; height: 40px; }
.f-desc { margin-top: 16px; max-width: 38ch; color: var(--muted); font-size: .95rem; }

.socials { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 22px; }
.socials a {
    width: 40px;
    height: 40px;
    display: grid;
    place-items: center;
    border: 1px solid var(--line);
    border-radius: 50%;
    color: var(--muted);
    transition: background .2s, color .2s, border-color .2s, transform .2s var(--ease);
}
.socials a:hover { background: var(--jaune); border-color: var(--jaune); color: var(--bg); transform: translateY(-2px); }
.socials svg { width: 18px; height: 18px; }

.f-title {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 18px;
    font-size: .78rem;
    font-weight: 800;
    letter-spacing: .14em;
    text-transform: uppercase;
}
.f-title svg { width: 15px; height: 15px; fill: var(--jaune); }

.f-info { display: grid; gap: 14px; }
.f-info dt { color: var(--faint); font-size: .72rem; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; }
.f-info dd { margin: 0; font-size: .95rem; }

.f-contact { display: grid; gap: 14px; padding: 0; list-style: none; }
.f-contact li { display: flex; align-items: flex-start; gap: 12px; font-size: .95rem; }
.f-contact .ico { width: 20px; height: 20px; margin-top: 2px; color: var(--jaune); }
.f-contact a { transition: color .2s; }
.f-contact a:hover { color: var(--jaune); }

.f-bottom {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 8px 24px;
    padding-block: 20px 28px;
    border-top: 1px solid var(--line);
    color: var(--faint);
    font-size: .82rem;
}
.f-bottom a { transition: color .2s; }
.f-bottom a:hover { color: var(--text); }

/* ─── Notification ─── */
.toast {
    position: fixed;
    left: 50%;
    bottom: calc(24px + env(safe-area-inset-bottom));
    z-index: 100;
    max-width: calc(100% - 32px);
    padding: 10px 18px;
    border-radius: 999px;
    background: var(--jaune);
    color: var(--bg);
    font-size: .9rem;
    font-weight: 700;
    box-shadow: 0 10px 30px rgba(0, 0, 0, .45);
    opacity: 0;
    transform: translate(-50%, 16px);
    pointer-events: none;
    transition: opacity .25s var(--ease), transform .25s var(--ease);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ─── Animations ─── */
@keyframes pulse { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: .45; transform: scale(.8); } }
@keyframes blink { 50% { opacity: .3; } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes nudge { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-2px); } }

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ═════════════ RESPONSIVE ═════════════ */
@media (hover: none) {
    .p-volume input { display: none; }
}

@media (max-width: 900px) {
    .footer-grid { grid-template-columns: 1fr 1fr; }
    .f-brand { grid-column: 1 / -1; }
}

@media (max-width: 760px) {
    .nav { display: none; }
}

@media (max-width: 640px) {
    :root { --gutter: 16px; --header-h: 58px; }

    .wordmark { font-size: 1.1rem; }
    .brand .emblem { width: 30px; height: 30px; }

    .hero { padding: 12px 0 36px; }

    /* Lecteur bord à bord sur mobile */
    .player {
        width: auto;
        margin-inline: calc(var(--gutter) * -1);
        border-radius: 0;
        box-shadow: none;
    }
    .p-badge { top: 10px; left: 10px; }
    .p-unmute { top: 8px; right: 8px; }
    .p-offline { --emblem: 40px; padding: 16px; }
    .p-ticker { height: 28px; }
    .p-ticker-track span { font-size: .72rem; }
    .p-ivol { top: 8px; right: 8px; height: 34px; }
    .p-ivol input { width: 64px; margin-right: 10px; }
    .p-btn { width: 40px; height: 40px; }
    .p-controls { padding: 40px 6px 6px; }

    .now { margin-top: 18px; }

    .footer-grid { grid-template-columns: 1fr; gap: 36px; padding-block: 44px 36px; }
}
