/* assets/css/style.css */

/* ─── CSS VARIABLES ─── */
:root {
    --primary:         #0B1D3A;
    --primary-light:   #143052;
    --primary-dark:    #071428;
    --secondary:       #F2942A;
    --secondary-light: #F5AD5A;
    --secondary-dark:  #D97E1A;
    --accent:          #F2942A;
    --ticker-speed:    35s;
}

/* ─── BASE & OVERFLOW SAFEGUARDS ─── */
*, *::before, *::after {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    overflow-x: hidden;
    max-width: 100%;
}

body {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
    max-width: 100%;
    width: 100%;
    position: relative;
    margin: 0;
    padding: 0;
}

img, picture, video, canvas, svg {
    max-width: 100%;
    height: auto;
}

/* ─── TYPOGRAPHY SAFETY & OVERFLOW ─── */
h1, h2, h3, h4, h5, h6, .news-title, .hero-title {
    max-width: 100%;
    overflow-wrap: break-word;
    word-break: break-word;
}

/* ─── SCROLLBAR HIDE ─── */
.scrollbar-hide {
    -ms-overflow-style: none;
    scrollbar-width: none;
}
.scrollbar-hide::-webkit-scrollbar {
    display: none;
}

/* ─── MATERIAL SYMBOLS ─── */
.material-symbols-outlined {
    font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24;
    vertical-align: middle;
    line-height: 1;
}

/* ─── TICKER ANIMADO (AHORA) ─── */
.ticker-wrapper {
    overflow: hidden;
    position: relative;
}
.ticker-wrapper::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    width: 40px;
    height: 100%;
    background: linear-gradient(to right, var(--primary), transparent);
    z-index: 1;
    pointer-events: none;
}
.ticker-track {
    display: inline-flex;
    white-space: nowrap;
    animation: ticker-scroll var(--ticker-speed) linear infinite;
    will-change: transform;
}
.ticker-track:hover {
    animation-play-state: paused;
}
@keyframes ticker-scroll {
    0%   { transform: translateX(0); }
    100% { transform: translateX(-50%); }
}

/* ─── REPRODUCTOR RADIO ─── */
@keyframes radio-wave {
    0%   { transform: scale(1);   opacity: 0.6; }
    100% { transform: scale(2.2); opacity: 0; }
}
.radio-pulse {
    animation: radio-wave 1.8s ease-out infinite;
}

/* ─── SEARCH OVERLAY ─── */
#search-overlay {
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

/* ─── HAMBURGER LINES ─── */
.hamburger-line {
    display: block;
    transition: transform 0.3s ease, opacity 0.3s ease;
    transform-origin: center;
}

/* ─── CARD HOVER EFFECT ─── */
.news-card {
    transition: transform 0.25s ease, box-shadow 0.25s ease;
    width: 100%;
    max-width: 100%;
}
.news-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 30px -5px rgba(11,29,58,0.15);
}

/* ─── HERO IMAGE ZOOM ─── */
.hero-img-zoom {
    transition: transform 0.7s ease;
}
.group:hover .hero-img-zoom {
    transform: scale(1.04);
}

/* ─── FOOTER NEWSLETTER INPUT ─── */
footer input[type="email"]:focus {
    border-color: var(--secondary);
    box-shadow: 0 0 0 2px rgba(242,148,42,0.25);
}

/* ─── UTILITY: Transition fast ─── */
.transition-fast {
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ─── CATEGORY BADGE ─── */
.category-badge {
    display: inline-block;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    padding: 4px 12px;
    color: #fff;
    background: var(--primary);
    max-width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.category-badge.orange { background: var(--secondary); color: #000; }
.category-badge.red    { background: var(--secondary-dark); }

/* ─── PULSE DOT (radio en vivo) ─── */
.live-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--secondary);
    display: inline-block;
    animation: live-blink 1.2s ease-in-out infinite;
}
@keyframes live-blink {
    0%, 100% { opacity: 1; }
    50%       { opacity: 0.2; }
}

/* ─── PRINT: hide interactive elements ─── */
@media print {
    header, footer, #player-widget, #search-overlay { display: none !important; }
}

/* ─── ARTICLE CONTENT ─── */
.prose-content p {
    margin-bottom: 1.25rem;
    line-height: 1.8;
}
.prose-content h2 {
    font-family: 'Montserrat', sans-serif;
    font-weight: 700;
    font-size: clamp(1.25rem, 4vw, 1.5rem);
    color: var(--primary);
    margin-top: 2rem;
    margin-bottom: 1rem;
    overflow-wrap: break-word;
    word-break: break-word;
}
.prose-content h3 {
    font-family: 'Montserrat', sans-serif;
    font-weight: 700;
    font-size: clamp(1.1rem, 3.5vw, 1.25rem);
    color: var(--primary);
    margin-top: 1.5rem;
    margin-bottom: 0.75rem;
    overflow-wrap: break-word;
    word-break: break-word;
}
.prose-content blockquote {
    border-left: 4px solid var(--secondary);
    padding: 1rem 1.25rem;
    margin: 1.5rem 0;
    background: #f8fafc;
    font-style: italic;
    color: #475569;
}
.prose-content ul, .prose-content ol {
    margin: 1rem 0;
    padding-left: 1.25rem;
}
.prose-content li {
    margin-bottom: 0.5rem;
    line-height: 1.7;
}
.prose-content a {
    color: var(--secondary);
    text-decoration: underline;
    font-weight: 600;
    word-break: break-all;
}
.prose-content a:hover {
    color: #e68a2e;
}
.prose-content img {
    border-radius: 0.5rem;
    margin: 1.5rem auto;
    max-width: 100%;
    height: auto;
}
.prose-content strong {
    font-weight: 700;
    color: #1e293b;
}

/* ─── FOCUS STYLES (Accessibility) ─── */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
    outline: 2px solid var(--secondary);
    outline-offset: 2px;
}

/* ─── REDUCED MOTION ─── */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    .ticker-track {
        animation: none;
    }
    .radio-pulse {
        animation: none;
    }
}

/* ==========================================================
   ─── OPTIMIZACIÓN RESPONSIVE MÓVIL PROFESIONAL (<= 768px) ───
   ========================================================== */
@media (max-width: 768px) {
    /* 1. Contenedores y márgenes de seguridad */
    body {
        overflow-x: hidden !important;
        width: 100% !important;
    }

    .max-w-\[1280px\] {
        padding-left: 14px !important;
        padding-right: 14px !important;
    }

    /* 2. Títulos y encabezados adaptables con clamp */
    h1, .hero-title {
        font-size: clamp(1.4rem, 6vw, 2.1rem) !important;
        line-height: 1.25 !important;
        overflow-wrap: break-word !important;
        word-break: break-word !important;
        max-width: 100% !important;
    }

    h2 {
        font-size: clamp(1.2rem, 5vw, 1.5rem) !important;
        line-height: 1.3 !important;
        overflow-wrap: break-word !important;
        word-break: break-word !important;
    }

    h3 {
        font-size: clamp(1.05rem, 4.2vw, 1.25rem) !important;
        line-height: 1.35 !important;
        overflow-wrap: break-word !important;
        word-break: break-word !important;
    }

    /* 3. Tarjetas / Cards */
    .news-card,
    article {
        width: 100% !important;
        max-width: 100% !important;
        margin-left: auto !important;
        margin-right: auto !important;
    }

    /* 4. Grids a 1 columna */
    .grid-cols-12 > .col-span-12,
    .grid-cols-12 > .lg\:col-span-8,
    .grid-cols-12 > .lg\:col-span-4,
    .grid-cols-12 > .lg\:col-span-5,
    .grid-cols-12 > .lg\:col-span-3 {
        width: 100% !important;
        max-width: 100% !important;
    }

    /* 5. Modales y Popups Responsive */
    .modal-container,
    [id^="modal-"] > div,
    #edit-modal > div,
    #schedule-modal > div,
    .fixed.inset-0 > div {
        width: calc(100% - 24px) !important;
        max-width: 100% !important;
        max-height: 90vh !important;
        overflow-y: auto !important;
        margin: auto !important;
        border-radius: 12px !important;
    }

    /* 6. Botones en Móvil */
    button, 
    .btn,
    a.btn {
        min-height: 42px;
        max-width: 100%;
        touch-action: manipulation;
    }

    /* 7. Footer Móvil Centrado */
    footer {
        text-align: center !important;
    }

    footer .grid {
        text-align: center !important;
        justify-items: center !important;
    }

    footer h4 {
        text-align: center !important;
        display: block !important;
        border-bottom: 2px solid var(--secondary) !important;
        padding-bottom: 4px !important;
        margin: 0 auto 14px auto !important;
        width: fit-content !important;
    }

    footer p,
    footer .text-slate-400 {
        text-align: center !important;
        line-height: 1.6 !important;
    }

    footer ul {
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
        justify-content: center !important;
        text-align: center !important;
        padding: 0 !important;
        margin: 0 auto !important;
        width: 100% !important;
    }

    footer ul li {
        display: flex !important;
        justify-content: center !important;
        align-items: center !important;
        text-align: center !important;
        width: 100% !important;
    }

    footer ul li a {
        display: inline-flex !important;
        justify-content: center !important;
        align-items: center !important;
        text-align: center !important;
        width: auto !important;
    }

    footer .flex.gap-3 {
        justify-content: center !important;
        margin: 0 auto !important;
    }

    footer form {
        width: 100% !important;
        max-width: 320px !important;
        margin: 0 auto !important;
    }

    footer form input,
    footer form button {
        width: 100% !important;
        text-align: center !important;
    }

    /* 8. Botón Flotante WhatsApp & Radio */
    #whatsapp-btn {
        bottom: 80px !important;
        right: 14px !important;
        width: 48px !important;
        height: 48px !important;
    }

    #player-widget {
        bottom: 18px !important;
        right: 14px !important;
    }
    #radio-btn {
        width: 48px !important;
        height: 48px !important;
    }

    /* 9. Formularios Móvil */
    input, select, textarea {
        font-size: 16px !important; /* Previene zoom automático en iOS Safari */
        max-width: 100% !important;
    }
}

/* ─── OPTIMIZACIONES PANTALLAS PEQUEÑAS (<= 480px) ─── */
@media (max-width: 480px) {
    .max-w-\[1280px\] {
        padding-left: 12px !important;
        padding-right: 12px !important;
    }

    h1, .hero-title {
        font-size: clamp(1.25rem, 5.5vw, 1.65rem) !important;
    }

    .prose-content {
        text-align: left !important;
    }

    .prose-content p {
        font-size: 0.9375rem !important;
        line-height: 1.7 !important;
        text-align: left !important;
    }

    .category-badge {
        font-size: 9px !important;
        padding: 3px 8px !important;
    }
}

/* ─── PRINT STYLES ─── */
@media print {
    body {
        font-size: 12pt;
        line-height: 1.5;
        color: #000;
    }
    a {
        color: #000;
        text-decoration: underline;
    }
    .prose-content a::after {
        content: " (" attr(href) ")";
        font-size: 0.8em;
        color: #666;
    }
}
