:root {
    --primary-navy: #22304E;
    /* Sampled Dark Blue */
    --accent-red: #e63946;
    --text-dark: #f4f4f4;
    /* Switched to light for dark mode */
    --text-light: #ccc;
    --bg-dark: #22304E;
    --card-bg: #2c3e50;

    /* Matrix Palette - Vivid & Dark */
    --matrix-bg: #1a253a;
    --hot-high: #ff4757;
    --hot-mid: #ff6b81;
    --cold: #2ed573;
    --frozen: #70a1ff;
    --divider: #57606f;
}

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

body {
    font-family: 'Inter', sans-serif;
    color: var(--text-dark);
    background-color: var(--bg-dark);
    line-height: 1.6;
}

h1,
h2,
h3,
h4 {
    font-family: 'Merriweather', serif;
    color: white;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Intro / Hero */
.intro-section {
    text-align: center;
    padding: 60px 0 40px;
    background: transparent;
}

.page-title {
    font-size: 3rem;
    margin-bottom: 10px;
    color: white;
}

.lead {
    font-size: 1.2rem;
    margin-bottom: 20px;
    color: white;
}

.sr-link {
    color: white;
    text-decoration: none;
    font-weight: bold;
    border-bottom: 1px solid transparent;
    transition: border-color 0.2s;
}

.sr-link:hover {
    border-color: white;
}

.sub-lead {
    font-size: 0.9rem;
    max-width: 800px;
    margin: 0 auto;
    color: rgba(255, 255, 255, 0.6);
    font-style: italic;
}

/* Theory Section */
.theory-section {
    padding: 40px 0;
    background-color: transparent;
}

.theory-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 60px;
}

.theory-column h3 {
    margin-bottom: 30px;
    font-size: 1.8rem;
    border-bottom: 3px solid var(--accent-red);
    padding-bottom: 10px;
    display: inline-block;
}

.card-stack {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.card {
    background: var(--card-bg);
    padding: 25px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    transition: transform 0.2s, box-shadow 0.2s;
}

.card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
}

.card h4 {
    margin-bottom: 10px;
    font-size: 1.2rem;
    color: var(--accent-red);
}

.card p {
    color: #ddd;
}

/* Framework Matrix - The Centerpiece */
.framework-section {
    background-color: rgba(0, 0, 0, 0.2);
    padding: 80px 0;
    color: white;
}

.framework-section h3 {
    color: white;
    text-align: center;
    font-size: 2.2rem;
    margin-bottom: 10px;
}

.framework-section p {
    text-align: center;
    max-width: 700px;
    margin: 0 auto 50px;
    color: rgba(255, 255, 255, 0.7);
}

.matrix-container {
    background: var(--matrix-bg);
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3);
}

.matrix-header {
    font-family: 'Merriweather', serif;
    font-size: 1.8rem;
    margin-bottom: 30px;
    text-align: left;
    border-left: 5px solid var(--accent-red);
    padding-left: 20px;
}

.matrix-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 15px;
}

.matrix-cell {
    padding: 25px 15px;
    min-height: 140px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    position: relative;
    overflow: hidden;
}

.matrix-cell::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0));
    opacity: 0;
    transition: opacity 0.3s;
}

.matrix-cell:hover {
    transform: translateY(-5px) scale(1.02);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
    z-index: 2;
}

.matrix-cell:hover::before {
    opacity: 1;
}

.cell-title {
    font-weight: 700;
    font-size: 1.2rem;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.cell-desc {
    font-size: 0.85rem;
    opacity: 0.9;
    font-weight: 300;
    margin-bottom: 5px;
}

.cell-example {
    font-size: 0.8rem;
    font-style: italic;
    opacity: 0.8;
    margin-top: 5px;
    line-height: 1.3;
    border-top: 1px solid rgba(255, 255, 255, 0.3);
    padding-top: 5px;
    width: 100%;
}

/* Matrix Colors & Gradients */
.hot-high {
    background: linear-gradient(135deg, var(--hot-high), #d63031);
    color: white;
}

.hot-mid {
    background: linear-gradient(135deg, var(--hot-mid), #ff4757);
    color: white;
}

.cold {
    background: linear-gradient(135deg, #7f8c8d, #95a5a6);
    color: white;
}

.frozen {
    background: linear-gradient(135deg, var(--frozen), #1e90ff);
    color: white;
    grid-column: 4;
}

/* Positioning */
.matrix-cell[data-type="Global War"] {
    grid-column: 4;
    grid-row: 1;
}

.matrix-cell[data-type="Continental War"] {
    grid-column: 4;
    grid-row: 2;
}

.matrix-cell[data-type="Strategic Terrorism"] {
    grid-column: 1;
    grid-row: 3;
}

.matrix-cell[data-type="Genocide"] {
    grid-column: 2;
    grid-row: 3;
}

.matrix-cell[data-type="Internal War"] {
    grid-column: 3;
    grid-row: 3;
}

.matrix-cell[data-type="Interstate War"] {
    grid-column: 4;
    grid-row: 3;
}

/* Dividers */
.matrix-divider {
    grid-column: 1 / -1;
    background-color: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.6);
    text-align: center;
    padding: 8px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 2px;
    font-size: 0.8rem;
    border-radius: 4px;
    margin: 5px 0;
}

.divider-complex {
    grid-row: 4;
    grid-column: 1 / 3;
}

.divider-armed {
    grid-row: 4;
    grid-column: 3 / 5;
}

/* Row 3 (Cold) */
.matrix-cell[data-type="Cultural Conflict"] {
    grid-column: 1;
    grid-row: 5;
}

.matrix-cell[data-type="Economical Conflict"] {
    grid-column: 2;
    grid-row: 5;
}

.matrix-cell[data-type="Technological Conflict"] {
    grid-column: 3;
    grid-row: 5;
}

.matrix-cell[data-type="Geopolitical Conflict"] {
    grid-column: 4;
    grid-row: 5;
}

/* Frozen */
.matrix-cell[data-type="Frozen Conflict"] {
    grid-row: 6;
}


/* Data Section */
.data-section {
    padding: 60px 0;
    background-color: transparent;
}

.data-section h3 {
    margin-bottom: 30px;
    font-size: 2rem;
}

.filters {
    margin-bottom: 30px;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.filter-btn {
    padding: 10px 20px;
    border: 2px solid rgba(255, 255, 255, 0.2);
    background: transparent;
    color: white;
    cursor: pointer;
    font-family: 'Inter', sans-serif;
    font-weight: 600;
    border-radius: 30px;
    transition: all 0.2s;
}

.filter-btn:hover,
.filter-btn.active {
    background: white;
    color: var(--primary-navy);
    box-shadow: 0 0 15px rgba(255, 255, 255, 0.2);
}

.conflict-list {
    display: grid;
    gap: 15px;
}

.conflict-item {
    background: var(--card-bg);
    padding: 20px 30px;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: transform 0.2s;
    border-left: 4px solid transparent;
    color: white;
}

.conflict-item:hover {
    transform: translateX(5px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

/* Dynamic border colors based on type could be added via JS, 
   but for now let's just use a default or CSS classes if we had them on items */
.conflict-item {
    border-left-color: var(--accent-red);
}

.conflict-info h4 {
    font-size: 1.3rem;
    margin-bottom: 8px;
    color: white;
}

.conflict-meta {
    font-size: 0.95rem;
    color: #aaa;
    display: flex;
    gap: 15px;
}

.conflict-meta span {
    position: relative;
}

.conflict-meta span:not(:last-child)::after {
    content: '•';
    position: absolute;
    right: -10px;
    color: #666;
}

.definitions-box {
    background: var(--card-bg);
    padding: 25px;
    border-radius: 8px;
    border-left: 4px solid var(--accent-red);
    margin-bottom: 30px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    color: #ddd;
}

.definitions-box strong {
    color: white;
}

.definitions-box ul {
    margin: 15px 0 15px 20px;
}

.definitions-box li {
    margin-bottom: 5px;
}

.definitions-box .note,
.definitions-box .historical-note {
    font-size: 0.9rem;
    color: #aaa;
    margin-top: 10px;
}

.legend {
    margin-top: 15px;
    padding: 10px;
    background: rgba(230, 57, 70, 0.1);
    border-radius: 4px;
    color: #ffadad;
}

.historical-note {
    font-style: italic;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding-top: 10px;
}

.conflict-item {
    flex-direction: column;
    /* Stack info and pictograms */
    align-items: flex-start;
}

.conflict-header {
    display: flex;
    justify-content: space-between;
    width: 100%;
    align-items: flex-start;
    margin-bottom: 15px;
}

.conflict-visuals {
    width: 100%;
    display: flex;
    flex-wrap: wrap;
    gap: 2px;
    padding-top: 10px;
    border-top: 1px dashed rgba(255, 255, 255, 0.1);
}

.casualty-icon {
    width: 8px;
    height: 12px;
    background-color: var(--accent-red);
    opacity: 0.8;
    border-radius: 2px;
    /* Simple person shape via clip-path or just a rect for performance with many items */
    clip-path: polygon(20% 0%, 80% 0%, 100% 100%, 0% 100%);
}

.casualty-icon:hover {
    opacity: 1;
    transform: scale(1.5);
}

.casualty-count-text {
    font-size: 0.85rem;
    color: #aaa;
    margin-top: 5px;
    width: 100%;
}

/* Total Casualties Section */
.total-casualties-container {
    margin-top: 60px;
    background: var(--matrix-bg);
    padding: 40px;
    border-radius: 16px;
    border: 2px solid var(--accent-red);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
    text-align: center;
    position: relative;
    overflow: hidden;
}

.total-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 30px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 20px;
}

.total-header h3 {
    font-size: 2rem;
    color: white;
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 2px;
}

.total-number {
    font-size: 4rem;
    font-weight: 900;
    color: var(--accent-red);
    font-family: 'Merriweather', serif;
    text-shadow: 0 0 20px rgba(230, 57, 70, 0.3);
}

.total-visuals {
    display: flex;
    flex-wrap: wrap;
    gap: 2px;
    justify-content: center;
}

.total-visuals .casualty-icon {
    width: 6px;
    height: 10px;
    opacity: 0.8;
    background-color: var(--accent-red);
}

.author-credit {
    font-size: 0.9rem;
    color: white;
    margin-top: 5px;
    font-weight: 500;
    letter-spacing: 0.5px;
}

/* Paths to Peace Styling (Green) */
.theory-column:last-child h3 {
    border-bottom-color: var(--cold);
}

.theory-column:last-child .card h4 {
    color: var(--cold);
}

.footer-btn {
    display: inline-block;
    padding: 12px 30px;
    background-color: var(--accent-red);
    color: white;
    text-decoration: none;
    font-weight: bold;
    border-radius: 4px;
    margin-bottom: 30px;
    transition: background-color 0.2s;
}

.footer-btn:hover {
    background-color: #c92a37;
}

.footer-note {
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.4);
    max-width: 800px;
    margin: 0 auto;
    font-style: italic;
    line-height: 1.5;
}

footer {
    background-color: rgba(0, 0, 0, 0.3);
    color: #aaa;
    text-align: center;
    padding: 40px 0;
    font-size: 0.9rem;
    margin-top: 40px;
    opacity: 0.9;
}

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

    .matrix-grid {
        grid-template-columns: 1fr 1fr;
        gap: 10px;
    }

    /* Re-layout for mobile matrix if needed, or keep grid but stack */
    .matrix-cell {
        grid-column: auto !important;
        grid-row: auto !important;
    }

    .matrix-divider {
        display: none;
    }

    /* Hide dividers on mobile for simpler stack */
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Programs Landing Page Styles */
.programs-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 30px;
    padding: 40px 0;
}

.program-card {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 40px 30px;
    text-decoration: none;
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-height: 200px;
    position: relative;
    overflow: hidden;
}

.program-card h3 {
    font-size: 1.8rem;
    margin-bottom: 15px;
    color: white;
}

.program-card p {
    color: var(--text-light);
    font-size: 1rem;
    margin-bottom: 20px;
}

.program-status {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    padding: 5px 10px;
    border-radius: 4px;
    display: inline-block;
    width: fit-content;
}

/* Active Program Styles */
.active-program {
    border-left: 5px solid var(--accent-red);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    cursor: pointer;
}

.active-program:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 40px rgba(230, 57, 70, 0.2);
    border-color: var(--accent-red);
}

.active-program .program-status {
    background: rgba(230, 57, 70, 0.2);
    color: var(--accent-red);
}

/* Disabled Program Styles */
.disabled-program {
    opacity: 0.5;
    cursor: default;
    background: rgba(44, 62, 80, 0.5);
    border-color: transparent;
}

.disabled-program h3 {
    color: #999;
}

.disabled-program .program-status {
    background: rgba(255, 255, 255, 0.1);
    color: #999;
}