/* =========================================================
   GSN CORE STYLESHEET
   Master styles for The Global Shift Network & Sub-Nodes
   ========================================================= */

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

/* Prevents horizontal overflow */

:root {
    --bg: #0f172a;
    --card: #1e293b;
    --card-hover: #334155;
    --text-main: #f8fafc;
    --text-sub: #94a3b8;
    --border: #334155;
    --accent: #0ea5e9;
    --accent-glow: rgba(14, 165, 233, 0.15);
    --danger: #ef4444;
    --danger-glow: rgba(239, 68, 68, 0.3);
    --warning: #f59e0b;
    --safe: #10b981;
}

body {
    background-color: var(--bg);
    background-image: radial-gradient(var(--border) 1px, transparent 1px);
    background-size: 24px 24px;
    color: var(--text-main);
    font-family: 'Inter', sans-serif;
    margin: 0;
    padding-bottom: 40px;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    line-height: 1.6;
    overflow-x: hidden;
    /* Stops mobile horizontal wobble */
}

/* --- 1. HEADERS & NAVIGATION --- */
.gsn-universal-header {
    background-color: #050505;
    color: #94a3b8;
    font-family: 'Inter', sans-serif;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    padding: 10px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #1e293b;
    z-index: 50;
    position: relative;
    width: 100%;
}

.gsn-brand {
    color: #f8fafc;
    font-weight: 700;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
    margin-right: 20px;
}

.gsn-header-img {
    height: 22px;
    width: auto;
}

.gsn-network-links {
    display: flex;
    gap: 15px;
    overflow-x: auto;
    white-space: nowrap;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding-bottom: 2px;
}

.gsn-network-links::-webkit-scrollbar {
    display: none;
}

.gsn-link {
    color: #94a3b8;
    text-decoration: none;
    transition: color 0.2s ease;
    font-weight: 500;
}

.gsn-link:hover,
.gsn-link.active {
    color: var(--accent);
}

.navbar {
    background: rgba(15, 23, 42, 0.8);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    min-height: 65px;
    display: flex;
    align-items: center;
    margin-bottom: 30px;
    position: sticky;
    top: 0;
    z-index: 40;
    width: 100%;
}

.nav-inner {
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
    padding: 10px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.brand {
    font-weight: 800;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-main);
    text-decoration: none;
    letter-spacing: -0.5px;
    flex-shrink: 0;
}

.brand-img {
    max-height: 32px;
    width: auto;
    filter: drop-shadow(0 0 8px var(--accent-glow));
}

.nav-links {
    display: flex;
    gap: 15px;
    align-items: center;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.nav-links a {
    color: var(--text-sub);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 600;
    transition: color 0.2s;
    white-space: nowrap;
}

.nav-links a:hover {
    color: var(--text-main);
}

.twitter-btn {
    background: #1da1f2;
    color: #fff !important;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.8rem !important;
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: 700 !important;
    border: none;
    transition: opacity 0.2s;
    text-decoration: none;
}


.container {
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
    padding: 0 20px;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.span-full {
    grid-column: 1 / -1;
}

.span-2 {
    grid-column: span 2;
}

.span-1 {
    grid-column: span 1;
}

.war-room-grid {
    display: grid;
    grid-template-columns: 1fr 2fr 1fr;
    gap: 20px;
    margin-bottom: 40px;
    grid-column: 1 / -1;
}

.metrics-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
}

.side-col {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.nexus-center {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* --- 3. CARDS & PANELS --- */
.card,
.metric-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 20px;
}

.metric-card {
    text-decoration: none;
    color: inherit;
    display: flex;
    flex-direction: column;
    transition: transform 0.2s, border-color 0.2s;
    position: relative;
    overflow: hidden;
}

.metric-card:hover {
    transform: translateY(-3px);
    border-color: #475569;
    background: var(--card-hover);
}

/* Flashing Animation for Critical Metrics */
@keyframes critical-pulse {
    0% {
        box-shadow: 0 0 5px rgba(239, 68, 68, 0.4);
        border-color: var(--danger);
    }

    50% {
        box-shadow: 0 0 25px rgba(239, 68, 68, 0.8), inset 0 0 10px rgba(239, 68, 68, 0.2);
        border-color: #ff7b7b;
    }

    100% {
        box-shadow: 0 0 5px rgba(239, 68, 68, 0.4);
        border-color: var(--danger);
    }
}

.metric-card.critical,
.alert-bar {
    animation: critical-pulse 2s infinite;
    border-color: var(--danger);
}

.metric-card.warning {
    border-color: var(--warning);
}

.card-header,
.metric-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 10px;
}

.card-title,
.metric-title {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text-sub);
    text-transform: uppercase;
    letter-spacing: 1px;
    font-family: 'JetBrains Mono', monospace;
}

.status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--text-sub);
}

.critical .status-dot {
    background: var(--danger);
}

.card-value-wrap {
    display: flex;
    align-items: baseline;
    gap: 8px;
    margin-bottom: 10px;
}

.card-value,
.metric-score,
.data-readout {
    font-family: 'JetBrains Mono', monospace;
    font-size: 2.5rem;
    font-weight: 800;
    line-height: 1;
    color: var(--text-main);
}

.critical .card-value {
    color: var(--danger);
    text-shadow: 0 0 10px var(--danger-glow);
}

.data-readout {
    font-size: 5.5rem;
    color: var(--accent);
    text-shadow: 0 0 20px var(--accent-glow);
    margin: 15px 0;
}

.card-unit {
    font-size: 0.85rem;
    color: var(--text-sub);
    font-weight: 600;
    text-transform: uppercase;
}

.card-footer {
    font-size: 0.75rem;
    color: var(--text-sub);
    border-top: 1px solid var(--border);
    padding-top: 10px;
    margin-top: auto;
    font-family: 'JetBrains Mono', monospace;
}

/* Sub-Card Visual Elements */
.bar-bg {
    height: 8px;
    background: #0f172a;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 20px;
    border: 1px solid var(--border);
}

.bar-fill {
    height: 100%;
    background: var(--accent);
    box-shadow: 0 0 10px var(--accent-glow);
    transition: width 1s ease;
}

.bar-fill.warning {
    background: var(--warning);
    box-shadow: 0 0 10px rgba(245, 158, 11, 0.5);
}

.metric-explanation {
    font-size: 0.95rem;
    color: #cbd5e1;
    line-height: 1.6;
    flex: 1;
}

.metric-explanation strong {
    color: var(--text-main);
    display: block;
    margin-bottom: 5px;
    font-size: 1rem;
}

.metric-technical {
    font-size: 0.75rem;
    color: var(--text-sub);
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px dashed var(--border);
    font-family: 'JetBrains Mono', monospace;
    text-transform: uppercase;
}

/* --- 4. RESTORED TAIWAN TRACKER LAYOUT --- */
.hero-card {
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(145deg, #1e293b 0%, #0f172a 100%);
}

.score-left {
    flex: 1;
}

.score-right {
    width: 220px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.metric-label {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.8rem;
    color: var(--accent);
    text-transform: uppercase;
    margin-bottom: 5px;
    display: block;
}

.big-number {
    font-family: 'JetBrains Mono', monospace;
    font-size: 4.5rem;
    font-weight: 800;
    line-height: 1;
    margin: 10px 0;
    color: var(--text-main);
}

.trend-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    margin-bottom: 15px;
    font-family: 'JetBrains Mono', monospace;
}

.status-text {
    font-size: 1.05rem;
    line-height: 1.5;
    color: #cbd5e1;
    margin: 0;
}

.metrics-tower {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.small-metric-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 18px;
    display: flex;
    flex-direction: column;
    text-decoration: none;
    color: inherit;
}

.sm-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.sm-score {
    font-family: 'JetBrains Mono', monospace;
    font-size: 1.5rem;
    font-weight: 800;
}

.sm-bar-bg {
    height: 6px;
    background: #0f172a;
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 15px;
    border: 1px solid var(--border);
}

.evidence-box {
    font-size: 0.85rem;
    color: #cbd5e1;
    line-height: 1.5;
    background: rgba(15, 23, 42, 0.5);
    padding: 12px;
    border-radius: 6px;
    border-left: 2px solid var(--border);
}

.chart-box {
    height: 280px;
    width: 100%;
    position: relative;
}

/* Carousel */
.carousel-container {
    display: flex;
    flex-direction: column;
    height: 100%;
    justify-content: space-between;
}

.carousel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.carousel-dots {
    display: flex;
    gap: 6px;
}

.c-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--border);
    cursor: pointer;
    transition: background 0.3s;
}

.c-dot.active {
    background: var(--accent);
}

.featured-thumb {
    border-radius: 8px;
    object-fit: cover;
    border: 1px solid var(--border);
    margin-bottom: 15px;
}

.featured-content {
    flex: 1;
    display: flex;
    flex-direction: column;
}

/* --- 5. ALERTS & UI ELEMENTS --- */
#triage-banner,
.alert-bar {
    background: linear-gradient(90deg, rgba(239, 68, 68, 0.1) 0%, var(--bg) 100%);
    border-left: 4px solid var(--danger);
    border-radius: 4px;
    padding: 15px 25px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    text-decoration: none;
    cursor: pointer;
}

.alert-text {
    font-weight: 600;
    font-size: 1.05rem;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 15px;
}

.alert-btn {
    background: var(--danger);
    color: #fff;
    padding: 8px 20px;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 800;
    text-decoration: none;
    border: none;
    text-align: center;
    white-space: nowrap;
}

.radar-box {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 20px;
    position: relative;
    height: 380px;
    display: flex;
    flex-direction: column;
    box-shadow: inset 0 0 40px rgba(0, 0, 0, 0.5);
}

.live-feed {
    background: rgba(15, 23, 42, 0.8);
    border: 1px solid var(--border);
    border-left: 3px solid var(--accent);
    padding: 12px 15px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.8rem;
    border-radius: 6px;
}

.terminal-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: 20px;
    border-bottom: 1px solid var(--border);
    padding-bottom: 10px;
    grid-column: 1 / -1;
    width: 100%;
}

.terminal-header h1 {
    margin: 0;
    font-size: 1.5rem;
    letter-spacing: -0.5px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.terminal-header h1::before {
    content: '';
    display: inline-block;
    width: 10px;
    height: 10px;
    background: var(--accent);
    border-radius: 50%;
    box-shadow: 0 0 10px var(--accent);
}

/* --- 6. ARTICLES WITH IMAGES --- */
.section-header {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-main);
    margin: 0 0 20px 0;
    border-bottom: 1px solid var(--border);
    padding-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.section-header::before {
    content: '';
    display: inline-block;
    width: 8px;
    height: 8px;
    background: var(--accent);
    border-radius: 50%;
}

.analysis-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    grid-column: 1 / -1;
}

.analysis-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 12px;
    text-decoration: none;
    transition: transform 0.2s, border-color 0.2s;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding: 0;
}

.analysis-card:hover {
    transform: translateY(-4px);
    border-color: var(--accent);
}

.card-img {
    width: 100%;
    height: 160px;
    object-fit: cover;
    border-bottom: 1px solid var(--border);
}

.card-content {
    padding: 20px;
    display: flex;
    flex-direction: column;
    flex: 1;
}

.featured-tag {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.7rem;
    color: var(--accent);
    font-weight: 700;
    text-transform: uppercase;
    margin-bottom: 8px;
    display: block;
    letter-spacing: 0.5px;
}

.analysis-card h4 {
    color: var(--text-main);
    margin: 0 0 10px 0;
    font-size: 1.05rem;
    line-height: 1.4;
}

.analysis-card p {
    color: var(--text-sub);
    font-size: 0.85rem;
    margin: 0;
    line-height: 1.5;
    flex-grow: 1;
}

.archive-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.archive-list li {
    border-bottom: 1px dashed var(--border);
    padding: 12px 0;
}

.archive-list li:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.archive-list a {
    color: var(--text-sub);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9rem;
    transition: color 0.2s;
    display: block;
}

.archive-list a:hover {
    color: var(--accent);
    padding-left: 5px;
}

.site-footer {
    max-width: 1200px;
    margin: auto auto 0 auto;
    padding: 20px;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.85rem;
    color: var(--text-sub);
    width: 100%;
    box-sizing: border-box;
}

.footer-links {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    justify-content: center;
}

.footer-links a {
    color: var(--text-sub);
    text-decoration: none;
    transition: color 0.2s;
}

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

/* --- MOBILE RESPONSIVENESS --- */
@media (max-width: 950px) {

    /* Navbar Wrapping */
    .gsn-universal-header {
        flex-direction: column;
        align-items: flex-start;
        padding: 12px 20px;
    }

    .gsn-brand {
        margin-bottom: 10px;
        width: 100%;
    }

    .gsn-network-links {
        width: 100%;
        padding-bottom: 8px;
    }

    .nav-inner {
        flex-direction: column;
        align-items: stretch;
        gap: 15px;
        padding: 15px 20px;
    }

    .brand {
        justify-content: center;
    }

    .nav-links {
        justify-content: center;
    }

    /* Layout Stacking */
    .container {
        grid-template-columns: 1fr;
    }

    .span-2,
    .span-1 {
        grid-column: 1 / -1;
    }

    /* Order Manipulation: Radar goes to the Top */
    .war-room-grid {
        display: flex;
        flex-direction: column;
    }

    .nexus-center {
        order: -1;
    }

    /* Triage Resizing */
    .hero-card {
        flex-direction: column;
        text-align: center;
    }

    .score-right {
        margin-top: 20px;
    }

    #triage-banner,
    .alert-bar {
        flex-direction: column;
        text-align: center;
        gap: 15px;
    }

    /* --- 7. GLOBAL LINK OVERRIDES (Killing Default Blue/Purple) --- */
    a {
        color: inherit;
        text-decoration: none;
    }

    /* Specific Carousel Fixes */
    #featured-container {
        text-decoration: none;
        color: var(--text-main);
        display: flex;
        transition: opacity 0.2s;
    }

    #featured-container:hover {
        opacity: 0.8;
    }

    #feat-title {
        color: var(--text-main);
        transition: color 0.2s;
    }

    #featured-container:hover #feat-title {
        color: var(--accent);
    }

    .archive-list a {
        color: var(--text-sub);
    }

    .archive-list a:hover {
        color: var(--accent);
    }

    /* --- 8. ARTICLE TEXT FORMATTING --- */
    /* Formats the raw text in your 50+ articles without breaking the dashboards */
    .container>p,
    .container>h1,
    .container>h2,
    .container>h3,
    .container>h4,
    .container>ul,
    .container>li,
    .container>.disclaimer-box {
        max-width: 800px;
        margin-left: auto;
        margin-right: auto;
        width: 100%;
    }

    .container>p,
    .container>ul {
        font-size: 1.15rem;
        line-height: 1.8;
        color: #cbd5e1;
        margin-bottom: 24px;
    }

    .container>h1 {
        text-align: center;
        font-size: 2.5rem;
        line-height: 1.2;
        color: var(--text-main);
        letter-spacing: -0.5px;
        margin-bottom: 30px;
        margin-top: 20px;
    }

    .container>h2 {
        color: var(--accent);
        margin-top: 40px;
        border-bottom: 1px solid var(--border);
        padding-bottom: 10px;
    }

    .container>img {
        max-width: 900px;
        width: 100%;
        height: auto;
        margin: 40px auto;
        border-radius: 8px;
        border: 1px solid var(--border);
        display: block;
    }

    /* --- 9. DAILY BRIEFING REPORT STYLES --- */
    .breadcrumb {
        font-family: 'JetBrains Mono', monospace;
        font-size: 0.85rem;
        color: var(--text-sub);
        margin-bottom: 20px;
    }

    .breadcrumb a {
        color: var(--accent);
        text-decoration: none;
    }

    .breadcrumb a:hover {
        text-decoration: underline;
    }

    .page-header {
        margin-bottom: 30px;
    }

    .page-header h1 {
        font-size: 2.2rem;
        color: var(--text-main);
        margin-bottom: 10px;
        letter-spacing: -0.5px;
    }

    .exec-summary {
        padding: 30px;
        background: var(--card);
        border: 1px solid var(--border);
        border-radius: 12px;
        margin-bottom: 24px;
    }

    .exec-title {
        font-family: 'JetBrains Mono', monospace;
        font-size: 0.9rem;
        text-transform: uppercase;
        color: var(--text-sub);
        display: block;
        margin-bottom: 15px;
        font-weight: 700;
        letter-spacing: 1px;
    }

    .big-score {
        font-family: 'JetBrains Mono', monospace;
        font-size: 4.5rem;
        font-weight: 800;
        line-height: 1;
        margin-bottom: 15px;
    }

    .grid-2 {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 24px;
        margin-bottom: 24px;
    }

    .metric-box {
        background: var(--card);
        border: 1px solid var(--border);
        border-radius: 12px;
        padding: 25px;
        display: flex;
        flex-direction: column;
    }

    .metric-box .val {
        font-family: 'JetBrains Mono', monospace;
        font-size: 3rem;
        font-weight: 800;
        color: var(--text-main);
        line-height: 1;
        margin-bottom: 10px;
    }

    .metric-box .desc {
        color: var(--text-sub);
        font-size: 0.95rem;
        line-height: 1.5;
    }

    .source-list {
        list-style: none;
        padding: 0;
        margin: 0;
    }

    .source-list li {
        padding: 15px;
        border-bottom: 1px dashed var(--border);
        color: #cbd5e1;
        font-size: 0.95rem;
        line-height: 1.6;
    }

    .source-list li:last-child {
        border-bottom: none;
    }

    .source-list li::before {
        content: "»";
        color: var(--accent);
        margin-right: 10px;
        font-family: 'JetBrains Mono', monospace;
        font-weight: bold;
    }

    @media (max-width: 768px) {
        .grid-2 {
            grid-template-columns: 1fr;
        }
    }

}