/* ========================================================================
 ! WARRANTEED COMPONENT: DETERMINISTIC RESOLUTION MATRIX MODULE
 ! Developed/Tested: June 2026 // Target Viewport: Unified Cross-Device
 ======================================================================== */

/* --- 1. GLOBAL BASELINE SECTION CONTAINMENT --- */
.matrix-section {
    width: 100vw;
    padding: 100px 20px;
    background: #fdfdfe;
    text-align: center;
    box-sizing: border-box;
}

.matrix-container {
    max-width: 1100px;
    margin: 0 auto;
}

.matrix-header-group {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 60px;
}

.matrix-badge {
    background: #eef2ff;
    color: #4f46e5;
    border: 1px solid #c7d2fe;
    padding: 4px 12px;
    border-radius: 4px;
    font-family: 'Space Mono', monospace;
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 2px;
}

.matrix-main-title {
    font-family: 'JetBrains Mono', monospace;
    font-size: 2.8rem;
    margin: 20px 0 10px;
    color: #0f172a;
    letter-spacing: -1.5px;
}

.matrix-main-title .accent-indigo { color: #4f46e5; }

.matrix-subtitle {
    color: #64748b;
    font-family: 'JetBrains Mono', monospace;
    max-width: 600px;
    line-height: 1.6;
    margin: 0;
}

/* --- 2. THE FLOW ROW STRUCTURAL GRID (DESKTOP LAYOUT MODE) --- */
.matrix-flow-row {
    position: relative;
    background: #ffffff;
    padding: 60px 40px;
    border-radius: 32px;
    border: 1px solid #e2e8f0;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.05), 0 10px 10px -5px rgba(0, 0, 0, 0.02);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0px;
    box-sizing: border-box;
}

.logic-node-card {
    flex: 1;
    text-align: left;
    padding: 20px;
    border-radius: 16px;
    background: #f8fafc;
    border: 1px solid #f1f5f9;
    box-sizing: border-box;
}

.status-indicator-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
}

.pulse-dot.green-glow {
    width: 8px;
    height: 8px;
    background: #10b981;
    border-radius: 50%;
    box-shadow: 0 0 8px #10b981;
    animation: radarBreathe 2s infinite ease-in-out;
}

.node-label {
    font-family: 'Space Mono', monospace;
    font-size: 0.6rem;
    font-weight: 700;
    color: #64748b;
}

.node-heading {
    font-family: 'JetBrains Mono', monospace;
    font-size: 1.15rem;
    margin: 0 0 8px;
    color: #0f172a;
}

.node-meta {
    margin: 0;
    font-size: 0.75rem;
    color: #94a3b8;
    font-family: 'Space Mono', monospace;
}

/* Intersecting horizontal lines */
.flow-vector-line {
    flex: 0.5;
    height: 2px;
    position: relative;
}

.flow-vector-line.pass-gate { background: linear-gradient(to right, #e2e8f0, #4f46e5, #e2e8f0); }
.flow-vector-line.execute-gate { background: linear-gradient(to right, #e2e8f0, #10b981, #e2e8f0); }

.vector-badge {
    position: absolute;
    top: -10px;
    left: 50%;
    transform: translateX(-50%);
    background: white;
    padding: 2px 8px;
    font-size: 0.6rem;
    font-family: 'Space Mono', monospace;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
}

.flow-vector-line.pass-gate .vector-badge { color: #4f46e5; }
.flow-vector-line.execute-gate .vector-badge { color: #10b981; }

/* The Terminal Dark Matrix Panel Card */
.outcome-pulse-panel {
    flex: 1.2;
    text-align: center;
    background: #0f172a;
    color: white;
    padding: 30px 20px;
    border-radius: 20px;
    transition: all 0.3s ease;
    box-sizing: border-box;
}

.outcome-badge {
    font-family: 'Space Mono', monospace;
    font-size: 0.6rem;
    color: #10b981;
    margin-bottom: 15px;
    letter-spacing: 2px;
    animation: textPulse 2.5s infinite ease-in-out;
}

.outcome-heading {
    font-family: 'JetBrains Mono', monospace;
    font-size: 1.1rem;
    font-weight: 700;
    line-height: 1.3;
}

.outcome-footer-meta {
    margin-top: 15px;
    font-size: 0.65rem;
    font-family: 'Space Mono', monospace;
    color: #94a3b8;
    border-top: 1px solid #1e293b;
    padding-top: 15px;
}

.matrix-footnote {
    margin-top: 40px;
    font-family: 'Space Mono', monospace;
    font-size: 0.75rem;
    color: #94a3b8;
}

.footnote-trigger {
    color: #f43f5e;
    text-decoration: underline;
    cursor: pointer;
    font-weight: bold;
}

/* --- 3. AUDIT POPUP WINDOW VIEWPORT SYSTEM --- */
.audit-modal-backdrop {
    display: none; /* Controlled by explicit function scoping triggers */
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.8);
    z-index: 10000;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(4px);
    box-sizing: border-box;
}

.audit-modal-window {
    background: #1e293b;
    color: #f8fafc;
    font-family: 'JetBrains Mono', monospace;
    width: 100%;
    max-width: 500px;
    border: 1px solid #334155;
    border-radius: 16px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    overflow: hidden;
}

.audit-modal-topbar {
    background: #0f172a;
    padding: 16px 24px;
    border-bottom: 1px solid #334155;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-report-tag {
    font-size: 0.75rem;
    color: #ef4444;
    font-weight: bold;
    letter-spacing: 1px;
}

.modal-raw-close {
    cursor: pointer;
    color: #64748b;
    font-size: 1.2rem;
    font-weight: bold;
    transition: color 0.2s;
}
.modal-raw-close:hover { color: #f8fafc; }

.audit-modal-body {
    padding: 24px;
    font-size: 0.85rem;
    line-height: 1.6;
    text-align: left;
}

.modal-inner-heading {
    margin: 0 0 15px 0;
    color: #fff;
    font-size: 1.1rem;
    letter-spacing: -0.5px;
}

.modal-inner-subtext {
    color: #94a3b8;
    margin: 0 0 20px 0;
    font-size: 0.75rem;
}

.modal-burden-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 20px;
}

.modal-burden-table tr {
    border-bottom: 1px solid #334155;
}
.modal-burden-table tr:last-child {
    border-bottom: none;
}

.modal-burden-table td {
    padding: 10px 0;
    color: #cbd5e1;
}

.modal-burden-table td small {
    font-size: 0.7rem;
    color: #64748b;
    display: block;
}

.modal-burden-table td.cost-col {
    text-align: right;
    color: #ef4444;
    vertical-align: top;
}

.modal-burden-table tr.total-burden-row td {
    padding: 15px 0 0 0;
    font-weight: bold;
    color: #fff;
}
.modal-burden-table tr.total-burden-row td.cost-col {
    font-size: 1rem;
}

.modal-success-callout {
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid #10b981;
    padding: 12px;
    border-radius: 8px;
    color: #10b981;
    font-size: 0.75rem;
}

.audit-modal-footer {
    background: #0f172a;
    padding: 12px;
    text-align: right;
    border-top: 1px solid #334155;
}

.modal-dismiss-btn {
    background: #334155;
    color: #fff;
    border: none;
    padding: 6px 16px;
    border-radius: 4px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.75rem;
    cursor: pointer;
    transition: background 0.2s;
}
.modal-dismiss-btn:hover { background: #475569; }


/* ========================================================================
 ! --- 3. MOBILE ARCHITECTURE (Screens under 768px wide) ---
 ======================================================================== */
@media (max-width: 768px) {
    .matrix-section {
        padding: 50px 15px !important;
    }

    .matrix-main-title {
        font-size: 1.8rem !important;
        letter-spacing: -0.5px !important;
    }

    /* Convert horizontal layout box into a single clean stacked lane */
    .matrix-flow-row {
        flex-direction: column !important;
        padding: 30px 15px !important;
        gap: 0px !important;
        border-radius: 20px !important;
    }

    .logic-node-card,
    .outcome-pulse-panel {
        width: 100% !important;
        flex: none !important;
    }

    .logic-node-card {
        width: 100% !important;
        max-width: 100% !important;
        flex: none !important;
        margin: 0 auto !important;
        box-sizing: border-box !important;
        padding: 12px 16px !important; 
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
        text-align: center !important;
    }

    .logic-node-card .status-indicator-row {
        margin-top: 0 !important;
        margin-bottom: 4px !important;
    }

    /* Target inner metadata text to ensure margins aren't pushing elements apart */
    .logic-node-card h4,
    .node-heading {
        margin: 4px 0 !important; /* Tightens space above and below the main H4 title text */
    }

    .node-meta {
        margin-top: 2px !important; /* Pulls the DATA_INTEGRITY subtext closer to the title */
    }

    /* Re-orient the horizontal connection lines to point downwards */
    .flow-vector-line {
        display: block !important;
        width: 2px !important;       /* Clean vertical line depth */
        height: 65px !important; 
        flex: none !important;
        margin: 0px auto !important; /* Tightens the spacing cushion between cards and lines */
        background: linear-gradient(to bottom, #e2e8f0, #4f46e5, #e2e8f0) !important;
        position: relative !important;
    }

    .flow-vector-line.execute-gate {
        background: linear-gradient(to bottom, #e2e8f0, #10b981, #e2e8f0) !important;
    }

    .vector-badge {
        position: absolute !important;
        top: 50% !important;
        left: 50% !important; /* Forces the badge to align to the center axis of the 2px line */
        transform: translate(-50%, -50%) !important; /* Perfectly centers the pill box on both axes */
        white-space: nowrap !important;
        margin: 0 !important;
        padding: 2px 6px !important; /* Tightens padding inside the badge for mobile readability */
        font-size: 0.55rem !important;
    }

    /* --- LOGISTICAL BURDEN POPUP WINDOW SMARTPHONE CONTRACTION --- */
    .audit-modal-backdrop {
        padding: 10px !important;
        overscroll-behavior: contain !important;
    }

    .audit-modal-window {
        width: 100% !important;
        max-width: 360px !important;
        max-height: 70vh !important; /* Locks window layout completely into view bounds */
        display: flex !important;
        flex-direction: column !important;
    }

    .audit-modal-body {
        padding: 15px !important;
        flex: 1 !important;
        overflow-y: scroll !important; /* native independent interior scroll bar tracks */
        -webkit-overflow-scrolling: touch !important;
        touch-action: pan-y !important;
    }

    .modal-inner-heading {
        font-size: 1rem !important;
        margin-bottom: 8px !important;
    }

    .modal-burden-table td {
        font-size: 0.72rem !important;
        padding: 6px 0 !important;
    }

    .modal-burden-table td small {
        font-size: 0.65rem !important;
    }
}

/* ========================================================================
 ! COMPONENT ANIMATIONS: SYSTEMS TELEMETRY DRIVEN PULSES
 ======================================================================== */

/* Ambient breathing effect for the green system status indicators */
@keyframes radarBreathe {
    0% {
        transform: scale(1);
        box-shadow: 0 0 6px rgba(16, 185, 129, 0.6);
        opacity: 0.8;
    }
    50% {
        transform: scale(1.15);
        box-shadow: 0 0 14px rgba(16, 185, 129, 1);
        opacity: 1;
    }
    100% {
        transform: scale(1);
        box-shadow: 0 0 6px rgba(16, 185, 129, 0.6);
        opacity: 0.8;
    }
}

/* Soft data-stream tracking animation for HANDSHAKE SUCCESSFUL */
@keyframes textPulse {
    0% {
        opacity: 0.7;
        text-shadow: 0 0 4px rgba(16, 185, 129, 0.2);
    }
    50% {
        opacity: 1;
        text-shadow: 0 0 10px rgba(16, 185, 129, 0.6);
    }
    100% {
        opacity: 0.7;
        text-shadow: 0 0 4px rgba(16, 185, 129, 0.2);
    }
}