/* ============================================================
   AVE Video Gallery — Front-end styles
   Designed to sit cleanly inside Impreza / Uncode themes.
   All selectors are prefixed .ave-vg- to avoid collisions.
   ============================================================ */

/* ── Custom properties (overridable per-instance via inline style) ── */
.ave-vg-wrap {
    --ave-radius:   16px;
    --ave-accent:   #e8c547;
    --ave-bg:       #0a0a0b;
    --ave-text:     #f0ede8;
    --ave-muted:    #6b6b72;
    --ave-overlay:  rgba(10,10,11,0.93);
    --ave-gap:      12px;
    box-sizing: border-box;
}

*, .ave-vg-wrap *,
.ave-vg-wrap *::before,
.ave-vg-wrap *::after {
    box-sizing: inherit;
}

/* ── Header ─────────────────────────────────────────────────────── */
.ave-vg-header {
    text-align: center;
    padding: 0 0 32px;
}

.ave-vg-eyebrow {
    font-size: 11px !important;
    font-weight: 600 !important;
    letter-spacing: 0.22em !important;
    text-transform: uppercase !important;
    color: var(--ave-accent) !important;
    margin: 0 0 10px !important;
}

.ave-vg-title {
    font-size: clamp(32px, 5vw, 64px) !important;
    font-weight: 800 !important;
    line-height: 1 !important;
    margin: 0 0 12px !important;
    color: var(--ave-text) !important;
}

.ave-vg-subtitle {
    font-size: 15px !important;
    color: var(--ave-muted) !important;
    max-width: 500px !important;
    margin: 0 auto !important;
    line-height: 1.6 !important;
}

/* ── Filter bar ─────────────────────────────────────────────────── */
.ave-vg-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
    margin-bottom: 28px;
}

.ave-vg-filter {
    background: transparent;
    border: 1px solid rgba(255,255,255,0.12);
    color: var(--ave-muted);
    font-family: inherit;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    padding: 7px 18px;
    border-radius: 3px;
    cursor: pointer;
    transition: border-color .2s, color .2s, background .2s;
    line-height: 1;
}

.ave-vg-filter:hover,
.ave-vg-filter.active {
    border-color: var(--ave-accent);
    color: var(--ave-accent);
    background: rgba(232,197,71,0.07);
}

/* ── Grid ───────────────────────────────────────────────────────── */
.ave-vg-grid {
    display: grid;
    gap: var(--ave-gap);
    grid-template-columns: repeat(3, 1fr);
}

.ave-vg-cols-2 .ave-vg-grid { grid-template-columns: repeat(2, 1fr); }
.ave-vg-cols-3 .ave-vg-grid { grid-template-columns: repeat(3, 1fr); }
.ave-vg-cols-4 .ave-vg-grid { grid-template-columns: repeat(4, 1fr); }

@media (max-width: 900px) {
    .ave-vg-cols-3 .ave-vg-grid,
    .ave-vg-cols-4 .ave-vg-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 560px) {
    .ave-vg-grid { grid-template-columns: 1fr !important; }
}

/* featured first card spans full width on 3-col */
.ave-vg-cols-3 .ave-vg-card.ave-vg-featured {
    grid-column: span 2;
}

@media (max-width: 900px) {
    .ave-vg-cols-3 .ave-vg-card.ave-vg-featured { grid-column: span 1; }
}

/* ── Card ───────────────────────────────────────────────────────── */
.ave-vg-card {
    position: relative;
    overflow: hidden;
    border-radius: var(--ave-radius);
    background: #111;
    cursor: pointer;
    aspect-ratio: 16 / 9;
    display: block;

    /* entrance animation */
    animation: aveVgCardIn .45s ease both;
}

.ave-vg-card:nth-child(1) { animation-delay: .04s; }
.ave-vg-card:nth-child(2) { animation-delay: .10s; }
.ave-vg-card:nth-child(3) { animation-delay: .16s; }
.ave-vg-card:nth-child(4) { animation-delay: .22s; }
.ave-vg-card:nth-child(5) { animation-delay: .28s; }
.ave-vg-card:nth-child(6) { animation-delay: .34s; }
.ave-vg-card:nth-child(7) { animation-delay: .40s; }
.ave-vg-card:nth-child(8) { animation-delay: .46s; }

@keyframes aveVgCardIn {
    from { opacity: 0; transform: translateY(16px); }
    to   { opacity: 1; transform: translateY(0); }
}

.ave-vg-card[style*="display: none"],
.ave-vg-card[style*="display:none"] {
    animation: none;
}

/* ── Thumbnail ──────────────────────────────────────────────────── */
.ave-vg-thumb {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform .55s cubic-bezier(.25,.46,.45,.94),
                filter .35s ease;
    filter: brightness(.78) saturate(.9);
}

.ave-vg-thumb-placeholder {
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #1a1a1f 0%, #222228 100%);
}

.ave-vg-card:hover .ave-vg-thumb {
    transform: scale(1.055);
    filter: brightness(.55) saturate(.8);
}

/* ── Gradient overlay ───────────────────────────────────────────── */
.ave-vg-card-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(
        to top,
        rgba(10,10,11,.88) 0%,
        rgba(10,10,11,.18) 55%,
        transparent 100%
    );
    border-radius: inherit;
    pointer-events: none;
}

/* ── Play button ────────────────────────────────────────────────── */
.ave-vg-play {
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%,-50%) scale(.8);
    width: 58px; height: 58px;
    border-radius: 50%;
    background: rgba(10,10,11,.45);
    border: 2px solid rgba(255,255,255,.28);
    display: flex; align-items: center; justify-content: center;
    opacity: 0;
    transition: opacity .25s, transform .3s cubic-bezier(.34,1.56,.64,1);
    backdrop-filter: blur(6px);
    pointer-events: none;
}

.ave-vg-card.ave-vg-featured .ave-vg-play {
    width: 72px; height: 72px;
}

.ave-vg-play svg {
    fill: #fff;
    width: 20px; height: 20px;
    margin-left: 3px;
}

.ave-vg-card:hover .ave-vg-play {
    opacity: 1;
    transform: translate(-50%,-50%) scale(1);
}

/* ── Badge ──────────────────────────────────────────────────────── */
.ave-vg-badge {
    position: absolute;
    top: 14px; left: 14px;
    background: var(--ave-accent);
    color: #000;
    font-size: 9px;
    font-weight: 700;
    letter-spacing: .18em;
    text-transform: uppercase;
    padding: 4px 10px;
    border-radius: 3px;
    line-height: 1.4;
}

/* ── Card meta ──────────────────────────────────────────────────── */
.ave-vg-meta {
    position: absolute;
    bottom: 0; left: 0; right: 0;
    padding: 18px 18px 16px;
    transform: translateY(4px);
    transition: transform .25s ease;
    pointer-events: none;
}

.ave-vg-card:hover .ave-vg-meta {
    transform: translateY(0);
}

.ave-vg-cat-label {
    display: block;
    font-size: 9px !important;
    font-weight: 700 !important;
    letter-spacing: .2em !important;
    text-transform: uppercase !important;
    color: var(--ave-accent) !important;
    margin-bottom: 5px !important;
    line-height: 1 !important;
}

.ave-vg-card-title {
    font-size: clamp(15px, 2vw, 21px) !important;
    font-weight: 700 !important;
    color: #fff !important;
    line-height: 1.15 !important;
    margin: 0 0 7px !important;
}

.ave-vg-featured .ave-vg-card-title {
    font-size: clamp(18px, 2.5vw, 28px) !important;
}

.ave-vg-duration {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 11px !important;
    color: rgba(255,255,255,.55) !important;
    line-height: 1 !important;
}

.ave-vg-duration svg {
    fill: rgba(255,255,255,.45);
    width: 12px; height: 12px;
    flex-shrink: 0;
}

/* ── Empty state ─────────────────────────────────────────────────── */
.ave-vg-empty {
    text-align: center;
    padding: 48px;
    color: var(--ave-muted);
    font-style: italic;
    border: 1px dashed rgba(255,255,255,.1);
    border-radius: var(--ave-radius);
}

/* ── Modal overlay ───────────────────────────────────────────────── */
.ave-vg-modal {
    position: fixed;
    inset: 0;
    z-index: 99999;
    background: var(--ave-overlay);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    pointer-events: none;
    transition: opacity .28s ease;
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
}

.ave-vg-modal.is-open {
    opacity: 1;
    pointer-events: all;
}

.ave-vg-modal-inner {
    width: 100%;
    max-width: 920px;
    transform: translateY(20px) scale(.97);
    transition: transform .32s cubic-bezier(.34,1.2,.64,1);
}

.ave-vg-modal.is-open .ave-vg-modal-inner {
    transform: translateY(0) scale(1);
}

.ave-vg-modal-video {
    position: relative;
    width: 100%;
    aspect-ratio: 16/9;
    background: #000;
    border-radius: var(--ave-radius);
    overflow: hidden;
}

.ave-vg-modal-video iframe,
.ave-vg-modal-video video {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: none;
}

.ave-vg-modal-bar {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    padding: 16px 4px 0;
}

.ave-vg-modal-cat {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .2em;
    text-transform: uppercase;
    color: var(--ave-accent);
    margin-bottom: 5px;
}

.ave-vg-modal-title {
    font-size: clamp(18px, 3vw, 30px);
    font-weight: 800;
    color: var(--ave-text);
    line-height: 1.1;
}

.ave-vg-modal-close {
    flex-shrink: 0;
    background: rgba(255,255,255,.06);
    border: 1px solid rgba(255,255,255,.12);
    color: var(--ave-text);
    width: 40px; height: 40px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
    display: flex; align-items: center; justify-content: center;
    transition: border-color .2s, background .2s, color .2s;
    font-family: inherit;
    line-height: 1;
}

.ave-vg-modal-close:hover {
    border-color: var(--ave-accent);
    color: var(--ave-accent);
    background: rgba(232,197,71,.08);
}

/* ── Hide filtered cards ─────────────────────────────────────────── */
.ave-vg-card.ave-vg-hidden {
    display: none !important;
    animation: none !important;
}
