/* ==========================================================================
   Eastern Veil - Design System
   Inspired by @srotimi_ui aesthetic
   ========================================================================== */

:root {
    /* Color Palette */
    --bg-base: #000000;
    --bg-surface: #0a0a0a;
    --bg-surface-elevated: #111111;
    
    --grid-line: rgba(255, 255, 255, 0.05);
    --grid-line-strong: rgba(255, 255, 255, 0.1);
    
    --text-primary: #ffffff;
    --text-muted: rgba(255, 255, 255, 0.5);
    --text-dim: rgba(255, 255, 255, 0.3);
    
    --accent-red: #d7263d;
    --accent-red-glow: rgba(215, 38, 61, 0.3);
    --accent-blue: #4a90e2;
    --accent-blue-glow: rgba(74, 144, 226, 0.3);
    
    --border-color: rgba(255, 255, 255, 0.15);
    --border-subtle: rgba(255, 255, 255, 0.08);

    /* Typography */
    --font-display: 'Syne', sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
    
    /* Spacing */
    --space-xs: 4px;
    --space-sm: 8px;
    --space-md: 16px;
    --space-lg: 32px;
    --space-xl: 64px;
    --space-2xl: 128px;
    
    /* Grid Size */
    --grid-size: 80px;
    
    /* Transitions */
    --transition-fast: 150ms ease-out;
    --transition-base: 300ms ease-out;
    --transition-slow: 600ms cubic-bezier(0.16, 1, 0.3, 1);
}

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

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

body {
    background-color: var(--bg-base);
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: 14px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
    position: relative;
    min-height: 100vh;
}

/* ==========================================================================
   Grid Background (Stephen's signature)
   ========================================================================== */

.grid-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    z-index: -1;
    background-size: var(--grid-size) var(--grid-size);
    background-image: 
        linear-gradient(to right, var(--grid-line) 1px, transparent 1px),
        linear-gradient(to bottom, var(--grid-line) 1px, transparent 1px);
    mask-image: linear-gradient(to bottom, rgba(0,0,0,1) 0%, rgba(0,0,0,0.3) 100%);
    -webkit-mask-image: linear-gradient(to bottom, rgba(0,0,0,1) 0%, rgba(0,0,0,0.3) 100%);
}

/* Add stronger markers at intersections */
.grid-overlay::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-size: calc(var(--grid-size) * 4) calc(var(--grid-size) * 4);
    background-image: 
        linear-gradient(to right, var(--grid-line-strong) 1px, transparent 1px),
        linear-gradient(to bottom, var(--grid-line-strong) 1px, transparent 1px);
}

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

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-display);
    font-weight: 700;
    letter-spacing: -0.02em;
}

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

a:hover {
    color: var(--accent-red);
}

.accent-blue { color: var(--accent-blue); }
.accent-red { color: var(--accent-red); }

/* ==========================================================================
   Navigation
   ========================================================================== */

.main-nav {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 90px;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-color);
    z-index: 100;
}

.nav-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 100%;
    padding: 0 var(--space-xl);
    max-width: 1600px;
    margin: 0 auto;
}

.logo {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    font-weight: 500;
    letter-spacing: normal;
    font-size: 2rem;
    transition: all var(--transition-fast);
}

.logo:hover {
    color: var(--text-primary);
    text-shadow: 0 0 8px rgba(255, 255, 255, 0.8), 0 0 15px rgba(255, 255, 255, 0.6);
}

.nav-logo-img {
    height: 44px;
    width: auto;
    mix-blend-mode: screen; /* Drops the black background, keeps the white lines */
}

.nav-links {
    display: flex;
    gap: var(--space-lg);
}

.nav-links a {
    letter-spacing: 0.1em;
    position: relative;
    padding: var(--space-xs) 0;
    font-weight: 700;
    font-size: 1rem;
    
    background: linear-gradient(90deg, var(--accent-red) 0%, var(--accent-blue) 50%, #fff 50%, #fff 100%);
    background-size: 200% auto;
    background-position: 100% center;
    color: transparent;
    -webkit-background-clip: text;
    background-clip: text;
    transition: background-position 0.4s ease-out, text-shadow 0.4s ease-out;
}

.nav-links a:hover {
    background-position: 0% center;
    text-shadow: 0 0 15px rgba(215, 38, 61, 0.4);
}

.nav-links a.active {
    background: linear-gradient(90deg, var(--accent-red) 0%, var(--accent-blue) 100%);
    background-size: 100% auto;
    color: transparent;
    -webkit-background-clip: text;
    background-clip: text;
}

.nav-links a.active::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    width: 100%;
    height: 1px;
    background: #fff;
    box-shadow: 0 0 8px rgba(255, 255, 255, 0.8), 0 0 15px rgba(255, 255, 255, 0.4);
}

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

.hero {
    position: relative;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

#nebula-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
}



.hero-content {
    position: relative;
    z-index: 10;
    text-align: center;
    max-width: 1000px;
    padding: 0 var(--space-lg);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-xl);
}

.hero-top-meta {
    display: flex;
    gap: var(--space-xl);
    color: var(--text-muted);
    font-size: 12px;
    letter-spacing: 0.1em;
    border: 1px solid var(--border-subtle);
    padding: var(--space-sm) var(--space-md);
    background: rgba(0,0,0,0.4);
    backdrop-filter: blur(4px);
}

.hero-title {
    font-size: clamp(3rem, 7vw, 6rem);
    line-height: 1.1;
    display: flex;
    flex-direction: column;
    text-shadow: 0 4px 24px rgba(0,0,0,0.5);
}

.hero-title .word {
    opacity: 0;
    display: inline-block;
    animation: revealWord 0.6s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
}

@keyframes revealWord {
    0% { opacity: 0; transform: translateY(20px); filter: blur(8px); }
    100% { opacity: 1; transform: translateY(0); filter: blur(0); }
}

.word.w1 { animation-delay: 0.3s; }
.word.w2 { animation-delay: 0.6s; }
.word.w3 { animation-delay: 0.8s; }
.word.w4 { animation-delay: 1.0s; }
.word.w5 { animation-delay: 1.3s; }
.word.w6 { animation-delay: 1.5s; }
.word.w7 { animation-delay: 1.7s; }

.hero-title .highlight {
    display: inline-block;
}

.hero-title .highlight .word {
    background: linear-gradient(to right, #fff, var(--text-muted));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* ==========================================================================
   Comet Buffer Animation
   ========================================================================== */

.comet-target {
    position: relative;
    display: inline-block;
}

.comet-buffer {
    position: absolute;
    bottom: -15px; /* Sits underneath the target line */
    left: 0;
    width: 100%;
    height: 2px;
    background: rgba(255, 255, 255, 0.04);
}

.comet-line {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    width: 100%;
    background: linear-gradient(90deg, transparent, var(--accent-red) 70%, #fff 100%);
    transform-origin: left;
    transform: scaleX(0);
    animation: cometDraw 1.5s cubic-bezier(0.4, 0, 0.2, 1) forwards;
    animation-delay: 2.3s; /* Waits for word 'Light.' (1.7s + 0.6s duration) */
}

.comet-head {
    position: absolute;
    top: -2px; /* Centers 6px head on 2px track */
    left: 0;
    width: 6px;
    height: 6px;
    background: #fff;
    border-radius: 50%;
    box-shadow: 0 0 15px 5px var(--accent-blue), 0 0 30px 10px rgba(215, 38, 61, 0.8);
    opacity: 0;
    animation: cometShoot 1.5s cubic-bezier(0.4, 0, 0.2, 1) forwards;
    animation-delay: 2.3s;
}

@keyframes cometDraw {
    0% { transform: scaleX(0); opacity: 0; }
    15% { opacity: 1; }
    100% { transform: scaleX(1); opacity: 1; }
}

@keyframes cometShoot {
    0% { left: 0%; opacity: 0; }
    15% { opacity: 1; }
    100% { left: 100%; opacity: 0; display: none; }
}

/* ==========================================================================
   Section Panels (Stephen's Style)
   ========================================================================== */

.section-panel {
    padding: var(--space-xl);
    max-width: 1400px;
    margin: 0 auto;
    position: relative;
}

.panel-container {
    border: 1px solid #ffffff;
    box-shadow: 0 0 60px rgba(255, 255, 255, 0.05), inset 0 0 30px rgba(255, 255, 255, 0.02);
    background: var(--bg-surface);
    position: relative;
}

.panel-header {
    display: grid;
    grid-template-columns: auto 1fr auto;
    border-bottom: 1px solid #ffffff;
    padding: var(--space-md);
    background: linear-gradient(90deg, rgba(255, 255, 255, 0.05), transparent);
    font-size: 12px;
    letter-spacing: 0.1em;
}

.panel-header > span {
    padding: 0 var(--space-md);
}

.panel-id { color: var(--text-muted); border-right: 1px solid var(--border-color); }
.panel-title { color: var(--text-primary); }
.panel-status { color: var(--accent-red); border-left: 1px solid var(--border-color); }

.panel-body {
    padding: var(--space-xl);
}

/* ==========================================================================
   Mission Section
   ========================================================================== */

.mission-text {
    font-size: clamp(2rem, 4vw, 3rem);
    max-width: 800px;
    margin-bottom: var(--space-xl);
    line-height: 1.2;
}

.mission-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr));
    gap: 1px; /* Borders via background */
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid #ffffff;
}

.grid-card {
    background: var(--bg-surface);
    padding: var(--space-lg);
    transition: all var(--transition-base);
    position: relative;
}

.grid-card:hover {
    background: var(--bg-surface-elevated);
    box-shadow: inset 0 0 40px rgba(255, 255, 255, 0.08);
}

.card-header {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    margin-bottom: var(--space-md);
    color: var(--text-primary);
}

.card-header h3 {
    font-family: var(--font-mono);
    font-size: 14px;
    letter-spacing: 0.1em;
}

.card-icon {
    font-size: 18px;
}

.grid-card p {
    color: var(--text-muted);
}

/* ==========================================================================
   News Section (SEC 02)
   ========================================================================== */


.news-carousel {
    width: 100%;
    overflow: hidden;
    padding: var(--space-md) 0;
    position: relative;
}

/* Gradients on edges to blend the scrolling */
.news-carousel::before, .news-carousel::after {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    width: 100px;
    z-index: 2;
    pointer-events: none;
}
.news-carousel::before { left: 0; background: linear-gradient(to right, var(--bg-surface), transparent); }
.news-carousel::after { right: 0; background: linear-gradient(to left, var(--bg-surface), transparent); }

.news-track {
    display: flex;
    gap: var(--space-lg);
    width: max-content;
    animation: marquee 40s linear infinite;
}

.news-track:hover {
    animation-play-state: paused;
}

@keyframes marquee {
    0% { transform: translateX(0); }
    100% { transform: translateX(calc(-50% - (var(--space-lg) / 2))); }
}

.news-card {
    flex: 0 0 300px;
    display: flex;
    flex-direction: column;
    border: 1px solid #ffffff;
    background: var(--bg-surface);
    transition: all var(--transition-base);
    text-decoration: none;
    position: relative;
    overflow: hidden;
}

.news-card:hover {
    background: var(--bg-surface-elevated);
    box-shadow: inset 0 0 40px rgba(255, 255, 255, 0.08), 0 0 20px rgba(255, 255, 255, 0.1);
    transform: translateY(-2px);
}

.news-image-wrapper {
    width: 100%;
    height: 160px;
    position: relative;
    border-bottom: 1px solid #ffffff;
    overflow: hidden;
}

.news-image-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    filter: grayscale(80%) contrast(1.2);
    transition: filter var(--transition-slow), transform var(--transition-slow);
}

.news-card:hover .news-image-wrapper img {
    filter: grayscale(0%) contrast(1.1);
    transform: scale(1.05);
}

.news-overlay {
    position: absolute;
    inset: 0;
    background-image: 
        linear-gradient(to right, rgba(255, 255, 255, 0.1) 1px, transparent 1px),
        linear-gradient(to bottom, rgba(255, 255, 255, 0.1) 1px, transparent 1px);
    background-size: 20px 20px;
    pointer-events: none;
    mix-blend-mode: overlay;
}

.news-content {
    padding: var(--space-md) var(--space-md) var(--space-lg);
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: var(--space-sm);
}

.news-meta {
    display: flex;
    justify-content: space-between;
    font-size: 10px;
    letter-spacing: 0.1em;
    color: var(--accent-blue);
    margin-bottom: 4px;
}

.news-title {
    font-size: 1.1rem;
    color: var(--text-primary);
    line-height: 1.4;
    min-height: 2.8em;
}

.news-action {
    margin-top: var(--space-xs);
    font-size: 10px;
    letter-spacing: 0.1em;
    color: var(--text-muted);
    transition: color var(--transition-base);
}

.news-card:hover .news-action {
    color: var(--accent-red);
}

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

.main-footer {
    border-top: 1px solid var(--border-color);
    padding: var(--space-xl) var(--space-xl) var(--space-md);
    background: var(--bg-surface);
    margin-top: var(--space-2xl);
}

.footer-grid {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1.5fr;
    gap: var(--space-xl);
    max-width: 1400px;
    margin: 0 auto;
    margin-bottom: var(--space-xl);
}

.footer-col {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.footer-logo {
    font-weight: 700;
    letter-spacing: 0.1em;
    font-size: 1.2rem;
    margin-bottom: var(--space-xs);
}

.footer-col p {
    color: var(--text-muted);
}

.col-title {
    color: var(--text-dim);
    font-size: 10px;
    letter-spacing: 0.2em;
    margin-bottom: var(--space-xs);
}

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

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

.footer-bottom {
    display: flex;
    justify-content: space-between;
    border-top: 1px solid var(--border-subtle);
    padding-top: var(--space-md);
    color: var(--text-dim);
    font-size: 10px;
    letter-spacing: 0.1em;
    max-width: 1400px;
    margin: 0 auto;
}

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

@keyframes scroll {
    0% { transform: translateY(-100%); }
    100% { transform: translateY(100%); }
}

.fade-up {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.8s ease-out, transform 0.8s ease-out;
}

.fade-up.visible {
    opacity: 1;
    transform: translateY(0);
}

.delay-1 { transition-delay: 100ms; }
.delay-2 { transition-delay: 200ms; }
.delay-3 { transition-delay: 300ms; }
.delay-4 { transition-delay: 400ms; }

@media (prefers-reduced-motion: reduce) {
    *, ::before, ::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
    .fade-up {
        opacity: 1;
        transform: none;
    }
}

/* ==========================================================================
   Breakpoints
   ========================================================================== */

@media (min-width: 768px) {
    .mobile-menu-btn {
        display: none;
    }
}

@media (max-width: 768px) {
    /* Layout & Spacing */
    .section-panel {
        padding: var(--space-lg) var(--space-md);
    }
    
    .hero-title {
        font-size: clamp(2.5rem, 10vw, 4rem);
    }
    
    .hero-top-meta {
        font-size: 10px;
        padding: var(--space-xs) var(--space-sm);
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .hero-content {
        padding: 0 var(--space-md);
        gap: var(--space-lg);
    }
    
    /* Footer */
    .footer-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: var(--space-lg);
    }
    
    .footer-col:first-child {
        grid-column: 1 / -1;
        margin-bottom: var(--space-md);
    }
    
    .footer-col:first-child > div {
        justify-content: center;
    }
    
    .main-footer {
        padding: var(--space-lg) var(--space-md) var(--space-md);
    }
    
    /* Navigation Dropdown */
    .mobile-menu-btn {
        display: flex;
        flex-direction: column;
        justify-content: space-between;
        width: 30px;
        height: 20px;
        background: transparent;
        border: none;
        cursor: pointer;
        z-index: 110;
        padding: 0;
    }
    
    .mobile-menu-btn .bar {
        height: 2px;
        width: 100%;
        background-color: var(--text-primary);
        border-radius: 2px;
        transition: all 0.3s ease;
    }
    
    .mobile-menu-btn.is-open .line1 {
        transform: translateY(9px) rotate(45deg);
    }
    .mobile-menu-btn.is-open .line2 {
        opacity: 0;
    }
    .mobile-menu-btn.is-open .line3 {
        transform: translateY(-9px) rotate(-45deg);
    }
    
    .nav-links {
        position: fixed;
        top: 90px;
        left: 0;
        width: 100%;
        background: rgba(0, 0, 0, 0.95);
        backdrop-filter: blur(16px);
        -webkit-backdrop-filter: blur(16px);
        border-bottom: 1px solid var(--border-color);
        flex-direction: column;
        padding: var(--space-xl) var(--space-lg);
        gap: var(--space-xl);
        transform: translateY(-150%);
        opacity: 0;
        visibility: hidden;
        transition: all var(--transition-base);
        z-index: 105;
        align-items: center;
    }
    
    .nav-links.is-open {
        transform: translateY(0);
        opacity: 1;
        visibility: visible;
    }
    
    .nav-links a {
        font-size: 1.2rem;
    }
}
