/* AMW Gallery 1.3.1 — editorial NGO gallery, dependency-free and strictly scoped. */
.amwg-gallery {
    --amwg-columns: 4;
    --amwg-gap: 20px;
    --amwg-radius: 22px;
    --amwg-accent: #ff5b1f;
    --amwg-overlay: rgba(17, 33, 27, .70);
    --amwg-icon-bg: #ff5b1f;
    display: grid;
    grid-template-columns: repeat(var(--amwg-columns), minmax(0, 1fr));
    gap: var(--amwg-gap);
    width: 100%;
}

.amwg-card {
    position: relative;
    display: block;
    min-width: 0;
    overflow: hidden;
    border-radius: var(--amwg-radius);
    background: #edf0eb;
    color: inherit;
    isolation: isolate;
    text-decoration: none;
    transform: translateZ(0);
    backface-visibility: hidden;
    contain: layout paint style;
}

.amwg-media {
    display: block;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

/*
 * Theme-proof image filling. Many WordPress themes ship rules such as
 * `.elementor img { height:auto }`; Editorial/Grid therefore position the
 * media absolutely and explicitly force the image to cover the entire tile.
 */
.amwg-image {
    display: block;
    width: 100% !important;
    height: 100% !important;
    max-width: none !important;
    object-fit: cover;
    object-position: center center;
    transform: scale(1.001);
    transition: transform .75s cubic-bezier(.2,.76,.2,1), filter .55s ease;
    will-change: transform;
}

.amwg-layout-editorial .amwg-media,
.amwg-layout-grid .amwg-media {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
}
.amwg-layout-editorial .amwg-image,
.amwg-layout-grid .amwg-image {
    position: absolute;
    inset: 0;
}

.amwg-shade {
    position: absolute;
    inset: 0;
    z-index: 2;
    background: linear-gradient(180deg, transparent 35%, var(--amwg-overlay) 115%);
    opacity: 0;
    transition: opacity .38s ease;
    pointer-events: none;
}

/* Aasha-inspired editorial rhythm: large leading story + mixed portrait/landscape tiles. */
.amwg-layout-editorial {
    grid-auto-flow: dense;
    grid-auto-rows: clamp(92px, 8vw, 128px);
}
.amwg-layout-editorial .amwg-card { grid-row: span 2; }
.amwg-layout-editorial .amwg-card:nth-child(8n + 1) { grid-column: span 2; grid-row: span 4; }
.amwg-layout-editorial .amwg-card:nth-child(8n + 4) { grid-row: span 3; }
.amwg-layout-editorial .amwg-card:nth-child(8n + 6) { grid-column: span 2; grid-row: span 2; }
.amwg-layout-editorial .amwg-card:nth-child(8n + 8) { grid-row: span 3; }

.amwg-layout-grid .amwg-card { aspect-ratio: 4 / 3; }

/* JS progressively enhances natural masonry. */
.amwg-layout-masonry .amwg-image {
    position: static;
    width: 100% !important;
    height: auto !important;
    max-width: 100% !important;
    object-fit: initial;
}
.amwg-layout-masonry .amwg-media { position: static; height: auto; }
.amwg-layout-masonry.amwg-masonry-ready {
    grid-auto-rows: 8px;
    align-items: start;
}

.amwg-action {
    position: absolute;
    z-index: 4;
    top: 20px;
    right: 20px;
    display: grid;
    width: 52px;
    height: 52px;
    place-items: center;
    overflow: hidden;
    border-radius: 50%;
    background: var(--amwg-icon-bg, var(--amwg-accent));
    color: #fff;
    opacity: 0;
    transform: translateY(10px) scale(.9);
    transition: opacity .3s ease, transform .45s cubic-bezier(.2,.8,.2,1), background-color .25s ease;
    box-shadow: 0 12px 32px rgba(9, 28, 21, .16);
    pointer-events: none;
}
.amwg-action::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -1;
    background: rgba(0,0,0,.12);
    transform: translateY(105%);
    transition: transform .42s cubic-bezier(.2,.8,.2,1);
}
.amwg-action__icon {
    display: grid;
    place-items: center;
    width: 22px;
    height: 22px;
    line-height: 0;
}
.amwg-action svg {
    display: block;
    width: 22px;
    height: 22px;
    fill: currentColor;
    transition: transform .38s cubic-bezier(.2,.8,.2,1);
}

.amwg-caption {
    position: absolute;
    z-index: 4;
    left: clamp(18px, 2.1vw, 30px);
    right: 76px;
    bottom: clamp(18px, 2vw, 28px);
    color: #fff;
    font-size: clamp(15px, 1.25vw, 20px);
    font-weight: 600;
    line-height: 1.25;
    letter-spacing: -.015em;
    opacity: 0;
    transform: translateY(12px);
    transition: opacity .32s ease, transform .45s cubic-bezier(.2,.8,.2,1);
    pointer-events: none;
}

@media (hover: hover) and (pointer: fine) {
    .amwg-hover-aasha .amwg-card:hover .amwg-shade,
    .amwg-hover-lift .amwg-card:hover .amwg-shade,
    .amwg-hover-zoom .amwg-card:hover .amwg-shade { opacity: 1; }

    .amwg-card:hover .amwg-action,
    .amwg-card:hover .amwg-caption {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
    .amwg-card:hover .amwg-action { color: #fff; }
    .amwg-card:hover .amwg-action::after { transform: translateY(0); }
    .amwg-card:hover .amwg-action svg { transform: translate(2px, -2px); }

    .amwg-hover-aasha .amwg-card:hover .amwg-image { transform: scale(1.075); }
    .amwg-hover-aasha .amwg-card { transition: transform .46s cubic-bezier(.2,.8,.2,1), box-shadow .46s ease; }
    .amwg-hover-aasha .amwg-card:hover { transform: translateY(-3px) translateZ(0); box-shadow: 0 26px 60px rgba(18, 48, 37, .14); }

    .amwg-hover-lift .amwg-card { transition: transform .42s cubic-bezier(.2,.8,.2,1), box-shadow .42s ease; }
    .amwg-hover-lift .amwg-card:hover { transform: translateY(-6px) translateZ(0); box-shadow: 0 24px 58px rgba(18, 48, 37, .16); }
    .amwg-hover-lift .amwg-card:hover .amwg-image,
    .amwg-hover-zoom .amwg-card:hover .amwg-image { transform: scale(1.06); }

    .amwg-hover-none .amwg-card:hover .amwg-shade,
    .amwg-hover-none .amwg-card:hover .amwg-action,
    .amwg-hover-none .amwg-card:hover .amwg-caption { opacity: 0; }
    .amwg-hover-none .amwg-card:hover .amwg-image { transform: none; }
}

.amwg-card:focus-visible { outline: 3px solid var(--amwg-accent); outline-offset: 5px; }

.amwg-reveal .amwg-card { opacity: 0; transform: translateY(24px) scale(.985); }
.amwg-reveal .amwg-card.amwg-inview {
    opacity: 1;
    transform: translateY(0) scale(1);
    transition: opacity .58s ease, transform .72s cubic-bezier(.2,.75,.25,1), box-shadow .4s ease;
}

.amwg-empty {
    padding: 28px;
    border: 1px dashed rgba(0,0,0,.2);
    border-radius: 18px;
    text-align: center;
}

/* Modern accessible lightbox */
.amwg-lightbox {
    position: fixed;
    inset: 0;
    z-index: 999999;
    display: grid;
    place-items: center;
    padding: clamp(16px, 4vw, 58px);
    background: rgba(8, 18, 14, .93);
    opacity: 0;
    visibility: hidden;
    transition: opacity .28s ease, visibility .28s ease;
    backdrop-filter: blur(14px) saturate(.85);
}
.amwg-lightbox.is-open { opacity: 1; visibility: visible; }
.amwg-lightbox__stage { position: relative; display: grid; place-items: center; max-width: 100%; max-height: 100%; }
.amwg-lightbox__image {
    display: block;
    max-width: min(92vw, 1680px);
    max-height: 86vh;
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 18px;
    box-shadow: 0 34px 100px rgba(0,0,0,.42);
    transform: scale(.985);
    transition: transform .3s ease;
}
.amwg-lightbox.is-open .amwg-lightbox__image { transform: scale(1); }
.amwg-lightbox__count {
    position: absolute;
    left: 20px;
    top: 20px;
    color: rgba(255,255,255,.72);
    font-size: 13px;
    letter-spacing: .08em;
}
.amwg-lightbox__close,
.amwg-lightbox__prev,
.amwg-lightbox__next {
    position: absolute;
    display: grid;
    place-items: center;
    width: 50px;
    height: 50px;
    padding: 0;
    border: 1px solid rgba(255,255,255,.18);
    border-radius: 50%;
    background: rgba(255,255,255,.10);
    color: #fff;
    font: inherit;
    font-size: 28px;
    cursor: pointer;
    transition: background .2s ease, transform .2s ease, border-color .2s ease;
    backdrop-filter: blur(8px);
}
.amwg-lightbox__close { top: 20px; right: 20px; }
.amwg-lightbox__prev { left: 20px; top: 50%; transform: translateY(-50%); }
.amwg-lightbox__next { right: 20px; top: 50%; transform: translateY(-50%); }
.amwg-lightbox__close:hover { background: rgba(255,255,255,.2); transform: rotate(5deg); }
.amwg-lightbox__prev:hover { background: rgba(255,255,255,.2); transform: translateY(-50%) translateX(-2px); }
.amwg-lightbox__next:hover { background: rgba(255,255,255,.2); transform: translateY(-50%) translateX(2px); }
body.amwg-no-scroll { overflow: hidden; }

@media (max-width: 1024px) {
    .amwg-gallery { --amwg-columns: min(var(--amwg-columns), 3); }
    .amwg-layout-editorial { grid-template-columns: repeat(3, minmax(0, 1fr)); grid-auto-rows: 105px; }
    .amwg-layout-editorial .amwg-card:nth-child(8n + 1) { grid-column: span 2; grid-row: span 3; }
}
@media (max-width: 767px) {
    .amwg-gallery { grid-template-columns: repeat(2, minmax(0, 1fr)); --amwg-gap: 14px; }
    .amwg-layout-editorial { grid-template-columns: repeat(2, minmax(0, 1fr)); grid-auto-rows: 96px; }
    .amwg-layout-editorial .amwg-card:nth-child(8n + 1) { grid-column: span 2; grid-row: span 3; }
    .amwg-layout-editorial .amwg-card:nth-child(8n + 6) { grid-column: span 2; }
    .amwg-action { top: 14px; right: 14px; width: 44px; height: 44px; }
    .amwg-caption { right: 62px; }
    .amwg-lightbox__prev { left: 8px; }
    .amwg-lightbox__next { right: 8px; }
    .amwg-lightbox__close { top: 10px; right: 10px; }
    .amwg-lightbox__count { left: 12px; top: 12px; }
}
@media (max-width: 479px) {
    .amwg-gallery { grid-template-columns: 1fr; }
    .amwg-layout-editorial { grid-template-columns: 1fr; grid-auto-rows: auto; }
    .amwg-layout-editorial .amwg-card,
    .amwg-layout-editorial .amwg-card:nth-child(n) { grid-column: auto; grid-row: auto; aspect-ratio: 4 / 3; }
    .amwg-layout-editorial .amwg-card:nth-child(4n + 1) { aspect-ratio: 4 / 5; }
}

@media (prefers-reduced-motion: reduce) {
    .amwg-card,
    .amwg-image,
    .amwg-shade,
    .amwg-action,
    .amwg-action::after,
    .amwg-caption,
    .amwg-lightbox,
    .amwg-lightbox__image { transition: none !important; animation: none !important; }
    .amwg-reveal .amwg-card { opacity: 1; transform: none; }
}
