body.page-gallery {
    background: var(--bg-light);
    color: var(--text-light);
}

body.page-gallery .page-projects-main.gallery-main {
    min-height: 100vh;
    padding-top: max(132px, calc(env(safe-area-inset-top) + 112px));
}

.gallery-filter-bar {
    padding: 0 16px 22px;
}

.gallery-heading {
    margin: 0 0 18px;
    font-size: clamp(18px, 2vw, 26px);
    font-weight: 500;
    letter-spacing: -0.02em;
    text-align: center;
}

.gallery-filter-toggle {
    display: none;
    width: 100%;
    max-width: 420px;
    margin: 0 auto;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 14px;
    font-family: inherit;
    font-size: 13px;
    font-weight: 500;
    letter-spacing: 0.02em;
    color: #111;
    background: #fff;
    border: 1px solid #111;
    border-radius: 4px;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.gallery-filter-toggle-label {
    color: rgba(17, 17, 17, 0.55);
}

.gallery-filter-toggle-current {
    margin-left: auto;
    font-weight: 600;
}

.gallery-filter-toggle::after {
    content: "";
    width: 7px;
    height: 7px;
    margin-left: 4px;
    border-right: 1.5px solid #111;
    border-bottom: 1.5px solid #111;
    transform: rotate(45deg) translateY(-2px);
    flex-shrink: 0;
}

.gallery-filter-bar.is-open .gallery-filter-toggle::after {
    transform: rotate(-135deg) translateY(-2px);
}

.gallery-filter-menu {
    position: static !important;
    top: auto !important;
    left: auto !important;
    width: auto !important;
    max-width: 100% !important;
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    padding: 0 !important;
    background-color: transparent !important;
    display: block !important;
    flex-direction: row !important;
    justify-content: center !important;
    align-items: stretch !important;
    gap: 0 !important;
    opacity: 1 !important;
    pointer-events: auto !important;
    z-index: auto !important;
    overflow: visible !important;
    transition: none !important;
}

.gallery-filter-list {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    list-style: none;
    margin: 0;
    padding: 0;
}

.gallery-filter-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 14px;
    font-size: 13px !important;
    font-weight: 500 !important;
    letter-spacing: 0.02em;
    text-decoration: none;
    text-transform: none !important;
    color: #111 !important;
    background: #fff;
    border: 1px solid #111;
    border-radius: 4px;
    transition: background 0.2s ease, color 0.2s ease;
}

.gallery-filter-link:hover {
    background: #f4f4f4;
    color: #111 !important;
}

.gallery-filter-link.is-active {
    background: #111;
    color: #fff !important;
}

.gallery-grid {
    display: grid;
    grid-template-columns: 1fr;
    grid-auto-flow: dense;
    grid-auto-rows: minmax(200px, 42vw);
    gap: 8px;
    width: 100%;
    padding: 0 8px 56px;
}

.gallery-card {
    position: relative;
    min-width: 0;
    min-height: 0;
    overflow: hidden;
}

.gallery-card[hidden] {
    display: none !important;
}

.gallery-card-media {
    position: relative;
    display: block;
    width: 100%;
    height: 100%;
    padding: 0;
    border: 0;
    background: var(--placeholder-light);
    overflow: hidden;
    cursor: pointer;
    color: inherit;
    text-decoration: none;
}

.gallery-card-media img,
.gallery-card-media video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    pointer-events: none;
    transition: transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.gallery-card-media:hover img,
.gallery-card-media:hover video,
.gallery-card-media:focus-visible img,
.gallery-card-media:focus-visible video {
    transform: scale(1.04);
}

.gallery-card-media:focus-visible {
    outline: 2px solid #111;
    outline-offset: 3px;
}

.gallery-card-title {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    margin: 0;
    padding: 36px 14px 12px;
    font-size: clamp(12px, 1.15vw, 16px);
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    line-height: 1.3;
    color: #fff;
    text-align: left;
    text-shadow: 0 1px 8px rgba(0, 0, 0, 0.35);
    background: linear-gradient(to top, rgba(0, 0, 0, 0.55) 0%, rgba(0, 0, 0, 0.12) 55%, transparent 100%);
    pointer-events: none;
}

.gallery-cta {
    padding: 24px 20px 80px;
    text-align: center;
}

.gallery-cta-title {
    max-width: 18em;
    margin: 0 auto 28px;
    font-weight: 500;
}

.gallery-full-lightbox {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
}

.gallery-full-lightbox.is-active {
    opacity: 1;
    pointer-events: auto;
}

.gallery-full-lightbox-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(10, 10, 10, 0.88);
}

.gallery-full-lightbox-stage {
    position: relative;
    z-index: 1;
    width: min(1200px, calc(100% - 32px));
    max-height: calc(100vh - 48px);
}

.gallery-full-lightbox-figure {
    margin: 0;
}

.gallery-full-lightbox-media {
    display: flex;
    align-items: center;
    justify-content: center;
    max-height: calc(100vh - 120px);
}

.gallery-full-lightbox-media img,
.gallery-full-lightbox-media video {
    max-width: 100%;
    max-height: calc(100vh - 120px);
    width: auto;
    height: auto;
    object-fit: contain;
    display: block;
}

.gallery-full-lightbox-caption {
    margin-top: 14px;
    color: #fff;
    text-align: center;
    font-size: 14px;
    font-weight: 500;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.gallery-full-lightbox-close,
.gallery-full-lightbox-arrow {
    position: absolute;
    z-index: 2;
    border: 0;
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
    cursor: pointer;
    font-family: inherit;
}

.gallery-full-lightbox-close {
    top: 14px;
    right: 14px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    font-size: 28px;
    line-height: 1;
}

.gallery-full-lightbox-arrow {
    top: 50%;
    transform: translateY(-50%);
    width: 44px;
    height: 44px;
    border-radius: 50%;
    font-size: 28px;
    line-height: 1;
}

.gallery-full-lightbox-arrow--prev { left: 10px; }
.gallery-full-lightbox-arrow--next { right: 10px; }

.gallery-full-lightbox-close:hover,
.gallery-full-lightbox-arrow:hover {
    background: rgba(255, 255, 255, 0.22);
}

.gallery-full-lightbox.is-single .gallery-full-lightbox-arrow {
    display: none;
}

@media (min-width: 700px) {
    body.page-gallery .page-projects-main.gallery-main {
        padding-top: max(140px, calc(env(safe-area-inset-top) + 118px));
    }

    .gallery-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
        grid-auto-flow: dense;
        grid-auto-rows: minmax(170px, 18vw);
        gap: 8px;
        padding: 0 12px 72px;
    }

    .gallery-card--hero {
        grid-column: span 2;
        grid-row: span 2;
    }

    .gallery-card--half {
        grid-column: span 2;
        grid-row: span 1;
    }

    .gallery-card--wide {
        grid-column: span 4;
        grid-row: span 2;
    }

    .gallery-card--banner {
        grid-column: span 4;
        grid-row: span 1;
    }

    .gallery-card--hero.gallery-card--flip {
        grid-column: 3 / span 2;
    }
}

@media (max-width: 1023px) {
    .gallery-filter-toggle {
        display: flex;
    }

    .gallery-filter-menu {
        display: none !important;
        margin-top: 12px;
    }

    .gallery-filter-bar.is-open .gallery-filter-menu {
        display: block !important;
    }
}

@media (max-width: 699px) {
    .gallery-card--hero,
    .gallery-card--wide,
    .gallery-card--banner,
    .gallery-card--half {
        grid-column: auto;
        grid-row: span 1;
    }

    .gallery-card--hero {
        grid-row: span 2;
    }

    .gallery-filter-link {
        padding: 7px 11px;
        font-size: 12px;
    }

    .gallery-full-lightbox-arrow {
        top: auto;
        bottom: 18px;
        transform: none;
    }

    .gallery-full-lightbox-arrow--prev { left: 18px; }
    .gallery-full-lightbox-arrow--next { right: 18px; }
}

body.page-project-detail .page-projects-main.gallery-main {
    padding-top: 0;
}

.detail-hero {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    max-height: min(90vh, 900px);
    overflow: hidden;
    background: #111;
}

.detail-hero-media {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.detail-hero-scroll {
    position: absolute;
    left: 50%;
    bottom: 24px;
    transform: translateX(-50%);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    color: #fff;
    font-size: 22px;
    text-decoration: none;
    text-shadow: 0 1px 8px rgba(0, 0, 0, 0.45);
    z-index: 2;
}

.detail-body {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: max(48px, calc(env(safe-area-inset-top) + 96px)) 5% 24px;
}

body.page-project-detail .detail-hero ~ .detail-body {
    padding-top: 40px;
}

.detail-layout {
    display: grid;
    grid-template-columns: 1fr;
    gap: 32px;
    align-items: start;
    padding-bottom: 28px;
    border-bottom: 2px solid #484747;
}

.detail-copy {
    min-width: 0;
}

.detail-back {
    display: inline-block;
    margin-bottom: 18px;
    font-size: 14px;
    font-weight: 500;
    color: rgba(17, 17, 17, 0.65);
    text-decoration: none;
}

.detail-back:hover {
    color: #111;
}

.detail-title {
    margin: 0 0 16px;
    font-size: clamp(22px, 3.2vw, 40px);
    font-weight: 700;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    line-height: 1.15;
    color: #111;
}

.detail-cats {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 0 0 20px;
    padding: 0;
    list-style: none;
}

.detail-cat-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 14px;
    font-size: 13px !important;
    font-weight: 500 !important;
    letter-spacing: 0.02em;
    text-decoration: none;
    text-transform: none !important;
    color: #111 !important;
    background: #fff;
    border: 1px solid #111;
    border-radius: 4px;
    transition: background 0.2s ease, color 0.2s ease;
}

.detail-cat-link:hover {
    background: #f4f4f4;
    color: #111 !important;
}

.detail-desc {
    margin: 0;
    font-size: clamp(15px, 1.4vw, 17px);
    font-weight: 400;
    line-height: 1.7;
    color: rgba(17, 17, 17, 0.88);
}

.detail-gallery {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    width: 100%;
    min-width: 0;
    padding: 0;
}

.detail-gallery-item {
    display: block;
    width: 100%;
    padding: 0;
    border: 0;
    background: var(--placeholder-light, #eee);
    aspect-ratio: 3 / 2;
    overflow: hidden;
    cursor: pointer;
}

.detail-gallery-item img,
.detail-gallery-item video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    pointer-events: none;
    transition: transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.detail-gallery-item:hover img,
.detail-gallery-item:hover video,
.detail-gallery-item:focus-visible img,
.detail-gallery-item:focus-visible video {
    transform: scale(1.03);
}

.detail-gallery-item:focus-visible {
    outline: 2px solid #111;
    outline-offset: 3px;
}

.gallery-full-lightbox-caption:empty {
    display: none;
}

.detail-embeds {
    display: flex;
    flex-direction: column;
    gap: 40px;
    margin: 36px 0 8px;
    padding: 8px 0 28px;
    border-bottom: 2px solid #484747;
}

.detail-embed {
    min-width: 0;
}

.detail-embed-title {
    margin: 0 0 14px;
    font-size: clamp(18px, 2.1vw, 26px);
    font-weight: 600;
    letter-spacing: 0.02em;
    line-height: 1.2;
    text-align: left;
    color: #111;
}

.detail-embed-iframe {
    width: 100%;
    background: #111;
    overflow: hidden;
}

.detail-embed-frame {
    display: block;
    width: 100%;
    height: 75vh;
    min-height: 420px;
    border: 0;
    background: #111;
}

.detail-embed-frame--square {
    height: auto;
    min-height: 0;
    aspect-ratio: 1 / 1;
}

.detail-embed-frame--low {
    height: 120vw;
    max-height: 90vh;
    min-height: 480px;
}

.detail-nav {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin: 0;
    padding: 28px 0 8px;
    border-bottom: 2px solid #484747;
}

.detail-nav-slot {
    min-width: 0;
}

.detail-nav-slot--next {
    text-align: right;
}

.detail-nav-link {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    max-width: 100%;
    font-size: clamp(14px, 1.6vw, 22px);
    font-weight: 700;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    line-height: 1.25;
    color: #242424 !important;
    text-decoration: none;
}

.detail-nav-link:hover {
    color: #111 !important;
}

.detail-nav-label {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.detail-nav-arrow {
    flex-shrink: 0;
}

@media (min-width: 900px) {
    .detail-layout {
        grid-template-columns: 1fr 1fr;
        gap: 40px;
        padding-bottom: 36px;
    }

    .detail-gallery {
        gap: 12px;
    }
}

@media (max-width: 699px) {
    .detail-body {
        padding-left: 16px;
        padding-right: 16px;
    }

    .detail-gallery {
        grid-template-columns: 1fr;
    }

    .detail-embeds {
        gap: 28px;
        margin-top: 28px;
    }

    .detail-embed-frame {
        height: 70vh;
        min-height: 320px;
    }

    .detail-embed-frame--low {
        height: 120vw;
        max-height: none;
        min-height: 360px;
    }

    .detail-nav {
        grid-template-columns: 1fr;
    }

    .detail-nav-slot--next {
        text-align: left;
    }
}


