@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@300..700&family=Urbanist:ital,wght@0,100..900;1,100..900&display=swap');

:root {
    --font-primary: 'Space Grotesk', sans-serif;
    --font-secondary: 'Urbanist', sans-serif;
}

/* Photo Gallery Styles */

/* Prevenir overflow horizontal */
html, body {
    overflow-x: hidden;
    max-width: 100%;
    font-family: var(--font-secondary);
}

.page-content {
    max-width: 100%;
    overflow-x: hidden;
}

.main {
    width: 100%;
    max-width: 100%;
    margin: 0;
    padding: 10rem 2rem 2rem;
    overflow-x: hidden;
    /* Adjusted for navbar height */
}

.main h1 {
    font-size: 3rem;
    /* Larger title */
    line-height: 1.2;
    margin-bottom: 3rem;
    text-align: center;
    color: #fff;
    font-family: var(--font-primary);
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

/* Photo Gallery */
.gallery {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    /* Slightly larger items */
    grid-auto-rows: 15rem;
    grid-auto-flow: dense;
    gap: 1rem;
}

.gallery figure {
    /* container-type: inline-size; */
    container: figure / inline-size;
    overflow: hidden;

    display: grid;
    /* grid-template-columns: 1fr; */
    /* grid-template-rows: 1fr; */

    /*
    Because 1fr = minmax(auto, 1fr),
    to prevent the grid blowout,
    set the minimum to zero.
  */
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: minmax(0, 1fr);
}

.gallery img {
    inline-size: 100%;
    block-size: 100%;
    object-fit: cover;

    /* grid-row: 1 / -1; */
    /* grid-column: 1 / -1; */
    grid-area: 1 / 1 / -1 / -1;

    transition: scale 1s ease-in-out;
}

.gallery figure:hover img {
    scale: 1.125;
}

.gallery figcaption {
    grid-area: 1 / 1 / -1 / -1;
    align-self: end;
    z-index: 1;

    padding: 3em 15% 1em 1em;
    color: #fff;
    font-size: 0.875rem;
    line-height: 1.3;
    background: linear-gradient(transparent 25%, rgb(0 0 0 / 0.75));
    pointer-events: none;
}

.gallery figcaption h3 {
    font-size: 1.0625rem;
}

.gallery figcaption p {
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

@media (width > 600px) {
    .gallery figure:nth-child(1) {
        grid-area: span 2 / span 2;
    }

    .gallery figure:nth-child(4n + 1) {
        grid-row: span 2;
    }

    .gallery figure:nth-child(4n + 2) {
        grid-column: span 2;
    }
}

/* Filter Styles - Casilla / Pill Capsule Design */
.portfolio-filtres {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.8rem 1.2rem;
    margin-bottom: 3.5rem;
    flex-wrap: wrap;
    padding: 0 1rem;
}

.filter-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(185, 185, 185, 0.25);
    border-radius: 50px;
    color: #b9b9b9;
    font-family: var(--font-primary);
    font-size: clamp(0.85rem, 1.1vw, 1rem);
    font-weight: 600;
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    padding: 0.7rem 1.6rem;
    transition: all 0.35s cubic-bezier(0.23, 1, 0.32, 1);
    position: relative;
    white-space: nowrap;
    backdrop-filter: blur(8px);
}

/* Hover: Tono Crema Marfil #fbf7ef */
.filter-btn:hover {
    background: #fbf7ef;
    color: #121212;
    border-color: #fbf7ef;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(251, 247, 239, 0.15);
}

/* Active State: Amarillo Dorado #ce9804 */
.filter-btn.active {
    background: #ce9804;
    color: #121212;
    border-color: #ce9804;
    font-weight: 700;
    box-shadow: 0 8px 25px rgba(206, 152, 4, 0.35);
}

@media (max-width: 768px) {
    .main {
        padding: 6rem 0.8rem 1.5rem;
    }

    .main h1 {
        font-size: clamp(1.8rem, 8vw, 2.5rem);
        margin-bottom: 1.5rem;
        letter-spacing: 0.08em;
    }

    .portfolio-filtres {
        gap: 0.4rem 0.6rem;
        margin-bottom: 1.5rem;
        padding: 0 0.5rem;
        justify-content: center;
    }

    .filter-btn {
        font-size: 0.75rem;
        padding: 0.5rem 0.7rem;
        letter-spacing: 0.05em;
        min-height: 40px;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .filter-btn.active::after {
        height: 2px;
        bottom: 2px;
    }

    .gallery {
        grid-template-columns: repeat(2, 1fr);
        grid-auto-rows: 10rem;
        gap: 0.5rem;
    }

    /* Reset special sizing on mobile */
    .gallery figure:nth-child(1) {
        grid-area: auto;
    }

    .gallery figure:nth-child(4n + 1) {
        grid-row: auto;
    }

    .gallery figure:nth-child(4n + 2) {
        grid-column: auto;
    }

    .gallery figcaption {
        padding: 1.5em 8% 0.6em 0.6em;
        font-size: 0.65rem;
    }

    .gallery figcaption h3 {
        font-size: 0.8rem;
    }

    .gallery figure[data-category='short-films'] {
        grid-column: span 1 !important;
        grid-row: span 2 !important;
    }
}

@media (max-width: 480px) {
    .main {
        padding: 5.5rem 0.5rem 1rem;
    }

    .main h1 {
        font-size: clamp(1.5rem, 10vw, 2rem);
        margin-bottom: 1rem;
        letter-spacing: 0.05em;
    }

    .portfolio-filtres {
        gap: 0.3rem 0.4rem;
        margin-bottom: 1rem;
        padding: 0 0.25rem;
    }

    .filter-btn {
        font-size: 0.65rem;
        padding: 0.4rem 0.5rem;
        letter-spacing: 0.03em;
        min-height: 36px;
    }

    .filter-btn.active::after {
        height: 1.5px;
        left: 15%;
        width: 70%;
    }

    .gallery {
        grid-template-columns: repeat(2, 1fr);
        grid-auto-rows: 9rem;
        gap: 0.4rem;
    }

    .gallery figcaption {
        padding: 1em 5% 0.5em 0.5em;
        font-size: 0.6rem;
    }

    .gallery figcaption h3 {
        font-size: 0.7rem;
        line-height: 1.2;
    }

    .gallery figure[data-category='short-films'] {
        grid-column: span 1 !important;
        grid-row: span 2 !important;
    }
}

.gallery video {
    inline-size: 100%;
    block-size: 100%;
    object-fit: cover;
    grid-area: 1 / 1 / -1 / -1;
    transition: scale 1s ease-in-out;
}



@media (max-width: 1024px) {
    .gallery {
        grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
    }
}

.gallery figure[data-category='short-films'] {
    grid-column: span 1 !important;
    grid-row: span 3 !important;
}

/* Portfolio Overlay Link */
.gallery figure {
    position: relative;
    /* Ensure it's a positioning context */
}

.portfolio-overlay-link {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10;
    cursor: pointer;
}

/* Brand Page - Video Section */
.brand-video-container {
    width: 100vw;
    max-width: 100vw;
    margin: 4rem 0;
    padding: 0;
    position: relative;
    left: 50%;
    right: 50%;
    transform: translateX(-50%);
}

.brand-video-container iframe,
.brand-video-container video {
    width: 100%;
    height: 90vh;
    /* Even taller */
    border-radius: 0;
    box-shadow: none;
    display: block;
}

/* Brand Page - Interactive Draggable Marquee Gallery */
.marquee-container {
    width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    white-space: nowrap;
    padding: 2rem 0;
    background-color: transparent;
    cursor: grab;
    user-select: none;
    -webkit-user-select: none;
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE 10+ */
    scroll-behavior: auto;
}

.marquee-container::-webkit-scrollbar {
    display: none; /* Chrome, Safari, Opera */
}

.marquee-container.is-dragging {
    cursor: grabbing !important;
    cursor: -webkit-grabbing !important;
}

.marquee-content {
    display: inline-flex;
    gap: 2rem;
    will-change: transform;
}

.marquee-content > img {
    height: 60vh;
    width: auto;
    border-radius: 8px;
    object-fit: cover;
    flex-shrink: 0;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
    pointer-events: none; /* Evita el arrastre por defecto de la imagen */
    -webkit-user-drag: none;
}

.marquee-content .video-item {
    width: 580px;
    max-width: 85vw;
    flex-shrink: 0;
    white-space: normal;
    position: relative;
    display: block;
    text-decoration: none;
    overflow: hidden;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
}

.marquee-content .video-item .video-wrapper {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    border-radius: 8px;
}

.marquee-content .video-item .video-wrapper img,
.marquee-content .video-item .video-wrapper video {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    position: absolute;
    top: 0;
    left: 0;
    pointer-events: none;
    -webkit-user-drag: none;
}

.marquee-content .video-item .video-title {
    font-size: clamp(1.4rem, 2.5vw, 2.1rem);
    letter-spacing: 0.1em;
    width: 90%;
    word-break: break-word;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.8);
}

/* ------------------------------------------- */
/* BRAND PAGES RESPONSIVE */
/* ------------------------------------------- */
@media (max-width: 768px) {
    .brand-video-container {
        margin: 2rem 0;
    }

    .brand-video-container iframe,
    .brand-video-container video {
        height: 50vh;
    }

    .marquee-container {
        padding: 1.5rem 0;
    }

    .marquee-content {
        gap: 1rem;
        animation-duration: 30s;
    }

    .marquee-content img {
        height: 40vh;
        border-radius: 6px;
    }
}

@media (max-width: 480px) {
    .brand-video-container {
        margin: 1.5rem 0;
    }

    .brand-video-container iframe,
    .brand-video-container video {
        height: 40vh;
    }

    .marquee-container {
        padding: 1rem 0;
    }

    .marquee-content {
        gap: 0.8rem;
        animation-duration: 25s;
    }

    .marquee-content img {
        height: 30vh;
        border-radius: 4px;
    }
}

/* ------------------------------------------- */
/* TABLET LANDSCAPE (768px - 1024px) */
/* ------------------------------------------- */
@media (min-width: 768px) and (max-width: 1024px) {
    .main {
        padding: 8rem 1.5rem 2rem;
    }

    .main h1 {
        font-size: 2.5rem;
    }

    .gallery {
        grid-template-columns: repeat(3, 1fr);
        grid-auto-rows: 14rem;
    }

    .portfolio-filtres {
        gap: 1.5rem;
    }

    .filter-btn {
        font-size: 1.1rem;
    }

    .brand-video-container iframe,
    .brand-video-container video {
        height: 70vh;
    }

    .marquee-content img {
        height: 50vh;
    }
}

/* ============================================= */
/* BRAND PAGES STYLES */
/* ============================================= */

/* Brand Hero Section */
.brand-hero {
    height: 60vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    padding-top: 80px;
    padding-left: 1.5rem;
    padding-right: 1.5rem;
}

.brand-hero h1 {
    font-family: 'League Spartan', sans-serif;
    font-size: clamp(2.5rem, 10vw, 6rem);
    font-weight: 900;
    color: #fff;
    text-transform: uppercase;
    margin: 0;
    line-height: 1.1;
}

.brand-hero p {
    color: gray;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    font-size: clamp(0.75rem, 2vw, 1rem);
    margin-top: 0.5rem;
}

/* Back Link */
.back-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: rgba(255, 255, 255, 0.6);
    text-decoration: none;
    font-family: 'League Spartan', sans-serif;
    text-transform: uppercase;
    margin-bottom: 2rem;
    transition: color 0.3s ease;
    font-size: clamp(0.8rem, 2vw, 1rem);
    padding: 0.5rem 1rem;
    min-height: 44px;
}

.back-link:hover {
    color: #ce9804;
}

.back-link i {
    font-size: 0.9em;
}

/* Brand Gallery */
.brand-gallery {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
}

.brand-gallery img {
    width: 100%;
    height: auto;
    border-radius: 8px;
    object-fit: cover;
}

/* ------------------------------------------- */
/* BRAND PAGES - TABLET RESPONSIVE */
/* ------------------------------------------- */
@media (max-width: 1024px) {
    .brand-hero {
        height: 50vh;
        padding-top: 70px;
    }

    .brand-gallery {
        padding: 1.5rem;
        gap: 1.5rem;
        grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    }
}

/* ------------------------------------------- */
/* BRAND PAGES - MOBILE RESPONSIVE */
/* ------------------------------------------- */
@media (max-width: 768px) {
    .brand-hero {
        height: auto;
        min-height: 35vh;
        padding-top: 5rem;
        padding-bottom: 2rem;
        padding-left: 1rem;
        padding-right: 1rem;
    }

    .brand-hero h1 {
        font-size: clamp(2rem, 12vw, 4rem);
    }

    .brand-hero p {
        font-size: 0.8rem;
        letter-spacing: 0.08em;
    }

    .back-link {
        margin-bottom: 1.5rem;
        font-size: 0.85rem;
        gap: 0.4rem;
    }

    .brand-gallery {
        padding: 1rem;
        gap: 1rem;
        grid-template-columns: 1fr;
    }
}

/* ------------------------------------------- */
/* BRAND PAGES - SMALL MOBILE RESPONSIVE */
/* ------------------------------------------- */
@media (max-width: 480px) {
    .brand-hero {
        padding-top: 4.5rem;
        padding-bottom: 1.5rem;
        min-height: 30vh;
    }

    .brand-hero h1 {
        font-size: clamp(1.8rem, 14vw, 3rem);
    }

    .brand-hero p {
        font-size: 0.7rem;
        letter-spacing: 0.06em;
    }

    .back-link {
        font-size: 0.75rem;
        margin-bottom: 1rem;
        padding: 0.4rem 0.8rem;
    }

    .brand-gallery {
        padding: 0.8rem;
        gap: 0.8rem;
    }

    .brand-gallery img {
        border-radius: 6px;
    }
}

/* ------------------------------------------- */
/* TOUCH DEVICE OPTIMIZATIONS */
/* ------------------------------------------- */
@media (hover: none) and (pointer: coarse) {
    /* Disable hover scale on touch devices */
    .gallery figure:hover img,
    .gallery figure:hover video {
        scale: 1;
    }

    /* Larger touch targets */
    .filter-btn {
        min-height: 44px;
        padding: 0.6rem 1rem;
    }

    .back-link {
        min-height: 44px;
    }

    .portfolio-overlay-link {
        /* Ensure full touch area */
        min-height: 100%;
    }

    /* Active state feedback */
    .filter-btn:active {
        transform: scale(0.97);
        opacity: 0.9;
    }
}

/* ------------------------------------------- */
/* LARGE DESKTOP (1300px+) */
/* ------------------------------------------- */
@media (min-width: 1300px) {
    .gallery {
        grid-template-columns: repeat(4, 1fr);
        grid-auto-rows: 18rem;
        gap: 1.2rem;
    }

    .main {
        padding: 10rem 3rem 3rem;
    }

    .main h1 {
        font-size: 3.5rem;
        margin-bottom: 3.5rem;
    }

    .marquee-content img {
        height: 65vh;
    }
}

/* ================================================= */
/* VERTICAL VIDEO POP-OUT MODAL (SHORT-FILMS LIGHTBOX) */
/* ================================================= */

.vertical-video-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 100000;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.35s cubic-bezier(0.23, 1, 0.32, 1);
}

.vertical-video-modal.active {
    opacity: 1;
    pointer-events: auto;
}

.vertical-video-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.88);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.vertical-video-content {
    position: relative;
    z-index: 100001;
    height: min(85vh, 750px);
    aspect-ratio: 9 / 16;
    background: #000000;
    border-radius: 18px;
    border: 1px solid rgba(206, 152, 4, 0.5);
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.9), 0 0 35px rgba(206, 152, 4, 0.25);
    overflow: hidden;
    transform: scale(0.9);
    transition: transform 0.35s cubic-bezier(0.23, 1, 0.32, 1);
    display: flex;
    justify-content: center;
    align-items: center;
}

.vertical-video-modal.active .vertical-video-content {
    transform: scale(1);
}

.vertical-video-content video {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: 16px;
    display: block;
}

.vertical-video-close {
    position: absolute;
    top: 15px;
    right: 15px;
    z-index: 100002;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(18, 18, 18, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: #ffffff;
    font-size: 1.6rem;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.vertical-video-close:hover {
    background: #ce9804;
    color: #121212;
    border-color: #ce9804;
    transform: scale(1.1);
}

/* Botón de expansión sobre los videos verticales en la cuadrícula */
figure[data-category="short-films"] {
    position: relative;
    overflow: hidden;
    border-radius: 10px;
    cursor: pointer;
}

.btn-expand-vertical {
    position: absolute;
    top: 12px;
    right: 12px;
    z-index: 25;
    background: rgba(18, 18, 18, 0.78);
    border: 1px solid rgba(206, 152, 4, 0.7);
    color: #ce9804;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.3s ease;
    opacity: 0.9;
    backdrop-filter: blur(4px);
}

figure[data-category="short-films"]:hover .btn-expand-vertical,
.btn-expand-vertical:hover {
    opacity: 1;
    background: #ce9804;
    color: #121212;
    transform: scale(1.1);
    box-shadow: 0 4px 15px rgba(206, 152, 4, 0.4);
}