/*
 * Projects/Workbench/MNG/css/gallery.css
 * Gallery Module — filter bar, thumbnail grid, lightbox overlay
 *
 * Companion to js/fg-gallery.js
 * Follows fieldguide.css variables and species.css lightbox conventions.
 *
 * Date: March 2026
 */


/* ================================================================
   FILTER BAR — horizontal scrolling pill row
   ================================================================ */

.gallery-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    padding: 0 0 0.85rem;
    align-items: center;
}

.gallery-pill {
    font-family: var(--font-data);
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.3rem 0.7rem;
    border: 1px solid rgba(44, 36, 22, 0.15);
    border-radius: 20px;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
    line-height: 1.3;
}

.gallery-pill:hover {
    background: rgba(44, 36, 22, 0.06);
    border-color: rgba(44, 36, 22, 0.25);
}

.gallery-pill.active {
    background: var(--text-primary);
    color: #FFFDF7;
    border-color: var(--text-primary);
}

.gallery-pill .pill-count {
    font-weight: 400;
    opacity: 0.7;
    margin-left: 0.15rem;
}

.gallery-pill.active .pill-count {
    opacity: 0.85;
}

.gallery-pill-tag {
    font-style: italic;
}

.gallery-pill-divider {
    display: inline-block;
    width: 1px;
    height: 1.1rem;
    background: rgba(44, 36, 22, 0.15);
    margin: 0 0.15rem;
}


/* ================================================================
   THUMBNAIL GRID — responsive, fills drawer width
   ================================================================ */

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 0.5rem;
}

.gallery-item {
    position: relative;
    border-radius: 5px;
    overflow: hidden;
    background: rgba(44, 36, 22, 0.04);
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s;
}

.gallery-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(44, 36, 22, 0.15);
}

.gallery-item img {
    width: 100%;
    aspect-ratio: 4 / 3;
    object-fit: cover;
    display: block;
}

.gallery-item-icon {
    width: 100%;
    aspect-ratio: 4 / 3;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    background: rgba(44, 36, 22, 0.06);
}


/* ── Type badge — small corner overlay ── */

.gallery-type-badge {
    position: absolute;
    top: 0.3rem;
    right: 0.3rem;
    font-family: var(--font-data);
    font-size: 0.6rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    padding: 0.15rem 0.35rem;
    border-radius: 3px;
    line-height: 1;
    color: #fff;
    background: rgba(44, 36, 22, 0.6);
    pointer-events: none;
}

.gallery-type-photo  { background: rgba(74, 107, 138, 0.75); }
.gallery-type-video  { background: rgba(155, 115, 64, 0.75); }
.gallery-type-pano   { background: rgba(74, 122, 74, 0.75); }
.gallery-type-pano_video { background: rgba(74, 122, 74, 0.75); }
.gallery-type-audio  { background: rgba(139, 115, 85, 0.75); }
.gallery-type-3d     { background: rgba(100, 100, 130, 0.75); }


/* ── Item meta — below thumbnail ── */

.gallery-item-meta {
    padding: 0.3rem 0.4rem;
}

.gallery-item-label {
    font-family: var(--font-data);
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-secondary);
    line-height: 1.3;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.gallery-item-date {
    font-family: var(--font-data);
    font-size: 0.65rem;
    color: var(--text-muted);
    line-height: 1.3;
}


/* ── Empty state ── */

.gallery-empty {
    font-family: var(--font-data);
    font-size: 0.85rem;
    color: var(--text-muted);
    font-style: italic;
    padding: 1.5rem 0;
    text-align: center;
}


/* ================================================================
   LIGHTBOX — fullscreen overlay
   ================================================================ */

.gallery-lb {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(44, 36, 22, 0.85);
    z-index: 3000;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}


/* ── Close button ── */

.gallery-lb-close {
    position: absolute;
    top: 0.8rem;
    right: 1rem;
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
    z-index: 10;
    transition: background 0.15s;
}

.gallery-lb-close:hover {
    background: rgba(255, 255, 255, 0.3);
}


/* ── Nav arrows ── */

.gallery-lb-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
    border: none;
    border-radius: 50%;
    width: 44px;
    height: 44px;
    font-size: 1.8rem;
    line-height: 1;
    cursor: pointer;
    z-index: 10;
    transition: background 0.15s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.gallery-lb-nav:hover {
    background: rgba(255, 255, 255, 0.25);
}

.gallery-lb-prev { left: 0.8rem; }
.gallery-lb-next { right: 0.8rem; }


/* ── Viewer area — contains the media itself ── */

.gallery-lb-viewer {
    max-width: 900px;
    width: 100%;
    max-height: 65vh;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.gallery-lb-img {
    max-width: 100%;
    max-height: 65vh;
    object-fit: contain;
    border-radius: 6px;
    display: block;
    margin: 0 auto;
}

.gallery-lb-video {
    max-width: 100%;
    max-height: 65vh;
    border-radius: 6px;
    display: block;
    margin: 0 auto;
    background: #000;
}

.gallery-lb-pano {
    width: 100%;
    height: 55vh;
    min-height: 280px;
    border-radius: 6px;
    overflow: hidden;
}

.gallery-lb-audio-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
    padding: 2rem;
    color: rgba(255, 255, 255, 0.5);
}

.gallery-lb-audio {
    width: 100%;
    max-width: 400px;
}

.gallery-lb-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 200px;
    color: rgba(255, 255, 255, 0.4);
    font-family: var(--font-data);
    font-size: 1rem;
    font-style: italic;
}

.gallery-lb-play-link {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    margin-top: 0.8rem;
    padding: 0.5rem 1rem;
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
    font-family: var(--font-data);
    font-size: 0.85rem;
    font-weight: 600;
    text-decoration: none;
    border-radius: 5px;
    transition: background 0.15s;
}

.gallery-lb-play-link:hover {
    background: rgba(255, 255, 255, 0.25);
}


/* ── Metadata panel — below viewer ── */

.gallery-lb-meta {
    max-width: 900px;
    width: 100%;
    padding: 0.85rem 0.25rem 0;
    color: rgba(255, 255, 255, 0.9);
}

.gallery-lb-title {
    font-family: var(--font-display);
    font-size: 1.1rem;
    font-weight: 700;
    line-height: 1.3;
}

.gallery-lb-caption {
    font-family: var(--font-data);
    font-size: 0.85rem;
    line-height: 1.5;
    color: rgba(255, 255, 255, 0.75);
    margin-top: 0.3rem;
}

.gallery-lb-details {
    font-family: var(--font-data);
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.55);
    margin-top: 0.35rem;
}

.gallery-lb-attrib {
    font-family: var(--font-data);
    font-size: 0.72rem;
    color: rgba(255, 255, 255, 0.45);
    font-style: italic;
    margin-top: 0.2rem;
}

.gallery-lb-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
    margin-top: 0.5rem;
}

.gallery-lb-tag {
    font-family: var(--font-data);
    font-size: 0.65rem;
    padding: 0.15rem 0.5rem;
    background: rgba(255, 255, 255, 0.12);
    border-radius: 10px;
    color: rgba(255, 255, 255, 0.7);
}

.gallery-lb-source {
    display: inline-block;
    margin-top: 0.45rem;
    font-family: var(--font-data);
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.6);
    text-decoration: none;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    transition: color 0.15s;
}

.gallery-lb-source:hover {
    color: rgba(255, 255, 255, 0.9);
}

.gallery-lb-counter {
    font-family: var(--font-data);
    font-size: 0.7rem;
    color: rgba(255, 255, 255, 0.4);
    margin-top: 0.5rem;
    text-align: right;
}


/* ================================================================
   RESPONSIVE — tighten grid on small screens
   ================================================================ */

@media (max-width: 600px) {
    .gallery-grid {
        grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
        gap: 0.35rem;
    }

    .gallery-item-meta {
        padding: 0.2rem 0.3rem;
    }

    .gallery-item-label {
        font-size: 0.65rem;
    }

    .gallery-lb-nav {
        width: 36px;
        height: 36px;
        font-size: 1.4rem;
    }

    .gallery-lb-prev { left: 0.3rem; }
    .gallery-lb-next { right: 0.3rem; }

    .gallery-lb-pano {
        height: 45vh;
        min-height: 220px;
    }
}
