/* ============================================
   RESPONSIVE DESIGN - MEDIA QUERIES
   Gala 2025 - Día del Médico | COLMED Valparaíso
   ============================================ */

/* ============================================
   TABLET - Hasta 1024px
   ============================================ */
@media (max-width: 1024px) {
    :root {
        --fs-h1: 2.75rem;
        --fs-h2: 2rem;
        --spacing-xl: 4rem;
    }

    .container {
        padding: 0 var(--spacing-sm);
    }

    /* Hero */
    .hero-logo {
        max-width: 350px;
    }

    .hero-title {
        font-size: 2.25rem;
    }

    /* Gallery */
    .photo-grid {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    }

    /* Modal */
    .modal-sidebar {
        width: 350px;
    }

    /* Sponsors */
    .sponsors-grid {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    }
}

/* ============================================
   TABLET SMALL - Hasta 768px
   ============================================ */
@media (max-width: 768px) {
    :root {
        --fs-h1: 2.25rem;
        --fs-h2: 1.75rem;
        --fs-h3: 1.5rem;
        --spacing-lg: 3rem;
        --spacing-xl: 3rem;
    }

    /* Header / Navegación */
    .navbar .container {
        flex-wrap: wrap;
    }

    .nav-menu {
        display: none;
        width: 100%;
        flex-direction: column;
        background: var(--color-dark-light);
        padding: var(--spacing-sm);
        border-radius: var(--radius-md);
        margin-top: var(--spacing-sm);
        gap: var(--spacing-xs);
    }

    .nav-menu.active {
        display: flex;
    }

    .nav-link {
        padding: 0.75rem;
        text-align: center;
    }

    .nav-link::after {
        display: none;
    }

    .mobile-menu-toggle {
        display: flex;
    }

    .mobile-menu-toggle.active span:nth-child(1) {
        transform: rotate(45deg) translate(7px, 7px);
    }

    .mobile-menu-toggle.active span:nth-child(2) {
        opacity: 0;
    }

    .mobile-menu-toggle.active span:nth-child(3) {
        transform: rotate(-45deg) translate(7px, -7px);
    }

    /* Hero */
    .hero-content {
        padding: var(--spacing-lg) var(--spacing-sm);
    }

    .hero-logo {
        max-width: 280px;
    }

    .hero-title {
        font-size: 2rem;
    }

    .hero-subtitle {
        font-size: 1.1rem;
    }

    .hero-cta {
        flex-direction: column;
        align-items: stretch;
    }

    .hero-cta .btn {
        width: 100%;
        justify-content: center;
    }

    /* Section Spacing */
    .video-section,
    .gallery-section,
    .sponsors-section {
        padding: var(--spacing-lg) 0;
    }

    .section-header {
        margin-bottom: var(--spacing-md);
    }

    /* Gallery */
    .gallery-controls {
        flex-direction: column;
        align-items: stretch;
    }

    .search-box {
        max-width: 100%;
    }

    .view-toggle {
        justify-content: center;
    }

    .photo-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
        gap: var(--spacing-sm);
    }

    /* Modal */
    .modal-content {
        padding: var(--spacing-sm);
    }

    .modal-body {
        flex-direction: column;
        max-height: 90vh;
    }

    .modal-image-container {
        max-height: 50vh;
    }

    .modal-sidebar {
        width: 100%;
        max-height: 40vh;
    }

    .modal-close {
        top: 10px;
        right: 10px;
        width: 40px;
        height: 40px;
        font-size: 1.25rem;
    }

    .modal-nav {
        width: 40px;
        height: 40px;
        font-size: 1.25rem;
    }

    .modal-prev {
        left: 10px;
    }

    .modal-next {
        right: 10px;
    }

    /* Sponsors */
    .sponsors-grid {
        grid-template-columns: 1fr;
    }

    /* Footer */
    .footer-content {
        grid-template-columns: 1fr;
        text-align: center;
        gap: var(--spacing-md);
    }

    .footer-logo {
        margin: 0 auto var(--spacing-sm);
    }

    .footer-links li {
        justify-content: center;
    }

    .social-links {
        justify-content: center;
    }

    /* Pagination */
    .pagination {
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    .page-btn {
        min-width: 36px;
        height: 36px;
    }

    /* Toast */
    .toast-container {
        top: 70px;
        right: 10px;
        left: 10px;
        max-width: 100%;
    }
}

/* ============================================
   MOBILE - Hasta 480px
   ============================================ */
@media (max-width: 480px) {
    :root {
        --fs-h1: 1.875rem;
        --fs-h2: 1.5rem;
        --fs-h3: 1.25rem;
        --fs-body: 0.9375rem;
        --spacing-md: 1.5rem;
        --spacing-lg: 2rem;
    }

    /* Header */
    .logo-colmed {
        height: 40px;
    }

    /* Hero */
    .hero-logo {
        max-width: 220px;
    }

    .hero-title {
        font-size: 1.75rem;
    }

    .hero-subtitle {
        font-size: 1rem;
    }

    .btn {
        padding: 0.625rem 1.5rem;
        font-size: 0.875rem;
    }

    /* Section Headers */
    .section-title {
        font-size: 1.5rem;
    }

    .section-description {
        font-size: 0.9375rem;
    }

    /* Gallery */
    .photo-grid {
        grid-template-columns: 1fr;
        gap: var(--spacing-sm);
    }

    .photo-card-image {
        height: 240px;
    }

    /* Modal */
    .modal-body {
        border-radius: var(--radius-md);
    }

    .share-buttons {
        grid-template-columns: repeat(2, 1fr);
    }

    /* Comments */
    .comment-form input,
    .comment-form textarea {
        font-size: 0.9375rem;
    }

    /* Sponsors */
    .sponsor-card {
        padding: var(--spacing-sm);
    }

    .sponsor-photos {
        grid-template-columns: repeat(2, 1fr);
    }

    .sponsor-photo {
        height: 100px;
    }

    /* Footer */
    .footer-text,
    .footer-links li {
        font-size: 0.8125rem;
    }

    /* Pagination */
    .page-btn {
        min-width: 32px;
        height: 32px;
        font-size: 0.875rem;
    }
}

/* ============================================
   LANDSCAPE MODE - Mobile horizontal
   ============================================ */
@media (max-width: 768px) and (orientation: landscape) {
    .hero-section {
        min-height: auto;
        padding: var(--spacing-lg) 0;
    }

    .modal-image-container {
        max-height: 70vh;
    }

    .modal-sidebar {
        max-height: 70vh;
    }

    .scroll-indicator {
        display: none;
    }
}

/* ============================================
   LARGE DESKTOP - 1440px y superior
   ============================================ */
@media (min-width: 1440px) {
    :root {
        --fs-h1: 4rem;
        --fs-h2: 3rem;
    }

    .container {
        max-width: 1400px;
    }

    .hero-logo {
        max-width: 550px;
    }

    .photo-grid {
        grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    }

    .modal-sidebar {
        width: 450px;
    }
}

/* ============================================
   EXTRA LARGE DESKTOP - 1920px y superior
   ============================================ */
@media (min-width: 1920px) {
    .container {
        max-width: 1600px;
    }

    .photo-grid {
        grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    }
}

/* ============================================
   HIGH DPI / RETINA DISPLAYS
   ============================================ */
@media (-webkit-min-device-pixel-ratio: 2),
       (min-resolution: 192dpi) {
    /* Optimizaciones para pantallas de alta densidad */
    .hero-background {
        background-size: cover;
        image-rendering: -webkit-optimize-contrast;
    }
}

/* ============================================
   PRINT STYLES
   ============================================ */
@media print {
    .main-header,
    .hero-cta,
    .gallery-controls,
    .pagination,
    .modal,
    .toast-container,
    .main-footer .social-links,
    .scroll-indicator {
        display: none !important;
    }

    body {
        font-size: 12pt;
        color: black;
        background: white;
    }

    .photo-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }

    .photo-card {
        break-inside: avoid;
        page-break-inside: avoid;
    }

    a {
        text-decoration: underline;
    }

    a[href^="http"]:after {
        content: " (" attr(href) ")";
        font-size: 0.8em;
    }
}

/* ============================================
   DARK MODE (opcional, si se implementa)
   ============================================ */
@media (prefers-color-scheme: dark) {
    /* Aquí se pueden agregar estilos para modo oscuro
       si se decide implementar esta funcionalidad */
}

/* ============================================
   ACCESSIBILITY - Alto contraste
   ============================================ */
@media (prefers-contrast: high) {
    :root {
        --color-gold: #FFD700;
        --color-blue: #3A7FE0;
        --color-red: #FF0000;
    }

    .btn {
        border-width: 3px;
    }

    a:focus,
    button:focus {
        outline: 3px solid currentColor;
        outline-offset: 3px;
    }
}

/* ============================================
   TOUCH DEVICES - Mejoras de UX
   ============================================ */
@media (hover: none) and (pointer: coarse) {
    /* Aumentar áreas táctiles */
    .btn,
    .action-btn,
    .view-btn,
    .page-btn,
    .nav-link {
        min-height: 44px;
        min-width: 44px;
    }

    /* Remover hover effects en dispositivos táctiles */
    .photo-card:hover {
        transform: none;
    }

    .photo-card-overlay {
        opacity: 1;
        background: linear-gradient(
            to bottom,
            transparent 40%,
            rgba(10, 10, 20, 0.9) 100%
        );
    }

    /* Simplificar transiciones */
    * {
        transition-duration: 0.15s !important;
    }
}

/* ============================================
   OPTIMIZACIÓN DE RENDIMIENTO
   ============================================ */
@media (max-width: 768px) {
    /* Reducir animaciones en móviles para mejor rendimiento */
    .hero-background {
        background-attachment: scroll;
    }

    [data-aos] {
        animation-duration: 0.4s !important;
    }
}
