/* ==========================================================
   About EGN India — page-exclusive rules
   ==========================================================
   Everything reusable (policy-page-intro/policy-intro-meta,
   section/section-header/h2-accent, as-location-grid/carousel/
   map-wrap, as-cta-bar, .pa-* icon-card look, etc.) already
   lives in common.css and is reused as-is. Genuinely new pieces
   of content live here: the intro lead paragraph, the "Past
   Events" city/venue grid, the "EGN Community" text+carousel
   layout, and its click-to-enlarge photo lightbox. Namespace: .ae-*.
   ========================================================== */

/* --- Hero logo, sits above the h1 inside .policy-page-intro --- */
.ae-hero-logo {
    display: block;
    width: 200px;
    max-width: 60%;
    height: auto;
    margin: 0 auto 20px;
}

@media (max-width: 600px) {
    .ae-hero-logo { width: 150px; margin-bottom: 14px; }
}

/* --- Intro lead paragraph, sits inside .policy-page-intro --- */
.ae-intro-lead {
    max-width: 700px;
    margin: 18px auto 0;
    font-size: 1.05rem;
    line-height: 1.7;
    color: var(--text-light);
}

/* ======================================= */
/* LOCATION — "Where to Find Us"            */
/* ======================================= */

/* Centered header on desktop too — same override pattern as #past-events
   below; mobile already centers via common.css's sitewide breakpoint. */
#location .section-header {
    text-align: center;
    max-width: 820px;
    margin-inline: auto;
}

#location .section-header h2 { text-align: center; }

#location .section-header p {
    text-align: center;
    max-width: 700px;
    margin: 0 auto;
}

/* ======================================= */
/* PAST EVENTS — venue/city grid            */
/* ======================================= */

/* Centered header — matches the same ID-scoped centering pattern used
   for #vision-purpose/#egn-unique/#in-collaboration etc. in common.css,
   overriding the sitewide default .section-header { text-align: left }. */
#past-events .section-header {
    text-align: center;
    max-width: 820px;
    margin-inline: auto;
}

#past-events .section-header h2 { text-align: center; }

#past-events .section-header p {
    text-align: center;
    max-width: 700px;
    margin: 0 auto;
}

.ae-past-events-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 16px;
}

.ae-past-event-card {
    overflow: hidden;
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-card);
    /* Grid item wraps an <img>; without this a replaced element's default
       min-width:auto can refuse to shrink below its intrinsic size and
       force the auto-fill grid track wider than intended (same gotcha
       already fixed on contact-international-agency.php's map columns). */
    min-width: 0;
    transition: border-color var(--trans-base), transform var(--trans-base), box-shadow var(--trans-base);
    content-visibility: auto;
    contain-intrinsic-size: 0 220px;
}

.ae-past-event-card:hover {
    border-color: var(--brand-blue);
    transform: translateY(-3px);
    box-shadow: 0 10px 24px rgba(20, 83, 188, 0.1);
}

.ae-past-event-card img {
    display: block;
    width: 100%;
    height: auto;
}

/* ======================================= */
/* EGN COMMUNITY — text (left) + auto-      */
/* playing photo carousel (right). Reuses   */
/* the exact .as-location-carousel/-slide/  */
/* -nav component (and its autoplay JS in   */
/* event-widgets.js) from the "Where to     */
/* Find Us" section above, just with a      */
/* taller portrait aspect-ratio since these */
/* are headshot-style photos. Clicking a    */
/* photo opens the .ae-lightbox-* popup     */
/* defined further below.                   */
/* ======================================= */
.ae-community-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 32px;
    align-items: center;
}

.ae-community-header { margin: 0; }

/* --- Peek carousel: dimmed photo on the left, larger centered   --- */
/* --- photo, dimmed photo on the right. Overrides the base       --- */
/* --- .as-location-carousel single-slide crossfade for this      --- */
/* --- instance only — the "Where to Find Us" carousel above and  --- */
/* --- the shared component on other pages are untouched.         --- */
.ae-community-carousel {
    aspect-ratio: auto;
    max-height: none;
    box-shadow: none;
    border-radius: 0;
    overflow: visible;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px 0;
    /* This is itself a grid item of .ae-community-layout and wraps photo
       <img>s; without this its default min-width:auto content floor can
       force the 1fr/1fr layout wider than the column was meant to be. */
    min-width: 0;
}

.ae-community-carousel .as-location-carousel-track {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 14px;
    width: 100%;
    height: auto;
}

.ae-community-carousel .as-location-slide {
    position: static;
    inset: auto;
    display: none;
    /* Fixed flex-basis for every slide regardless of active/peek state —
       only `transform: scale()` (a paint-only property) changes size below.
       Sizing this via flex-basis instead animated layout on every click,
       reflowing the whole row and bouncing the content that follows the
       section. */
    flex: 0 0 30%;
    aspect-ratio: 3 / 4;
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.1);
    transform: scale(0.72);
    transition: transform 0.5s ease, opacity 0.5s ease, box-shadow 0.5s ease;
}

.ae-community-carousel .as-location-slide.ae-peek-prev,
.ae-community-carousel .as-location-slide.ae-peek-next {
    display: block;
    opacity: 0.5;
}

/* Flexbox lays out children by `order`, not DOM position — without    */
/* this, the visible trio renders in DOM order (active, next, prev)    */
/* instead of the intended left-to-right (prev, active, next).         */
.ae-community-carousel .as-location-slide.ae-peek-prev { order: 1; }
.ae-community-carousel .as-location-slide.active       { order: 2; }
.ae-community-carousel .as-location-slide.ae-peek-next { order: 3; }

.ae-community-carousel .as-location-slide.active {
    display: block;
    opacity: 1;
    transform: scale(1.12);
    z-index: 2;
    box-shadow: 0 20px 46px rgba(10, 20, 40, 0.24);
}

.ae-community-photo-btn {
    display: block;
    width: 100%;
    height: 100%;
    padding: 0;
    border: 0;
    background: none;
    cursor: zoom-in;
}

.ae-community-photo-btn img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* ======================================= */
/* PHOTO LIGHTBOX — opened from the         */
/* community carousel. Same overlay/close-  */
/* button language as .pf-modal-overlay/    */
/* .pf-modal-close, sized for an image      */
/* instead of a form card.                  */
/* ======================================= */
.ae-lightbox-overlay {
    position: fixed;
    inset: 0;
    z-index: 3200;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: rgba(10, 12, 20, 0.85);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity var(--trans-base), visibility var(--trans-base);
}

.ae-lightbox-overlay.is-open { opacity: 1; visibility: visible; pointer-events: auto; }

body.ae-lightbox-open { overflow: hidden; }

.ae-lightbox-img {
    max-width: min(90vw, 720px);
    max-height: 88vh;
    border-radius: var(--radius-sm);
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.5);
    transform: scale(0.96);
    transition: transform var(--trans-base);
    display: block;
}

.ae-lightbox-overlay.is-open .ae-lightbox-img { transform: scale(1); }

.ae-lightbox-close {
    position: fixed;
    top: 20px;
    right: 24px;
    width: 42px;
    height: 42px;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.12);
    color: #ffffff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color var(--trans-base), transform var(--trans-base);
}

.ae-lightbox-close:hover { background: var(--brand-red); transform: scale(1.06); }
.ae-lightbox-close svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }

/* --- Responsive --- */
@media (max-width: 900px) {
    .ae-community-layout  { grid-template-columns: 1fr; gap: 20px; }
    .ae-community-carousel .as-location-slide { flex-basis: 34%; }
}

@media (max-width: 600px) {
    .ae-past-events-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
    .ae-past-event-card  { padding: 16px 18px; }
    .ae-lightbox-close   { top: 12px; right: 12px; width: 38px; height: 38px; }

    /* Peek carousel is too cramped at this width — show only the centered photo. */
    .ae-community-carousel .as-location-slide.ae-peek-prev,
    .ae-community-carousel .as-location-slide.ae-peek-next {
        display: none;
    }
    .ae-community-carousel .as-location-slide.active { flex-basis: 78%; }
}
