/* Stay Connected: the route map is drawn by home-v2.js. */
.f12-home .home-connect {
    --f12-split-col-gap: var(--f12-space-10);
}

.f12-home .home-connect .f12-split-feature__cta .f12-btn + .f12-btn {
    margin-left: var(--f12-space-8);
}

/* 12px under the large title. On smaller screens the map sits between them. */
@media (min-width: 1025px) {
    .f12-home .home-connect .f12-split-feature__body {
        margin-top: calc(var(--f12-space-3) - var(--f12-split-row-gap));
    }
}

.f12-home .home-connect__map svg {
    display: block;
    width: 100%;
    overflow: visible;
    color: var(--f12-color-brand-editorial);
}

.f12-home .home-connect__marker { --ripple-size: 2.3; }

.f12-home .home-connect__marker--lead { --ripple-size: 3.6; }

.f12-home .home-connect__dot { fill: currentColor; }

/* Hubs stay strong; other churches are quieter dots. */
.f12-home .home-connect__marker:not(.home-connect__marker--hub) .home-connect__dot {
    scale: 0.7;
    fill-opacity: 0.55;
}

.f12-home .home-connect__halo { fill: currentColor; opacity: 0.12; }

.f12-home .home-connect__ring {
    fill: none;
    stroke: currentColor;
    stroke-width: 0.7;
    opacity: 0;
}

.f12-home .home-connect__routes {
    fill: none;
    stroke: currentColor;
    stroke-width: 0.7;
    stroke-linecap: round;
}

.f12-home .home-connect__routes path { stroke-dasharray: 1; opacity: 0.35; }

.f12-home .home-connect__plane { fill: currentColor; stroke: none; opacity: 0; }

@media (prefers-reduced-motion: no-preference) {
    .f12-home .home-connect__map .is-waiting { visibility: hidden; }

    .f12-home .home-connect__map .is-playing .home-connect__ring {
        animation: home-connect-ripple 620ms var(--delay) ease-out both;
    }

    .f12-home .home-connect__map .is-playing .home-connect__dot {
        animation: home-connect-dot-pop 360ms var(--delay) cubic-bezier(0.3, 1.6, 0.5, 1) both;
    }

    .f12-home .home-connect__map .is-playing .home-connect__routes path {
        animation: home-connect-route-draw 1800ms var(--delay) cubic-bezier(0.45, 0, 0.2, 1) both;
    }

    .f12-home .home-connect__map .is-playing .home-connect__halo {
        transform-origin: 0 0;
        animation: home-connect-halo 3600ms calc(var(--delay) + 400ms) ease-in-out infinite both;
    }
}

@keyframes home-connect-ripple {
    from { opacity: 0.55; transform: scale(0.35); }
    to { opacity: 0; transform: scale(var(--ripple-size)); }
}

@keyframes home-connect-dot-pop {
    from { opacity: 0; transform: scale(0); }
    to { opacity: 1; transform: scale(1); }
}

@keyframes home-connect-route-draw {
    from { stroke-dashoffset: 1; }
    to { stroke-dashoffset: 0; }
}

@keyframes home-connect-halo {
    0%, 100% { opacity: 0.14; transform: scale(1); }
    50% { opacity: 0.04; transform: scale(1.6); }
}

/* Stay Connected and its event stack read as one section, so they sit closer than separate sections. */
.f12-home .home-connect-group {
    display: grid;
    gap: var(--f12-layout-section-gap-grouped);
}

@media (max-width: 768px) {
    .f12-home .home-connect-group {
        gap: var(--f12-layout-section-gap-grouped-mobile);
    }
}

/* Event stack: one event at a time on its banner, with the next events peeking out behind.
   home-v2.js moves the deck. */
.f12-home .event-stack {
    --peek: clamp(12px, 3.2vw, 36px);
    --step: 0.045; /* How much smaller each card behind gets. */
    --card-radius: clamp(14px, 1.8vw, 22px);
    --card-ratio: 1920 / 595;
    --turn: 700ms;
    display: grid;
    max-width: 1040px;
    margin-inline: auto;
    gap: var(--f12-space-6);
    justify-items: center;
}

.f12-home .event-stack__deck {
    display: grid;
    width: 100%;
    padding-top: calc(var(--peek) * 2);
    touch-action: pan-y; /* Vertical scrolling stays native; horizontal drags change the card. */
    user-select: none;
    outline: none;
}

.f12-home .event-stack__deck > * {
    grid-area: 1 / 1;
}

/* --i is a card's depth: 0 is the front card, 1 and 2 peek out behind, deeper cards are hidden. */
.f12-home .event-stack__card {
    --i: 0;
    position: relative;
    z-index: calc(20 - var(--i));
    display: block;
    aspect-ratio: var(--card-ratio);
    overflow: hidden;
    border-radius: var(--card-radius);
    text-decoration: none;
    box-shadow: 0 calc(18px - var(--i) * 6px) 44px rgba(16, 18, 22, calc(0.28 - var(--i) * 0.08));
    transform-origin: 50% 0;
    transform: translateY(calc(var(--i) * var(--peek) * -1)) scale(calc(1 - var(--i) * var(--step)));
    opacity: calc(1 - max(var(--i) - 2, 0));
    transition:
        transform var(--turn) cubic-bezier(0.22, 1, 0.36, 1),
        opacity var(--turn) cubic-bezier(0.22, 1, 0.36, 1),
        box-shadow var(--turn) ease;
}

.f12-home .event-stack__card img {
    position: absolute;
    inset: 0;
    z-index: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    background: #1d1f22; /* Shows while the photo loads. */
    transition: transform 1.2s cubic-bezier(0.22, 1, 0.36, 1);
}

/* Every layer rounds its own corners. Clipping alone leaves a dark ring and stepped curves on moving cards. */
.f12-home .event-stack__card img,
.f12-home .event-stack__card::before,
.f12-home .event-stack__card::after {
    border-radius: inherit;
}

/* A soft shade behind the type, and a white wash that fades cards behind the front one toward the page.
   Both change by opacity only, so they ease smoothly as a card moves up the deck. */
.f12-home .event-stack__card::before,
.f12-home .event-stack__card::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 1;
    pointer-events: none;
}

.f12-home .event-stack__card::before {
    background: radial-gradient(ellipse 60% 70% at 50% 50%, rgba(10, 12, 15, 0.42), rgba(10, 12, 15, 0.12) 75%);
}

.f12-home .event-stack__card::after {
    background: #fff;
    opacity: calc(min(var(--i), 1) * 0.35 + var(--i) * 0.15);
    transition: opacity var(--turn) cubic-bezier(0.22, 1, 0.36, 1);
}

.f12-home .event-stack__text {
    position: absolute;
    inset: 0;
    z-index: 2;
    display: grid;
    place-content: center;
    justify-items: center;
    gap: 0.2em;
    padding: var(--f12-space-6);
    color: #fff; /* On the text, not the card: title links take their colour from their parent. */
    text-align: center;
    text-shadow: 0 1px 14px rgba(0, 0, 0, 0.3);
    opacity: calc(1 - min(var(--i), 1));
    transition: opacity calc(var(--turn) * 0.6) ease;
}

.f12-home .event-stack__eyebrow,
.f12-home .event-stack__date,
.f12-home .event-stack__label {
    font-size: clamp(0.6875rem, 0.9vw, 0.8125rem);
    font-weight: 700;
    letter-spacing: 0.2em;
    text-transform: uppercase;
}

.f12-home .event-stack__title {
    margin: 0.15em 0 0.35em;
    font-size: clamp(1.75rem, 3.2vw, 2.75rem);
    font-weight: 700;
    line-height: 1.05;
    letter-spacing: 0.01em;
    text-transform: uppercase;
}

/* The site's title-link arrow sits just after the event name, without moving the centred name. */
.f12-home .event-stack__title.f12-title-link__label {
    position: relative;
}

.f12-home .event-stack__title.f12-title-link__label::after {
    position: absolute;
    left: 100%;
    top: 50%;
    transform: translateY(-50%);
}

.f12-home .event-stack__place {
    font-size: clamp(1.0625rem, 1.5vw, 1.375rem);
    font-weight: 700;
}

/* The section's line, sitting in the front card's bottom corners. */
.f12-home .event-stack__labels {
    z-index: 30;
    align-self: end;
    display: flex;
    justify-content: space-between;
    padding: 0 clamp(1.25rem, 7.5%, 6rem) clamp(1rem, 3.2%, 1.75rem);
    color: #fff;
    pointer-events: none;
    transition: opacity 300ms ease;
}

.f12-home .event-stack.is-dragging .event-stack__labels,
.f12-home .event-stack.is-turning .event-stack__labels { opacity: 0.6; }

.f12-home .event-stack__label { margin: 0; text-shadow: 0 1px 10px rgba(0, 0, 0, 0.35); }

/* Leaving: the front card keeps its look while it drops forward and fades, then rejoins the back of the deck unseen. */
.f12-home .event-stack__card.is-leaving {
    --i: 0 !important;
    z-index: 25;
    opacity: 0;
    transform: translateY(18%) scale(1.04);
    transition:
        transform calc(var(--turn) * 0.9) cubic-bezier(0.4, 0, 0.6, 1),
        opacity calc(var(--turn) * 0.55) cubic-bezier(0.4, 0, 1, 1);
}

/* Type hands over cleanly: the old event's words go first, the new event's arrive just after. */
.f12-home .event-stack__card.is-leaving .event-stack__text {
    opacity: 0;
    transition-duration: 160ms;
}

.f12-home .event-stack__card.is-front .event-stack__text {
    transition-delay: calc(var(--turn) * 0.3);
}

.f12-home .event-stack__card.is-front:hover img,
.f12-home .event-stack__card.is-front:focus-visible img { transform: scale(1.03); }

.f12-home .event-stack__card:focus-visible {
    outline: 3px solid var(--f12-color-brand-editorial);
    outline-offset: 4px;
}

/* While dragging, the front card follows the finger without easing. */
.f12-home .event-stack.is-dragging .event-stack__card.is-front { transition: none; }

.f12-home .event-stack__controls {
    display: flex;
    align-items: center;
    gap: var(--f12-space-4);
}

.f12.f12-home .event-stack__arrow { display: inline-flex; font-size: 1.05rem; }

.f12-home .event-stack__dots {
    display: flex;
    align-items: center;
    gap: var(--f12-space-2);
}

/* Each dot is a 24px tap target around a small visible pill. */
.f12-home .event-stack__dot {
    position: relative;
    width: 14px;
    height: 24px;
    padding: 0;
    border: 0;
    background: none;
    cursor: pointer;
    transition: width 300ms cubic-bezier(0.22, 1, 0.36, 1);
}

.f12-home .event-stack__dot::before,
.f12-home .event-stack__dot::after {
    content: "";
    position: absolute;
    inset: 9px 4px;
    border-radius: 999px;
    background: var(--f12-color-border-subtle);
}

.f12-home .event-stack__dot::after {
    background: var(--f12-color-text-muted);
    transform-origin: 0 50%;
    transform: scaleX(0);
}

.f12-home .event-stack__dot[aria-current="true"] { width: 34px; }

.f12-home .event-stack__dot[aria-current="true"]::after { transform: scaleX(1); }

/* While playing, the active dot fills up until the next card. */
.f12-home .event-stack.is-autoplay .event-stack__dot[aria-current="true"]::after {
    animation: event-stack-progress var(--interval) linear both;
}

.f12-home .event-stack.is-paused .event-stack__dot[aria-current="true"]::after {
    animation-play-state: paused;
}

@keyframes event-stack-progress {
    from { transform: scaleX(0); } to { transform: scaleX(1); }
}

.f12-home .event-stack__dot:focus-visible {
    outline: 2px solid var(--f12-color-brand-editorial);
    outline-offset: 2px;
    border-radius: 999px;
}

/* Phones: a taller, full-width card, with the cards behind bigger and peeking out further. */
@media (max-width: 640px) {
    .f12-home .event-stack { --card-ratio: 4 / 3; --peek: 18px; --step: 0.03; }

    .f12-home .event-stack__labels { padding: 0 var(--f12-space-5) var(--f12-space-5); }
}

@media (prefers-reduced-motion: reduce) {
    .f12-home .event-stack { --turn: 1ms; }

    .f12-home .event-stack__card img { transition: none; }
}

/* One event: no stack to peek at or browse, so drop the peek space and the controls. */
.f12-home .event-stack:has(.event-stack__card:only-of-type) .event-stack__deck { padding-top: 0; }

.f12-home .event-stack:has(.event-stack__card:only-of-type) .event-stack__controls { display: none; }

/* Phones show the short title, "Stay Connected". */
@media (max-width: 768px) {
    .f12-home .home-connect__title-rest { display: none; }
}
