/* =========================================================
   GALLERY
   ========================================================= */

*, *::before, *::after {
    box-sizing: border-box;
}

:root {
    --cream: #efe9e0;
    --cream2: #f8f5ef;
    --dark: #171713;
    --green: #14251b;
    --olive: #566139;
    --gold: #c8a96a;
    --text: #28251f;
    --muted: #746e63;
    --serif: "Cormorant Garamond", Georgia, serif;
    --sans: "Inter", Arial, sans-serif;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    margin: 0;
    background: var(--cream);
    color: var(--text);
    font-family: var(--sans);
    font-size: clamp(14px, 0.35vw + 12px, 16px);
}

/* =========================
   GALLERY INTRO
   ========================= */
.navbar {
    height: 88px;
    position: fixed;
    inset: 0 0 auto;
    z-index: 10000;
    display: flex;
    align-items: center;
    padding: 0 5%;
    background: black;
    color: #fff;
    transition: background .25s, box-shadow .25s, backdrop-filter .25s
}

.gallery-intro {
    text-align: center;
    padding: 38px 20px 19px;
    background: var(--cream2);
}

.intro-mark {
    color: var(--gold);
    font-size: 22px;
    margin-bottom: 3px;
}

.eyebrow {
    margin: 0;
    color: var(--olive);
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 2px;
}

.gallery-intro h1 {
    font-family: var(--serif);
    font-size: 43px;
    font-weight: 500;
    line-height: .95;
    margin: 10px 0 11px;
    color: var(--green);
}

.gallery-intro h1 em {
    font-style: italic;
}

.intro-copy {
    margin: 0;
    color: var(--text);
    font-size: 11px;
}


/* =========================
   FILTER
   ========================= */

.filter-wrap {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;

    padding: 16px 4%;

    background: var(--cream2);

    border-bottom: 1px solid #e2dacc;

    flex-wrap: wrap;
}

.filter {
    height: 42px;

    padding: 0 25px;

    border: 1px solid #d8d0c2;

    background: transparent;

    border-radius: 24px;

    color: var(--text);

    display: flex;
    align-items: center;
    justify-content: center;

    gap: 9px;

    font-size: 11px;
    letter-spacing: .2px;

    cursor: pointer;

    transition: .2s;
}

.filter svg {
    width: 22px;
    height: 22px;

    fill: none;
    stroke: currentColor;
    stroke-width: 1.5;

    stroke-linecap: round;
    stroke-linejoin: round;
}

.filter.active {
    background: var(--olive);
    color: #fff;
    border-color: var(--olive);

    min-width: 88px;
}

.filter:hover {
    border-color: var(--gold);
    color: var(--olive);
}

.filter.active:hover {
    color: #fff;
}


/* =========================
   GALLERY GRID
   ========================= */

.gallery-grid {
    max-width: 1370px;

    margin: 28px auto 20px;

    padding: 0 3.5%;

    display: grid;

    grid-template-columns: repeat(4, 1fr);

    gap: 12px;

    content-visibility: auto;

    contain-intrinsic-size: auto 1800px;
}

.gallery-card {
    position: relative;

    min-width: 0;

    height: auto;

    border-radius: 6px;

    overflow: hidden;

    background: #ddd;

    box-shadow: 0 2px 10px rgba(39, 31, 20, .07);

    cursor: pointer;

    aspect-ratio: 4 / 3;

    transition:
        transform .25s ease,
        box-shadow .25s ease;
}

.gallery-card.wide {
    aspect-ratio: 4 / 3;
}

.gallery-card img {
    width: 100%;
    height: 100%;

    object-fit: cover;

    display: block;

    transition: transform .55s ease;
}

.gallery-card:hover img {
    transform: scale(1.045);
}

.gallery-card:hover {
    transform: translateY(-2px);

    box-shadow: 0 8px 24px rgba(39, 31, 20, .13);
}

.caption {
    position: absolute;

    left: 0;
    right: 0;
    bottom: 0;

    padding: 40px 14px 13px;

    color: #fff;

    background: linear-gradient(transparent,
            rgba(0, 0, 0, .72));

    display: flex;
    flex-direction: column;
}

.caption strong {
    font-family: var(--serif);

    font-size: 17px;
    font-weight: 500;
}

.caption small {
    font-size: 10px;

    opacity: .92;

    margin-top: 2px;
}


/* =========================
   LOAD MORE
   ========================= */

.load-more {
    display: flex;
    align-items: center;

    gap: 9px;

    margin: 18px auto 42px;

    padding: 12px 24px;

    border: 1px solid #bdb4a3;

    background: transparent;

    border-radius: 5px;

    color: var(--text);

    font-size: 11px;

    cursor: pointer;
}

.load-more span {
    font-size: 18px;
    color: var(--olive);
}


/* =========================
   GALLERY PHOTO POPUP
   ========================= */

.gallery-modal {
    position: fixed;

    inset: 0;

    z-index: 11000;

    display: grid;

    place-items: center;

    padding: 24px;

    opacity: 0;

    visibility: hidden;

    pointer-events: none;

    transition:
        opacity .22s ease,
        visibility .22s ease;
}

.gallery-modal.open {
    opacity: 1;

    visibility: visible;

    pointer-events: auto;
}

.modal-backdrop {
    position: absolute;

    inset: 0;

    background: rgba(12, 16, 12, .82);

    backdrop-filter: blur(7px);

    -webkit-backdrop-filter: blur(7px);
}

.modal-panel {
    position: relative;

    z-index: 1;

    width: min(1080px, 94vw);

    height: min(680px, 88vh);

    background: var(--cream2);

    border-radius: 12px;

    overflow: hidden;

    box-shadow: 0 30px 90px rgba(0, 0, 0, .45);

    display: grid;

    grid-template-columns:
        minmax(0, 1.48fr) minmax(320px, .72fr);

    transform:
        translateY(10px) scale(.985);

    transition:
        transform .22s ease;
}

.gallery-modal.open .modal-panel {
    transform: none;
}

.modal-photo-wrap {
    position: relative;

    min-width: 0;
    min-height: 0;

    background: #101610;

    display: grid;

    place-items: center;

    overflow: hidden;
}

.modal-photo-wrap img {
    width: 100%;
    height: 100%;

    object-fit: contain;

    display: block;
}

.modal-close {
    position: absolute;

    z-index: 5;

    right: 14px;
    top: 14px;

    width: 40px;
    height: 40px;

    border: 1px solid rgba(255, 255, 255, .62);

    border-radius: 50%;

    background: rgba(15, 20, 16, .76);

    color: #fff;

    font-size: 25px;

    line-height: 1;

    cursor: pointer;

    display: grid;

    place-items: center;
}

.modal-close:hover {
    background: var(--gold);

    border-color: var(--gold);

    color: var(--dark);
}

.modal-nav {
    position: absolute;

    z-index: 4;

    top: 50%;

    transform: translateY(-50%);

    width: 42px;
    height: 42px;

    border: 1px solid rgba(255, 255, 255, .62);

    border-radius: 50%;

    background: rgba(15, 20, 16, .58);

    color: #fff;

    font-size: 29px;

    line-height: 1;

    cursor: pointer;

    display: grid;

    place-items: center;
}

.modal-nav:hover {
    background: var(--gold);

    border-color: var(--gold);

    color: var(--dark);
}

.modal-nav.prev {
    left: 14px;
}

.modal-nav.next {
    right: 14px;
}

.modal-info {
    min-width: 0;
    min-height: 0;

    padding: 48px 38px 38px;

    display: flex;

    flex-direction: column;

    justify-content: center;

    border-left: 1px solid #ddd4c5;

    overflow: auto;
}

.modal-kicker {
    font-size: 10px;

    letter-spacing: 2.2px;

    color: var(--gold);

    font-weight: 700;

    margin: 0 0 12px;
}

.modal-info h2 {
    font-family: var(--serif);

    font-size: 38px;

    line-height: 1.02;

    font-weight: 500;

    color: var(--green);

    margin: 0 0 12px;
}

.modal-property {
    font-size: 12px;

    line-height: 1.45;

    font-weight: 700;

    letter-spacing: .25px;

    color: var(--olive);

    padding: 0 0 18px;

    border-bottom: 1px solid #ddd4c5;
}

.modal-info p {
    font-size: 13px;

    line-height: 1.7;

    color: var(--muted);

    margin: 18px 0 24px;
}

.modal-book {
    align-self: flex-start;

    display: inline-flex;

    align-items: center;

    gap: 12px;

    padding: 13px 18px;

    background: var(--olive);

    border: 1px solid var(--olive);

    border-radius: 4px;

    color: #fff;

    text-decoration: none;

    font-size: 10px;

    font-weight: 700;

    letter-spacing: 1px;

    transition: .2s ease;
}

.modal-book span {
    font-size: 16px;

    line-height: 1;
}

.modal-book:hover {
    background: var(--green);

    border-color: var(--green);

    transform: translateY(-1px);
}

/*
   Hanya aktif ketika popup gallery terbuka.
   Jangan gunakan overflow hidden pada body secara permanen.
*/
body.modal-open {
    overflow: hidden;
}


/* =========================
   TABLET
   ========================= */

@media (max-width: 1100px) {

    .gallery-grid {
        grid-template-columns: 1fr 1fr 1fr;
    }

    .filter {
        padding: 0 17px;
    }
}


/* =========================
   TABLET INTRO
   ========================= */

@media (max-width: 1100px) and (min-width: 701px) {

    .gallery-intro {
        padding: 29px 18px 14px;
    }

    .intro-mark {
        font-size: 18px;
    }

    .gallery-intro h1 {
        font-size: 32px;

        margin: 7px 0 8px;
    }

    .eyebrow {
        font-size: 8px;
    }

    .intro-copy {
        font-size: 8px;
    }
}


/* =========================
   MOBILE
   ========================= */

@media (max-width: 700px) {

    .gallery-intro {
        padding: 14px 16px 8px;
    }

    .intro-mark {
        font-size: 14px;

        margin-bottom: 0;
    }

    .gallery-intro h1 {
        font-size: 17px;

        margin: 4px 0 5px;
    }

    .eyebrow {
        font-size: 5px;

        letter-spacing: 1.2px;
    }

    .intro-copy {
        font-size: 5px;

        line-height: 1.4;
    }


    /* FILTER */

    .filter-wrap {
        position: relative;

        justify-content: flex-start;

        overflow-x: auto;

        flex-wrap: nowrap;

        padding:
            12px 48px 12px 16px;

        scrollbar-width: none;

        scroll-padding-left: 16px;

        scroll-snap-type: x proximity;
    }

    .filter-wrap::-webkit-scrollbar {
        display: none;
    }

    .filter {
        flex: 0 0 auto;

        height: 38px;

        padding: 0 16px;

        font-size: 10px;

        scroll-snap-align: start;
    }


    /* GRID */

    .gallery-grid {
        grid-template-columns: 1fr 1fr;

        padding: 0 12px;

        gap: 8px;

        margin-top: 16px;

        content-visibility: visible;
    }

    .gallery-card.wide,
    .gallery-card {
        aspect-ratio: 4 / 3;
    }

    .caption {
        padding: 34px 9px 9px;
    }

    .caption strong {
        font-size: 14px;
    }

    .caption small {
        font-size: 8px;
    }

    .load-more {
        margin-bottom: 30px;
    }
}


/* =========================
   MOBILE MODAL
   ========================= */

@media (max-width: 800px) {

    .gallery-modal {
        padding: 10px;
    }

    .modal-panel {
        width: min(560px, 96vw);

        height: min(88vh, 760px);

        grid-template-columns: 1fr;

        grid-template-rows:
            minmax(0, 48vh) minmax(0, 1fr);

        border-radius: 10px;
    }

    .modal-photo-wrap {
        min-height: 0;
    }

    .modal-info {
        padding: 22px 22px 24px;

        border-left: 0;

        border-top: 1px solid #ddd4c5;

        justify-content: flex-start;
    }

    .modal-info h2 {
        font-size: 30px;
    }

    .modal-info p {
        font-size: 12px;

        line-height: 1.6;

        margin: 13px 0 18px;
    }

    .modal-book {
        padding: 12px 16px;
    }

    .modal-close {
        right: 10px;

        top: 10px;

        width: 36px;
        height: 36px;
    }

    .modal-nav {
        width: 38px;
        height: 38px;
    }

    .modal-nav.prev {
        left: 10px;
    }

    .modal-nav.next {
        right: 10px;
    }
}


/* =========================
   SMALL MOBILE
   ========================= */

@media (max-width: 480px) {

    .modal-panel {
        height: 90vh;

        grid-template-rows:
            minmax(0, 43vh) minmax(0, 1fr);
    }

    .modal-info {
        padding: 19px 18px 22px;
    }

    .modal-info h2 {
        font-size: 27px;
    }

    .modal-property {
        font-size: 11px;

        padding-bottom: 14px;
    }

    .modal-info p {
        margin: 12px 0 16px;
    }

    .modal-book {
        width: 100%;

        justify-content: center;
    }
}


/* =========================
   MOBILE FILTER INDICATOR
   ========================= */

@media (max-width: 700px) {

    .filter-scroll-indicator {
        position: fixed;

        z-index: 900;

        width: 54px;
        height: 38px;

        display: none;

        align-items: center;

        justify-content: flex-end;

        padding-right: 16px;

        pointer-events: none;

        background: linear-gradient(90deg,
                rgba(248, 245, 239, 0),
                var(--cream2) 72%);
    }

    .filter-scroll-indicator::after {
        content: "";

        width: 7px;
        height: 7px;

        border-top: 1px solid var(--gold);
        border-right: 1px solid var(--gold);

        transform: rotate(45deg);

        filter: drop-shadow(0 0 3px rgba(255, 255, 255, .9));
    }

    .filter-scroll-indicator.show {
        display: flex;
    }
}


/* =========================
   GALLERY SENTINEL
   ========================= */

.gallery-sentinel {
    height: 1px;

    width: 100%;

    margin-top: 1px;
}

/* =========================================================
   FIX POPUP: foto utuh dan panel tidak terpotong
   ========================================================= */

.gallery-modal {
    overflow-y: auto;
    padding: 16px;
}

.gallery-modal .modal-panel {
    width: min(1080px, 100%);
    height: auto;
    max-height: calc(100dvh - 32px);
    grid-template-columns: minmax(0, 1.4fr) minmax(280px, 0.7fr);
    overflow: hidden;
}

/* Area foto punya tinggi yang jelas */
.gallery-modal .modal-photo-wrap {
    min-width: 0;
    min-height: 0;
    height: min(72dvh, 680px);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.gallery-modal .modal-photo-wrap img {
    display: block;
    width: 100%;
    height: 100%;
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    object-position: center;
}

/* Info boleh discroll jika isinya lebih tinggi dari panel */
.gallery-modal .modal-info {
    min-height: 0;
    overflow-y: auto;
}

/* Tablet dan mobile */
@media (max-width: 800px) {
    .gallery-modal .modal-panel {
        width: min(560px, 100%);
        max-height: calc(100dvh - 20px);
        grid-template-columns: minmax(0, 1fr);
        grid-template-rows: minmax(180px, 52dvh) minmax(0, 1fr);
    }

    .gallery-modal .modal-photo-wrap {
        height: auto;
        min-height: 0;
    }

    .gallery-modal .modal-info {
        padding: 20px;
    }
}

/* Ponsel kecil */
@media (max-width: 480px) {
    .gallery-modal {
        padding: 8px;
    }

    .gallery-modal .modal-panel {
        max-height: calc(100dvh - 16px);
        grid-template-rows: minmax(160px, 46dvh) minmax(0, 1fr);
    }
}