/* Destination + tour detail pages: section system, long-copy handling and motion.
   Loaded after destinations.css / tours.css. Everything that hides content until it is revealed
   is gated behind .dd-js (set by detail-pages.js), so the page is fully visible without scripts. */

/* ---------- Section system: a title block, then its information ---------- */

.dd-page .dd-section {
    margin-top: 76px;
    padding-top: 60px;
    border-top: 1px solid var(--d-line);
}

.dd-page .dd-facts + .dd-section {
    margin-top: 0;
    padding-top: 56px;
    border-top: 0;
}

.dd-page .dd-section > h2 {
    margin: 0 0 32px;
    font-size: clamp(30px, 3.4vw, 44px);
    line-height: 1.08;
    letter-spacing: -.02em;
    color: var(--d-ink);
}

/* a short brand-coloured rule closes the title and sets the information apart from it */
.dd-page .dd-section > h2::after {
    content: "";
    display: block;
    width: 44px;
    height: 3px;
    margin-top: 18px;
    border-radius: 3px;
    background: var(--d-brand);
}

/* key facts: one calm panel instead of loose lines */
.dd-page .dd-facts {
    margin: 36px 0 0;
    padding: 28px 32px;
    gap: 24px 36px;
    border: 0;
    border-radius: 20px;
    background: var(--d-soft);
}

.dd-page .dd-facts dt {
    margin-bottom: 6px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: color-mix(in srgb, var(--d-text) 80%, var(--d-ink));
}

.dd-page .dd-facts dd {
    font-size: 19px;
}

/* ---------- Long description: a lead, scannable sub-headings, a way in ---------- */

.dd-page .dd-prose {
    max-width: 68ch;
    color: var(--d-text);
}

.dd-page .dd-prose > p:first-of-type {
    margin-bottom: 1.4em;
    font-size: clamp(19px, 1.7vw, 22px);
    line-height: 1.65;
    color: var(--d-ink);
}

/* every sub-heading after the first starts a new beat */
.dd-page .dd-prose h3 {
    margin-top: 2.6em;
    padding-top: 1.5em;
    border-top: 1px solid var(--d-line);
    scroll-margin-top: 120px;
}

.dd-page .dd-prose > h3:first-child,
.dd-page .dd-prose > h3:first-child + h3 {
    margin-top: 0;
    padding-top: 0;
    border-top: 0;
}

/* admin copy often opens with a headline that repeats the page title: quieten it into a standfirst */
.dd-page .dd-prose > h3:first-child:has(+ h3) {
    margin-bottom: .5em;
    font-size: 15px;
    font-weight: 600;
    line-height: 1.4;
    letter-spacing: .02em;
    color: color-mix(in srgb, var(--d-text) 85%, var(--d-ink));
}

.dd-page .dd-prose h4 {
    margin-top: 1.8em;
    color: var(--d-ink);
}

.dd-toc {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 0 0 40px;
    padding: 0;
    list-style: none;
}

.dd-toc a {
    display: inline-block;
    padding: 9px 16px;
    border: 1px solid var(--d-line);
    border-radius: 999px;
    background: #fff;
    color: var(--d-ink);
    font-size: 14.5px;
    font-weight: 600;
    line-height: 1.2;
    text-decoration: none;
    transition: background-color .25s var(--d-ease), border-color .25s var(--d-ease);
}

.dd-toc a:hover,
.dd-toc a:focus-visible {
    border-color: var(--d-brand);
    background: var(--d-brand-soft);
    color: var(--d-ink);
}

.dd-toc a:focus-visible {
    outline: 2px solid var(--d-ink);
    outline-offset: 2px;
}

.dd-prose.is-collapsible:not(.is-open) {
    position: relative;
    max-height: 620px;
    overflow: hidden;
    -webkit-mask-image: linear-gradient(#000 62%, transparent);
    mask-image: linear-gradient(#000 62%, transparent);
}

.dd-readmore {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    margin-top: 28px;
    padding: 14px 26px;
    border: 1.5px solid var(--d-ink);
    border-radius: 999px;
    background: transparent;
    color: var(--d-ink);
    font-size: 16px;
    font-weight: 700;
    line-height: 1;
    cursor: pointer;
    transition: background-color .25s var(--d-ease), color .25s var(--d-ease);
}

.dd-readmore:hover {
    background: var(--d-ink);
    color: #fff;
}

.dd-readmore:focus-visible {
    outline: 2px solid var(--d-brand);
    outline-offset: 3px;
}

.dd-readmore i {
    font-size: 13px;
    transition: transform .3s var(--d-ease);
}

.dd-readmore[aria-expanded="true"] i {
    transform: rotate(180deg);
}

/* ---------- Tour page: same rhythm for the legacy review block and the itinerary ---------- */

.tp-page .tp-legacy {
    margin-top: 76px;
    padding-top: 60px;
    border-top: 1px solid var(--d-line);
}

.tp-page .tp-legacy .tp-reviews > h3,
.tp-page .tp-legacy .client-review-items > h3,
.tp-page .tp-legacy .review-comment-items > h3 {
    margin: 0 0 28px;
    font-size: clamp(26px, 2.8vw, 36px);
    line-height: 1.1;
    letter-spacing: -.015em;
    color: var(--d-ink);
}

.tp-page .tp-day__body h3 {
    color: var(--d-ink);
}

/* ---------- Motion ---------- */

/* Focal moment: the hero photograph settles into its frame once. */
.dd-hero img,
.tp-gallery__main .carousel-item.active img {
    animation: ddSettle 1.4s var(--d-ease) both;
}

@keyframes ddSettle {
    from { transform: scale(1.07); opacity: .6; }
    to { transform: scale(1); opacity: 1; }
}

/* Sections and list items arrive as the reader reaches them. */
.dd-js [data-reveal] {
    opacity: 0;
    transform: translateY(22px);
}

.dd-js [data-reveal].is-in {
    opacity: 1;
    transform: none;
    transition: opacity .8s var(--d-ease), transform .8s var(--d-ease);
    transition-delay: calc(var(--rd, 0) * 70ms);
}

/* The month bars rise when the calendar is on screen, not at page load. */
.dd-js .dd-calendar:not(.is-in) .dd-month__bar {
    animation: none;
    transform: scaleY(0);
}

/* The route line of the itinerary draws itself down the page. */
.dd-js .tp-days::before {
    transform: scaleY(0);
    transform-origin: top;
}

.dd-js .tp-days.is-in::before {
    transform: scaleY(1);
    transition: transform 1.6s var(--d-ease) .1s;
}

@media (max-width: 767px) {
    /* contents chips become one swipeable row instead of a tall stack */
    .dd-toc {
        flex-wrap: nowrap;
        margin-inline: -16px;
        padding: 0 16px 4px;
        overflow-x: auto;
        scroll-snap-type: x proximity;
        scrollbar-width: none;
    }

    .dd-toc::-webkit-scrollbar {
        display: none;
    }

    .dd-toc li {
        flex: 0 0 auto;
        scroll-snap-align: start;
    }

    .dd-toc a {
        white-space: nowrap;
    }

    .dd-page .dd-section {
        margin-top: 56px;
        padding-top: 44px;
    }

    .dd-page .dd-facts {
        padding: 22px 20px;
    }

    .dd-prose.is-collapsible:not(.is-open) {
        max-height: 520px;
    }

    .tp-page .tp-legacy {
        margin-top: 56px;
        padding-top: 44px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .dd-hero img,
    .tp-gallery__main .carousel-item.active img {
        animation: none;
    }

    .dd-js [data-reveal],
    .dd-js [data-reveal].is-in {
        opacity: 1;
        transform: none;
        transition: none;
    }

    .dd-js .dd-calendar:not(.is-in) .dd-month__bar {
        transform: none;
    }

    .dd-js .tp-days::before,
    .dd-js .tp-days.is-in::before {
        transform: none;
        transition: none;
    }

    .dd-readmore i,
    .dd-toc a {
        transition: none;
    }
}
