/* ========================================
   AN/FPS-35 Gallery - Terminal Theme
   Unified with sid3.xyz main site aesthetic
   ======================================== */

:root {
    /* Terminal color palette - synced with main site */
    --terminal-bg: #0b1220;
    --terminal-bg-light: #0f172a;
    --terminal-text: #e0e0e0;
    --neon-green: #00FFB3;
    --neon-cyan: #22d3ee;
    --neon-yellow: #facc15;
    --card-bg: rgba(15, 23, 42, 0.8);
    --card-border: rgba(0, 255, 179, 0.2);
    --card-border-hover: #00FFB3;
    
    /* Typography */
    --font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-mono: 'Courier New', Courier, monospace;
}

/* ========================================
   Base Reset & Layout
   ======================================== */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    height: 100%;
    scroll-behavior: smooth;
}

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }
    *, *::before, *::after {
        animation-duration: 0.001ms !important;
        transition-duration: 0.001ms !important;
    }
}

body.terminal-body {
    min-height: 100vh;
    background-color: var(--terminal-bg);
    color: var(--terminal-text);
    font-family: var(--font-family);
    padding: 20px;
    position: relative;
    overflow-x: hidden;
}

/* ========================================
   Terminal Visual Effects
   ======================================== */

/* Scanline overlay */
.scanlines {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: repeating-linear-gradient(
        0deg,
        rgba(0, 255, 179, 0.03) 0px,
        rgba(0, 255, 179, 0.03) 1px,
        transparent 1px,
        transparent 2px
    );
    pointer-events: none;
    z-index: 100;
    opacity: 0.5;
}

/* Terminal chrome background glow */
.terminal-chrome {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(
        ellipse at center,
        rgba(0, 255, 179, 0.05) 0%,
        transparent 70%
    );
    pointer-events: none;
    z-index: 0;
}

/* ========================================
   Header & Navigation
   ======================================== */

.terminal-header {
    text-align: center;
    margin-bottom: 3rem;
    position: relative;
    z-index: 10;
}

.terminal-nav {
    margin-bottom: 1.5rem;
}

.terminal-link {
    color: var(--neon-green);
    text-decoration: none;
    font-family: var(--font-mono);
    font-size: 0.9rem;
    transition: all 0.3s ease;
    display: inline-block;
}

.terminal-link:hover {
    text-shadow: 0 0 10px var(--neon-green);
    transform: translateX(-4px);
}

.terminal-prompt {
    color: var(--neon-cyan);
    margin-right: 0.5rem;
}

.terminal-title {
    font-family: var(--font-mono);
    font-size: clamp(1.5rem, 4vw, 2.5rem);
    margin-bottom: 1rem;
    color: var(--neon-green);
    text-shadow: 0 0 20px rgba(0, 255, 179, 0.5);
    letter-spacing: 0.05em;
}

.terminal-cursor {
    animation: blink 1s step-end infinite;
    color: var(--neon-cyan);
}

@keyframes blink {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0; }
}

.terminal-description {
    max-width: 800px;
    margin: 0 auto;
    font-size: clamp(0.95rem, 2vw, 1.1rem);
    line-height: 1.6;
    color: var(--terminal-text);
}

/* ========================================
   Filter Buttons - Terminal Command Style
   ======================================== */

#filter-container {
    text-align: center;
    margin-bottom: 2.5rem;
    position: relative;
    z-index: 10;
}

.filter-btn {
    background-color: var(--card-bg);
    color: var(--terminal-text);
    border: 1px solid var(--card-border);
    padding: 10px 20px;
    margin: 5px;
    border-radius: 4px;
    cursor: pointer;
    font-family: var(--font-mono);
    font-size: 0.85rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.filter-btn::before {
    content: '[';
    margin-right: 0.3rem;
    color: var(--neon-cyan);
}

.filter-btn::after {
    content: ']';
    margin-left: 0.3rem;
    color: var(--neon-cyan);
}

.filter-btn:hover {
    border-color: var(--card-border-hover);
    box-shadow: 0 0 15px rgba(0, 255, 179, 0.3);
    transform: translateY(-2px);
}

.filter-btn.active {
    background-color: rgba(0, 255, 179, 0.1);
    border-color: var(--neon-green);
    color: var(--neon-green);
    box-shadow: 0 0 20px rgba(0, 255, 179, 0.4);
}

/* ========================================
   Gallery Grid - Neon Terminal Cards
   ======================================== */

.gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
    position: relative;
    z-index: 10;
    padding: 1rem 0;
}

.gallery a {
    background-color: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 4px;
    overflow: hidden;
    text-decoration: none;
    color: var(--terminal-text);
    transition: all 0.3s ease;
    position: relative;
    display: block;
}

.gallery a::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(0, 255, 179, 0.1) 0%, transparent 50%);
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.gallery a:hover {
    border-color: var(--card-border-hover);
    box-shadow: 0 0 20px rgba(0, 255, 179, 0.4), 0 4px 12px rgba(0, 0, 0, 0.3);
    transform: translateY(-4px);
}

.gallery a:hover::before {
    opacity: 1;
}

/* Image container for progressive loading */
.img-container {
    width: 100%;
    height: 200px;
    overflow: hidden;
    border-bottom: 1px solid var(--card-border);
    background: var(--terminal-bg-light);
    position: relative;
}

.gallery img {
    width: 100%;
    height: 200px;
    object-fit: cover;
    display: block;
    transition: filter 0.4s ease, opacity 0.4s ease, transform 0.4s ease;
}

/* Blur-up progressive loading effect */
.gallery img.blur-up {
    filter: blur(10px);
    opacity: 0.7;
    transform: scale(1.05);
}

.gallery img.loaded {
    filter: blur(0);
    opacity: 1;
    transform: scale(1);
}

.gallery img.error {
    filter: grayscale(1) brightness(0.5);
    opacity: 0.5;
}

.gallery a:hover img.loaded {
    filter: brightness(1.1);
}

.gallery .title {
    padding: 15px;
    font-size: 0.9rem;
    font-family: var(--font-mono);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--terminal-text);
}

.gallery a:hover .title {
    color: var(--neon-green);
}

/* ========================================
   Loading State
   ======================================== */

.loading-message {
    text-align: center;
    font-size: 1.2rem;
    font-family: var(--font-mono);
    width: 100%;
    color: var(--neon-cyan);
    animation: pulse 1.5s ease-in-out infinite;
}

.loading-message::after {
    content: '█';
    animation: blink 1s step-end infinite;
    margin-left: 0.5rem;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* ========================================
   Lightbox Modal - Terminal CRT Style
   ======================================== */

.lightbox-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(11, 18, 32, 0.95);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.lightbox-overlay[data-visible="true"] {
    opacity: 1;
    visibility: visible;
}

.lightbox-content {
    position: relative;
    max-width: 90%;
    max-height: 90%;
    display: flex;
    flex-direction: column;
    align-items: center;
    border: 2px solid var(--card-border-hover);
    border-radius: 8px;
    padding: 20px;
    background: rgba(15, 23, 42, 0.9);
    box-shadow: 0 0 40px rgba(0, 255, 179, 0.3), 
                0 0 80px rgba(0, 255, 179, 0.1);
}

.lightbox-content img {
    max-width: 100%;
    max-height: 80vh;
    object-fit: contain;
    border-radius: 4px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
    transition: opacity 0.4s ease, filter 0.4s ease;
}

.lightbox-content img.blur-up {
    filter: blur(8px);
}

.lightbox-caption {
    color: var(--neon-green);
    margin-top: 15px;
    font-family: var(--font-mono);
    text-align: center;
    width: 100%;
    max-width: 800px;
}

.caption-content {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.caption-title {
    font-size: 1.1rem;
    text-shadow: 0 0 10px rgba(0, 255, 179, 0.5);
}

.caption-meta {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
}

.category-badge {
    padding: 4px 12px;
    border-radius: 3px;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border: 1px solid;
}

.category-badge.category-electronics {
    background: rgba(34, 211, 238, 0.1);
    border-color: var(--neon-cyan);
    color: var(--neon-cyan);
}

.category-badge.category-filters {
    background: rgba(0, 255, 179, 0.1);
    border-color: var(--neon-green);
    color: var(--neon-green);
}

.category-badge.category-miscellaneous {
    background: rgba(250, 204, 21, 0.1);
    border-color: var(--neon-yellow);
    color: var(--neon-yellow);
}

.image-counter {
    font-size: 0.9rem;
    color: var(--terminal-text);
    opacity: 0.7;
}

.lightbox-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0, 255, 179, 0.1);
    color: var(--neon-green);
    border: 1px solid var(--card-border-hover);
    padding: 15px 20px;
    cursor: pointer;
    font-size: 2rem;
    z-index: 1001;
    border-radius: 4px;
    transition: all 0.3s ease;
    font-family: var(--font-mono);
}

.lightbox-nav:hover {
    background: rgba(0, 255, 179, 0.2);
    box-shadow: 0 0 20px rgba(0, 255, 179, 0.5);
    transform: translateY(-50%) scale(1.1);
}

.lightbox-nav.prev {
    left: 20px;
}

.lightbox-nav.next {
    right: 20px;
}

.lightbox-close {
    position: absolute;
    top: 20px;
    right: 20px;
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.5);
    padding: 8px 15px;
    cursor: pointer;
    font-size: 1.5rem;
    z-index: 1001;
    border-radius: 4px;
    transition: all 0.3s ease;
    font-family: var(--font-mono);
}

.lightbox-close:hover {
    background: rgba(239, 68, 68, 0.2);
    box-shadow: 0 0 15px rgba(239, 68, 68, 0.5);
    transform: rotate(90deg);
}

/* ========================================
   Scroll Lock Utility
   ======================================== */

.no-scroll {
    overflow: hidden !important;
}

body.no-scroll {
    padding-right: 17px; /* Compensate for scrollbar width */
}

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

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

@media (max-width: 768px) {
    .terminal-title {
        font-size: 1.5rem;
    }
    
    .terminal-description {
        font-size: 0.95rem;
    }
    
    .filter-btn {
        padding: 8px 15px;
        font-size: 0.75rem;
        margin: 3px;
    }
    
    .gallery {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
        gap: 15px;
    }
    
    .lightbox-nav {
        padding: 10px 15px;
        font-size: 1.5rem;
    }
    
    .lightbox-nav.prev {
        left: 10px;
    }
    
    .lightbox-nav.next {
        right: 10px;
    }
    
    .lightbox-close {
        top: 10px;
        right: 10px;
        padding: 5px 10px;
        font-size: 1.2rem;
    }
    
    .lightbox-content {
        max-width: 95%;
        max-height: 95%;
        padding: 15px;
    }
    
    .caption-content {
        gap: 8px;
    }
    
    .caption-title {
        font-size: 0.95rem;
    }
    
    .caption-meta {
        gap: 10px;
    }
    
    .category-badge {
        font-size: 0.7rem;
        padding: 3px 10px;
    }
    
    .image-counter {
        font-size: 0.8rem;
    }
}

@media (max-width: 480px) {
    .gallery {
        grid-template-columns: 1fr;
    }
    
    .scanlines {
        opacity: 0.3;
    }
}
