@import url('https://fonts.googleapis.com/css2?family=Archivo+Black&family=Space+Grotesk:wght@400;500;700&family=Space+Mono:ital,wght@0,400;0,700;1,400&display=swap');

/* --- DESIGN TOKENS --- */
:root {
    --bg-base: #050505;
    --bg-panel: rgba(10, 10, 10, 0.85);
    --text-main: #f4f4f4;
    --text-muted: #888888;
    --border-color: rgba(255, 255, 255, 0.15);
    --grid-color: rgba(255, 255, 255, 0.1);
    --grid-bulge: rgba(255, 255, 255, 0.4);
    
    --chartreuse: #D4FF00;
    --cyber-cyan: #00E5FF;
    --alert-red: #FF3300;
    
    --font-display: 'Archivo Black', sans-serif;
    --font-ui: 'Space Grotesk', sans-serif;
    --font-mono: 'Space Mono', monospace;
}

[data-theme="light"] {
    --bg-base: #fcfcfc;
    --bg-panel: rgba(255, 255, 255, 0.9);
    --text-main: #0a0a0a;
    --text-muted: #666666;
    --border-color: rgba(0, 0, 0, 0.15);
    --grid-color: rgba(0, 0, 0, 0.1);
    --grid-bulge: rgba(0, 0, 0, 0.3);
    --chartreuse: #aacc00;
}

/* --- BASE STYLES --- */
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
    background-color: transparent;
    color: var(--text-main);
    font-family: var(--font-ui);
    -webkit-font-smoothing: antialiased;
    line-height: 1.4;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    overflow-wrap: break-word;
}

/* --- BACKGROUNDS --- */
.dot-matrix-bg, .dot-matrix-bulge {
    position: fixed;
    top: 0; left: 0; width: 100vw; height: 100vh;
    z-index: -2;
    pointer-events: none;
}
.dot-matrix-bg {
    background-color: var(--bg-base);
    background-image: radial-gradient(circle, var(--grid-color) 1.5px, transparent 1.5px);
    background-size: 24px 24px;
    transition: background-color 0.3s ease;
}
.dot-matrix-bulge {
    background-image: radial-gradient(circle, var(--grid-bulge) 2.5px, transparent 2.5px);
    background-size: 24px 24px;
    -webkit-mask-image: radial-gradient(150px at var(--mouse-x, 50vw) var(--mouse-y, 50vh), black 10%, transparent 100%);
    mask-image: radial-gradient(150px at var(--mouse-x, 50vw) var(--mouse-y, 50vh), black 10%, transparent 100%);
    z-index: -1;
}

/* --- ANIMATIONS --- */
@keyframes color-cycle { 0%, 100% { color: var(--chartreuse); } 33% { color: var(--cyber-cyan); } 66% { color: var(--alert-red); } }
@keyframes bg-cycle { 0%, 100% { background-color: var(--chartreuse); } 33% { background-color: var(--cyber-cyan); } 66% { background-color: var(--alert-red); } }
@keyframes ticker-scroll { 0% { transform: translateX(0); } 100% { transform: translateX(-50%); } }

.cycle-text { animation: color-cycle 10s infinite; }
.cycle-bg { animation: bg-cycle 10s infinite; }

/* --- HEADER --- */
.header-global {
    position: sticky;
    top: 0;
    z-index: 1000;
    background: var(--bg-panel);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-color);
}
.ticker-wrap {
    width: 100%;
    overflow: hidden;
    white-space: nowrap;
    border-bottom: 1px solid var(--border-color);
    padding: 0.5rem 0;
    font-family: var(--font-mono);
    font-size: 0.65rem;
    color: var(--text-muted);
    text-transform: uppercase;
}
.ticker-content { display: inline-block; animation: ticker-scroll 40s linear infinite; }
.ticker-item { margin-right: 4rem; }

.nav-fixed {
    padding: 0 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 60px;
}
.nav-brand {
    font-family: var(--font-display);
    font-size: 1.1rem;
    text-transform: uppercase;
    color: var(--text-main);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 10px;
}
.status-indicator { width: 10px; height: 10px; border-radius: 50%; }
.nav-links { display: flex; gap: 1.5rem; align-items: center; }
.nav-links a {
    font-family: var(--font-mono);
    font-size: 0.65rem;
    font-weight: 700;
    color: var(--text-muted);
    text-decoration: none;
}
.nav-links a:hover { color: var(--text-main); }

/* --- CONTENT --- */
.content-wrapper {
    flex: 1 0 auto;
    width: 100%;
    max-width: 1300px;
    margin: 0 auto;
    padding: 2rem 1rem;
}

/* --- FILTER PANEL (Tactical UI) --- */
.nav-filter-panel {
    display: none;
    background: var(--bg-panel);
    border-bottom: 1px dashed var(--border-color);
    padding: 1rem;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}
.nav-filter-panel.active {
    display: block;
}

.nav-filter-inner {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    width: 100%;
    max-width: var(--content-max-width);
    margin: 0 auto;
}

.filter-dropdowns {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    width: 100%;
}

.tactical-input, .tactical-select {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    font-family: var(--font-mono);
    font-size: 0.75rem;
    padding: 0.75rem 1rem;
    outline: none;
    text-transform: uppercase;
    width: 100%;
    border-radius: 0;
    appearance: none;
    -webkit-appearance: none;
}
.tactical-input:focus, .tactical-select:focus {
    border-color: var(--chartreuse);
}

.tactical-btn {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    font-family: var(--font-mono);
    font-size: 0.75rem;
    padding: 0.75rem 1rem;
    cursor: pointer;
    text-transform: uppercase;
    transition: all 0.2s;
}
.tactical-btn:hover {
    background: var(--text-main);
    color: var(--bg-base);
}

/* Filtering Active Alert State */
body.filtering-active .ticker-wrap {
    background: var(--alert-red);
}
body.filtering-active .ticker-wrap .ticker-item {
    color: #fff;
}
body.filtering-active .active-filter-ticker {
    font-weight: bold;
    animation: none; /* Override standard cycle when alert is on */
}

@media (min-width: 768px) {
    .nav-filter-panel {
        padding: 1rem 3rem;
    }
    .nav-filter-inner {
        flex-direction: row;
        align-items: center;
    }
    .filter-dropdowns {
        flex-direction: row;
        justify-content: flex-end;
    }
    .tactical-input {
        max-width: 300px;
    }
    .tactical-select {
        width: auto;
    }
}

.hero-section { margin-bottom: 3rem; }
.hero-title {
    font-family: var(--font-display);
    font-size: clamp(2.5rem, 8vw, 4.5rem);
    line-height: 0.85;
    text-transform: uppercase;
    margin-top: 1.5rem;
}
.status-pill {
    display: inline-block;
    padding: 4px 12px;
    background: var(--text-main);
    color: var(--bg-base);
    font-family: var(--font-mono);
    font-size: 0.65rem;
    font-weight: bold;
}

/* --- POST CARDS (RE-DESIGNED) --- */
.archive-container {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
}

.post-card {
    display: block;
    text-decoration: none;
    color: var(--text-main);
    position: relative;
    border: 1px solid var(--border-color);
    background: var(--bg-panel);
    backdrop-filter: blur(10px);
    transition: border-color 0.3s, transform 0.2s;
    overflow: hidden;
}

/* Hover overlay synced animation */
.post-card .hover-overlay {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    animation: bg-cycle 10s infinite;
    opacity: 0;
    transition: opacity 0.3s;
    z-index: 0;
}

.post-card:hover {
    border-color: var(--text-main);
    transform: translateY(-4px);
    color: #000;
}
.post-card:hover .hover-overlay { opacity: 1; }
.post-card:hover .text-muted { color: rgba(0,0,0,0.6); }
.post-card-inner {
    position: relative;
    z-index: 1;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    height: 100%; /* Ensure inner container fills the card */
}

.post-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 1rem;
}

.post-date-block {
    display: flex;
    align-items: baseline;
    gap: 5px;
    font-family: var(--font-mono);
}
.post-date-block .day { font-size: 1.5rem; font-weight: 700; font-family: var(--font-display); }
.post-date-block .month { font-size: 0.8rem; font-weight: bold; opacity: 0.6; }

.classification-tag { font-family: var(--font-mono); font-size: 0.65rem; text-align: right; }
.classification-tag .label { opacity: 0.5; display: block; }
.classification-tag .value { font-weight: bold; }

.post-card-body {
    flex-grow: 1; /* Pushes the footer to the bottom */
    display: flex;
    flex-direction: column;
    justify-content: center; /* Vertically center the title if it's short */
}

.post-card-title {
    font-family: var(--font-display);
    font-size: 1.6rem;
    line-height: 1.1;
    text-transform: uppercase;
}

.post-card-summary {
    font-family: var(--font-ui);
    font-size: 0.95rem;
    line-height: 1.5;
    margin-top: 0.5rem;
}

.post-card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid var(--border-color);
    padding-top: 1rem;
    font-family: var(--font-mono);
    font-size: 0.65rem;
}
.location-info .label { opacity: 0.5; }
.location-info .value { font-weight: bold; }
.access-status { font-weight: bold; letter-spacing: 0.05em; }

/* FEATURED MODIFIER */
.post-card.featured {
    border-width: 1px;
}

/* --- SINGLE POST PAGE --- */
.single-post { padding: 1.5rem; }
.post-header { margin-bottom: 3rem; padding-bottom: 2rem; border-bottom: 1px solid var(--border-color); }
.post-header .post-title { font-family: var(--font-display); font-size: clamp(2rem, 8vw, 4rem); line-height: 1; text-transform: uppercase; margin: 2rem 0; }

.tactical-meta { display: grid; grid-template-columns: 1fr; gap: 1rem; font-family: var(--font-mono); font-size: 0.7rem; text-transform: uppercase; }
.meta-box { padding: 1rem; border-left: 2px solid var(--border-color); background: rgba(0,0,0,0.1); }
.meta-box strong { display: block; color: var(--text-main); margin-bottom: 4px; }
.post-sub-meta { font-family: var(--font-mono); font-size: 0.7rem; color: var(--text-muted); margin-top: 1.5rem; }

.post-content { font-size: 1.2rem; line-height: 1.7; }
.post-content p { margin-bottom: 2rem; }
.post-content h2, .post-content h3 { font-family: var(--font-display); text-transform: uppercase; margin: 4rem 0 1.5rem; line-height: 1.1; }
.post-content blockquote { 
    border-left: 10px solid var(--chartreuse); 
    padding: 2.5rem; 
    background: rgba(0,0,0,0.1); 
    font-family: var(--font-display); 
    font-size: clamp(1.5rem, 4vw, 2.5rem); 
    text-transform: uppercase; 
    margin: 4rem 0; 
    line-height: 1;
}

.related-intel { margin-top: 5rem; padding-top: 3rem; border-top: 1px solid var(--border-color); }
.related-title { font-family: var(--font-display); font-size: 1.5rem; margin-bottom: 2.5rem; text-transform: uppercase; }

/* --- FOOTER --- */
.footer-global { padding: 4rem 1rem; margin-top: auto; border-top: 1px solid var(--border-color); }
.footer-inner { text-align: center; font-family: var(--font-mono); font-size: 0.65rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.2em; }

/* --- THEME TOGGLE --- */
.theme-btn {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    font-family: var(--font-mono);
    padding: 6px 12px;
    cursor: pointer;
    font-size: 0.6rem;
    text-transform: uppercase;
}
.theme-btn:hover { background: var(--text-main); color: var(--bg-base); }

/* --- DESKTOP EXPANSION --- */
@media (min-width: 768px) {
    .nav-fixed { padding: 0 3rem; height: 75px; }
    .nav-brand { font-size: 1.3rem; }
    .nav-links { gap: 3rem; }
    .nav-links a { font-size: 0.75rem; }
    
    .content-wrapper { padding: 4rem 3rem; }
    .hero-section { text-align: left; margin-bottom: 5rem; }
    .hero-title { font-size: 6rem; }

    /* Archive Grid Expansion */
    .archive-container { display: grid; grid-template-columns: repeat(2, 1fr); gap: 2.5rem; }
    
    /* Featured Post layout in Grid */
    a.post-card.featured { 
        grid-column: span 2; 
        border-width: 2px;
    }
    a.post-card.featured .post-card-inner { 
        display: grid; 
        grid-template-columns: 150px 1fr 180px; 
        align-items: center; 
        gap: 4rem; 
        padding: 3rem; 
    }
    a.post-card.featured .post-card-header { 
        flex-direction: column; 
        border-bottom: none; 
        border-right: 1px solid var(--border-color); 
        padding: 0; 
        height: 100%; 
        justify-content: center; 
    }
    a.post-card.featured .classification-tag { 
        text-align: left; 
        margin-top: 1rem; 
    }
    .post-card.featured .post-card-body { padding: 0; display: block; justify-content: flex-start; }
    a.post-card.featured .post-card-title { font-size: 3rem; }
    a.post-card.featured .post-card-footer { 
        border-top: none; 
        border-left: 1px solid var(--border-color); 
        padding: 0; 
        flex-direction: column; 
        height: 100%; 
        justify-content: center; 
        align-items: flex-end; 
        text-align: right; 
    }

    .post-card-title { font-size: 1.8rem; }

    /* Single Post Desktop */
    .single-post { padding: 5rem; }
    .tactical-meta { grid-template-columns: repeat(4, 1fr); gap: 2rem; }
    .post-content { max-width: 900px; margin: 0 auto; }
}
