/*
Theme Name: MiV1
Theme URI: 
Author: Miguel Ángel Arteaga
Description: Tema personalizado portabilizable V1.
Version: 1.0.0
License: GNU General Public License v2 or later
Text Domain: miv1
*/

/* ==========================================================================
   1. Fuentes Locales (Inter & Outfit)
   ========================================================================== */
@font-face { font-family: 'Inter'; font-style: normal; font-weight: 400; src: url('fonts/inter-v20-latin-regular.woff2') format('woff2'); }
@font-face { font-family: 'Inter'; font-style: normal; font-weight: 500; src: url('fonts/inter-v20-latin-500.woff2') format('woff2'); }
@font-face { font-family: 'Inter'; font-style: normal; font-weight: 700; src: url('fonts/inter-v20-latin-700.woff2') format('woff2'); }

@font-face { font-family: 'Outfit'; font-style: normal; font-weight: 400; src: url('fonts/outfit-v15-latin-regular.woff2') format('woff2'); }
@font-face { font-family: 'Outfit'; font-style: normal; font-weight: 500; src: url('fonts/outfit-v15-latin-500.woff2') format('woff2'); }
@font-face { font-family: 'Outfit'; font-style: normal; font-weight: 700; src: url('fonts/outfit-v15-latin-700.woff2') format('woff2'); }

/* ==========================================================================
   2. Reset y Estructura Flexbox (Sticky Footer)
   ========================================================================== */
*, *::before, *::after { box-sizing: border-box; }

html, body { height: 100%; margin: 0; }

body {
    display: flex;
    flex-direction: column;
    font-family: 'Inter', sans-serif;
    color: #333;
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, h6 {
    font-family: 'Outfit', sans-serif;
    margin: 0 0 1rem 0;
    color: #1a1a1a;
}

img { max-width: 100%; height: auto; }

.site-main {
    flex: 1;
    width: 85%;
    max-width: 1200px;
    margin: 40px auto;
    padding: 0 20px;
}

/* ==========================================================================
   3. Header (Cápsula Glassmorphism)
   ========================================================================== */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 85%;
    max-width: 1200px;
    margin: 25px auto;
    padding: 14px 40px;
    background-color: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 100px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    position: sticky;
    top: 20px;
    z-index: 1000;
    transition: transform 0.4s ease, opacity 0.4s ease, background-color 0.3s ease;
}

.site-branding h2 { margin: 0; font-size: 1.25rem; font-weight: 700; font-family: 'Outfit', sans-serif; }
.site-branding h2 a { text-decoration: none; color: #ffffff; text-shadow: 0 2px 4px rgba(0,0,0,0.2); }
.site-branding p { display: none; }

.custom-logo { max-height: 40px; width: auto; display: block; }
.site-branding a { display: flex; align-items: center; }

/* ==========================================================================
   4. Navegación (Forzada para uniformidad total)
   ========================================================================== */
.main-navigation .menu-header {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    gap: 8px;
}

/* Selector que apunta directamente a los enlaces dentro de los elementos de lista */
.main-navigation .menu-header li a,
.main-navigation .menu-header li.current-menu-item a,
.main-navigation .menu-header li.current_page_item a {
    display: block !important;
    text-decoration: none !important;
    color: #ffffff !important;
    padding: 6px 16px !important;
    border-radius: 50px !important;
    transition: all 0.3s ease !important;
    background-color: transparent !important;
    border: none !important;
    box-shadow: none !important;
    font-weight: 400 !important;
}

/* Hover: Un sutil cambio de color sin borde */
.main-navigation .menu-header li a:hover,
.main-navigation .menu-header li.current-menu-item a:hover {
    background-color: rgba(255, 255, 255, 0.15) !important;
    border: none !important;
    box-shadow: none !important;
}

/* ==========================================================================
   5. Footer (Cápsula Glassmorphism)
   ========================================================================== */
.site-footer { 
    width: 100%; 
    margin-top: auto; 
    padding-bottom: 25px; 
    transition: transform 0.4s ease, opacity 0.4s ease;
}
.footer-container {
    width: 85%; max-width: 1200px; margin: 0 auto; padding: 16px 40px;
    background-color: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 100px;
    display: flex; justify-content: center; align-items: center;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}
.footer-container p { margin: 0; font-family: 'Inter', sans-serif; font-size: 0.85rem; color: #ffffff; text-shadow: 0 1px 2px rgba(0,0,0,0.2); }

/* ==========================================================================
   6. Utilidades
   ========================================================================== */
.alignfull { width: 100vw; position: relative; left: 50%; right: 50%; margin-left: -50vw; margin-right: -50vw; }

/* ==========================================================================
   7. Botones Globales
   ========================================================================== */
.btn-primary {
    display: inline-block;
    padding: 10px 25px;
    background-color: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: #ffffff;
    text-decoration: none;
    border-radius: 100px; /* Igual que header y footer */
    font-weight: 500;
    font-family: 'Outfit', sans-serif;
    transition: all 0.3s ease;
    cursor: pointer;
    text-shadow: 0 1px 2px rgba(0,0,0,0.1);
}
.btn-primary:hover { 
    background-color: rgba(255, 255, 255, 0.3); 
    transform: translateY(-2px);
    color: #ffffff;
}
.btn-primary:active {
    transform: translateY(0);
    box-shadow: inset 0 4px 6px rgba(0, 0, 0, 0.2);
    transition: all 0.1s ease;
}

/* ==========================================================================
   8. Ocultar Títulos por Defecto
   ========================================================================== */
/* Oculta el título automático en las páginas para permitir diseños a pantalla completa con Gutenberg */
.page .site-main > article > h2 {
    display: none;
}

/* ==========================================================================
   9. Formularios Glassmorphism
   ========================================================================== */
.glass-input {
    background: rgba(255, 255, 255, 0.1) !important;
    border: 1px solid rgba(255, 255, 255, 0.3) !important;
    border-radius: 100px !important;
    padding: 14px 25px !important;
    color: #ffffff !important;
    font-family: 'Inter', sans-serif !important;
    outline: none !important;
    transition: all 0.3s ease !important;
}
.glass-input::placeholder {
    color: rgba(255, 255, 255, 0.5);
}
.glass-input:focus {
    background: rgba(255, 255, 255, 0.2) !important;
    border-color: rgba(255, 255, 255, 0.5) !important;
}

/* ==========================================================================
   10. Tarjetas de Características
   ========================================================================== */
.feature-card:hover {
    transform: translateY(-10px);
    background: rgba(255, 255, 255, 0.15) !important;
    border-color: rgba(255, 255, 255, 0.4) !important;
}

/* ==========================================================================
   11. Redes Sociales (Iconos Glass)
   ========================================================================== */
.social-icon-link {
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    color: #ffffff;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    text-decoration: none;
    flex-shrink: 0;
}

.social-icon-link:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.15) rotate(5deg);
    border-color: rgba(255, 255, 255, 0.5);
    color: #ffffff;
}

.social-icon-link svg {
    width: 24px;
    height: 24px;
    fill: currentColor;
}

/* ==========================================================================
   11.5 Menu Hamburguesa
   ========================================================================== */
.menu-toggle {
    display: none;
    flex-direction: column;
    gap: 5px;
    cursor: pointer;
    z-index: 1001;
    transition: all 0.3s ease;
}
.menu-toggle span {
    width: 25px;
    height: 3px;
    background: #fff;
    border-radius: 5px;
    transition: 0.3s;
}

/* Animación de la hamburguesa a X e interacción de fondo */
#menu-toggle-check:checked ~ .menu-toggle span:nth-child(1) {
    transform: translateY(8px) rotate(45deg);
}
#menu-toggle-check:checked ~ .menu-toggle span:nth-child(2) {
    opacity: 0;
}
#menu-toggle-check:checked ~ .menu-toggle span:nth-child(3) {
    transform: translateY(-8px) rotate(-45deg);
}

/* Capa de desenfoque global cuando el menú está abierto */
header:has(#menu-toggle-check:checked)::after {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    backdrop-filter: blur(30px); /* Aumento significativo para evitar distracciones */
    -webkit-backdrop-filter: blur(30px);
    background: rgba(255, 255, 255, 0.01); /* Sin cambio de color notable */
    z-index: -1;
    pointer-events: none;
    transition: backdrop-filter 0.4s ease;
}

/* ==========================================================================
   12. Optimizaciones Responsive (Todos los dispositivos)
   ========================================================================== */
@media (max-width: 768px) {
    header, .footer-container, .site-main { width: 92%; padding: 12px 20px; }
    .social-card { padding: 35px 20px !important; }
    .social-icons-container { max-width: 180px; margin: 0 auto; } /* Fuerza el diseño 3+2 */
    
    .menu-toggle { display: flex; }
    
    .main-navigation {
        position: absolute;
        top: calc(100% + 15px);
        left: 50%;
        transform: translateX(-50%);
        width: 280px;
        max-width: 90vw;
        background: rgba(255, 255, 255, 0.2); /* Consistencia con el resto del tema */
        backdrop-filter: blur(20px);
        -webkit-backdrop-filter: blur(20px);
        border: 1px solid rgba(255, 255, 255, 0.3);
        border-radius: 30px;
        padding: 30px 20px;
        display: flex;
        flex-direction: column;
        align-items: center;
        z-index: 1100;
        opacity: 0;
        visibility: hidden;
        transition: opacity 0.3s ease, visibility 0.3s ease, transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        box-shadow: 0 15px 35px rgba(0,0,0,0.2);
    }
    
    #menu-toggle-check:checked ~ .main-navigation {
        opacity: 1;
        visibility: visible;
    }

    .main-navigation .menu-header {
        flex-direction: column;
        text-align: center;
        gap: 15px;
    }

    .main-navigation .menu-header li a { 
        padding: 10px 20px !important; 
        font-size: 1.2rem !important;
        font-family: 'Outfit', sans-serif !important;
    }
}

/* ==========================================================================
   13. Galería Interactiva MiV1
   ========================================================================== */
.miv1-gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
    padding: 40px 0;
}

.miv1-gallery-item {
    aspect-ratio: 1 / 1;
    overflow: hidden;
    border-radius: 30px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    background: rgba(255, 255, 255, 0.05);
}

.miv1-gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.6s ease;
}

.miv1-gallery-item:hover {
    transform: scale(1.03) translateY(-5px);
    border-color: rgba(255, 255, 255, 0.5);
    box-shadow: 0 15px 30px rgba(0,0,0,0.2);
}

.miv1-gallery-item:hover img {
    transform: scale(1.1);
}

/* Estilos del Lightbox / Card Viewer */
.miv1-gallery-viewer {
    display: none;
    width: 100%;
    margin: 20px 0;
    opacity: 0;
    transition: all 0.5s ease;
}

.miv1-gallery-viewer.active { display: block; opacity: 1; }

.lightbox-card {
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 40px;
    padding: 20px;
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
    box-shadow: 0 25px 50px rgba(0,0,0,0.3);
    position: relative;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
}

.lightbox-image {
    max-width: 100%;
    width: 100%;
    height: auto;
    aspect-ratio: 16 / 9;
    object-fit: cover;
    border-radius: 20px;
    display: block;
}

@media (max-width: 480px) {
    .social-card h3 { font-size: 1.5rem !important; margin-bottom: 15px !important; }
    .social-icon-link { width: 45px; height: 45px; }
    .social-icon-link svg { width: 20px; height: 20px; }
    .social-card p { font-size: 0.85rem !important; margin-bottom: 20px !important; }
    .site-branding h2 { font-size: 1.1rem; }
}

/* ==========================================================================
   14. Cuadrícula de Entradas (Glassmorphism)
   ========================================================================== */
.post-grid-container {
    padding: 60px 0;
}

.post-card {
    background: rgba(255, 255, 255, 0.2) !important;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.2) !important;
    border-radius: 30px !important;
    padding: 25px;
    transition: all 0.3s ease;
    color: #ffffff;
}

.post-card:hover {
    transform: translateY(-5px);
    background: rgba(255, 255, 255, 0.15) !important;
    border-color: rgba(255, 255, 255, 0.4) !important;
}

.post-card h2 a { color: #ffffff; text-decoration: none; font-family: 'Outfit', sans-serif; }
.post-card .wp-block-post-excerpt { font-size: 0.9rem; opacity: 0.8; line-height: 1.5; }

/* Estilo para el enlace "Leer más" dentro de las tarjetas */
.post-card .wp-block-post-excerpt__more-link {
    display: inline-block !important;
    margin-top: 15px !important;
    padding: 8px 20px !important;
    background-color: rgba(255, 255, 255, 0.1) !important;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.2) !important;
    border-radius: 50px !important;
    color: #ffffff !important;
    text-decoration: none !important;
    font-family: 'Outfit', sans-serif !important;
    font-size: 0.8rem !important;
    transition: all 0.3s ease !important;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.post-card .wp-block-post-excerpt__more-link:hover {
    background-color: rgba(255, 255, 255, 0.2) !important;
    border-color: rgba(255, 255, 255, 0.4) !important;
    transform: translateY(-2px);
}

/* ==========================================================================
   15. Botón Back to Top (Glassmorphism)
   ========================================================================== */
.back-to-top {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 50px;
    height: 50px;
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    z-index: 2000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}
.back-to-top.show { opacity: 1; visibility: visible; }
.back-to-top:hover { background: rgba(255, 255, 255, 0.3); transform: translateY(-5px); color: #fff; }

/* ==========================================================================
   16. Plantilla de Entrada Individual (Single Post)
   ========================================================================== */
.single-post-view {
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 40px;
    padding: 60px;
    color: #ffffff;
    max-width: 900px;
    margin: 0 auto 60px;
    box-shadow: 0 25px 50px rgba(0,0,0,0.15);
}

.post-hero-image img {
    width: 100%;
    height: auto;
    border-radius: 30px;
    margin-bottom: 40px;
    box-shadow: 0 15px 30px rgba(0,0,0,0.2);
}

.entry-title { 
    font-size: clamp(2rem, 5vw, 3.5rem); 
    margin-bottom: 15px; 
    line-height: 1.1; 
    will-change: transform, opacity; /* Optimización para animaciones fluidas */
}
.entry-meta { margin-bottom: 50px; font-size: 0.9rem; opacity: 0.7; font-family: 'Inter', sans-serif; }
.entry-content { font-size: 1.15rem; line-height: 1.8; opacity: 0.95; }
.entry-content p { margin-bottom: 1.8rem; }

/* Ajustes específicos para móviles */
@media (max-width: 768px) {
    .single-post-view {
        padding: 30px 20px;
        border-radius: 30px;
        width: 100%;
    }
    .entry-title { font-size: 2.2rem; }
    .entry-meta { margin-bottom: 30px; }
}

/* ==========================================================================
   17. Galería Estilo Instagram (Native Query)
   ========================================================================== */
.instagram-grid-container .wp-block-post-template {
    display: grid !important;
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 15px !important;
    list-style: none !important;
    padding: 0 !important;
}

.instagram-post-item {
    aspect-ratio: 1 / 1 !important;
    overflow: hidden;
    border-radius: 15px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    position: relative;
    transition: all 0.3s ease;
}

.instagram-post-item:hover {
    transform: scale(0.98);
    border-color: rgba(255, 255, 255, 0.5);
    filter: brightness(1.1);
}

.instagram-post-item .wp-block-post-featured-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* ==========================================================================
   18. Barra de Progreso de Lectura
   ========================================================================== */
.reading-progress-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    z-index: 2000;
    background: transparent;
}

.reading-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, rgba(255,255,255,0.1), rgba(255,255,255,0.8));
    width: 0%;
    transition: width 0.1s ease;
}

/* ==========================================================================
   19. Cursor Personalizado (Glass Liquid)
   ========================================================================== */
.custom-cursor {
    width: 20px;
    height: 20px;
    background: rgba(255, 255, 255, 0.3);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    border: 1px solid rgba(255, 255, 255, 0.5);
    border-radius: 50%;
    position: fixed;
    top: 0;
    left: 0;
    pointer-events: none;
    z-index: 9999;
    transition: transform 0.1s ease-out, width 0.3s, height 0.3s, background 0.3s;
    display: none; /* Oculto por defecto, se activa en desktop vía JS */
}

@media (min-width: 1025px) {
    .custom-cursor { display: block; }
    body { cursor: none; } /* Ocultar cursor nativo */
    a, button { cursor: none; }
}

.custom-cursor.hover {
    transform: scale(2.5) !important;
    background: rgba(255, 255, 255, 0.1);
}

.custom-cursor.click {
    transform: scale(0.8) !important;
    background: rgba(255, 255, 255, 0.5);
}

/* ==========================================================================
   20. Clases para Modo Concentración
   ========================================================================== */
.header-hidden {
    transform: translateY(-150%) !important;
    opacity: 0;
}

.footer-hidden {
    transform: translateY(150%) !important;
    opacity: 0;
}