/* ==========================================================================
   Poesía y Cumbia Radio
   La poesía (IM Fell English, cursiva de imprenta antigua) contra la cumbia
   (Barlow Condensed, letra de cartel). Negro de película, rojo y amarillo de
   brocha como el logo, papel de las portadas. El protagonista es el disco.
   ========================================================================== */

:root {
    --negro: #000000;
    --rojo: #e1251b;
    --rojo-vivo: #ff3b2f;
    --amarillo: #ffdd00;
    --papel: #f1ebdd;
    --oro: #c8a25a;
    --humo: #aaa59c;

    --poesia: 'IM Fell English', 'Iowan Old Style', Georgia, serif;
    --cumbia: 'Barlow Condensed', 'Arial Narrow', 'Roboto Condensed', sans-serif;

    /* Escala tipográfica (cuarta justa, 1.333) */
    --t-xs: 14px;
    --t-s: 18px;
    --t-m: 24px;
    --t-l: 32px;
    --t-xl: 42px;

    /* Tamaño de la funda del disco; el resto del escenario se mide desde aquí */
    --funda: min(44vh, 29vw);
    /* Ancho de la figura del programa (esquina inferior derecha) */
    --figura: clamp(240px, 24vw, 500px);
    --borde: clamp(16px, 4vw, 72px);
}

*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    background: var(--negro);
}

body {
    min-height: 100vh;
    background: var(--negro) url('../images/bg.jpg') center / cover fixed no-repeat;
    color: var(--papel);
    font-family: var(--cumbia);
    font-size: var(--t-s);
    line-height: 1.45;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

body.section-open,
body.menu-open {
    overflow: hidden;
}

img {
    display: block;
    max-width: 100%;
}

a {
    color: inherit;
}

button {
    font: inherit;
    color: inherit;
    cursor: pointer;
}

ul,
ol {
    list-style: none;
}

/* Foco visible: teclado en el navegador y control remoto en la TV */
:focus {
    outline: none;
}

/* .tizen-focused solo se ve cuando se navega con flechas (control remoto o teclado) */
:focus-visible,
.nav-teclado .tizen-focused {
    outline: 3px solid var(--amarillo);
    outline-offset: 4px;
}

/* ==========================================================================
   Carga
   ========================================================================== */

.loading-modal {
    position: fixed;
    inset: 0;
    z-index: 5000;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 28px;
    padding: 24px;
    background: var(--negro);
    text-align: center;
}

.loading-modal-logo {
    width: min(520px, 76vw);
}

.loading-modal-progress {
    font-family: var(--poesia);
    font-style: italic;
    font-size: var(--t-l);
    animation: latido 1.6s ease-in-out infinite;
}

.loading-modal-error {
    max-width: 26em;
    font-size: var(--t-m);
    color: var(--papel);
}

.loading-modal-retry-btn {
    padding: 12px 32px;
    border: 0;
    border-radius: 999px;
    background: var(--rojo);
    color: #fff;
    font-weight: 600;
    font-size: var(--t-m);
}

@keyframes latido {
    50% { opacity: 0.35; }
}

/* ==========================================================================
   Barra superior
   ========================================================================== */

.topbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 3000;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    padding: 18px var(--borde);
    background: linear-gradient(var(--negro) 30%, transparent);
}

.brand img {
    height: clamp(44px, 7vh, 96px);
    width: auto;
}

.header-nav-list {
    display: flex;
    gap: clamp(18px, 2.4vw, 48px);
}

.header-nav-list a {
    display: block;
    padding: 4px 2px;
    font-size: clamp(18px, 1.35vw, 28px);
    font-weight: 500;
    text-decoration: none;
    color: var(--papel);
    border-bottom: 3px solid transparent;
}

.header-nav-list a:hover,
.header-nav-list a.active {
    border-bottom-color: var(--amarillo);
}

.mobile-menu-toggle,
.mobile-menu-overlay {
    display: none;
}

/* ==========================================================================
   Escenario: lo que suena ahora
   ========================================================================== */

.main-layout {
    position: relative;
    z-index: 1;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: clamp(32px, 6vh, 80px);
    padding: clamp(110px, 16vh, 180px) calc(var(--figura) * 0.82) 40px var(--borde);
    opacity: 0;
    transition: opacity 0.5s ease;
}

.main-layout.is-ready {
    opacity: 1;
}

.now-playing {
    display: flex;
    align-items: center;
    gap: clamp(32px, 4vw, 96px);
}

/* Funda + disco que asoma: el disco gira mientras suena (33⅓ rpm) */
.record-set {
    position: relative;
    flex: none;
    width: calc(var(--funda) * 1.56);
    height: var(--funda);
}

.sleeve {
    position: absolute;
    top: 0;
    left: 0;
    z-index: 2;
    width: var(--funda);
    height: var(--funda);
    background: #1a1a1a;
    box-shadow: 12px 0 28px rgba(0, 0, 0, 0.75);
    overflow: hidden;
}

.now-playing-art {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Funda genérica de papel cuando la canción no trae carátula */
.sleeve-plain {
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    height: 100%;
    padding: 9%;
    background: var(--papel);
    color: var(--negro);
}

.sleeve-plain-artist {
    font-family: var(--cumbia);
    font-weight: 800;
    font-size: calc(var(--funda) * 0.075);
    line-height: 1.1;
    color: var(--rojo);
}

.sleeve-plain-title {
    font-family: var(--poesia);
    font-style: italic;
    font-size: calc(var(--funda) * 0.12);
    line-height: 1.05;
    overflow-wrap: anywhere;
}

.record {
    position: absolute;
    top: 2%;
    left: calc(var(--funda) * 0.58);
    z-index: 1;
    width: calc(var(--funda) * 0.96);
    height: calc(var(--funda) * 0.96);
    border-radius: 50%;
    background:
        conic-gradient(from 30deg, transparent 0 10%, rgba(255, 255, 255, 0.09) 14%, transparent 20% 60%, rgba(255, 255, 255, 0.07) 64%, transparent 70%),
        repeating-radial-gradient(circle, #0b0b0b 0 2px, #191919 2px 3px);
    box-shadow: 0 0 0 1px #222, 0 18px 40px rgba(0, 0, 0, 0.8);
}

.is-playing .record {
    animation: girar 1.8s linear infinite;
}

.record-label {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 36%;
    height: 36%;
    transform: translate(-50%, -50%);
    border-radius: 50%;
    background: var(--rojo);
    box-shadow: inset 0 0 0 4px var(--rojo), inset 0 0 0 6px var(--amarillo);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 22%;
    text-align: center;
}

/* Agujero central */
.record-label::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 8%;
    height: 8%;
    transform: translate(-50%, -50%);
    border-radius: 50%;
    background: var(--negro);
}

.record-label-brand {
    font-weight: 800;
    font-size: calc(var(--funda) * 0.034);
    line-height: 1;
    color: var(--amarillo);
}

.record-label-side {
    font-family: var(--poesia);
    font-style: italic;
    font-size: calc(var(--funda) * 0.026);
    line-height: 1;
    color: var(--papel);
}

@keyframes girar {
    to { transform: rotate(360deg); }
}

/* Cambio de canción: la ficha se desvanece y vuelve con los datos nuevos */
.record-set .sleeve,
.track {
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.record-set.changing .sleeve {
    opacity: 0;
    transform: translateX(-24px);
}

.track.changing {
    opacity: 0;
}

/* Ficha de la canción */
.track {
    flex: 1;
    min-width: 0;
    max-width: 36em;
}

.track-program {
    font-size: var(--t-s);
    font-weight: 500;
    color: var(--oro);
}

.track-title {
    margin-top: 8px;
    font-family: var(--poesia);
    font-style: italic;
    font-weight: 400;
    font-size: clamp(44px, 5.4vw, 112px);
    line-height: 0.98;
    color: var(--papel);
    overflow-wrap: break-word;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.track-artist {
    margin-top: 14px;
    font-weight: 600;
    font-size: clamp(24px, 2.3vw, 48px);
    line-height: 1.1;
    color: var(--amarillo);
}

.now-playing-controls {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 16px 28px;
    margin-top: clamp(24px, 4vh, 48px);
}

.btn-play-pause {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 12px 28px 12px 20px;
    border: 2px solid var(--rojo);
    border-radius: 999px;
    background: var(--rojo);
    color: #fff;
    font-weight: 600;
    font-size: clamp(20px, 1.5vw, 30px);
    line-height: 1;
    transition: background-color 0.2s ease, border-color 0.2s ease;
}

.btn-play-pause:hover {
    background: var(--rojo-vivo);
    border-color: var(--rojo-vivo);
}

.is-playing .btn-play-pause {
    background: transparent;
    border-color: var(--papel);
}

.btn-play-pause:disabled {
    cursor: progress;
    opacity: 0.7;
}

.progress-container {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
    min-width: 200px;
    max-width: 380px;
}

.progress-time {
    font-size: var(--t-s);
    font-variant-numeric: tabular-nums;
    color: var(--humo);
}

.progress-bar-container {
    flex: 1;
    height: 4px;
    background: rgba(241, 235, 221, 0.22);
}

.progress-bar {
    height: 100%;
    background: var(--amarillo);
    transition: width 1s linear;
}

/* Siguiente canción */
.playing-next {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-top: clamp(28px, 5vh, 56px);
}

.brush-label {
    flex: none;
    height: clamp(40px, 5vh, 64px);
    width: auto;
}

.playing-next-art {
    flex: none;
    width: clamp(52px, 6vh, 80px);
    height: clamp(52px, 6vh, 80px);
    object-fit: cover;
}

.playing-next-text {
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.playing-next-title {
    font-family: var(--poesia);
    font-style: italic;
    font-size: clamp(22px, 1.6vw, 34px);
    line-height: 1.1;
}

.playing-next-artist {
    font-size: clamp(17px, 1.2vw, 26px);
    color: var(--humo);
}

/* ==========================================================================
   Recién escuchaste
   ========================================================================== */

.song-history {
    display: flex;
    align-items: flex-start;
    gap: 24px;
}

.song-history-items {
    flex: 1;
    min-width: 0;
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 24px;
}

.history-art-wrapper {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    grid-template-rows: auto auto;
    column-gap: 12px;
    align-items: start;
}

.history-art {
    grid-row: 1 / 3;
    width: clamp(44px, 5vh, 64px);
    height: clamp(44px, 5vh, 64px);
    object-fit: cover;
}

.history-art-plain {
    display: block;
    background:
        radial-gradient(circle, var(--rojo) 0 18%, transparent 19%),
        repeating-radial-gradient(circle, #0b0b0b 0 2px, #1c1c1c 2px 3px);
    border-radius: 50%;
}

.history-text {
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.history-title,
.history-artist {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.history-title {
    font-family: var(--poesia);
    font-style: italic;
    font-size: clamp(18px, 1.15vw, 26px);
    line-height: 1.2;
}

.history-artist {
    font-size: clamp(16px, 1vw, 22px);
    color: var(--humo);
}

.history-time {
    grid-column: 2;
    font-size: var(--t-xs);
    color: var(--oro);
}

.history-art-wrapper.is-new {
    animation: entrar 0.6s ease both;
}

@keyframes entrar {
    from { opacity: 0; transform: translateX(-16px); }
}

/* Avisos */
.loading-notification {
    position: fixed;
    left: 50%;
    bottom: 32px;
    z-index: 3500;
    transform: translateX(-50%);
    max-width: calc(100vw - 32px);
    padding: 12px 20px;
    background: var(--papel);
    color: var(--negro);
    font-weight: 500;
}

/* ==========================================================================
   Figura del programa al aire (esquina inferior derecha)
   ========================================================================== */

.program-image-container {
    position: fixed;
    right: 0;
    bottom: 0;
    z-index: 0;
    width: var(--figura);
    pointer-events: none;
}

.program-image {
    width: 100%;
    max-height: 88vh;
    object-fit: contain;
    object-position: bottom right;
}

.program-image.animating-in {
    animation: entrar-figura 0.8s ease both;
}

@keyframes entrar-figura {
    from { opacity: 0; transform: translateY(24px); }
}

/* ==========================================================================
   Secciones (Nosotros, Programas, Equipo, Pide un tema, Contacto)
   ========================================================================== */

.site-section {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 4000;
    overflow-y: auto;
    background: rgba(0, 0, 0, 0.94) url('../images/bg.jpg') center / cover fixed;
}

.site-section.visible {
    display: block;
    animation: aparecer 0.35s ease both;
}

@keyframes aparecer {
    from { opacity: 0; }
}

.section-content {
    position: relative;
    max-width: 1180px;
    margin: 0 auto;
    padding: clamp(80px, 12vh, 140px) var(--borde) 96px;
}

.section-close {
    position: fixed;
    top: 20px;
    right: var(--borde);
    z-index: 1;
    padding: 8px 20px;
    border: 2px solid var(--papel);
    border-radius: 999px;
    background: var(--negro);
    font-weight: 600;
    font-size: var(--t-s);
}

.section-close:hover {
    border-color: var(--amarillo);
    color: var(--amarillo);
}

.section-title {
    font-family: var(--poesia);
    font-style: italic;
    font-weight: 400;
    font-size: clamp(56px, 8vw, 128px);
    line-height: 1;
    margin-bottom: clamp(28px, 5vh, 56px);
}

.section-subtitle {
    font-family: var(--poesia);
    font-style: italic;
    font-weight: 400;
    font-size: var(--t-xl);
    line-height: 1.1;
    margin: 72px 0 32px;
}

.section-lead,
.team-intro {
    max-width: 36em;
    margin-bottom: 40px;
    font-size: clamp(20px, 1.4vw, 28px);
    color: var(--humo);
}

/* Nosotros */
.manifesto {
    font-family: var(--poesia);
    font-style: italic;
    font-size: clamp(34px, 5vw, 84px);
    line-height: 1.12;
    color: var(--amarillo);
}

/* Programas: banner + horario, en filas */
.programs-grid {
    display: flex;
    flex-direction: column;
    gap: 40px;
}

.program-card {
    display: grid;
    grid-template-columns: minmax(0, 520px) minmax(0, 1fr);
    align-items: center;
    gap: 40px;
}

.program-schedule {
    font-weight: 600;
    font-size: var(--t-m);
    color: var(--amarillo);
}

.program-info p:not(.program-schedule) {
    max-width: 26em;
    margin-top: 6px;
    font-family: var(--poesia);
    font-size: clamp(22px, 1.6vw, 30px);
    line-height: 1.3;
}

.features-grid {
    display: flex;
    flex-direction: column;
    gap: 36px;
}

.feature-card {
    display: flex;
    align-items: flex-start;
    gap: 24px;
    max-width: 52em;
}

.feature-card img {
    flex: none;
    width: 96px;
    height: 96px;
    border-radius: 50%;
    object-fit: cover;
}

.feature-card h4 {
    font-family: var(--poesia);
    font-style: italic;
    font-weight: 400;
    font-size: var(--t-l);
    line-height: 1.1;
}

.feature-card p {
    margin-top: 6px;
    max-width: 38em;
    font-size: clamp(18px, 1.2vw, 24px);
    color: var(--humo);
}

/* Equipo: como los créditos de una película */
.team-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 72px 48px;
    text-align: center;
}

.team-card img {
    width: 132px;
    height: 132px;
    margin: 0 auto 20px;
    border-radius: 50%;
    object-fit: cover;
}

.team-card .role {
    font-family: var(--poesia);
    font-style: italic;
    font-size: var(--t-m);
    color: var(--oro);
}

.team-card h3 {
    margin-top: 4px;
    font-weight: 800;
    font-size: clamp(32px, 2.6vw, 52px);
    line-height: 1.05;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.team-card ul {
    margin-top: 16px;
    font-size: clamp(18px, 1.2vw, 24px);
    color: var(--humo);
}

.team-card small {
    font-size: 0.8em;
    color: var(--oro);
}

/* Pide un tema */
.iframe-container iframe {
    display: block;
    width: 100%;
    height: 70vh;
    min-height: 480px;
    border: 0;
}

/* Contacto */
.footer-content {
    display: flex;
    flex-wrap: wrap;
    gap: 32px 96px;
}

.footer-section {
    font-style: normal;
    font-size: clamp(22px, 1.6vw, 32px);
    line-height: 1.5;
}

.footer-social {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-family: var(--poesia);
    font-style: italic;
    font-size: clamp(28px, 2.4vw, 44px);
    line-height: 1.2;
}

.footer-section a,
.footer-social a,
.footer-bottom a {
    text-decoration-color: var(--rojo);
    text-decoration-thickness: 2px;
    text-underline-offset: 4px;
}

.footer-section a:hover,
.footer-social a:hover,
.footer-bottom a:hover {
    color: var(--amarillo);
}

.footer-bottom {
    max-width: 40em;
    margin-top: 72px;
    font-size: var(--t-s);
    color: var(--humo);
}

/* ==========================================================================
   Confirmación de salida (app de TV)
   ========================================================================== */

.exit-confirm-modal {
    position: fixed;
    inset: 0;
    z-index: 6000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: rgba(0, 0, 0, 0.85);
}

.exit-confirm-content {
    width: min(560px, 100%);
    padding: 40px;
    background: var(--papel);
    color: var(--negro);
    text-align: center;
}

.exit-confirm-content h2 {
    font-family: var(--poesia);
    font-style: italic;
    font-weight: 400;
    font-size: var(--t-xl);
    line-height: 1.1;
}

.exit-confirm-content p {
    margin-top: 8px;
    font-size: var(--t-m);
}

.exit-confirm-buttons {
    display: flex;
    justify-content: center;
    gap: 16px;
    margin-top: 32px;
}

.exit-confirm-btn {
    padding: 12px 28px;
    border: 2px solid var(--negro);
    border-radius: 999px;
    background: transparent;
    font-weight: 600;
    font-size: var(--t-m);
}

.exit-confirm-no {
    background: var(--rojo);
    border-color: var(--rojo);
    color: #fff;
}

.nav-teclado .exit-confirm-modal .tizen-focused,
.exit-confirm-modal :focus-visible {
    outline-color: var(--negro);
}

/* ==========================================================================
   Pantallas medianas: la figura del programa se achica
   ========================================================================== */

@media (max-width: 1280px) {
    :root {
        --figura: clamp(200px, 20vw, 280px);
    }

    .song-history-items {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .song-history-items li:nth-child(n + 4) {
        display: none;
    }
}

/* ==========================================================================
   Celular y tablet vertical
   ========================================================================== */

@media (max-width: 900px) {
    :root {
        --funda: min(56vw, 300px);
    }

    .topbar {
        padding: 12px 16px;
    }

    .brand img {
        height: 44px;
    }

    .mobile-menu-toggle {
        display: flex;
        align-items: center;
        justify-content: center;
        position: relative;
        z-index: 3200;
        width: 48px;
        height: 48px;
        border: 0;
        background: transparent;
        color: var(--papel);
    }

    /* Menú lateral que entra desde la derecha */
    .site-header {
        position: fixed;
        top: 0;
        right: 0;
        bottom: 0;
        z-index: 3100;
        width: min(300px, 82vw);
        padding: 88px 28px 28px;
        background: var(--negro);
        transform: translateX(100%);
        visibility: hidden;
        transition: transform 0.3s ease, visibility 0.3s;
    }

    .site-header.mobile-open {
        transform: none;
        visibility: visible;
    }

    .header-nav-list {
        flex-direction: column;
        gap: 8px;
    }

    .header-nav-list a {
        font-size: var(--t-l);
        font-weight: 600;
    }

    .mobile-menu-overlay {
        display: block;
        position: fixed;
        inset: 0;
        z-index: 2900;
        background: rgba(0, 0, 0, 0.6);
        opacity: 0;
        visibility: hidden;
        transition: opacity 0.3s ease, visibility 0.3s;
    }

    .mobile-menu-overlay.visible {
        opacity: 1;
        visibility: visible;
    }

    .main-layout {
        justify-content: flex-start;
        gap: 48px;
        padding: 92px 16px 48px;
    }

    .now-playing {
        flex-direction: column;
        align-items: stretch;
        gap: 28px;
    }

    .record-set {
        margin: 0 auto;
    }

    .track-title {
        font-size: clamp(40px, 11vw, 64px);
    }

    .track-artist {
        font-size: var(--t-m);
    }

    .progress-container {
        max-width: none;
    }

    .song-history {
        flex-direction: column;
        gap: 16px;
    }

    .song-history-items {
        width: 100%;
        grid-template-columns: minmax(0, 1fr);
        gap: 16px;
    }

    .song-history-items li:nth-child(n + 4) {
        display: grid;
    }

    .history-art-wrapper {
        grid-template-columns: auto minmax(0, 1fr) auto;
        grid-template-rows: auto;
        align-items: center;
    }

    .history-art {
        grid-row: auto;
    }

    .history-time {
        grid-column: auto;
    }

    /* En el celular la figura del programa no cabe junto al disco */
    .program-image-container {
        display: none;
    }

    .section-close {
        top: 12px;
        right: 16px;
    }

    .program-card {
        grid-template-columns: minmax(0, 1fr);
        gap: 16px;
    }

    .feature-card img {
        width: 72px;
        height: 72px;
    }

    .team-grid {
        grid-template-columns: minmax(0, 1fr);
        gap: 56px;
    }
}

/* ==========================================================================
   Pantallas verticales grandes (TV o tótem en vertical)
   ========================================================================== */

@media (orientation: portrait) and (min-width: 1000px) {
    :root {
        --funda: 46vw;
        --figura: 40vw;
    }

    .main-layout {
        justify-content: flex-start;
        padding: 200px var(--borde) 45vh;
    }

    .now-playing {
        flex-direction: column;
        align-items: flex-start;
    }

    .track-title {
        font-size: 7vw;
    }

    .track-artist {
        font-size: 3.4vw;
    }

    .song-history {
        flex-direction: column;
    }

    .song-history-items {
        width: 100%;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 32px;
    }

    .song-history-items li:nth-child(n + 4) {
        display: grid;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
