/* ==========================================================
   RESET
========================================================== */

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

html {
    scroll-behavior: auto;
}

body {
    font-family:
        'Outfit',
        Arial,
        Helvetica,
        sans-serif;

    overflow-x: hidden;
}


/* ==========================================================
   HEADER
========================================================== */

.header {
    width: 100%;
    height: 80px;

    display: flex;
    align-items: center;
    justify-content: space-between;

    padding: 0 4vw;

    background: #f1efe9;

    position: relative;
    z-index: 100;
}

.header-logo {
    font-size: 18px;
    font-weight: 600;

    letter-spacing: 0.08em;
}

.header-nav {
    display: flex;
    gap: 30px;
}

.header-nav a {
    color: #111;

    font-size: 14px;

    text-decoration: none;
}


/* ==========================================================
   INTRO
========================================================== */

.intro {
    min-height: 65vh;

    display: flex;
    align-items: flex-end;

    padding:
        0
        4vw
        8vh;

    background: var(--black);
    color: var(--white);
}

.intro h1 {
    font-size: clamp(
        70px,
        10vw,
        170px
    );

    font-weight: 400;

    line-height: 0.82;

    letter-spacing: -0.065em;
}

.intro em {
    font-family:
        'Old Standard TT',
        Georgia,
        serif;

    font-style: normal;
    font-weight: 700;
    color: #8a6a2a;
}


/* ==========================================================
   HISTORIA
========================================================== */

.history {
    /*
     * 5 fechas.
     *
     * Si añades fechas,
     * aumenta este valor.
     */

    height: 600vh;

    position: relative;
}


/* ==========================================================
   PANTALLA FIJA
========================================================== */

.history-sticky {
    position: sticky;

    top: 0;

    width: 100%;
    height: 100vh;

    overflow: hidden;

    background: var(--black);
    color: var(--white);
}


/* ==========================================================
   CAPAS
========================================================== */

.images-layer,
.dates-layer,
.texts-layer {
    position: absolute;

    inset: 0;

    width: 100%;
    height: 100%;
}


/* ==========================================================
   IMÁGENES
========================================================== */

.images-layer {
    z-index: 1;
}

.image-group {
    position: absolute;

    inset: 0;

    opacity: 0;

    pointer-events: none;

    transition:
        opacity 0.15s linear;
}

.image-group.active {
    opacity: 1;
}


.photo {
    position: absolute;

    object-fit: cover;

    display: block;

    will-change: transform, opacity;
}


/* ==========================================================
   POSICIONES GRUPO 1
========================================================== */

.image-group[data-index="0"] .photo-1 {
    width: 29vw;
    height: 41vh;

    min-width: 275px;

    left: 4vw;
    top: 6vh;
}

.image-group[data-index="0"] .photo-2 {
    width: 30vw;
    height: 45vh;

    min-width: 290px;

    right: 5vw;
    bottom: 6vh;
}


/* ==========================================================
   POSICIONES GRUPO 2
========================================================== */

.image-group[data-index="1"] .photo-3 {
    width: 23vw;
    height: 32vh;

    left: 5vw;
    top: 6vh;
}

.image-group[data-index="1"] .photo-4 {
    width: 24vw;
    height: 36vh;

    right: 6vw;
    top: 7vh;
}

.image-group[data-index="1"] .photo-5 {
    width: 26vw;
    height: 34vh;

    left: 10vw;
    bottom: 6vh;
}


/* ==========================================================
   POSICIONES GRUPO 3
========================================================== */

.image-group[data-index="2"] .photo-6 {
    width: 32vw;
    height: 50vh;

    left: 5vw;
    bottom: 5vh;
}

.image-group[data-index="2"] .photo-7 {
    width: 24vw;
    height: 35vh;

    right: 6vw;
    top: 6vh;
}


/* ==========================================================
   POSICIONES GRUPO 4
========================================================== */

.image-group[data-index="3"] .photo-8 {
    width: 23vw;
    height: 30vh;

    left: 4vw;
    top: 5vh;
}

.image-group[data-index="3"] .photo-9 {
    width: 27vw;
    height: 41vh;

    right: 5vw;
    top: 6vh;
}

.image-group[data-index="3"] .photo-10 {
    width: 21vw;
    height: 31vh;

    right: 15vw;
    bottom: 5vh;
}


/* ==========================================================
   POSICIONES GRUPO 5
========================================================== */

.image-group[data-index="4"] .photo-11 {
    width: 31vw;
    height: 47vh;

    left: 5vw;
    top: 7vh;
}

.image-group[data-index="4"] .photo-12 {
    width: 31vw;
    height: 47vh;

    right: 5vw;
    bottom: 8vh;
}


/* ==========================================================
   FECHA GIGANTE — odómetro por dígitos (scroll-driven)
========================================================== */

.dates-layer {
    z-index: 2;

    pointer-events: none;

    display: flex;
    align-items: center;
    justify-content: center;
}


.date {
    display: flex;
    align-items: center;

    font-weight: 400;
    letter-spacing: -0.02em;

    /* blancas siempre, con sombra para que se lean encima de cualquier foto */
    color: #ffffff;
    text-shadow: 0 6px 30px rgba(0, 0, 0, .55), 0 2px 10px rgba(0, 0, 0, .5);
}


/* Ventana visible de un dígito: solo deja ver 1 número */

.digit-window {
    overflow: hidden;

    height: 0.75em;

    font-size: clamp(
        140px,
        27vw,
        520px
    );

    line-height: 0.75;
}


/* Columna vertical con TODOS los dígitos de esa posición */

.digit-track {
    display: flex;
    flex-direction: column;

    will-change: transform;
}


.digit-track span {
    display: block;

    height: 0.75em;
    line-height: 0.75;

    text-align: center;
}


/* El punto — fijo, nunca se anima */

.date-dot {
    font-size: clamp(
        140px,
        27vw,
        520px
    );

    line-height: 0.75;

    margin: 0 0.02em;
}


/* ==========================================================
   TEXTOS
========================================================== */

.texts-layer {
    z-index: 3;

    pointer-events: none;
}

.history-text {
    position: absolute;

    left: 6vw;

    bottom: 8vh;

    width: min(
        520px,
        38vw
    );

    font-size: clamp(
        18px,
        1.65vw,
        30px
    );

    line-height: 1.2;

    opacity: 0;

    /* blanco siempre, con sombra para que se lea encima de cualquier foto */
    color: #ffffff;
    text-shadow: 0 2px 16px rgba(0, 0, 0, .6), 0 1px 4px rgba(0, 0, 0, .55);

    transform:
        translate(
            -15vw,
            100vh
        );

    will-change:
        transform,
        opacity;
}

.history-text strong {
    color: #d9b571;
    font-weight: 700;
}


.history-text.active {
    opacity: 1;

    transform:
        translate(
            0,
            0
        );
}


/* ==========================================================
   SECCIÓN FINAL
========================================================== */

.end-section {
    min-height: 100vh;

    display: flex;

    justify-content: center;
    align-items: center;

    padding: 5vw;
}

.end-section h2 {
    font-size: clamp(
        60px,
        10vw,
        170px
    );

    line-height: 0.9;

    letter-spacing: -0.06em;

    font-weight: 400;
}


/* ==========================================================
   TABLET
========================================================== */

@media (max-width: 900px) {

    .header-nav {
        display: none;
    }

    .intro {
        min-height: 50vh;
    }

    .history-text {
        width: 70vw;
    }

}


/* ==========================================================
   MOBILE
========================================================== */

@media (max-width: 600px) {

    .header {
        height: 65px;
    }


    .intro {
        min-height: 45vh;

        padding-bottom: 5vh;
    }


    .intro h1 {
        font-size: 17vw;
    }


    .digit-window,
    .date-dot {
        font-size: 29vw;
    }


    .history-text {
        left: 6vw;

        bottom: 7vh;

        width: 86vw;

        font-size: 18px;
    }


    /* Reducimos fotos en móvil */

    .image-group .photo {
        max-width: none;
    }


    .image-group[data-index="0"] .photo-1,
    .image-group[data-index="2"] .photo-6,
    .image-group[data-index="4"] .photo-11 {

        width: 38vw;
        height: 25vh;

        left: 4vw;
        top: 8vh;
    }


    .image-group[data-index="0"] .photo-2,
    .image-group[data-index="2"] .photo-7,
    .image-group[data-index="4"] .photo-12 {

        width: 37vw;
        height: 25vh;

        right: 4vw;
        bottom: 9vh;
    }


    .image-group[data-index="1"] .photo-3,
    .image-group[data-index="3"] .photo-8 {

        width: 35vw;
        height: 22vh;

        left: 4vw;
        top: 8vh;
    }


    .image-group[data-index="1"] .photo-4,
    .image-group[data-index="3"] .photo-9 {

        width: 35vw;
        height: 23vh;

        right: 4vw;
        top: 10vh;
    }


    .image-group[data-index="1"] .photo-5,
    .image-group[data-index="3"] .photo-10 {

        display: none;
    }

}