/* Homepage sections, in the order they appear. */

@layer pages {
    /* ---------- Hero ---------- */

    /* The portrait video fills phones and tablets; the landscape version takes over from 60rem. */
    .hero {
        position: relative;
        isolation: isolate;
        display: grid;
        align-items: end;
        min-height: max(44rem, calc(100svh - var(--chrome-height)));
        padding-block: var(--space-2xl) 3.5rem;
        overflow: hidden;
        color: var(--white);
        background: var(--navy);
    }

    .hero__media {
        position: absolute;
        inset: 0;
        z-index: -1;
        overflow: hidden;
    }

    .hero__media video {
        display: block;
        width: 100%;
        height: 100%;
        object-fit: cover;
        object-position: 62% 30%;
        animation: hero-settle 9s var(--ease-out) both;
    }

    @keyframes hero-settle {
        from {
            transform: scale(1.09);
        }
    }

    /* Safari's play button over a video it will not autoplay; the still below shows instead. */
    .hero__media video::-webkit-media-controls-start-playback-button {
        display: none !important;
        -webkit-appearance: none;
    }

    /* Set by hero-video.js when autoplay is refused: a still of the video's shot, cropped the same way. */
    .hero__media[data-autoplay-blocked] {
        background: url("../../images/hero/video-poster-mobile.webp") 62% 30% / cover no-repeat;
    }

    .hero__media[data-autoplay-blocked] video {
        visibility: hidden;
    }

    /* Darkens the lower part of the video where the text sits. */
    .hero__media::after {
        content: "";
        position: absolute;
        inset: 0;
        background: linear-gradient(to top, rgb(18 15 32 / 0.96) 8%, rgb(18 15 32 / 0.88) 36%, rgb(18 15 32 / 0.66) 54%, rgb(18 15 32 / 0.18) 64%, transparent 74%);
    }

    .hero__inner {
        position: relative;
    }

    .hero__copy {
        max-width: 41rem;
    }

    .hero__copy > * {
        animation: hero-rise 0.9s var(--ease-out) both;
    }

    .hero__copy > :nth-child(2) {
        animation-delay: 0.12s;
    }

    .hero__copy > :nth-child(3) {
        animation-delay: 0.24s;
    }

    .hero__copy > :nth-child(4) {
        animation-delay: 0.36s;
    }

    .hero__copy > :nth-child(5) {
        animation-delay: 0.48s;
    }

    @keyframes hero-rise {
        from {
            opacity: 0;
            transform: translateY(1.5rem);
        }
    }

    .hero__kicker {
        font-family: var(--font-display);
        font-size: var(--text-lg);
        color: var(--white);
        text-shadow: 0 0 1rem rgb(18 15 32 / 0.85), 0 1px 2px rgb(18 15 32 / 0.6);
    }

    .hero__title {
        margin-block: var(--space-sm) var(--space-lg);
        font-size: clamp(1.75rem, 0.6rem + 5vw, 4rem);
        line-height: 1.14;
        color: var(--white);
    }

    .hero__title span {
        color: var(--sand-pale);
    }

    .hero__text {
        display: none;
        max-width: 34rem;
        font-size: var(--text-lg);
        color: rgb(255 255 255 / 0.92);
    }

    .hero__actions {
        display: flex;
        flex-wrap: wrap;
        gap: var(--space-lg) var(--space-xl);
        align-items: center;
        margin-top: var(--space-xl);
    }

    .hero .button.button--hero-secondary {
        --button-ink: var(--navy);
        --button-background: var(--white);
        --button-fill: var(--sand);
        --button-fill-ink: var(--white);
    }

    .hero__price {
        margin-top: var(--space-lg);
        font-size: var(--text-sm);
        color: rgb(255 255 255 / 0.82);
    }

    @media (min-width: 45rem) {
        .hero__text {
            display: block;
        }
    }

    /* The landscape video is composed with its subject on the right-hand side. */
    @media (min-width: 60rem) {
        .hero {
            align-items: center;
            min-height: max(38rem, calc(100svh - var(--chrome-height)));
            padding-block: var(--space-3xl) 8.5rem;
        }

        .hero__media video {
            object-position: 70% 35%;
        }

        .hero__media[data-autoplay-blocked] {
            background-image: url("../../images/hero/video-poster-desktop.webp");
            background-position: 70% 35%;
        }

        .hero__media::after {
            background: linear-gradient(to right, rgb(18 15 32 / 0.92), rgb(18 15 32 / 0.72) 44%, rgb(18 15 32 / 0.1) 78%);
        }
    }

    /* ---------- Planner bar that overlaps the hero ---------- */

    .planner {
        position: relative;
        z-index: 2;
        margin-top: -1.5rem;
    }

    .planner__form {
        display: grid;
        gap: var(--space-md) var(--space-lg);
        align-items: end;
        padding: clamp(1.5rem, 1rem + 2vw, 2rem) clamp(1.25rem, 0.5rem + 3vw, 2.25rem);
        background: var(--sand);
        box-shadow: var(--shadow-lift);
    }

    .planner__title {
        font-size: 1.5rem;
        line-height: 1.25;
        color: var(--white);
    }

    .planner__field {
        display: grid;
        gap: 0.375rem;
    }

    .planner__field label {
        font-size: var(--text-sm);
        font-weight: 500;
        color: var(--white);
    }

    .planner__field select {
        border-color: var(--white);
    }

    @media (min-width: 40rem) {
        .planner__form {
            grid-template-columns: repeat(3, 1fr);
        }

        .planner__title {
            grid-column: 1 / -1;
        }

        .planner__form .button {
            grid-column: 1 / -1;
            justify-self: start;
        }
    }

    @media (min-width: 60rem) {
        .planner {
            margin-top: -4rem;
        }
    }

    @media (min-width: 66rem) {
        .planner__form {
            grid-template-columns: 11rem 1.4fr 1fr 0.7fr auto;
        }

        .planner__title,
        .planner__form .button {
            grid-column: auto;
        }

        .planner__title {
            align-self: center;
        }
    }

    /* ---------- Introduction ---------- */

    .intro__grid {
        display: grid;
        gap: var(--space-2xl);
        align-items: center;
    }

    .intro__copy h2 {
        margin-block: var(--space-sm) var(--space-lg);
    }

    .intro__copy p + p {
        margin-top: var(--space-md);
    }

    .intro__copy .feature-list {
        margin-block: var(--space-xl);
    }

    .tiles {
        display: grid;
        grid-auto-columns: 44%;
        grid-auto-flow: column;
        gap: 0.5rem;
        margin-top: clamp(2.5rem, 2rem + 2vw, 3.75rem);
        padding-bottom: var(--space-xs);
        overflow-x: auto;
        scroll-snap-type: x proximity;
        scrollbar-width: none;
    }

    .tile {
        position: relative;
        display: block;
        aspect-ratio: 19 / 20;
        overflow: hidden;
        scroll-snap-align: start;
        background: var(--navy);
    }

    .tile img {
        width: 100%;
        height: 100%;
        object-fit: cover;
        transition: transform var(--slow) var(--ease-out);
    }

    .tile::after {
        content: "";
        position: absolute;
        inset: 0;
        background: linear-gradient(transparent 45%, rgb(18 15 32 / 0.92));
    }

    .tile__label {
        position: absolute;
        inset: auto 0 var(--space-md);
        z-index: 1;
        font-family: var(--font-display);
        font-size: var(--text-lg);
        font-weight: 600;
        color: var(--white);
        text-align: center;
        transition: color var(--steady) var(--ease);
    }

    .tile:hover img {
        transform: scale(1.08);
    }

    .tile:hover .tile__label {
        color: var(--sand-pale);
    }

    @media (min-width: 40rem) {
        .tiles {
            grid-auto-columns: 1fr;
            overflow: visible;
        }
    }

    @media (min-width: 60rem) {
        .intro__grid {
            grid-template-columns: 5fr 6fr;
            gap: clamp(3rem, 6vw, 5.5rem);
        }

    }

    /* ---------- Activities tabs ---------- */

    .activities {
        background: linear-gradient(var(--white) 46%, var(--linen) 46%);
    }

    .tabs {
        display: grid;
        gap: 1.875rem;
    }

    .tabs__list {
        display: flex;
        gap: var(--space-sm);
        margin-inline: calc(-1 * var(--gutter));
        padding: var(--space-xs) var(--gutter) var(--space-lg);
        overflow-x: auto;
        scrollbar-width: none;
    }

    .tabs__tab {
        flex: none;
        padding: 1.125rem var(--space-lg);
        font-family: var(--font-display);
        font-size: var(--text-lg);
        font-weight: 600;
        color: var(--navy);
        text-align: left;
        background: var(--white);
        border: 0;
        box-shadow: var(--shadow-lift);
        cursor: pointer;
        transition: color var(--steady) var(--ease), background-color var(--steady) var(--ease);
    }

    .tabs__tab:hover {
        color: var(--sand-ink);
    }

    .tabs__tab[aria-selected="true"] {
        color: var(--white);
        background: var(--sand);
    }

    @media (max-width: 63.99rem) {
        .tabs__tab {
            border: 1px solid var(--sand);
        }
    }

    .tabs__panels {
        display: grid;
        gap: 1.875rem;
    }

    .tabs__panel {
        display: grid;
        gap: var(--space-xl);
        padding: clamp(1.25rem, 0.8rem + 1.8vw, 1.875rem);
        background: var(--white);
        box-shadow: var(--shadow-soft);
    }

    .tabs__panel[hidden] {
        display: none;
    }

    .tabs__panel:not([hidden]) {
        animation: panel-in 0.6s var(--ease-out);
    }

    @keyframes panel-in {
        from {
            opacity: 0;
            transform: translateY(0.75rem);
        }
    }

    .tabs__media {
        overflow: hidden;
        background: var(--linen);
    }

    .tabs__media img {
        width: 100%;
        height: 100%;
        aspect-ratio: 3 / 2;
        object-fit: cover;
    }

    .tabs__copy p {
        margin-block: var(--space-md) var(--space-lg);
    }

    @media (scripting: none) {
        .tabs__list {
            display: none;
        }
    }

    @media (min-width: 48rem) {
        .tabs__panel {
            grid-template-columns: 5fr 6fr;
            align-items: center;
        }

        .tabs__media img {
            aspect-ratio: 6 / 7;
        }
    }

    @media (min-width: 64rem) {
        .tabs {
            grid-template-columns: 20rem 1fr;
            align-items: start;
        }

        .tabs__list {
            display: grid;
            margin: 0;
            padding: 0;
            overflow: visible;
        }

        .tabs__tab {
            padding: 1.375rem var(--space-lg);
            font-size: 1.25rem;
        }
    }

    /* ---------- Moving band of place names ---------- */

    .marquee {
        position: relative;
        padding-block: 1.375rem;
        overflow: hidden;
        background: var(--navy-muted);
    }

    .marquee__track {
        display: flex;
        width: max-content;
        animation: marquee 55s linear infinite;
    }

    .marquee:hover .marquee__track,
    .marquee.is-paused .marquee__track {
        animation-play-state: paused;
    }

    @keyframes marquee {
        to {
            transform: translateX(-50%);
        }
    }

    .marquee__group {
        display: flex;
        flex: none;
    }

    .marquee__group li {
        display: flex;
        gap: var(--space-lg);
        align-items: center;
        padding-right: var(--space-lg);
        font-family: var(--font-display);
        font-size: clamp(1.5rem, 1.1rem + 1.6vw, 2.25rem);
        font-weight: 600;
        line-height: 1.3;
        color: var(--sand-pale);
        white-space: nowrap;
    }

    .marquee__group .icon {
        width: 1.375rem;
        height: 1.375rem;
        color: var(--sand);
    }

    /* Fades the names out behind the pause button. */
    .marquee::after {
        content: "";
        position: absolute;
        inset: 0 0 0 auto;
        width: 7rem;
        background: linear-gradient(to right, transparent, var(--navy-muted) 60%);
    }

    .marquee__toggle {
        position: absolute;
        z-index: 1;
        top: 50%;
        right: var(--space-md);
        display: grid;
        place-items: center;
        width: 2.25rem;
        height: 2.25rem;
        color: var(--white);
        background: var(--navy);
        border: 1px solid var(--line-on-navy);
        cursor: pointer;
        translate: 0 -50%;
    }

    .marquee__toggle .icon {
        width: 0.875rem;
        height: 0.875rem;
    }

    @media (scripting: none), (prefers-reduced-motion: reduce) {
        .marquee__toggle {
            display: none;
        }
    }

    /* ---------- A day on safari ---------- */

    .rhythm__steps {
        display: grid;
        gap: var(--space-xl);
        counter-reset: step;
    }

    .rhythm__steps li {
        position: relative;
        padding-left: 2.25rem;
    }

    /* A line with a marker at each stage of the day. */
    .rhythm__steps li::before {
        content: "";
        position: absolute;
        top: 0.5rem;
        left: 0;
        width: 0.6875rem;
        height: 0.6875rem;
        background: var(--white);
        border: 2px solid var(--sand);
        border-radius: 50%;
    }

    .rhythm__steps li:not(:last-child)::after {
        content: "";
        position: absolute;
        top: 1.5rem;
        bottom: calc(-1 * var(--space-xl) - 0.25rem);
        left: 0.3125rem;
        width: 1px;
        background: var(--line);
    }

    .rhythm__photo {
        aspect-ratio: 4 / 3;
        margin-bottom: var(--space-md);
        overflow: hidden;
        background: var(--linen);
    }

    .rhythm__photo img {
        width: 100%;
        height: 100%;
        object-fit: cover;
    }

    .rhythm__steps h3 {
        margin-bottom: var(--space-xs);
    }

    .rhythm__note {
        max-width: 44rem;
        margin-inline: auto;
        text-align: center;
        margin-top: var(--space-2xl);
        padding-top: var(--space-lg);
        border-top: 1px solid var(--line);
    }

    @media (min-width: 62rem) {
        .rhythm__steps {
            grid-template-columns: repeat(5, 1fr);
            gap: var(--space-xl);
        }

        .rhythm__steps li {
            padding: 2.25rem 0 0;
        }

        .rhythm__steps li::before {
            top: 0;
        }

        .rhythm__steps li:not(:last-child)::after {
            top: 0.3125rem;
            right: calc(-1 * var(--space-xl));
            bottom: auto;
            left: 1.125rem;
            width: auto;
            height: 1px;
        }
    }

    /* ---------- Client photograph carousel ---------- */

    .client-gallery {
        padding-block: var(--space-2xl);
        background: var(--white);
    }

    .client-gallery__viewport {
        --client-photo-columns: 1;
        --client-photo-gap: 1rem;

        position: relative;
        overflow: hidden;
        cursor: grab;
        touch-action: pan-y;
    }

    .client-gallery__viewport.is-dragging {
        cursor: grabbing;
        user-select: none;
    }

    .client-gallery__track {
        display: flex;
        gap: var(--client-photo-gap);
        width: 100%;
        will-change: transform;
        transition: transform 600ms var(--ease);
    }

    .client-gallery__group {
        display: contents;
    }

    .client-gallery__item {
        flex: 0 0 calc((100% - (var(--client-photo-columns) - 1) * var(--client-photo-gap)) / var(--client-photo-columns));
        aspect-ratio: 4 / 3;
        overflow: hidden;
    }

    .client-gallery__item img {
        width: 100%;
        height: 100%;
        object-fit: cover;
        object-position: center;
    }

    .client-gallery__arrow {
        position: absolute;
        z-index: 2;
        top: 50%;
        transform: translateY(-50%);
        background: rgb(18 15 32 / 0.84);
        box-shadow: var(--shadow-soft);
    }

    .client-gallery__arrow--previous {
        left: var(--space-xs);
    }

    .client-gallery__arrow--next {
        right: var(--space-xs);
    }

    @media (min-width: 48rem) {
        .client-gallery__viewport {
            --client-photo-columns: 3;
        }
    }

    @media (min-width: 75rem) {
        .client-gallery__viewport {
            --client-photo-columns: 5;
        }
    }

    @media (prefers-reduced-motion: reduce) {
        .client-gallery__track {
            transition-duration: 0ms;
        }
    }

    /* ---------- Pricing ---------- */

    .pricing__grid {
        display: grid;
        gap: var(--space-2xl);
    }

    .pricing__copy h2 {
        margin-block: var(--space-sm) var(--space-md);
    }

    .pricing__copy .button {
        margin-top: var(--space-lg);
    }

    @media (min-width: 64rem) {
        .pricing__grid {
            grid-template-columns: 4fr 7fr;
            gap: clamp(3rem, 5vw, 4.5rem);
            align-items: start;
        }

        .pricing__copy {
            position: sticky;
            top: calc(var(--header-height) + var(--space-xl));
        }
    }

    /* ---------- Founder ---------- */

    .founder__grid {
        display: grid;
        gap: var(--space-2xl);
        align-items: center;
    }

    .founder__copy h2 {
        margin-top: var(--space-sm);
    }

    .founder__copy .button {
        margin-top: var(--space-lg);
    }

    .founder__media {
        max-width: 30rem;
    }

    @media (min-width: 60rem) {
        .founder__grid {
            grid-template-columns: 6fr 5fr;
            gap: clamp(3rem, 6vw, 5.5rem);
        }

        .founder__media {
            justify-self: end;
        }
    }

    /* ---------- Figures for US travelers ---------- */

    .figures {
        padding-block: clamp(3.5rem, 2.5rem + 4vw, 5.5rem);
        color: var(--text-on-navy);
        background: var(--navy) url("../../images/pattern-contours.svg") center top / max(100rem, 100%) auto no-repeat;
    }

    .figures__title {
        font-size: var(--text-xl);
        color: var(--sand-pale);
    }

    .figures__list {
        display: grid;
        gap: var(--space-xl);
        margin-block: var(--space-xl) var(--space-2xl);
    }

    .figures__list dt {
        font-family: var(--font-display);
        font-size: clamp(2rem, 1.5rem + 2vw, 2.875rem);
        font-weight: 600;
        line-height: 1.15;
        color: var(--white);
    }

    .figures__list dd {
        max-width: 15rem;
        margin: var(--space-xs) 0 0;
    }

    @media (min-width: 34rem) {
        .figures__list {
            grid-template-columns: repeat(2, 1fr);
        }
    }

    @media (min-width: 62rem) {
        .figures__list {
            grid-template-columns: repeat(4, 1fr);
        }

        .figures__list div + div {
            padding-left: var(--space-xl);
            border-left: 1px solid var(--line-on-navy);
        }
    }

    /* ---------- Questions ---------- */

    .questions__grid {
        display: grid;
        gap: var(--space-2xl);
    }

    .questions__copy h2 {
        margin-block: var(--space-sm) var(--space-md);
    }

    .questions__copy .button {
        margin-top: var(--space-xl);
    }

    @media (min-width: 64rem) {
        .questions__grid {
            grid-template-columns: 4fr 7fr;
            gap: clamp(3rem, 5vw, 4.5rem);
            align-items: start;
        }

        .questions__copy {
            position: sticky;
            top: calc(var(--header-height) + var(--space-xl));
        }
    }
}
