/* =========================================================
   VARIABLES & RESET - MOBILE FIRST
========================================================= */
:root {
    --color-primary: #2c3e50;
    --color-secondary: #2980b9;
    --color-accent: #27ae60;
    --color-text: #333;
    --color-light: #f8f9fa;
    --font-heading: 'Merriweather', serif;
    --font-body: 'Open Sans', sans-serif;
    --transition: all 0.3s ease;
}

/* RESET COMPLETO */
* { 
    margin: 0; 
    padding: 0; 
    box-sizing: border-box; 
    max-width: 100%;
}

html { 
    scroll-behavior: smooth; 
    overflow-x: hidden;
    width: 100%;
}

body {
    font-family: var(--font-body);
    color: var(--color-text);
    line-height: 1.5;
    background-color: var(--color-light);
    position: relative;
    overflow-x: hidden;
    width: 100%;
    font-size: 16px;
}

body::before {
    content: "";
    position: fixed; 
    inset: 0;
    background: url('imagenes/fondo.jpg') no-repeat center center / cover;
    filter: blur(4px);
    z-index: -1; 
    opacity: 0.9;
}

/* Elementos base responsivos */
img, video, iframe, object, embed {
    max-width: 100%;
    height: auto;
    display: block;
}

/* =========================================================
   TIPOGRAFÍA MOBILE FIRST
========================================================= */
h1, h2, h3, h4 { 
    font-family: var(--font-heading); 
    font-weight: 700; 
    line-height: 1.2; 
    margin-bottom: 0.8rem; 
    word-wrap: break-word;
    overflow-wrap: break-word;
}

h1 { 
    font-size: 1.6rem; 
    color: #fff; 
}

h2 { 
    font-size: 1.6rem; 
    color: var(--color-primary); 
    position: relative; 
    padding-bottom: 0.5rem; 
    text-align: center;
}

h2::after { 
    content: ""; 
    position: absolute; 
    bottom: 0; 
    left: 50%; 
    transform: translateX(-50%);
    width: 60px; 
    height: 3px; 
    background: var(--color-accent); 
}

h3 { 
    font-size: 1.3rem; 
    color: var(--color-secondary); 
    text-align: center;
    margin-top: 1rem;
}

p { 
    margin-bottom: 1rem; 
    overflow-wrap: break-word;
    word-break: break-word;
}

a { 
    text-decoration: none; 
    color: var(--color-secondary); 
    transition: var(--transition); 
    display: inline-block;
}

a:hover { 
    color: var(--color-primary); 
}

/* =========================================================
   LAYOUT GENERAL
========================================================= */
.container { 
    width: 100%; 
    max-width: 100%; 
    margin: 0 auto; 
    padding: 0 1rem; 
}

.section-with-bg { 
    background-color: rgba(255, 255, 255, 0.85); 
    padding: 2rem 0; 
}

section {
    padding: 2rem 0;
}

/* =========================================================
   HEADER - MOBILE FIRST
========================================================= */
header {
    background-color: var(--color-primary);
    color: white; 
    padding: 1rem 0;
    position: sticky; 
    top: 0; 
    z-index: 1000;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    width: 100%;
}

.header-container { 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    flex-wrap: wrap;
    gap: 10px;
}

header h1 { 
    margin: 0; 
    font-size: 1.3rem;
    line-height: 1.3;
    max-width: 70%;
    white-space: normal;
}

header h1 span { 
    font-weight: 400; 
    font-size: 0.85rem; 
    display: block; 
    opacity: .85; 
    margin-top: 0.2rem;
}

.menu-toggle {
    background: none; 
    border: none; 
    color: white;
    font-size: 1.5rem; 
    cursor: pointer; 
    display: grid;
    place-items: center;
    padding: 0.5rem;
    min-width: 44px;
    min-height: 44px;
    border-radius: 4px;
}

.menu-toggle:hover {
    background: rgba(255,255,255,0.1);
}

.menu-icon {
    display: block;
    line-height: 1;
}

.main-nav {
    display: none;
    width: 100%;
    order: 3;
    margin-top: 1rem;
}

.main-nav.open {
    display: block;
}

.main-nav ul { 
    list-style: none; 
    background: var(--color-primary);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.main-nav li { 
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.main-nav li:last-child {
    border-bottom: none;
}

.main-nav a {
    color: white; 
    font-weight: 600; 
    padding: 1rem; 
    display: block;
    text-align: center;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.main-nav a:hover { 
    background: rgba(255,255,255,0.1); 
}

/* =========================================================
   BIOGRAFÍA
========================================================= */
.bio-container { 
    display: flex; 
    flex-direction: column;
    align-items: center; 
    margin-top: 1.5rem; 
    text-align: center;
    gap: 1.5rem;
}

.bio-img {
    width: 100%;
    max-width: 250px;
    height: auto;
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

.bio-text { 
    width: 100%;
}

.destacada {
    font-size: 1.1rem; 
    font-weight: 600; 
    color: var(--color-primary);
    position: relative; 
    padding: 0.5rem 0 0.5rem 1rem; 
    margin-bottom: 1.5rem;
    text-align: left;
}

.destacada::before { 
    content: ""; 
    position: absolute; 
    left: 0; 
    top: 0; 
    height: 100%; 
    width: 5px; 
    background: var(--color-accent); 
}

/* =========================================================
   CARRUSEL - MOBILE FIRST
========================================================= */
.carousel-container {
    position: relative;
    margin: 1.5rem auto;
    width: 100%;
    max-width: 100%;
    overflow: hidden;
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.15);
    background: #000;
}

.carousel {
    display: flex;
    transition: transform 0.4s ease;
    will-change: transform;
}

.carousel img {
    flex: 0 0 100%;
    width: 100%;
    height: 40vh;
    min-height: 200px;
    max-height: 300px;
    object-fit: cover;
    background: #000;
    display: block;
}

/* Botones */
.carousel-btn {
    position: absolute; 
    top: 50%; 
    transform: translateY(-50%);
    background: rgba(0,0,0,0.6); 
    color: white; 
    border: none;
    width: 44px; 
    height: 44px; 
    border-radius: 50%;
    display: grid; 
    place-items: center;
    cursor: pointer; 
    z-index: 10; 
    font-size: 1.2rem; 
    transition: var(--transition);
    min-width: 44px;
    min-height: 44px;
}

.carousel-btn:hover { 
    background: rgba(0,0,0,0.9); 
}

.carousel-btn:active {
    transform: translateY(-50%) scale(0.95);
}

.carousel-btn.prev { 
    left: 10px; 
}

.carousel-btn.next { 
    right: 10px; 
}

/* Indicadores */
.carousel-indicators {
    position: absolute; 
    bottom: 15px; 
    left: 50%; 
    transform: translateX(-50%);
    display: flex; 
    gap: 8px;
    z-index: 10;
}

.indicator {
    width: 10px; 
    height: 10px; 
    border-radius: 50%;
    background: rgba(255,255,255,0.5); 
    cursor: pointer; 
    transition: var(--transition);
    border: none;
    padding: 0;
}

.indicator.active { 
    background: #fff; 
    transform: scale(1.2);
}

/* =========================================================
   OBRAS - MOBILE FIRST (1 COLUMNA)
========================================================= */
.obra-grid { 
    display: grid; 
    grid-template-columns: 1fr; 
    gap: 1.5rem; 
    margin-top: 1.5rem; 
}

.obra {
    background: white; 
    border-radius: 10px; 
    overflow: hidden;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1); 
    transition: var(--transition);
    display: flex; 
    flex-direction: column;
    height: 100%;
    width: 100%;
}

.obra:hover { 
    transform: translateY(-4px); 
    box-shadow: 0 10px 20px rgba(0,0,0,0.15); 
}

.obra img {
    width: 100%;
    aspect-ratio: 3 / 4;
    object-fit: contain;
    background: #f5f5f5;
}

.obra-content { 
    padding: 1.2rem; 
    flex: 1;
    display: flex;
    flex-direction: column;
}

.categoria { 
    margin-bottom: 2rem; 
}

.categoria h3 {
    margin-bottom: 1rem;
}

/* =========================================================
   VIDEOS - MOBILE FIRST
========================================================= */
.video-grid { 
    display: grid; 
    grid-template-columns: 1fr; 
    gap: 1.5rem; 
    margin-top: 1.5rem; 
}

.video-wrapper { 
    position: relative; 
    padding-bottom: 56.25%; 
    height: 0; 
    overflow: hidden; 
    border-radius: 10px; 
    box-shadow: 0 5px 15px rgba(0,0,0,0.1); 
    background: #000;
}

.video-wrapper h3 {
    position: absolute;
    top: 10px;
    left: 10px;
    right: 10px;
    color: white;
    background: rgba(0,0,0,0.7);
    padding: 0.5rem 0.8rem;
    border-radius: 5px;
    font-size: 0.95rem;
    z-index: 2;
    margin: 0;
    text-align: center;
}

.video-wrapper iframe, 
.video-wrapper video { 
    position: absolute; 
    top: 0;
    left: 0;
    width: 100%; 
    height: 100%; 
    border: 0; 
}

/* =========================================================
   NOTICIAS
========================================================= */
.noticias-grid { 
    display: grid; 
    grid-template-columns: 1fr; 
    gap: 1.5rem; 
    margin-top: 1.5rem; 
}

.noticia-card {
    background: white; 
    padding: 1.2rem; 
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1); 
    display: block; 
    transition: var(--transition);
    text-align: center;
}

.noticia-card:hover { 
    transform: translateY(-3px); 
    box-shadow: 0 10px 20px rgba(0,0,0,0.12); 
}

.noticia-card img {
    width: 80px;
    height: auto;
    border-radius: 8px;
    margin: 0 auto 1rem auto;
    display: block;
}

.noticia-card h3 { 
    margin-bottom: .5rem; 
    font-size: 1.1rem;
    color: var(--color-primary);
}

.noticia-card p {
    color: #666;
    font-size: 0.95rem;
}

/* =========================================================
   CONTACTO
========================================================= */
.contacto-grid { 
    display: grid; 
    grid-template-columns: 1fr; 
    gap: 2rem; 
    margin-top: 1.5rem; 
}

.contacto-info { 
    display: flex; 
    flex-direction: column; 
    gap: 1.2rem; 
    text-align: center;
    align-items: center;
}

.contacto-info p {
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    justify-content: center;
    flex-wrap: wrap;
}

.contacto-info a {
    color: var(--color-primary);
    font-weight: 600;
    text-decoration: underline;
}

.social-links { 
    display: flex; 
    justify-content: center;
    gap: 0.8rem; 
    flex-wrap: wrap;
}

.social-links a {
    display: grid; 
    place-items: center; 
    width: 44px; 
    height: 44px;
    background: var(--color-primary); 
    color: white; 
    border-radius: 50%; 
    transition: var(--transition);
    min-width: 44px;
    min-height: 44px;
    font-size: 1.2rem;
}

.social-links a:hover { 
    background: var(--color-secondary); 
    transform: translateY(-2px); 
}

/* =========================================================
   BOTONES
========================================================= */
.btn-compra, .btn-leer-mas {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.8rem 1.2rem; 
    background: var(--color-accent); 
    color: #fff;
    border: none; 
    border-radius: 6px; 
    font-weight: 600; 
    cursor: pointer; 
    transition: var(--transition); 
    text-align: center;
    margin-top: 1rem;
    font-size: 1rem;
    min-height: 44px;
    text-decoration: none;
    width: 100%;
}

.btn-leer-mas { 
    background: var(--color-secondary); 
    margin-top: .5rem; 
}

.btn-compra:hover, 
.btn-leer-mas:hover { 
    filter: brightness(.9); 
    transform: translateY(-1px); 
}

.btn-compra:active,
.btn-leer-mas:active {
    transform: translateY(0);
}

/* =========================================================
   FOOTER
========================================================= */
footer { 
    background: var(--color-primary); 
    color: white; 
    padding: 1.5rem 0; 
    text-align: center; 
    margin-top: 2rem;
}

footer p { 
    margin-bottom: 0.5rem; 
    font-size: 0.95rem;
}

.creditos { 
    font-size: 0.85rem; 
    opacity: 0.8; 
}

/* =========================================================
   MEDIA QUERIES - TABLETS (768px+)
========================================================= */
@media (min-width: 768px) {
    body {
        font-size: 17px;
    }
    
    .container {
        padding: 0 1.5rem;
        max-width: 1200px;
    }
    
    h1 {
        font-size: 1.8rem;
    }
    
    h2 {
        font-size: 1.8rem;
    }
    
    h2::after {
        width: 80px;
    }
    
    h3 {
        font-size: 1.4rem;
    }
    
    .section-with-bg {
        padding: 3rem 0;
    }
    
    section {
        padding: 3rem 0;
    }
    
    /* Header desktop */
    .menu-toggle {
        display: none;
    }
    
    .main-nav {
        display: block !important;
        width: auto;
        order: 2;
        margin-top: 0;
    }
    
    .main-nav ul {
        display: flex;
        background: transparent;
        box-shadow: none;
        border-radius: 0;
    }
    
    .main-nav li {
        border-bottom: none;
        margin-left: 1.5rem;
    }
    
    .main-nav a {
        padding: 0.5rem 0;
        justify-content: flex-start;
        min-height: auto;
        position: relative;
    }
    
    .main-nav a::after {
        content: "";
        position: absolute;
        bottom: -2px;
        left: 0;
        width: 0;
        height: 2px;
        background: var(--color-accent);
        transition: var(--transition);
    }
    
    .main-nav a:hover::after {
        width: 100%;
    }
    
    /* Biografía desktop */
    .bio-container {
        flex-direction: row;
        text-align: left;
        gap: 2rem;
    }
    
    .bio-img {
        max-width: 300px;
        margin: 0;
    }
    
    .destacada {
        text-align: left;
    }
    
    /* Carrusel tablet */
    .carousel img {
        height: 50vh;
        min-height: 300px;
        max-height: 400px;
    }
    
    /* Obras tablet (2 columnas) */
    .obra-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    /* Videos tablet (2 columnas) */
    .video-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    /* Noticias tablet (2 columnas) */
    .noticias-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    /* Contacto tablet */
    .contacto-grid {
        grid-template-columns: 1fr;
    }
}

/* =========================================================
   MEDIA QUERIES - DESKTOP (1024px+)
========================================================= */
@media (min-width: 1024px) {
    .container {
        padding: 0 2rem;
    }
    
    h1 {
        font-size: 2rem;
    }
    
    h2 {
        font-size: 2rem;
    }
    
    /* Obras desktop (3 columnas) */
    .obra-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 2rem;
    }
    
    /* Videos desktop (3 columnas cuando hay espacio) */
    .video-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    
    /* Carrusel desktop */
    .carousel img {
        height: 60vh;
        min-height: 400px;
        max-height: 500px;
    }
    
    /* Biografía desktop */
    .bio-container {
        gap: 3rem;
    }
    
    .bio-img {
        max-width: 350px;
    }
    
    /* Contacto desktop */
    .contacto-info {
        flex-direction: row;
        justify-content: center;
        flex-wrap: wrap;
    }
    
    .social-links {
        margin-left: 1rem;
    }
    
    /* Fondo más blur en desktop */
    body::before {
        filter: blur(8px);
    }
}

/* =========================================================
   MEDIA QUERIES - PANTALLAS GRANDES (1200px+)
========================================================= */
@media (min-width: 1200px) {
    .container {
        max-width: 1200px;
    }
    
    .carousel img {
        height: 70vh;
        max-height: 600px;
    }
}

/* =========================================================
   AJUSTES PARA ORIENTACIÓN HORIZONTAL EN MÓVILES
========================================================= */
@media (max-height: 500px) and (orientation: landscape) {
    .carousel img {
        height: 70vh;
        min-height: 250px;
    }
    
    .bio-container {
        flex-direction: row;
        text-align: left;
    }
    
    .bio-img {
        max-width: 200px;
    }
    
    header {
        padding: 0.5rem 0;
    }
    
    .main-nav a {
        padding: 0.5rem;
    }
}

/* =========================================================
   MEJORAS DE ACCESIBILIDAD
========================================================= */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    html {
        scroll-behavior: auto;
    }
}

/* High contrast mode */
@media (prefers-contrast: high) {
    :root {
        --color-primary: #000;
        --color-secondary: #0056b3;
        --color-accent: #008000;
        --color-text: #000;
    }
    
    .carousel-btn {
        border: 2px solid white;
    }
}

/* Dark mode */
@media (prefers-color-scheme: dark) {
    body {
        background-color: #121212;
        color: #e0e0e0;
    }
    
    .section-with-bg {
        background-color: rgba(30, 30, 30, 0.9);
    }
    
    .obra,
    .noticia-card {
        background: #1e1e1e;
        color: #e0e0e0;
    }
    
    .destacada {
        color: #ffffff;
    }
    
    h2, h3 {
        color: #ffffff;
    }
}

/* =========================================================
   UTILIDADES
========================================================= */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.loading {
    opacity: 0.7;
    pointer-events: none;
}

/* Prevenir zoom en iOS en inputs */
@media screen and (max-width: 768px) {
    input,
    select,
    textarea {
        font-size: 16px;
    }
}