/* ============================================================
   ESTILOSOBREMI-DEFERRED.CSS - VERSIÓN FINAL CORREGIDA
   ============================================================
   CSS NO-CRÍTICO optimizado para sobremi.html
   • Header compacto (como estilos3.css)
   • Carrusel aumentado 2x (600px)
   • Puzzle sin línea visible
   • Comentado para ajustes manuales fáciles
   ============================================================ */

/* ============================================================
   VARIABLES GLOBALES - Customize aquí
   ============================================================ */
:root {
    /* Colores corporativos */
    --color-primary: #0C4569;
    --color-white: #ffffff;
    --color-text: #333333;
    
    /* Espaciado responsivo con clamp() */
    --spacing-xs: clamp(0.5rem, 2vw, 0.625rem);
    --spacing-sm: clamp(0.625rem, 2vw, 1rem);
    --spacing-lg: clamp(1.25rem, 4vw, 1.875rem);
    --font-size-small: clamp(0.75rem, 2vw, 0.8rem);
    
    /* Transiciones suaves */
    --transition-slow: 0.5s ease;
    --transition-image: 4s cubic-bezier(0.4, 0, 0.2, 1);
    
    /* Border radius */
    --radius-md: 20px;
    
    /* Sombras suaves */
    --shadow-soft: 0 4px 8px rgb(0 0 0 / 10%);
    
    /* CARRUSEL: Ancho máximo (AJUSTA AQUÍ si quieres cambiar tamaño)
       250px: muy pequeño
       400px: mediano
       600px: grande (recomendado) */
    --carousel-max-width: 600px;
}

/* ============================================================
   CARRUSEL DE IMÁGENES - AUMENTADO 2X
   ============================================================
   Ancho: clamp(250px, 85%, 600px)
   Esto significa:
   • Mínimo: 250px en móviles muy pequeños
   • Normal: 85% del viewport (máximo responsivo)
   • Máximo: 600px (NO crece más)
   
   AJUSTES:
   • Cambiar max-width: 600px a 400px para hacerlo más pequeño
   • Cambiar 85% a 75% para que ocupe menos % del viewport
   ============================================================ */
.image-wrapper {
    /* ANCHO CARRUSEL: Aumentado a 600px (antes 300px) */
    width: clamp(250px, 85%, var(--carousel-max-width));
    max-width: var(--carousel-max-width);
    
    /* ALTURA: Proporcional a la foto (0.74 = aspecto foto) */
    aspect-ratio: 0.74;
    
    /* Centrado y espaciado */
    margin-inline: auto;
    position: relative;
    overflow: hidden;
    
    /* Estilos visuales */
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-soft);
    background-color: transparent;
    
    /* Optimización performance */
    contain: layout;
    content-visibility: auto;
}

/* Foto actual dentro del carrusel */
.profile-photo {
    width: 100%;
    height: 100%;
    position: absolute;
    inset: 0;
    opacity: 0;
    transition: opacity var(--transition-image);
    transform: translateZ(0);
}

.profile-photo picture {
    width: 100%;
    height: 100%;
    display: block;
}

.photo-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center top;
}

/* Cuando la foto está activa */
.profile-photo.active {
    opacity: 1;
}

/* ============================================================
   CONTENEDOR PUZZLE
   ============================================================
   Contenedor donde aparece el puzzle
   
   AJUSTES:
   • max-width: 400px → cambiar tamaño del puzzle
   • aspect-ratio: 1 → si quieres rectángulo cambiar a 1.2
   • padding: 20px → reducir si quieres menos espacio interno
   ============================================================ */
.flex-container {
    margin-block: 30px;
    margin-inline: auto;
    background-color: var(--color-white);
    border-radius: var(--radius-md);
    padding: 20px;
    width: 100%;
    max-width: 400px;      /* Cambiar aquí si quieres puzzle más grande/pequeño */
    aspect-ratio: 1;       /* 1 = cuadrado, 1.2 = rectángulo */
    max-height: 400px;
    box-shadow: var(--shadow-soft);
    display: grid;
    place-items: center;
    gap: 15px;
    contain: layout;
    position: relative;
}

/* Contenedor del puzzle (las piezas) */
#puzzle-container {
    width: 100%;
    max-width: 300px;
    aspect-ratio: 1;
    position: relative;
    margin-inline: auto;
    font-size: 0;
    line-height: 0;
    backface-visibility: hidden;
    transform: translateZ(0);
}

/* Texto que aparece encima del puzzle */
#puzzle-text {
    text-align: center;
    color: var(--color-primary);
    font-weight: bold;
    opacity: 0;
    transition: opacity var(--transition-slow);
    margin-block-end: 10px;
    order: -1;
    font-size: 1rem;
    line-height: 1.4;
}

/* ============================================================
   PIEZAS DEL PUZZLE - SIN LÍNEA VISIBLE
   ============================================================
   Solución anti-gap:
   • margin: -0.5px → Solapa 0.5px con piezas adyacentes
   • box-shadow inset → Sombra suave que suaviza líneas
   
   Si la línea sigue visible:
   • Cambiar -0.5px a -1px (solapamiento mayor)
   • Cambiar opacity de 0.1 a 0.2 (sombra más visible)
   ============================================================ */
.piece {
    position: absolute;
    background-repeat: no-repeat;
    opacity: 0;
    transition: opacity var(--transition-slow);
    transform: translateZ(0);
    will-change: transform, opacity;
    backface-visibility: hidden;
    image-rendering: crisp-edges;
    
    /* ANTI-GAP: Solapa con piezas adyacentes */
    margin: -0.5px;        /* Cambiar a -1px si línea aún visible */
    
    /* Sombra suave para suavizar líneas */
    box-shadow: inset 0 0 1px rgba(0,0,0,0.1);  /* Cambiar 0.1 a 0.2 si quieres más visible */
}

/* ============================================================
   MARCA DE AGUA (LOGO FONDO)
   ============================================================ */
.watermark-container {
    position: fixed;
    inset: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    z-index: -1;
    overflow: hidden;
}

.watermark {
    position: fixed !important;
    top: 50% !important;
    left: 50% !important;
    transform: translate(-50%, -50%) !important;
    width: 100vw !important;
    height: 100vh !important;
    background-image: url('../img/LOGOFONDO.svg');
    background-position: center center;
    background-repeat: no-repeat;
    background-size: 30% auto;
    opacity: 0.2;
    pointer-events: none;
    will-change: opacity;
}

/* ============================================================
   FOOTER
   ============================================================ */
footer {
    background-color: var(--color-primary);
    color: var(--color-white);
    padding-block: 10px;
    width: 100%;
}

.copyright {
    text-align: center;
    font-size: var(--font-size-small);
    padding: 10px 20px;
    border-block-start: 1px solid rgb(255 255 255 / 20%);
}

/* ============================================================
   UTILIDADES Y ESTILOS GENERALES
   ============================================================ */
p {
    text-align: justify;
    margin-block-end: 15px;
    padding-inline: 10px;
}

main, body > * {
    position: relative;
    z-index: 1;
}

.fade {
    transition: opacity var(--transition-slow);
}

img {
    height: auto;
    max-width: 100%;
    display: block;
    content-visibility: auto;
}

input, textarea, select {
    box-sizing: border-box;
}

.clearfix {
    display: flow-root;
}

/* ============================================================
   MEDIA QUERIES - RESPONSIVE
   ============================================================
   
   Breakpoints:
   • 1441px+: Desktop grande
   • 1024px+: Laptop/Desktop
   • 774px: Tablet/Móvil grande (TU VIVO está aquí)
   • 480px: Móvil pequeño
   • landscape: Modo apaisado
   ============================================================ */

/* DESKTOP GRANDE (1441px+) */
@media (min-width: 1441px) {
    .flex-container {
        max-width: 500px;
    }
    .watermark {
        background-size: 35% auto;
    }
}

/* DESKTOP/LAPTOP (max-width: 1024px) */
@media (max-width: 1024px) {
    .content {
        padding-inline: 20px;
    }
    .image-wrapper {
        width: clamp(250px, 80%, 350px);
    }
    .flex-container {
        max-width: 380px;
    }
    .watermark {
        background-size: 40% auto;
    }
}

/* ============================================================
   TABLET/MÓVIL GRANDE (max-width: 770px) ⭐ TU VIVO
   ============================================================
   CAMBIO CLAVE: Breakpoint REDUCIDO a 770px (antes 774px)
   
   ¿POR QUÉ?
   • Tu Vivo 771x915 caía ENTRE breakpoints
   • Ahora 771px NO entra en este media query
   • Mantiene estilos del rango 1024px (más correctos)
   
   Notas sobre este media query:
   • Se aplica cuando ancho < 770px
   • Tablet 768px sí entra aquí (correcto)
   • Tu Vivo 771px NO entra (respeta estilos superiores)
   ============================================================ */
@media (max-width: 770px) {
    .content {
        padding-inline: 15px;
    }
    
    .image-wrapper {
        width: clamp(200px, 75%, 280px);
        margin-block: 15px;
    }
    
    .flex-container {
        max-width: 320px;
        margin-block: 20px;
        padding: 15px;
    }
    
    #puzzle-container {
        max-width: 220px;
    }
    
    .watermark {
        background-size: 35% auto;
    }
}

/* MÓVIL PEQUEÑO (max-width: 480px) */
@media (max-width: 480px) {
    .content {
        padding-inline: 10px;
    }
    
    .image-wrapper {
        width: clamp(150px, 70%, 220px);
        margin-block: 12px;
    }
    
    .flex-container {
        max-width: 280px;
        padding: 10px;
    }
    
    #puzzle-container {
        max-width: 200px;
    }
    
    .watermark {
        background-size: 32% auto;
    }
}

/* ============================================================
   MODO APAISADO (LANDSCAPE) - Móviles en horizontal
   ============================================================
   Se aplica cuando altura < ancho (landscape)
   Optimiza espacio vertical (muy limitado)
   
   AJUSTES aquí si tu Vivo en apaisado se ve mal:
   • padding-block: 3px → aumentar si quieres más espacio
   • max-height: 40px → aumentar tamaño logo
   • gap: 15px → reducir si nav muy ancho
   ============================================================ */
@media (orientation: landscape) {
    header {
        padding-block: 10px;
        padding-inline: 0;
    }
    
    .logo {
        width: clamp(50px, 12vw, 80px);
    }
    
    nav ul {
        gap: 30px;
    }
    
    nav ul li a {
        padding-block: 10px;
        padding-inline: 15px;
        font-size: clamp(12px, 3vw, 14px);
    }
    
    main {
        padding-block: 8px;
    }
}

/* LANDSCAPE muy bajo (max-height: 480px) */
@media (max-height: 480px) and (orientation: landscape) {
    .header-container {
        padding-block: 5px;
        padding-inline: 0;
    }
    
    .image-wrapper {
        max-width: 200px;
    }
    
    .flex-container {
        max-width: 300px;
        padding: 10px;
        max-height: none;
        aspect-ratio: auto;
        min-height: 320px;
        gap: 10px;
    }
    
    #puzzle-container {
        max-width: 200px;
        flex-shrink: 0;
    }
    
    #puzzle-text {
        font-size: 0.9rem;
        line-height: 1.3;
        margin-block-end: 8px;
    }
    
    .watermark {
        background-size: 20% auto;
    }
}

/* LANDSCAPE medio (tablet+height) */
@media (min-width: 768px) and (max-height: 1024px) and (orientation: landscape) {
    .flex-container {
        max-width: 400px;
        max-height: none;
        aspect-ratio: auto;
        min-height: 380px;
        padding: 15px;
    }
    
    #puzzle-container {
        max-width: 280px;
    }
    
    #puzzle-text {
        font-size: 1rem;
        line-height: 1.4;
    }
    
    .watermark {
        background-size: 25% auto;
    }
}

/* LANDSCAPE muy comprimido (max-height: 400px) */
@media (max-height: 400px) and (orientation: landscape) {
    .flex-container {
        min-height: 280px;
        padding: 8px;
        gap: 10px;
    }
    
    #puzzle-container {
        max-width: 180px;
    }
    
    #puzzle-text {
        font-size: 0.85rem;
        line-height: 1.2;
        margin-block-end: 5px;
    }
    
    .header-container {
        padding-block: 5px;
        padding-inline: 0;
    }
    
    nav ul li a {
        padding-block: 10px;
        padding-inline: 15px;
        font-size: clamp(12px, 3vw, 14px);
    }
}

/* LANDSCAPE ancho (min-width: 1024px) */
@media (min-width: 1024px) and (max-height: 600px) and (orientation: landscape) {
    .flex-container {
        max-width: 450px;
        min-height: 400px;
    }
    
    #puzzle-container {
        max-width: 300px;
    }
}

/* ============================================================
   ACCESIBILIDAD - Respetar preferencias usuario
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* ============================================================
   ESTILOS DE IMPRESIÓN
   ============================================================ */
@media print {
    .watermark-container, nav {
        display: none;
    }
    
    .flex-container {
        box-shadow: none;
        page-break-inside: avoid;
    }
    
    body {
        color: black;
        background: white;
    }
    
    * {
        box-shadow: none !important;
        text-shadow: none !important;
    }
}

/* ============================================================
   FOOTER LEGAL - AÑADIDO
   ============================================================ */

.footer-legal-bar {
    background-color: rgba(0, 0, 0, 0.15);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding: clamp(8px, 2vw, 12px) 20px;
}

.footer-legal-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    max-width: 1200px;
    margin: 0 auto;
}

.footer-copy-text {
    color: rgba(255, 255, 255, 0.8);
    font-size: clamp(0.7rem, 1.8vw, 0.85rem);
    font-weight: normal;
}

.footer-legal-links {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.footer-legal-links a {
    color: #ffffff;
    font-size: clamp(0.7rem, 1.8vw, 0.85rem);
    text-decoration: none;
    transition: opacity 0.3s ease;
    white-space: nowrap;
    font-weight: 500;
}

.footer-legal-links a:hover {
    opacity: 0.8;
    text-decoration: underline;
}

.footer-legal-links .separator {
    color: rgba(255, 255, 255, 0.3);
    font-size: 0.8rem;
}

/* Responsive */
@media (max-width: 768px) {
    .footer-legal-bar {
        padding: 10px 15px;
    }
    
    .footer-legal-content {
        flex-direction: column;
        text-align: center;
        gap: 6px;
    }
    
    .footer-legal-links {
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .footer-legal-bar {
        padding: 8px 10px;
    }
    
    .footer-copy-text {
        font-size: 0.7rem;
        width: 100%;
        text-align: center;
    }
    
    .footer-legal-links {
        width: 100%;
        justify-content: center;
        gap: 6px;
    }
    
    .footer-legal-links a {
        font-size: 0.7rem;
        padding: 2px 0;
    }
    
    .footer-legal-links .separator {
        font-size: 0.7rem;
    }
}

@media (max-width: 380px) {
    .footer-legal-links a {
        font-size: 0.65rem;
    }
    
    .footer-legal-links .separator {
        font-size: 0.65rem;
        margin: 0 2px;
    }
    
    .footer-legal-links {
        gap: 4px;
    }
}

/* ============================================================
   FIN DEL CSS3 OPTIMIZADO
   ============================================================ */
