/**
 * NoiseBLASTER! Stylesheet
 * 
 * Design system based on Noise Factor ecosystem conventions (shade, polymorphic):
 * - Dark theme (#1a1a1a background)
 * - Accent color: #aad604 (lime green)
 * - Font: Nunito
 * - Icons: Material Symbols Outlined
 * - No emojis
 */

/* ============================================================================
   Fonts
   ============================================================================ */

@font-face {
    font-family: 'Nunito';
    src: url('/fonts/Nunito.woff2') format('woff2');
    font-weight: 100 900;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Press Start 2P';
    src: url('/fonts/PressStart2P-Regular.woff2') format('woff2');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Material Symbols Outlined';
    src: url('/fonts/MaterialSymbolsOutlined.woff2') format('woff2');
    font-weight: 100 700;
    font-style: normal;
    font-display: block;
}

.material-symbols-outlined {
    font-family: 'Material Symbols Outlined';
    font-weight: normal;
    font-style: normal;
    font-size: 24px;
    line-height: 1;
    letter-spacing: normal;
    text-transform: none;
    display: inline-block;
    white-space: nowrap;
    word-wrap: normal;
    direction: ltr;
    -webkit-font-smoothing: antialiased;
    font-variation-settings: 
        'FILL' 0,
        'wght' 400,
        'GRAD' 0,
        'opsz' 24;
}

/* ============================================================================
   CSS Custom Properties
   ============================================================================ */

:root {
    /* Colors */
    --color-bg: #1a1a1a;
    --color-bg-elevated: #222222;
    --color-bg-hover: #2a2a2a;
    --color-bg-active: #333333;
    
    --color-text-primary: #e0e0e0;
    --color-text-secondary: #a0a0a0;
    --color-text-muted: #666666;
    
    --color-accent: #aad604;
    --color-accent-dim: #88b000;
    --color-accent-bright: #ccff00;
    
    --color-border: #333333;
    --color-border-subtle: #2a2a2a;
    
    --color-error: #ff4444;
    --color-success: #44ff44;
    
    /* Typography */
    --font-family: 'Nunito', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-size-xs: 0.75rem;    /* 12px */
    --font-size-sm: 0.875rem;   /* 14px */
    --font-size-base: 1rem;     /* 16px */
    --font-size-lg: 1.125rem;   /* 18px */
    --font-size-xl: 1.25rem;    /* 20px */
    --font-size-2xl: 1.5rem;    /* 24px */
    --font-size-3xl: 2rem;      /* 32px */
    
    --font-weight-normal: 400;
    --font-weight-medium: 500;
    --font-weight-semibold: 600;
    --font-weight-bold: 700;
    
    --line-height-tight: 1.2;
    --line-height-normal: 1.5;
    --line-height-relaxed: 1.75;
    
    /* Spacing */
    --space-1: 0.25rem;   /* 4px */
    --space-2: 0.5rem;    /* 8px */
    --space-3: 0.75rem;   /* 12px */
    --space-4: 1rem;      /* 16px */
    --space-5: 1.25rem;   /* 20px */
    --space-6: 1.5rem;    /* 24px */
    --space-8: 2rem;      /* 32px */
    --space-10: 2.5rem;   /* 40px */
    --space-12: 3rem;     /* 48px */
    
    /* Layout */
    --max-width: 1200px;
    --header-height: 60px;
    --footer-height: 60px;
    
    /* Borders */
    --radius-sm: 4px;
    --radius-md: 6px;
    --radius-lg: 8px;
    --radius-xl: 12px;
    --radius-full: 9999px;
    
    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 8px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.4);
    --shadow-xl: 0 16px 48px rgba(0, 0, 0, 0.5);
    
    /* Transitions */
    --transition-fast: 0.1s ease;
    --transition-base: 0.2s ease;
    --transition-slow: 0.3s ease;
    
    /* Z-index layers */
    --z-base: 0;
    --z-elevated: 10;
    --z-header: 100;
    --z-overlay: 200;
    --z-modal: 300;
}

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

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

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-family);
    font-size: var(--font-size-base);
    font-weight: var(--font-weight-normal);
    line-height: var(--line-height-normal);
    color: var(--color-text-primary);
    background-color: var(--color-bg);
    min-height: 100vh;
}

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

a:hover {
    color: var(--color-accent-bright);
    text-decoration: underline;
}

button {
    font-family: inherit;
    font-size: inherit;
    cursor: pointer;
    border: none;
    background: none;
}

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

canvas {
    display: block;
}

/* ============================================================================
   Layout
   ============================================================================ */

.app {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.main {
    flex: 1;
    width: 100%;
    max-width: var(--max-width);
    margin: 0 auto;
    padding: var(--space-4);
}

/* ============================================================================
   Header
   ============================================================================ */

.header {
    height: var(--header-height);
    background: var(--color-bg-elevated);
    border-bottom: 1px solid var(--color-border);
    position: sticky;
    top: 0;
    z-index: var(--z-header);
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    max-width: var(--max-width);
    height: 100%;
    margin: 0 auto;
    padding: 0 var(--space-6);
}

.logo-link {
    display: flex;
    align-items: center;
    text-decoration: none;
}

.logotype {
    font-family: 'Press Start 2P', monospace;
    font-size: 16px;
    line-height: 1;
    letter-spacing: -1px;
}

.logotype-noise {
    color: var(--lime) !important;
}

.logotype-blaster {
    color: #ffffff !important;
}

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

.nav-link {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-3);
    border-radius: var(--radius-md);
    color: var(--color-text-secondary);
    transition: all var(--transition-fast);
}

.nav-link:hover {
    color: var(--color-text-primary);
    background: var(--color-bg-hover);
    text-decoration: none;
}

.nav-link .material-symbols-outlined {
    font-size: 20px;
}

.nav-label {
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-medium);
}

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

.footer {
    height: var(--footer-height);
    background: var(--color-bg);
    border-top: 1px solid var(--color-border);
}

.footer-inner {
    display: flex;
    align-items: center;
    justify-content: center;
    max-width: var(--max-width);
    height: 100%;
    margin: 0 auto;
    padding: 0 var(--space-6);
}

.footer-text {
    font-size: var(--font-size-sm);
    color: var(--color-text-muted);
}

.footer-text a {
    color: var(--color-text-secondary);
}

.footer-text a:hover {
    color: var(--color-accent);
}

.footer-separator {
    margin: 0 var(--space-3);
    color: var(--color-border);
}

.rss-link {
    display: inline;
    color: var(--color-text-secondary);
}

/* ============================================================================
   Buttons
   ============================================================================ */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-4);
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-medium);
    line-height: 1;
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
}

.btn .material-symbols-outlined {
    font-size: 18px;
}

.btn-primary {
    background: var(--color-accent);
    color: var(--color-bg);
}

.btn-primary:hover {
    background: var(--color-accent-bright);
}

.btn-secondary {
    background: var(--color-bg-active);
    color: var(--color-text-primary);
}

.btn-secondary:hover {
    background: var(--color-bg-hover);
}

.btn-large {
    padding: var(--space-3) var(--space-6);
    font-size: var(--font-size-base);
}

.btn-large .material-symbols-outlined {
    font-size: 24px;
}

/* ============================================================================
   Loading / Error / Empty States
   ============================================================================ */

.loading-state,
.error-state,
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 400px;
    text-align: center;
    padding: var(--space-8);
}

.loading-spinner,
.error-icon,
.empty-icon {
    margin-bottom: var(--space-4);
}

.loading-spinner .material-symbols-outlined,
.error-icon .material-symbols-outlined,
.empty-icon .material-symbols-outlined {
    font-size: 64px;
    color: var(--color-text-muted);
}

.error-icon .material-symbols-outlined {
    color: var(--color-error);
}

.loading-text,
.error-text,
.empty-text {
    font-size: var(--font-size-base);
    color: var(--color-text-secondary);
    max-width: 400px;
}

.error-title,
.empty-title {
    font-size: var(--font-size-xl);
    font-weight: var(--font-weight-semibold);
    color: var(--color-text-primary);
    margin-bottom: var(--space-2);
}

.error-state .btn {
    margin-top: var(--space-6);
}

/* ============================================================================
   Content Container
   ============================================================================ */

.content {
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
}

.section-title {
    font-size: var(--font-size-lg);
    font-weight: var(--font-weight-semibold);
    color: var(--color-text-secondary);
    margin-bottom: var(--space-2);
}

/* ============================================================================
   Hero Section
   ============================================================================ */

.hero-section {
    width: 100%;
}

.hero-container {
    position: relative;
    width: 100%;
    max-height: 45vh;
    aspect-ratio: 21 / 9;
    background: var(--color-bg-elevated);
    border-radius: var(--radius-xl);
    overflow: hidden;
    cursor: pointer;
    transition: transform var(--transition-base), box-shadow var(--transition-base);
}

.hero-container:hover {
    transform: scale(1.005);
    box-shadow: var(--shadow-xl);
}

.hero-container:hover .hero-overlay {
    opacity: 1;
}

.hero-container:hover .hero-action {
    opacity: 1;
    transform: translateY(0);
}

.hero-canvas {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.hero-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: var(--space-6);
    background: linear-gradient(
        to top,
        rgba(0, 0, 0, 0.9) 0%,
        rgba(0, 0, 0, 0.6) 30%,
        rgba(0, 0, 0, 0.2) 60%,
        transparent 100%
    );
    opacity: 0.9;
    transition: opacity var(--transition-base);
}

.hero-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
}

.hero-title {
    font-size: var(--font-size-2xl);
    font-weight: var(--font-weight-bold);
    color: #ffffff;
    margin-bottom: var(--space-2);
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
}

.hero-meta {
    display: flex;
    align-items: center;
    gap: var(--space-4);
    font-size: var(--font-size-sm);
    color: var(--color-text-secondary);
}

.hero-author {
    display: flex;
    align-items: center;
    gap: var(--space-1);
}

.hero-author .material-symbols-outlined {
    font-size: 16px;
}

.hero-time {
    color: var(--color-text-muted);
}

.hero-action {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-4);
    background: var(--color-accent);
    color: var(--color-bg);
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-medium);
    border-radius: var(--radius-md);
    align-self: flex-start;
    margin-top: var(--space-4);
    opacity: 0;
    transform: translateY(8px);
    transition: all var(--transition-base);
}

.hero-action .material-symbols-outlined {
    font-size: 18px;
}

.hero-loading,
.hero-error {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    background: var(--color-bg-elevated);
    color: var(--color-text-muted);
    font-size: var(--font-size-sm);
}

.hero-loading .material-symbols-outlined,
.hero-error .material-symbols-outlined {
    font-size: 48px;
}

.hero-error {
    color: var(--color-error);
}

/* ============================================================================
   Thumbnails Grid
   ============================================================================ */

.thumbnails-section {
    width: 100%;
}

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

.thumbnail-card {
    position: relative;
    aspect-ratio: 4 / 3;
    background: var(--color-bg-elevated);
    border-radius: var(--radius-lg);
    overflow: hidden;
    cursor: pointer;
    transition: transform var(--transition-base), box-shadow var(--transition-base);
}

.thumbnail-card:hover {
    transform: scale(1.03);
    box-shadow: var(--shadow-lg);
}

.thumbnail-card:hover .thumbnail-overlay {
    opacity: 1;
}

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

.thumbnail-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--color-bg-active), var(--color-bg-elevated));
}

.thumbnail-placeholder .material-symbols-outlined {
    font-size: 48px;
    color: var(--color-text-muted);
}

.thumbnail-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: var(--space-3);
    background: linear-gradient(
        to top,
        rgba(0, 0, 0, 0.85) 0%,
        rgba(0, 0, 0, 0.4) 50%,
        transparent 100%
    );
    opacity: 0.85;
    transition: opacity var(--transition-fast);
}

.thumbnail-title {
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-semibold);
    color: #ffffff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: var(--space-1);
}

.thumbnail-meta {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-size: var(--font-size-xs);
    color: var(--color-text-secondary);
}

.thumbnail-author {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ============================================================================
   App Tags
   ============================================================================ */

.app-tag {
    display: inline-flex;
    align-items: center;
    padding: var(--space-1) var(--space-2);
    background: var(--color-bg-active);
    border-radius: var(--radius-sm);
    font-size: var(--font-size-xs);
    font-weight: var(--font-weight-medium);
    color: var(--color-text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.app-tag.app-noisedeck {
    background: rgba(170, 214, 4, 0.2);
    color: var(--color-accent);
}

.app-tag.app-polymorphic {
    background: rgba(100, 200, 255, 0.2);
    color: #64c8ff;
}

.app-tag.app-shade {
    background: rgba(255, 100, 200, 0.2);
    color: #ff64c8;
}

.app-tag.app-foundry {
    background: rgba(255, 200, 100, 0.2);
    color: #ffc864;
}

/* ============================================================================
   More Section
   ============================================================================ */

.more-section {
    display: flex;
    justify-content: center;
    padding: var(--space-3) 0;
}

/* ============================================================================
   Feed Section (Infinite Scroll)
   ============================================================================ */

.feed-section {
    width: 100%;
}

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

.feed-loading,
.feed-end {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    padding: var(--space-8);
    color: var(--color-text-muted);
    font-size: var(--font-size-sm);
}

.feed-end .material-symbols-outlined {
    color: var(--color-success);
}

/* ============================================================================
   Animations
   ============================================================================ */

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

.spinning {
    animation: spin 1s linear infinite;
}

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

.fade-in {
    animation: fadeIn var(--transition-base) forwards;
}

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

.slide-up {
    animation: slideUp var(--transition-slow) forwards;
}

/* ============================================================================
   Utilities
   ============================================================================ */

.hidden {
    display: none !important;
}

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

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

@media (max-width: 1024px) {
    .thumbnails-grid,
    .feed-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 768px) {
    :root {
        --header-height: 56px;
    }
    
    .main {
        padding: var(--space-4);
    }
    
    .header-inner {
        padding: 0 var(--space-4);
    }
    
    .nav-label {
        display: none;
    }
    
    .thumbnails-grid,
    .feed-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: var(--space-3);
    }
    
    .hero-title {
        font-size: var(--font-size-xl);
    }
    
    .hero-overlay {
        padding: var(--space-4);
    }
    
    .section-title {
        font-size: var(--font-size-base);
    }
}

@media (max-width: 480px) {
    .hero-container {
        aspect-ratio: 4 / 3;
    }
    
    .hero-meta {
        flex-wrap: wrap;
        gap: var(--space-2);
    }
    
    .footer-separator {
        display: none;
    }
    
    .footer-text {
        display: flex;
        flex-direction: column;
        gap: var(--space-2);
    }
}

/* ============================================================================
   Reduced Motion
   ============================================================================ */

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    .spinning {
        animation: none;
    }
}
