/* ═══ LA BRECHA v3 — Final Design ═══ */
* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
    --primary: #10b981;
    --primary-dim: #10b98112;
    --primary-border: #10b98125;
    --primary-glow: #10b98140;
    --red: #ef4444;
    --orange: #f59e0b;
    --yellow: #eab308;
    --purple: #8b5cf6;
    --blue: #3b82f6;
    --bg: #0f1117;
    --bg-card: #161b22;
    --bg-elevated: #1c2128;
    --bg-hover: #21262d;
    --border: #30363d;
    --border-hover: #484f58;
    --text: #c9d1d9;
    --text-bright: #f0f6fc;
    --text-dim: #8b949e;
    --text-muted: #484f58;
    --font: 'Inter', -apple-system, sans-serif;
    --mono: 'JetBrains Mono', 'Fira Code', monospace;
    --max-width: 1200px;
    --article-width: 720px;
}

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    overflow-x: hidden;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--primary); text-decoration: none; transition: color 0.2s; }
a:hover { color: var(--text-bright); }

/* ═══ ZONE 1: COMMAND BAR (56px sticky) ═══ */
nav {
    position: fixed;
    top: 0; width: 100%; z-index: 1000;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2.5rem;
    background: rgba(15, 17, 23, 0.95);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border);
}
.logo { display: flex; align-items: center; gap: 0.5rem; text-decoration: none; }
.logo-iso { width: 22px; height: 28px; flex-shrink: 0; }
.logo-text {
    font-family: Georgia, 'Source Serif Pro', serif;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-bright);
    letter-spacing: -0.02em;
}
.nav-links { display: flex; gap: 2rem; align-items: center; }
.nav-links a {
    font-family: var(--font);
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--text-dim);
    transition: color 0.2s;
}
.nav-links a:hover, .nav-links a.active { color: var(--text-bright); }
.nav-right { display: flex; align-items: center; gap: 1.2rem; }
.search-trigger {
    background: none; border: none;
    color: var(--text-dim); cursor: pointer;
    font-size: 1.1rem;
    transition: color 0.2s;
}
.search-trigger:hover { color: var(--primary); }
.btn-subscribe {
    font-family: var(--font);
    font-size: 0.78rem;
    font-weight: 600;
    padding: 0.45rem 1.2rem;
    border: none;
    border-radius: 6px;
    color: #fff;
    background: var(--primary);
    cursor: pointer;
    transition: all 0.2s;
}
.btn-subscribe:hover {
    background: #0d9668;
}

/* ═══ ZONE 2: HERO — Mapa grande + Logo centrado ═══ */
.hero {
    position: relative;
    height: 100vh;
    min-height: 550px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}
#attackMap {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    opacity: 0.85;
}
.hero-bottom-fade {
    position: absolute;
    bottom: 0; left: 0; right: 0;
    height: 120px;
    background: linear-gradient(to top, var(--bg), transparent);
    pointer-events: none;
    z-index: 2;
}
.hero-center {
    position: relative; z-index: 10;
    text-align: center;
}

/* Glitch Logo */
.logo-stage-hero {
    position: relative;
}
.logo-svg-hero {
    width: 100%;
    max-width: 750px;
    height: auto;
}
.scan-line-hero {
    position: absolute;
    left: 0; right: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, #E07020, transparent);
    z-index: 3;
    opacity: 0;
    animation: scanPassHero 7s infinite;
    pointer-events: none;
}
@keyframes scanPassHero {
    0%, 88%, 100% { top: -4px; opacity: 0; }
    91% { top: 25%; opacity: 0.5; }
    94% { top: 60%; opacity: 0.5; }
    97% { top: 100%; opacity: 0; }
}
.glitch-top-hero { animation: glitchTopH 6s infinite; }
.glitch-bot-hero { animation: glitchBotH 6s infinite; }
@keyframes glitchTopH {
    0%, 90%, 100% { transform: translate(0,0); }
    91% { transform: translate(-3px, 0); }
    92% { transform: translate(2px, -1px); }
    93% { transform: translate(-1px, 0); }
    94% { transform: translate(4px, 0); }
    95% { transform: translate(-2px, 1px); }
    96% { transform: translate(0,0); }
}
@keyframes glitchBotH {
    0%, 90%, 100% { transform: translate(0,0); }
    91% { transform: translate(3px, 1px); }
    92% { transform: translate(-2px, 0); }
    93% { transform: translate(1px, 0); }
    94% { transform: translate(-4px, 0); }
    95% { transform: translate(2px, -1px); }
    96% { transform: translate(0,0); }
}
.aberration-hero { animation: aberrationH 6s infinite; }
@keyframes aberrationH {
    0%, 90%, 100% { opacity: 0; }
    91%, 95% { opacity: 0.55; }
    96% { opacity: 0; }
}
.hero-tagline-glitch {
    font-family: var(--mono);
    font-size: 0.8rem;
    letter-spacing: 2px;
    color: rgba(255,255,255,0.6);
    margin-top: 1rem;
    animation: tagFlickerH 6s infinite;
}
.hero-tagline-glitch .slash { color: #E07020; font-weight: 500; }
.cursor-blink {
    display: inline-block;
    width: 7px; height: 12px;
    background: #E07020;
    margin-left: 6px;
    vertical-align: -1px;
    animation: cursorB 1s steps(2) infinite;
}
@keyframes cursorB { 0%, 49% { opacity: 1; } 50%, 100% { opacity: 0; } }
@keyframes tagFlickerH {
    0%, 89%, 100% { opacity: 1; }
    90% { opacity: 0.2; }
    91% { opacity: 1; }
    93% { opacity: 0.4; }
    94% { opacity: 1; }
}
.hero-stats-bar {
    display: flex;
    justify-content: center;
    gap: 2.5rem;
    margin-top: 2rem;
}
.stat-item {
    font-family: var(--mono);
    font-size: 0.68rem;
    color: var(--text-muted);
}
.stat-item::before {
    content: '● ';
    color: var(--primary);
}
.stat-item .stat-num { color: var(--text-dim); }

/* ═══ ZONE 3: BREAKING STRIP ═══ */
.breaking-bar {
    position: relative; z-index: 10;
    background: #0a120a;
    border-top: 1px solid var(--primary-dim);
    border-bottom: 1px solid var(--primary-dim);
    display: flex;
    flex-direction: column;
    align-items: center;
    overflow: hidden;
    padding: 0.5rem 0;
}
.breaking-label {
    font-family: var(--mono);
    font-size: 0.6rem;
    font-weight: 700;
    letter-spacing: 0.25em;
    text-transform: uppercase;
    color: var(--primary);
    margin-bottom: 0.4rem;
    text-align: center;
    width: 100%;
}
.breaking-track {
    display: flex;
    animation: ticker 60s linear infinite;
    padding-left: 2rem;
}
.breaking-item {
    flex-shrink: 0;
    margin-right: 3rem;
    font-size: 0.82rem;
    color: var(--text);
    white-space: nowrap;
}
.breaking-item .sev { font-family: var(--mono); font-weight: 700; font-size: 0.7rem; }
.breaking-item .sev-c { color: var(--red); }
.breaking-item .sev-h { color: var(--orange); }
.breaking-item .sev-m { color: var(--yellow); }
@keyframes ticker {
    0% { transform: translateX(0); }
    100% { transform: translateX(-50%); }
}

/* ═══ ZONE 4: PRIMARY FEED ═══ */
.section {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 4rem 2rem;
}
.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 2rem;
}
.section-label {
    font-family: var(--font);
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--text-bright);
}
.btn-outline {
    font-family: var(--font);
    font-size: 0.78rem;
    font-weight: 500;
    color: var(--text-dim);
    border: 1px solid var(--border);
    padding: 0.45rem 1rem;
    border-radius: 6px;
    transition: all 0.2s;
}
.btn-outline:hover { border-color: var(--primary); color: var(--primary); }

/* Category filters */
.filters {
    display: flex; gap: 0.6rem; margin-bottom: 2rem; flex-wrap: wrap;
}
.filter-pill {
    font-family: var(--font);
    font-size: 0.75rem;
    font-weight: 500;
    padding: 0.4rem 1rem;
    border: 1px solid var(--border);
    border-radius: 20px;
    background: transparent;
    color: var(--text-dim);
    cursor: pointer;
    transition: all 0.15s;
}
.filter-pill:hover { border-color: var(--primary-border); color: var(--primary); }
.filter-pill.active {
    background: var(--primary);
    color: #000;
    border-color: var(--primary);
    font-weight: 600;
}

/* News grid — top 3 row + rest below */
.news-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.2rem;
}
.news-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
    transition: all 0.2s;
    cursor: pointer;
    position: relative;
}
.news-card:hover {
    border-color: var(--border-hover);
    transform: translateY(-2px);
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
}
.news-card:hover .card-border-left { opacity: 1; }
.card-border-left {
    position: absolute;
    top: 0; left: 0; bottom: 0;
    width: 2px;
    background: var(--primary);
    opacity: 0;
    transition: opacity 0.2s;
}
.news-card.featured {
    grid-column: span 1;
}
.card-img {
    width: 100%; height: 180px;
    object-fit: cover;
    border-bottom: 1px solid var(--border);
    background: var(--bg-elevated);
}
.news-card.featured .card-img { height: 180px; }
.card-body { padding: 1rem 1.2rem; }
.card-meta {
    display: flex; align-items: center; gap: 0.7rem;
    margin-bottom: 0.7rem;
}
.tag {
    font-family: var(--font);
    font-size: 0.65rem;
    font-weight: 600;
    padding: 0.25rem 0.6rem;
    border-radius: 4px;
    letter-spacing: 0.02em;
}
.tag-breach { background: rgba(255,51,68,0.12); color: var(--red); }
.tag-ransomware { background: rgba(255,51,68,0.12); color: var(--red); }
.tag-zero-day { background: rgba(255,204,0,0.12); color: var(--yellow); }
.tag-apt { background: rgba(139,92,246,0.12); color: var(--purple); }
.tag-vuln { background: rgba(255,140,0,0.12); color: var(--orange); }
.tag-supply-chain { background: rgba(0,255,136,0.12); color: var(--primary); }
.tag-threat-intel { background: rgba(0,136,255,0.12); color: var(--blue); }
.tag-breaking { background: var(--red); color: #000; font-weight: 700; }

.severity-badge {
    font-family: var(--mono);
    font-size: 0.55rem;
    font-weight: 700;
    padding: 0.15rem 0.5rem;
    border-radius: 2px;
    letter-spacing: 0.05em;
}
.sev-critical { background: var(--red); color: #000; }
.sev-high { background: var(--orange); color: #000; }
.sev-medium { background: var(--yellow); color: #000; }
.sev-low { background: #333; color: #888; }

.card-date {
    font-family: var(--mono);
    font-size: 0.65rem;
    color: var(--text-muted);
}
.card-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-bright);
    line-height: 1.35;
    margin-bottom: 0.5rem;
}
.news-card.featured .card-title { font-size: 1rem; }
.card-excerpt {
    font-size: 0.82rem;
    color: var(--text-dim);
    line-height: 1.6;
    text-align: justify;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.card-footer {
    display: flex; align-items: center; justify-content: space-between;
    margin-top: 1rem;
    padding-top: 0.8rem;
    border-top: 1px solid var(--border);
}
.card-source {
    font-family: var(--mono);
    font-size: 0.6rem;
    color: var(--text-muted);
}
.card-read {
    font-family: var(--mono);
    font-size: 0.7rem;
    color: var(--primary);
}

/* Pulse dot for new articles */
.pulse-new::before {
    content: '';
    display: inline-block;
    width: 6px; height: 6px;
    border-radius: 50%;
    background: var(--primary);
    margin-right: 6px;
    animation: pulse-glow 2s ease-in-out infinite;
}
@keyframes pulse-glow {
    0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgba(0,255,136,0.4); }
    50% { opacity: 0.5; box-shadow: 0 0 0 4px transparent; }
}

/* ═══ ZONE 5: THREAT DASHBOARD ═══ */
.threat-section {
    background: var(--bg-card);
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
}
.threat-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
}
.threat-card {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 1.5rem;
    text-align: center;
}
.threat-card h4 {
    font-family: var(--mono);
    font-size: 0.6rem;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.12em;
    margin-bottom: 0.8rem;
}
.threat-value {
    font-family: var(--mono);
    font-size: 2rem;
    font-weight: 800;
    line-height: 1;
}
.threat-value.t-critical { color: var(--red); }
.threat-value.t-high { color: var(--orange); }
.threat-value.t-medium { color: var(--yellow); }
.threat-value.t-info { color: var(--primary); }
.threat-sub {
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-top: 0.5rem;
}

/* ═══ SEARCH OVERLAY ═══ */
.search-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    z-index: 2000;
    background: rgba(5,5,8,0.97);
    display: none;
    flex-direction: column;
    align-items: center;
    padding: 120px 2rem 2rem;
    opacity: 0;
    transition: opacity 0.2s;
}
.search-overlay.active { display: flex; opacity: 1; }
.search-input-wrap { width: 100%; max-width: 700px; }
.search-input {
    width: 100%;
    background: transparent;
    border: none;
    border-bottom: 1px solid var(--primary);
    font-family: var(--mono);
    font-size: 1.5rem;
    color: var(--text-bright);
    padding: 1rem 0;
    outline: none;
    caret-color: var(--primary);
}
.search-input::placeholder { color: var(--text-muted); }
.search-close {
    position: absolute;
    top: 1.5rem; right: 2rem;
    background: none; border: none;
    color: var(--text-dim); font-size: 1.5rem;
    cursor: pointer;
}
.search-close:hover { color: var(--primary); }
.search-results {
    width: 100%; max-width: 700px;
    margin-top: 2rem;
}
.search-result-item {
    padding: 1rem 0;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    transition: padding-left 0.2s;
}
.search-result-item:hover { padding-left: 0.5rem; }
.search-result-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-bright);
    margin-bottom: 0.3rem;
}
.search-result-meta {
    font-family: var(--mono);
    font-size: 0.65rem;
    color: var(--text-muted);
}

/* ═══ POST PAGE ═══ */
.post-container {
    max-width: var(--article-width);
    margin: 0 auto;
    padding: 6rem 2rem 4rem;
}
.post-hero-img {
    width: calc(100% + 4rem);
    margin-left: -2rem;
    height: 380px;
    object-fit: cover;
    border-radius: 4px;
    margin-bottom: 2rem;
    border: 1px solid var(--border);
}
.post-meta {
    display: flex; align-items: center; gap: 1rem;
    margin-bottom: 1.5rem; flex-wrap: wrap;
}
.post-title {
    font-size: 2rem;
    font-weight: 800;
    line-height: 1.2;
    color: var(--text-bright);
    margin-bottom: 1.5rem;
    letter-spacing: -0.02em;
}
.post-content { font-size: 1.05rem; line-height: 1.8; color: var(--text); text-align: justify; }
.post-content p { margin-bottom: 1.2rem; }
.post-content h2 {
    font-size: 1.3rem;
    color: var(--text-bright);
    margin: 2.5rem 0 1rem;
    padding-left: 1rem;
    border-left: 3px solid var(--primary);
}
.post-content code {
    font-family: var(--mono);
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    padding: 0.15rem 0.4rem;
    border-radius: 2px;
    font-size: 0.85rem;
    color: var(--primary);
}
.post-content blockquote {
    border-left: 3px solid var(--border);
    margin: 1.5rem 0;
    padding-left: 1.5rem;
    color: var(--text-dim);
    font-style: italic;
}
.post-content ul, .post-content ol {
    margin: 1rem 0 1rem 1.5rem;
}
.post-content li { margin-bottom: 0.5rem; }

/* Reading progress bar */
.reading-progress {
    position: fixed;
    top: 48px; left: 0;
    height: 2px;
    background: var(--primary);
    width: 0%;
    z-index: 100;
    transition: width 0.1s linear;
}

/* ═══ ARCHIVE ═══ */
.archive-list { display: flex; flex-direction: column; gap: 0.8rem; }
.archive-item {
    display: grid;
    grid-template-columns: 140px 1fr auto;
    gap: 1.5rem;
    align-items: center;
    padding: 1rem 1.2rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 4px;
    transition: all 0.2s;
    text-decoration: none;
    color: inherit;
}
.archive-item:hover {
    border-color: var(--primary-border);
    background: var(--bg-elevated);
    transform: translateX(4px);
}
.archive-item img {
    width: 140px; height: 80px;
    object-fit: cover; border-radius: 3px;
}
.archive-title {
    font-size: 0.92rem;
    font-weight: 600;
    color: var(--text-bright);
    line-height: 1.3;
    margin-bottom: 0.3rem;
}
.archive-meta {
    font-family: var(--mono);
    font-size: 0.6rem;
    color: var(--text-muted);
}

/* ═══ FOOTER ═══ */
footer {
    border-top: 1px solid var(--border);
    padding: 3rem 2rem;
    text-align: center;
}
.footer-logo {
    font-family: var(--font);
    font-size: 1rem;
    font-weight: 800;
    color: var(--text-bright);
    margin-bottom: 0.5rem;
}
.footer-logo span { color: var(--primary); }
.footer-text { font-size: 0.72rem; color: var(--text-muted); }

/* ═══ RESPONSIVE ═══ */
/* ═══ Reportes grid ═══ */
.reportes-grid {
    max-width: var(--max-width);
    margin: 0 auto;
    display: grid;
    grid-template-columns: 1.2fr 0.8fr;
    gap: 3rem;
    align-items: center;
}

/* ═══ RESPONSIVE — Tablet ═══ */
@media (max-width: 1024px) {
    .news-grid { grid-template-columns: 1fr 1fr; }
    .news-card.featured { grid-column: span 1; }
    .threat-grid { grid-template-columns: 1fr 1fr; }
}

/* ═══ RESPONSIVE — Mobile (iPhone, Android) ═══ */
@media (max-width: 768px) {
    /* Navigation */
    nav {
        flex-wrap: wrap;
        height: auto;
        padding: 0.6rem 1rem;
        gap: 0.4rem;
    }
    .nav-links {
        order: 3;
        width: 100%;
        overflow-x: auto;
        gap: 1rem;
        padding: 0.3rem 0;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }
    .nav-links::-webkit-scrollbar { display: none; }
    .nav-links a { white-space: nowrap; font-size: 0.75rem; }
    .nav-right { margin-left: auto; }

    /* Hero */
    .hero { height: 55vh; min-height: 320px; }
    .logo-svg-hero { max-width: 280px !important; }
    .hero-tagline-glitch { font-size: 0.6rem !important; letter-spacing: 1px !important; }
    .hero-stats-bar { flex-direction: column; gap: 0.4rem; align-items: center; margin-top: 1.2rem !important; }
    .stat-item { font-size: 0.6rem; }

    /* Sections */
    .section { padding: 2.5rem 1rem; }
    .section-label { font-size: 0.8rem; }

    /* News Grid — single column */
    .news-grid { grid-template-columns: 1fr; gap: 1rem; }
    .news-card.featured { grid-column: span 1; }
    .card-img { height: 180px; }
    .news-card.featured .card-img { height: 180px; }
    .card-body { padding: 1rem; }
    .card-title { font-size: 0.95rem; }
    .card-excerpt { font-size: 0.8rem; -webkit-line-clamp: 3; }

    /* Filters */
    .filters { gap: 0.4rem; overflow-x: auto; flex-wrap: nowrap; padding-bottom: 0.5rem; -webkit-overflow-scrolling: touch; }
    .filters::-webkit-scrollbar { display: none; }
    .filter-pill { padding: 0.35rem 0.8rem; font-size: 0.7rem; flex-shrink: 0; }

    /* Breaking bar */
    .breaking-label { font-size: 0.5rem; }
    .breaking-item { font-size: 0.65rem; margin-right: 2rem; }

    /* Terminal */
    #terminalFeed { font-size: 0.6rem !important; height: 180px !important; padding: 0.8rem 1rem !important; }

    /* Threat grid */
    .threat-grid { grid-template-columns: 1fr 1fr; }

    /* Archive items */
    .archive-item { grid-template-columns: 1fr; gap: 0.8rem; padding: 1rem; }
    .archive-item img { width: 100%; height: 150px; border-radius: 4px; }

    /* About — stack mission/vision */
    #nosotros > div > div:first-of-type { grid-template-columns: 1fr !important; }
    /* Founder card — stack */
    #nosotros > div > div:last-of-type { flex-direction: column !important; text-align: center !important; }

    /* Report section */
    .reportes-grid { grid-template-columns: 1fr !important; gap: 1.5rem !important; }
    #reportes { padding: 2rem 1rem !important; }

    /* Footer */
    footer > div:first-child { grid-template-columns: 1fr !important; gap: 1.5rem !important; text-align: center !important; }

    /* Post page */
    .post-container { padding: 5rem 1rem 2rem; }
    .post-hero-img { width: 100% !important; margin-left: 0 !important; height: 200px; border-radius: 6px; }
    .post-title { font-size: 1.4rem; }
    .post-content { font-size: 0.95rem; }
    .post-meta { flex-wrap: wrap; gap: 0.5rem; }

    /* Newsletter CTA */
    #newsletter > div > div:last-child { flex-direction: column !important; }
    #newsletter input { width: 100% !important; }
}

/* ═══ RESPONSIVE — Small phones ═══ */
@media (max-width: 400px) {
    .hero { height: 45vh; min-height: 280px; }
    .logo-svg-hero { max-width: 220px !important; }
    .card-img { height: 150px; }
    .section { padding: 2rem 0.8rem; }
    nav { padding: 0.5rem 0.8rem; }
    .logo-iso { width: 18px; height: 24px; }
}
