/* ======== CONFIGURACIÓN GENERAL ======== */
:root {
    --color-fondo: #121212;
    --color-texto: #f0f0f0;
    --color-acento: #ffffff;
    --color-hover: #888888;
    --color-whatsapp: #25D366;
    --fuente-principal: 'Montserrat', sans-serif;
    --header-height: 110px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
    font-family: var(--fuente-principal);
    background-color: var(--color-fondo);
    color: var(--color-texto);
    line-height: 1.6;
    font-weight: 300;
    padding-top: var(--header-height);
    /* Mejora de renderizado de texto */
    -webkit-font-smoothing: antialiased;
}

.container { max-width: 1200px; margin: 0 auto; padding: 4rem 2rem; }
h1, h2, h3 { font-weight: 700; text-transform: uppercase; letter-spacing: 2px; color: var(--color-acento); }

/* ======== HEADER ======== */
header {
    background: linear-gradient(to bottom, rgba(0,0,0,0) 0%, rgba(20,20,20,0.9) 100%);
    position: fixed;
    top: 0; left: 0; width: 100%;
    display: flex; justify-content: space-between; align-items: center;
    padding: 1rem 3rem;
    z-index: 1000;
    border-bottom: none;
    height: var(--header-height);
    text-shadow: 0 2px 4px rgba(0,0,0,0.5);
    /* Optimización de animaciones */
    will-change: background-color; 
}

.header-left { flex: 0 0 auto; }
.logo img { height: 70px; width: auto; display: block; }

.nav-menu ul { list-style: none; display: flex; gap: 3rem; }
.nav-menu a {
    text-decoration: none; color: var(--color-texto); font-size: 0.95rem;
    text-transform: uppercase; letter-spacing: 1px; transition: color 0.3s ease;
}
.nav-menu a:hover { color: var(--color-acento); }

.header-right { display: flex; align-items: center; gap: 1.5rem; }
.header-social { display: flex; gap: 1.2rem; padding-right: 1rem; border-right: 1px solid rgba(255,255,255,0.2); }
.header-social a { color: #fff; font-size: 1.4rem; transition: color 0.3s; }
.header-social a:hover { color: var(--color-hover); }
.menu-toggle { display: none; font-size: 1.5rem; cursor: pointer; color: #fff; }

/* ======== HERO BOXED (Carrusel) ======== */
.hero-boxed {
    width: 100%;
    padding: 0 2rem; 
    
    /* ALTURA AUMENTADA PARA ORDENADOR */
    height: 100vh;      /* Ocupa el 100% de la altura visible */
    min-height: 800px;  /* Altura mínima de seguridad */
    
    position: relative;
    display: flex;
    justify-content: center;
    contain: layout size; 
}

.carousel-container { 
    width: 100%; height: 100%; 
    position: relative; 
    overflow: hidden; 
    border-radius: 4px; 
}

.carousel-image {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    opacity: 0; transition: opacity 1s ease-in-out;
    display: block;
    will-change: opacity; 
}
.carousel-image img { width: 100%; height: 100%; object-fit: cover; display: block; }
.carousel-image.active { opacity: 1; }

.carousel-control {
    position: absolute; top: 50%; transform: translateY(-50%);
    background: transparent; color: rgba(255,255,255,0.7);
    border: none; padding: 20px; cursor: pointer; font-size: 3rem;
    z-index: 10; transition: color 0.3s;
}
.carousel-control:hover { color: #fff; transform: translateY(-50%) scale(1.1); }
.carousel-control.prev { left: 10px; }
.carousel-control.next { right: 10px; }

/* ======== PORTAFOLIO ======== */
#trabajo { background-color: var(--color-fondo); padding-top: 4rem; position: relative; }
#trabajo h2 { text-align: center; margin-bottom: 3rem; font-size: 2rem; }

.filtros {
    text-align: center; margin-bottom: 3rem;
    display: flex; justify-content: center; flex-wrap: wrap; gap: 1rem;
    scroll-margin-top: 150px; 
}
.filtro-btn {
    background: transparent; border: 1px solid #333; color: #888;
    padding: 0.8rem 2rem; cursor: pointer; transition: all 0.3s;
    text-transform: uppercase; font-family: var(--fuente-principal); letter-spacing: 1px;
}
.filtro-btn:hover, .filtro-btn.active { border-color: var(--color-acento); color: var(--color-acento); }

.galeria-grid {
    display: grid; 
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px; 
    position: relative; 
    min-height: 400px;
}
.galeria-placeholder {
    position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
    text-align: center; opacity: 0.4; pointer-events: none;
    width: 100%;
}
.galeria-placeholder img { width: 450px; max-width: 90%; margin-bottom: 1rem; filter: invert(0); }

.galeria-item { display: none; overflow: hidden; aspect-ratio: 1 / 1.2; cursor: pointer; }

/* ======== VIDEOS ======== */
.galeria-item.video-container {
    grid-column: 1 / -1; width: 100%; max-width: 900px; 
    margin: 0 auto; aspect-ratio: auto; background: transparent; display: none; 
}

.video-carousel {
    position: relative; width: 100%; padding-top: 56.25%; 
    background: #000; overflow: hidden; margin-bottom: 15px; 
}
.video-slide {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%; display: none; 
}
.video-slide.active { display: block; }
.video-slide iframe { width: 100%; height: 100%; border: none; }

.video-controls-bar {
    display: flex; justify-content: center; align-items: center; gap: 20px; padding: 10px;
}
.video-control-btn {
    background: transparent; border: 1px solid #333; color: #fff; cursor: pointer;
    font-size: 1.2rem; padding: 5px 15px; transition: all 0.3s;
}
.video-control-btn:hover { border-color: #fff; background: #333; }

.video-dots { display: flex; gap: 10px; }
.dot {
    display: block; width: 10px; height: 10px; background-color: #444;
    border-radius: 50%; cursor: pointer; transition: background-color 0.3s;
}
.dot.active { background-color: #fff; transform: scale(1.2); }

.galeria-item img {
    width: 100%; height: 100%; object-fit: cover;
    transition: transform 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94); filter: grayscale(20%);
    will-change: transform, filter;
}
.galeria-item:hover img { transform: scale(1.05); filter: grayscale(0%); }

/* ======== BOTÓN FLOTANTE ======== */
.btn-flotante {
    position: fixed; bottom: 30px; right: 30px;
    background-color: #fff; color: #000; border: none;
    width: 50px; height: 50px; border-radius: 50%;
    font-size: 1.2rem; cursor: pointer;
    box-shadow: 0 4px 10px rgba(0,0,0,0.5);
    z-index: 900; opacity: 0; pointer-events: none;
    transition: opacity 0.3s, transform 0.3s;
    display: flex; align-items: center; justify-content: center;
}
.btn-flotante.visible { opacity: 1; pointer-events: auto; }
.btn-flotante:hover { transform: scale(1.1); background-color: #ccc; }


/* ======== ABOUT y CONTACTO (Content Visibility) ======== */
#sobre-mi, #contacto {
    content-visibility: auto; 
}

.about-container { display: flex; align-items: center; gap: 4rem; padding: 6rem 2rem; }
.about-texto { flex: 1; }
.about-texto h3 { font-size: 1rem; color: #666; margin-bottom: 1rem; }
.about-texto h2 { font-size: 3rem; margin-bottom: 2rem; color: #fff; }
.about-texto p { margin-bottom: 1.5rem; font-size: 1.1rem; color: #ccc; font-weight: 300; }
.street-link-container { margin-top: 2.5rem; padding-top: 2rem; border-top: 1px solid #333; }
.link-street-text { color: #fff; text-decoration: none; font-size: 1.1rem; font-weight: 400; transition: color 0.3s; font-style: italic; }
.link-street-text:hover { color: #ccc; text-decoration: underline; }
.about-imagen { flex: 1; max-width: 400px; }
.about-imagen img { width: 100%; border-radius: 2px; }

#contacto { background-color: #0a0a0a; text-align: center; padding-bottom: 6rem; }
.links-contacto { display: flex; justify-content: center; gap: 2rem; margin-top: 3rem; flex-wrap: wrap; }
.link-item {
    padding: 1rem 2rem; border: 1px solid #333; text-decoration: none; color: #fff;
    font-size: 1rem; transition: all 0.3s; display: flex; align-items: center; gap: 10px;
}
.link-item:hover { background: #fff; color: #000; border-color: #fff; }
.link-item.whatsapp-btn { border-color: var(--color-whatsapp); color: var(--color-whatsapp); }
.link-item.whatsapp-btn:hover { background-color: var(--color-whatsapp); color: #fff; }
.contact-form-container { max-width: 600px; margin: 4rem auto 0; text-align: left; }
.form-group label { font-size: 0.9rem; color: #888; margin-bottom: 0.5rem; display: block; }
.form-group input, .form-group textarea {
    width: 100%; padding: 1rem; background: #1a1a1a; border: 1px solid #333;
    color: #fff; font-family: var(--fuente-principal); margin-bottom: 1.5rem;
}
.form-group input:focus, .form-group textarea:focus { outline: none; border-color: #fff; }
.btn-enviar {
    width: 100%; padding: 1rem; background: #fff; color: #000; border: none;
    font-weight: 700; text-transform: uppercase; cursor: pointer; transition: background 0.3s;
}
.btn-enviar:hover { background: #ccc; }

footer { text-align: center; padding: 3rem; background: #000; color: #555; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 2px; }

/* Lightbox */
.lightbox {
    display: none; position: fixed; z-index: 9999; left: 0; top: 0; width: 100%; height: 100%;
    background-color: rgba(0, 0, 0, 0.95); justify-content: center; align-items: center;
}
.lightbox-wrapper { position: relative; max-width: 90%; max-height: 90%; }
.lightbox-contenido { max-width: 100%; max-height: 90vh; box-shadow: 0 0 20px rgba(0,0,0,0.5); }
.lightbox-cerrar { position: absolute; top: 20px; right: 30px; font-size: 40px; color: #fff; cursor: pointer; }
.lightbox-prev, .lightbox-next {
    cursor: pointer; position: absolute; top: 50%; transform: translateY(-50%);
    padding: 16px; color: white; font-size: 30px; user-select: none;
}
.lightbox-prev { left: -60px; }
.lightbox-next { right: -60px; }

/* ======== RESPONSIVE (Móvil) ======== */
@media (max-width: 900px) {
    body { padding-top: 80px; }
    header { height: 80px; padding: 1rem 1.5rem; }
    .logo img { height: 50px; }
    
    .nav-menu {
        position: absolute; top: 100%; left: 0; width: 100%; background: #000;
        height: 0; overflow: hidden; transition: height 0.3s ease; flex-direction: column;
    }
    .nav-menu.active { height: auto; padding: 2rem 0; border-bottom: 1px solid #333; }
    .nav-menu ul { flex-direction: column; align-items: center; gap: 1.5rem; }
    .header-social { border-right: none; padding-right: 0; }
    .menu-toggle { display: block; margin-left: 1rem; }
    
    /* Mantenemos altura reducida solo para móvil */
    .hero-boxed { padding: 0 1rem; height: 85vh; min-height: auto; }
    
    .about-container { flex-direction: column; }
    .links-contacto { flex-direction: column; }
    .lightbox-prev { left: 10px; background: rgba(0,0,0,0.5); }
    .lightbox-next { right: 10px; background: rgba(0,0,0,0.5); }
}