/* ==========================================================================
   1. VARIABLES & BASE STYLES
   ========================================================================== */
:root {
    --bg-parchment: #F5E6CA;
    --bg-darker: #E6D2B5;
    --ink-primary: #3E2723;
    --ink-secondary: #5D4037;
    --accent-gold: #B8860B;
    --accent-rust: #A0522D;
    --paper-shadow: 0 10px 30px rgba(62, 39, 35, 0.15);
}

html { scroll-behavior: smooth; }
* { box-sizing: border-box; margin: 0; padding: 0; }

/* Skip to content link (hidden until focused) */
.skip-to-content {
    position: absolute;
    top: -100px;
    left: 0;
    background: var(--ink-primary);
    color: white;
    padding: 1rem;
    text-decoration: none;
    z-index: 10000;
    font-family: 'Special Elite', monospace;
    font-weight: bold;
}

.skip-to-content:focus {
    top: 0;
}

body {
    background-color: var(--bg-parchment);
    background-image: 
        url("https://www.transparenttextures.com/patterns/p6.png"),
        radial-gradient(circle at center, var(--bg-parchment) 0%, var(--bg-darker) 100%);
    color: var(--ink-primary);
    font-family: 'EB Garamond', serif;
    line-height: 1.6;
    min-height: 100vh;
}

/* ==========================================================================
   2. TYPOGRAPHY & BUTTONS
   ========================================================================== */
h1, h2, h3 { font-weight: 700; letter-spacing: -0.02em; color: var(--ink-primary); }
h1 { font-size: 3rem; margin-bottom: 0.5rem; text-align: center; }
h2 { font-size: 2rem; margin-bottom: 1.5rem; border-bottom: 2px solid var(--accent-gold); display: inline-block; }
p { margin-bottom: 1rem; font-size: 1.2rem; }

.tagline { text-align: center; font-style: italic; margin-bottom: 2rem; }
.meta-text { font-family: 'Special Elite', monospace; font-size: 0.9rem; color: var(--ink-secondary); }

.btn-wax {
    display: inline-block;
    background-color: var(--accent-rust);
    color: #fff !important;
    padding: 0.8rem 1.5rem;
    border-radius: 50% 20% / 10% 40%; 
    text-decoration: none;
    font-weight: bold;
    font-family: 'Special Elite', monospace;
    box-shadow: 2px 2px 5px rgba(0,0,0,0.3);
    transition: all 0.2s ease;
    border: none;
    cursor: pointer;
}

.btn-wax:hover {
    transform: scale(1.05) rotate(-1deg);
    filter: brightness(1.1);
    box-shadow: 3px 3px 8px rgba(0,0,0,0.4);
}

.sheet a, .event-entry a, .card-content a, footer a {
    color: #960018; 
    font-family: 'Special Elite', monospace;
    text-decoration: none;
    font-weight: bold;
    transition: all 0.2s ease-in-out;
    text-shadow: 0.5px 0.5px 0px rgba(0, 0, 0, 0.15);
    position: relative;
    display: inline-block;
}

.sheet a:hover, .event-entry a:hover, .card-content a:hover, footer a:hover {
    color: #bc0000;
}

.sheet a::after, .event-entry a::after, .card-content a::after, footer a::after {
    content: '';
    position: absolute;
    width: 0;
    height: 2px;
    bottom: -2px;
    left: 0;
    background-color: #960018;
    transition: width 0.3s ease;
    opacity: 0.4;
}

.sheet a:hover::after, .event-entry a:hover::after, .card-content a:hover::after, footer a:hover::after {
    width: 100%;
}

/* ==========================================================================
   3. LAYOUT COMPONENTS
   ========================================================================== */
.container { max-width: 1000px; margin: 0 auto; padding: 2rem; }
.sheet { background: #fffefae6; padding: 3rem; box-shadow: var(--paper-shadow); border: 1px solid #dcdcdc; margin-bottom: 3rem; position: relative; }
.logo-img { display: block; margin: 0 auto 1rem auto; width: 80px; height: auto; }

/* G-code Easter Eggs */
.gcode-easter-egg {
    font-family: 'Courier New', 'Courier', monospace;
    font-size: 0.6rem;
    color: var(--ink-secondary);
    opacity: 0.25;
    letter-spacing: 1px;
    pointer-events: none;
    z-index: 0;
}

.gcode-top {
    position: absolute;
    top: 0.5rem;
    left: 0.5rem;
}

.gcode-bottom {
    position: absolute;
    bottom: 0.5rem;
    right: 0.5rem;
}

header {
    position: relative;
}

/* User Account Icon */
.user-account-icon {
    position: fixed;
    top: 1rem;
    right: 1rem;
    background: transparent;
    border: 2px solid var(--ink-primary);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    z-index: 1000;
    padding: 0;
}

.user-account-icon svg {
    width: 20px;
    height: 20px;
    stroke: var(--ink-primary);
}

.user-account-icon:hover {
    background: var(--ink-primary);
    transform: scale(1.1);
}

.user-account-icon:hover svg {
    stroke: var(--bg-parchment);
}

.user-account-icon[aria-expanded="true"] {
    background: var(--ink-primary);
}

.user-account-icon[aria-expanded="true"] svg {
    stroke: var(--bg-parchment);
}

/* Section Reference Stamps */
.section-ref {
    position: absolute;
    top: 1rem;
    right: 1rem;
    font-family: 'Special Elite', monospace;
    font-size: 0.65rem;
    color: var(--ink-secondary);
    opacity: 0.4;
    letter-spacing: 0.5px;
    z-index: 1;
    pointer-events: none;
}

#gallery .section-ref {
    position: relative;
    top: 0;
    right: 0;
    display: block;
    margin-bottom: 0.5rem;
    text-align: right;
}

/* Subtle corner watermarks on sections */
.sheet::before {
    content: '';
    position: absolute;
    bottom: 1rem;
    left: 1rem;
    font-family: 'Special Elite', monospace;
    font-size: 0.5rem;
    color: var(--ink-secondary);
    opacity: 0.15;
    transform: rotate(-90deg);
    transform-origin: left bottom;
    pointer-events: none;
    z-index: 0;
}

#about.sheet::before { content: '444569°N'; }
#itinerary.sheet::before { content: '895443°W'; }
#gallery::before { content: 'PLV-54467'; }
#materials.sheet::before { content: '328M-715'; }
#contact.sheet::before { content: 'CCP-54467'; }
#manifest.sheet::before { content: '444569-895443'; }

/* Easter Egg Serial Number */
.easter-egg-serial {
    font-family: 'Special Elite', monospace;
    letter-spacing: 1px;
}

.manifest-container { display: flex; justify-content: space-between; gap: 2rem; margin-top: 1.5rem; }
.manifest-column { flex: 1; }
.manifest-column p { margin-bottom: 0.5rem; border-bottom: 1px dotted rgba(62, 39, 35, 0.2); }

.seal {
    border: 1px dashed var(--ink-secondary);
    padding: 2px 4px;
    background: rgba(184, 134, 11, 0.1);
    font-size: 0.8rem;
}

/* ==========================================================================
   4. NAVIGATION
   ========================================================================== */
nav {
    text-align: center;
    margin-bottom: 3rem;
    border-top: 1px solid var(--ink-primary);
    border-bottom: 1px solid var(--ink-primary);
    padding: 1rem 0;
    position: sticky;
    top: 0;
    background: var(--bg-parchment);
    z-index: 2000; /* Above polaroid cards (z-index: 1000-1001) */
}

.nav-toggle {
    display: none;
    flex-direction: column;
    gap: 5px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 8px;
    margin: 0 auto 1rem auto;
}

.nav-toggle span {
    width: 25px;
    height: 3px;
    background: var(--ink-primary);
    transition: all 0.3s ease;
}

.nav-toggle[aria-expanded="true"] span:nth-child(1) {
    transform: rotate(45deg) translate(8px, 8px);
}

.nav-toggle[aria-expanded="true"] span:nth-child(2) {
    opacity: 0;
}

.nav-toggle[aria-expanded="true"] span:nth-child(3) {
    transform: rotate(-45deg) translate(7px, -7px);
}

.nav-menu {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    flex-wrap: wrap;
}

nav a {
    text-decoration: none;
    color: var(--ink-primary);
    margin: 0 1.5rem;
    font-size: 1.1rem;
    text-transform: uppercase;
    transition: color 0.2s ease;
    position: relative;
}

nav a:hover,
nav a.active {
    color: var(--accent-gold) !important;
}

nav a.active::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--accent-gold);
}

/* ==========================================================================
   5. EVENTS / ITINERARY
   ========================================================================== */
.next-event {
    background: rgba(184, 134, 11, 0.05);
    border: 1px solid var(--accent-gold);
    padding: 1.5rem;
    margin-bottom: 2rem;
    position: relative;
}

.next-event::before {
    content: "UPNEXT";
    position: absolute;
    top: -10px;
    right: 10px;
    background: var(--accent-gold);
    color: white;
    font-family: 'Special Elite', monospace;
    font-size: 0.7rem;
    padding: 2px 8px;
    letter-spacing: 1px;
    box-shadow: 2px 2px 0px rgba(0,0,0,0.2);
}

.event-entry { padding: 0.5rem 0; }

.event-row-compact {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0;
    border-bottom: 1px dotted rgba(62, 39, 35, 0.2);
    font-size: 0.9rem;
}

.event-row-compact:last-child {
    border-bottom: none;
}

/* ==========================================================================
   6. GALLERY & CARDS
   ========================================================================== */
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 2rem;
    padding: 2rem 1rem;
    min-height: 400px;
    justify-items: center; /* Center polaroids in grid cells */
}

.gallery-card {
    background: white;
    border: 1px solid rgba(62, 39, 35, 0.15);
    border-radius: 4px;
    overflow: hidden;
    transition: all 0.3s ease;
    cursor: pointer;
    display: flex;
    flex-direction: column;
}

.gallery-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0,0,0,0.15);
    border-color: var(--accent-gold);
}

.gallery-card.featured {
    border-color: var(--accent-gold);
    border-width: 2px;
}

.card-image-container {
    position: relative;
    width: 100%;
    aspect-ratio: 1;
    overflow: hidden;
    background: var(--bg-darker);
}

.card-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

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

.card-actions {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    opacity: 1; /* Always visible on desktop */
    transition: opacity 0.3s ease;
    z-index: 10;
}

/* Keep hover effect for subtle enhancement, but icons are always visible */
@media (hover: hover) {
    .gallery-card:hover .card-actions {
        opacity: 1; /* Already visible, but keeps transition smooth */
    }
}

.card-action-btn {
    background: #fdfaf3; /* Cream/parchment matching ledger buttons */
    border: 1.2px solid var(--accent-gold); /* Match ledger border width */
    border-radius: 50%;
    width: 32px;
    height: 32px;
    min-width: 32px;
    min-height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    backdrop-filter: blur(4px);
    flex-shrink: 0;
    box-shadow: 1px 1px 3px rgba(0,0,0,0.15); /* Match copy button shadow */
    opacity: 1; /* Always visible */
    position: relative; /* For tooltip positioning */
}

/* Desktop hover - only on devices that support hover */
@media (hover: hover) {
    .card-action-btn:hover {
        background: var(--accent-gold);
        color: white;
        transform: scale(1.1);
        box-shadow: 2px 4px 8px rgba(0,0,0,0.25); /* Match copy button hover shadow */
        opacity: 1; /* Fully opaque on hover */
    }
    
}

.card-content {
    padding: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
}

.card-title {
    font-family: 'Special Elite', monospace;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--ink-primary);
    margin: 0;
    flex: 1;
    line-height: 1.3;
}

.card-badge {
    background: var(--accent-gold);
    color: white;
    padding: 0.2rem 0.5rem;
    border-radius: 3px;
    font-family: 'Special Elite', monospace;
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

    top: auto !important;
    left: auto !important;
}

/* Legacy Polaroid Styles (kept for reference, not actively used) */
.card {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    cursor: zoom-in;
    isolation: isolate;
    touch-action: pan-y;
}

.card::before {
    content: '';
    position: absolute;
    top: -8px;
    left: 50%;
    transform: translateX(-50%);
    width: 20px;
    height: 20px;
    background: var(--accent-gold);
    border-radius: 50% 50% 50% 0;
    transform: translateX(-50%) rotate(-45deg);
    z-index: 3;
    pointer-events: none;
    transition: opacity 0.3s ease;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.card.red-pin::before {
    background: #960018;
}

.polaroid-frame {
    background: #fff;
    padding: 12px 12px 50px 12px;
    box-shadow: 
        0 4px 20px rgba(0,0,0,0.15),
        0 2px 8px rgba(0,0,0,0.1);
    width: 100%;
    max-width: 250px;
    position: relative;
    transition: all 0.3s ease;
    transform-origin: center center;
}

.polaroid-frame img {
    width: 100%;
    height: auto;
    display: block;
    aspect-ratio: 1 / 1;
    object-fit: cover;
    filter: sepia(0.1) contrast(1.05) brightness(0.98);
}

.polaroid-ink {
    position: absolute;
    bottom: 12px; /* At bottom of frame padding area */
    left: 12px;
    right: 12px;
    font-family: 'Cedarville Cursive', cursive;
    font-size: 1.1rem;
    color: var(--ink-primary);
    text-align: center;
    line-height: 1.3;
    padding-top: 8px;
    border-top: 1px solid rgba(62, 39, 35, 0.2);
    z-index: 1; /* In white frame area */
}

.polaroid-copy-wrapper {
    position: absolute;
    top: 18px; /* Top-right corner, like a specimen tag */
    right: 18px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    opacity: 0.9;
    transition: opacity 0.3s ease;
    z-index: 10; /* Above image */
    align-items: center;
    pointer-events: auto; /* Always clickable */
}

/* Polaroid buttons use card-action-btn styles - no need for separate styles */

.polaroid-copy-wrapper button:hover {
    background: var(--accent-gold);
    color: #fff;
    box-shadow: 3px 6px 12px rgba(0,0,0,0.3);
    animation: buttonWiggle 0.4s ease-in-out;
}

.polaroid-copy-wrapper button.copy-success {
    background: #2e7d32;
    border-color: #2e7d32;
    color: #fff;
    animation: checkmarkPulse 0.5s ease-in-out;
}

/* Favorite button styling */
.card-action-btn.favorite-btn.is-favorited,
.favorite-btn.is-favorited {
    color: var(--accent-gold);
}

.card-action-btn.favorite-btn.is-favorited svg,
.favorite-btn.is-favorited svg {
    filter: drop-shadow(0 0 2px rgba(184, 134, 11, 0.5));
}

.card-action-btn.favorite-btn:hover,
.favorite-btn:hover {
    transform: scale(1.1);
}

.card-action-btn.favorite-btn.is-favorited:hover,
.favorite-btn.is-favorited:hover {
    color: var(--accent-rust);
    transform: scale(1.15);
}

/* Ledger table buttons - match gallery card style but smaller */
td .copy-link,
td .favorite-btn {
    background: rgba(253, 250, 243, 0.8); /* Cream/parchment matching gallery buttons */
    border: 1px solid var(--accent-gold);
    border-radius: 50%;
    width: 24px;
    height: 24px;
    min-width: 24px;
    min-height: 24px;
    padding: 0;
    cursor: pointer;
    color: var(--ink-primary);
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 1px 3px rgba(0,0,0,0.15);
    position: relative; /* For tooltips */
}

td .copy-link:hover,
td .favorite-btn:hover {
    background: var(--accent-gold);
    color: white;
    transform: scale(1.1);
    box-shadow: 0 2px 6px rgba(0,0,0,0.25);
    animation: buttonWiggle 0.4s ease-in-out;
}

td .favorite-btn.is-favorited {
    color: var(--accent-gold);
}

td .favorite-btn.is-favorited svg {
    filter: drop-shadow(0 0 2px rgba(184, 134, 11, 0.5));
}

td .favorite-btn.is-favorited:hover {
    color: white;
    background: var(--accent-gold);
}

td .copy-link svg,
td .favorite-btn svg {
    width: 12px;
    height: 12px;
}

/* Lightbox favorite button */
.lb-copy-icon-btn.favorite-btn.is-favorited {
    color: var(--accent-gold);
}

.lb-copy-icon-btn.favorite-btn.is-favorited svg {
    filter: drop-shadow(0 0 3px rgba(184, 134, 11, 0.6));
}

@media (hover: hover) {
    .card:hover .polaroid-frame { 
        transform: translateY(-10px) scale(1.05) !important;
        box-shadow: 
            0 12px 40px rgba(0,0,0,0.25),
            0 6px 20px rgba(0,0,0,0.15);
        z-index: 1000; 
    }
    .card:hover {
        z-index: 1001;
    }
    .card:hover .polaroid-copy-wrapper { 
        opacity: 1 !important; /* Always visible */
    }
    .card:hover::before {
        opacity: 0;
    }
}

@media (max-width: 850px) {
    .gallery-grid {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
        gap: 1rem;
        padding: 1rem 0.5rem;
    }
    
    .card-actions {
        opacity: 1; /* Always visible on mobile */
        gap: 0.5rem;
    }
    
    .card-action-btn {
        width: 28px !important;
        height: 28px !important;
        min-width: 28px !important;
        min-height: 28px !important;
        background: rgba(253, 250, 243, 0.9) !important; /* Slightly translucent cream/parchment on mobile */
        border: 1.2px solid var(--accent-gold) !important; /* Match ledger border */
        opacity: 1 !important; /* Always visible on mobile */
        transition: all 0.2s ease;
    }
    
    .card-action-btn:active,
    .card-action-btn.is-active {
        background: #fdfaf3 !important; /* Full opacity cream/parchment when clicked */
        opacity: 1 !important;
        transform: scale(1.15);
    }
    
    .card-action-btn:hover {
        background: rgba(253, 250, 243, 0.75) !important; /* Keep slightly translucent on hover */
        opacity: 0.75 !important;
    }
    
    .card-action-btn svg {
        width: 14px !important;
        height: 14px !important;
    }
        min-width: 24px !important;
        min-height: 24px !important;
        max-width: 24px !important;
        max-height: 24px !important;
    }
    
    .card.is-focused .polaroid-frame {
        transform: translateY(-10px) scale(1.05) !important;
        box-shadow: 
            0 12px 40px rgba(0,0,0,0.25),
            0 6px 20px rgba(0,0,0,0.15);
        z-index: 1000;
    }
    .card.is-focused {
        z-index: 1001;
    }
    .card.is-focused .polaroid-copy-wrapper { 
        opacity: 1; 
        pointer-events: auto; 
    }
    .card.is-focused::before {
        opacity: 0;
    }
    .card .polaroid-frame {
        transition: transform 0.2s ease, box-shadow 0.2s ease;
    }
}

/* ==========================================================================
   8. LEDGER TABLE
   ========================================================================== */
.ledger-library-container {
    margin: 0 0 20px 0;
    background: #fff;
    border: 2px solid var(--ink-primary);
    box-shadow: 8px 8px 0px var(--bg-darker);
    overflow: hidden;
}

.ledger-library-container .table-container {
    margin: 0;
    border: none;
    background: #fdfaf3;
}

.ledger-ledger-header {
    background: var(--ink-primary);
    color: var(--bg-parchment);
    padding: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
}

.ledger-title-box h2 {
    color: var(--accent-gold);
    font-family: 'Special Elite', monospace;
    font-size: 1.2rem;
    margin: 0;
    border-bottom: none;
    display: block;
}

.ledger-title-box p {
    font-size: 0.75rem;
    letter-spacing: 2px;
    margin: 0;
    opacity: 0.8;
}

.ledger-filter-bar {
    display: flex;
    gap: 15px;
}

.ledger-filter-bar .filter-group {
    display: flex;
    flex-direction: column;
}

.ledger-filter-bar .filter-group label {
    font-family: 'Special Elite', monospace;
    font-size: 0.5rem;
    color: var(--accent-gold);
    margin-bottom: 2px;
}

.ledger-filter-bar .filter-group select {
    background: rgba(255,255,255,0.1);
    border: 1px solid var(--accent-gold);
    color: white;
    font-family: 'Special Elite', monospace;
    font-size: 0.65rem;
    padding: 2px;
    outline: none;
}

.ledger-filter-bar .filter-group select option {
    background: var(--ink-primary);
}

.ledger-filter-bar .filter-toggle {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    margin-top: 2px;
}

.ledger-filter-bar .filter-toggle input[type="checkbox"] {
    cursor: pointer;
    width: 16px;
    height: 16px;
    accent-color: var(--accent-gold);
}

.ledger-filter-bar .filter-toggle .toggle-label {
    font-family: 'Special Elite', monospace;
    font-size: 0.65rem;
    color: white;
    text-transform: uppercase;
    margin: 0;
}
/* Legacy search styles - now using unified filter bar */
.search-stats-compact {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    margin: 1.5rem auto 2rem auto;
    max-width: 1000px;
    padding: 0 2rem;
    flex-wrap: wrap;
}

.search-wrapper {
    position: relative;
    flex: 1;
    min-width: 250px;
    max-width: 400px;
}

.search-icon-wrapper {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 2;
    pointer-events: none;
}

.search-icon {
    width: 18px;
    height: 18px;
    color: var(--ink-secondary);
    opacity: 0.6;
    transition: opacity 0.2s ease;
}

.search-input {
    width: 100%;
    padding: 10px 12px 10px 40px;
    background: #fff;
    border: 1px solid var(--ink-secondary);
    border-radius: 3px;
    font-family: 'EB Garamond', serif;
    font-size: 0.95rem;
    color: var(--ink-primary);
    transition: all 0.2s ease;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.search-input:focus {
    outline: none;
    border-color: var(--accent-gold);
    box-shadow: 0 0 0 2px rgba(184, 134, 11, 0.1), 0 1px 4px rgba(0,0,0,0.08);
}

.search-wrapper:focus-within .search-icon {
    opacity: 1;
    color: var(--accent-gold);
}

.search-input::placeholder {
    color: var(--ink-secondary);
    opacity: 0.6;
    font-style: italic;
}

.search-clear-btn {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    cursor: pointer;
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--ink-secondary);
    line-height: 1;
    z-index: 10;
    transition: all 0.2s ease;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: transparent;
}

.search-clear-btn:hover {
    color: var(--accent-rust);
    background: rgba(160, 82, 45, 0.1);
    transform: translateY(-50%) scale(1.1);
}

.search-clear-btn.hidden {
    display: none !important;
}

/* Stats Bar - Compact Inline */
.stats-bar {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-family: 'Special Elite', monospace;
    font-size: 0.85rem;
    color: var(--ink-secondary);
    flex-shrink: 0;
}

.stat-item {
    white-space: nowrap;
}

.stat-item b {
    color: var(--ink-primary);
    font-weight: 700;
}

.stat-separator {
    opacity: 0.4;
    color: var(--ink-secondary);
}

/* Mobile Responsive */
@media (max-width: 850px) {
    .search-stats-compact {
        flex-direction: column;
        align-items: stretch;
        gap: 1rem;
        padding: 0 1rem;
    }
    
    .search-wrapper {
        max-width: 100%;
    }
    
    .stats-bar {
        justify-content: center;
        font-size: 0.8rem;
    }
}

@media (max-width: 600px) {
    .search-stats-compact {
        margin: 1rem auto 1.5rem auto;
    }
    
    .search-input {
        font-size: 0.9rem;
        padding: 9px 10px 9px 36px;
    }
    
    .search-icon {
        width: 16px;
        height: 16px;
    }
}

.table-container { max-height: 500px; overflow-y: auto; border: 1px solid #dcd1ba; background: #fdfaf3; margin: 20px 0; }
.ledger-table { width: 100%; border-collapse: collapse; font-family: 'Special Elite', monospace; }

/* TIGHTENED COLUMN PADDING */
.ledger-table th, .ledger-table td { 
    border: 1px solid var(--ink-secondary); 
    padding: 8px 10px; /* Reduced from 10px 10px */
}

/* SPECIFICALLY TIGHTEN THE FIRST COLUMN */
.ledger-table td:first-child { 
    padding-left: 6px; /* Bring icons closer to the left edge */
    padding-right: 8px; /* Bring the text closer to the icons */
    white-space: nowrap; 
    display: flex; 
    align-items: center; 
    gap: 4px; /* Tiny gap between icons and the Ref number */
}

.ledger-table th { background: var(--bg-darker); position: sticky; top: 0; z-index: 10; }

.ledger-row.is-pictured {
    background-color: rgba(184, 134, 11, 0.15) !important;
    border-left: 6px solid var(--accent-gold);
    transition: background-color 0.4s ease;
}

.ledger-row.is-pictured td { font-weight: bold; color: var(--ink-primary); }

.artifact-name { position: relative; cursor: help; text-decoration: underline dotted rgba(62, 39, 35, 0.3); }
.archival-note {
    visibility: hidden; opacity: 0; position: absolute; left: 0; top: 120%; 
    width: 280px; background: #3E2723; color: #F5F5DC; padding: 15px;
    border: 1px solid var(--accent-gold); border-radius: 4px; z-index: 999;
    transition: opacity 0.2s; pointer-events: none; font-family: 'EB Garamond', serif;
}
@media (hover: hover) { .artifact-name:hover .archival-note { visibility: visible; opacity: 1; } }

/* TIGHTENED ICONS - Only for ledger table, not gallery cards */
.ledger-table .copy-full, 
.ledger-table .copy-link {
    background: #fdfaf3;
    border: 1.2px solid var(--accent-gold);
    padding: 4px; /* Reduced from 6px to make them smaller/sharper */
    color: var(--ink-primary);
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50% 15% / 15% 50%;
    box-shadow: 1px 1px 3px rgba(0,0,0,0.15);
    margin-right: 2px; /* Reduced from 6px to bring icons together */
    font-size: 0.85rem; /* Slightly smaller icons to fit the tight row */
}

.ledger-table .copy-full:hover, 
.ledger-table .copy-link:hover {
    background: var(--accent-gold);
    color: #fff;
    transform: scale(1.15);
    box-shadow: 2px 4px 8px rgba(0,0,0,0.25);
    animation: buttonWiggle 0.4s ease-in-out;
}

/* Copy success state - checkmark feedback */
.ledger-table .copy-full.copy-success,
.ledger-table .copy-link.copy-success {
    background: #2e7d32;
    border-color: #2e7d32;
    color: #fff;
    animation: checkmarkPulse 0.5s ease-in-out;
}

@keyframes checkmarkPulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}


/* MOBILE DESCRIPTION OVERLAY */
@media (max-width: 850px) {
    /* Create the grey-out effect when a description is active */
    body.desc-active::after {
        content: '';
        position: fixed;
        top: 0; left: 0; width: 100%; height: 100%;
        background: rgba(0, 0, 0, 0.4);
        z-index: 998; /* Just below the note */
    }

    .artifact-name.is-active .archival-note {
        visibility: visible;
        opacity: 1;
        position: fixed; /* Lock to screen, not table row */
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        width: 85vw;
        max-width: 320px;
        z-index: 999;
        pointer-events: auto; /* Allow interaction if needed */
        box-shadow: 0 0 20px rgba(0,0,0,0.5);
        border: 2px solid var(--accent-gold);
    }
}

/* ==========================================================================
   LEDGER VIEW TOGGLE & CARD VIEW
   ========================================================================== */

/* Ledger header - matches material ledger header style */
.ledger-header {
    background: var(--ink-primary);
    color: var(--bg-parchment);
    padding: 12px 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 15px;
}

/* Toggle buttons - right side of header */
.ledger-view-toggle {
    display: flex;
    gap: 4px;
}

.view-toggle-btn {
    background: transparent;
    border: 1px solid rgba(245, 230, 202, 0.3);
    border-radius: 3px;
    padding: 5px 7px;
    cursor: pointer;
    color: var(--bg-parchment);
    opacity: 0.6;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.view-toggle-btn:hover {
    opacity: 0.9;
    background: rgba(245, 230, 202, 0.1);
}

.view-toggle-btn.active {
    opacity: 1;
    background: rgba(245, 230, 202, 0.15);
    border-color: var(--accent-gold);
    color: var(--accent-gold);
}

.view-toggle-btn svg {
    width: 16px;
    height: 16px;
}

/* Cards container - hidden by default */
.ledger-cards-container {
    display: none;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 0.5rem;
    padding: 0.75rem;
    background: #fdfaf3;
    border: 1px solid #dcd1ba;
    margin: 20px 0;
    max-height: 500px;
    overflow-y: auto;
}

.ledger-cards-container.active {
    display: grid;
}

/* Hide table when cards are active */
.table-container.hidden {
    display: none;
}

/* Individual catalog card - compact horizontal layout */
.catalog-card {
    background: #fdfaf3;
    border: 1px solid var(--ink-secondary);
    border-radius: 2px;
    padding: 0.5rem;
    font-family: 'Special Elite', monospace;
    position: relative;
    box-shadow: 2px 2px 0 rgba(62, 39, 35, 0.08);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    cursor: pointer;
    display: flex;
    gap: 0.5rem;
    align-items: flex-start;
}

.catalog-card:hover {
    transform: translateY(-1px);
    box-shadow: 2px 2px 0 rgba(62, 39, 35, 0.12), 4px 4px 8px rgba(0, 0, 0, 0.08);
}

.catalog-card.is-pictured {
    border-left: 3px solid var(--accent-gold);
}

/* Thumbnail image */
.catalog-card-thumb {
    width: 48px;
    height: 48px;
    min-width: 48px;
    border-radius: 2px;
    overflow: hidden;
    background: #e8e0d0;
    border: 1px solid var(--ink-secondary);
    flex-shrink: 0;
}

.catalog-card-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    filter: sepia(0.1);
}

.catalog-card-thumb.no-image {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.6rem;
    color: var(--ink-secondary);
    text-align: center;
    line-height: 1.1;
}

/* Card content - right side */
.catalog-card-content {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

/* Top row: name + actions */
.catalog-card-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 0.5rem;
}

.catalog-card-name {
    font-size: 0.85rem;
    font-weight: normal;
    color: var(--ink-primary);
    margin: 0;
    line-height: 1.2;
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.catalog-card-actions {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
}

.catalog-card-actions .card-action-btn {
    width: 22px;
    height: 22px;
    min-width: 22px;
    min-height: 22px;
}

.catalog-card-actions .card-action-btn svg {
    width: 11px;
    height: 11px;
}

/* Bottom row: ref, material, status */
.catalog-card-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    align-items: center;
    font-size: 0.7rem;
    color: var(--ink-secondary);
}

.catalog-card-ref {
    opacity: 0.7;
}

.catalog-card-material {
    background: rgba(255, 255, 255, 0.6);
    padding: 1px 4px;
    border-radius: 2px;
}

.catalog-card-status {
    font-size: 0.6rem;
    padding: 1px 6px;
    border-radius: 2px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    transform: rotate(-1deg);
}

.catalog-card-status.status-in-stock {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.catalog-card-status.status-catalog {
    background: #fff3cd;
    color: #856404;
    border: 1px solid #ffeeba;
}

.catalog-card-status.status-printing {
    background: #cce5ff;
    color: #004085;
    border: 1px solid #b8daff;
}

.catalog-card-status.status-sold {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* Mobile adjustments for cards */
@media (max-width: 850px) {
    .ledger-cards-container {
        grid-template-columns: 1fr;
        gap: 0.5rem;
        padding: 0.75rem;
        max-height: none;
    }

    .catalog-card-thumb {
        width: 40px;
        height: 40px;
        min-width: 40px;
    }

    .catalog-card-name {
        font-size: 0.8rem;
    }

    .view-toggle-btn {
        padding: 8px 10px;
    }
}

/* ==========================================================================
   7. FILTER BAR & SEARCH
   ========================================================================== */
.unified-filter-bar {
    background: white;
    border: 1px solid var(--ink-secondary);
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    margin: 1.5rem 0;
    /* Not sticky - stays in place */
}

.filter-bar-content {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.5rem 1rem;
    flex-wrap: wrap;
}

.filter-search-compact {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex: 1;
    min-width: 200px;
}

/* Search icon label - sits outside the input */
.search-label {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--ink-secondary);
    flex-shrink: 0;
}

.search-label svg {
    width: 14px;
    height: 14px;
}

.search-wrapper-compact {
    display: flex;
    align-items: center;
    background: white;
    border: 1px solid var(--ink-secondary);
    border-radius: 3px;
    padding: 0.3rem 0.5rem;
    flex: 0 1 auto;
    min-width: 120px;
    max-width: 200px;
}

.search-input-compact {
    border: none;
    outline: none;
    font-family: 'Special Elite', monospace;
    font-size: 0.75rem;
    color: var(--ink-primary);
    flex: 1;
    min-width: 0;
    padding: 0.25rem 0;
}

.search-input-compact::placeholder {
    color: var(--ink-secondary);
    opacity: 0.6;
}

.stats-bar-compact {
    display: flex;
    gap: 0.5rem;
    font-family: 'Special Elite', monospace;
    font-size: 0.65rem;
    color: var(--ink-secondary);
    white-space: nowrap;
}

.stat-separator {
    color: var(--ink-secondary);
    opacity: 0.3;
}

.filter-controls-compact {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.filter-toggle-compact {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    cursor: pointer;
    font-family: 'Special Elite', monospace;
    font-size: 0.7rem;
    white-space: nowrap;
}

.filter-toggle-compact input[type="checkbox"] {
    width: 14px;
    height: 14px;
    cursor: pointer;
    accent-color: var(--accent-gold);
    flex-shrink: 0;
}

.filter-select-compact {
    background: white;
    border: 1px solid var(--ink-secondary);
    padding: 0.25rem 0.5rem;
    font-family: 'Special Elite', monospace;
    font-size: 0.7rem;
    color: var(--ink-primary);
    cursor: pointer;
    transition: border-color 0.2s ease;
    border-radius: 3px;
}

.filter-select-compact:hover,
.filter-select-compact:focus {
    border-color: var(--accent-gold);
    outline: none;
}

.active-filters-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: var(--bg-darker);
    border-top: 1px solid rgba(62, 39, 35, 0.1);
}

.filter-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--accent-gold);
    color: white;
    padding: 0.2rem 0.6rem;
    border-radius: 3px;
    font-family: 'Special Elite', monospace;
    font-size: 0.65rem;
}

.filter-chip-remove {
    background: transparent;
    border: none;
    color: white;
    cursor: pointer;
    padding: 0;
    display: flex;
    align-items: center;
    font-size: 0.9rem;
    line-height: 1;
}

.filter-chip-remove:hover {
    opacity: 0.8;
}

@media (max-width: 850px) {
    .filter-bar-content {
        flex-direction: column;
        align-items: stretch;
        gap: 0.75rem;
    }
    
    .filter-search-compact {
        flex-direction: column;
        align-items: stretch;
        gap: 0.5rem;
    }
    
    .search-wrapper-compact {
        max-width: 100%;
    }
    
    .stats-bar-compact {
        font-size: 0.6rem;
        flex-wrap: wrap;
    }
    
    .filter-controls-compact {
        flex-direction: column;
        align-items: stretch;
        gap: 0.5rem;
    }
    
    .filter-toggle-compact,
    .filter-select-compact {
        width: 100%;
    }
}



/* Polaroid Card Container */
.card {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    cursor: zoom-in;
    isolation: isolate;
    touch-action: pan-y;
    transition: transform 0.3s ease;
}

/* Pin graphic - yellow by default */
.card::before {
    content: '';
    position: absolute;
    top: -8px;
    left: 50%;
    transform: translateX(-50%) rotate(-45deg);
    width: 20px;
    height: 20px;
    background: var(--accent-gold);
    border-radius: 50% 50% 50% 0;
    z-index: 3;
    pointer-events: none;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

/* Red pin for mandatory/featured items */
.card.featured::before {
    background: #960018;
}

/* Polaroid Frame */
.polaroid-frame {
    background: #fff;
    padding: 12px 12px 50px 12px; /* Bottom padding for text only */
    box-shadow: 
        0 4px 20px rgba(0,0,0,0.15),
        0 2px 8px rgba(0,0,0,0.1);
    width: 100%;
    max-width: 250px;
    position: relative;
    transition: all 0.3s ease;
    transform-origin: center center;
}

.polaroid-frame img {
    width: 100%;
    height: auto;
    display: block;
    aspect-ratio: 1 / 1;
    object-fit: cover;
    filter: sepia(0.1) contrast(1.05) brightness(0.98);
}

/* Handwritten label on polaroid */
.polaroid-ink {
    position: absolute;
    bottom: 12px; /* At bottom of frame padding area */
    left: 12px;
    right: 12px;
    z-index: 1; /* Above image, below buttons */
    font-family: 'Gloria Hallelujah', cursive;
    font-size: 1.1rem;
    color: var(--ink-primary);
    text-align: center;
    line-height: 1.3;
    padding-top: 8px;
    border-top: 1px solid rgba(62, 39, 35, 0.2);
}

/* Copy buttons wrapper - REMOVED DUPLICATE - using updated version above */


/* Wobble animation */
@keyframes wobble {
    0%, 100% { transform: rotate(0deg); }
    25% { transform: rotate(-2deg); }
    75% { transform: rotate(2deg); }
}

/* Hover effects with wobble */
@media (hover: hover) {
    .card:hover .polaroid-frame { 
        transform: translateY(-10px) scale(1.05) !important;
        box-shadow: 
            0 12px 40px rgba(0,0,0,0.25),
            0 6px 20px rgba(0,0,0,0.15);
        z-index: 1000; 
        animation: wobble 0.5s ease-in-out;
    }
    .card:hover {
        z-index: 1001;
    }
    .card:hover .polaroid-copy-wrapper { 
        opacity: 1 !important; /* Always visible */
        pointer-events: auto;
    }
}

/* Mobile touch handling with wobble */
@media (max-width: 850px) {
    .gallery-grid {
        grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
        gap: 1.5rem;
        padding: 1rem 0.5rem;
    }
    
    .card.is-focused .polaroid-frame {
        transform: translateY(-10px) scale(1.05) !important;
        box-shadow: 
            0 12px 40px rgba(0,0,0,0.25),
            0 6px 20px rgba(0,0,0,0.15);
        z-index: 1000;
        animation: wobble 0.5s ease-in-out;
    }
    .card.is-focused {
        z-index: 1001;
    }
    .card.is-focused .polaroid-copy-wrapper { 
        opacity: 1; 
        pointer-events: auto; 
    }
    .card .polaroid-frame {
        transition: transform 0.2s ease, box-shadow 0.2s ease;
    }
    
    /* Wobble on tap/click */
    .card:active .polaroid-frame {
        animation: wobble 0.3s ease-in-out;
    }
    
    /* Make buttons visible on mobile when card is focused */
    .card.is-focused .polaroid-copy-wrapper {
        opacity: 1;
    }
}

/* Random rotation will be applied via JavaScript */
/* Mandatory items get less rotation, non-mandatory get more */

/* Duplicate removed - using styles from earlier in file */

/* THE WIGGLE ANIMATION */
@keyframes buttonWiggle {
    0% { transform: rotate(0deg); }
    25% { transform: rotate(-8deg); }
    50% { transform: rotate(8deg); }
    75% { transform: rotate(-4deg); }
    100% { transform: rotate(0deg); }
}

.polaroid-copy-wrapper button:hover {
    background: var(--accent-gold);
    color: #fff;
    box-shadow: 3px 6px 12px rgba(0,0,0,0.3);
    animation: buttonWiggle 0.4s ease-in-out;
}

.polaroid-copy-wrapper button.copy-success {
    background: #2e7d32;
    border-color: #2e7d32;
    color: #fff;
    animation: checkmarkPulse 0.5s ease-in-out;
}

.specimen-frame img { 
    width: 100%; 
    aspect-ratio: 1 / 1;
    object-fit: cover; 
    display: block;
    border: 1px solid rgba(62, 39, 35, 0.1);
    filter: sepia(0.08) contrast(1.05) brightness(0.98);
}

.specimen-label { 
    display: block; 
    font-family: 'Special Elite', monospace; 
    font-size: 0.7rem; 
    color: #3E2723; 
    text-align: center; 
    margin-top: 6px;
    padding-top: 6px;
    border-top: 1px solid rgba(62, 39, 35, 0.2);
    line-height: 1.3;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

.specimen-ref {
    display: block;
    font-size: 0.6rem;
    color: #8B5A3C;
    margin-top: 3px;
    font-weight: normal;
    opacity: 0.8;
}

/* GALLERY MANIFESTATION BAY */
.manifestation-bay {
    display: flex;
    gap: 1.5rem;
    margin-bottom: 2.5rem;
    border: 1px dashed var(--ink-secondary);
    padding: 1.5rem;
    background: rgba(255, 255, 255, 0.2);
    flex-wrap: wrap;
    justify-content: center;
}

.status-indicator {
    font-family: 'Special Elite', monospace;
    font-size: 0.75rem;
    margin-bottom: 1rem;
    color: var(--ink-primary);
}

.pulse-dot {
    height: 8px; width: 8px; background: #c0392b; border-radius: 50%;
    display: inline-block; margin-right: 8px;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(192, 57, 43, 0.7); }
    70% { transform: scale(1); box-shadow: 0 0 0 6px rgba(192, 57, 43, 0); }
    100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(192, 57, 43, 0); }
}

.manifest-slot { flex: 1; max-width: 200px; text-align: center; }
.slot-label { font-family: 'Special Elite'; font-size: 0.65rem; display: block; margin-bottom: 8px; }
.slot-frame { width: 100%; aspect-ratio: 1; border: 1px solid var(--ink-primary); background-size: cover; background-position: center; }
.slot-frame.mystery { background: var(--bg-darker); display: flex; align-items: center; justify-content: center; }
.mystery-glyph { font-size: 3rem; opacity: 0.2; font-family: 'Special Elite'; animation: flicker 3s infinite; }
.slot-meta { font-family: 'Special Elite'; font-size: 0.7rem; margin-top: 8px; text-transform: uppercase; }

@keyframes flicker { 0%, 100% { opacity: 0.1; } 50% { opacity: 0.3; } }


/* ==========================================================================
   8. LEDGER TABLE
   ========================================================================== */
.ledger-library-container {
    margin: 0 0 20px 0;
    background: #fff;
    border: 2px solid var(--ink-primary);
    box-shadow: 8px 8px 0px var(--bg-darker);
    overflow: hidden;
}

.ledger-library-container .table-container {
    margin: 0;
    border: none;
    background: #fdfaf3;
}

.ledger-ledger-header {
    background: var(--ink-primary);
    color: var(--bg-parchment);
    padding: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
}

.ledger-title-box h2 {
    color: var(--accent-gold);
    font-family: 'Special Elite', monospace;
    font-size: 1.2rem;
    margin: 0;
    border-bottom: none;
    display: block;
}

.ledger-title-box p {
    font-size: 0.75rem;
    letter-spacing: 2px;
    margin: 0;
    opacity: 0.8;
}

.ledger-filter-bar {
    display: flex;
    gap: 15px;
}

.ledger-filter-bar .filter-group {
    display: flex;
    flex-direction: column;
}

.ledger-filter-bar .filter-group label {
    font-family: 'Special Elite', monospace;
    font-size: 0.5rem;
    color: var(--accent-gold);
    margin-bottom: 2px;
}

.ledger-filter-bar .filter-group select {
    background: rgba(255,255,255,0.1);
    border: 1px solid var(--accent-gold);
    color: white;
    font-family: 'Special Elite', monospace;
    font-size: 0.65rem;
    padding: 2px;
    outline: none;
}

.ledger-filter-bar .filter-group select option {
    background: var(--ink-primary);
}

.ledger-filter-bar .filter-toggle {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    margin-top: 2px;
}

.ledger-filter-bar .filter-toggle input[type="checkbox"] {
    cursor: pointer;
    width: 16px;
    height: 16px;
    accent-color: var(--accent-gold);
}

.ledger-filter-bar .filter-toggle .toggle-label {
    font-family: 'Special Elite', monospace;
    font-size: 0.65rem;
    color: white;
    text-transform: uppercase;
    margin: 0;
}

.table-container { 
    max-height: 500px; 
    overflow-y: auto; 
    border: 1px solid #dcd1ba; 
    background: #fdfaf3; 
    margin: 20px 0; 
}

.ledger-table { 
    width: 100%; 
    border-collapse: collapse; 
    font-family: 'Special Elite', monospace; 
}

.ledger-table th, .ledger-table td { 
    border: 1px solid var(--ink-secondary); 
    padding: 8px 10px;
}

.ledger-table td:first-child { 
    padding-left: 6px;
    padding-right: 8px;
    white-space: nowrap; 
    display: flex; 
    align-items: center; 
    gap: 4px;
}

.ledger-table th { 
    background: var(--bg-darker); 
    position: sticky; 
    top: 0; 
    z-index: 10; 
}

.ledger-row.is-pictured {
    background-color: rgba(184, 134, 11, 0.15) !important;
    border-left: 6px solid var(--accent-gold);
    transition: background-color 0.4s ease;
}

.ledger-row.is-pictured td { 
    font-weight: bold; 
    color: var(--ink-primary); 
}

.artifact-name { 
    position: relative; 
    cursor: help; 
    text-decoration: underline dotted rgba(62, 39, 35, 0.3); 
}

.archival-note {
    visibility: hidden; 
    opacity: 0; 
    position: absolute; 
    left: 0; 
    top: 120%; 
    width: 280px; 
    background: #3E2723; 
    color: #F5F5DC; 
    padding: 15px;
    border: 1px solid var(--accent-gold); 
    border-radius: 4px; 
    z-index: 999;
    transition: opacity 0.2s; 
    pointer-events: none; 
    font-family: 'EB Garamond', serif;
}

@media (hover: hover) { 
    .artifact-name:hover .archival-note { 
        visibility: visible; 
        opacity: 1; 
    } 
}


.status-stamp {
    display: inline-block !important;
    padding: 2px 10px;
    border: 2px solid;
    border-radius: 4px;
    font-family: 'Special Elite', monospace;
    font-weight: bold;
    text-transform: uppercase;
    font-size: 0.7rem;
    line-height: 1;
    position: relative;
    white-space: nowrap;
    background-color: rgba(255, 255, 255, 0.05);
}

.status-stamp::after {
    content: "";
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background-image: url("https://www.transparenttextures.com/patterns/p6.png");
    opacity: 0.3;
    pointer-events: none;
}

.status-catalog { color: #1976d2; border-color: #1976d2; }
.status-in-stock { color: #2e7d32; border-color: #2e7d32; }
.status-printing { color: #c62828; border-color: #c62828; }
.status-sold { color: #b71c1c; border-color: #b71c1c; }

#ledger-body tr:nth-child(even) .status-stamp { 
    transform: rotate(-2.5deg) !important; 
}

#ledger-body tr:nth-child(odd) .status-stamp { 
    transform: rotate(1.8deg) !important; 
}

#ledger-body tr:nth-child(3n) .status-stamp { 
    transform: rotate(-4deg) !important; 
}

/* ==========================================================================
   9. MATERIALS LIBRARY
   ========================================================================== */
.material-library-container {
    margin: 2rem auto;
    max-width: 900px;
    background: #fff;
    border: 2px solid var(--ink-primary);
    box-shadow: 8px 8px 0px var(--bg-darker);
    overflow: hidden;
}

.material-ledger-header {
    background: var(--ink-primary);
    color: var(--bg-parchment);
    padding: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
}

.material-specimen {
    display: flex;
    align-items: center;
    background: white;
    border: 1px solid #dcdcdc;
    padding: 6px 10px;
    transition: all 0.2s ease;
    min-height: 55px;
}

.material-specimen:hover {
    border-color: var(--accent-gold);
    box-shadow: 3px 3px 0px var(--accent-gold);
    transform: translate(-1px, -1px);
}

.material-specimen.is-active .specimen-label {
    opacity: 1;
    transform: translateY(0);
}

.material-filter-bar {
    display: flex;
    gap: 15px;
}

.material-scroll-window {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 1px;
    background: #dcdcdc;
    max-height: 500px;
    overflow-y: auto;
}

.specimen-swatch {
    width: 32px;
    height: 32px;
    flex-shrink: 0;
    border: 1px solid rgba(0,0,0,0.1);
    margin-right: 10px;
    position: relative;
    box-shadow: inset 0 0 4px rgba(0,0,0,0.1);
    overflow: hidden;
}

.specimen-swatch::after {
    content: '';
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background: linear-gradient(135deg, rgba(255,255,255,0.1) 0%, transparent 50%);
    pointer-events: none;
    z-index: 1;
}

/* Reduce overlay on gradient swatches to show colors better */
.specimen-swatch.gradient-swatch::after {
    background: linear-gradient(135deg, rgba(255,255,255,0.05) 0%, transparent 40%);
}

.specimen-label {
    font-family: 'Special Elite', monospace;
    font-size: 0.65rem;
    color: var(--ink-primary);
    line-height: 1.2;
    display: flex;
    flex-direction: column;
    justify-content: center;
    flex: 1;
    min-width: 0;
}

.spec-title {
    display: block;
    font-weight: bold;
    text-transform: uppercase;
    font-size: 0.7rem;
    margin-bottom: 1px;
    line-height: 1.1;
}

.spec-meta {
    display: block;
    font-size: 0.55rem;
    color: var(--ink-secondary);
    opacity: 0.8;
    margin-bottom: 1px;
    line-height: 1.1;
}

.spec-notes {
    display: block;
    font-size: 0.55rem;
    opacity: 0.7;
    font-style: italic;
    margin-top: 2px;
    line-height: 1.1;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    line-clamp: 1;
    -webkit-box-orient: vertical;
}

.spec-symbol {
    display: inline-block;
    margin-right: 6px;
    color: var(--accent-gold);
    font-size: 0.9rem;
    font-family: 'Courier New', monospace;
    letter-spacing: 0;
    line-height: 1;
    vertical-align: middle;
    font-weight: normal;
}

.material-overflow-fix {
    overflow: visible !important;
}

/* ==========================================================================
   11. PAGINATION
   ========================================================================== */
.gallery-pagination {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    margin-top: 30px;
    padding: 20px;
    background: rgba(245, 230, 202, 0.3);
    border: 1px solid rgba(62, 39, 35, 0.15);
    border-radius: 6px;
}

.pagination-info {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

.pagination-count {
    font-family: 'Special Elite', monospace;
    font-size: 0.75rem;
    color: var(--ink-secondary);
    opacity: 0.8;
}

/* Stamp Button Style - Matches your Lightbox */
.stamp-btn {
    background: transparent;
    border: 2px solid var(--ink-secondary);
    color: var(--ink-secondary);
    font-family: 'Special Elite', monospace;
    padding: 5px 15px;
    cursor: pointer;
    text-transform: uppercase;
    font-weight: bold;
    transition: all 0.2s ease;
    border-radius: 3px;
}

.stamp-btn:hover:not(:disabled) {
    background: var(--ink-secondary);
    color: var(--bg-parchment);
    transform: rotate(-1deg); /* Slight wiggle on hover */
}

/* Disabled State - Looks 'Faded' */
.stamp-btn:disabled {
    opacity: 0.2;
    cursor: not-allowed;
    border-style: dotted; /* Looks like an incomplete stamp */
}

.page-stamp {
    font-family: 'Special Elite', monospace;
    font-weight: bold;
    color: var(--accent-rust);
    font-size: 1.1rem;
}


.toast-notification {
    position: fixed; bottom: -80px; left: 50%; transform: translateX(-50%);
    background: #3E2723; color: #F5E6CA; padding: 15px 30px;
    border: 2px solid var(--accent-gold); font-family: 'Special Elite', monospace;
    font-size: 1.1rem; z-index: 999999;
    transition: bottom 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    box-shadow: 0 10px 30px rgba(0,0,0,0.6); pointer-events: none; white-space: nowrap;
}
.toast-notification.show { bottom: 40px; }

@media (max-width: 850px) { 
    .manifest-container { flex-direction: column; }
}

@media (max-width: 600px) {
    .container { padding: 10px; }
    .sheet { padding: 1.5rem; }
    nav a { display: block; margin: 10px 0; }
    h1 { font-size: 2rem; }

    .artifact-name.is-active .archival-note {
        visibility: visible !important; opacity: 1 !important;
        position: fixed !important; top: 50% !important; left: 50% !important;
        transform: translate(-50%, -50%) !important; width: 85vw !important;
        background: #2b1b19 !important; z-index: 9999 !important;
    }
}

#lightbox {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.9); z-index: 10000;
    display: none; justify-content: center; align-items: center; flex-direction: column;
}

#lightbox-img {
    max-width: 90%; max-height: 60vh; border: 10px solid white;
    box-shadow: 0 0 30px rgba(0,0,0,0.5); background: white; object-fit: contain;
}

#lightbox-caption {
    margin-top: 20px; font-family: 'Special Elite', serif;
    text-align: center; width: 100%; padding: 0 20px 30px 20px; color: #fff;
    max-height: 40vh;
    overflow-y: auto;
    min-height: 200px;
}

/* Duplicate removed - using updated styles in section 10 */

.lb-copy-icon-btn {
    background: rgba(255, 255, 255, 0.2);
    border: 2px solid rgba(255, 255, 255, 0.5);
    border-radius: 50%;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
    color: #fff;
    cursor: pointer;
    transition: all 0.2s ease;
}

.lb-copy-icon-btn.return-btn {
    border-color: rgba(255, 255, 255, 0.6);
    color: #fff;
}

.lb-copy-icon-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.8);
    transform: scale(1.05);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.5);
    animation: buttonWiggle 0.4s ease-in-out;
}

.lb-copy-icon-btn.copy-success {
    background: #2e7d32;
    border-color: #2e7d32;
    color: #fff;
    animation: checkmarkPulse 0.5s ease-in-out;
}

.lb-copy-icon-btn.return-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.8);
    color: #fff;
}

.lb-copy-icon-btn:active {
    transform: translateY(2px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.lb-copy-icon-btn svg {
    width: 18px;
    height: 18px;
}

/* ==========================================================================
   10. LIGHTBOX
   ========================================================================== */
#lightbox {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    z-index: 10000;
    display: none;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    padding: 1rem;
    overflow-y: auto;
    cursor: pointer;
}

#lightbox-img {
    max-width: 70%;
    max-height: 50vh;
    border: 8px solid white;
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.5);
    background: white;
    object-fit: contain;
    border-radius: 2px;
}

#lightbox-caption {
    margin-top: 1rem;
    font-family: 'Special Elite', monospace;
    text-align: center;
    width: 100%;
    max-width: 700px;
    padding: 0 1rem 1rem 1rem;
    color: #fff;
    max-height: 40vh;
    overflow-y: auto;
}

.lb-copy-row {
    margin-top: 0.5rem;
    display: flex;
    justify-content: center;
    gap: 10px;
}

.lb-share-row {
    margin-top: 0.5rem;
    display: flex;
    justify-content: center;
    gap: 6px;
    flex-wrap: wrap;
    padding-top: 0.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.3);
}

.lb-share-btn {
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.4);
    border-radius: 4px;
    padding: 6px 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    color: #fff;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: 'Special Elite', monospace;
    font-size: 0.75rem;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

@media (min-width: 851px) {
    .lb-share-btn {
        padding: 8px 12px;
        font-size: 0.8rem;
        gap: 6px;
    }
    
    .lb-share-btn svg {
        width: 18px;
        height: 18px;
    }
}

.lb-share-btn:hover {
    background: rgba(255, 255, 255, 0.25);
    border-color: rgba(255, 255, 255, 0.7);
    transform: translateY(-1px);
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.4);
}

.lb-share-btn:active {
    transform: translateY(0);
}

.lb-share-btn svg {
    flex-shrink: 0;
    width: 16px;
    height: 16px;
}

.lb-share-native {
    background: rgba(184, 134, 11, 0.2);
    border-color: var(--accent-gold);
}

.lb-share-native:hover {
    background: var(--accent-gold);
    border-color: var(--accent-gold);
    color: #3E2723;
}

.lb-share-twitter {
    border-color: #1DA1F2;
}

.lb-share-twitter:hover {
    background: #1DA1F2;
    border-color: #1DA1F2;
}

.lb-share-facebook {
    border-color: #1877F2;
}

.lb-share-facebook:hover {
    background: #1877F2;
    border-color: #1877F2;
}

.lb-share-reddit {
    border-color: #FF4500;
}

.lb-share-reddit:hover {
    background: #FF4500;
    border-color: #FF4500;
}

.lb-share-linkedin {
    border-color: #0077B5;
}

.lb-share-linkedin:hover {
    background: #0077B5;
    border-color: #0077B5;
}

@media (max-width: 600px) {
    .lb-share-row {
        gap: 6px;
    }
    
    .lb-share-btn {
        padding: 5px 8px;
        font-size: 0.7rem;
    }
    
    .lb-share-btn svg {
        width: 14px;
        height: 14px;
    }
    
    .lb-share-native span {
        display: none;
    }
}

/* Duplicate removed - using updated styles above */

/* ==========================================================================
   12. FOOTER
   ========================================================================== */
footer {
    position: relative;
    text-align: center;
    padding: 5rem 0 3rem 0;
    border-top: 1px solid var(--ink-secondary);
    margin-top: 4rem;
    font-family: 'Special Elite', monospace;
    color: var(--ink-secondary);
}

.footer-divider {
    width: 60px;
    height: 4px;
    background: var(--accent-gold);
    margin: 0 auto 20px auto;
}

.footer-official {
    letter-spacing: 1px;
    text-transform: uppercase;
    font-size: 0.9rem;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
}

.footer-seal {
    border: 1px solid var(--ink-secondary);
    padding: 3px 8px;
    font-size: 0.8rem;
    background: rgba(184, 134, 11, 0.05);
}

.footer-pipe { opacity: 0.4; }
.footer-subtext { font-size: 0.75rem; opacity: 0.6; margin-top: 15px; }


/* ==========================================================================
   11. PAGINATION
   ========================================================================== */
.gallery-pagination {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    margin-top: 30px;
    padding: 20px;
    background: rgba(245, 230, 202, 0.3);
    border: 1px solid rgba(62, 39, 35, 0.15);
    border-radius: 6px;
}

.pagination-info {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

.pagination-count {
    font-family: 'Special Elite', monospace;
    font-size: 0.75rem;
    color: var(--ink-secondary);
    opacity: 0.8;
}

.stamp-btn {
    background: transparent;
    border: 2px solid var(--ink-secondary);
    color: var(--ink-secondary);
    font-family: 'Special Elite', monospace;
    padding: 5px 15px;
    cursor: pointer;
    text-transform: uppercase;
    font-weight: bold;
    transition: all 0.2s ease;
    border-radius: 3px;
}

.stamp-btn:hover:not(:disabled) {
    background: var(--ink-secondary);
    color: var(--bg-parchment);
    transform: rotate(-1deg);
}

.stamp-btn:disabled {
    opacity: 0.2;
    cursor: not-allowed;
    border-style: dotted;
}

.page-stamp {
    font-family: 'Special Elite', monospace;
    font-weight: bold;
    color: var(--accent-rust);
    font-size: 1.1rem;
}

.toast-notification {
    position: fixed; bottom: -80px; left: 50%; transform: translateX(-50%);
    background: #3E2723; color: #F5E6CA; padding: 15px 30px;
    border: 2px solid var(--accent-gold); font-family: 'Special Elite', monospace;
    font-size: 1.1rem; z-index: 999999;
    transition: bottom 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    box-shadow: 0 10px 30px rgba(0,0,0,0.6); pointer-events: none; white-space: nowrap;
}
.toast-notification.show { bottom: 40px; }

/* ==========================================================================
   13. BACK TO TOP BUTTON
   ========================================================================== */
.back-to-top {
    position: fixed;
    bottom: 30px;
    left: 30px;
    width: 50px;
    height: 50px;
    background: var(--accent-gold);
    color: white;
    border: 2px solid var(--ink-primary);
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    transition: all 0.3s ease;
    z-index: 999;
}

.back-to-top:hover {
    background: var(--accent-rust);
    transform: translateY(-3px);
    box-shadow: 0 6px 16px rgba(0,0,0,0.3);
}

.back-to-top:active {
    transform: translateY(-1px);
}

@media (max-width: 600px) {
    .back-to-top {
        bottom: 20px;
        left: 20px;
        width: 45px;
        height: 45px;
    }
}

/* ==========================================================================
   15. USER ACCOUNT DRAWER
   ========================================================================== */
.user-drawer {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10001;
    pointer-events: none;
}

.user-drawer[aria-hidden="false"] {
    pointer-events: auto;
}

.user-drawer-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    opacity: 0;
    transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.user-drawer[aria-hidden="false"] .user-drawer-overlay {
    opacity: 1;
}

.user-drawer-content {
    position: absolute;
    top: 0;
    right: 0;
    width: 90%;
    max-width: 400px;
    height: 100%;
    background: var(--bg-parchment);
    box-shadow: -4px 0 20px rgba(0, 0, 0, 0.3);
    transform: translateX(100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    z-index: 10002;
}

.user-drawer[aria-hidden="false"] .user-drawer-content {
    transform: translateX(0);
}

.user-drawer-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 2px solid var(--ink-primary);
    background: var(--ink-primary);
    color: var(--bg-parchment);
}

.user-drawer-header h2 {
    margin: 0;
    font-family: 'Special Elite', monospace;
    font-size: 1.5rem;
    color: var(--accent-gold);
    border: none;
}

.user-drawer-close {
    background: transparent;
    border: 2px solid var(--bg-parchment);
    border-radius: 50%;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    padding: 0;
    color: var(--bg-parchment);
}

.user-drawer-close:hover {
    background: var(--bg-parchment);
    color: var(--ink-primary);
    transform: rotate(90deg);
}

.user-drawer-close svg {
    width: 20px;
    height: 20px;
}

.user-drawer-tabs {
    display: flex;
    border-bottom: 1px solid var(--ink-secondary);
    background: var(--bg-darker);
}

.user-drawer-tab {
    flex: 1;
    padding: 1rem;
    background: transparent;
    border: none;
    border-bottom: 3px solid transparent;
    color: var(--ink-primary);
    font-family: 'Special Elite', monospace;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.user-drawer-tab:hover {
    background: rgba(62, 39, 35, 0.1);
}

.user-drawer-tab.active {
    border-bottom-color: var(--accent-gold);
    color: var(--accent-gold);
    font-weight: bold;
}

.user-drawer-body {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
}

.user-drawer-tab-content {
    display: none;
}

.user-drawer-tab-content.active {
    display: block;
}

@media (max-width: 600px) {
    .user-drawer-content {
        width: 100%;
        max-width: 100%;
    }
}

/* ==========================================================================
   USER ACCOUNT AUTHENTICATION FORMS
   ========================================================================== */

.auth-landing {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.auth-view-toggle {
    display: flex;
    gap: 0.5rem;
    border-bottom: 1px solid var(--ink-secondary);
    margin-bottom: 1rem;
}

.auth-toggle-btn {
    flex: 1;
    padding: 0.75rem 1rem;
    background: transparent;
    border: none;
    border-bottom: 3px solid transparent;
    color: var(--ink-primary);
    font-family: 'Special Elite', monospace;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.auth-toggle-btn:hover {
    background: rgba(62, 39, 35, 0.05);
}

.auth-toggle-btn.active {
    border-bottom-color: var(--accent-gold);
    color: var(--accent-gold);
    font-weight: bold;
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.form-group label {
    font-family: 'Special Elite', monospace;
    font-size: 0.9rem;
    color: var(--ink-primary);
    font-weight: bold;
}

.form-group input {
    padding: 0.75rem;
    border: 2px solid var(--ink-secondary);
    background: var(--bg-parchment);
    color: var(--ink-primary);
    font-family: 'EB Garamond', serif;
    font-size: 1rem;
    transition: all 0.2s ease;
}

.form-group input:focus {
    outline: none;
    border-color: var(--accent-gold);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(62, 39, 35, 0.1);
}

.form-group input:invalid:not(:placeholder-shown) {
    border-color: var(--accent-rust);
}

.form-hint {
    font-size: 0.8rem;
    color: var(--ink-secondary);
    font-style: italic;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    font-family: 'EB Garamond', serif;
    font-size: 1rem;
    color: var(--ink-primary);
}

.checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: var(--accent-gold);
}

.checkbox-label span {
    user-select: none;
}

.form-actions {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-top: 0.5rem;
}

.btn-auth-primary {
    padding: 0.75rem 1.5rem;
    background: var(--ink-primary);
    color: var(--bg-parchment);
    border: 2px solid var(--ink-primary);
    font-family: 'Special Elite', monospace;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-auth-primary:hover:not(:disabled) {
    background: var(--accent-gold);
    border-color: var(--accent-gold);
    color: var(--ink-primary);
}

.btn-auth-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    position: relative;
}

.btn-auth-primary:disabled::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    top: 50%;
    left: 50%;
    margin-left: -8px;
    margin-top: -8px;
    border: 2px solid var(--bg-parchment);
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

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

.btn-auth-secondary {
    padding: 0.6rem 1.25rem;
    background: transparent;
    color: var(--ink-primary);
    border: 2px solid var(--ink-primary);
    font-family: 'Special Elite', monospace;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-auth-secondary:hover {
    background: var(--ink-primary);
    color: var(--bg-parchment);
}

.btn-auth-danger {
    padding: 0.6rem 1.25rem;
    background: transparent;
    color: var(--accent-rust);
    border: 2px solid var(--accent-rust);
    font-family: 'Special Elite', monospace;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-top: 0.5rem;
}

.btn-auth-danger:hover {
    background: var(--accent-rust);
    color: var(--bg-parchment);
}

.auth-link {
    color: var(--ink-primary);
    text-decoration: underline;
    font-size: 0.9rem;
    text-align: center;
    transition: color 0.2s ease;
}

.auth-link:hover {
    color: var(--accent-gold);
}

.form-error {
    padding: 0.75rem;
    background: rgba(200, 50, 50, 0.1);
    border: 1px solid var(--accent-rust);
    color: var(--accent-rust);
    font-size: 0.9rem;
    border-radius: 4px;
    animation: slideIn 0.3s ease-out;
    transition: all 0.2s ease;
}

.form-success {
    padding: 0.75rem;
    background: rgba(50, 150, 50, 0.1);
    border: 1px solid #4a9;
    color: #4a9;
    font-size: 0.9rem;
    border-radius: 4px;
    animation: slideIn 0.3s ease-out;
    transition: all 0.2s ease;
}

.form-message {
    padding: 0.75rem;
    font-size: 0.9rem;
    border-radius: 4px;
    margin-top: 1rem;
}

.form-message.form-error {
    background: rgba(200, 50, 50, 0.1);
    border: 1px solid var(--accent-rust);
    color: var(--accent-rust);
}

.form-message.form-info {
    background: rgba(62, 39, 35, 0.1);
    border: 1px solid var(--ink-secondary);
    color: var(--ink-primary);
}

.form-info {
    padding: 0.75rem;
    background: rgba(62, 39, 35, 0.05);
    border: 1px solid var(--ink-secondary);
    color: var(--ink-primary);
    font-size: 0.9rem;
    border-radius: 4px;
    font-style: italic;
}

/* Logged in view */
.auth-logged-in {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.user-info {
    padding: 1rem;
    background: rgba(62, 39, 35, 0.05);
    border: 1px solid var(--ink-secondary);
    border-radius: 4px;
}

.user-email {
    font-family: 'EB Garamond', serif;
    font-size: 1.1rem;
    color: var(--ink-primary);
    margin-bottom: 0.5rem;
    word-break: break-all;
}

.user-status {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.status-badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.85rem;
    font-family: 'Special Elite', monospace;
    font-weight: bold;
}

.status-badge.verified {
    background: rgba(50, 150, 50, 0.2);
    color: #4a9;
    border: 1px solid #4a9;
}

.status-badge.unverified {
    background: rgba(200, 150, 50, 0.2);
    color: var(--accent-rust);
    border: 1px solid var(--accent-rust);
}

.user-actions {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

/* ==========================================================================
   COLLECTION TAB STYLES
   ========================================================================== */

.collection-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.collection-header h3 {
    font-family: 'Special Elite', monospace;
    font-size: 1.2rem;
    color: var(--ink-primary);
    margin: 0;
    border-bottom: 2px solid var(--accent-gold);
    display: inline-block;
    padding-bottom: 0.5rem;
}

.collection-view-toggle {
    background: var(--bg-parchment);
    border: 2px solid var(--accent-gold);
    border-radius: 4px;
    padding: 0.5rem;
    cursor: pointer;
    transition: all 0.2s ease;
    color: var(--ink-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    flex-shrink: 0;
}

.collection-view-toggle:hover {
    background: var(--accent-gold);
    color: #fff;
    transform: scale(1.05);
}

.collection-view-toggle:active {
    transform: scale(0.95);
}

.collection-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-top: 1rem;
}

/* Dense two-column view */
.collection-grid.dense-view {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
}

.collection-grid.dense-view .collection-card {
    border-radius: 4px;
}

.collection-grid.dense-view .collection-card-image {
    padding-top: 75%; /* Less tall in dense view */
}

.collection-grid.dense-view .collection-card-info {
    padding: 0.5rem;
}

.collection-grid.dense-view .collection-card-name {
    font-size: 0.95rem;
    margin-bottom: 0.25rem;
}

.collection-grid.dense-view .collection-card-ref {
    font-size: 0.75rem;
    margin-bottom: 0.25rem;
}

.collection-grid.dense-view .collection-card-material {
    font-size: 0.7rem;
}

.collection-grid.dense-view .collection-remove-btn {
    width: 24px;
    height: 24px;
    top: 0.25rem;
    right: 0.25rem;
}

.collection-grid.dense-view .collection-remove-btn svg {
    width: 14px;
    height: 14px;
}

.collection-card {
    background: rgba(255, 255, 255, 0.7);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: var(--paper-shadow);
    transition: all 0.3s ease;
    cursor: pointer;
}

.collection-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 15px 35px rgba(62, 39, 35, 0.2);
}

.collection-card-image {
    position: relative;
    width: 100%;
    padding-top: 100%; /* Square aspect ratio */
    overflow: hidden;
    background: var(--bg-darker);
}

.collection-card-image img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.collection-remove-btn {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    background: rgba(200, 50, 50, 0.9);
    color: white;
    border: none;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    z-index: 10;
    padding: 0;
}

.collection-remove-btn:hover {
    background: rgba(200, 50, 50, 1);
    transform: scale(1.1);
}

.collection-remove-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.collection-card-info {
    padding: 1rem;
}

.collection-card-name {
    font-family: 'EB Garamond', serif;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--ink-primary);
    margin: 0 0 0.5rem 0;
}

.collection-card-ref {
    font-family: 'Special Elite', monospace;
    font-size: 0.85rem;
    color: var(--ink-secondary);
    margin: 0 0 0.25rem 0;
}

.collection-card-material {
    font-family: 'EB Garamond', serif;
    font-size: 0.9rem;
    color: var(--ink-secondary);
    font-style: italic;
    margin: 0.25rem 0 0 0;
}

.collection-empty,
.collection-loading,
.collection-error {
    text-align: center;
    padding: 3rem 1.5rem;
    color: var(--ink-primary);
}

.collection-empty h3 {
    font-family: 'Special Elite', monospace;
    font-size: 1.5rem;
    margin-bottom: 1rem;
    color: var(--ink-primary);
}

.collection-empty p {
    font-family: 'EB Garamond', serif;
    font-size: 1.1rem;
    margin-bottom: 1.5rem;
    color: var(--ink-secondary);
}

.collection-loading {
    font-family: 'EB Garamond', serif;
    font-size: 1.1rem;
    color: var(--ink-secondary);
    font-style: italic;
}

.collection-error {
    font-family: 'EB Garamond', serif;
    font-size: 1rem;
    color: var(--accent-rust);
}

.collection-error p {
    margin: 0;
}

.spinner {
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 0.8s linear infinite;
}

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

@media (max-width: 600px) {
    .collection-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 1rem;
    }
    
    .collection-grid.dense-view {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.5rem;
    }
    
    .collection-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }
    
    .collection-view-toggle {
        width: 32px;
        height: 32px;
        padding: 0.4rem;
    }
    
    .collection-card-info {
        padding: 0.75rem;
    }
    
    .collection-card-name {
        font-size: 1rem;
    }
}

/* ==========================================================================
   16. MOBILE RESPONSIVE STYLES
   ========================================================================== */
/* Mobile Navigation */
@media (max-width: 850px) {
    .nav-toggle {
        display: flex;
    }
    
    .nav-menu {
        max-height: 0;
        overflow: hidden;
        flex-direction: column;
        gap: 0;
        transition: max-height 0.3s ease;
    }
    
    .nav-menu.active {
        max-height: 500px;
        padding-top: 1rem;
    }
    
    nav a {
        margin: 0.5rem 0;
        padding: 0.75rem;
        border-bottom: 1px solid rgba(62, 39, 35, 0.1);
    }
    
    nav a:last-child {
        border-bottom: none;
    }
}

/* Mobile Ledger Table */
@media (max-width: 850px) {
    .table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .ledger-table {
        font-size: 0.85rem;
        min-width: 100%;
    }
    
    .ledger-table th,
    .ledger-table td {
        padding: 6px 8px;
    }
    
    .ledger-table th {
        font-size: 0.75rem;
        padding: 8px 6px;
    }
    
    .ledger-table td:first-child {
        padding-left: 4px;
        padding-right: 6px;
        font-size: 0.8rem;
    }
    
    /* Make buttons smaller on mobile */
    .ledger-table .copy-full,
    .ledger-table .copy-link {
        width: 24px;
        height: 24px;
        padding: 2px;
    }
    
    .ledger-table .copy-full svg,
    .ledger-table .copy-link svg {
        width: 12px;
        height: 12px;
    }
    
    /* Compact status stamps */
    .status-stamp {
        font-size: 0.7rem;
        padding: 2px 6px;
    }
    
    /* Make artifact name column more compact */
    .ledger-table td.artifact-name {
        font-size: 0.85rem;
        line-height: 1.3;
    }
    
    /* Hide Material column on mobile */
    .ledger-table th.material-column,
    .ledger-table td.material-column {
        display: none;
    }
}


/* ==========================================================================
   ACCOUNT MODAL
   ========================================================================== */
.account-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 20000;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s ease;
    display: block;
}

.account-modal.active {
    opacity: 1;
    pointer-events: auto;
}

.account-modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1;
}

.account-modal-content {
    position: absolute;
    background: var(--bg-parchment);
    border: 2px solid var(--ink-primary);
    box-shadow: 0 -10px 40px rgba(0,0,0,0.3);
    display: flex;
    flex-direction: column;
    max-height: 85vh;
    width: 90%;
    max-width: 600px;
    left: 50%;
    top: 50%;
    z-index: 2;
    transform: translate(-50%, -50%) scale(0.9);
    transition: transform 0.3s ease, opacity 0.3s ease;
    opacity: 0;
    border-radius: 8px;
    overflow: hidden;
}

.account-modal.active .account-modal-content {
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
}

/* Mobile: Convert to bottom sheet */
@media (max-width: 850px) {
    .account-modal-content {
        left: 0;
        right: 0;
        top: auto;
        bottom: 0;
        max-width: 100%;
        width: 100%;
        max-height: 90vh;
        border-left: none;
        border-right: none;
        border-top: 3px solid var(--ink-primary);
        border-radius: 20px 20px 0 0;
        transform: translateY(100%);
        opacity: 1;
    }

    .account-modal.active .account-modal-content {
        transform: translateY(0);
    }
}

.account-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 2px solid var(--ink-primary);
    background: var(--ink-primary);
    color: var(--bg-parchment);
}

.account-modal-header h2 {
    margin: 0;
    font-family: 'Special Elite', monospace;
    font-size: 1.2rem;
    color: var(--accent-gold);
    border: none;
}

.account-modal-close {
    background: transparent;
    border: none;
    color: var(--bg-parchment);
    cursor: pointer;
    padding: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.2s;
}

.account-modal-close:hover {
    opacity: 0.7;
}

.account-modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
}

.account-section {
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid rgba(62, 39, 35, 0.2);
}

.account-section:last-child {
    border-bottom: none;
}

.account-section h3 {
    font-family: 'EB Garamond', serif;
    color: var(--ink-primary);
    margin-top: 0;
    margin-bottom: 1rem;
    border-bottom: 2px solid var(--ink-primary);
    padding-bottom: 0.5rem;
}

.account-main-tabs {
    display: flex;
    gap: 0;
    margin-bottom: 1.5rem;
    border-bottom: 2px solid var(--ink-primary);
    background: var(--bg-darker);
    border-radius: 4px 4px 0 0;
}

.account-main-tab {
    flex: 1;
    background: none;
    border: none;
    padding: 1rem 1.5rem;
    font-family: 'EB Garamond', serif;
    font-size: 1.1rem;
    color: var(--ink-primary);
    cursor: pointer;
    border-bottom: 3px solid transparent;
    transition: all 0.3s;
    background: transparent;
}

.account-main-tab.active {
    border-bottom-color: var(--ink-primary);
    font-weight: 700;
    background: var(--bg-parchment);
}

.account-main-tab:hover {
    background: rgba(62, 39, 35, 0.1);
}

.account-main-tab.active:hover {
    background: var(--bg-parchment);
}

.account-main-tab-content {
    display: none;
}

.account-main-tab-content.active {
    display: block;
}

.account-tabs {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
    border-bottom: 2px solid var(--ink-primary);
}

.account-tab {
    background: none;
    border: none;
    padding: 0.75rem 1.5rem;
    font-family: 'EB Garamond', serif;
    font-size: 1.1rem;
    color: var(--ink-primary);
    cursor: pointer;
    border-bottom: 3px solid transparent;
    transition: all 0.3s;
}

.account-tab.active {
    border-bottom-color: var(--ink-primary);
    font-weight: 700;
}

.account-tab:hover {
    background: rgba(62, 39, 35, 0.1);
}

.account-form {
    display: none;
}

.account-form.active {
    display: block;
}

.account-form .form-group {
    margin-bottom: 1.5rem;
}

.account-form .form-group label {
    display: block;
    font-family: 'EB Garamond', serif;
    font-weight: 700;
    color: var(--ink-primary);
    margin-bottom: 0.5rem;
    font-size: 1.1rem;
}

.account-form .form-group input {
    width: 100%;
    padding: 0.75rem;
    font-family: 'EB Garamond', serif;
    font-size: 1rem;
    border: 2px solid var(--ink-primary);
    background: #FFF;
    color: var(--ink-primary);
    box-sizing: border-box;
}

.account-form .form-group input:focus {
    outline: none;
    border-color: #5D4037;
    box-shadow: 0 0 0 3px rgba(93, 64, 55, 0.1);
}

.btn-account-action {
    padding: 0.75rem 2rem;
    font-family: 'EB Garamond', serif;
    font-size: 1.1rem;
    font-weight: 700;
    border: 2px solid var(--ink-primary);
    background: var(--ink-primary);
    color: var(--bg-parchment);
    cursor: pointer;
    transition: all 0.3s;
    text-decoration: none;
    display: inline-block;
}

.btn-account-action:hover {
    background: #5D4037;
    border-color: #5D4037;
}

.preference-item {
    background: #FFF;
    border: 2px solid #3E2723;
    padding: 1.5rem;
    margin-bottom: 1rem;
}

.preference-item h4 {
    font-family: 'EB Garamond', serif;
    color: #3E2723;
    margin-top: 0;
    margin-bottom: 0.5rem;
}

.preference-item p {
    font-family: 'EB Garamond', serif;
    color: #3E2723;
    margin: 0.5rem 0;
    font-size: 0.95rem;
}

.preference-toggle {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-top: 1rem;
}

.preference-toggle label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-family: 'EB Garamond', serif;
    color: #3E2723;
    cursor: pointer;
}

.preference-toggle input[type="checkbox"] {
    width: auto;
    margin: 0;
    cursor: pointer;
}


.account-section .loading {
    text-align: center;
    padding: 2rem;
    color: var(--ink-secondary);
    font-style: italic;
}

#accountAlertContainer {
    margin-bottom: 1rem;
}

#accountAlertContainer .alert {
    padding: 1rem;
    border-radius: 4px;
    margin-bottom: 1rem;
    font-family: 'EB Garamond', serif;
}

#accountAlertContainer .alert-success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

#accountAlertContainer .alert-error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
    display: block;
}

/* Prevent browser password manager from showing on page load */
.account-form input[readonly] {
    background-color: #fff;
    cursor: text;
}

/* Hide password fields when modal is not active to prevent auto-fill detection */
.account-modal:not(.active) .account-form input[type="password"] {
    position: absolute;
    left: -9999px;
    opacity: 0;
    pointer-events: none;
}

/* Tooltip styles for buttons */
.card-action-btn[data-tooltip],
.lb-copy-icon-btn[data-tooltip],
td button[data-tooltip] {
    position: relative;
}

.card-action-btn[data-tooltip]::after,
.lb-copy-icon-btn[data-tooltip]::after,
td button[data-tooltip]::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(-8px);
    background: var(--ink-primary);
    color: #fdfaf3;
    padding: 6px 10px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-family: 'Special Elite', monospace;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease, transform 0.2s ease;
    z-index: 1000;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

.card-action-btn[data-tooltip]::before,
.lb-copy-icon-btn[data-tooltip]::before,
td button[data-tooltip]::before {
    content: '';
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(-2px);
    border: 5px solid transparent;
    border-top-color: var(--ink-primary);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
    z-index: 1001;
}

/* Show tooltip on hover (desktop) */
@media (hover: hover) {
    .card-action-btn[data-tooltip]:hover::after,
    .lb-copy-icon-btn[data-tooltip]:hover::after,
    td button[data-tooltip]:hover::after {
        opacity: 1;
        transform: translateX(-50%) translateY(-12px);
    }
    
    .card-action-btn[data-tooltip]:hover::before,
    .lb-copy-icon-btn[data-tooltip]:hover::before,
    td button[data-tooltip]:hover::before {
        opacity: 1;
    }
}

/* Show tooltip on mobile only when active/touched (below button) */
@media (max-width: 850px) {
    .card-action-btn[data-tooltip]::after,
    td button[data-tooltip]::after {
        bottom: auto;
        top: 100%;
        transform: translateX(-50%) translateY(8px);
        opacity: 0; /* Hidden by default on mobile */
    }
    
    .card-action-btn[data-tooltip]::before,
    td button[data-tooltip]::before {
        bottom: auto;
        top: 100%;
        transform: translateX(-50%) translateY(2px);
        border-top-color: transparent;
        border-bottom-color: var(--ink-primary);
        opacity: 0; /* Hidden by default on mobile */
    }
    
    /* Show tooltip only when button is active (being touched/pressed) */
    .card-action-btn[data-tooltip]:active::after,
    td button[data-tooltip]:active::after {
        opacity: 1;
        transform: translateX(-50%) translateY(12px);
    }
    
    .card-action-btn[data-tooltip]:active::before,
    td button[data-tooltip]:active::before {
        opacity: 1;
        transform: translateX(-50%) translateY(6px);
    }
    
    /* Also show on focus for accessibility */
    .card-action-btn[data-tooltip]:focus::after,
    td button[data-tooltip]:focus::after {
        opacity: 1;
        transform: translateX(-50%) translateY(12px);
    }
    
    .card-action-btn[data-tooltip]:focus::before,
    td button[data-tooltip]:focus::before {
        opacity: 1;
        transform: translateX(-50%) translateY(6px);
    }
}

/* ==========================================================================
   20. FLOATING NAVIGATION CLUSTER
   ========================================================================== */

/* Desktop: Left-edge vertical stack */
.nav-cluster {
    position: fixed;
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 998;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.nav-cluster-stack {
    display: flex;
    flex-direction: column;
    gap: 6px;
    background: var(--ink-primary);
    border: 2px solid var(--accent-gold);
    border-radius: 8px;
    padding: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

/* Pagination section */
.nav-pagination {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px 0;
    border-bottom: 1px solid rgba(184, 134, 11, 0.3);
}

.nav-page-indicator {
    font-family: 'Special Elite', monospace;
    font-size: 0.75rem;
    color: var(--accent-gold);
    min-width: 36px;
    text-align: center;
    white-space: nowrap;
}

/* Cluster buttons */
.nav-cluster-btn {
    background: transparent;
    border: none;
    color: var(--bg-parchment);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 6px;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.nav-cluster-btn:hover:not(:disabled) {
    background: rgba(184, 134, 11, 0.3);
    color: var(--accent-gold);
}

.nav-cluster-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.nav-arrow {
    width: 28px;
    height: 28px;
}

/* Filters toggle with badge */
.nav-filters-toggle {
    position: relative;
    width: 100%;
    padding: 8px;
}

.nav-filter-badge,
.nav-mobile-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: var(--accent-rust);
    color: white;
    font-family: 'Special Elite', monospace;
    font-size: 0.6rem;
    min-width: 16px;
    height: 16px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
}

/* Back to top in cluster */
.nav-back-to-top {
    width: 100%;
    padding: 8px;
    border-top: 1px solid rgba(184, 134, 11, 0.3);
    margin-top: 2px;
}

/* Filter Panel - Desktop (expands from cluster) */
/* Panel is now a sibling of nav-cluster (not a child) so mobile display:none doesn't hide it */
.nav-filter-panel {
    position: fixed;
    left: 90px; /* cluster left (20px) + cluster width (~60px) + gap (10px) */
    top: 50%;
    width: 260px;
    background: var(--ink-primary);
    border: 2px solid var(--accent-gold);
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-50%) translateX(-10px);
    transition: all 0.25s ease;
    z-index: 2001; /* Above sticky nav (2000) */
}

.nav-filter-panel[aria-hidden="false"] {
    opacity: 1;
    visibility: visible;
    transform: translateY(-50%) translateX(0);
}

.nav-filter-panel-content {
    display: flex;
    flex-direction: column;
}

.nav-filter-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 12px;
    border-bottom: 1px solid rgba(184, 134, 11, 0.3);
}

.nav-filter-title {
    font-family: 'Special Elite', monospace;
    font-size: 0.9rem;
    color: var(--accent-gold);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.nav-filter-close {
    background: transparent;
    border: none;
    color: var(--bg-parchment);
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.nav-filter-close:hover {
    background: rgba(184, 134, 11, 0.3);
    color: var(--accent-gold);
}

.nav-filter-body {
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.nav-filter-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.nav-filter-label {
    font-family: 'Special Elite', monospace;
    font-size: 0.7rem;
    color: var(--bg-parchment);
    opacity: 0.8;
    display: flex;
    align-items: center;
    gap: 6px;
}

.nav-filter-input,
.nav-filter-select {
    background: rgba(245, 230, 202, 0.1);
    border: 1px solid rgba(184, 134, 11, 0.5);
    border-radius: 4px;
    padding: 8px 10px;
    font-family: 'Special Elite', monospace;
    font-size: 0.8rem;
    color: var(--bg-parchment);
    transition: border-color 0.2s ease;
}

.nav-filter-input:focus,
.nav-filter-select:focus {
    outline: none;
    border-color: var(--accent-gold);
}

.nav-filter-input::placeholder {
    color: rgba(245, 230, 202, 0.5);
}

.nav-filter-select {
    cursor: pointer;
}

.nav-filter-select option {
    background: var(--ink-primary);
    color: var(--bg-parchment);
}

.nav-filter-checkbox {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    padding: 6px 0;
}

.nav-filter-checkbox input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--accent-gold);
    cursor: pointer;
}

.nav-checkbox-label {
    font-family: 'Special Elite', monospace;
    font-size: 0.8rem;
    color: var(--bg-parchment);
}

.nav-filter-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 12px;
    border-top: 1px solid rgba(184, 134, 11, 0.3);
    background: rgba(0, 0, 0, 0.2);
    border-radius: 0 0 6px 6px;
}

.nav-clear-btn {
    background: transparent;
    border: 1px solid var(--accent-rust);
    color: var(--accent-rust);
    font-family: 'Special Elite', monospace;
    font-size: 0.7rem;
    padding: 4px 10px;
    border-radius: 3px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.nav-clear-btn:hover {
    background: var(--accent-rust);
    color: white;
}

.nav-filter-stats {
    display: flex;
    gap: 12px;
    font-family: 'Special Elite', monospace;
    font-size: 0.65rem;
    color: rgba(245, 230, 202, 0.7);
}

.nav-filter-stats b {
    color: var(--accent-gold);
}

/* Mobile FAB */
.nav-mobile-fab {
    display: none; /* Hidden on desktop */
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 56px;
    height: 56px;
    background: var(--ink-primary);
    border: 2px solid var(--accent-gold);
    border-radius: 50%;
    color: var(--accent-gold);
    cursor: pointer;
    z-index: 998;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    transition: all 0.3s ease;
}

.nav-mobile-fab:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.4);
}

.nav-mobile-fab.active {
    background: var(--accent-gold);
    color: var(--ink-primary);
}

.nav-mobile-badge {
    top: -2px;
    right: -2px;
}

/* Mobile overlay */
.nav-mobile-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 997;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.nav-mobile-overlay[aria-hidden="false"] {
    opacity: 1;
}

/* Mobile Responsive - Switch to FAB + Bottom Sheet */
@media (max-width: 768px) {
    /* Hide desktop cluster */
    .nav-cluster {
        display: none;
    }

    /* Show mobile FAB */
    .nav-mobile-fab {
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .nav-mobile-overlay {
        display: block;
        pointer-events: none;
        z-index: 2001; /* Above sticky nav (2000) to darken it */
    }

    .nav-mobile-overlay[aria-hidden="false"] {
        pointer-events: auto;
    }

    /* Filter panel becomes bottom sheet */
    .nav-filter-panel {
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        top: auto;
        width: 100%;
        max-height: 70vh;
        border-radius: 16px 16px 0 0;
        transform: translateY(100%);
        z-index: 2002; /* Above overlay (2001) */
    }

    .nav-filter-panel[aria-hidden="false"] {
        transform: translateY(0);
    }

    .nav-filter-panel-content {
        max-height: 70vh;
        overflow-y: auto;
    }

    /* Add pagination to mobile bottom sheet header */
    .nav-filter-header {
        flex-wrap: wrap;
        gap: 10px;
        padding: 14px 16px;
    }

    .nav-filter-title {
        flex: 1;
    }

    /* Mobile pagination row (injected via JS) */
    .nav-mobile-pagination {
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 12px;
        width: 100%;
        padding: 12px 16px;
        background: rgba(0, 0, 0, 0.2);
        border-bottom: 1px solid rgba(184, 134, 11, 0.3);
    }

    .nav-mobile-pagination .nav-page-indicator {
        font-size: 0.9rem;
        min-width: 60px;
    }

    .nav-mobile-pagination .nav-cluster-btn {
        width: 40px;
        height: 40px;
        background: rgba(184, 134, 11, 0.2);
        border-radius: 50%;
    }

    .nav-filter-body {
        padding: 16px;
        gap: 16px;
    }

    .nav-filter-input,
    .nav-filter-select {
        padding: 12px;
        font-size: 1rem;
    }

    .nav-filter-footer {
        flex-direction: column;
        gap: 12px;
        padding: 14px 16px;
    }

    .nav-clear-btn {
        width: 100%;
        padding: 10px;
        font-size: 0.85rem;
    }

    .nav-filter-stats {
        width: 100%;
        justify-content: center;
        font-size: 0.75rem;
    }

    /* Mobile back-to-top row */
    .nav-mobile-back-to-top {
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 8px;
        padding: 12px 16px;
        border-top: 1px solid rgba(184, 134, 11, 0.3);
        color: var(--bg-parchment);
        font-family: 'Special Elite', monospace;
        font-size: 0.85rem;
        cursor: pointer;
        transition: background 0.2s ease;
    }

    .nav-mobile-back-to-top:hover {
        background: rgba(184, 134, 11, 0.2);
    }
}

/* Hide old back-to-top button (now integrated into cluster) */
.back-to-top {
    display: none !important;
}

/* Hide old pagination and filter bar (controls still functional, hidden from view) */
.gallery-pagination {
    display: none !important;
}

.unified-filter-bar {
    display: none !important;
}
