/**
 * mod_hpwslider — frontend slideshow
 * Honours the Cassiopeia CSS custom properties from user.css where present,
 * with sane Heide Park World navy fallbacks so the module also looks right
 * before user.css has loaded or on pages where it isn't included.
 */
.hpwslider {
    --hpwslider-primary: var(--cassiopeia-color-primary, #05143e);
    --hpwslider-gold: var(--cassiopeia-color-gold, #d8b258);
    --hpwslider-height: 480px;
    --hpwslider-fit: cover;

    position: relative;
    overflow: hidden;
    width: 100%;
    height: var(--hpwslider-height);
    border-radius: 16px;
    background: linear-gradient(135deg, var(--hpwslider-primary), color-mix(in srgb, var(--hpwslider-primary) 60%, #000 40%));
    isolation: isolate;
}

.hpwslider__track {
    position: relative;
    width: 100%;
    height: 100%;
}

.hpwslider__slide {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: flex-end;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity .6s ease;
}

.hpwslider__slide.is-active {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

/* Slide-effect variant: horizontal translation instead of a cross-fade. */
.hpwslider--slide .hpwslider__slide {
    transition: transform .6s ease, opacity .3s ease;
    transform: translateX(100%);
}

.hpwslider--slide .hpwslider__slide.is-active {
    transform: translateX(0);
}

.hpwslider--slide .hpwslider__slide.is-prev {
    transform: translateX(-100%);
}

.hpwslider__media {
    position: absolute;
    inset: 0;
}

/* When the image itself becomes the link (link button switched off), the wrapping <a> needs an
   explicit block-level box for the image's width/height: 100% to resolve against correctly. */
.hpwslider__media > a,
.hpwslider__card-media > a,
.hpwslider__timeline-media > a {
    display: block;
    width: 100%;
    height: 100%;
}

.hpwslider__image {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: var(--hpwslider-fit);
    object-position: center;
}

.hpwslider__slide::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(0deg, rgba(5, 20, 62, .92) 0%, rgba(5, 20, 62, .55) 30%, rgba(5, 20, 62, 0) 60%);
    z-index: 1;
}

.hpwslider__content {
    position: relative;
    z-index: 2;
    padding: clamp(1.25rem, 3vw, 2.5rem);
    color: #fff;
    max-width: 42rem;
}

.hpwslider__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.75rem;
    height: 2.75rem;
    margin-bottom: .75rem;
    border-radius: 50%;
    background: color-mix(in srgb, var(--hpwslider-gold) 25%, transparent);
    box-shadow: 0 0 0 1px color-mix(in srgb, var(--hpwslider-gold) 55%, transparent), 0 0 24px color-mix(in srgb, var(--hpwslider-gold) 35%, transparent);
    font-size: 1.25rem;
    color: var(--hpwslider-gold);
}

.hpwslider__subtitle {
    margin: 0 0 .25rem;
    font-family: 'Caveat', cursive;
    font-size: 1.4rem;
    color: var(--hpwslider-gold);
}

.hpwslider__title {
    margin: 0 0 .5rem;
    font-family: 'Francois One', sans-serif;
    font-size: clamp(1.5rem, 3.5vw, 2.5rem);
    line-height: 1.1;
    text-wrap: balance;
}

.hpwslider__text {
    margin: 0 0 1rem;
    font-size: 1rem;
    line-height: 1.5;
    opacity: .92;
}

.hpwslider__text p:last-child {
    margin-bottom: 0;
}

.hpwslider__cta {
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    padding: .6rem 1.35rem;
    border-radius: 999px;
    background: var(--hpwslider-primary);
    border: 1px solid color-mix(in srgb, #fff 20%, transparent);
    color: #fff;
    text-decoration: none;
    font-weight: 600;
    box-shadow: 0 2px 10px rgba(0, 0, 0, .25);
    transition: background .2s ease, border-color .2s ease, box-shadow .2s ease, transform .15s ease;
}

.hpwslider__cta:hover,
.hpwslider__cta:focus-visible {
    /* A touch of white keeps this a clean, brighter navy instead of blending toward gold,
       which produced a muddy olive-grey (#2f3443) when mixed directly into the fill. */
    background: color-mix(in srgb, var(--hpwslider-primary) 90%, #fff 10%);
    border-color: var(--hpwslider-gold);
    box-shadow: 0 4px 14px rgba(0, 0, 0, .3), 0 0 0 1px color-mix(in srgb, var(--hpwslider-gold) 55%, transparent);
    transform: translateY(-1px);
    color: #fff;
}

.hpwslider__arrow {
    position: absolute;
    top: 50%;
    z-index: 3;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.75rem;
    height: 2.75rem;
    margin-top: -1.375rem;
    border: none;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 2px 10px rgba(0, 0, 0, .25);
    color: var(--hpwslider-primary);
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
    transition: background .2s ease, transform .15s ease;
}

.hpwslider__arrow--prev { left: 1rem; }
.hpwslider__arrow--next { right: 1rem; }

.hpwslider__arrow:hover,
.hpwslider__arrow:focus-visible {
    background: color-mix(in srgb, #fff 85%, var(--hpwslider-gold) 15%);
    transform: translateY(-1px);
}

.hpwslider__dots {
    position: absolute;
    z-index: 3;
    bottom: 1rem;
    left: 50%;
    display: flex;
    gap: .5rem;
    transform: translateX(-50%);
}

.hpwslider__dot {
    width: .6rem;
    height: .6rem;
    padding: 0;
    border: 1px solid color-mix(in srgb, #fff 60%, transparent);
    border-radius: 50%;
    background: transparent;
    cursor: pointer;
}

.hpwslider__dot.is-active {
    background: var(--hpwslider-gold);
    border-color: var(--hpwslider-gold);
}

@media (prefers-reduced-motion: reduce) {
    .hpwslider__slide,
    .hpwslider--slide .hpwslider__slide {
        transition: none;
    }
}

@media (max-width: 576px) {
    .hpwslider__arrow {
        width: 2.25rem;
        height: 2.25rem;
        font-size: 1.25rem;
    }
}

/* ==========================================================================
   Grid layout mode — several slides shown at once as compact cards, instead
   of one full-width stretched-out slide. Cards follow the same "photo with
   bottom text gradient" pattern as the site's own article and video cards,
   rather than a separate dark panel below the image.
   ========================================================================== */
.hpwslider--grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.25rem;
    height: auto;
    overflow: visible;
    background: none;
    border-radius: 0;
}

.hpwslider--grid.hpwslider--cols-2 { grid-template-columns: repeat(2, 1fr); }
.hpwslider--grid.hpwslider--cols-3 { grid-template-columns: repeat(3, 1fr); }
.hpwslider--grid.hpwslider--cols-4 { grid-template-columns: repeat(4, 1fr); }

.hpwslider__card {
    position: relative;
    aspect-ratio: 4 / 3;
    overflow: hidden;
    border-radius: 14px;
    background: var(--hpwslider-primary);
    box-shadow: 0 2px 10px rgba(0, 0, 0, .15);
    transition: transform .2s ease, box-shadow .2s ease;
}

.hpwslider__card:hover,
.hpwslider__card:focus-within {
    transform: translateY(-3px);
    box-shadow: 0 8px 22px rgba(0, 0, 0, .25);
}

.hpwslider__card-media {
    position: absolute;
    inset: 0;
}

.hpwslider__card-media .hpwslider__image {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: var(--hpwslider-fit);
}

.hpwslider__card::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(0deg, rgba(5, 20, 62, .92) 0%, rgba(5, 20, 62, .5) 35%, rgba(5, 20, 62, 0) 65%);
    z-index: 1;
}

.hpwslider--grid .hpwslider__content {
    position: absolute;
    inset: auto 0 0 0;
    z-index: 2;
    max-width: none;
    padding: 1rem 1.1rem 1.15rem;
}

.hpwslider--grid .hpwslider__icon {
    width: 2rem;
    height: 2rem;
    margin-bottom: .4rem;
    font-size: .9rem;
}

.hpwslider--grid .hpwslider__subtitle {
    font-size: 1rem;
    margin-bottom: .1rem;
}

.hpwslider--grid .hpwslider__title {
    font-size: 1.15rem;
    line-height: 1.2;
    margin-bottom: .3rem;
}

.hpwslider--grid .hpwslider__text {
    font-size: .85rem;
    margin-bottom: .65rem;
    /* Keep cards tidy: clip long descriptions instead of growing the card. */
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.hpwslider--grid .hpwslider__cta {
    padding: .4rem .95rem;
    font-size: .8rem;
}

@media (max-width: 900px) {
    .hpwslider--grid.hpwslider--cols-3,
    .hpwslider--grid.hpwslider--cols-4 {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 560px) {
    .hpwslider--grid,
    .hpwslider--grid.hpwslider--cols-2,
    .hpwslider--grid.hpwslider--cols-3,
    .hpwslider--grid.hpwslider--cols-4 {
        grid-template-columns: 1fr;
    }
}

/* ==========================================================================
   Split mode — image and text side by side instead of overlaid, so text
   never has to fight a busy background photo and images aren't cropped as
   aggressively. Reuses the exact same carousel markup/JS as fade/slide.
   ========================================================================== */
.hpwslider--split .hpwslider__slide {
    display: flex;
    flex-direction: row;
    align-items: stretch;
}

.hpwslider--split .hpwslider__media {
    position: relative;
    inset: auto;
    flex: 0 0 45%;
}

.hpwslider--split .hpwslider__slide::after {
    display: none;
}

.hpwslider--split .hpwslider__content {
    position: relative;
    z-index: 2;
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    max-width: none;
    padding: clamp(1.5rem, 3vw, 3rem);
    background: var(--hpwslider-primary);
}

@media (max-width: 640px) {
    .hpwslider--split .hpwslider__slide {
        flex-direction: column;
        overflow-y: auto;
    }

    .hpwslider--split .hpwslider__media {
        flex: 0 0 45%;
    }
}

/* ==========================================================================
   Peek carousel — the active slide sits front and centre while its
   neighbours peek in from the sides, hinting that there's more to scroll
   through. Native scroll-snap drives it, so touch panning works for free.
   ========================================================================== */
.hpwslider--peek {
    background: none;
    border-radius: 0;
}

.hpwslider__peek-track {
    display: flex;
    gap: 1rem;
    height: var(--hpwslider-height);
    padding: 0 11%;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x mandatory;
    scroll-behavior: smooth;
    -ms-overflow-style: none;
    scrollbar-width: none;
}

.hpwslider__peek-track::-webkit-scrollbar {
    display: none;
}

.hpwslider--peek .hpwslider__slide {
    position: relative;
    flex: 0 0 78%;
    scroll-snap-align: center;
    border-radius: 16px;
    overflow: hidden;
    opacity: .5;
    visibility: visible;
    pointer-events: auto;
    transform: scale(.93);
    transition: opacity .35s ease, transform .35s ease;
}

.hpwslider--peek .hpwslider__slide.is-active {
    opacity: 1;
    transform: scale(1);
}

.hpwslider--peek:not(.hpwslider--video-peek) .hpwslider__slide > .hpwslider__image,
.hpwslider--peek:not(.hpwslider--video-peek) .hpwslider__slide > a {
    position: absolute;
    inset: 0;
}

.hpwslider--peek .hpwslider__slide::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(0deg, rgba(5, 20, 62, .9) 0%, rgba(5, 20, 62, .5) 30%, rgba(5, 20, 62, 0) 60%);
    z-index: 1;
}

@media (max-width: 640px) {
    .hpwslider__peek-track {
        padding: 0 6%;
    }

    .hpwslider--peek .hpwslider__slide {
        flex: 0 0 88%;
    }
}

/* ==========================================================================
   Timeline mode — a vertical chronology with a connecting line and marker
   dots, good for anniversaries, history pages or step-by-step retrospectives.
   ========================================================================== */
.hpwslider--timeline {
    height: auto;
    overflow: visible;
    background: none;
    border-radius: 0;
}

.hpwslider__timeline-list {
    position: relative;
    list-style: none;
    margin: 0;
    padding: 0 0 0 2.75rem;
}

.hpwslider__timeline-list::before {
    content: '';
    position: absolute;
    top: .4rem;
    bottom: .4rem;
    left: 1.1rem;
    width: 2px;
    background: color-mix(in srgb, var(--hpwslider-primary) 35%, transparent);
}

.hpwslider__timeline-item {
    position: relative;
    margin-bottom: 1.75rem;
}

.hpwslider__timeline-item:last-child {
    margin-bottom: 0;
}

.hpwslider__timeline-marker {
    position: absolute;
    top: .4rem;
    left: -2.75rem;
    width: 2.2rem;
    height: 2.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: var(--hpwslider-primary);
    box-shadow: 0 0 0 4px #fff, 0 0 0 5px color-mix(in srgb, var(--hpwslider-primary) 35%, transparent);
    color: var(--hpwslider-gold);
    font-size: .9rem;
}

.hpwslider__timeline-card {
    display: flex;
    gap: 1.1rem;
    overflow: hidden;
    border-radius: 14px;
    background: color-mix(in srgb, var(--hpwslider-primary) 6%, #fff 94%);
    box-shadow: 0 2px 10px rgba(0, 0, 0, .08);
}

.hpwslider__timeline-media {
    position: relative;
    flex: 0 0 34%;
    aspect-ratio: 4 / 3;
    overflow: hidden;
}

.hpwslider__timeline-body {
    flex: 1;
    padding: 1rem 1.25rem 1rem 0;
    min-width: 0;
}

.hpwslider__timeline-body .hpwslider__subtitle,
.hpwslider__timeline-body .hpwslider__title,
.hpwslider__timeline-body .hpwslider__text {
    color: var(--hpwslider-primary);
}

.hpwslider__timeline-body .hpwslider__title {
    font-size: 1.15rem;
}

.hpwslider__timeline-body .hpwslider__text {
    font-size: .9rem;
    opacity: .8;
}

.hpwslider__timeline-body .hpwslider__cta {
    box-shadow: none;
}

@media (max-width: 560px) {
    .hpwslider__timeline-list {
        padding-left: 1.75rem;
    }

    .hpwslider__timeline-marker {
        left: -1.75rem;
        width: 1.8rem;
        height: 1.8rem;
        font-size: .75rem;
    }

    .hpwslider__timeline-card {
        flex-direction: column;
    }

    .hpwslider__timeline-media {
        flex-basis: auto;
        aspect-ratio: 16 / 9;
    }

    .hpwslider__timeline-body {
        padding: .9rem 1rem 1rem;
    }
}

/* ==========================================================================
   Video tiles — thumbnail with a centred play icon and the title sitting
   below the image (not overlaid), matching a classic video-listing grid.
   ========================================================================== */
.hpwslider--video {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.25rem;
    height: auto;
    overflow: visible;
    background: none;
    border-radius: 0;
}

.hpwslider--video.hpwslider--cols-2 { grid-template-columns: repeat(2, 1fr); }
.hpwslider--video.hpwslider--cols-3 { grid-template-columns: repeat(3, 1fr); }
.hpwslider--video.hpwslider--cols-4 { grid-template-columns: repeat(4, 1fr); }

.hpwslider__vtile-media {
    position: relative;
    display: block;
    width: 100%;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    border-radius: 12px;
    background: var(--hpwslider-primary);
}

.hpwslider__vtile-play {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.75rem;
    color: #fff;
    text-shadow: 0 2px 10px rgba(0, 0, 0, .55);
    background: rgba(5, 20, 62, .12);
    transition: background .2s ease, transform .2s ease;
}

.hpwslider__vtile-media:hover .hpwslider__vtile-play,
.hpwslider__vtile-media:focus-visible .hpwslider__vtile-play {
    background: rgba(5, 20, 62, .32);
    transform: scale(1.08);
}

.hpwslider__vtile-body {
    width: 100%;
    padding-top: .65rem;
    text-align: left;
    box-sizing: border-box;
}

.hpwslider__vtile-title {
    margin: 0 0 .25rem;
    font-family: 'Francois One', sans-serif;
    font-size: 1.05rem;
    line-height: 1.25;
    color: var(--hpwslider-primary);
}

.hpwslider__vtile-more {
    font-size: .85rem;
    font-weight: 600;
    color: var(--hpwslider-primary);
    text-decoration: underline;
    text-underline-offset: 2px;
}

@media (max-width: 900px) {
    .hpwslider--video.hpwslider--cols-3,
    .hpwslider--video.hpwslider--cols-4 {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 560px) {
    .hpwslider--video,
    .hpwslider--video.hpwslider--cols-2,
    .hpwslider--video.hpwslider--cols-3,
    .hpwslider--video.hpwslider--cols-4 {
        grid-template-columns: 1fr;
    }
}

/* ==========================================================================
   Video-peek — the peek carousel's scroll-snap mechanics, but each card
   uses the video-tile look (thumbnail, play icon, title below) instead of
   a full-bleed photo with text overlaid on top.
   ========================================================================== */
.hpwslider--video-peek {
    height: auto;
    overflow: visible;
}

.hpwslider--video-peek .hpwslider__peek-track {
    height: auto;
    align-items: flex-start;
}

.hpwslider--video-peek .hpwslider__slide {
    display: block;
}

.hpwslider--video-peek .hpwslider__slide::after {
    display: none;
}

.hpwslider--video-peek .hpwslider__vtile-media {
    /* The classic padding-percentage aspect-ratio technique instead of the modern aspect-ratio
       property: this depends only on the element's own width, never on how any ancestor
       (flex row, overflow-x:auto scroller, height:auto container) resolves its own height --
       which is what was still collapsing the image even after switching to block layout. */
    height: 0;
    padding-bottom: 56.25%; /* 16:9 */
    border-radius: 0;
}

.hpwslider--video-peek .hpwslider__vtile-media .hpwslider__image,
.hpwslider--video-peek .hpwslider__vtile-media .hpwslider__vtile-play {
    position: absolute;
    inset: 0;
}

.hpwslider--video-peek .hpwslider__vtile-body {
    padding: .9rem 1.1rem 1.1rem;
}

.hpwslider--video-peek .hpwslider__vtile-title {
    font-size: 1.05rem;
}

@media (max-width: 640px) {
    .hpwslider--video-peek .hpwslider__slide {
        flex: 0 0 88%;
    }
}

/* ==========================================================================
   Icon bar — a row of round icon badges (e.g. social media links), no
   images involved. Wraps onto multiple lines on narrow screens.
   ========================================================================== */
.hpwslider--icons {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 1rem 1.25rem;
    height: auto;
    overflow: visible;
    background: none;
    border-radius: 0;
    /* A little breathing room so the hover lift/shadow has room to render without clipping. */
    padding: .5rem;
}

.hpwslider__icon-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: .4rem;
    text-decoration: none;
    color: var(--hpwslider-primary);
    cursor: default;
}

a.hpwslider__icon-item {
    cursor: pointer;
}

.hpwslider__icon-badge {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 3.25rem;
    height: 3.25rem;
    border-radius: 50%;
    background: var(--hpwslider-primary);
    color: #fff;
    font-size: 1.4rem;
    box-shadow: 0 2px 10px rgba(0, 0, 0, .15);
    transition: transform .2s ease, background .2s ease, box-shadow .2s ease;
}

a.hpwslider__icon-item:hover .hpwslider__icon-badge,
a.hpwslider__icon-item:focus-visible .hpwslider__icon-badge {
    background: color-mix(in srgb, var(--hpwslider-primary) 90%, #fff 10%);
    box-shadow: 0 8px 18px rgba(0, 0, 0, .25), 0 0 0 2px color-mix(in srgb, var(--hpwslider-gold) 55%, transparent);
    transform: translateY(-3px) scale(1.06);
}

.hpwslider__icon-label {
    font-size: .8rem;
    font-weight: 600;
    text-align: center;
}

@media (max-width: 480px) {
    .hpwslider--icons {
        gap: .85rem 1rem;
    }

    .hpwslider__icon-badge {
        width: 2.85rem;
        height: 2.85rem;
        font-size: 1.2rem;
    }
}
