/* =========================================
 * WebWeCreate Awards — card layout, pinned scroll (desktop), swiper (mobile)
 *
 * This file extends the existing `.infinite-gallery` styles with card-specific
 * rules. It does NOT replace them — the legacy image-based gallery (without
 * `--cards` modifier) keeps working with the original CSS + JS in Code Snippets.
 * ========================================= */

/* ── Pin wrap (desktop scroll-jacking range) ───────────────────── */
.ig-pin-wrap {
    position: relative;
    width: 100%;
    height: var(--ig-pin-height, 250vh);
}

/* ── Gallery container in card mode ────────────────────────────── */
.infinite-gallery--cards {
    position: sticky;
    top: 0;
    height: 100vh;
    overflow: hidden;
    background: transparent;
}

/* SSR fallback — visible until JS replaces it */
.infinite-gallery--cards .awards-fallback {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    padding: 40px 24px;
    width: 100%;
    max-height: 100vh;
    overflow-y: auto;
}
.infinite-gallery--cards.ig-ready .awards-fallback {
    display: none;
}

/* ── Wrapper / columns (built by JS) ──────────────────────────── */
.infinite-gallery--cards .ig-wrapper {
    display: grid;
    grid-template-columns: repeat(var(--cols, 6), 1fr);
    gap: 20px;
    height: 100%;
    align-items: start;
    padding:20px;
}

.infinite-gallery--cards .ig-column {
    display: flex;
    flex-direction: column;
    gap: 20px;
    will-change: transform;
    /* JS controls transform via scroll progress — no CSS keyframes here */
}

/* ── Award card colour palette (3-step cycle) ─────────────────── */
.award-card[data-color-index="0"] { --card-bg: #660F1D; }
.award-card[data-color-index="1"] { --card-bg: #8C1B2D; }
.award-card[data-color-index="2"] { --card-bg: #3D0911; }

/* ── Award card ───────────────────────────────────────────────── */
.award-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 60px 16px;
    background: var(--card-bg, #660F1D);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 14px;
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    color: #fff;
    transition: transform 0.4s ease, border-color 0.3s ease, background 0.3s ease;
    min-height: 350px;
    justify-content:center;
}

.award-card:hover {
    transform: translateY(-3px);
    border-color: rgba(255, 255, 255, 0.18);
    background: color-mix(in srgb, var(--card-bg, #660F1D) 85%, #fff 15%);
}

.award-card__trophy {
    /* Smaller, framed trophy — like a plaque/certificate vibe */
    width: 35%;
    margin: 0 auto 18px;
    aspect-ratio: 3 / 4;
    padding: 20px;
    border: 1.5px solid currentColor;
    background-size: contain;
    background-position: center;
    background-repeat: no-repeat;
    background-origin: content-box; /* keep image inside the padding box */
    background-clip: content-box;
}

.award-card__text {
    width: 100%;
}

.award-card__title {
    font-size: 1.5rem;
    line-height: 1.2em;
    margin: 0 0 8px;
    font-weight: 800;
    letter-spacing: 0.03em;
    text-transform: uppercase;
}

.award-card__subtitle {
    font-size: 0.79rem;
    line-height: 1.45;
    margin: 0;
    opacity: 0.8;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    font-family: 'Noto Sans Thai';
}

/* ── Fade gradients (top / bottom) ────────────────────────────── */
.infinite-gallery--cards::before,
.infinite-gallery--cards::after {
    content: '';
    position: absolute;
    left: 0;
    width: 100%;
    height: 120px;
    z-index: 5;
    pointer-events: none;
}
.infinite-gallery--cards::before {
    top: 0;
    background: linear-gradient(to bottom,
        var(--ig-fade-color, rgba(0, 0, 0, 1)),
        rgba(0, 0, 0, 0));
}
.infinite-gallery--cards::after {
    bottom: 0;
    background: linear-gradient(to top,
        var(--ig-fade-color, rgba(0, 0, 0, 1)),
        rgba(0, 0, 0, 0));
}

/* ── Mobile / tablet ≤ 1024px: Swiper layout ──────────────────── */
@media (max-width: 1024px) {
    .ig-pin-wrap {
        height: auto;
    }
    .infinite-gallery--cards {
        position: static;
        height: auto;
        min-height: 340px;
    }
    .infinite-gallery--cards::before,
    .infinite-gallery--cards::after {
        display: none;
    }

    .infinite-gallery--cards .ig-swiper {
        width: 100%;
        overflow: hidden;
    }
    .infinite-gallery--cards .ig-swiper .swiper-slide {
        width: 70vw;
        max-width: 320px;
        height: auto;
    }
    .infinite-gallery--cards .ig-swiper .award-card {
        height: 100%;
    }
    .infinite-gallery--cards .ig-swiper .award-card__trophy {
        aspect-ratio: 1 / 1;
    }
}

@media (max-width: 767px) {
    .infinite-gallery--cards .ig-swiper .swiper-slide {
        width: 78vw;
        max-width: none;
        aspect-ratio: 2.5 / 3;
    }
    .award-card {
        padding: 18px 14px 16px;
    }
    .award-card__title {
        font-size: 1.5rem;
    }
    .award-card__subtitle {
        font-size: 1rem;
    }
}

/* ── Reduced motion: collapse to static grid ──────────────────── */
@media (prefers-reduced-motion: reduce) {
    .ig-pin-wrap {
        height: auto;
    }
    .infinite-gallery--cards {
        position: static;
        height: auto;
        overflow: visible;
    }
    .infinite-gallery--cards.ig-ready .awards-fallback {
        display: grid;
    }
    .infinite-gallery--cards .ig-wrapper {
        display: none;
    }
    .infinite-gallery--cards::before,
    .infinite-gallery--cards::after {
        display: none;
    }
}
