/* ============================================================
   The Retro Vault — Stylesheet
   Apple HIG foundations with retro computing charm
   ============================================================ */

/* --- CSS Variables --- */
:root {
    /* Colors — dark theme with retro warmth */
    --bg-primary: #0a0a12;
    --bg-secondary: #12121e;
    --bg-card: rgba(255, 255, 255, 0.04);
    --bg-card-hover: rgba(255, 255, 255, 0.07);
    --bg-header: rgba(10, 10, 18, 0.85);

    --text-primary: #e8e8ed;
    --text-secondary: #8e8ea0;
    --text-tertiary: #5e5e70;

    --accent: #f5a623;
    --accent-glow: rgba(245, 166, 35, 0.35);
    --accent-secondary: #4ade80;

    --border: rgba(255, 255, 255, 0.08);
    --border-hover: rgba(255, 255, 255, 0.16);
    --border-focus: rgba(245, 166, 35, 0.5);

    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 20px rgba(245, 166, 35, 0.15);

    --radius: 12px;
    --radius-sm: 8px;
    --radius-xs: 6px;
    --radius-full: 9999px;

    /* Apple system font stack */
    --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica Neue', Arial, sans-serif;
    --font-mono: 'SF Mono', 'Menlo', 'Consolas', 'Liberation Mono', 'Courier New', monospace;

    /* Spacing (8px grid) */
    --space-1: 4px;
    --space-2: 8px;
    --space-3: 12px;
    --space-4: 16px;
    --space-5: 20px;
    --space-6: 24px;
    --space-8: 32px;
    --space-10: 40px;
    --space-12: 48px;
    --space-16: 64px;

    /* Layout */
    --container-max: 1200px;
    --header-height: 56px;
}

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

html {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
    scroll-behavior: smooth;
}

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
}

/* --- Base --- */
body {
    font-family: var(--font-sans);
    font-size: 15px;
    line-height: 1.5;
    color: var(--text-primary);
    background-color: var(--bg-primary);
    min-height: 100vh;
    overflow-x: hidden;
}

a {
    color: var(--accent);
    text-decoration: none;
    transition: color 0.2s;
}

a:hover {
    color: #ffc042;
}

img {
    display: block;
    max-width: 100%;
    height: auto;
}

button, select, input {
    font-family: inherit;
    font-size: inherit;
}

/* --- Scanline Overlay (retro effect) --- */
.scanlines {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: repeating-linear-gradient(
        0deg,
        rgba(0, 0, 0, 0.02) 0px,
        rgba(0, 0, 0, 0.02) 1px,
        transparent 1px,
        transparent 3px
    );
    pointer-events: none;
    z-index: 10000;
}

@media (prefers-reduced-motion: reduce) {
    .scanlines { display: none; }
}

/* --- Container --- */
.container {
    max-width: var(--container-max);
    margin: 0 auto;
    padding: 0 var(--space-6);
}

/* --- Header --- */
.site-header {
    position: sticky;
    top: 0;
    z-index: 1000;
    background: var(--bg-header);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border-bottom: 1px solid var(--border);
    height: var(--header-height);
}

.nav-bar {
    display: flex;
    align-items: center;
    height: var(--header-height);
    gap: var(--space-4);
}

.nav-left {
    flex-shrink: 0;
}

.nav-right {
    flex-shrink: 0;
    display: none;
}

.site-brand {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-size: 17px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.02em;
    white-space: nowrap;
}

.site-brand:hover {
    color: var(--text-primary);
}

.site-brand-small {
    display: none;
    align-items: center;
    gap: var(--space-2);
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
}

.brand-icon {
    font-size: 20px;
}

.back-link {
    font-size: 15px;
    font-weight: 500;
    color: var(--accent);
    display: flex;
    align-items: center;
    gap: var(--space-1);
    white-space: nowrap;
}

/* --- Search Bar --- */
.search-bar {
    display: flex;
    align-items: center;
    flex: 1;
    max-width: 480px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: var(--space-2) var(--space-3);
    gap: var(--space-2);
    transition: border-color 0.2s, box-shadow 0.2s;
}

.search-bar:focus-within {
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.search-icon {
    color: var(--text-tertiary);
    flex-shrink: 0;
}

.search-bar input {
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 14px;
    outline: none;
    width: 100%;
    line-height: 1.4;
}

.search-bar input::placeholder {
    color: var(--text-tertiary);
}

.search-shortcut {
    flex-shrink: 0;
    padding: 2px 6px;
    font-size: 11px;
    font-family: var(--font-mono);
    color: var(--text-tertiary);
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--border);
    border-radius: 4px;
    line-height: 1.2;
}

/* --- Hero Section --- */
.hero {
    text-align: center;
    padding: var(--space-16) 0 var(--space-10);
}

.hero-title {
    font-size: clamp(32px, 6vw, 56px);
    font-weight: 800;
    letter-spacing: -0.03em;
    line-height: 1.1;
    margin-bottom: var(--space-4);
    color: var(--text-primary);
}

.hero-title.glow {
    text-shadow:
        0 0 10px var(--accent-glow),
        0 0 30px rgba(245, 166, 35, 0.12),
        0 0 60px rgba(245, 166, 35, 0.06);
    animation: subtleFlicker 5s infinite;
}

@keyframes subtleFlicker {
    0%, 100% { opacity: 1; }
    92% { opacity: 1; }
    93% { opacity: 0.92; }
    94% { opacity: 1; }
    97% { opacity: 0.96; }
    98% { opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
    .hero-title.glow { animation: none; }
}

.hero-tagline {
    font-size: 17px;
    color: var(--text-secondary);
    max-width: 540px;
    margin: 0 auto var(--space-8);
    line-height: 1.5;
}

.hero-welcome {
    max-width: 620px;
    margin: 0 auto var(--space-8);
    color: var(--text-secondary);
    font-size: 16px;
    line-height: 1.6;
}

.hero-welcome p {
    margin-bottom: var(--space-4);
}

.hero-welcome p:first-child {
    display: none; /* Title already shown as h1 */
}

.hero-welcome p:last-child {
    color: var(--accent);
    font-weight: 600;
    font-size: 18px;
    margin-bottom: 0;
}

.hero-stats {
    display: flex;
    justify-content: center;
    gap: var(--space-10);
}

.stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-1);
}

.stat-number {
    font-size: 36px;
    font-weight: 800;
    color: var(--accent);
    font-variant-numeric: tabular-nums;
    font-family: var(--font-mono);
    text-shadow: 0 0 15px var(--accent-glow);
}

.stat-label {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

/* --- Category Grid (Landing Page) --- */
.categories {
    padding-bottom: var(--space-16);
}

.category-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: var(--space-6);
}

.category-card {
    display: block;
    background: var(--bg-card);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    overflow: hidden;
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1),
                box-shadow 0.25s cubic-bezier(0.4, 0, 0.2, 1),
                border-color 0.25s;
    color: inherit;
    text-decoration: none;
}

.category-card:hover {
    transform: translateY(-6px);
    box-shadow: var(--shadow-lg), var(--shadow-glow);
    border-color: var(--border-hover);
    color: inherit;
}

@media (prefers-reduced-motion: reduce) {
    .category-card { transition: none; }
    .category-card:hover { transform: none; }
}

.category-card-image {
    aspect-ratio: 3 / 4;
    overflow: hidden;
    background: var(--bg-secondary);
}

.category-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.category-card:hover .category-card-image img {
    transform: scale(1.05);
}

@media (prefers-reduced-motion: reduce) {
    .category-card-image img { transition: none; }
    .category-card:hover .category-card-image img { transform: none; }
}

.category-card-body {
    padding: var(--space-5) var(--space-6);
}

.category-card-title {
    font-size: 22px;
    font-weight: 700;
    letter-spacing: -0.01em;
    margin: 0 0 var(--space-1);
    color: var(--text-primary);
}

.category-card-count {
    font-size: 14px;
    color: var(--text-secondary);
    font-family: var(--font-mono);
}

/* --- Category Page Header --- */
.category-hero {
    padding: var(--space-10) 0 var(--space-6);
}

.category-page-title {
    font-size: clamp(28px, 5vw, 42px);
    font-weight: 800;
    letter-spacing: -0.02em;
    margin-bottom: var(--space-1);
}

.category-page-count {
    font-size: 15px;
    color: var(--text-secondary);
    font-family: var(--font-mono);
}

/* --- Collection Toolbar --- */
.collection {
    padding-bottom: var(--space-16);
}

.collection-toolbar {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--space-4);
    margin-bottom: var(--space-6);
    flex-wrap: wrap;
}

.filter-bar {
    display: flex;
    gap: var(--space-2);
    flex-wrap: wrap;
}

.filter-chip {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-4);
    border-radius: var(--radius-full);
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
    min-height: 36px;
}

.filter-chip:hover {
    border-color: var(--border-hover);
    color: var(--text-primary);
    background: var(--bg-card);
}

.filter-chip.active {
    background: var(--accent);
    border-color: var(--accent);
    color: #000;
    font-weight: 600;
}

.filter-chip.active:hover {
    background: #ffc042;
    border-color: #ffc042;
}

.chip-count {
    font-size: 11px;
    font-weight: 600;
    opacity: 0.7;
}

.sort-controls {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    flex-shrink: 0;
}

.sort-label {
    font-size: 13px;
    color: var(--text-tertiary);
    white-space: nowrap;
}

.sort-select {
    padding: var(--space-2) var(--space-3);
    padding-right: var(--space-8);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--bg-card);
    color: var(--text-primary);
    font-size: 13px;
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238e8ea0' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 8px center;
    min-height: 36px;
}

.sort-select:focus {
    outline: none;
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

/* --- Item Grid --- */
.item-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: var(--space-5);
}

.item-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    overflow: hidden;
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1),
                box-shadow 0.25s cubic-bezier(0.4, 0, 0.2, 1),
                border-color 0.25s;
}

.item-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg), var(--shadow-glow);
    border-color: var(--border-hover);
}

@media (prefers-reduced-motion: reduce) {
    .item-card { transition: none; }
    .item-card:hover { transform: none; }
}

.item-card.previously-owned {
    opacity: 0.75;
}

.item-card.previously-owned:hover {
    opacity: 1;
}

.card-link {
    display: block;
    color: inherit;
    text-decoration: none;
}

.card-link:hover {
    color: inherit;
}

.card-image {
    aspect-ratio: 3 / 4;
    overflow: hidden;
    background: var(--bg-secondary);
    position: relative;
}

.card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.item-card:hover .card-image img {
    transform: scale(1.05);
}

@media (prefers-reduced-motion: reduce) {
    .card-image img { transition: none; }
    .item-card:hover .card-image img { transform: none; }
}

.card-placeholder {
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, var(--bg-secondary), var(--bg-card));
}

.card-body {
    padding: var(--space-3) var(--space-4) var(--space-4);
}

.card-category {
    display: block;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--accent);
    margin-bottom: var(--space-1);
}

.card-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.3;
    margin: 0;
}

.card-meta {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: var(--space-1);
    font-family: var(--font-mono);
}

.card-year, .card-genre {
    font-family: var(--font-mono);
    font-size: 12px;
}

/* --- Badges --- */
.badge {
    display: inline-block;
    font-size: 11px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: var(--radius-xs);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.badge-category {
    background: rgba(245, 166, 35, 0.15);
    color: var(--accent);
    border: 1px solid rgba(245, 166, 35, 0.25);
}

.badge-sub {
    background: rgba(74, 222, 128, 0.12);
    color: var(--accent-secondary);
    border: 1px solid rgba(74, 222, 128, 0.2);
}

.badge-prev {
    background: rgba(239, 68, 68, 0.12);
    color: #f87171;
    border: 1px solid rgba(239, 68, 68, 0.2);
    font-size: 10px;
    margin-left: var(--space-1);
}

/* --- No Results --- */
.no-results {
    text-align: center;
    padding: var(--space-16) 0;
    color: var(--text-secondary);
}

.no-results-icon {
    font-size: 48px;
    margin-bottom: var(--space-4);
}

.btn-clear-search {
    margin-top: var(--space-4);
    padding: var(--space-2) var(--space-6);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--bg-card);
    color: var(--accent);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-clear-search:hover {
    background: var(--bg-card-hover);
    border-color: var(--accent);
}

.results-count {
    text-align: center;
    padding: var(--space-6) 0;
    color: var(--text-tertiary);
    font-size: 13px;
    font-family: var(--font-mono);
}

/* ============================================================
   Detail Page
   ============================================================ */

.item-detail {
    display: grid;
    grid-template-columns: 1fr 380px;
    gap: var(--space-10);
    padding-top: var(--space-8);
    padding-bottom: var(--space-10);
}

/* --- Gallery --- */
.gallery {
    min-width: 0;
}

.gallery-main {
    border-radius: var(--radius);
    overflow: hidden;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    cursor: pointer;
    position: relative;
}

.gallery-main::after {
    content: 'Click to enlarge';
    position: absolute;
    bottom: var(--space-3);
    right: var(--space-3);
    padding: 4px 10px;
    font-size: 11px;
    color: rgba(255, 255, 255, 0.7);
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    border-radius: var(--radius-xs);
    opacity: 0;
    transition: opacity 0.2s;
    pointer-events: none;
}

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

.gallery-main-img {
    width: 100%;
    display: block;
    transition: none;
}

.gallery-thumbs {
    display: flex;
    gap: var(--space-2);
    margin-top: var(--space-3);
    overflow-x: auto;
    padding-bottom: var(--space-2);
    scrollbar-width: thin;
    scrollbar-color: var(--border) transparent;
}

.gallery-thumb {
    flex-shrink: 0;
    width: 72px;
    height: 54px;
    border-radius: var(--radius-xs);
    overflow: hidden;
    border: 2px solid transparent;
    cursor: pointer;
    transition: border-color 0.2s, opacity 0.2s;
    background: var(--bg-secondary);
    padding: 0;
}

.gallery-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.gallery-thumb:hover {
    border-color: var(--border-hover);
}

.gallery-thumb.active {
    border-color: var(--accent);
}

/* --- Item Info --- */
.item-info {
    min-width: 0;
}

.item-badges {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
    margin-bottom: var(--space-3);
}

.item-title {
    font-size: 28px;
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.2;
    margin-bottom: var(--space-6);
}

.metadata {
    margin-bottom: var(--space-6);
}

.meta-row {
    display: flex;
    padding: var(--space-3) 0;
    border-bottom: 1px solid var(--border);
}

.meta-row:first-child {
    border-top: 1px solid var(--border);
}

.meta-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    width: 100px;
    flex-shrink: 0;
    font-family: var(--font-mono);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.meta-value {
    font-size: 14px;
    color: var(--text-primary);
}

/* --- Credits --- */
.credits-section {
    margin-bottom: var(--space-6);
}

.section-heading {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: var(--space-3);
}

.credit-row {
    display: flex;
    flex-direction: column;
    padding: var(--space-2) 0;
}

.credit-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-family: var(--font-mono);
}

.credit-value {
    font-size: 14px;
    color: var(--text-primary);
    margin-top: 1px;
}

/* --- External Link --- */
.external-link {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-3) var(--space-5);
    border-radius: var(--radius-sm);
    border: 1px solid var(--accent);
    color: var(--accent);
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s;
}

.external-link:hover {
    background: var(--accent);
    color: #000;
}

.external-link svg {
    flex-shrink: 0;
}

/* --- Item Navigation --- */
.item-nav {
    display: flex;
    justify-content: space-between;
    max-width: var(--container-max);
    margin: 0 auto;
    padding: var(--space-6) var(--space-6) var(--space-12);
    border-top: 1px solid var(--border);
}

.item-nav-link {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    transition: color 0.2s;
    max-width: 45%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.item-nav-link:hover {
    color: var(--accent);
}

/* ============================================================
   Lightbox
   ============================================================ */

.lightbox {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.92);
    backdrop-filter: blur(10px);
    z-index: 20000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.25s;
}

.lightbox:not([hidden]) {
    opacity: 1;
}

.lightbox[hidden] {
    display: none;
}

.lightbox-img {
    max-width: 90vw;
    max-height: 85vh;
    object-fit: contain;
    border-radius: var(--radius-sm);
}

.lightbox-close {
    position: absolute;
    top: var(--space-4);
    right: var(--space-4);
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: none;
    background: rgba(255, 255, 255, 0.1);
    color: white;
    font-size: 24px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
    z-index: 1;
}

.lightbox-close:hover {
    background: rgba(255, 255, 255, 0.2);
}

.lightbox-prev,
.lightbox-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: none;
    background: rgba(255, 255, 255, 0.08);
    color: white;
    font-size: 28px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
    z-index: 1;
}

.lightbox-prev { left: var(--space-4); }
.lightbox-next { right: var(--space-4); }

.lightbox-prev:hover,
.lightbox-next:hover {
    background: rgba(255, 255, 255, 0.18);
}

.lightbox-counter {
    position: absolute;
    bottom: var(--space-6);
    left: 50%;
    transform: translateX(-50%);
    font-size: 13px;
    font-family: var(--font-mono);
    color: rgba(255, 255, 255, 0.5);
}

/* ============================================================
   Footer
   ============================================================ */

.site-footer {
    border-top: 1px solid var(--border);
    padding: var(--space-8) 0;
    text-align: center;
    color: var(--text-tertiary);
    font-size: 13px;
}

.footer-sub {
    margin-top: var(--space-2);
    font-size: 12px;
    font-family: var(--font-mono);
    color: var(--text-tertiary);
    opacity: 0.6;
}

/* ============================================================
   Focus & Accessibility
   ============================================================ */

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

.card-link:focus-visible {
    outline-offset: -2px;
    border-radius: var(--radius);
}

/* Screen reader only */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* ============================================================
   Responsive
   ============================================================ */

/* Large tablets and below */
@media (max-width: 960px) {
    .item-detail {
        grid-template-columns: 1fr;
        gap: var(--space-6);
    }
}

/* Tablets */
@media (max-width: 768px) {
    :root {
        --header-height: 52px;
    }

    .category-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .hero {
        padding: var(--space-10) 0 var(--space-8);
    }

    .hero-stats {
        gap: var(--space-6);
    }

    .stat-number {
        font-size: 28px;
    }

    .item-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
        gap: var(--space-4);
    }

    .collection-toolbar {
        flex-direction: column;
    }

    .sort-controls {
        width: 100%;
    }

    .sort-select {
        flex: 1;
    }

    .item-title {
        font-size: 24px;
    }

    .item-nav {
        padding: var(--space-4) var(--space-4) var(--space-8);
    }
}

/* Mobile */
@media (max-width: 480px) {
    .container {
        padding: 0 var(--space-4);
    }

    .category-grid {
        grid-template-columns: 1fr;
        gap: var(--space-4);
    }

    .category-card-body {
        padding: var(--space-3) var(--space-4);
    }

    .category-card-title {
        font-size: 18px;
    }

    .search-shortcut {
        display: none;
    }

    .hero-title {
        font-size: 28px;
    }

    .hero-tagline {
        font-size: 15px;
    }

    .item-grid {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
        gap: var(--space-3);
    }

    .card-body {
        padding: var(--space-2) var(--space-3) var(--space-3);
    }

    .card-title {
        font-size: 14px;
    }

    .meta-row {
        flex-direction: column;
        gap: 2px;
    }

    .meta-label {
        width: auto;
    }

    .gallery-thumb {
        width: 60px;
        height: 45px;
    }

    .lightbox-prev,
    .lightbox-next {
        width: 40px;
        height: 40px;
        font-size: 22px;
    }

    /* On detail page, show small brand and hide back in nav-right */
    .nav-right {
        display: flex;
    }

    .site-brand-small {
        display: flex;
    }
}

/* Very small screens */
@media (max-width: 360px) {
    .item-grid {
        grid-template-columns: 1fr 1fr;
    }

    .filter-chip {
        font-size: 12px;
        padding: var(--space-1) var(--space-3);
    }
}
