html.motion {
    scroll-behavior: smooth;
}

/* Progress Bar */
.trip-progress {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    z-index: 20;
    pointer-events: none;
}

.trip-progress span {
    display: block;
    height: 100%;
    background: rgba(var(--blue), 1);
    box-shadow: 0 0 12px rgba(var(--blue), 0.6);
    transform-origin: left;
    transform: scaleX(var(--progress, 0));
}

/* Hero */
.trip-hero {
    position: relative;
    height: 92vh;
    height: 92svh;
    min-height: 520px;
    --hero-h: max(92svh, 520px);
    overflow: hidden;
    color: rgba(var(--white), 1);
    background: rgba(var(--black), 1);
}

.trip-hero-media {
    position: absolute;
    inset: -6% 0 0 0;
    will-change: transform;
}

.trip-hero-media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.trip-hero-shade {
    position: absolute;
    inset: 0;
    background:
        linear-gradient(to bottom, rgba(0, 0, 0, 0.45) 0%, rgba(0, 0, 0, 0) 30%),
        linear-gradient(to top, rgba(0, 0, 0, 0.75) 0%, rgba(0, 0, 0, 0.15) 55%, rgba(0, 0, 0, 0) 100%);
}

.trip-back {
    position: absolute;
    top: 28px;
    left: 32px;
    z-index: 2;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 9px 16px;
    border-radius: 999px;
    font-size: 0.9rem;
    color: rgba(var(--white), 1);
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.25);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    transition: background 0.4s var(--ease-out-quart), transform 0.4s var(--ease-out-quint);
}

.trip-back:hover {
    color: rgba(var(--white), 1);
    background: rgba(255, 255, 255, 0.24);
    transform: translateX(-3px);
}

.trip-hero-content {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 32px 72px;
    will-change: transform, opacity;
}

.trip-kicker {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 18px;
    font-size: 0.8rem;
    letter-spacing: 3px;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.85);
}

.trip-kicker::before {
    content: "";
    width: 32px;
    height: 2px;
    background: rgba(var(--blue), 1);
}

.trip-hero h1 {
    margin: 0;
    font-family: 'Questrial', sans-serif;
    font-size: clamp(2.6rem, 7vw, 5.6rem);
    line-height: 1.02;
    letter-spacing: -1px;
    color: rgba(var(--white), 1);
    text-shadow: 0 2px 30px rgba(0, 0, 0, 0.35);
}

.trip-hero-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 26px;
}

.trip-hero-meta > span {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 7px 14px;
    border-radius: 999px;
    font-size: 0.9rem;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.trip-hero-meta i {
    color: rgba(var(--blue), 1);
}

.trip-scroll-cue {
    position: absolute;
    right: 32px;
    bottom: 72px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    font-size: 0.7rem;
    letter-spacing: 3px;
    text-transform: uppercase;
    writing-mode: vertical-rl;
    color: rgba(255, 255, 255, 0.7);
}

.trip-scroll-cue::after {
    content: "";
    width: 1px;
    height: 56px;
    background: linear-gradient(to bottom, rgba(255, 255, 255, 0.9), rgba(255, 255, 255, 0));
    animation: trip-cue 2.2s var(--ease-in-out-quad) infinite;
    transform-origin: top;
}

@keyframes trip-cue {
    0% { transform: scaleY(0); opacity: 1; }
    60% { transform: scaleY(1); opacity: 1; }
    100% { transform: scaleY(1); opacity: 0; }
}

/* Hero Entrance */
html.motion .trip-hero-media img {
    transform: scale(1.12);
}

html.motion .trip-hero [data-hero] {
    opacity: 0;
    transform: translate3d(0, 28px, 0);
}

html.motion.is-loaded .trip-hero-media img {
    transform: scale(1);
    transition: transform 2.8s var(--ease-out-quart);
}

html.motion.is-loaded .trip-hero [data-hero] {
    opacity: 1;
    transform: translate3d(0, 0, 0);
    transition:
        opacity 1s var(--ease-out-quint) var(--d, 0ms),
        transform 1.2s var(--ease-out-quint) var(--d, 0ms);
}

/* Hero Parallax (scroll-driven, runs off the main thread) */
@supports (animation-timeline: view()) {
    html.motion .trip-hero {
        view-timeline: --trip-hero block;
    }

    html.motion .trip-hero-media,
    html.motion .trip-hero-content {
        animation: linear both;
        animation-timeline: --trip-hero;
        animation-range: exit 0% exit 100%;
    }

    html.motion .trip-hero-media {
        animation-name: trip-hero-media;
    }

    html.motion .trip-hero-content {
        animation-name: trip-hero-content;
    }
}

@keyframes trip-hero-media {
    to { transform: translate3d(0, calc(var(--hero-h) * 0.35), 0); }
}

@keyframes trip-hero-content {
    71% { opacity: 0; }
    to { transform: translate3d(0, calc(var(--hero-h) * 0.15), 0); opacity: 0; }
}

/* Intro */
.trip-intro {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 72px 32px 24px;
}

.trip-intro-label,
.trip-next-label {
    font-size: 0.75rem;
    letter-spacing: 3px;
    text-transform: uppercase;
    color: rgba(var(--grey), 1);
}

.trip-chapter-list {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 16px;
    list-style: none;
}

.trip-chapter-list a {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 8px 16px 8px 8px;
    border-radius: 999px;
    font-size: 0.92rem;
    color: rgba(var(--black), 1);
    background: rgba(var(--light-grey), 0.5);
    border: 1px solid transparent;
    transition: border-color 0.4s var(--ease-out-quart), background 0.4s var(--ease-out-quart), transform 0.4s var(--ease-out-quint);
}

.trip-chapter-list a:hover {
    background: rgba(var(--white), 1);
    border-color: rgba(var(--blue), 0.6);
    transform: translateY(-2px);
}

.trip-chapter-list b {
    display: inline-grid;
    place-items: center;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    font-family: 'Questrial', sans-serif;
    font-size: 0.75rem;
    font-weight: normal;
    color: rgba(var(--white), 1);
    background: rgba(var(--blue), 1);
}

/* Chapters */
.trip-chapters {
    position: relative;
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 48px 32px 40px;
}

.trip-route {
    position: absolute;
    top: 48px;
    bottom: 40px;
    left: 50%;
    width: 2px;
    margin-left: -1px;
    background-image: linear-gradient(to bottom, rgba(var(--light-grey), 1) 50%, transparent 50%);
    background-size: 2px 12px;
}

.trip-route span {
    position: absolute;
    inset: 0;
    background: rgba(var(--blue), 1);
    transform-origin: top;
    transform: scaleY(var(--route, 0));
}

.chapter {
    position: relative;
    display: grid;
    grid-template-columns: 1fr 1fr;
    align-items: center;
    column-gap: 112px;
    padding: 56px 0;
    scroll-margin-top: 40px;
}

.chapter.is-flipped .chapter-media {
    order: 2;
}

.chapter-marker {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 16px;
    height: 16px;
    margin: -8px 0 0 -8px;
    border-radius: 50%;
    background: rgba(var(--white), 1);
    border: 2px solid rgba(var(--light-grey), 1);
    transition: border-color 0.5s var(--ease-out-quart), box-shadow 0.5s var(--ease-out-quart), transform 0.5s var(--ease-out-quint);
}

.chapter.is-passed .chapter-marker {
    border-color: rgba(var(--blue), 1);
    background: rgba(var(--blue), 1);
    box-shadow: 0 0 0 6px rgba(var(--blue), 0.15), 0 0 20px rgba(var(--blue), 0.5);
    transform: scale(1.1);
}

.chapter-media {
    position: relative;
    margin: 0;
    aspect-ratio: 1 / 1;
    border-radius: 18px;
    overflow: hidden;
    background: rgba(var(--light-grey), 0.6);
    box-shadow: 0 24px 50px -24px rgba(var(--black), 0.35);
}

.chapter-media img {
    position: absolute;
    inset: -6% 0;
    width: 100%;
    height: 112%;
    object-fit: cover;
    transform: translate3d(0, var(--shift, 0px), 0) scale(var(--zoom, 1));
    will-change: transform;
}

.chapter-copy {
    position: relative;
    z-index: 0;
    padding-top: 40px;
}

.chapter-num {
    position: absolute;
    top: -64px;
    left: -10px;
    z-index: -1;
    font-family: 'Questrial', sans-serif;
    font-size: 9rem;
    line-height: 1;
    color: transparent;
    -webkit-text-stroke: 1.5px rgba(var(--blue), 0.25);
    user-select: none;
}

.chapter-copy h2 {
    margin: 0 0 18px;
    font-size: clamp(1.7rem, 3vw, 2.3rem);
    line-height: 1.15;
}

.chapter-text p {
    margin: 0 0 14px;
    font-size: 1.06rem;
    line-height: 1.85;
}

.chapter-text strong {
    color: rgba(var(--black), 1);
}

.chapter-note {
    position: relative;
    margin: 30px 0 34px 12px;
    padding: 20px 24px;
    border-radius: 28px;
    background: rgba(var(--white), 1);
    border: 1px solid rgba(var(--light-grey), 1);
    box-shadow: 6px 6px 20px rgba(var(--light-grey), 0.6);
    transition: box-shadow 0.6s var(--ease-out-quart);
}

.chapter-note:hover {
    box-shadow: 6px 6px 24px rgba(var(--blue), 0.18);
}

/* Thought bubble tail */
.chapter-note::before,
.chapter-note::after {
    content: "";
    position: absolute;
    border-radius: 50%;
    background: rgba(var(--white), 1);
    border: 1px solid rgba(var(--light-grey), 1);
    box-shadow: 3px 3px 10px rgba(var(--light-grey), 0.6);
}

.chapter-note::before {
    left: 18px;
    bottom: -20px;
    width: 16px;
    height: 16px;
}

.chapter-note::after {
    left: 6px;
    bottom: -34px;
    width: 9px;
    height: 9px;
}

.chapter-note-label {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
    font-size: 0.72rem;
    letter-spacing: 2.5px;
    text-transform: uppercase;
    color: rgba(var(--blue), 1);
}

.chapter-note-label::before {
    content: "";
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: rgba(var(--blue), 1);
    box-shadow: 0 2px 12px 2px rgba(var(--blue), 0.5);
}

.chapter-note p {
    margin: 0;
    font-size: 0.98rem;
    line-height: 1.75;
    color: rgba(var(--black), 0.85);
}

/* Chapter Reveal */
html.motion .chapter-media {
    clip-path: inset(18% 18% 18% 18% round 18px);
    transition: clip-path 1.3s var(--ease-out-quint);
}

html.motion .chapter-media img {
    --zoom: 1.25;
    transition: transform 1.6s var(--ease-out-quint);
}

html.motion .chapter-copy > * {
    opacity: 0;
    transform: translate3d(0, 32px, 0);
    transition:
        opacity 0.9s var(--ease-out-quint) var(--d, 0ms),
        transform 1.1s var(--ease-out-quint) var(--d, 0ms);
}

html.motion .chapter-num {
    transform: translate3d(0, 60px, 0);
}

html.motion .chapter.is-in .chapter-media {
    clip-path: inset(0 0 0 0 round 18px);
}

html.motion .chapter.is-in .chapter-media img {
    --zoom: 1;
}

html.motion .chapter.is-in .chapter-copy > * {
    opacity: 1;
    transform: translate3d(0, 0, 0);
}

/* Once settled, parallax drives the image without easing lag */
html.motion .chapter.is-settled .chapter-media img {
    transition: none;
}

/* Next Trip */
.trip-next {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 40px 32px 100px;
}

.trip-next-card {
    position: relative;
    display: block;
    height: 340px;
    margin-top: 16px;
    border-radius: 22px;
    overflow: hidden;
    color: rgba(var(--white), 1);
    background: rgba(var(--black), 1);
}

.trip-next-card:hover {
    color: rgba(var(--white), 1);
}

.trip-next-card img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0.75;
    transition: transform 1.2s var(--ease-out-quint), opacity 0.6s var(--ease-out-quart);
}

.trip-next-card:hover img {
    transform: scale(1.06);
    opacity: 0.6;
}

.trip-next-body {
    position: absolute;
    inset: auto 0 0 0;
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 24px;
    padding: 32px 36px;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.7), rgba(0, 0, 0, 0));
}

.trip-next-body small {
    display: block;
    margin-bottom: 6px;
    font-size: 0.8rem;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.8);
}

.trip-next-body h3 {
    margin: 0;
    font-family: 'Questrial', sans-serif;
    font-size: clamp(1.6rem, 4vw, 2.6rem);
    color: rgba(var(--white), 1);
}

.trip-next-arrow {
    flex: none;
    display: grid;
    place-items: center;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    font-size: 1.2rem;
    color: rgba(var(--black), 1);
    background: rgba(var(--white), 1);
    transition: transform 0.6s var(--ease-out-quint), background 0.4s var(--ease-out-quart), color 0.4s var(--ease-out-quart);
}

.trip-next-card:hover .trip-next-arrow {
    transform: translateX(6px);
    background: rgba(var(--blue), 1);
    color: rgba(var(--white), 1);
}

.trip-next-links {
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 20px;
    font-size: 0.95rem;
}

.trip-next-links a {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: rgba(var(--grey), 1);
}

.trip-next-links a:hover {
    color: rgba(var(--blue), 1);
}

.trip-missing {
    padding: 140px 16px;
    text-align: center;
}

@media (max-width: 768px) {
    .trip-progress {
        display: none;
    }

    .trip-hero {
        min-height: 460px;
        --hero-h: max(92svh, 460px);
    }

    .trip-back {
        top: 16px;
        left: 16px;
    }

    .trip-hero-content {
        padding: 0 16px 48px;
    }

    .trip-scroll-cue {
        display: none;
    }

    .trip-intro {
        padding: 48px 16px 8px;
    }

    .trip-chapters {
        padding: 32px 16px 24px 44px;
    }

    .trip-route {
        left: 20px;
        top: 32px;
        bottom: 24px;
    }

    .chapter {
        grid-template-columns: 1fr;
        row-gap: 28px;
        padding: 36px 0;
    }

    .chapter.is-flipped .chapter-media {
        order: 0;
    }

    .chapter-marker {
        top: 36px;
        left: -24px;
        margin-top: 0;
    }

    .chapter-copy {
        padding-top: 28px;
    }

    .chapter-num {
        top: -42px;
        font-size: 6rem;
    }

    .chapter-text p {
        font-size: 1rem;
    }

    .trip-next {
        padding: 24px 16px 72px;
    }

    .trip-next-card {
        height: 260px;
    }

    .trip-next-body {
        padding: 22px;
    }

    .trip-next-arrow {
        width: 46px;
        height: 46px;
    }
}
