/**
 * PLGC Featured Events Slider — event-slider.css
 *
 * Figma "hero slider" node (34039:628) — right column of Section 2
 *   Container:  708 × 567 px  →  aspect-ratio: 5/4 (scales with column width)
 *   Photo:      full-bleed cover  (recommended graphic: 1400×1120px, 5:4 ratio)
 *   Panel:      bottom ~23%, full width, auto-height from content
 *               gradient black → #454041, border-radius 10px 0 0 10px
 *   Title:      Open Sans Regular 24px / 36px, white, centered
 *   CTA:        Open Sans Regular 24px, white, underlined — OR yellow pill for tickets
 *   Dots:       top-right, 27px from top (4.76% × 567), 41px from right (5.83% × 708)
 *   Sold Out:   yellow pill badge, top-left corner
 *
 * @package PLGC
 * @since   1.5.5
 */

/* ── Elementor parent — let the slider size itself via aspect-ratio ───── */
/* The widget wrapper just needs to not collapse. The slider's own
   aspect-ratio (5/4 on desktop) sets its height from the column width,
   so we no longer need to chain height:100% down from the section.      */
.elementor-widget:has(.plgc-es) {
    align-self: stretch;
}

/* ── Wrapper ─────────────────────────────────────────────────────────────── */
.plgc-es {
    position: relative;
    width: 100%;
    aspect-ratio: 5 / 4;
    overflow: hidden;
    background: #1a2e1d;
}

/* Admin notice — only admins see this when TEC not active */
.plgc-es--admin-notice {
    aspect-ratio: auto;
    min-height: 0;
    background: transparent;
}

/* Empty state */
.plgc-es--empty {
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #233C26 0%, #2D5032 100%);
}

.plgc-es__empty-inner {
    padding: 40px;
    text-align: center;
}

.plgc-es__empty-msg {
    font-family: 'Open Sans', sans-serif;
    font-size: 1rem;
    line-height: 1.625rem;
    color: rgba(255, 255, 255, 0.75);
    margin: 0;
}

/* Fallback image slide — static, no Swiper JS needed */
.plgc-es--fallback .swiper,
.plgc-es--fallback .swiper-wrapper,
.plgc-es--fallback .swiper-slide {
    width: 100%;
    height: 100%;
    /* Swiper resets its own transforms — these keep the fallback laid out correctly
       without the JS initialiser ever running */
    transform: none !important;
}

/*
 * Hide the fallback panel entirely on mobile.
 * On desktop it lives in the right column of a two-column layout and adds
 * visual weight. On mobile it stacks as a standalone green bar or orphaned
 * photo with no active event content, which adds no value.
 */
@media (max-width: 767px) {
    .plgc-es--fallback,
    .plgc-es--empty {
        display: none !important;
    }
}

/* Visually hidden live region */
.plgc-es__sr-live {
    position: absolute;
    width: 1px; height: 1px;
    padding: 0; margin: -1px;
    overflow: hidden;
    clip: rect(0,0,0,0);
    white-space: nowrap;
    border: 0;
}

/* ── Swiper ──────────────────────────────────────────────────────────────── */
.plgc-es__swiper {
    width: 100%;
    height: 100%;
}

/* ── Individual slide ────────────────────────────────────────────────────── */
.plgc-es__slide {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

.plgc-es__bg-img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center center;
    display: block;
}

.plgc-es__bg-placeholder {
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, #233C26 0%, #2D5032 100%);
}

/* ── Dark gradient panel ─────────────────────────────────────────────────── */
/* The panel provides the dark background for the content overlay.
   We hide the empty panel div and instead apply the background + border-radius
   directly on .plgc-es__content — this way the dark background always grows
   to exactly match content height, regardless of how much text is inside.    */
.plgc-es__panel {
    display: none;
}

/* ── Content layer — IS the panel (background applied here) ─────────────── */
.plgc-es__content {
    position: absolute;
    right: 0;
    bottom: 7.05%;
    width: 88.4%;
    min-height: 23%;
    height: auto;
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 20px 36px 20px;
    text-align: center;
    pointer-events: auto;
    /* Dark gradient background — now on the content element so it always
       matches content height perfectly. Panel div is hidden.                 */
    background: linear-gradient(180deg, #000000 12.255%, #454041 108.82%);
    border-radius: 10px 0 0 10px;
}

/* Eyebrow — date + time, small caps, muted white */
.plgc-es__date {
    font-family: 'Open Sans', sans-serif;
    font-weight: 600;
    font-size: 0.6875rem;     /* 11px */
    line-height: 1.125rem;
    color: rgba(255, 255, 255, 0.65);
    margin: 0;
    letter-spacing: 0.09em;
    text-transform: uppercase;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

/* Event title — primary text, 24px Open Sans */
.plgc-es__title {
    font-family: 'Open Sans', sans-serif;
    font-weight: 400;
    font-size: 1.5rem;        /* 24px — matches Figma */
    line-height: 2.25rem;     /* 36px */
    color: #FFFFFF;
    margin: 0;
    /* Clamp to 2 lines — keeps panel height stable for long event names */
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Thin yellow rule between title and CTA — adds visual separation */
.plgc-es__divider {
    width: 2.5rem;
    height: 1px;
    background: rgba(255, 174, 64, 0.5);
    margin: 2px auto 0;
    flex-shrink: 0;
}

/* ── CTA states ──────────────────────────────────────────────────────────── */

/* Base — "Learn More" / "View Details": white outline pill button
   More prominent than a bare underline link, clearly a CTA action.
   White border on dark background = 21:1 contrast (WCAG AAA).            */
.plgc-es__cta {
    font-family: 'Open Sans', sans-serif;
    font-weight: 600;
    font-size: 0.9375rem;      /* 15px — matches global .plgc-btn */
    line-height: 1;
    color: #FFFFFF;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
    padding: 0.75rem 1.5rem;
    min-height: 47px;          /* WCAG 2.5.5 — matches primary button height */
    min-width: 44px;
    background: transparent;
    border: 2px solid rgba(255, 255, 255, 0.75);
    border-radius: 6.25rem;    /* pill — matches .plgc-btn */
    transition: background 0.15s ease, border-color 0.15s ease;
}

.plgc-es__cta:hover {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 1);
    color: #FFFFFF;
    text-decoration: none;
}

/* "Get Tickets" — yellow pill, visually distinct, signals a transaction */
.plgc-es__cta--tickets {
    background: #FFAE40;
    color: #000000;
    border-radius: 6.25rem;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9375rem;     /* 15px, matches global .plgc-btn */
    line-height: 1;
    padding: 0.9375rem 1.5rem;
    min-height: 47px;
    transition: background 0.15s ease, color 0.15s ease;
}

.plgc-es__cta--tickets:hover {
    background: #FDBC69;
    color: #000000;
    text-decoration: none;
}

/* Focus rings — WCAG 2.4.7 */
.plgc-es__cta:focus-visible {
    outline: 3px solid #FFAE40;
    outline-offset: 3px;
    border-radius: 6.25rem;
}

.plgc-es__cta--tickets:focus-visible {
    outline: 3px solid #FFFFFF;
    outline-offset: 3px;
    border-radius: 6.25rem;
}

/* ── Sold Out badge ──────────────────────────────────────────────────────── */
/* Top-left of slide. Yellow + black text = 7.42:1 contrast (AAA) */
.plgc-es__badge {
    position: absolute;
    top: 16px;
    left: 16px;
    z-index: 3;
    font-family: 'Open Sans', sans-serif;
    font-weight: 700;
    font-size: 0.6875rem;     /* 11px */
    line-height: 1;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    padding: 6px 14px;
    border-radius: 100px;
    pointer-events: none;
}

.plgc-es__badge--sold-out {
    background: #FFAE40;
    color: #000000;
    border: 2px solid rgba(0,0,0,0.15);
}

/* ── Pagination dots ─────────────────────────────────────────────────────── */
/* Matches gallery-sections.css dot style exactly:
     - Visible dot drawn by ::before (14px circle)
     - 44×44px touch target via padding, NOT min-width (keeps dots visually tight)
     - Inactive: solid white fill + shadow (matches gallery)
     - Active:   green fill + 2px white ring + shadow                      */
.plgc-es__dots {
    position: absolute !important;
    top: 27px !important;     /* 4.76% × 567px */
    right: 41px !important;   /* 5.83% × 708px */
    left: auto !important;
    bottom: auto !important;
    width: auto !important;
    display: flex;
    flex-direction: row;
    gap: 0;                   /* no gap — padding on each button creates visual spacing */
    align-items: center;
    z-index: 10;
    /* Reset Swiper defaults */
    --swiper-pagination-progressbar-bg-color: transparent;
    background: transparent !important;
}

.plgc-es__dots .swiper-pagination-bullet {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    /* Touch target: 44×44px via padding (0 width + 14px pad each side) */
    width: 0 !important;
    height: 0 !important;
    padding: 14px !important;
    margin: 0 !important;
    border: none !important;
    background: transparent !important;
    cursor: pointer !important;
    opacity: 1 !important;
    position: relative !important;
    box-sizing: content-box !important;
    transition: transform 0.15s ease !important;
    /* Reset Swiper CSS custom properties */
    --swiper-pagination-bullet-size: 0px;
    --swiper-pagination-bullet-width: 0px;
    --swiper-pagination-bullet-height: 0px;
    --swiper-pagination-bullet-inactive-opacity: 1;
    --swiper-pagination-bullet-inactive-color: transparent;
}

/* Visible dot — inactive: solid white (matches gallery inactive dots) */
.plgc-es__dots .swiper-pagination-bullet::before {
    content: '' !important;
    display: block !important;
    width: 14px !important;
    height: 14px !important;
    border-radius: 50% !important;
    background: #FFFFFF !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.45) !important;
    transition: background 0.2s ease, box-shadow 0.2s ease !important;
    flex-shrink: 0 !important;
    box-sizing: border-box !important;
}

/* Active — green fill + white outline ring (matches gallery active dots) */
.plgc-es__dots .swiper-pagination-bullet-active::before {
    background: #567915 !important;
    box-shadow: 0 0 0 2px #FFFFFF, 0 1px 4px rgba(0, 0, 0, 0.5) !important;
}

.plgc-es__dots .swiper-pagination-bullet:hover::before {
    background: rgba(255, 255, 255, 0.65) !important;
}

.plgc-es__dots .swiper-pagination-bullet-active:hover::before {
    background: #567915 !important;
}

.plgc-es__dots .swiper-pagination-bullet:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px #FFAE40, 0 0 0 5px rgba(0, 0, 0, 0.3);
}

/* ── Text group wrapper — date + title + price stacked ───────────────────── */
/* Base styles for the wrapper (applies at all breakpoints) */
.plgc-es__text {
    display: flex;
    flex-direction: column;
    align-items: center;   /* centred by default (overridden in horizontal layouts) */
    text-align: center;
    gap: 4px;
}


/* ── Responsive — Desktop (≥ 1025px) ─────────────────────────────────────── */
/* Two-column flex row: text group on the left (1fr), CTA pinned to the right.
   Both columns are vertically centred via align-items:center on the outer row.
   Equal padding top and bottom guarantees visually balanced spacing.          */
@media (min-width: 1025px) {
    .plgc-es__content {
        display: flex;
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        gap: 2rem;
        padding: 1.375rem 2rem 1.375rem 2.25rem;
        text-align: center;
        min-height: 0;
    }

    .plgc-es__text {
        align-items: center;
        text-align: center;
        gap: 5px;
    }

    .plgc-es__date {
        font-size: 0.8125rem;   /* 13px — up from 11px for better readability */
    }

    .plgc-es__title {
        font-size: 1.25rem;
        line-height: 1.75rem;
        -webkit-line-clamp: 1;
        text-align: center;
    }

    /* Divider hidden in horizontal layout — CTA has its own visual weight */
    .plgc-es__divider {
        display: none;
    }

    .plgc-es__cta {
        flex-shrink: 0;
    }
}


/* ── Responsive — Tablet (768px–1024px) ──────────────────────────────────── */
/* Same horizontal layout as desktop; smaller sizes to fit the 50/50 column.
   aspect-ratio: 5/4 from the base rule still applies — no min-height needed. */
@media (max-width: 1024px) {
    .plgc-es__content {
        display: flex;
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        gap: 1.25rem;
        padding: 1.125rem 1.25rem 1.125rem 1.5rem;
        text-align: center;
        min-height: 0;
    }

    .plgc-es__text {
        align-items: center;
        text-align: center;
        gap: 4px;
    }

    .plgc-es__date {
        font-size: 0.75rem;    /* 12px — readable within narrower column */
    }

    .plgc-es__title {
        font-size: 1.0625rem;
        line-height: 1.5rem;
        -webkit-line-clamp: 1;
        text-align: center;
    }

    .plgc-es__divider {
        display: none;
    }

    .plgc-es__cta {
        flex-shrink: 0;
        font-size: 0.875rem;
        padding: 0.625rem 1.125rem;
    }
}


/* ── Responsive — Mobile (≤ 767px) ──────────────────────────────────────── */
@media (max-width: 767px) {
    /* On mobile the slider stacks image-above / content-below, so we need a
       pixel floor instead of aspect-ratio. The 58/42 split gives the image
       ~244px at 420px total — enough to read a graphic clearly.              */
    .plgc-es {
        aspect-ratio: auto;
        height: 420px;         /* explicit height — children need this to resolve height:100%.
                                  min-height alone does NOT propagate to height:100% children
                                  in standard CSS block layout. Without this, the swiper/slide
                                  chain collapses to 0px and overflow:hidden clips all content. */
        min-height: 420px;
    }

    /* Image: top 58% only */
    .plgc-es__bg-img {
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        bottom: auto;
        height: 58%;
        width: 100%;
        object-fit: cover;
        object-position: center center;
    }

    .plgc-es__bg-placeholder {
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        bottom: auto;
        height: 58%;
    }

    /* Content block: anchored to the bottom, auto-height from content */
    .plgc-es__content {
        position: absolute;
        bottom: 0;
        left: 0;
        right: 0;
        width: 100%;
        border-radius: 0;
        padding: 0.875rem 1.25rem;
        gap: 0.375rem;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        text-align: center;
    }

    .plgc-es__text {
        align-items: center;
        text-align: center;
        gap: 0.25rem;
    }

    /* Date: bump up from 12px — needs to be readable */
    .plgc-es__date {
        font-size: 0.8125rem;   /* 13px */
        letter-spacing: 0.06em;
    }

    /* Title: noticeably larger than before */
    .plgc-es__title {
        font-size: 1.1875rem;   /* 19px */
        line-height: 1.45;
        -webkit-line-clamp: 2;
        text-align: center;
    }

    /* Remove divider on mobile — it wastes vertical space and breaks the
       uniform rhythm between date, title, and button.                   */
    .plgc-es__divider {
        display: none;
    }

    .plgc-es__cta {
        font-size: 0.875rem;
        padding: 0.625rem 1.25rem;
        min-height: 44px;
        margin-top: 0.25rem;
    }

    .plgc-es__cta--tickets {
        font-size: 0.875rem;
        padding: 0.75rem 1.25rem;
        margin-top: 0.25rem;
    }

    /* Dots stay top-right of the image portion */
    .plgc-es__dots {
        top: 14px !important;
        right: 16px !important;
    }

    .plgc-es__badge {
        top: 12px;
        left: 12px;
        font-size: 0.625rem;
        padding: 5px 10px;
    }
}

/* ── Reduced motion ──────────────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
    .plgc-es__cta,
    .plgc-es__cta--tickets,
    .plgc-es__dots .swiper-pagination-bullet,
    .plgc-es__dots .swiper-pagination-bullet::before {
        transition: none !important;
    }

    /* Respect reduced motion: no video autoplay, show poster only */
    .plgc-es__slide--video .plgc-es__play-btn {
        display: none;
    }
}


/* ─────────────────────────────────────────────────────────────────────────────
   VIDEO SLIDES — Play button facade + video container

   WCAG 2.1 AA compliance:
     SC 2.2.2 — No autoplay: user clicks play button to start video
     SC 2.1.1 — Native <button> is keyboard accessible
     SC 2.5.5 — 56×56px button meets 44px minimum touch target
     SC 4.1.2 — aria-label describes "Play video: [headline]"
     SC 2.4.7 — 3px focus ring on play button
     SC 1.4.11 — White play icon on semi-transparent dark bg = well above 3:1
   ───────────────────────────────────────────────────────────────────────────── */

/* Play button — centred on the poster image */
.plgc-es__play-btn {
    position: absolute;
    z-index: 3;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    /* Move up slightly to account for the bottom overlay panel */
    margin-top: -2rem;
    width: 56px;
    height: 56px;
    border: none;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.55);
    color: #FFFFFF;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease, transform 0.2s ease;
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
}

.plgc-es__play-btn:hover {
    background: rgba(0, 0, 0, 0.75);
    transform: translate(-50%, -50%) scale(1.08);
}

.plgc-es__play-btn:focus-visible {
    outline: 3px solid #FFAE40;
    outline-offset: 3px;
}

.plgc-es__play-icon {
    width: 24px;
    height: 24px;
    /* Slight offset to optically centre the triangle within the circle */
    margin-left: 2px;
}

/* Hide play button when video is playing */
.plgc-es__slide--video-playing .plgc-es__play-btn {
    display: none;
}

/* Hide poster image when video is playing */
.plgc-es__slide--video-playing .plgc-es__bg-img {
    opacity: 0;
    pointer-events: none;
}

/* Hide overlay panel when video is playing */
.plgc-es__slide--video-playing .plgc-es__panel,
.plgc-es__slide--video-playing .plgc-es__content {
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

/* Video container — fills the slide, behind the overlay */
.plgc-es__video-container {
    position: absolute;
    inset: 0;
    z-index: 1;
    background: #000;
}

.plgc-es__video-container video,
.plgc-es__video-container iframe {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border: none;
}

/* When video is playing, bring container above poster */
.plgc-es__slide--video-playing .plgc-es__video-container {
    z-index: 4;
}

/* Mobile — play button adjusts to sit above the bottom panel */
@media (max-width: 767px) {
    .plgc-es__play-btn {
        margin-top: -4rem;
        width: 48px;
        height: 48px;
    }

    .plgc-es__play-icon {
        width: 20px;
        height: 20px;
    }
}

/* ── Price line (from tribe_get_cost() — ECP/Tickets) ────────────────────── */
/* Sits between title and CTA. "Free" / "From $25" / "$45 – $120"            */
.plgc-es__price {
    font-family: 'Open Sans', sans-serif;
    font-weight: 600;
    font-size: 0.8125rem;    /* 13px */
    line-height: 1.25rem;
    color: #FFAE40;          /* Yellow — stands out, AA contrast on dark panel */
    margin: 0;
    letter-spacing: 0.02em;
}
