/* ==========================================================================
   0. VARIABLES — cambia aquí los valores globales
   ========================================================================== */
:root {
    --bg: #eeeeee;            /* Fondo (antes #f6f6f6; versión negra: #000000) */
    --text: #777777;          /* Texto y líneas gris claro (antes #666666 / #555555) */
    --fs: 1rem;               /* 16px — tamaño del texto (antes 14px) */
    --lh: 1.2;                /* Interlineado de todo el texto (antes 1.4) */
    --header-ink: #ffffff;    /* Color del header antes del efecto diferencia (blanco = máximo contraste) */
    --surface: #e6e6e6;       /* Botones y fondo mientras cargan imágenes (antes #d6d6d6) */

    --gap: 0.1875rem;         /* 3px — gap entre columnas (antes 5px, y al principio 10px) */
    --gap-mobile: 0.15rem;    /* 2.4px — galería en móvil (antes 4px) */

    --radius: 0.75rem;        /* 12px — imágenes y vídeos (antes 6px) */
    --radius-hero: 1.25rem;   /* 20px — vídeo principal (antes 10px) */

    --font: 'Times New Roman', Times, serif; /* Tipografía principal (para volver a Eiko: 'Eiko', serif) */
    --font-footer: 'Eiko', serif; /* Tipografía del PJM gigante del footer */
    --card-ratio: 3 / 3.8;    /* Proporción de las tarjetas de la portada (vertical) */
}

/* ==========================================================================
   1. FUENTES Y RESET GENERAL
   ========================================================================== */
@font-face {
    font-family: 'Eiko';
    src: url('../img/fonts/PP Eiko/PPEiko-Regular.woff2') format('woff2');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

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

body {
    font-family: var(--font);
    font-weight: 400; 
    background-color: var(--bg);
    color: var(--text);
    line-height: var(--lh);
    padding: 0 0.625rem 1.25rem 0.625rem; 
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

/* Scroll suave con Lenis */
html.lenis, html.lenis body { height: auto; }
.lenis-smooth { scroll-behavior: auto !important; }
.lenis-smooth [data-lenis-prevent] { overscroll-behavior: contain; }

/* Enlaces limpios */
a, a:visited { color: var(--text); text-decoration: none; }
a.logo { color: var(--text); text-decoration: none; }

/* ==========================================================================
   2. CABECERA (HEADER)
   ========================================================================== */
.main-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.625rem 0 1.25rem 0;
}

.logo {
    font-family: var(--font);
    font-size: var(--fs);      /* Mismo tamaño que los enlaces del menú */
    line-height: var(--lh);
}

.nav-links a {
    font-size: var(--fs);
    color: var(--text);
    margin-left: clamp(1.5rem, 3vw, 3rem);
}

.nav-links a:hover { text-decoration: underline; text-underline-offset: 0.2em; }

/* ==========================================================================
   2b. CABECERA DE LA HOME (fija) E INTRO
   ========================================================================== */
.home-header {
    position: sticky;
    top: 0;
    z-index: 50;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin: 0 -0.625rem;              /* ocupa todo el ancho al fijarse */
    padding: 0.625rem;
    background: transparent;
    color: var(--header-ink);
    mix-blend-mode: difference;       /* El texto se invierte sobre las imágenes */
    font-size: var(--fs);
    line-height: var(--lh);
}

.home-header a, .home-header a:visited { color: var(--header-ink); }

.hh-meta {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    min-width: 0;
}

.hh-meta p { margin: 0; }
.hh-meta .sep { margin: 0 0.15em; }

.hh-nav {
    display: flex;
    gap: var(--gap);
    flex-shrink: 0;
}

/* Botones redondos */
.pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 3.5rem;
    height: 1.75rem;
    padding: 0 1rem;
    border-radius: 999px;
    /* Con el efecto diferencia, #101010 se ve como el gris #e6e6e6 sobre el fondo */
    background-color: #101010;
    color: var(--header-ink);
    font-size: 0.875em;
    line-height: 1;
    transition: background-color 0.25s, color 0.25s;
}

.pill:hover { background-color: var(--header-ink); color: #101010; }
/* Mayor prioridad que los enlaces visitados, para que el texto del botón no desaparezca */
.home-header .pill:hover, .home-header .pill:hover:visited,
.g-head .pill:hover, .g-head .pill:hover:visited { color: #101010; }

/* Números de ancho fijo: la hora y la cuenta atrás no bailan */
.clock, [data-birthday] { font-variant-numeric: tabular-nums; }

.home-intro {
    margin: 0.5rem 0 4rem;
    font-size: var(--fs);
    line-height: var(--lh);
}

.hh-desc { margin-bottom: 0.75rem; max-width: 60em; }

.hh-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: var(--gap);
    align-items: start;
}

/* ==========================================================================
   3. HERO / BLOQUE PRINCIPAL & INTRO
   ========================================================================== */
.hero-section {
    margin-top: 0.625rem;
    margin-bottom: 0;
    width: 100%;
}

.hero-video {
    width: 100%;
    aspect-ratio: 1492 / 949; 
    object-fit: cover;
    border-radius: var(--radius-hero);
    background-color: var(--surface);
    display: block;
}

.intro-section {
    margin-top: 0;
    margin-bottom: 10rem;
}

.main-title {
    font-family: var(--font);
    font-weight: 400; 
    font-size: clamp(3.438rem, 8.5vw, 7.5rem); 
    letter-spacing: -0.04em;
    line-height: 0.916; 
    margin-top: 1.25rem;
}

.image-placeholder {
    width: 100%;
    background-color: var(--surface); /* Color gris neutro */
    border-radius: var(--radius);       /* Mismo borde redondeado de tu galería */
    
    /* Si quieres que sea vertical por defecto (3:4) */
    aspect-ratio: 3 / 4;
}

/* Opcional: si quieres forzarlo a cuadrado cuando lo necesites */
.image-placeholder.ratio-square {
    aspect-ratio: 1 / 1;
}

/* ==========================================================================
   4. CABECERAS DE SECCIÓN GLOBALES
   ========================================================================== */
.global-section { width: 100%; }

.grid-section-header {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: var(--gap);
    font-size: var(--fs);
    color: var(--text);
    margin-bottom: 1.5rem;
}

.grid-section-header > div {
    border-top: 1px solid var(--text);
    padding-top: 0.5rem;
}

/* ==========================================================================
   5. GRID DE PROYECTOS (PORTADA INDEX)
   ========================================================================== */
.projects-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 2.5rem var(--gap); 
    margin-bottom: 12.5rem;
}

.project-card {
    display: flex;
    flex-direction: column;
}

.image-container {
    width: 100%;
    aspect-ratio: var(--card-ratio);
    overflow: hidden;        /* Recorta el contenido que sobresale */
    border-radius: var(--radius);
    position: relative;
    background-color: var(--surface);
}

.project-link.is-soon { cursor: default; }   /* proyectos "Coming soon": no se pueden clicar */

.blur-cover {
    filter: blur(4px); /* Cambia este número para más o menos borroso */
    transform: scale(1.05); /* Evita que los bordes del blur se vean transparentes */
    transition: filter 0.3s ease;
}

.image-container img,
.image-container video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}


.project-info {
    margin-top: 1rem;
    display: flex;
    align-items: flex-start;
    width: 100%;
}

.proj-num {
    font-size: var(--fs); 
    line-height: var(--lh);
    padding-right: 0.5rem;
}

.project-info-line {
    flex-grow: 1;
    border-top: 1px solid var(--text);
    margin-top: 0.6rem;         
}

.proj-details {
    display: flex;
    flex-direction: column;
    width: 72%;
    padding-left: 0.5rem;
}

.proj-details p {
    font-size: var(--fs); 
    line-height: var(--lh);
}

/* ==========================================================================
   6. FICHA TÉCNICA DEL PROYECTO
   ========================================================================== */
.project-subtitle {
    font-size: var(--fs);
    margin-top: 1.5rem;
    margin-bottom: 2.5rem;
}

.project-header-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: var(--gap);
    margin-bottom: 5rem;
}

.header-col {
    /* Sin línea superior en la ficha del proyecto */
    font-size: var(--fs);
    line-height: var(--lh);
}

.description-col {
    grid-column: 1 / span 2;
    padding-right: 2rem;
}

/* Créditos con el mismo ritmo de filas que la ficha */
.credits-col {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.meta-col {
    display: flex;
    flex-direction: column;
    gap: 0;
}

/* Cada fila: "Etiqueta: dato", todo seguido y alineado a la izquierda */
.meta-row {
    display: block;
    width: 100%;
}

.meta-row span:first-child::after { content: ': '; }

.meta-row span:last-child { word-break: break-word; }

/* ==========================================================================
   7. GALERÍA DE IMÁGENES DEL PROYECTO (FORMATO FLEXIBLE)
   ========================================================================== */
.project-gallery {
    margin-bottom: 8rem;
}

.gallery-row {
    margin-bottom: var(--gap); 
}

.project-gallery img,
.project-gallery video {
    display: block;
    width: 100%;
    border-radius: var(--radius);
    overflow: hidden;
}

/* Fila de 2 columnas flexible */
.gallery-row.grid-2-col,
.grid-2-col {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--gap);
    margin-bottom: var(--gap);
}

/* Por defecto mantienen su alto proporcional */
.grid-2-col img,
.grid-2-col video {
    width: 100%;
    height: auto;
    object-fit: cover;
}

/* Clases opcionales para forzar aspectos concretos cuando lo necesites */
.ratio-portrait {
    aspect-ratio: 3 / 4 !important;
}

.ratio-square {
    aspect-ratio: 1 / 1 !important;
}

/* --- ANIMACIÓN REVELADO CON SCROLL --- */
.gallery-row img,
.gallery-row video {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 1.2s cubic-bezier(0.16, 1, 0.3, 1), 
                transform 1.2s cubic-bezier(0.16, 1, 0.3, 1);
    will-change: opacity, transform;
}

.gallery-row img.is-visible,
.gallery-row video.is-visible {
    opacity: 1;
    transform: translateY(0);
}

/* ==========================================================================
   8. NAVEGACIÓN PROYECTOS (NEXT / BEFORE)
   ========================================================================== */
.project-nav-section { margin-bottom: 10rem; }

.project-nav-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: var(--gap);
}

.nav-project-card:first-child { grid-column: 1; }
.nav-project-card:last-child { grid-column: 4; }

.nav-project-card {
    display: flex;
    flex-direction: column;
}

.nav-card-header {
    border-top: 1px solid var(--text);
    padding-top: 0.5rem;
    font-size: var(--fs);
    margin-bottom: 0.75rem;
}

.nav-card-info {
    display: flex;
    margin-top: 0.75rem;
    font-size: var(--fs);
    line-height: var(--lh);
}

.nav-card-info .proj-num { padding-right: 1.5rem; }

/* ==========================================================================
   9. FOOTER
   ========================================================================== */
.giant-footer-brand {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: var(--gap);
    font-size: clamp(7.5rem, 34vw, 31.25rem); 
    line-height: 0.72;
    letter-spacing: -0.05em;
    font-family: var(--font-footer);
    margin-bottom: calc(2.5rem + 0.22em); /* deja sitio a la J de Eiko, que baja de la línea */
    pointer-events: none;
}

.giant-p { grid-column: 1; }
.giant-jm { grid-column: 3 / span 2; }

.footer-content-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: var(--gap);
}

.footer-col {
    display: flex;
    flex-direction: column;
    font-size: var(--fs);
    line-height: var(--lh);
}

.col-rights {
    margin-top: 2rem;
}

.footer-col a:hover { text-decoration: underline; text-underline-offset: 0.2em; }
.muted { color: var(--text); } /* Mismo gris que el resto, sin transparencia */

/* ==========================================================================
   10. ADAPTACIÓN PARA MÓVIL
   ========================================================================== */
@media (max-width: 768px) {
    /* Móvil: botones arriba, información debajo */
    .home-header { flex-wrap: wrap; row-gap: 0.5rem; }
    .hh-meta { display: contents; }
    .hh-meta p { order: 3; flex-basis: 100%; }
    .hh-meta p > .sep:first-child { display: none; }
    .hh-nav { margin-left: auto; }
    .hh-grid { grid-template-columns: 1fr 1fr; row-gap: 1.25rem; }

    .main-header { padding: 1.5rem 0; }
    .projects-grid { grid-template-columns: 1fr; }

    .project-header-grid {
        grid-template-columns: 1fr;
        gap: 2rem;
        margin-bottom: 3rem;
    }

    .description-col {
        grid-column: 1 / -1;
        padding-right: 0;
        font-size: 1rem;
    }

    .gallery-row.grid-2-col,
    .grid-2-col {
        grid-template-columns: 1fr;
        gap: var(--gap-mobile);
    }

    .project-nav-grid {
        grid-template-columns: 1fr;
        gap: 3rem;
    }

    .nav-project-card:first-child,
    .nav-project-card:last-child {
        grid-column: 1;
    }

    .grid-section-header { display: block !important; }
    .grid-section-header div:not(:first-child) { display: none !important; }
    .grid-section-header div:first-child {
        width: 100% !important;
        border-top: 1px solid var(--text) !important;
        padding-top: 0.5rem !important;
    }

    .giant-footer-brand {
        display: flex !important;
        justify-content: space-between !important;
        width: 100% !important;
        font-size: 35vw !important;
        line-height: 0.72 !important;
        margin: 0.5rem 0 calc(1.5rem + 0.22em) 0 !important;
    }

    .giant-p, .giant-jm {
        grid-column: auto !important;
        display: flex !important;
    }

    /* Footer en móvil: dos columnas */
    .footer-content-grid {
        display: grid !important;
        grid-template-columns: 1fr 1fr !important;
        gap: 1.5rem var(--gap) !important;
    }

    .footer-content-grid > div:nth-child(2) { display: none !important; }

    .footer-col {
        width: 100% !important;
    }
}
/* ==========================================================================
   11. ABOUT (overlay del botón ¶)
   ========================================================================== */
:root {
    --about-blur: 28px;                  /* intensidad del desenfoque */
    --about-tint: rgba(0, 0, 0, 0.08);   /* oscurecimiento del fondo (0 = nada) */
    --about-top: 13.5rem;                /* altura a la que empieza el texto (en la portada se ajusta a las tarjetas) */
}

button.pill { border: 0; font-family: var(--font); cursor: pointer; }

/* El botón ¶ se queda relleno y muestra ✕ mientras el About está abierto */
body.about-open .home-header [data-about-open],
body.about-open .home-header [data-about-open]:visited { background-color: var(--header-ink); color: #101010; }

/* Capa 1: desenfoque de la web (sigue haciendo scroll por debajo) */
.about-blur {
    position: fixed;
    inset: 0;
    z-index: 44;
    background-color: var(--about-tint);
    -webkit-backdrop-filter: blur(var(--about-blur));
    backdrop-filter: blur(var(--about-blur));
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.6s ease, visibility 0s linear 0.6s;
}

/* Capa 2: texto con efecto diferencia, en la misma rejilla de 4 columnas que la web */
.about-overlay {
    position: fixed;
    inset: 0;
    z-index: 45;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: min(var(--about-top), 21vh) 0.625rem 0;   /* nunca tan abajo que no quepa */
    color: var(--header-ink);
    mix-blend-mode: difference;
    font-size: var(--fs);
    line-height: var(--lh);
    pointer-events: none;                /* el scroll y los clics pasan a la capa de atrás */
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.6s ease, visibility 0s linear 0.6s;
}

body.about-open .about-blur,
body.about-open .about-overlay {
    opacity: 1;
    visibility: visible;
    transition: opacity 0.6s ease;
}

.about-overlay a { pointer-events: auto; }
.about-overlay a, .about-overlay a:visited { color: var(--header-ink); }
.about-overlay a:hover { text-decoration: underline; text-underline-offset: 0.2em; }

.ab-content {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    column-gap: var(--gap);
    align-items: start;
    transform: translateY(1rem);
    transition: transform 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

body.about-open .ab-content { transform: translateY(0); }

/* Todo en la misma línea: About me (columnas 1-2) · Experience (3) · Contact (4) */
.ab-about { grid-column: 1 / span 2; padding-right: 2rem; }
.ab-side { display: contents; }
.ab-exp { grid-column: 3; }
.ab-contact { grid-column: 4; }

.ab-title { margin-bottom: clamp(0.5rem, 2.2vh, 1.5rem); }
.ab-job + .ab-job { margin-top: clamp(0.5rem, 2.2vh, 1.5rem); }

/* P y JM grandes: P a la izquierda y JM a la derecha */
.ab-brand {
    display: flex;
    justify-content: space-between;
    padding-bottom: calc(1rem + 0.22em);   /* sitio para la J de Eiko */
    font-family: var(--font-footer);
    font-size: min(12vw, 12vh);
    line-height: 0.72;
    letter-spacing: -0.05em;
}

@media (max-width: 768px) {
    .about-overlay { padding-top: calc(var(--header-h, 6rem) + 1rem); }
    .ab-content { grid-template-columns: 1fr 1fr; }
    .ab-about { grid-column: 1 / -1; padding-right: 0; }
    /* Experience y Contact en una sola columna, uno debajo del otro */
    .ab-side { grid-column: 1 / -1; margin-top: 1rem; display: flex; flex-direction: column; gap: 1.5rem; }
    .ab-exp, .ab-contact { grid-column: auto; margin-top: 0; }
    .ab-brand { padding-bottom: calc(0.5rem + 0.22em); font-size: min(30vw, 6.5vh); }
}

/* Pantallas de poca altura (portátiles pequeños): el About se compacta para caber */
@media (min-width: 769px) and (max-height: 760px) {
    .about-overlay { padding-top: min(var(--about-top), 17vh); }
    .ab-brand { font-size: min(12vw, 10vh); }
}

/* ==========================================================================
   12. SIN BARRA DE SCROLL (se sigue pudiendo hacer scroll con normalidad)
   ========================================================================== */
html, body { scrollbar-width: none; -ms-overflow-style: none; }   /* Firefox y Edge antiguo */
html::-webkit-scrollbar, body::-webkit-scrollbar { display: none; } /* Chrome y Safari */
