/*
 * Photo Gallery — standalone styles
 * Loaded automatically by photo-gallery/gallery-pagination.php via render_paginated_gallery().
 *
 * Depends on CSS custom properties defined in the site's main stylesheet:
 * --gallery-gap, --gallery-item-bg, --gallery-item-padding, --gallery-item-border,
 * --gallery-item-radius, --gallery-item-shadow, --gallery-img-radius,
 * --gallery-odd-rotate, --gallery-even-rotate, --gallery-3n-rotate,
 * --link-color, --border, --bg-page, --primary, --btn-text, --text-muted,
 * --font-ui, --content-panel-radius
 */

/* ── Image Grid (gallery) ───────────────────────────────────────── */

.img-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: var(--gallery-gap);
    margin-bottom: 2em;
}

.img-grid a {
    display: block;
    overflow: hidden;
    background: var(--gallery-item-bg);
    padding: var(--gallery-item-padding);
    border: var(--gallery-item-border);
    border-radius: var(--gallery-item-radius);
    box-shadow: var(--gallery-item-shadow);
    transition: transform 0.25s, box-shadow 0.25s;
    transform: rotate(var(--gallery-odd-rotate));
}
.img-grid a:nth-child(even) { transform: rotate(var(--gallery-even-rotate)); }
.img-grid a:nth-child(3n)   { transform: rotate(var(--gallery-3n-rotate)); }
.img-grid a:hover { transform: rotate(0deg) scale(1.03); box-shadow: 0 6px 20px rgba(0,0,0,.2); }

.img-grid img {
    width: 100%;
    height: 160px;
    object-fit: cover;
    border-radius: var(--gallery-img-radius);
    display: block;
}

/* ── Gallery pagination ─────────────────────────────────────────── */

.gallery-pagination {
    margin: 2em 0 0;
    text-align: center;
    font-family: var(--font-ui);
}

.gallery-pagination ul {
    list-style: none;
    margin: 0 0 0.5em;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 6px;
}

.gallery-pagination a,
.gallery-pagination .active {
    display: inline-block;
    min-width: 2.25em;
    padding: 8px 12px;
    border-radius: 3px;
    font-size: 0.95rem;
    line-height: 1;
    text-decoration: none;
}

.gallery-pagination a {
    color: var(--link-color);
    border: 1px solid var(--border);
    background: var(--bg-page);
    transition: background 0.2s, color 0.2s, border-color 0.2s;
}
.gallery-pagination a:hover {
    color: var(--btn-text);
    background: var(--primary);
    border-color: var(--primary);
}

.gallery-pagination .active {
    color: var(--btn-text);
    background: var(--primary);
    border: 1px solid var(--primary);
    font-weight: 700;
}

.gallery-pagination .gallery-page-prev,
.gallery-pagination .gallery-page-next {
    min-width: auto;
    font-weight: 600;
}

.gallery-page-info {
    margin: 0;
    font-size: 0.875rem;
    color: var(--text-muted);
}

/* ── Gallery lightbox slideshow ─────────────────────────────────── */

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

.gallery-lightbox {
    position: fixed;
    inset: 0;
    z-index: 300;
    background: rgba(0, 0, 0, 0.92);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 48px 64px;
}
.gallery-lightbox[hidden] { display: none !important; }

.gallery-lightbox-img {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
    display: block;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.45);
}

.gallery-lightbox-close {
    position: absolute;
    top: 16px;
    right: 20px;
    background: transparent;
    border: none;
    color: #fff;
    font-size: 2.5rem;
    line-height: 1;
    cursor: pointer;
    padding: 4px 10px;
    opacity: 0.85;
    transition: opacity 0.2s;
}
.gallery-lightbox-close:hover { opacity: 1; }

.gallery-lightbox-prev,
.gallery-lightbox-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.18);
    border: 1px solid rgba(255, 255, 255, 0.45);
    border-radius: 3px;
    width: 44px;
    height: 44px;
    cursor: pointer;
    font-size: 1.6rem;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}
.gallery-lightbox-prev:hover,
.gallery-lightbox-next:hover { background: rgba(255, 255, 255, 0.35); }
.gallery-lightbox-prev { left: 16px; }
.gallery-lightbox-next { right: 16px; }

.gallery-lightbox-counter {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    margin: 0;
    color: rgba(255, 255, 255, 0.85);
    font-family: var(--font-ui);
    font-size: 0.9rem;
}

/* ── Trophy Room slideshow ──────────────────────────────────────── */

.trophy-slideshow {
    position: relative;
    width: 100%;
    background: #1a1a1a;
    border: 1px solid var(--border);
    border-radius: var(--content-panel-radius);
    overflow: hidden;
    margin-bottom: 2em;
}

.trophy-slideshow .slideshow-track {
    display: flex;
    transition: transform 0.5s ease;
}

.trophy-slideshow .slide {
    flex: 0 0 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 380px;
    padding: 1em;
}

.trophy-slideshow .slide img {
    max-width: 100%;
    max-height: 420px;
    width: auto;
    height: auto;
    object-fit: contain;
    display: block;
}

.trophy-slideshow .slideshow-btn {
    z-index: 2;
}

.trophy-slideshow .slideshow-dots {
    z-index: 2;
}

/* ── Responsive ─────────────────────────────────────────────────── */

@media (max-width: 600px) {
    .gallery-lightbox { padding: 40px 16px; }
    .gallery-lightbox-prev { left: 8px; }
    .gallery-lightbox-next { right: 8px; }
    .trophy-slideshow .slide { min-height: 260px; }
    .trophy-slideshow .slide img { max-height: 280px; }
    .img-grid { grid-template-columns: repeat(2, 1fr); }
    .img-grid img { height: 120px; }
}
