/* =========================================
   WORK.CSS
   ========================================= */

/* --- WORK HEADER --- */
.work-header {
    padding: 20vh 5vw 10vh;
    text-align: center;
}

.work-title {
    font-family: var(--font-raleway);
    font-size: clamp(4rem, 15vw, 12rem);
    line-height: 0.9;
    margin-bottom: 2rem;
    color: var(--white);
}

/* --- SHARED WORK-CHILD HEADERS (stills / animations / 360) --- */
:is(.stills-header, .animations-header, .gallery-header) {
    padding: 20vh 5vw 5vh;
    text-align: center;
}

:is(.stills-title, .animations-title, .gallery-title) {
    font-family: var(--font-raleway);
    font-size: clamp(3rem, 10vw, 8rem);
    line-height: 0.9;
    margin-bottom: 3rem;
    color: var(--white);
    text-transform: lowercase;
}

:is(.stills-subtitle, .animations-subtitle, .gallery-subtitle) {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    box-sizing: border-box;
    text-align: left;
}

:is(.stills-subtitle, .gallery-subtitle) {
    padding-left: clamp(160px, 15vw, 300px);
    max-width: 1200px;
    margin: 0 auto 8rem 0;
}

:is(.stills-subtitle, .animations-subtitle, .gallery-subtitle) h2 {
    font-family: var(--font-raleway, sans-serif);
    font-size: clamp(24px, 3vw, 38px);
    font-weight: 400;
    line-height: 1.3;
    margin: 0;
    opacity: 0;
    will-change: transform, opacity;
}

:is(.stills-subtitle, .gallery-subtitle) h2 {
    color: var(--white);
}

.animations-subtitle h2 {
    color: var(--text);
}

:is(.stills-subtitle, .animations-subtitle, .gallery-subtitle) p {
    font-size: clamp(20px, 2.5vw, 32px);
    color: var(--accent);
    font-weight: 300;
    line-height: 1.4;
    margin: 0;
    opacity: 0;
    will-change: transform, opacity;
}

.section-work {
    padding-left: clamp(160px, 15vw, 300px);
    box-sizing: border-box;
}

.work-subtitle {
    padding-left: clamp(160px, 15vw, 300px);
}

.work-subtitle {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    padding-left: clamp(160px, 15vw, 300px);
    box-sizing: border-box;
    max-width: 1000px;
    margin: 0 auto 8rem 0;
}

.work-subtitle-line-1,
.work-subtitle-line-2 {
    display: block;
    font-size: clamp(36px, 5vw, 64px);
    color: var(--gray-1);
    font-weight: 300;
    opacity: 0;
    will-change: transform;
}

.work-title {
    opacity: 0;
}

.work-subtitle-line-1 {
    text-align: left;
    padding-right: 0;
}

.work-subtitle-line-2 {
    text-align: right;
    padding-right: 5%;
    font-weight: 500;
}

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

/* --- WORK GRID --- */
.section-work {
    padding-right: 5vw;
    padding-bottom: 20vh;
    padding-top: 0;
    opacity: 0;
}

.all-work-title {
    position: relative;
    z-index: 10;
    text-align: center;
    margin-bottom: 5vh;
    font-size: clamp(2rem, 4vw, 3.5rem);
    font-weight: 400;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--text);
    clear: both;
    width: calc(100% * 8 / 12);
}

.work-grid {
    display: flex;
    flex-direction: column;
    gap: 20vh;
}

.work-item {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    align-items: center;
    text-decoration: none;
    color: inherit;
}

.work-item:hover {
    opacity: 1;
}

.work-mask {
    grid-column: 1 / 9;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    clip-path: inset(0);
    background: #1a1c1e;
    transition: clip-path 0.1s linear;
    border-radius: 12px;
}

.work-item.alt .work-mask {
    grid-column: 5 / 13;
}

.work-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.6s ease-out;
}

.work-item:hover .work-img {
    transform: scale(1.05);
}

.work-info {
    grid-column: 10 / 13;
    padding-left: 3rem;
}

.work-item.alt .work-info {
    grid-column: 1 / 4;
    grid-row: 1;
    padding-left: 0;
    padding-right: 3rem;
    text-align: right;
}

.work-info h3 {
    font-family: var(--font-sans);
    font-size: clamp(2.5rem, 4vw, 3.5rem);
    font-weight: 400;
    margin-bottom: 0.8rem;
}

.work-info span {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.2em;
    color: var(--accent);
    font-weight: 500;
    display: block;
    margin-bottom: 0.5rem;
}

/* =========================================
   PORTFOLIO GALLERY
   ========================================= */

.gallery-container {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    width: min(1600px, 100%);
    margin: 0 auto;
    box-sizing: border-box;
    position: relative;
    gap: 32px;
}

.large-images {
    width: calc(100% - 180px);
    min-width: 0;
    position: relative;
    container-type: inline-size;
}

.large-image {
    background-size: cover;
    background-position: center;
    box-shadow: 0 -15px 40px rgba(0, 0, 0, 0.8);
    border-radius: 12px;
    transform: translateX(var(--offset, 0%));
}

.horizon-card .horizon-img {
    box-shadow: 0 -5px 10px rgba(0, 0, 0, 0.8);
}

/* Horizontal section */
.horizontal-scroll-container {
    width: 100%;
    height: 100vh;
    display: flex;
    align-items: center;
    overflow: hidden;
}

.horizontal-scroll-content {
    display: flex;
    flex-wrap: nowrap;
    width: max-content;
    height: 100%;
    align-items: center;
    gap: 40px;
    /* Consistent gap between images */
}

.horizon {
    position: relative;
    width: 100cqw;
    /* = ancho de .large-images, referencia estable para el scroll */
    height: calc(100vh - 40px);
    margin: 20px 0;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border-radius: 0;
    box-shadow: none;
}

.horizon-img {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 12px;
    box-shadow: 0 -5px 10px rgba(0, 0, 0, 0.8);
    display: block;
}

/* Vertical section */
.vertical-scroll-container {
    padding-top: 5vh;
    padding-bottom: 20vh;
}

.large-image.vertical {
    height: calc(100vh - 20px);
    width: 90cqw;
    position: sticky;
    top: 10px;
    margin: 10px 0;
    /* contenedor invisible: la img lleva el estilo */
    background: transparent !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    display: flex;
    align-items: center;
    justify-content: center;
}

.vertical-img {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
    display: block;
    border-radius: 12px;
    box-shadow: 0 -15px 40px rgba(0, 0, 0, 0.8);
}

.minimap {
    flex: 0 0 120px;
    align-self: auto;
    width: 120px;
    height: 100vh;
    min-height: 100vh;
    position: sticky;
    top: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background: transparent;
}

.minimap-label {
    color: #fff;
    mix-blend-mode: difference;
    opacity: 0.6;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    position: relative;
    left: var(--minimap-offset, 0px);
    margin-top: clamp(8px, 1.4vh, 25px);
    margin-bottom: clamp(10px, 1.8vh, 30px);
    z-index: 2;
    transform: scale(0.7) translateX(18px);
    transition: all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    cursor: pointer;
    text-align: center;
    pointer-events: auto;
    font-weight: 500;
}

.minimap-label:hover {
    opacity: 0.85;
    transform: scale(0.9) translateX(0px);
}

.minimap-children {
    position: relative;
    left: var(--minimap-offset, 0px);
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    margin-top: -0.15rem;
    margin-bottom: clamp(10px, 1.8vh, 30px);
}

.minimap-child-link {
    color: #fff;
    text-decoration: none;
    mix-blend-mode: difference;
    opacity: 0.5;
    font-size: 0.76rem;
    font-weight: 500;
    letter-spacing: 0.09em;
    text-transform: capitalize;
    transform: scale(0.7) translateX(18px);
    transition: all 0.35s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    cursor: pointer;
}

.minimap-child-link:hover {
    opacity: 0.82;
    transform: scale(0.9) translateX(0px);
}

.thumb {
    width: 90px;
    height: auto;
    cursor: pointer;
    opacity: 0.6;
    transform: scale(0.7) translateX(18px);
    transition: all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    border-radius: 6px;
    overflow: hidden;
    position: relative;
    left: var(--offset, 0);
    margin-top: -20px;
    z-index: 1;
}

.thumb img {
    display: block;
    width: 100%;
    height: auto;
    border-radius: 6px;
}

.thumb:first-child {
    margin-top: 0;
}

.thumb.active {
    opacity: 1;
    transform: scale(1) translateX(0px);
    border: 2px solid #fff;
    z-index: 10;
}

.thumb:hover {
    z-index: 5;
    opacity: 0.85;
    transform: scale(0.9) translateX(0px);
}

/* =========================================
   AERIAL VIEWS (ZOOM REVEAL)
   ========================================= */

.stacked-scroll-trigger {
    position: relative;
    width: 100%;
    height: 100vh;
    overflow: hidden;
    margin-bottom: 20vh;
}

.stacked-scroll-cards {
    position: relative;
    width: 100%;
    height: 100%;
}

.stacked-card {
    position: absolute;
    inset: 0;
    overflow: hidden;
    will-change: transform, opacity;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border-radius: 0;
    box-shadow: none;
}

.stacked-img {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
    display: block;
    border-radius: 12px;
    box-shadow: 0 0 40px rgba(0, 0, 0, 0.5);
}

@media (min-width: 1920px) {
    .work-header,
    :is(.stills-header, .animations-header, .gallery-header) {
        padding-top: 22vh;
        padding-bottom: 12vh;
    }

    .all-work-title {
        font-size: clamp(2.4rem, 3.8vw, 4rem);
        margin-bottom: 6vh;
    }

    .gallery-container {
        gap: 48px;
    }

    .large-images {
        width: calc(100% - 216px);
    }

    .minimap {
        flex-basis: 120px;
        width: 120px;
    }

    .minimap-label {
        font-size: 1.11rem;
    }

    .minimap-child-link {
        font-size: 1.09rem;
    }
}

@media (max-width: 768px) {
    .work-header {
        padding: 10vh 5vw 5vh;
    }

    .work-title {
        font-size: clamp(2rem, 8vw, 4rem);
        position: sticky;
        top: 10vh;
        align-self: flex-start;
        text-align: left;
        margin-left: 0;
        padding-left: 0;
    }

    .work-subtitle {
        padding-left: 0;
        margin-bottom: 4rem;
        max-width: 100%;
        text-align: left;
    }

    .work-subtitle-line-1,
    .work-subtitle-line-2 {
        width: 100%;
        padding-right: 0;
        font-size: clamp(24px, 6vw, 36px);
        text-align: left;
    }

    :is(.stills-header, .animations-header, .gallery-header) {
        padding: 15vh 5vw 5vh;
    }

    :is(.stills-title, .animations-title, .gallery-title) {
        font-size: clamp(3rem, 12vw, 4rem);
        text-align: left;
    }

    :is(.stills-subtitle, .gallery-subtitle) {
        padding-left: 0;
    }

    .section-work {
        padding: 10vh 5vw 15vh;
    }

    .work-grid {
        gap: 8vh;
    }

    .work-item {
        display: flex;
        flex-direction: column;
        align-items: flex-start;
        gap: 1.5rem;
    }

    .work-mask {
        width: 100%;
        margin-bottom: 0;
    }

    .work-info,
    .work-item.alt .work-info {
        padding-left: 0;
        padding-right: 0;
        text-align: left;
    }

    .all-work-title {
        width: 100%;
        margin-left: 0;
    }

    .gallery-container {
        display: block;
    }

    .large-images {
        width: 100%;
    }

    .minimap {
        position: relative;
        top: auto;
        z-index: 1;
        width: 100%;
        min-height: auto;
        padding: 1.25rem 0 0;
        flex-direction: row;
        justify-content: flex-start;
        align-items: center;
        gap: 0.75rem;
        overflow-x: auto;
        overflow-y: hidden;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }

    .minimap::-webkit-scrollbar {
        display: none;
    }

    .minimap-label,
    .minimap-children {
        display: none;
    }

    .thumb {
        flex: 0 0 74px;
        width: 74px;
        margin-top: 0;
        transform: none;
        left: 0;
    }

    .thumb:first-child {
        margin-left: 0;
    }
}
