/* ============================================================
   apc/slider-style-5 — frontend styles
   ============================================================ */

.ss5-wrapper {
    box-sizing: border-box;
    width: 100%;
    min-width: 0;
    max-width: 100%;
    /*padding-left: 24px;
    padding-right: 24px; */
}

/* ── Header ── */
.ss5-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 28px;
}
.ss5-header__content {
    flex: 1;
    min-width: 0;
}
.ss5-header__title {
    color: #0a0a0a;
    margin: 0 0 6px;
}
.ss5-header__sub {
    color: rgba(0, 0, 0, 0.5);
    margin: 0;
}
.ss5-header__controls {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
    align-self: center;
}
.ss5-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border: 1px solid rgba(0, 0, 0, 0.15);
    border-radius: 50%;
    background: #fff;
    cursor: pointer;
    color: #1a1a1a;
    transition: background 0.2s ease, border-color 0.2s ease, opacity 0.2s ease;
}
.ss5-btn:hover {
    background: #f5f5f5;
    border-color: rgba(0, 0, 0, 0.3);
}
.ss5-btn:disabled,
.ss5-btn.is-disabled {
    opacity: 0.3;
    cursor: default;
    pointer-events: none;
}

/* ── Stage / track ── */
.ss5-stage {
    position: relative;
    width: 100%;
    --ss5-gap: 20px;
    --ss5-visible: 4.3; /* desktop: how many cards are visible at once */
}

.ss5-track {
    margin: 0;
    padding: 0;
    list-style: none;
}

.ss5-card {
    position: relative;
    box-sizing: border-box;
    overflow: hidden;
    background-color: #e0e0e0;
    background-size: cover;
    background-position: center;
}

.ss5-card__img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.ss5-card__overlay {
    position: absolute;
    inset: 0;
    pointer-events: none;
}

.ss5-card__content {
    position: relative;
    z-index: 1;
    height: 100%;
    display: flex;
    flex-direction: column;
    padding: 10px;
    box-sizing: border-box;
    gap: 8px;
	justify-content: flex-start !important;
	align-items: stretch !important;
}
.ss5-card__content * {
    /*color: #fff; */
    /*margin: 0;*/
}
.ss5-card__content > * + * {
    margin-top: 8px;
}

/* ── Desktop: 3 full cards + a 4th half-visible, horizontally scrollable.
   No aspect-ratio here on purpose — height comes from whichever
   card's content is tallest (flex row default align-items:stretch
   evens the rest out to match), with --ss5-desktop-min-height as a
   floor so short-content slides don't collapse too short. ── */
@media (min-width: 769px) {
    .ss5-stage {
        overflow: visible;
        /* No border-radius here: the stage is what clips the partially
           visible card, so a radius on it would round the cut-off edge.
           Rounded corners come only from .ss5-card itself. */
        /*border-radius: 12px;*/
        --ss5-desktop-min-height: 440px;
    }
    .ss5-track {
        display: flex;
        align-items: stretch;
        gap: var(--ss5-gap);
        min-height: var(--ss5-desktop-min-height);
        overflow-x: auto;
        overflow-y: hidden;
        scroll-snap-type: x mandatory;
        scroll-behavior: smooth;
        scrollbar-width: none;
        -webkit-overflow-scrolling: touch;
        touch-action: pan-x pan-y;
    }
    .ss5-track::-webkit-scrollbar { display: none; }
    .ss5-card {
        flex: 0 0 calc((100% - (var(--ss5-visible) - 1) * var(--ss5-gap)) / var(--ss5-visible));
        width: calc((100% - (var(--ss5-visible) - 1) * var(--ss5-gap)) / var(--ss5-visible));
        border-radius: 12px;
        scroll-snap-align: start;
    }
}

/* ── Desktop, narrower screens: fewer visible cards, same "+ partial
   peek" pattern, so cards don't get squeezed too thin. Only the
   --ss5-visible count changes; the card width calc above picks it up. ── */
@media (min-width: 769px) and (max-width: 1440px) {
    .ss5-stage {
        --ss5-visible: 3.3;
    }
}
@media (min-width: 769px) and (max-width: 1100px) {
    .ss5-stage {
        --ss5-visible: 2.3;
        --ss5-gap: 16px;
    }
}

/* ── Mobile: squeezy-style scroll-snap track, scale-on-scroll, all cards
   equal height, with a bigger prev/next peek on both sides ── */
@media (max-width: 768px) {
    .ss5-wrapper {
        padding: 0;
    }
    .ss5-header {
        padding-left: 24px;
        padding-right: 24px;
    }
    .ss5-header__controls {
        display: none;
    }
    .ss5-stage {
        overflow: visible;
        --ss5-mobile-peek: 10vw;
        --ss5-mobile-gap: 12px;
        --ss5-mobile-first-inset: 24px;
    }
    .ss5-track {
        display: grid;
        grid-auto-flow: column;
        grid-auto-columns: calc(100vw - 2 * (var(--ss5-mobile-peek) + var(--ss5-mobile-gap)));
        align-items: stretch;
        overflow-x: auto;
        overflow-y: visible;
        scroll-snap-type: x mandatory;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        touch-action: pan-x pan-y;
        gap: var(--ss5-mobile-gap);
        /* The first slide begins closer to the left edge. Once the track is
           scrolled, the remaining slides use their centre snap alignment. */
        padding-left: var(--ss5-mobile-first-inset);
        padding-right: calc(var(--ss5-mobile-peek) + var(--ss5-mobile-gap));
        scroll-padding: 0;
        --carousel-scroll-progress: 0;
    }
    .ss5-track::-webkit-scrollbar {
        display: none;
    }
    .ss5-card {
        --scale-amount: 0.05;
        --carousel-item-progress: clamp(
            -1,
            var(--carousel-item-index, 0) - var(--carousel-scroll-progress, 0),
            1
        );
        --carousel-card-scale: calc(
            1 - max(
                var(--carousel-item-progress),
                -1 * var(--carousel-item-progress)
            ) * var(--scale-amount)
        );
        scroll-snap-align: center;
        border-radius: 10px;
        transform: scale(var(--carousel-card-scale));
        transform-origin: center center;
        transition: transform 0.05s linear;
    }
    .ss5-card__content {
        height: auto;
        padding: 20px;
    }
}


/* ============================================================
   Stories — clickable cards + story modal
   ============================================================ */

/* ── Clickable card: a full-card button sits under the content.
   Content ignores the pointer so the click falls through to the
   button, but real links/buttons inside the slide stay usable. ── */
.ss5-card--story {
    cursor: pointer;
}
.ss5-card__story-btn {
    position: absolute;
    inset: 0;
    z-index: 1;
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: inherit;
    background: transparent;
    cursor: pointer;
    -webkit-appearance: none;
    appearance: none;
    -webkit-tap-highlight-color: transparent;
}
.ss5-card__story-btn:focus-visible {
    outline: 3px solid #fff;
    outline-offset: -6px;
    box-shadow: inset 0 0 0 6px rgba(21, 93, 252, 0.9);
}
.ss5-card__story-btn .screen-reader-text {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}
.ss5-card--story .ss5-card__content {
    pointer-events: none;
}
.ss5-card--story .ss5-card__content a,
.ss5-card--story .ss5-card__content button,
.ss5-card--story .ss5-card__content input,
.ss5-card--story .ss5-card__content select,
.ss5-card--story .ss5-card__content textarea,
.ss5-card--story .ss5-card__content label {
    pointer-events: auto;
}
.ss5-card--story .ss5-card__img {
    transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}
@media (hover: hover) {
    .ss5-card--story:hover .ss5-card__img {
        transform: scale(1.04);
    }
}

/* ── Auto-generated story cards (source: Stāsti) ── */
.ss5-card--auto {
    color: #fff;
}
.ss5-card--auto .ss5-card__content {
    padding: 20px;
}
.ss5-card__story-type {
    align-self: flex-start;
    display: inline-block;
    padding: 4px 10px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.16);
    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);
    font-size: 13px;
    font-weight: 500;
    line-height: 1.4;
    color: #fff;
}
.ss5-card__story-text {
    margin-top: auto;
}
/* Date sits directly above the title: quiet, read first, groups with the text */
.ss5-card__story-date {
    display: block;
    margin: 0 0 6px;
    color: rgba(255, 255, 255, 0.78);
    font-size: 14px;
    font-weight: 500;
    line-height: 1.4;
    font-variant-numeric: tabular-nums;
}
.ss5-card__story-title {
    margin: 0;
    color: #fff;
    font-size: clamp(1.15rem, 1.4vw, 1.4rem);
    line-height: 1.25;
}
.ss5-card__story-excerpt {
    margin: 8px 0 0;
    color: rgba(255, 255, 255, 0.82);
    font-size: 15px;
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
@media (max-width: 768px) {
    .ss5-wrapper--stories .ss5-card {
        min-height: 420px;
    }
}

/* ── "All stories" archive card (last slide, source: Stāsti) ── */
.ss5-card--archive {
    display: flex;
}
.ss5-card__archive-link {
    position: relative;
    z-index: 1;
    flex: 1 1 auto;
    display: flex;
    flex-direction: row;
    justify-content: flex-start;
    align-items: flex-end;
    gap: 10px;
    min-height: 100%;
    padding: 20px;
    box-sizing: border-box;
    color: inherit;
    text-decoration: none;
    border-radius: inherit;
}
.ss5-card__archive-link:hover,
.ss5-card__archive-link:focus {
    color: inherit;
    text-decoration: none;
}
.ss5-card__archive-link:focus-visible {
    outline: 3px solid #fff;
    outline-offset: -6px;
    box-shadow: inset 0 0 0 6px rgba(21, 93, 252, 0.9);
}
.ss5-card__archive-label {
    font-size: clamp(1.15rem, 1.4vw, 1.4rem);
    font-weight: 600;
    line-height: 1.25;
}
.ss5-card__archive-icon {
    display: inline-flex;
    flex-shrink: 0;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.ss5-card--archive .ss5-card__img {
    transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}
@media (hover: hover) {
    .ss5-card--archive:hover .ss5-card__archive-icon {
        transform: translateX(4px);
    }
    .ss5-card--archive:hover .ss5-card__img {
        transform: scale(1.04);
    }
}

/* Story modal styles live in the Stories snippet (handle: um-story-modal),
   shared with apc/modal-card-grid. */

@media (prefers-reduced-motion: reduce) {
    .ss5-card--story .ss5-card__img,
    .ss5-card--archive .ss5-card__img,
    .ss5-card__archive-icon {
        transition: none;
    }
}
@media (max-width: 768px) {
    .ss5-wrapper--stories .ss5-card__content {
        height: 100%;
    }
}

/* ============================================================
   Donation cards (cards with apc/donation-slider) — stretch the
   content to fill the whole card: icon + title at the top, the
   donation slider at the bottom, both full card width.
   Scoped with :has(), so other Slider Style 5 uses are untouched.
   ============================================================ */
.ss5-card:has(.apc-donation-slider) {
    display: flex;
    flex-direction: column;
}
.ss5-card:has(.apc-donation-slider) > .ss5-card__content {
    flex: 1 1 auto;
    height: auto;
    align-items: stretch !important;
    justify-content: flex-start !important;
}
/* Outer group: fill the card height, push the slider to the bottom */
.ss5-card__content > .wp-block-group:has(.apc-donation-slider) {
    flex: 1 1 auto;
    width: 100%;
    align-items: stretch;
    justify-content: space-between;
}
/* Its children (icon/title group + donation slider) take the full width */
.ss5-card__content > .wp-block-group:has(.apc-donation-slider) > * {
    width: 100%;
    max-width: none;
    margin-left: 0;
    margin-right: 0;
}
/* ============================================================
   Instagram source — 4:5 image cards, whole card links to the
   post on Instagram (opens in a new tab).
   ============================================================ */
.ss5-wrapper--instagram .ss5-stage {
    --ss5-desktop-min-height: 0px; /* height comes from the 4:5 ratio */
}
.ss5-wrapper--instagram .ss5-card {
    aspect-ratio: 4 / 5;
    min-height: 0;
}
.ss5-card--instagram {
    color: #fff;
    background-color: #111;
}
.ss5-card--instagram .ss5-card__content {
    height: 100%;
    padding: 16px;
    pointer-events: none;
}

/* Full-card link (same idea as the story button) */
.ss5-card__link {
    position: absolute;
    inset: 0;
    z-index: 2;
    border-radius: inherit;
    -webkit-tap-highlight-color: transparent;
}
.ss5-card__link:focus-visible {
    outline: 3px solid #fff;
    outline-offset: -6px;
    box-shadow: inset 0 0 0 6px rgba(21, 93, 252, 0.9);
}
.ss5-card__link .screen-reader-text {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Video / carousel marker, top right */
.ss5-card__ig-type {
    position: absolute;
    top: 12px;
    right: 12px;
    display: inline-flex;
    color: #fff;
    filter: drop-shadow(0 1px 3px rgba(0, 0, 0, 0.45));
}
.ss5-card__ig-caption {
    margin: auto 0 0;
    color: #fff;
    font-size: 14px;
    line-height: 1.45;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.ss5-card--instagram .ss5-card__img {
    transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}
@media (hover: hover) {
    .ss5-card--instagram:hover .ss5-card__img {
        transform: scale(1.04);
    }
}
@media (prefers-reduced-motion: reduce) {
    .ss5-card--instagram .ss5-card__img {
        transition: none;
    }
}

/* ============================================================
   Instagram modal (click action: modal) — shared <dialog>.
   Desktop: media left, account + text + date right.
   Mobile: full screen, media on top, text scrolls below.
   ============================================================ */
button.ss5-card__link {
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 0;
    border: 0;
    background: transparent;
    cursor: pointer;
    -webkit-appearance: none;
    appearance: none;
}
.ss5-card--ig-modal {
    cursor: pointer;
}

html.ss5-igm-lock {
    overflow: hidden;
}

.ss5-igm {
    position: fixed;
    inset: 0;
    width: 100%;
    max-width: none;
    height: 100%;
    max-height: none;
    margin: 0;
    padding: 56px 88px;
    border: 0;
    box-sizing: border-box;
    background: transparent;
    color: #0a0a0a;
    overflow: hidden;
}
.ss5-igm[open] {
    display: flex;
    align-items: center;
    justify-content: center;
}
.ss5-igm::backdrop {
    background: rgba(10, 10, 10, 0.82);
}

.ss5-igm__frame {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 360px;
    width: min(1120px, 100%);
    height: min(760px, 100%);
    border-radius: 12px;
    overflow: hidden;
    background: #fff;
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.35);
}

/* ── Media ── */
.ss5-igm__media {
    position: relative;
    min-width: 0;
    min-height: 0;
    background: #000;
}
.ss5-igm__stage {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}
.ss5-igm__stage.is-loading::after {
    content: "";
    position: absolute;
    width: 32px;
    height: 32px;
    border: 3px solid rgba(255, 255, 255, 0.25);
    border-top-color: #fff;
    border-radius: 50%;
    animation: ss5-igm-spin 0.8s linear infinite;
}
@keyframes ss5-igm-spin {
    to { transform: rotate(360deg); }
}
.ss5-igm__asset {
    display: block;
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
}
video.ss5-igm__asset {
    width: 100%;
    height: 100%;
    background: #000;
}

/* Carousel (several images in one post) */
.ss5-igm__step {
    position: absolute;
    top: 50%;
    z-index: 2;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    margin-top: -16px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.9);
    color: #1a1a1a;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
}
.ss5-igm__step--prev { left: 12px; }
.ss5-igm__step--next { right: 12px; }
.ss5-igm__step[hidden] { display: none; }
.ss5-igm__dots {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 14px;
    z-index: 2;
    display: flex;
    justify-content: center;
    gap: 5px;
    pointer-events: none;
}
.ss5-igm__dots[hidden] { display: none; }
.ss5-igm__dots span {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.5);
}
.ss5-igm__dots span.is-active {
    background: #fff;
}

/* ── Text panel ── */
.ss5-igm__panel {
    display: flex;
    flex-direction: column;
    min-height: 0;
    border-left: 1px solid rgba(0, 0, 0, 0.08);
}
.ss5-igm__head {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 16px 56px 16px 20px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}
.ss5-igm__avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    color: #fff;
    background: linear-gradient(45deg, #f9ce34, #ee2a7b 55%, #6228d7);
}
.ss5-igm__user {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: #0a0a0a;
    font-weight: 600;
    font-size: 15px;
    text-decoration: none;
}
.ss5-igm__user:hover,
.ss5-igm__user:focus-visible {
    text-decoration: underline;
}
.ss5-igm__caption {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    padding: 18px 20px;
    font-size: 15px;
    line-height: 1.6;
    white-space: pre-line;
    overflow-wrap: anywhere;
    color: #1a1a1a;
}
.ss5-igm__caption a {
    color: #155dfc;
    text-decoration: none;
}
.ss5-igm__caption a:hover {
    text-decoration: underline;
}
.ss5-igm__foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 20px;
    border-top: 1px solid rgba(0, 0, 0, 0.08);
    font-size: 14px;
}
.ss5-igm__date {
    color: rgba(0, 0, 0, 0.55);
    font-variant-numeric: tabular-nums;
}
.ss5-igm__date[hidden] { display: none; }
.ss5-igm__permalink {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-left: auto;
    color: #0a0a0a;
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
}
.ss5-igm__permalink:hover {
    text-decoration: underline;
}

/* ── Close + post navigation (outside the frame) ── */
.ss5-igm__close,
.ss5-igm__nav {
    position: absolute;
    z-index: 3;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
    cursor: pointer;
    transition: background 0.2s ease;
}
.ss5-igm__close:hover,
.ss5-igm__nav:hover {
    background: rgba(255, 255, 255, 0.24);
}
.ss5-igm__close { top: 8px; right: 16px; }
.ss5-igm__nav { top: 50%; margin-top: -22px; }
.ss5-igm__nav--prev { left: 20px; }
.ss5-igm__nav--next { right: 20px; }
.ss5-igm__nav[hidden] { display: none; }

.ss5-igm button:focus-visible,
.ss5-igm a:focus-visible {
    outline: 3px solid #155dfc;
    outline-offset: 2px;
}

/* Tablet: narrower text column */
@media (max-width: 1100px) {
    .ss5-igm {
        padding: 56px 72px;
    }
    .ss5-igm__frame {
        grid-template-columns: minmax(0, 1fr) 300px;
    }
}

/* Mobile: full screen, media on top, text below */
@media (max-width: 768px) {
    .ss5-igm {
        padding: 0;
    }
    .ss5-igm__frame {
        grid-template-columns: 1fr;
        grid-template-rows: minmax(0, 58vh) minmax(0, 1fr);
        width: 100%;
        height: 100%;
        border-radius: 0;
    }
    .ss5-igm__panel {
        border-left: 0;
    }
    .ss5-igm__head {
        order: -1;
        padding: 12px 16px;
    }
    .ss5-igm__caption {
        padding: 14px 16px;
    }
    .ss5-igm__foot {
        padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
    }
    .ss5-igm__close {
        top: 10px;
        right: 10px;
        width: 40px;
        height: 40px;
        background: rgba(0, 0, 0, 0.5);
    }
    /* Post-to-post: arrows sit on the media, swipe also works */
    .ss5-igm__nav {
        top: 29vh;
        width: 36px;
        height: 36px;
        margin-top: -18px;
        background: rgba(0, 0, 0, 0.45);
    }
    .ss5-igm__nav--prev { left: 8px; }
    .ss5-igm__nav--next { right: 8px; }
    /* On mobile, carousel steps move inward so they don't clash with post arrows */
    .ss5-igm__step {
        top: auto;
        bottom: 30px;
        margin-top: 0;
    }
    .ss5-igm__step--prev { left: calc(50% - 60px); }
    .ss5-igm__step--next { right: calc(50% - 60px); }
}

@media (prefers-reduced-motion: reduce) {
    .ss5-igm__stage.is-loading::after {
        animation-duration: 2s;
    }
}
