/* ==========================================================================
   Moments from Our Trips: photographic field journal
   ========================================================================== */

/* The page extends the established Peru Summit palette and clips media motion. */
.trips-gallery-page {
    --trips-ink: #171717;
    --trips-copy: #5d5d5d;
    --trips-muted: #818181;
    --trips-line: #e8e8e4;
    --trips-paper: #f7f7f5;
    --trips-red: #f10100;
    overflow: clip;
    background-color: #ffffff;
}

/* Every page-level h2 follows the agreed fixed scale without a width cap. */
.trips-gallery-page h2 {
    max-width: none;
    font-size: 2.4rem;
}

/* Hero photography stays legible beneath the shared semitransparent overlay. */
.trips-gallery-page .tour-category-hero-image {
    object-position: center 48%;
}

/* Brand selection styling completes the browser surface. */
.trips-gallery-body ::selection {
    background-color: #f10100;
    color: #ffffff;
}

/* Page links and gallery controls receive a visible keyboard focus ring. */
.trips-gallery-body a:focus-visible,
.trips-gallery-body button:focus-visible {
    outline: 3px solid rgba(241, 1, 0, 0.34);
    outline-offset: 4px;
}

/* The page scrollbar uses the established neutral and red palette. */
.trips-gallery-body {
    scrollbar-color: #f10100 #f0f0ed;
    scrollbar-width: thin;
}

/* WebKit scrollbars preserve the same restrained browser treatment. */
.trips-gallery-body::-webkit-scrollbar {
    width: 10px;
}

.trips-gallery-body::-webkit-scrollbar-track {
    background-color: #f0f0ed;
}

.trips-gallery-body::-webkit-scrollbar-thumb {
    border: 2px solid #f0f0ed;
    border-radius: 7px;
    background-color: #f10100;
}

/* ==========================================================================
   Gallery introduction
   ========================================================================== */

/* The introduction opens with a concise bilingual statement and no card shell. */
.trip-gallery-intro {
    padding: clamp(4rem, 8vw, 7rem) 0 clamp(3rem, 6vw, 5rem);
    background-color: #ffffff;
}

/* The introduction uses an editorial two-column composition at wide viewports. */
.trip-gallery-intro-layout {
    display: grid;
    grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
    gap: clamp(2rem, 7vw, 7rem);
    align-items: end;
}

/* The supplied gallery title owns the hierarchy at the agreed h2 scale. */
.trip-gallery-intro h2 {
    margin: 0;
    color: var(--trips-ink);
    font-family: "Metromedium", "Roboto", sans-serif;
    font-size: 2.4rem;
    font-weight: 500;
    letter-spacing: -0.025em;
    line-height: 1.05;
    text-wrap: balance;
}

/* The supplied Spanish translation remains quiet but prominent enough to orient readers. */
.trip-gallery-intro p {
    max-width: 65ch;
    margin: 0;
    color: var(--trips-copy);
    font-size: clamp(1rem, 1.6vw, 1.25rem);
    line-height: 1.7;
}

/* A full horizontal rule separates the introduction without a forbidden text rail. */
.trip-gallery-intro-rule {
    grid-column: 1 / -1;
    width: 100%;
    height: 1px;
    margin-top: clamp(1.5rem, 3vw, 2.5rem);
    background-color: var(--trips-line);
}

/* ==========================================================================
   Fancybox gallery chapters
   ========================================================================== */

/* Gallery chapters alternate quiet surfaces while retaining one shared rhythm. */
.trip-gallery-chapter {
    padding: clamp(4rem, 8vw, 7.5rem) 0;
    scroll-margin-top: 96px;
    background-color: var(--trips-paper);
}

/* The middle chapter reverses to white to pace the photographic story. */
.trip-gallery-chapter:nth-of-type(even) {
    background-color: #ffffff;
}

/* Chapter titles and bilingual descriptions remain open rather than carded. */
.trip-gallery-chapter-heading {
    display: grid;
    grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
    gap: clamp(1.5rem, 6vw, 6rem);
    align-items: end;
    padding-bottom: clamp(2rem, 4vw, 3.5rem);
}

/* All chapter h2 titles use the required size and unrestricted measure. */
.trip-gallery-chapter-heading h2 {
    max-width: none;
    margin: 0;
    color: var(--trips-ink);
    font-family: "Metromedium", "Roboto", sans-serif;
    font-size: 2.4rem;
    font-weight: 500;
    letter-spacing: -0.025em;
    line-height: 1.05;
    text-wrap: balance;
}

/* Supplied Spanish chapter text uses the body face and readable contrast. */
.trip-gallery-chapter-heading p {
    max-width: 65ch;
    margin: 0;
    color: var(--trips-copy);
    font-size: 1rem;
    line-height: 1.7;
}

/* The five-image field-journal grid gives each gallery a memorable lead frame. */
.trip-gallery-grid {
    display: grid;
    grid-template-columns: repeat(12, minmax(0, 1fr));
    grid-template-rows: repeat(3, clamp(180px, 19vw, 285px));
    gap: clamp(0.8rem, 1.4vw, 1.25rem);
}

/* Every gallery link clips its photograph to the project-wide radius. */
.trip-gallery-item {
    position: relative;
    display: block;
    min-width: 0;
    overflow: hidden;
    border-radius: 7px;
    background-color: var(--trips-line);
    color: #ffffff;
    cursor: zoom-in;
}

/* The lead photograph occupies two rows to anchor each chapter. */
.trip-gallery-item.is-lead {
    grid-column: 1 / span 7;
    grid-row: 1 / span 2;
}

/* Two compact photographs form the right-hand journal column. */
.trip-gallery-item.is-landscape,
.trip-gallery-item.is-portrait {
    grid-column: 8 / span 5;
}

.trip-gallery-item.is-landscape {
    grid-row: 1;
}

.trip-gallery-item.is-portrait {
    grid-row: 2;
}

/* The final row balances a compact detail with a wider closing scene. */
.trip-gallery-item.is-detail {
    grid-column: 1 / span 5;
    grid-row: 3;
}

.trip-gallery-item.is-wide {
    grid-column: 6 / span 7;
    grid-row: 3;
}

/* Additional ACF photographs continue below the opening five-frame composition. */
.trip-gallery-item.is-extra {
    grid-column: span 4;
    min-height: clamp(180px, 19vw, 285px);
}

/* Figures fill the link so Fancybox targets have stable dimensions. */
.trip-gallery-figure {
    position: absolute;
    inset: 0;
    margin: 0;
}

/* Authentic photography fills each journal frame with a controlled crop. */
.trip-gallery-figure img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 480ms cubic-bezier(0.16, 1, 0.3, 1);
}

/* A lower image shade keeps visible captions readable on varied photography. */
.trip-gallery-figure::after {
    position: absolute;
    inset: 42% 0 0;
    background: linear-gradient(180deg, rgba(9, 12, 13, 0), rgba(9, 12, 13, 0.78));
    content: "";
    pointer-events: none;
}

/* Visible captions name each photograph and expose the expand action. */
.trip-gallery-figure figcaption {
    position: absolute;
    z-index: 1;
    right: 0;
    bottom: 0;
    left: 0;
    display: flex;
    gap: 1rem;
    align-items: flex-end;
    justify-content: space-between;
    padding: clamp(1rem, 2vw, 1.5rem);
    color: #ffffff;
    font-size: 1rem;
    font-weight: 700;
    line-height: 1.35;
}

/* Caption icons use the same 7px control geometry as the rest of the site. */
.trip-gallery-figure figcaption i {
    display: grid;
    flex: 0 0 38px;
    width: 38px;
    height: 38px;
    border-radius: 7px;
    background-color: rgba(255, 255, 255, 0.16);
    place-items: center;
}

/* Fine-pointer hover provides one restrained, photographic motion language. */
@media (hover: hover) and (pointer: fine) {
    .trip-gallery-item:hover .trip-gallery-figure img {
        transform: scale(1.045);
    }
}

/* The photographic closing section retains the required h2 scale. */
.trips-gallery-page .welcome-planning-content h2 {
    max-width: none;
    font-size: 2.4rem;
    line-height: 1.08;
}

/* ==========================================================================
   Fancybox surface adjustments
   ========================================================================== */

/* Fancybox controls inherit the single project radius instead of circular chrome. */
.trips-gallery-body .f-button,
.trips-gallery-body .f-thumbs__slide__button,
.trips-gallery-body .fancybox__content,
.trips-gallery-body .fancybox__content > img {
    border-radius: 7px;
}

/* Fancybox caption copy stays readable over the dark lightbox surface. */
.trips-gallery-body .fancybox__caption {
    color: #ffffff;
    font-family: "Roboto", Arial, Helvetica, sans-serif;
    line-height: 1.55;
}

/* ==========================================================================
   Responsive layout
   ========================================================================== */

/* Tablet layouts simplify the heading pair while keeping the mosaic composition. */
@media (max-width: 991.98px) {
    .trip-gallery-intro-layout,
    .trip-gallery-chapter-heading {
        grid-template-columns: minmax(0, 1fr);
        gap: 1rem;
    }

    .trip-gallery-intro-rule {
        margin-top: 1.25rem;
    }

    .trip-gallery-grid {
        grid-template-rows: repeat(3, clamp(170px, 25vw, 235px));
    }
}

/* Mobile galleries become one readable image stream without horizontal overflow. */
@media (max-width: 767.98px) {
    .trip-gallery-intro,
    .trip-gallery-chapter {
        padding: 3.5rem 0;
    }

    .trip-gallery-intro h2,
    .trip-gallery-chapter-heading h2,
    .trips-gallery-page .welcome-planning-content h2,
    .trips-gallery-page h2 {
        max-width: none;
        font-size: 2.4rem;
    }

    .trip-gallery-grid {
        grid-template-columns: minmax(0, 1fr);
        grid-template-rows: none;
        gap: 0.85rem;
    }

    .trip-gallery-item.is-lead,
    .trip-gallery-item.is-landscape,
    .trip-gallery-item.is-portrait,
    .trip-gallery-item.is-detail,
    .trip-gallery-item.is-wide,
    .trip-gallery-item.is-extra {
        grid-column: 1;
        grid-row: auto;
        aspect-ratio: 4 / 3;
    }

    .trip-gallery-item.is-portrait {
        aspect-ratio: 4 / 5;
    }
}

/* Reduced-motion visitors receive the complete gallery without image animation. */
@media (prefers-reduced-motion: reduce) {
    .trip-gallery-figure img {
        transition: none;
    }
}
