/* ===== Hero ===== */
.tours-hero {
    position: relative;
    min-height: 30vh;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 6rem 5% 4rem;
    overflow: hidden;
    background-color: var(--forest-dark);
}

.tours-hero::before {
    content: "";
    position: absolute;
    inset: 0;
    background: url("../assets/images/panama-city/panama-skyline.jpg") center / cover no-repeat;
}

.tours-hero::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(1, 1, 1, .2) 0%, rgba(1, 1, 1, .2) 78%, var(--hero-fade, var(--forest-dark)) 100%);
}

.tours-hero-inner {
    position: relative;
    z-index: 1;
}

.tours-hero h1 {
    font-size: clamp(2.8rem, 8vw, 5.5rem);
    color: var(--white);
    text-transform: uppercase;
    line-height: 1;
    margin-bottom: 1rem;
    text-shadow: 0 4px 30px rgba(0, 0, 0, 0.4);
}

.tours-hero-kicker {
    display: inline-block;
    font-size: 0.9rem;
    font-weight: 700;
    letter-spacing: 3px;
    text-transform: uppercase;
    color: var(--forest-dark);
    background: var(--golden-frog);
    padding: 0.4rem 1rem;
    border-radius: 999px;
    margin-bottom: 1.5rem;
}

.tours-hero-sub {
    font-size: clamp(1.1rem, 2.5vw, 1.5rem);
    color: var(--golden-frog);
    letter-spacing: 2px;
    text-transform: uppercase;
}

/* ===== Filter bar ===== */
.tour-filters {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.75rem;
    padding: 1rem 5% 0.5rem;
    background-color: var(--forest-dark);
}

.tour-filter {
    font-family: var(--font-primary);
    font-size: 1rem;
    font-weight: 700;
    color: var(--white);
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--forest-light);
    border-radius: 999px;
    padding: 0.55rem 1.2rem;
    cursor: pointer;
    transition: all 0.25s ease;
}

.tour-filter:hover {
    border-color: var(--golden-frog);
}

.tour-filter.active {
    background: var(--golden-frog);
    border-color: var(--golden-frog);
    color: var(--forest-dark);
}

/* ===== Bento grid ===== */
.tours-list-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    grid-auto-rows: 270px;
    grid-auto-flow: dense;
    gap: 1.25rem;
    padding: 2rem 5% 4rem;
    background-color: var(--forest-dark);
}

.tour-card--feature {
    grid-column: span 2;
    grid-row: span 2;
}

.tour-card--wide {
    grid-column: span 2;
}

.tour-card--tall {
    grid-row: span 2;
}

.tour-card--full {
    grid-column: 1 / -1;
}

.tour-list-card,
.tour-cta-card {
    position: relative;
    border-radius: 18px;
    overflow: hidden;
    isolation: isolate;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
    transition: transform 0.4s ease, box-shadow 0.4s ease;
}

.tour-list-card {
    cursor: pointer;
    color: var(--white);
}

.tour-list-card.is-hidden {
    display: none;
}

.tour-list-card:hover,
.tour-list-card:focus-visible,
.tour-cta-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.5), 0 0 0 2px var(--golden-frog);
    outline: none;
}

/* Photo layers */
.tour-card-img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: -2;
    transition: transform 1.2s ease, opacity 0.8s ease;
}

.tour-card-img--alt {
    opacity: 0;
}

.tour-list-card:hover .tour-card-img,
.tour-list-card:focus-visible .tour-card-img {
    transform: scale(1.08);
}

.tour-list-card:hover .tour-card-img--alt,
.tour-list-card:focus-visible .tour-card-img--alt {
    opacity: 1;
}

.tour-list-card::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -1;
    background: linear-gradient(180deg, rgba(0, 0, 0, 0) 35%, rgba(5, 18, 12, 0.92) 100%);
    transition: background 0.4s ease;
}

.tour-list-card:hover::after,
.tour-list-card:focus-visible::after {
    background: linear-gradient(180deg, rgba(0, 0, 0, 0.1) 10%, rgba(5, 18, 12, 0.95) 100%);
}

/* Outlined numeral */
.tour-card-num {
    position: absolute;
    top: 0.75rem;
    right: 1.1rem;
    font-family: var(--font-heading);
    font-size: 3rem;
    font-weight: 800;
    line-height: 1;
    color: transparent;
    -webkit-text-stroke: 2px rgba(255, 255, 255, 0.85);
    text-shadow: 0 2px 12px rgba(0, 0, 0, 0.3);
}

.tour-card--feature .tour-card-num {
    font-size: 5rem;
}

/* Text overlay */
.tour-card-body {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 1.4rem;
}

.tour-card-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-bottom: 0.6rem;
}

.tour-tag {
    font-size: 0.8rem;
    font-weight: 700;
    padding: 0.25rem 0.7rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.16);
    backdrop-filter: blur(6px);
    border: 1px solid rgba(255, 255, 255, 0.25);
}

.tour-list-title {
    font-size: 1.45rem;
    color: var(--white);
    line-height: 1.15;
    margin-bottom: 0;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
}

.tour-card--feature .tour-list-title {
    font-size: clamp(1.8rem, 3vw, 2.6rem);
}

/* Description + CTA reveal on hover */
.tour-list-desc,
.tour-card-cta {
    max-height: 0;
    opacity: 0;
    overflow: hidden;
    transition: max-height 0.45s ease, opacity 0.35s ease, margin 0.45s ease;
}

.tour-list-desc {
    font-size: 1rem;
    line-height: 1.5;
    color: #E6E6E6;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
}

.tour-card-cta {
    display: inline-block;
    font-weight: 800;
    color: var(--golden-frog);
}

.tour-list-card:hover .tour-list-desc,
.tour-list-card:focus-visible .tour-list-desc {
    max-height: 6rem;
    opacity: 1;
    margin-top: 0.5rem;
}

.tour-list-card:hover .tour-card-cta,
.tour-list-card:focus-visible .tour-card-cta {
    max-height: 2rem;
    opacity: 1;
    margin-top: 0.6rem;
}

/* Feature cards: larger description text (still revealed on hover) */
.tour-card--feature .tour-list-desc {
    font-size: 1.1rem;
}

/* Custom tour CTA card */
.tour-cta-card {
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 1.5rem;
    text-decoration: none;
    color: var(--forest-dark);
    background: linear-gradient(135deg, var(--golden-frog), var(--golden-dark));
}

.tour-cta-card h3 {
    font-size: 1.6rem;
    color: var(--forest-dark);
    margin: 0.4rem 0;
}

.tour-cta-card p {
    font-size: 1rem;
    line-height: 1.4;
}

.tour-cta-card .tour-card-cta {
    max-height: none;
    opacity: 1;
    margin-top: 0.8rem;
    color: var(--forest-dark);
}

.tour-cta-icon {
    font-size: 2rem;
}

/* Scroll reveal (class added by JS so cards stay visible without it) */
.reveal-ready .tour-list-card,
.reveal-ready .tour-cta-card {
    opacity: 0;
    transform: translateY(40px);
}

.reveal-ready .is-visible {
    opacity: 1;
    transform: none;
    transition: opacity 0.7s ease var(--delay, 0ms),
        transform 0.7s ease var(--delay, 0ms),
        box-shadow 0.4s ease;
}

.reveal-ready .is-visible:hover,
.reveal-ready .is-visible:focus-visible {
    transform: translateY(-6px);
    transition: transform 0.4s ease, box-shadow 0.4s ease;
}

/* Responsive */
@media (max-width: 1024px) {
    .tours-list-grid {
        grid-template-columns: repeat(2, 1fr);
        grid-auto-rows: 250px;
    }
}

@media (max-width: 600px) {
    /* Cards are near-square here: keep the top of vertical photos (faces, heads) in frame */
    .tour-card-img {
        object-position: 50% 25%;
    }

    .tours-list-grid {
        grid-template-columns: 1fr;
        grid-auto-rows: 320px;
        padding: 1.5rem 16px 3rem;
    }

    .tour-card--feature,
    .tour-card--wide,
    .tour-card--tall {
        grid-column: auto;
        grid-row: auto;
    }

    .tour-card--feature .tour-card-num {
        font-size: 3rem;
    }

    /* No hover on touch: always show description */
    .tour-list-card .tour-list-desc {
        max-height: 6rem;
        opacity: 1;
        margin-top: 0.5rem;
    }

    .tour-cta-card {
        min-height: 220px;
    }

    .tours-hero {
        padding: 5rem 16px 3rem;
    }

    .tours-hero-kicker {
        font-size: 0.75rem;
        letter-spacing: 1.5px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .tours-hero::before {
        animation: none;
    }

    .reveal-ready .tour-list-card,
    .reveal-ready .tour-cta-card {
        opacity: 1;
        transform: none;
    }

    .tour-card-img {
        transition: none;
    }
}


/* ===== Tour modal ===== */
.modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 2.5vh 2.5vw;
    background: rgba(5, 15, 10, 0.82);
    backdrop-filter: blur(10px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.35s ease;
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.modal-content {
    position: relative;
    width: 100%;
    max-width: 1500px;
    height: 100%;
    max-height: 920px;
    display: grid;
    grid-template-columns: 1.45fr 1fr;
    border-radius: 24px;
    overflow: hidden;
    background: var(--forest-dark);
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(244, 208, 63, 0.25);
    transform: translateY(30px) scale(0.96);
    transition: transform 0.45s cubic-bezier(0.2, 0.9, 0.3, 1.15);
}

.modal-overlay.active .modal-content {
    transform: none;
}

.modal-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    z-index: 10;
    width: 44px;
    height: 44px;
    display: grid;
    place-items: center;
    /* Hide the × glyph (its font metrics sit off-center); draw the X with pseudo-elements */
    font-size: 0;
    color: var(--white);
    background: rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(6px);
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 50%;
    cursor: pointer;
    transition: background 0.3s ease, color 0.3s ease, transform 0.3s ease;
}

.modal-close::before,
.modal-close::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 18px;
    height: 2px;
    margin: -1px 0 0 -9px;
    border-radius: 2px;
    background: currentColor;
    transform: rotate(45deg);
}

.modal-close::after {
    transform: rotate(-45deg);
}

.modal-close:hover,
.modal-close:focus-visible {
    background: var(--golden-frog);
    color: var(--forest-dark);
    transform: rotate(90deg);
    outline: none;
}

/* Gallery (left) */
.modal-gallery {
    position: relative;
    min-height: 0;
    background: #000;
    isolation: isolate;
    /* Clip the slide zoom so it can't spill into the details panel */
    overflow: hidden;
}

.carousel-container {
    position: absolute;
    inset: 0;
}

.carousel-track {
    position: absolute;
    inset: 0;
    z-index: -1;
}

.carousel-slide {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0;
    transform: scale(1.06);
    transition: opacity 0.7s ease, transform 6s ease-out;
}

.carousel-slide.active {
    opacity: 1;
    transform: scale(1);
}

.modal-gallery::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    background: linear-gradient(180deg, rgba(0, 0, 0, 0.25) 0%, rgba(0, 0, 0, 0) 30%, rgba(5, 18, 12, 0.35) 60%, rgba(5, 18, 12, 0.92) 100%);
}

.carousel-btn {
    position: absolute;
    top: 45%;
    transform: translateY(-50%);
    width: 52px;
    height: 52px;
    display: grid;
    place-items: center;
    font-size: 1.3rem;
    color: var(--white);
    background: rgba(0, 0, 0, 0.35);
    backdrop-filter: blur(6px);
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 50%;
    cursor: pointer;
    transition: background 0.3s ease, color 0.3s ease;
}

.carousel-btn:hover,
.carousel-btn:focus-visible {
    background: var(--golden-frog);
    color: var(--forest-dark);
    outline: none;
}

.carousel-prev { left: 1.2rem; }
.carousel-next { right: 1.2rem; }

/* Hide the ❮ ❯ glyphs (font metrics sit off-center); draw a chevron instead */
.carousel-btn {
    font-size: 0;
}

.carousel-btn::before {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 10px;
    height: 10px;
    border-top: 2px solid currentColor;
    border-left: 2px solid currentColor;
    /* The arms fill only one half of the rotated 12px box (±4.25px from its
       center), so shift the box that far the other way to center the chevron */
    transform: translate(calc(-50% + 4.25px), -50%) rotate(-45deg);
}

.carousel-next::before {
    transform: translate(calc(-50% - 4.25px), -50%) rotate(135deg);
}

.carousel-counter {
    position: absolute;
    top: 1.3rem;
    left: 1.3rem;
    padding: 0.3rem 0.8rem;
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--white);
    background: rgba(0, 0, 0, 0.45);
    border-radius: 999px;
}

.single-photo .carousel-btn,
.single-photo .carousel-counter,
.single-photo .carousel-thumbs {
    display: none;
}

.modal-hero-text {
    position: absolute;
    left: 2.5rem;
    right: 2.5rem;
    bottom: 6.5rem;
    color: var(--white);
    pointer-events: none;
}

.single-photo .modal-hero-text {
    bottom: 2.5rem;
}

.modal-num {
    display: block;
    font-family: var(--font-heading);
    font-size: clamp(3.5rem, 7vw, 6rem);
    font-weight: 800;
    line-height: 0.9;
    color: transparent;
    -webkit-text-stroke: 2px var(--golden-frog);
}

.modal-region {
    margin: 0.6rem 0 0.2rem;
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: uppercase;
    font-size: 0.95rem;
    color: var(--golden-frog);
}

.modal-title {
    font-size: clamp(2.2rem, 4.5vw, 3.8rem);
    line-height: 1.05;
    color: var(--white);
    margin: 0;
    text-shadow: 0 4px 24px rgba(0, 0, 0, 0.5);
}

.carousel-thumbs {
    position: absolute;
    left: 2.5rem;
    bottom: 1.6rem;
    display: flex;
    gap: 0.6rem;
}

.carousel-thumb {
    width: 76px;
    height: 52px;
    border-radius: 10px;
    border: 2px solid rgba(255, 255, 255, 0.4);
    background-size: cover;
    background-position: center;
    opacity: 0.6;
    cursor: pointer;
    transition: opacity 0.3s ease, border-color 0.3s ease, transform 0.3s ease;
}

.carousel-thumb:hover,
.carousel-thumb.active {
    opacity: 1;
    border-color: var(--golden-frog);
    transform: translateY(-3px);
}

/* Details (right) */
.modal-details {
    display: flex;
    flex-direction: column;
    min-height: 0;
    color: var(--white);
    background:
        radial-gradient(circle at 100% 0%, rgba(244, 208, 63, 0.08), transparent 45%),
        var(--forest-dark);
}

.modal-scroll {
    flex: 1;
    overflow-y: auto;
    padding: 4rem 2.5rem 1.5rem;
    scrollbar-width: thin;
    scrollbar-color: var(--forest-light) transparent;
}

.modal-tags {
    margin-bottom: 1.2rem;
}

.modal-desc {
    font-size: 1.1rem;
    line-height: 1.7;
    color: #E6E6E6;
    margin-bottom: 2rem;
}

.modal-desc p + p {
    margin-top: 0.9em;
}

/* Duration chip (clock + hours), like the flyers */
.modal-duration {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1.1rem;
    padding: 0.4rem 0.95rem;
    border: 1px solid var(--golden-frog);
    border-radius: 999px;
    font-weight: 700;
    color: var(--white);
}

.modal-duration[hidden] {
    display: none;
}

.modal-duration svg {
    width: 1.1em;
    height: 1.1em;
    fill: none;
    stroke: var(--golden-frog);
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* Main highlights: circled icon + title + one line */
.modal-highlights {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 1.1rem;
    margin-bottom: 1rem;
}

.modal-highlights li {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
}

.modal-highlight-icon {
    flex: 0 0 auto;
    display: grid;
    place-items: center;
    width: 52px;
    height: 52px;
    border: 1.5px solid var(--golden-frog);
    border-radius: 50%;
    color: var(--golden-frog);
}

.modal-highlight-icon svg {
    width: 26px;
    height: 26px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.6;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.modal-highlights h3 {
    font-size: 1rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--white);
    margin: 0.35rem 0 0.2rem;
}

.modal-highlights p {
    font-size: 0.98rem;
    line-height: 1.5;
    color: #CFCFCF;
}

/* Tours without photos yet: warm gradient + big emoji instead of an image */
.tour-card--no-photo,
.no-photo .modal-gallery {
    background:
        radial-gradient(circle at 70% 25%, rgba(244, 208, 63, 0.25), transparent 55%),
        linear-gradient(135deg, #5a3321, #2b170e);
}

.tour-card-emoji {
    position: absolute;
    top: 38%;
    left: 50%;
    z-index: -1;
    transform: translate(-50%, -50%);
    font-size: 5rem;
    filter: drop-shadow(0 10px 20px rgba(0, 0, 0, 0.4));
    transition: transform 0.6s ease;
}

.tour-list-card:hover .tour-card-emoji {
    transform: translate(-50%, -50%) rotate(-8deg) scale(1.1);
}

.modal-footer {
    padding: 1.2rem 2.5rem 1.5rem;
    border-top: 1px solid var(--forest-green);
    background: rgba(0, 0, 0, 0.2);
    text-align: center;
}

.modal-book {
    display: block;
    width: 100%;
    font-size: 1.1rem;
    padding: 1.1rem 1.5rem;
}

.modal-footnote {
    margin-top: 0.7rem;
    font-size: 0.9rem;
    color: #AAA;
}

/* Tablet / phone: stack photo on top, full screen */
@media (max-width: 900px) {
    .modal-overlay {
        padding: 0;
    }

    /* Vertical photos: show the whole frame over a blurred copy instead of cropping heads and subjects */
    .carousel-backdrop {
        position: absolute;
        inset: -30px;
        background-size: cover;
        background-position: center;
        filter: blur(24px) brightness(0.55);
    }

    .carousel-slide.is-portrait {
        object-fit: contain;
    }

    .modal-content {
        max-height: none;
        /* dvh tracks the mobile browser toolbar so the footer is never hidden */
        height: 100dvh;
        border-radius: 0;
        grid-template-columns: 1fr;
        grid-template-rows: 40% 1fr;
    }

    .modal-hero-text {
        left: 1.5rem;
        right: 1.5rem;
        bottom: 5rem;
    }

    /* Horizontal swipes go to the photo carousel instead of being eaten by page scroll */
    .modal-gallery {
        touch-action: pan-y;
    }

    /* Thumbs stop short of the arrows and scroll sideways when there are many */
    .carousel-thumbs {
        left: 1.5rem;
        right: 7rem;
        bottom: 1.1rem;
        padding-top: 4px;
        overflow-x: auto;
        scrollbar-width: none;
    }

    .carousel-thumbs::-webkit-scrollbar {
        display: none;
    }

    .carousel-thumb {
        flex: none;
    }

    .carousel-thumb {
        width: 56px;
        height: 40px;
    }

    .carousel-btn {
        width: 42px;
        height: 42px;
    }

    /* Arrows sit bottom-right, level with the thumbs, so they don't cover the title */
    .carousel-btn {
        top: auto;
        bottom: 1.1rem;
        transform: none;
    }

    .carousel-prev { left: auto; right: 3.9rem; }
    .carousel-next { right: 1.2rem; }

    .modal-scroll {
        padding: 1.5rem 1.5rem 1rem;
    }

    .modal-desc {
        font-size: 1.05rem;
        line-height: 1.6;
        margin-bottom: 1.5rem;
    }

    .modal-footer {
        padding: 0.8rem 1.5rem calc(0.8rem + env(safe-area-inset-bottom));
    }

    .modal-book {
        font-size: 0.9rem;
        letter-spacing: 0.5px;
        padding: 0.8rem 1rem;
        box-shadow: 0 3px 10px rgba(244, 208, 63, 0.3);
    }

    .modal-footnote {
        margin-top: 0.5rem;
        font-size: 0.8rem;
    }
}

@media (max-width: 480px) {
    .modal-hero-text {
        left: 1.2rem;
        right: 1.2rem;
        bottom: 4.4rem;
    }

    .carousel-thumbs {
        left: 1.2rem;
    }

    .modal-num {
        font-size: 2.4rem;
        -webkit-text-stroke-width: 1.5px;
    }

    .modal-region {
        font-size: 0.8rem;
        margin-top: 0.4rem;
    }

    .modal-title {
        font-size: 1.9rem;
    }

    .modal-scroll {
        padding: 1.2rem 1.2rem 1rem;
    }

    .modal-footer {
        padding-left: 1.2rem;
        padding-right: 1.2rem;
    }

    .modal-close {
        width: 40px;
        height: 40px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .modal-content,
    .carousel-slide {
        transition: opacity 0.2s ease;
        transform: none;
    }
}
