/* =========================================================================
   Gallery page  (loaded only by gallery.php)
   Uses the brand tokens from style.css. Classes are prefixed gx- / gxv- so
   nothing here touches the .pc cards used on the homepage, trips and
   destinations.
   ========================================================================= */

.gx { --gx-gap: clamp(16px, 2vw, 28px); }

.gx-rows {
    display: grid;
    gap: clamp(32px, 4.5vw, 60px);
}

/* ---------------------------------------------------------------- rows */
.gx-row {
    display: grid;
    gap: var(--gx-gap);
    align-items: start;
}
.gx-row--wide {
    grid-template-columns: 7fr 5fr;
    --gx-h: clamp(300px, 34vw, 460px);
}
.gx-row--wide.gx-row--flip { grid-template-columns: 5fr 7fr; }
.gx-row--trio {
    grid-template-columns: repeat(3, 1fr);
    --gx-h: clamp(190px, 22vw, 300px);
}
/* last row with fewer photos than the pattern */
.gx-row[data-count="1"] { grid-template-columns: 1fr; }
.gx-row--trio[data-count="2"] {
    grid-template-columns: repeat(2, 1fr);
    --gx-h: clamp(240px, 28vw, 380px);
}

/* ---------------------------------------------------------------- photo */
.gx-item { margin: 0; min-width: 0; }

.gx-btn {
    display: block;
    width: 100%;
    height: var(--gx-h);
    padding: 0;
    overflow: hidden;
    border-radius: var(--r-sm);
    background: var(--cream-2);
    cursor: zoom-in;
}
.gx-btn img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform .7s cubic-bezier(.2, .6, .2, 1);
}
.gx-btn:focus-visible { outline-offset: 4px; }

@media (hover: hover) {
    .gx-btn:hover img { transform: scale(1.035); }
}

/* ---------------------------------------------------------------- caption */
.gx-cap { padding: 14px 2px 0; }
.gx-place {
    display: block;
    font-family: var(--serif);
    font-size: clamp(19px, 1.7vw, 22px);
    line-height: 1.25;
    color: var(--ink);
}
.gx-note {
    display: block;
    margin-top: 3px;
    font-size: 14px;
    color: var(--ink-soft);
}

/* ---------------------------------------------------------------- mobile */
@media (max-width: 720px) {
    .gx-row,
    .gx-row--wide.gx-row--flip,
    .gx-row--trio[data-count="2"] { grid-template-columns: 1fr; }
    .gx-rows, .gx-row { gap: 28px; }
    .gx-btn { height: auto; aspect-ratio: 4 / 3; }
}

/* ========================================================================
   Photo viewer
   ======================================================================== */
.gxv {
    position: fixed; inset: 0; z-index: 200;
    display: grid;
    grid-template-rows: auto minmax(0, 1fr) auto;
    background: var(--navy-deep);
    color: var(--on-dark);
}
.gxv[hidden] { display: none; }

.gxv-top {
    display: flex; align-items: center; justify-content: space-between;
    padding: 14px clamp(16px, 3vw, 32px);
}
.gxv-count {
    font-size: 14px;
    color: var(--on-dark-soft);
    font-variant-numeric: tabular-nums;
}

.gxv-btn {
    display: grid; place-items: center;
    width: 46px; height: 46px;
    border: 1px solid rgba(244, 239, 228, .28);
    border-radius: 50%;
    color: var(--on-dark);
    transition: border-color .2s, color .2s;
}
.gxv-btn svg { width: 20px; height: 20px; }
.gxv-btn:hover { border-color: var(--gold); color: var(--gold); }
.gxv-btn:focus-visible { outline: 2px solid var(--gold-bright); outline-offset: 3px; }

.gxv-stage {
    position: relative;
    min-height: 0;
    padding: 0 clamp(64px, 9vw, 120px);
}
.gxv-stage img {
    display: block;
    width: 100%; height: 100%;
    object-fit: contain;
    transition: opacity .25s ease;
}
.gxv-stage img.is-swap { opacity: 0; }

.gxv-prev, .gxv-next { position: absolute; top: 50%; transform: translateY(-50%); }
.gxv-prev { left: clamp(10px, 2.5vw, 32px); }
.gxv-next { right: clamp(10px, 2.5vw, 32px); }

.gxv-cap {
    padding: 16px 20px 26px;
    text-align: center;
}
.gxv-place { display: block; font-family: var(--serif); font-size: clamp(20px, 2.2vw, 26px); }
.gxv-note  { display: block; margin-top: 3px; font-size: 14px; color: var(--on-dark-soft); }

@media (max-width: 720px) {
    .gxv-stage { padding: 0 8px; }
    .gxv-prev, .gxv-next { background: rgba(7, 19, 32, .6); }
}

@media (prefers-reduced-motion: reduce) {
    .gx-btn img, .gxv-stage img, .gxv-btn { transition: none; }
}