/* Reset y estilos base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #8a6d3b;
    --primary-dark: #6b4f25;
    --secondary-color: #a8c6a8;
    --accent-color: #d7b89c;
    --text-dark: #333333;
    --text-light: #666666;
    --text-lighter: #888888;
    --bg-light: #f9f7f3;
    --bg-white: #ffffff;
    --shadow: 0 5px 15px rgba(0, 0, 0, 0.08);
    --transition: all 0.3s ease;
    --border-radius: 8px;
    --font-heading: 'Playfair Display', serif;
    --font-body: 'Raleway', sans-serif;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-body);
    font-size: 16px;
    line-height: 1.6;
    color: var(--text-dark);
    background-color: var(--bg-light);
    overflow-x: hidden;
}

.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

.section {
    padding: 80px 0;
    position: relative;
}

.section-title {
    font-family: var(--font-heading);
    font-size: 2.8rem;
    font-weight: 700;
    text-align: center;
    margin-bottom: 20px;
    position: relative;
}

.section-title .highlight {
    color: var(--primary-color);
    position: relative;
}

.section-subtitle {
    text-align: center;
    color: var(--text-light);
    font-size: 1.1rem;
    max-width: 600px;
    margin: 0 auto 50px;
}

.highlight {
    color: var(--primary-color);
}

/* Navegación */
.main-nav {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    background-color: rgba(255, 255, 255, 0.95);
    box-shadow: var(--shadow);
    z-index: 1000;
    backdrop-filter: blur(10px);
    transition: var(--transition);
}

.nav-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    max-width: 1200px;
    margin: 0 auto;
}

.nav-logo {
    display: flex;
    align-items: center;
    gap: 10px;
}

.logo-text-nav {
    font-family: var(--font-heading);
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--primary-color);
    background-color: var(--accent-color);
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.logo-name {
    font-family: var(--font-heading);
    font-size: 1.3rem;
    font-weight: 600;
    color: var(--text-dark);
}

.nav-menu {
    display: flex;
    list-style: none;
    gap: 30px;
}

.nav-link {
    text-decoration: none;
    color: var(--text-dark);
    font-weight: 600;
    font-size: 1rem;
    transition: var(--transition);
    position: relative;
    padding: 5px 0;
}

.nav-link:hover {
    color: var(--primary-color);
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 2px;
    background-color: var(--primary-color);
    transition: var(--transition);
}

.nav-link:hover::after {
    width: 100%;
}

.menu-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-dark);
    cursor: pointer;
}

/* Hero section */
.hero-section {
    min-height: 100vh;
    display: flex;
    align-items: center;
    padding-top: 80px;
    position: relative;
    overflow: hidden;
    /* Quitamos el gradiente de fondo ya que ahora tendremos video */
    background: transparent;
}

.video-background {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    overflow: hidden;
}

.video-background video {
    position: absolute;
    top: 50%;
    left: 50%;
    min-width: 100%;
    min-height: 100%;
    width: auto;
    height: auto;
    transform: translateX(-50%) translateY(-50%);
    object-fit: cover;
    
    /* Asegurar que el video sea responsivo */
    @media (min-aspect-ratio: 16/9) {
        width: 100%;
        height: auto;
    }
    
    @media (max-aspect-ratio: 16/9) {
        width: auto;
        height: 100%;
    }
}

/* Overlay para mejorar legibilidad */
.video-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        to bottom,
        rgba(0, 0, 0, 0.3) 0%,
        rgba(0, 0, 0, 0.2) 50%,
        rgba(0, 0, 0, 0.4) 100%
    );
    z-index: 1;
}

/* Asegurar que el contenido esté por encima del video */
.hero-content {
    position: relative;
    z-index: 2;
    max-width: 700px;
    margin: 0 auto;
    text-align: center;
}

/* Ajustar colores del texto para mejor contraste sobre video */
.hero-title {
    font-family: var(--font-heading);
    font-size: 3.5rem;
    font-weight: 700;
    margin-bottom: 20px;
    line-height: 1.2;
    color: white; /* Cambiar a blanco para mejor contraste */
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

.hero-title .highlight {
    color: var(--accent-color); /* Usar color de acento para el highlight */
    text-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
}

.hero-subtitle {
    font-size: 1.3rem;
    color: white; /* Blanco semitransparente */
    margin-bottom: 40px;
    text-shadow: 0 1px 5px rgba(0, 0, 0, 0.3);
}

/* Ajustar botón para mejor contraste */
.hero-section .btn-primary {
    background-color: rgba(138, 109, 59, 0.9); /* Más opaco para mejor visibilidad */
    border-color: rgba(138, 109, 59, 0.9);
    color: white;
    backdrop-filter: blur(5px); /* Efecto de vidrio esmerilado */
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.hero-section .btn-primary:hover {
    background-color: rgba(255, 255, 255, 0.9);
    color: var(--primary-color);
    border-color: white;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
}

/* Ajustar elementos flotantes para que sean visibles sobre el video */
.floating-element {
    position: absolute;
    border-radius: 50%;
    z-index: 1; /* Asegurar que estén sobre el overlay pero bajo el contenido */
    pointer-events: none;
    background-color: rgba(215, 184, 156, 0.15); /* Más visible sobre video */
    box-shadow: 0 0 30px rgba(215, 184, 156, 0.2);
}

.element-1 {
    width: 100px;
    height: 100px;
    top: 20%;
    left: 8%;
    animation: slowFloat 15s ease-in-out infinite;
}

.element-2 {
    width: 150px;
    height: 150px;
    bottom: 15%;
    right: 6%;
    animation: slowFloat 20s ease-in-out infinite reverse;
    animation-delay: 1s;
}

.element-3 {
    width: 80px;
    height: 80px;
    top: 60%;
    left: 12%;
    animation: slowFloat 18s ease-in-out infinite;
    animation-delay: 2s;
}

@keyframes slowFloat {
    0%, 100% { 
        transform: translate(0, 0) rotate(0deg); 
    }
    33% { 
        transform: translate(10px, -15px) rotate(120deg); 
    }
    66% { 
        transform: translate(-10px, 10px) rotate(240deg); 
    }
}

/* ============================================
   RESPONSIVE PARA VIDEO DE FONDO
   ============================================ */

@media (max-width: 992px) {
    .hero-title {
        font-size: 2.8rem;
    }
    
    .element-1, .element-2, .element-3 {
        opacity: 0.7; /* Reducir opacidad en móviles */
    }
}

@media (max-width: 768px) {
    .hero-title {
        font-size: 2.2rem;
    }
    
    .hero-subtitle {
        font-size: 1.1rem;
    }
    
    /* En móviles, podemos reducir aún más la opacidad o esconder elementos */
    .floating-element {
        opacity: 0.5;
    }
    
    /* Asegurar que el video no consuma demasiada batería en móviles */
    @media (max-width: 768px) and (prefers-reduced-motion: reduce) {
        .video-background video {
            display: none; /* Ocultar video si el usuario prefiere reducir movimiento */
        }
        
        .video-background {
            background: linear-gradient(135deg, var(--bg-light) 0%, #f0ebe1 100%);
        }
    }
}

@media (max-width: 576px) {
    .hero-title {
        font-size: 1.8rem;
    }
    
    .hero-subtitle {
        font-size: 1rem;
    }
    
    .floating-element {
        display: none; /* Ocultar completamente en pantallas muy pequeñas */
    }
}

/* ============================================
   MEJORAS DE ACCESIBILIDAD Y RENDIMIENTO
   ============================================ */

/* Detener video cuando no es visible (opcional) */
.hero-section:not(:hover) video {
    /* Pausar video cuando no está en viewport (requiere JavaScript adicional) */
}

/* Para usuarios que prefieren reducir movimiento */
@media (prefers-reduced-motion: reduce) {
    .video-background video {
        animation: none;
    }
    
    .floating-element {
        animation: none;
        opacity: 0.3;
    }
    
    /* Mostrar imagen estática en lugar de video */
    .video-background {
        background-image: url('/images/poster-video.jpg');
        background-size: cover;
        background-position: center;
    }
    
    .video-background video {
        display: none;
    }
}

/* Controles de video para móviles */
.video-controls {
    position: absolute;
    bottom: 20px;
    right: 20px;
    z-index: 3;
    opacity: 0.7;
    transition: opacity 0.3s ease;
}

.video-controls:hover {
    opacity: 1;
}

.video-controls button {
    background: rgba(0, 0, 0, 0.5);
    border: none;
    color: white;
    padding: 8px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
    backdrop-filter: blur(5px);
}

/* Loading state para el video */
.video-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    z-index: 1;
}

.hero-content {
    max-width: 700px;
    margin: 0 auto;
    text-align: center;
    position: relative;
    z-index: 2;
}

.hero-title {
    font-family: var(--font-heading);
    font-size: 3.5rem;
    font-weight: 700;
    margin-bottom: 20px;
    line-height: 1.2;
}

.hero-subtitle {
    font-size: 1.3rem;
    color: white;
    margin-bottom: 40px;
}

/* Botones */
.btn-primary {
    display: inline-block;
    background-color: var(--primary-color);
    color: white;
    padding: 15px 35px;
    border-radius: var(--border-radius);
    text-decoration: none;
    font-weight: 600;
    font-size: 1rem;
    transition: var(--transition);
    border: 2px solid var(--primary-color);
    cursor: pointer;
}

.btn-primary:hover {
    background-color: transparent;
    color: var(--primary-color);
}

/* Sección sobre el artista */
.about-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 60px;
    align-items: center;
}

.about-image {
    position: relative;
}

.image-frame {
    position: relative;
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--shadow);
}

.image-frame img {
    width: 100%;
    height: auto;
    display: block;
    transition: var(--transition);
}

.image-decoration {
    position: absolute;
    top: 20px;
    left: 20px;
    width: 100%;
    height: 100%;
    border: 3px solid var(--accent-color);
    border-radius: var(--border-radius);
    z-index: -1;
}

.about-name {
    font-family: var(--font-heading);
    font-size: 2.2rem;
    margin-bottom: 20px;
    color: var(--text-dark);
}

.about-description {
    margin-bottom: 20px;
    color: var(--text-light);
    line-height: 1.8;
}

.about-quote {
    font-family: var(--font-heading);
    font-style: italic;
    font-size: 1.3rem;
    color: var(--primary-color);
    padding: 20px 0 20px 30px;
    border-left: 3px solid var(--accent-color);
    margin-top: 30px;
}

/* Sección de obras */
.works-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 40px;
    margin-top: 50px;
}

.work-item {
    background-color: var(--bg-white);
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: var(--transition);
    cursor: pointer;
}

.work-item:hover {
    transform: translateY(-10px);
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.15);
}

.work-image {
    position: relative;
    height: 300px;
    overflow: hidden;
}

.work-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.work-item:hover .work-image img {
    transform: scale(1.05);
}

.work-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    background: linear-gradient(to top, rgba(0,0,0,0.8), transparent);
    color: white;
    padding: 20px;
    transform: translateY(10px);
    opacity: 0;
    transition: var(--transition);
}

.work-item:hover .work-overlay {
    transform: translateY(0);
    opacity: 1;
}

.work-title {
    font-family: var(--font-heading);
    font-size: 1.5rem;
    margin-bottom: 5px;
}

.work-year {
    font-size: 0.9rem;
    opacity: 0.8;
}

.work-details {
    padding: 25px;
    background-color: var(--bg-white);
    border-top: 1px solid #eee;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.5s ease;
}

.work-details.active {
    max-height: 300px;
}

.work-detail-title {
    font-family: var(--font-heading);
    font-size: 1.5rem;
    color: var(--primary-color);
    margin-bottom: 10px;
}

.work-detail-description {
    color: var(--text-light);
    margin-bottom: 15px;
    line-height: 1.7;
}

.work-detail-specs {
    font-size: 0.9rem;
    color: var(--text-lighter);
}

/* Sección de contacto */
.contact-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 60px;
    margin-top: 50px;
}

.contact-info-title, .contact-form-title {
    font-family: var(--font-heading);
    font-size: 1.8rem;
    margin-bottom: 30px;
    color: var(--text-dark);
}

.contact-item {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 25px;
}

.contact-item i {
    font-size: 1.2rem;
    color: var(--primary-color);
    width: 40px;
    height: 40px;
    background-color: rgba(138, 109, 59, 0.1);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.contact-item h4 {
    font-size: 0.9rem;
    color: var(--text-lighter);
    margin-bottom: 5px;
}

.contact-item p {
    font-size: 1.1rem;
    color: var(--text-dark);
}

.phone-link {
    color: var(--text-dark);
    text-decoration: none;
    transition: var(--transition);
}

.phone-link:hover {
    color: var(--primary-color);
}

.form-group {
    margin-bottom: 20px;
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 15px;
    border: 1px solid #ddd;
    border-radius: var(--border-radius);
    font-family: var(--font-body);
    font-size: 1rem;
    transition: var(--transition);
    background-color: var(--bg-white);
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(138, 109, 59, 0.1);
}

/* Footer */
.main-footer {
    background-color: var(--text-dark);
    color: white;
    padding: 60px 0 30px;
}

.footer-content {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 40px;
}

.footer-logo {
    display: flex;
    flex-direction: column;
}

.logo-text-footer {
    font-family: var(--font-heading);
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--accent-color);
    margin-bottom: 10px;
}

.logo-name-footer {
    font-family: var(--font-heading);
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 10px;
}

.footer-tagline {
    color: #aaa;
    font-style: italic;
}

.footer-links {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.footer-links a {
    color: #ccc;
    text-decoration: none;
    transition: var(--transition);
}

.footer-links a:hover {
    color: var(--accent-color);
    padding-left: 5px;
}

.footer-contact {
    display: flex;
    flex-direction: column;
}

.footer-phone {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: white;
    text-decoration: none;
    font-size: 1.2rem;
    margin-bottom: 20px;
    transition: var(--transition);
}

.footer-phone:hover {
    color: var(--accent-color);
}

.footer-copyright {
    color: #888;
    font-size: 0.9rem;
    margin-top: auto;
}

/* Responsive */
@media (max-width: 992px) {
    .about-content,
    .contact-content {
        grid-template-columns: 1fr;
        gap: 40px;
    }
    
    .hero-title {
        font-size: 2.8rem;
    }
    
    .section-title {
        font-size: 2.4rem;
    }
}

@media (max-width: 768px) {
    .nav-menu {
        position: fixed;
        top: 80px;
        left: 0;
        width: 100%;
        background-color: white;
        flex-direction: column;
        align-items: center;
        padding: 20px 0;
        box-shadow: var(--shadow);
        transform: translateY(-100%);
        opacity: 0;
        transition: var(--transition);
        z-index: 999;
    }
    
    .nav-menu.active {
        transform: translateY(0);
        opacity: 1;
    }
    
    .menu-toggle {
        display: block;
    }
    
    .footer-content {
        grid-template-columns: 1fr;
        text-align: center;
        gap: 30px;
    }
    
    .hero-title {
        font-size: 2.2rem;
    }
    
    .section {
        padding: 60px 0;
    }
}

@media (max-width: 576px) {
    .hero-title {
        font-size: 1.8rem;
    }
    
    .section-title {
        font-size: 2rem;
    }
    
    .works-grid {
        grid-template-columns: 1fr;
    }
}

/* Solución para imágenes después de animación */
body.loaded .work-image img,
body.loaded .image-frame img {
    opacity: 1 !important;
    visibility: visible !important;
    animation: imageFadeIn 0.5s ease forwards;
}

@keyframes imageFadeIn {
    from {
        opacity: 0.95;
    }
    to {
        opacity: 1;
    }
}

/* Asegurar que las imágenes no se vean afectadas por la animación de carga */
.work-image,
.image-frame {
    opacity: 1 !important;
    transition: none !important;
}

/* Fondo de respaldo para imágenes */
.work-image {
    background-color: #f9f7f3;
    position: relative;
}

.work-image::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: inherit;
    z-index: 0;
}

.work-image img {
    position: relative;
    z-index: 1;
}

/* ============================================
   ANIMACIONES DE CARGA CORREGIDAS
   ============================================ */

/* Animación de carga - VERSIÓN SIMPLIFICADA Y FUNCIONAL */
.loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #f9f7f3; /* Fondo sólido igual al body */
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 99999; /* Z-index muy alto */
    opacity: 1;
    visibility: visible;
    transition: opacity 0.6s ease, visibility 0.6s ease;
}

.loading-screen.fade-out {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.loading-content {
    text-align: center;
}

.logo-animation {
    position: relative;
    width: 120px;
    height: 120px;
    margin: 0 auto 20px;
}

.clay-piece {
    position: absolute;
    border-radius: 50%;
    background-color: #8a6d3b;
    opacity: 0.7;
}

.piece-1 {
    width: 50px;
    height: 50px;
    top: 10px;
    left: 35px;
    animation: float1 2s ease-in-out infinite;
}

.piece-2 {
    width: 40px;
    height: 40px;
    top: 50px;
    left: 15px;
    animation: float2 2.2s ease-in-out infinite 0.3s;
}

.piece-3 {
    width: 45px;
    height: 45px;
    top: 50px;
    left: 65px;
    animation: float3 2.4s ease-in-out infinite 0.6s;
}

@keyframes float1 {
    0%, 100% { transform: translateY(0) scale(1); }
    50% { transform: translateY(-15px) scale(1.05); }
}

@keyframes float2 {
    0%, 100% { transform: translateY(0) scale(1); }
    50% { transform: translateY(-10px) scale(1.03); }
}

@keyframes float3 {
    0%, 100% { transform: translateY(0) scale(1); }
    50% { transform: translateY(-18px) scale(1.07); }
}

.logo-text {
    font-family: 'Playfair Display', serif;
    font-size: 2rem;
    font-weight: 700;
    color: #333333;
    margin-bottom: 5px;
}

.loading-subtitle {
    font-size: 1rem;
    color: #666666;
    font-style: italic;
}

/* Elementos flotantes del hero */
.floating-element {
    position: absolute;
    border-radius: 50%;
    background-color: rgba(168, 198, 168, 0.05);
    z-index: 1;
    pointer-events: none;
}

.element-1 {
    width: 80px;
    height: 80px;
    top: 20%;
    left: 5%;
    animation: slowFloat 15s ease-in-out infinite;
}

.element-2 {
    width: 120px;
    height: 120px;
    bottom: 15%;
    right: 8%;
    animation: slowFloat 20s ease-in-out infinite reverse;
    animation-delay: 1s;
}

.element-3 {
    width: 60px;
    height: 60px;
    top: 60%;
    left: 10%;
    animation: slowFloat 18s ease-in-out infinite;
    animation-delay: 2s;
}

@keyframes slowFloat {
    0%, 100% { transform: translate(0, 0) rotate(0deg); }
    33% { transform: translate(5px, -10px) rotate(120deg); }
    66% { transform: translate(-5px, 5px) rotate(240deg); }
}

/* Elementos laterales */
.side-element {
    position: fixed;
    width: 100px;
    height: 100px;
    background-color: rgba(215, 184, 156, 0.08);
    border-radius: 50%;
    z-index: -1;
    opacity: 0;
    transition: opacity 0.8s ease;
    pointer-events: none;
}

.side-left {
    left: -50px;
    top: 50%;
}

.side-right {
    right: -50px;
    top: 30%;
}

.side-element.visible {
    opacity: 0.3;
}

/* Animaciones scroll */
.fade-in-up {
    opacity: 1 !important; /* FORZAR VISIBILIDAD */
    transform: translateY(0) !important;
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.fade-in-up.animated {
    opacity: 0;
    transform: translateY(30px);
}

.fade-in-up.appear {
    opacity: 1;
    transform: translateY(0);
}

/* IMPORTANTE: Forzar visibilidad de imágenes siempre */
.work-image img,
.image-frame img {
    opacity: 1 !important;
    visibility: visible !important;
    display: block !important;
    animation: none !important;
}

/* Garantizar que las imágenes sean visibles después de la carga */
body:not(.loading) img {
    opacity: 1 !important;
    visibility: visible !important;
}

/* ============================================
   ESTILOS CRÍTICOS PARA IMÁGENES
   ============================================ */

/* Reset de estilos problemáticos */
.work-image {
    background-color: transparent !important;
    position: relative;
}

.work-image::before {
    display: none !important;
}

/* Forzar carga y visibilidad */
img {
    max-width: 100%;
    height: auto;
    opacity: 1 !important;
    transition: none !important;
}

/* Corrección específica para imágenes en grid de obras */
.works-grid .work-image img {
    width: 100%;
    height: 300px;
    object-fit: cover;
    opacity: 1 !important;
    animation: forceShow 0.01s forwards !important;
}

@keyframes forceShow {
    to { opacity: 1 !important; }
}

/* Eliminar cualquier efecto de la animación de carga en las imágenes */
#loading-animation.fade-out ~ * img {
    opacity: 1 !important;
    animation: immediateShow 0s forwards !important;
}

@keyframes immediateShow {
    to { opacity: 1 !important; }
}