/* ---------------------------------------------------------------------------
   The full-screen welcome slider that opens over the home page.

   Loaded only by the view component, which renders nothing when the slider is
   switched off in the panel -- so a site running without it never fetches this
   file. Everything here is namespaced under .epac_slider_* / .epac_slide*, which
   the theme does not use, so nothing in style.css can be reached from here and
   nothing here can reach the page underneath.

   The transition is a wipe and a drift, run as two layers of the same slide:
   the picture crosses slowly under a mask that opens from the direction of
   travel, and a soft veil sweeps across behind it. Both are transforms and
   clip-paths -- no width, height or top/left is animated -- so the whole thing
   stays on the compositor and does not reflow the page it is sitting on top of.
   --------------------------------------------------------------------------- */

.epac_slider_modal {
    --epac-slider-accent: var(--accent-color, #4baf47);
    --epac-slider-ease: cubic-bezier(0.65, 0, 0.35, 1);
    --epac-slider-soft: cubic-bezier(0.22, 1, 0.36, 1);
    /* One number for the whole choreography: the wipe, the drift's head start and
       the caption's stagger are all fractions of it, so the slide never begins to
       leave before the last word has arrived. */
    --epac-slider-move: 1100ms;

    position: fixed;
    inset: 0;
    z-index: 20000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: clamp(16px, 4vw, 56px);
    opacity: 0;
    visibility: hidden;
    transition: opacity 520ms var(--epac-slider-soft), visibility 0s linear 520ms;
}

/* [hidden] is the state the markup ships in, so the overlay is never on screen
   before the script has had a chance to decide whether it should open. The
   attribute alone would be overridden by the display above. */
.epac_slider_modal[hidden] {
    display: none;
}

.epac_slider_modal.is-open {
    opacity: 1;
    visibility: visible;
    transition: opacity 520ms var(--epac-slider-soft), visibility 0s;
}

/* The page keeps its scrollbar width while the overlay is up -- removing it
   shifts the whole layout sideways, which is visible the moment the slider
   closes again. */
body.epac_slider_locked {
    overflow: hidden;
}

.epac_slider_backdrop {
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at 50% 45%, rgba(12, 24, 14, 0.82), rgba(4, 10, 5, 0.96));
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}

.epac_slider_stage {
    position: relative;
    width: min(1180px, 100%);
    max-height: 100%;
    display: flex;
    flex-direction: column;
    gap: 14px;
    transform: translateY(26px) scale(0.97);
    opacity: 0;
    transition: transform 640ms var(--epac-slider-soft), opacity 520ms var(--epac-slider-soft);
}

.epac_slider_modal.is-open .epac_slider_stage {
    transform: none;
    opacity: 1;
}

.epac_slider_eyebrow {
    margin: 0;
    text-align: center;
    color: #fff;
    font-family: var(--heading-font, "Encode Sans Condensed", sans-serif);
    font-size: clamp(14px, 1.5vw, 17px);
    font-weight: 600;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    opacity: 0.86;
}

/* ---- The autoplay timer, as a line ------------------------------------- */

.epac_slider_progress {
    height: 3px;
    border-radius: 3px;
    background: rgba(255, 255, 255, 0.16);
    overflow: hidden;
}

.epac_slider_progress > span {
    display: block;
    height: 100%;
    width: 100%;
    background: linear-gradient(90deg, var(--epac-slider-accent), #d6f2a8);
    transform: scaleX(0);
    transform-origin: left center;
}

/* Autoplay off, or paused on hover: a bar that is not counting anything down
   is worse than no bar, because it says the slide is about to change. */
.epac_slider_modal:not([data-autoplay="true"]) .epac_slider_progress {
    visibility: hidden;
}

/* ---- The pictures ------------------------------------------------------- */

.epac_slider_frame {
    position: relative;
    flex: 1 1 auto;
    min-height: 0;
    border-radius: 18px;
    overflow: hidden;
    box-shadow: 0 40px 90px rgba(0, 0, 0, 0.55);
    background: #0b160c;
}

.epac_slider_track {
    position: relative;
    width: 100%;
    /* Tall enough to be worth opening, short enough to leave the thumbnails and
       the heading on screen at 768px -- the height the design is squeezed at. */
    height: min(70vh, 620px);
}

.epac_slide {
    position: absolute;
    inset: 0;
    margin: 0;
    overflow: hidden;
    /* Closed by default: only the active slide is wiped open, and only the
       active slide is in the accessibility tree or the tab order. */
    clip-path: inset(0 0 0 100%);
    visibility: hidden;
    pointer-events: none;
    z-index: 1;
}

.epac_slide_img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    /* The drift starts here and is released on .is-active. Held slightly past
       the wipe so the picture is already moving when it is uncovered. */
    transform: scale(1.14);
    transform-origin: center 45%;
}

/* The band of light that crosses behind the wipe. Purely decorative, and the
   first thing dropped under reduced motion. */
.epac_slide_veil {
    position: absolute;
    inset: 0;
    z-index: 2;
    pointer-events: none;
    background: linear-gradient(100deg,
        rgba(255, 255, 255, 0) 38%,
        rgba(255, 255, 255, 0.34) 50%,
        rgba(255, 255, 255, 0) 62%);
    transform: translateX(-120%);
}

.epac_slide.is-active {
    visibility: visible;
    pointer-events: auto;
    z-index: 3;
    clip-path: inset(0 0 0 0);
    transition: clip-path var(--epac-slider-move) var(--epac-slider-ease);
}

.epac_slide.is-active .epac_slide_img {
    /* Longer than the wipe on purpose: the drift outlives the transition and
       carries on for as long as the slide is up, which is what stops a held
       slide from looking like a still. */
    transform: scale(1);
    transition: transform 7000ms linear;
}

.epac_slide.is-active .epac_slide_veil {
    transform: translateX(120%);
    transition: transform calc(var(--epac-slider-move) * 1.15) var(--epac-slider-ease);
}

/* Going backwards, the wipe opens from the other edge -- otherwise "previous"
   looks exactly like "next" and the arrows stop meaning anything. */
.epac_slider_track[data-dir="prev"] .epac_slide:not(.is-active) {
    clip-path: inset(0 100% 0 0);
}

.epac_slider_track[data-dir="prev"] .epac_slide.is-active .epac_slide_veil {
    transform: translateX(-120%);
}

.epac_slider_track[data-dir="prev"] .epac_slide_veil {
    transform: translateX(120%);
}

/* The slide being replaced stays put and fades under the incoming one, so the
   frame is never empty mid-transition. */
.epac_slide.is-leaving {
    visibility: visible;
    z-index: 2;
    clip-path: inset(0 0 0 0);
    opacity: 0;
    transform: scale(1.02);
    transition: opacity calc(var(--epac-slider-move) * 0.8) var(--epac-slider-ease),
                transform var(--epac-slider-move) var(--epac-slider-ease);
}

/* ---- The words over the picture ----------------------------------------- */

.epac_slide_caption {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 4;
    padding: clamp(22px, 5vw, 54px);
    padding-top: clamp(60px, 12vw, 130px);
    color: #fff;
    background: linear-gradient(to top, rgba(6, 14, 7, 0.92) 12%, rgba(6, 14, 7, 0.55) 48%, rgba(6, 14, 7, 0) 100%);
    text-align: left;
}

.epac_slide_caption > * {
    /* Each line arrives after the wipe has passed it, staggered below. */
    opacity: 0;
    transform: translateY(24px);
}

.epac_slide.is-active .epac_slide_caption > * {
    opacity: 1;
    transform: none;
    transition: opacity 620ms var(--epac-slider-soft), transform 720ms var(--epac-slider-soft);
}

.epac_slide.is-active .epac_slide_caption > *:nth-child(1) { transition-delay: 480ms; }
.epac_slide.is-active .epac_slide_caption > *:nth-child(2) { transition-delay: 600ms; }
.epac_slide.is-active .epac_slide_caption > *:nth-child(3) { transition-delay: 720ms; }

.epac_slide_title {
    margin: 0 0 10px;
    font-family: var(--heading-font, "Encode Sans Condensed", sans-serif);
    font-size: clamp(22px, 3.4vw, 40px);
    font-weight: 700;
    line-height: 1.18;
    color: #fff;
    max-width: 22ch;
}

.epac_slide_text {
    margin: 0;
    font-size: clamp(14px, 1.6vw, 18px);
    line-height: 1.6;
    max-width: 58ch;
    color: rgba(255, 255, 255, 0.88);
}

.epac_slide_btn {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    margin-top: 18px;
    padding: 12px 26px;
    border-radius: 40px;
    background: var(--epac-slider-accent);
    color: #0d1f0e;
    font-weight: 600;
    text-decoration: none;
    transition: transform 260ms var(--epac-slider-soft), box-shadow 260ms var(--epac-slider-soft);
}

.epac_slide_btn:hover,
.epac_slide_btn:focus-visible {
    color: #0d1f0e;
    transform: translateY(-2px);
    box-shadow: 0 12px 26px rgba(75, 175, 71, 0.42);
}

/* ---- Controls ----------------------------------------------------------- */

.epac_slider_arrow,
.epac_slider_close {
    position: absolute;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(255, 255, 255, 0.28);
    background: rgba(10, 20, 11, 0.42);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    color: #fff;
    cursor: pointer;
    transition: background 240ms ease, border-color 240ms ease, transform 240ms var(--epac-slider-soft);
}

.epac_slider_arrow {
    top: 50%;
    z-index: 6;
    width: 54px;
    height: 54px;
    margin-top: -27px;
    border-radius: 50%;
}

.epac_slider_prev { left: 18px; }
.epac_slider_next { right: 18px; }

.epac_slider_arrow:hover,
.epac_slider_arrow:focus-visible {
    background: var(--epac-slider-accent);
    border-color: var(--epac-slider-accent);
    color: #0d1f0e;
}

.epac_slider_prev:hover { transform: translateX(-3px); }
.epac_slider_next:hover { transform: translateX(3px); }

.epac_slider_close {
    top: -6px;
    right: 0;
    z-index: 7;
    width: 44px;
    height: 44px;
    border-radius: 50%;
}

.epac_slider_close:hover,
.epac_slider_close:focus-visible {
    background: #fff;
    border-color: #fff;
    color: #0d1f0e;
    transform: rotate(90deg);
}

.epac_slider_count {
    position: absolute;
    right: 18px;
    bottom: 16px;
    z-index: 6;
    padding: 5px 14px;
    border-radius: 30px;
    background: rgba(10, 20, 11, 0.55);
    color: rgba(255, 255, 255, 0.82);
    font-size: 13px;
    letter-spacing: 0.06em;
}

.epac_slider_count b {
    color: #fff;
}

/* ---- Thumbnails --------------------------------------------------------- */

.epac_slider_thumbs {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: nowrap;
    overflow-x: auto;
    padding: 2px 2px 6px;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.35) transparent;
}

.epac_slider_thumb {
    flex: 0 0 auto;
    width: 92px;
    height: 58px;
    padding: 0;
    border: 2px solid transparent;
    border-radius: 10px;
    overflow: hidden;
    background: none;
    cursor: pointer;
    opacity: 0.5;
    transition: opacity 260ms ease, border-color 260ms ease, transform 260ms var(--epac-slider-soft);
}

.epac_slider_thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.epac_slider_thumb:hover,
.epac_slider_thumb:focus-visible {
    opacity: 0.85;
    transform: translateY(-3px);
}

.epac_slider_thumb.is-active {
    opacity: 1;
    border-color: var(--epac-slider-accent);
    transform: translateY(-3px);
}

/* Keyboard focus has to be visible against a photograph, which is why this is
   an outline with an offset rather than the theme's usual subtle ring. */
.epac_slider_modal :focus-visible {
    outline: 2px solid #fff;
    outline-offset: 3px;
}

/* ---- Narrow screens ----------------------------------------------------- */

@media (max-width: 767px) {
    .epac_slider_track {
        height: min(62vh, 460px);
    }

    .epac_slider_arrow {
        width: 42px;
        height: 42px;
        margin-top: -21px;
    }

    .epac_slider_prev { left: 8px; }
    .epac_slider_next { right: 8px; }

    .epac_slider_close {
        top: 0;
        right: 0;
        width: 38px;
        height: 38px;
    }

    .epac_slider_thumb {
        width: 68px;
        height: 44px;
    }

    /* The counter sits where the caption's button lands on a narrow screen. */
    .epac_slider_count {
        display: none;
    }
}

/* ---- Reduced motion ------------------------------------------------------
   The slides still change -- the slider would be pointless otherwise -- but the
   wipe, the drift and the sweep are all replaced by a plain cross-fade, which is
   the part that causes trouble. Autoplay is switched off in the script for the
   same reason, so nothing moves without being asked to.
   ------------------------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
    .epac_slider_modal,
    .epac_slider_stage,
    .epac_slide,
    .epac_slide.is-active,
    .epac_slide.is-leaving,
    .epac_slide_img,
    .epac_slide.is-active .epac_slide_img,
    .epac_slide.is-active .epac_slide_caption > * {
        transition-duration: 220ms !important;
        transition-delay: 0ms !important;
    }

    .epac_slider_stage {
        transform: none;
    }

    .epac_slide,
    .epac_slide.is-active {
        clip-path: none;
    }

    .epac_slide:not(.is-active):not(.is-leaving) {
        opacity: 0;
    }

    .epac_slide.is-active {
        opacity: 1;
    }

    .epac_slide_img,
    .epac_slide.is-active .epac_slide_img {
        transform: none;
    }

    .epac_slide_veil {
        display: none;
    }

    .epac_slider_progress {
        visibility: hidden;
    }
}
