/*!
 * skylapse.video - video grid (stage 5A-VIDEOS-GRID).
 *
 * All visual properties use CSS custom properties (var(--vg-*)) so every
 * theme can override them in data/themes.json. See header.php for the
 * :root block that injects theme values.
 */

/* ---- grid container ---- */
.vg-grid {
    display: grid;
    gap: var(--vg-gap, 16px);
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

/* Full-width modifier used on grid pages (videos.php, filter.php,
   search.php). The container carries the 16px gutter through
   .search-content--wide (css/search.css), so the grid itself only fills
   that container edge to edge: no 100vw, no negative margins, therefore
   no clipping and no horizontal scrollbar. */
.vg-grid--full {
    width: 100%;
    max-width: none;
    margin-left: 0;
    margin-right: 0;
    padding-left: 0;
    padding-right: 0;
    box-sizing: border-box;
}

@media (max-width: 1024px) {
    .vg-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 767px) {
    .vg-grid {
        grid-template-columns: 1fr;
    }
}

/* ---- card ---- */
.vg-card {
    position: relative;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    border-radius: var(--vg-radius, 12px);
    background: var(--color-surface);
    cursor: pointer;
}

/* ---- link ---- */
.vg-link {
    display: block;
    width: 100%;
    height: 100%;
    text-decoration: none;
    outline: none;
}

.vg-link:focus-visible {
    outline: 2px solid var(--color-accent);
    outline-offset: -2px;
}

/* ---- video ---- */
.vg-video {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 160ms ease;
}

.vg-card:hover .vg-video {
    transform: scale(var(--vg-hover-scale, 1.02));
}

/* ---- overlay badges (top-left + top-right) ---- */
.vg-badges {
    position: absolute;
    top: 8px;
    left: 8px;
    right: 8px;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    pointer-events: none;
    z-index: 2;
}

/* ---- format badges (horizontal row, top-left) ---- */
.vg-formats {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0;
    pointer-events: auto;
}

.vg-format {
    display: inline-block;
    padding: 3px 7px;
    font-size: 0.8rem;
    font-weight: 600;
    line-height: 1;
    border-radius: 4px;
    background: var(--vg-badge-bg, rgba(0,0,0,0.65));
    color: var(--vg-badge-fg, #fff);
}

.vg-format-sep {
    display: inline-block;
    padding: 0 2px;
    font-size: 0.75rem;
    font-weight: 700;
    line-height: 1;
    color: var(--vg-badge-fg, #fff);
}

/* ---- filter badges (vertical stack, top-right) ---- */
.vg-filters {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 2px;
    pointer-events: auto;
}

.vg-filters--many {
    max-height: 72px;
    overflow: hidden;
}

.vg-filter {
    display: inline-block;
    padding: 2px 8px;
    font-size: 0.72rem;
    font-weight: 500;
    line-height: 1.2;
    border-radius: 4px;
    background: var(--vg-badge-bg, rgba(0,0,0,0.65));
    color: var(--vg-badge-fg, #fff);
    text-decoration: none;
    white-space: nowrap;
    pointer-events: auto;
    transition: opacity 120ms ease;
}

.vg-filter:hover {
    opacity: 0.85;
    text-decoration: underline;
}

.vg-filter--overflow {
    font-weight: 600;
    opacity: 0.75;
    cursor: default;
    pointer-events: none;
}

/* ---- vertical badge (top centre) ---- */
.vg-vertical {
    position: absolute;
    top: 8px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 2;
    padding: 3px 7px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    line-height: 1;
    background: var(--vg-badge-bg, rgba(0,0,0,0.65));
    color: var(--vg-badge-fg, #fff);
    pointer-events: none;
    white-space: nowrap;
}

/* Hide vertical badge on very narrow cards to prevent overlap */
@media (max-width: 480px) {
    .vg-vertical {
        display: none;
    }
}

/* ---- duration (bottom-right) ---- */
.vg-duration {
    position: absolute;
    bottom: 8px;
    right: 8px;
    padding: 3px 7px;
    font-size: 0.75rem;
    font-weight: 500;
    line-height: 1;
    border-radius: 4px;
    background: var(--vg-badge-bg, rgba(0,0,0,0.65));
    color: var(--vg-badge-fg, #fff);
    z-index: 2;
}

/* ---- Buy button (bottom-left) ---- */
.vg-buy {
    position: absolute;
    bottom: 8px;
    left: 8px;
    padding: 8px 14px;
    font-size: 0.85rem;
    font-weight: 700;
    line-height: 1;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    background: var(--vg-accent, var(--color-accent));
    color: var(--vg-buy-fg, #fff);
    z-index: 2;
    transition: opacity 120ms ease, transform 120ms ease;
}

.vg-buy:hover {
    opacity: 0.9;
    transform: scale(1.04);
}

/* ---- shared grid button (pager + sort) ---- */
.vg-btn {
    display: inline-flex;
    align-items: center;
    padding: 6px 14px;
    border-radius: 0;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9rem;
    transition: opacity 120ms ease;
}

.vg-btn:hover {
    opacity: 0.85;
}

/* ---- pager (page navigation, top-right of grid) ---- */
.vg-pager {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    margin: 12px 0;
    font-size: 0.9rem;
}

.vg-pager__prev,
.vg-pager__next {
    background: var(--vg-accent, var(--color-accent));
    color: var(--vg-buy-fg, #fff);
}

.vg-pager__prev--disabled,
.vg-pager__next--disabled {
    opacity: 0.4;
    cursor: default;
    background: var(--color-muted, #666);
    color: var(--color-text, #fff);
}

.vg-pager__select {
    min-width: 64px;
    padding: 5px 8px;
    border: 1px solid var(--color-muted, #888);
    border-radius: 4px;
    background: var(--color-surface, #222);
    color: var(--color-text, #eee);
    font-size: 0.9rem;
    cursor: pointer;
}

/* ---- sort controls (same button look as pager prev/next) ---- */
.vg-sort {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 16px;
}

.vg-sort__btn {
    background: var(--color-muted, #666);
    color: var(--color-text, #eee);
}

.vg-sort__btn.is-active {
    background: var(--vg-accent, var(--color-accent));
    color: var(--vg-buy-fg, #fff);
}

@media (max-width: 767px) {
    .vg-sort {
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .vg-pager {
        flex-wrap: wrap;
        justify-content: center;
    }
}
@media (hover: none) {
    .vg-card:hover .vg-video {
        transform: none;
    }
}

/* Stage 5A-ACCOUNT-ORDERS-UI-V3: the media query above was never closed, so
   every badge rule below was nested inside @media (hover: none) and produced
   unstyled badges on pointer devices. Closed it here. */
/* ---- payment status badges (Stage 5A-PAYMENT-c) ---- */
.order-badge {
    display: inline-block;
    font-size: 0.8125rem;
    font-weight: 600;
    padding: 0.2em 0.55em;
    border-radius: 3px;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    white-space: nowrap;
    vertical-align: middle;
}
.order-badge--paid {
    background: var(--vg-accent, #2ecc71);
    color: #fff;
}
.order-badge--pending {
    background: var(--vg-accent2, #f39c12);
    color: #fff;
}
.order-badge--failed {
    background: rgba(255,255,255,0.15);
    color: #999;
}
/* ---- order action area ---- */
.order-action {
    margin-top: 1.5rem;
}
.order-action .btn--download {
    font-size: 1.05rem;
    padding: 0.7em 1.8em;
}
