/* ==========================================================================
   1. VARIABLES Y CONFIGURACIÓN INICIAL
   ========================================================================== */
:root {
    --bg-color: #0f0f0f;
    --text-color: #ffffff;
    --tracking: -0.04em; 
    
    --font-inconsolata: 'Inconsolata', monospace;
    --font-helvetica: 'Helvetica Neue', Helvetica, Arial, sans-serif;
    --font-denton: 'Denton Variable', serif; 
}

@font-face {
    font-family: 'Denton Variable';
    src: url('fonts/DentonXCondensedTest-LightItalic.otf') format('opentype'), local('DentonVariableTest-VF');
    font-weight: 100 900;
    font-style: italic;
    font-display: swap;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-color: var(--bg-color);
    background-image: radial-gradient(circle at 50% 120%, rgba(255,255,255,0.1) 0%, var(--bg-color) 60%);
    color: var(--text-color);
    min-height: 100vh;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    transition: background-color 0.8s ease, color 0.8s ease, background-image 0.8s ease;
}

body.theme-light {
    background-color: #fffffb;
    background-image: none;
    color: #0f0f0f;
}

body.theme-light .text-block, 
body.theme-light .item-meta,
body.theme-light .multimedia-title-group { /* Aseguramos que el texto oscuro se aplique al título de multimedia */
    color: #555555;
}

body.theme-light .scroll-arrow {
    stroke: #0f0f0f;
}

/* ==========================================================================
   2. TIPOGRAFÍA COMPARTIDA
   ========================================================================== */
.font-inconsolata {
    font-family: var(--font-inconsolata);
    letter-spacing: var(--tracking);
    font-size: 0.85rem;
    text-transform: uppercase;
}

.font-helvetica {
    font-family: var(--font-helvetica);
    letter-spacing: var(--tracking);
    font-weight: 300;
}

.font-denton {
    font-family: var(--font-denton);
    letter-spacing: var(--tracking);
    font-style: italic;
    transform: skewX(-6deg);
    display: inline-block; 
}

/* ==========================================================================
   3. LAYOUT PRINCIPAL (HERO Y NAVEGACIÓN)
   ========================================================================== */
header {
    position: fixed; 
    top: 0;
    left: 0;
    width: 100%;
    z-index: 100;
    display: flex;
    justify-content: space-between;
    padding: 2rem 4rem;
    transition: color 0.8s ease;
}

.hero-section {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4rem;
    padding: 8rem 4rem 4rem 4rem;
    max-width: 1800px;
    margin: 0 auto;
    min-height: 100vh;
}

.left-col {
    display: flex;
    flex-direction: column;
    gap: 4rem;
}

.main-title {
    font-size: 8rem;
    line-height: 1;
    margin-left: -0.5rem; 
}

.text-block {
    font-size: 1.2rem;
    line-height: 1.4;
    max-width: 400px;
    color: #d1d1d1;
    text-align: justify;
    hyphens: auto; /* Mejora la justificación al permitir la división de palabras */
    transition: color 0.8s ease;
}

.profile-section {
    display: flex;
    align-items: flex-end;
    gap: 1rem;
    margin-top: 2rem;
}

.right-col {
    display: flex;
    flex-direction: column;
}

.section-title {
    font-size: 6rem;
    text-align: right;
    margin-bottom: 4rem;
}

.portfolio-grid {
    display: flex;
    gap: 1.5rem;
    align-items: flex-start;
}

.portfolio-item {
    flex: 1;
    max-width: 170px;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.item-meta {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    color: #a0a0a0;
    transition: color 0.8s ease;
}

/* ==========================================================================
   4. APARTADO: 01 CAPSULE (SCATTERED)
   ========================================================================== */
.project-section {
    width: 100%;
    display: flex;
    flex-direction: column;
}

.scattered-gallery {
    position: relative;
    width: 100%;
    height: 130vh; 
    min-height: 900px; 
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
}

.scattered-item .img-placeholder img {
    /* Para la galería scattered, las imágenes no deben ser recortadas, sino contenidas. */
    object-fit: contain;
}

.center-title-group {
    position: relative;
    z-index: 50; 
    pointer-events: none; 
    display: flex;
    flex-direction: column;
    width: max-content; 
}

.project-title {
    font-size: 8rem;
    line-height: 1;
    text-align: center;
}

.project-subtitle {
    margin-top: 0.8rem;
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 0.1rem; 
}

.project-subtitle span {
    font-size: 1rem;
    line-height: 1.2;
    text-align: justify;
    text-align-last: justify; 
    width: 100%;
    display: block;
}

.scattered-item {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.3);
    opacity: 0;
    z-index: 5; 
}

.justified-block {
    margin-top: 0.6rem;
    font-size: 0.75rem;
    line-height: 1.2;
    text-align: justify;
    text-align-last: justify; 
    width: 100%;
}

/* ==========================================================================
   5. GALERÍA ESTÁTICA (GRID DE 4 COLUMNAS)
   ========================================================================== */
.static-gallery {
    width: 100%;
    max-width: 1800px; 
    margin: 0 auto;
    padding: 6rem 4rem;
    
    display: grid;
    grid-template-columns: repeat(4, 1fr); 
    gap: 2rem; 
}

.static-item {
    width: 100%;
    display: flex;
    flex-direction: column;
}

.static-item img {
    width: 100%;
    height: auto;
    aspect-ratio: 3 / 4; 
    object-fit: cover;   
    display: block;
    transition: transform 0.5s ease;
}

.static-item img:hover {
    transform: scale(1.02);
}

/* GALERÍA DE FILAS INDIVIDUALES */
.full-width-gallery {
    width: 100%;
    max-width: 1800px; 
    margin: 0 auto;
    padding: 0 0 8rem 0; 
    display: flex;
    flex-direction: column;
    gap: 6rem; 
}

.row-item {
    width: 100%;
    display: flex;
    justify-content: center;
}

.row-item img {
    width: 100%;      
    height: auto;     
    max-height: 95vh; 
    object-fit: contain; 
    display: block;
}

@media (max-width: 1024px) {
    .full-width-gallery {
        padding: 0 0 4rem 0;
        gap: 3rem;
    }
}

@media (max-width: 1200px) {
    .static-gallery {
        grid-template-columns: repeat(2, 1fr); 
    }
}

@media (max-width: 600px) {
    .static-gallery {
        grid-template-columns: 1fr; 
        padding: 2rem;
    }
}

/* ==========================================================================
   6. COMPONENTES COMUNES (PLACEHOLDERS, IMGS)
   ========================================================================== */
.black-placeholder { background-color: #000000; width: 100%; height: 100%; }
.white-placeholder { background-color: #fcfcfc; width: 100%; height: 100%; }

.img-placeholder {
    background-color: var(--bg-color);
    width: 100%;
    position: relative;
    overflow: hidden;
}

.img-placeholder img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.profile-img { width: 150px; height: 150px; }
.portfolio-img { aspect-ratio: 2 / 3; }

.scroll-arrow {
    align-self: flex-end;
    margin-top: auto;
    width: 80px;
    height: 80px;
    stroke: #ffffff;
    stroke-width: 2;
    fill: none;
    transition: stroke 0.8s ease;
}

/* ==========================================================================
   7. SECCIÓN 02 | PAM23
   ========================================================================== */
.fade-to-black {
    width: 100%;
    height: 40vh; 
    background: linear-gradient(to bottom, #fffffb 0%, #0f0f0f 100%);
    position: relative;
    z-index: 10;
}

#pam23-section {
    background-color: var(--bg-color); 
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center; 
    padding-bottom: 8rem;
}

.pam23-title-group {
    margin: 4rem 0;
}

.pam-grid-natural {
    width: 100%;
    max-width: 1600px; 
    padding: 0 4rem;
}

.pam-item-natural img {
    width: 100%;
    height: auto;
    max-height: 85vh;
    object-fit: contain;
    display: block;
}

.force-white, .force-white span { color: #ffffff !important; }


/* ==========================================================================
   8. SECCIÓN 03 | MULTIMEDIA (NUEVO)
   ========================================================================== */

/* Transición desde el negro de PAM al blanco de Multimedia */
.fade-to-white {
    width: 100%;
    height: 40vh; 
    background: linear-gradient(to bottom, #0f0f0f 0%, #fffffb 100%);
    position: relative;
    z-index: 10;
}

#multimedia-section {
    background-color: #fffffb; 
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center; 
    padding-bottom: 8rem;
}

.multimedia-title-group {
    margin: 4rem 0 6rem 0; 
    color: #0f0f0f; /* Título oscuro para fondo claro */
}

/* El título es un poco largo, por lo que reducimos la fuente un poco en pantallas normales */
#multimedia-section .project-title {
    font-size: 4rem;
}

/* Hacemos el subtítulo un poco más pequeño para que la justificación se vea mejor en un contenedor más estrecho */
.multimedia-title-group .project-subtitle span {
    font-size: 0.85rem;
}

.video-container {
    width: 100%;
    max-width: 1600px; 
    padding: 0 4rem;
    display: flex;
    justify-content: center;
}

/* Estilos para el reproductor de vídeo */
.video-container video {
    max-width: 100%; /* Reemplaza a width: 100% para mantener la proporción del vídeo y evitar franjas. */
    height: auto;
    max-height: 85vh; /* Evita que el vídeo sea más grande que la altura de la pantalla */
    background-color: #000; /* Fondo negro por si el vídeo tiene otra proporción antes de reproducirse */
    box-shadow: 0px 20px 40px rgba(0, 0, 0, 0.1); /* Sutil sombra de elegancia al estar en fondo claro */
    display: block;
}



/* ==========================================================================
   SECCIÓN: CONTACTO
   ========================================================================== */
#contact-section {
    background-color: var(--bg-color); /* Asegura el fondo oscuro */
    color: var(--text-color); /* Asegura el texto claro por defecto en esta sección */
    min-height: 100vh;
    padding: 8rem 4rem;
    display: flex;
    justify-content: center;
}

.contact-container {
    width: 100%;
    max-width: 1600px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.contact-header {
    display: flex;
    align-items: flex-end;
    gap: 2rem;
    margin-bottom: 8rem;
}

.contact-header h2 {
    font-size: 6rem;
    line-height: 1;
    margin: 0;
    font-weight: 100;
}

.contact-header svg {
    width: 50px;
    height: 50px;
    stroke: #ffffff;
    stroke-width: 1.5;
    fill: none;
    margin-bottom: 0.5rem; /* Alinea visualmente la flecha con el texto */
}

.contact-content {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    width: 100%;
}

.contact-info {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.contact-row {
    display: grid;
    grid-template-columns: 250px 1fr;
    font-size: 1.2rem;
    letter-spacing: 0.02em;
}

.contact-label { color: #fffffb; }
.contact-value { color: #fffffb; }

.contact-visual {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.contact-image-placeholder {
    width: 180px; 
    height: 240px;
    background-color: #4a2a27; /* Fondo granate del boceto */
    overflow: hidden;
}

.contact-image-placeholder img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.thanks-text {
    font-size: 2.2rem;
    letter-spacing: 0.02em;
}

/* ==========================================================================
   9. ANIMACIONES
   ========================================================================== */
.fade-up {
    opacity: 0;
    transform: translateY(30px);
    animation: fadeUpAnim 1s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes fadeUpAnim {
    to { opacity: 1; transform: translateY(0); }
}

.delay-1 { animation-delay: 0.1s; }
.delay-2 { animation-delay: 0.3s; }
.delay-3 { animation-delay: 0.5s; }
.delay-4 { animation-delay: 0.7s; }

.scattered-gallery.in-view .scattered-item {
    animation: flyOutFromCenter 1.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes flyOutFromCenter {
    to {
        top: var(--t-top);
        left: var(--t-left);
        transform: translate(-50%, -50%) scale(1);
        opacity: 1;
    }
}

.delay-s-1 { animation-delay: 0.1s; }
.delay-s-2 { animation-delay: 0.25s; }
.delay-s-3 { animation-delay: 0.4s; }
.delay-s-4 { animation-delay: 0.55s; }
.delay-s-5 { animation-delay: 0.7s; }
.delay-s-6 { animation-delay: 0.85s; }

.reveal-on-scroll {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 1s cubic-bezier(0.16, 1, 0.3, 1), transform 1s cubic-bezier(0.16, 1, 0.3, 1);
    transition-delay: var(--delay, 0s);
}

.reveal-on-scroll.in-view {
    opacity: 1;
    transform: translateY(0);
}

/* ==========================================================================
   10. RESPONSIVE
   ========================================================================== */
@media (max-width: 1024px) {
    header { padding: 1.5rem 2rem; }
    .hero-section { grid-template-columns: 1fr; padding: 6rem 2rem 2rem 2rem; }
    .main-title { font-size: 5rem; }
    .section-title { font-size: 4rem; text-align: left; }
    
    .portfolio-grid { flex-wrap: wrap; justify-content: space-between; }
    .portfolio-item { flex: 0 0 48%; max-width: none; }

    .project-title { font-size: 4rem; }
    #multimedia-section .project-title { font-size: 2rem; } /* Ajuste del título largo en móvil */

    .scattered-gallery { height: auto; min-height: 100vh; flex-direction: column; padding: 4rem 2rem; }
    .scattered-item { position: relative; top: auto !important; left: auto !important; transform: none !important; width: 100% !important; margin: 0 auto; opacity: 1; }
    
    .static-gallery { padding: 2rem; gap: 4rem; }
    .pam-grid-natural, .video-container { padding: 0 2rem; }
}



/* --- AJUSTES RESPONSIVE PARA CONTACTO --- */
@media (max-width: 1024px) {
    #contact-section { padding: 4rem 2rem; }
    .contact-header h2 { font-size: 4rem; }
    .contact-content { flex-direction: column; align-items: flex-start; gap: 4rem; }
    .contact-row { grid-template-columns: 200px 1fr; }
    .contact-visual { align-self: flex-start; }
}

@media (max-width: 600px) {
    .contact-row { grid-template-columns: 1fr; gap: 0.2rem; margin-bottom: 1rem; }
}