/* ===================================================================
   GB Studio - Gallery Stylesheet
   Dark theme · Collections-based navigation
   =================================================================== */

:root {
    --bg: #1a1b1e;
    --bg-raised: #1e1f23;
    --surface: #25262b;
    --surface-hover: #2c2d32;
    --primary: #3b82f6;
    --primary-dim: rgba(59, 130, 246, 0.15);
    --primary-ghost: rgba(59, 130, 246, 0.06);
    --text: #f0f0f2;
    --text-secondary: #9ca3af;
    --text-muted: #6b7280;
    --border: rgba(255, 255, 255, 0.08);
    --border-hover: rgba(255, 255, 255, 0.15);
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.25);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.35);
    --shadow-lg: 0 8px 30px rgba(0, 0, 0, 0.5);
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --font: 'SF Pro Display', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --cell: 320px;
    --gap: 6px;
    --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
    --ease-smooth: cubic-bezier(0.4, 0, 0.2, 1);
}

/* ---- Reset ---- */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

html {
    overflow-y: auto;
    overflow-x: hidden;
    scroll-behavior: smooth;
    scrollbar-width: thin;
    scrollbar-color: var(--surface-hover) var(--bg);
}

body {
    background: var(--bg);
    color: var(--text);
    font-family: var(--font);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--surface-hover); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--primary); }

.hidden { display: none !important; }


/* ===================================================================
   NAVBAR
   =================================================================== */
.navbar {
    position: sticky;
    top: 0;
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2rem;
    height: 60px;
    background: rgba(26, 27, 30, 0.85);
    -webkit-backdrop-filter: blur(20px) saturate(1.4);
    backdrop-filter: blur(20px) saturate(1.4);
    border-bottom: 1px solid var(--border);
}

.navbar-brand {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text);
    text-decoration: none;
    letter-spacing: -0.02em;
    flex-shrink: 0;
}

.brand-accent { color: var(--primary); font-weight: 400; }

.navbar-tabs { display: flex; gap: 0.25rem; }

.tab-link {
    position: relative;
    padding: 0.45rem 1rem;
    font-size: 0.85rem;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: var(--radius-sm);
    transition: color 0.25s, background 0.25s;
    white-space: nowrap;
    font-weight: 500;
    letter-spacing: 0.01em;
    cursor: pointer;
}

.tab-link:hover { color: var(--text); background: var(--surface); }
.tab-link.active { color: var(--primary); background: var(--primary-dim); }

.main-site-btn {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.4rem 0.9rem;
    font-size: 0.8rem;
    color: var(--text-secondary);
    text-decoration: none;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    transition: all 0.3s ease;
    flex-shrink: 0;
    font-weight: 500;
}

.main-site-btn:hover {
    color: var(--primary);
    border-color: var(--primary);
    background: var(--primary-ghost);
    transform: translateY(-1px);
}

/* Mobile tabs */
.mobile-tabs {
    display: none;
    gap: 0.25rem;
    padding: 0.6rem 1rem;
    background: var(--bg-raised);
    border-bottom: 1px solid var(--border);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}
.mobile-tabs::-webkit-scrollbar { display: none; }


/* ===================================================================
   SEARCH BAR
   =================================================================== */
.search-bar {
    border-bottom: 1px solid var(--border);
    background: var(--bg-raised);
    padding: 0.6rem 2rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.search-wrap {
    position: relative;
    flex: 1;
    max-width: 520px;
}

.search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    color: var(--text-muted);
    pointer-events: none;
}

.search-input {
    width: 100%;
    padding: 0.5rem 0.75rem 0.5rem 36px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 20px;
    color: var(--text);
    font-family: var(--font);
    font-size: 0.82rem;
    outline: none;
    transition: border-color 0.25s ease, background 0.25s ease;
}

.search-input::placeholder { color: var(--text-muted); }
.search-input:focus {
    border-color: var(--primary);
    background: var(--bg);
}

.search-clear {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    width: 20px;
    height: 20px;
    background: var(--surface-hover);
    border: none;
    border-radius: 50%;
    color: var(--text-muted);
    font-size: 12px;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    line-height: 1;
    transition: background 0.2s;
}

.search-clear:hover { background: var(--border-hover); color: var(--text); }
.search-clear.visible { display: flex; }

/* Breadcrumb (shown inside search bar area when viewing a collection) */
.breadcrumb {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.8rem;
    flex-shrink: 0;
}

.breadcrumb-back {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.3rem 0.7rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    color: var(--text-secondary);
    font-size: 0.78rem;
    font-family: var(--font);
    cursor: pointer;
    transition: all 0.25s ease;
    white-space: nowrap;
    font-weight: 500;
}

.breadcrumb-back:hover {
    color: var(--primary);
    border-color: var(--primary);
    background: var(--primary-ghost);
}

.breadcrumb-back svg { width: 14px; height: 14px; flex-shrink: 0; }

.breadcrumb-sep { color: var(--text-muted); }

.breadcrumb-current {
    color: var(--text);
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 200px;
}


/* ===================================================================
   MAIN CONTENT AREA
   =================================================================== */
.gallery-section {
    flex: 1;
    padding: 1.25rem 2rem 3rem;
}

/* -- View transition wrapper -- */
.view-container {
    transition: opacity 0.3s ease;
}

.view-container.fading { opacity: 0; }


/* ===================================================================
   COLLECTIONS VIEW
   =================================================================== */
.collections-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 1.25rem;
    max-width: 1380px;
    margin: 0 auto;
}

.collection-card {
    position: relative;
    border-radius: var(--radius-lg);
    overflow: hidden;
    cursor: pointer;
    background: var(--surface);
    border: 1px solid var(--border);
    transition: transform 0.4s var(--ease-out),
                border-color 0.35s ease,
                box-shadow 0.35s ease;
    opacity: 0;
    animation: cardReveal 0.5s var(--ease-out) forwards;
}

.collection-card:hover {
    transform: translateY(-4px) scale(1.008);
    border-color: rgba(59, 130, 246, 0.35);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45),
                0 0 0 1px rgba(59, 130, 246, 0.15);
}

/* Stagger delays */
.collection-card:nth-child(1)  { animation-delay: 0.04s; }
.collection-card:nth-child(2)  { animation-delay: 0.10s; }
.collection-card:nth-child(3)  { animation-delay: 0.16s; }
.collection-card:nth-child(4)  { animation-delay: 0.22s; }
.collection-card:nth-child(5)  { animation-delay: 0.28s; }
.collection-card:nth-child(6)  { animation-delay: 0.34s; }
.collection-card:nth-child(n+7) { animation-delay: 0.38s; }

@keyframes cardReveal {
    from { opacity: 0; transform: translateY(20px) scale(0.97); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

.collection-cover {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 10;
    overflow: hidden;
    background: var(--bg);
}

.collection-cover img,
.collection-cover video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.6s var(--ease-out);
}

.collection-card:hover .collection-cover img,
.collection-card:hover .collection-cover video {
    transform: scale(1.05);
}

/* Gradient overlay */
.collection-cover::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(
        to top,
        rgba(0, 0, 0, 0.55) 0%,
        rgba(0, 0, 0, 0.1) 40%,
        transparent 60%
    );
    pointer-events: none;
}

/* Item count badge on the cover */
.collection-count {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    padding: 0.2rem 0.6rem;
    background: rgba(0, 0, 0, 0.6);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
    border-radius: 12px;
    font-size: 0.68rem;
    color: rgba(255, 255, 255, 0.85);
    font-weight: 500;
    z-index: 2;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.collection-info {
    padding: 0.9rem 1.1rem 1rem;
}

.collection-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text);
    letter-spacing: -0.01em;
    margin-bottom: 0.2rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.collection-desc {
    font-size: 0.78rem;
    color: var(--text-secondary);
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.collection-date {
    font-size: 0.68rem;
    color: var(--text-muted);
    margin-top: 0.45rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}


/* ===================================================================
   GALLERY GRID (inside a collection)
   =================================================================== */
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(4, var(--cell));
    grid-auto-rows: var(--cell);
    gap: var(--gap);
    max-width: calc(4 * var(--cell) + 3 * var(--gap));
    margin: 0 auto;
    transition: opacity 0.3s ease;
}

.gallery-grid.fading { opacity: 0; }

.gallery-item {
    position: relative;
    overflow: hidden;
    border-radius: var(--radius-md);
    cursor: pointer;
    background: var(--surface);
    border: 1px solid var(--border);
    transition: transform 0.35s var(--ease-out),
                border-color 0.35s ease,
                box-shadow 0.35s ease;
    opacity: 0;
    animation: itemReveal 0.45s var(--ease-out) forwards;
}

.gallery-item::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(0,0,0,0.45) 0%, transparent 50%);
    opacity: 0;
    transition: opacity 0.35s ease;
    pointer-events: none;
    border-radius: inherit;
}

.gallery-item:hover {
    transform: scale(1.015);
    border-color: rgba(59, 130, 246, 0.3);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(59, 130, 246, 0.15);
    z-index: 2;
}

.gallery-item:hover::after { opacity: 1; }

.gallery-item img,
.gallery-item video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.5s var(--ease-out);
}

.gallery-item:hover img,
.gallery-item:hover video { transform: scale(1.04); }

/* Stagger delays */
.gallery-item:nth-child(1)  { animation-delay: 0.03s; }
.gallery-item:nth-child(2)  { animation-delay: 0.07s; }
.gallery-item:nth-child(3)  { animation-delay: 0.11s; }
.gallery-item:nth-child(4)  { animation-delay: 0.15s; }
.gallery-item:nth-child(5)  { animation-delay: 0.19s; }
.gallery-item:nth-child(6)  { animation-delay: 0.23s; }
.gallery-item:nth-child(7)  { animation-delay: 0.27s; }
.gallery-item:nth-child(8)  { animation-delay: 0.31s; }
.gallery-item:nth-child(9)  { animation-delay: 0.35s; }
.gallery-item:nth-child(10) { animation-delay: 0.39s; }
.gallery-item:nth-child(11) { animation-delay: 0.43s; }
.gallery-item:nth-child(12) { animation-delay: 0.47s; }
.gallery-item:nth-child(n+13) { animation-delay: 0.50s; }

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

/* Emphasis grid spans */
.emphasis-1           { grid-column: span 1; grid-row: span 1; }
.emphasis-2.horizontal { grid-column: span 2; grid-row: span 1; }
.emphasis-2.vertical   { grid-column: span 1; grid-row: span 2; }
.emphasis-3            { grid-column: span 2; grid-row: span 2; }

/* Audio thumbnail */
.audio-thumbnail {
    position: relative;
    width: 100%;
    height: 100%;
    background: var(--surface);
}

.audio-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s var(--ease-out);
}

.gallery-item:hover .audio-thumbnail img { transform: scale(1.04); }

.audio-play-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 56px;
    height: 56px;
    background: rgba(0, 0, 0, 0.65);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 3;
    transition: background 0.3s ease, transform 0.3s ease;
    border: 1px solid rgba(255,255,255,0.1);
}

.gallery-item:hover .audio-play-icon {
    background: rgba(59, 130, 246, 0.75);
    transform: translate(-50%, -50%) scale(1.08);
}

.audio-play-icon svg { width: 26px; height: 26px; fill: white; margin-left: 2px; }


/* ===================================================================
   SEARCH RESULTS VIEW
   =================================================================== */
.search-results-header {
    max-width: 1380px;
    margin: 0 auto 1.25rem;
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
}

.search-results-title {
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-weight: 400;
}

.search-results-title strong {
    color: var(--text);
    font-weight: 600;
}

.search-results-count {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Matching collections in search */
.search-collections-row {
    max-width: 1380px;
    margin: 0 auto 1.5rem;
}

.search-collections-label {
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
    font-weight: 600;
    margin-bottom: 0.6rem;
}

.search-collections-list {
    display: flex;
    gap: 0.6rem;
    overflow-x: auto;
    scrollbar-width: none;
    padding-bottom: 0.25rem;
}

.search-collections-list::-webkit-scrollbar { display: none; }

.search-collection-chip {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 0.75rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.25s ease;
    flex-shrink: 0;
}

.search-collection-chip:hover {
    border-color: var(--primary);
    background: var(--primary-ghost);
}

.search-collection-chip-thumb {
    width: 36px;
    height: 24px;
    border-radius: 3px;
    object-fit: cover;
}

.search-collection-chip-name {
    font-size: 0.78rem;
    color: var(--text);
    font-weight: 500;
    white-space: nowrap;
}

.search-collection-chip-count {
    font-size: 0.68rem;
    color: var(--text-muted);
}

/* Item badge showing collection name in search results */
.item-collection-badge {
    position: absolute;
    bottom: 0.5rem;
    left: 0.5rem;
    padding: 0.15rem 0.5rem;
    background: rgba(0, 0, 0, 0.7);
    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);
    border-radius: 10px;
    font-size: 0.62rem;
    color: rgba(255, 255, 255, 0.8);
    z-index: 3;
    pointer-events: none;
    font-weight: 500;
    border: 1px solid rgba(255,255,255,0.06);
}


/* ===================================================================
   LOADING / ERROR / EMPTY STATES
   =================================================================== */
.gallery-loading {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4rem 2rem;
    color: var(--text-muted);
    font-size: 0.85rem;
}

/* Also used outside grids */
.loading-block {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4rem 2rem;
    color: var(--text-muted);
    font-size: 0.85rem;
}

.loading-spinner {
    width: 36px;
    height: 36px;
    border: 3px solid var(--surface-hover);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-bottom: 1rem;
}

@keyframes spin { to { transform: rotate(360deg); } }

.gallery-error,
.gallery-empty,
.collections-empty {
    padding: 3rem 2rem;
    text-align: center;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-size: 0.9rem;
    max-width: 500px;
    margin: 2rem auto;
}

.gallery-error { border-color: rgba(239, 68, 68, 0.25); }

.error-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--surface);
    color: var(--text-muted);
    padding: 1rem;
    height: 100%;
    text-align: center;
    font-size: 0.8rem;
}

.img-error { background: var(--surface); border: 1px dashed var(--border); }

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem 1.2rem;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 0.85rem;
    font-family: var(--font);
    font-weight: 500;
    transition: all 0.25s ease;
    margin-top: 0.75rem;
}

.primary-btn { background: var(--primary); color: #fff; }

.primary-btn:hover {
    background: #2563eb;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.35);
}


/* ===================================================================
   IMAGE VIEWER / LIGHTBOX
   =================================================================== */
.image-viewer {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 1000;
}

.image-viewer.open {
    display: flex;
    align-items: center;
    justify-content: center;
}

.viewer-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(10, 10, 12, 0.92);
    -webkit-backdrop-filter: blur(30px);
    backdrop-filter: blur(30px);
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.viewer-shell {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    max-width: 92vw;
    max-height: 94vh;
    overflow-y: auto;
    scrollbar-width: none;
    animation: viewerEnter 0.35s var(--ease-out);
}
.viewer-shell::-webkit-scrollbar { display: none; }

@keyframes viewerEnter {
    from { opacity: 0; transform: scale(0.96) translateY(8px); }
    to   { opacity: 1; transform: scale(1) translateY(0); }
}

.viewer-close {
    position: fixed;
    top: 1.25rem;
    right: 1.5rem;
    z-index: 10;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 50%;
    width: 42px;
    height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-secondary);
    transition: all 0.25s ease;
}

.viewer-close:hover {
    color: var(--text);
    border-color: var(--primary);
    background: var(--surface-hover);
    transform: rotate(90deg);
}

.nav-btn {
    position: fixed;
    top: 50%;
    transform: translateY(-50%);
    z-index: 10;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--surface);
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-secondary);
    transition: all 0.25s ease;
}

.nav-btn:hover {
    color: var(--text);
    border-color: var(--primary);
    background: var(--surface-hover);
    transform: translateY(-50%) scale(1.05);
}

.nav-prev { left: 1.25rem; }
.nav-next { right: 1.25rem; }

.viewer-media-wrap {
    position: relative;
    min-width: 200px;
    min-height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.viewer-media-loader {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
    transition: opacity 0.3s ease;
}

.viewer-media-loader.loaded { opacity: 0; pointer-events: none; }

.viewer-media-container {
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.35s ease;
}

.viewer-media-container.revealed { opacity: 1; }

.viewer-media-container img.viewer-image {
    max-width: 88vw;
    max-height: 72vh;
    object-fit: contain;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
}

.viewer-media-container video.viewer-video {
    max-width: 88vw;
    max-height: 72vh;
    object-fit: contain;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
}

.audio-player-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    max-width: 420px;
    padding: 1.5rem;
}

.viewer-audio {
    width: 100%;
    margin-bottom: 1.5rem;
    border-radius: 8px;
    filter: invert(1) hue-rotate(180deg);
}

.audio-cover-image {
    max-width: 280px;
    max-height: 280px;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
}

.media-error {
    background: rgba(239, 68, 68, 0.15);
    color: #fca5a5;
    padding: 1.5rem 2rem;
    border-radius: var(--radius-md);
    border: 1px solid rgba(239, 68, 68, 0.2);
    text-align: center;
    font-size: 0.9rem;
}


/* ===================================================================
   VIEWER INFO PANEL
   =================================================================== */
.viewer-info {
    width: 100%;
    max-width: 680px;
    padding: 1.1rem 0 0;
    color: var(--text);
    opacity: 0;
    transition: opacity 0.35s ease 0.1s;
}

.viewer-info.revealed { opacity: 1; }

.viewer-info-main {
    text-align: center;
    margin-bottom: 0.75rem;
}

.viewer-title {
    font-size: 1.1rem;
    font-weight: 600;
    letter-spacing: -0.01em;
    margin-bottom: 0.25rem;
}

.viewer-description {
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.55;
}

.viewer-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: center;
    margin-bottom: 0.65rem;
}

.viewer-meta:empty { display: none; }

.meta-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.3rem 0.65rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 20px;
    font-size: 0.7rem;
    color: var(--text-secondary);
    white-space: nowrap;
}

.meta-chip svg { width: 13px; height: 13px; flex-shrink: 0; opacity: 0.6; }
.meta-chip-label { color: var(--text-muted); margin-right: 0.15rem; }
.meta-chip-value { color: var(--text-secondary); font-weight: 500; }

.cgi-details {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 0.5rem;
    margin-bottom: 0.65rem;
}

.cgi-detail-item {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0.55rem 0.75rem;
}

.cgi-detail-label {
    font-size: 0.62rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    margin-bottom: 0.15rem;
}

.cgi-detail-value { font-size: 0.82rem; color: var(--text-secondary); font-weight: 500; }

.viewer-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
    justify-content: center;
    margin-bottom: 0.65rem;
}

.viewer-tags:empty { display: none; }

.viewer-tag {
    padding: 0.2rem 0.55rem;
    font-size: 0.65rem;
    color: var(--primary);
    background: var(--primary-ghost);
    border: 1px solid rgba(59, 130, 246, 0.15);
    border-radius: 14px;
    cursor: default;
    font-weight: 500;
}

.viewer-actions { display: flex; justify-content: center; padding-top: 0.25rem; }

.viewer-share-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.4rem 0.9rem;
    font-size: 0.75rem;
    font-family: var(--font);
    font-weight: 500;
    color: var(--text-secondary);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.25s ease;
}

.viewer-share-btn:hover {
    color: var(--primary);
    border-color: var(--primary);
    background: var(--primary-ghost);
    transform: translateY(-1px);
}

.viewer-share-btn svg { opacity: 0.7; }

.share-toast {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    padding: 0.6rem 1.2rem;
    background: var(--surface);
    border: 1px solid var(--primary);
    border-radius: 20px;
    color: var(--primary);
    font-size: 0.8rem;
    font-weight: 500;
    z-index: 2000;
    opacity: 0;
    animation: toastIn 0.3s var(--ease-out) forwards,
               toastOut 0.3s ease 1.8s forwards;
    pointer-events: none;
}

@keyframes toastIn  { to { opacity: 1; transform: translateX(-50%) translateY(0); } }
@keyframes toastOut { to { opacity: 0; transform: translateX(-50%) translateY(10px); } }


/* ===================================================================
   FOOTER
   =================================================================== */
.footer {
    margin-top: auto;
    border-top: 1px solid var(--border);
    background: var(--bg-raised);
}

.footer-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    max-width: 1380px;
    margin: 0 auto;
    padding: 1.25rem 2rem;
}

.footer-brand {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.02em;
}

.footer-copy { font-size: 0.78rem; color: var(--text-muted); }

.footer-socials { display: flex; gap: 0.6rem; }

.social-link {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    color: var(--text-secondary);
    border: 1px solid var(--border);
    transition: all 0.25s ease;
}

.social-link:hover {
    color: var(--primary);
    border-color: var(--primary);
    background: var(--primary-ghost);
    transform: translateY(-2px);
}


/* ===================================================================
   RESPONSIVE
   =================================================================== */
@media (max-width: 1380px) {
    .gallery-grid {
        grid-template-columns: repeat(3, var(--cell));
        max-width: calc(3 * var(--cell) + 2 * var(--gap));
    }
}

@media (max-width: 1040px) {
    .gallery-grid {
        grid-template-columns: repeat(2, var(--cell));
        max-width: calc(2 * var(--cell) + 1 * var(--gap));
    }
    .collections-grid { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
}

@media (max-width: 768px) {
    :root { --cell: 1fr; --gap: 5px; }

    .navbar-tabs { display: none; }
    .mobile-tabs { display: flex; }
    .navbar { padding: 0 1.25rem; }
    .search-bar { padding: 0.5rem 1rem; }

    .gallery-section { padding: 0.75rem 0.75rem 2rem; }

    .gallery-grid {
        grid-template-columns: repeat(2, 1fr);
        grid-auto-rows: 48vw;
        max-width: 100%;
    }

    .emphasis-2.horizontal { grid-column: span 2; }
    .emphasis-3 { grid-column: span 2; grid-row: span 2; }

    .collections-grid {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }

    .footer-content {
        flex-direction: column;
        gap: 0.6rem;
        text-align: center;
        padding: 1.25rem;
    }

    .nav-prev { left: 0.5rem; }
    .nav-next { right: 0.5rem; }
    .viewer-close { top: 0.75rem; right: 0.75rem; }

    .viewer-media-container img.viewer-image,
    .viewer-media-container video.viewer-video { max-height: 55vh; }

    .viewer-info { padding: 0.75rem 1rem 0; }
    .cgi-details { grid-template-columns: 1fr 1fr; }

    .breadcrumb-current { max-width: 120px; }
}

@media (max-width: 480px) {
    .gallery-grid { grid-auto-rows: 46vw; }

    .emphasis-2.horizontal,
    .emphasis-2.vertical,
    .emphasis-3 {
        grid-column: span 1;
        grid-row: span 1;
    }

    .cgi-details { grid-template-columns: 1fr; }
}
