/* ============================================================
   double-standard.xyz -- Styles
   Contradiction Monitoring System Dashboard
   ============================================================ */

/* === CSS Custom Properties === */
:root {
    --speed: 1;
    --bg-deep: #0D1117;
    --bg-panel: #161B22;
    --border: #21262D;
    --text-body: #A0AEC0;
    --text-secondary: #8B9DAF;
    --text-system: #4FD1C5;
    --alert: #E53E3E;
    --alert-soft: #FC8181;
    --accent: #667EEA;
    --success: #48BB78;
    --rule-color: #2D3748;
    --scanline-opacity: 0.04;
}

/* === Reset === */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: var(--bg-deep);
    color: var(--text-body);
    font-family: 'IBM Plex Sans', sans-serif;
    font-weight: 400;
    font-size: 16px;
    line-height: 1.7;
}

/* === Boot Sequence Overlay === */
#boot-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--bg-deep);
    z-index: 10000;
    display: flex;
    align-items: flex-start;
    justify-content: flex-start;
    padding: 40px;
    opacity: 1;
    transition: opacity 0.5s ease;
}

#boot-overlay.fade-out {
    opacity: 0;
    pointer-events: none;
}

#boot-overlay.hidden {
    display: none;
}

#boot-text {
    font-family: 'Share Tech Mono', monospace;
    font-size: 13px;
    color: var(--text-system);
    white-space: pre-wrap;
    line-height: 1.8;
}

#boot-text .boot-line {
    opacity: 0;
    animation: bootLineIn 0.1s forwards;
}

@keyframes bootLineIn {
    to { opacity: 1; }
}

/* === Scan Line Overlay === */
#scanlines {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9000;
    background: repeating-linear-gradient(
        to bottom,
        rgba(0, 0, 0, var(--scanline-opacity)) 0px,
        rgba(0, 0, 0, var(--scanline-opacity)) 1px,
        transparent 1px,
        transparent 3px
    );
}

/* === Dashboard Layout === */
#dashboard {
    width: 100%;
    height: 100%;
    display: grid;
    grid-template-columns: 62% 1fr;
    grid-template-rows: 1fr 60px;
    grid-template-areas:
        "panel-a panel-b"
        "panel-c panel-c";
    opacity: 0;
    transition: opacity 0.6s ease;
}

#dashboard.active {
    opacity: 1;
}

.dashboard-panel {
    position: relative;
    overflow: hidden;
}

/* Panel border pulse on hover */
.dashboard-panel::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    border: 1px solid var(--border);
    opacity: 0.3;
    transition: opacity 0.2s ease;
}

.dashboard-panel:hover::after {
    opacity: 0.6;
}

/* === Panel A: Primary Feed === */
#panel-a {
    grid-area: panel-a;
    background: var(--bg-deep);
    overflow-y: auto;
    overflow-x: hidden;
    border-right: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    scrollbar-width: thin;
    scrollbar-color: var(--border) var(--bg-deep);
}

#panel-a::-webkit-scrollbar {
    width: 4px;
}

#panel-a::-webkit-scrollbar-track {
    background: var(--bg-deep);
}

#panel-a::-webkit-scrollbar-thumb {
    background: var(--border);
}

#panel-a-inner {
    padding: 40px 50px 120px 50px;
}

/* === Case Files === */
.case-file {
    margin-bottom: 20px;
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.case-file.visible {
    opacity: 1;
    transform: translateY(0);
}

.case-header {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    align-items: center;
    margin-bottom: 24px;
    padding-bottom: 12px;
    border-bottom: 1px dashed var(--border);
}

.case-id {
    font-family: 'Share Tech Mono', monospace;
    font-size: 12px;
    color: var(--text-system);
    letter-spacing: 1px;
}

.case-timestamp {
    font-family: 'Share Tech Mono', monospace;
    font-size: 11px;
    color: var(--text-secondary);
    animation: flicker 3s infinite;
}

.case-severity {
    font-family: 'Share Tech Mono', monospace;
    font-size: 11px;
    letter-spacing: 1px;
    padding: 2px 8px;
}

.severity-high {
    color: var(--alert-soft);
    border: 1px solid var(--alert-soft);
}

.severity-critical {
    color: var(--alert);
    border: 1px solid var(--alert);
    animation: severityPulse 2s infinite;
}

@keyframes severityPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

/* === Kinetic Typography === */
h1[data-kinetic] {
    font-family: 'Orbitron', sans-serif;
    font-weight: 700;
    font-size: 56px;
    line-height: 1.15;
    color: #ffffff;
    margin-bottom: 20px;
    letter-spacing: 2px;
}

h1[data-kinetic] .char {
    display: inline-block;
    opacity: 0;
}

h1[data-kinetic] .char.settled {
    opacity: 1;
    transform: none;
    text-shadow: none;
    transition: all 0.3s cubic-bezier(0.33, 1, 0.68, 1);
}

h1[data-kinetic] .char.jittering {
    opacity: 1;
    text-shadow: -2px 0 #E53E3E, 2px 0 #667EEA;
}

/* === Section Headings (Exo 2) === */
.section-heading {
    font-family: 'Exo 2', sans-serif;
    font-weight: 500;
    font-size: 28px;
    color: var(--text-secondary);
    margin-bottom: 20px;
    position: relative;
    overflow: hidden;
}

.section-heading .typewriter-cursor {
    display: inline-block;
    width: 2px;
    height: 1em;
    background: var(--text-system);
    margin-left: 2px;
    animation: cursorBlink 0.6s infinite;
    vertical-align: text-bottom;
}

@keyframes cursorBlink {
    0%, 49% { opacity: 1; }
    50%, 100% { opacity: 0; }
}

.section-heading .scan-flash {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(to right, transparent, rgba(79, 209, 197, 0.06), transparent);
    transform: translateX(-100%);
    pointer-events: none;
}

/* === Body Text === */
.body-text {
    font-family: 'IBM Plex Sans', sans-serif;
    font-weight: 400;
    font-size: 16px;
    line-height: 1.7;
    color: var(--text-body);
    margin-bottom: 20px;
    opacity: 0;
    transform: translateY(8px);
    transition: opacity 0.5s ease, transform 0.5s ease;
}

.body-text.visible {
    opacity: 1;
    transform: translateY(0);
}

.body-text::before {
    content: '';
    display: block;
    width: 0;
    height: 2px;
    background: #2D3748;
    margin-bottom: 12px;
    transition: width 0.3s ease;
}

.body-text.visible::before {
    width: 100%;
}

/* === Glitch Dividers === */
.glitch-divider {
    height: 60px;
    margin: 40px 0;
    position: relative;
    overflow: hidden;
}

.pixel-sort-bar {
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        var(--bg-deep) 0%,
        var(--border) 15%,
        var(--text-secondary) 20%,
        var(--border) 25%,
        var(--bg-deep) 30%,
        var(--bg-panel) 40%,
        var(--alert) 42%,
        var(--bg-panel) 44%,
        var(--bg-deep) 50%,
        var(--accent) 55%,
        var(--bg-deep) 57%,
        var(--border) 65%,
        var(--text-system) 68%,
        var(--border) 70%,
        var(--bg-deep) 75%,
        var(--bg-panel) 85%,
        var(--text-secondary) 90%,
        var(--bg-deep) 100%
    );
    opacity: 0.5;
    animation: pixelSortShift 4s ease-in-out infinite alternate;
}

@keyframes pixelSortShift {
    0% { transform: translateX(-5%); }
    100% { transform: translateX(5%); }
}

/* === Panel B: Side Monitor === */
#panel-b {
    grid-area: panel-b;
    background: var(--bg-panel);
    border-bottom: 1px solid var(--border);
    display: flex;
    flex-direction: column;
}

.panel-b-header {
    padding: 16px 16px 12px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.panel-b-header .data-label {
    font-family: 'Share Tech Mono', monospace;
    font-size: 11px;
    color: var(--text-system);
    letter-spacing: 1px;
    animation: flicker 4s infinite;
}

#panel-b-stream {
    flex: 1;
    overflow-y: auto;
    padding: 12px 16px;
    scrollbar-width: thin;
    scrollbar-color: var(--border) var(--bg-panel);
}

#panel-b-stream::-webkit-scrollbar {
    width: 3px;
}

#panel-b-stream::-webkit-scrollbar-track {
    background: var(--bg-panel);
}

#panel-b-stream::-webkit-scrollbar-thumb {
    background: var(--border);
}

.stream-item {
    padding: 10px 0;
    border-bottom: 1px solid rgba(33, 38, 45, 0.5);
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.stream-timestamp {
    font-family: 'Share Tech Mono', monospace;
    font-size: 11px;
    color: var(--text-system);
    animation: flicker 5s infinite;
}

.stream-text {
    font-family: 'IBM Plex Sans', sans-serif;
    font-size: 13px;
    color: var(--text-body);
    line-height: 1.5;
}

.ghost-text {
    color: var(--text-secondary);
    opacity: 0.6;
    font-style: italic;
}

.stream-glitch-thumb {
    margin: 4px 0;
    opacity: 0.7;
}

.panel-b-ghost {
    padding: 12px 16px;
    border-top: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex-shrink: 0;
}

.ghost-shortcut {
    font-family: 'Share Tech Mono', monospace;
    font-size: 10px;
    color: var(--text-secondary);
    opacity: 0.35;
}

/* === Panel C: Status Strip === */
#panel-c {
    grid-area: panel-c;
    background: var(--bg-panel);
    display: flex;
    align-items: center;
    padding: 0 20px;
    gap: 24px;
    border-top: 1px solid var(--border);
    /* Barcode-like border pattern */
    border-top: 2px dashed var(--border);
}

.status-item {
    display: flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
}

.data-label {
    font-family: 'Share Tech Mono', monospace;
    font-size: 11px;
    color: var(--text-system);
    letter-spacing: 0.5px;
    animation: flicker 6s infinite;
}

.data-value {
    font-family: 'Share Tech Mono', monospace;
    font-size: 13px;
}

.data-value.success {
    color: var(--success);
}

.status-indicator {
    font-family: 'Share Tech Mono', monospace;
    font-size: 11px;
}

.status-indicator.active {
    color: var(--success);
}

.status-indicator.active::before {
    content: '';
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--success);
    margin-right: 6px;
    animation: statusPulse 2s infinite;
}

@keyframes statusPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

/* Throughput Meter */
.throughput-meter {
    flex: 0 0 auto;
}

.meter-bar {
    width: 80px;
    height: 6px;
    background: var(--border);
    position: relative;
    overflow: hidden;
}

.meter-fill {
    height: 100%;
    width: 65%;
    background: var(--text-system);
    transition: width 0.5s ease;
}

/* Contradiction Index */
.accent-numeral {
    font-family: 'Audiowide', sans-serif;
    font-weight: 400;
    font-size: 28px;
    color: var(--alert);
    text-shadow: 1px 1px 0 var(--alert-soft);
}

.breadcrumb {
    margin-left: auto;
}

.breadcrumb .data-label {
    color: var(--text-secondary);
    opacity: 0.6;
}

/* === CRT Flicker Animation === */
@keyframes flicker {
    0% { opacity: 0.85; }
    10% { opacity: 1; }
    20% { opacity: 0.9; }
    35% { opacity: 1; }
    42% { opacity: 0.85; }
    55% { opacity: 1; }
    65% { opacity: 0.88; }
    80% { opacity: 1; }
    90% { opacity: 0.92; }
    100% { opacity: 0.85; }
}

/* === Panel D: Overlay === */
#panel-d {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 8000;
    background: radial-gradient(
        ellipse at center,
        rgba(102, 126, 234, 0.08) 0%,
        rgba(13, 17, 23, 0.95) 70%
    );
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.6s ease;
}

#panel-d.active {
    opacity: 1;
    pointer-events: auto;
}

.overlay-content {
    text-align: center;
}

.glitch-composition {
    margin-bottom: 32px;
}

.overlay-scales {
    opacity: 0.6;
}

.glitch-circle {
    animation: glitchOffset 2s infinite alternate;
}

@keyframes glitchOffset {
    0% { transform: translate(0, 0); }
    25% { transform: translate(3px, -2px); }
    50% { transform: translate(-2px, 4px); }
    75% { transform: translate(4px, 1px); }
    100% { transform: translate(-1px, -3px); }
}

.overlay-heading {
    font-family: 'Orbitron', sans-serif;
    font-weight: 700;
    font-size: 48px;
    color: #ffffff;
    letter-spacing: 4px;
    margin-bottom: 16px;
    text-shadow: -2px 0 var(--alert), 2px 0 var(--accent);
}

.overlay-subtext {
    font-family: 'Share Tech Mono', monospace;
    font-size: 14px;
    color: var(--text-system);
}

/* RGB fade-out for overlay */
#panel-d.fading-out {
    animation: rgbFadeOut 0.6s forwards;
}

@keyframes rgbFadeOut {
    0% { opacity: 1; }
    33% {
        text-shadow: -4px 0 var(--alert), 4px 0 var(--accent);
        opacity: 0.8;
    }
    66% {
        text-shadow: -8px 0 var(--alert), 8px 0 var(--accent);
        opacity: 0.4;
    }
    100% {
        opacity: 0;
    }
}

/* === Terminal Mode === */
.terminal-mode {
    padding-top: 40px;
}

.terminal-header {
    margin-bottom: 24px;
}

.terminal-prompt {
    font-family: 'Share Tech Mono', monospace;
    font-size: 16px;
    color: var(--text-system);
}

.terminal-cursor {
    font-family: 'Share Tech Mono', monospace;
    font-size: 16px;
    color: var(--text-system);
    animation: cursorBlink 0.6s infinite;
}

.terminal-line {
    font-family: 'Share Tech Mono', monospace;
    font-size: 14px;
    color: var(--text-system);
    line-height: 1.8;
    opacity: 0;
    white-space: pre-wrap;
}

.terminal-line.typed {
    opacity: 1;
}

#final-index {
    text-align: center;
    padding: 60px 0 40px;
    opacity: 0;
    transition: opacity 0.8s ease;
}

#final-index.visible {
    opacity: 1;
}

#final-index-value {
    font-size: 144px;
    line-height: 1;
    display: block;
}

/* === Data Corruption Transition Effect === */
.corruption-transition {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 7500;
    pointer-events: none;
    opacity: 0;
}

.corruption-transition.active {
    animation: corruptionFlash 0.5s forwards;
}

@keyframes corruptionFlash {
    0% {
        opacity: 0;
        background: repeating-linear-gradient(
            to bottom,
            transparent 0px,
            transparent 2px,
            rgba(229, 62, 62, 0.1) 2px,
            rgba(229, 62, 62, 0.1) 4px
        );
    }
    30% {
        opacity: 1;
        background: repeating-linear-gradient(
            to bottom,
            transparent 0px,
            transparent 1px,
            rgba(102, 126, 234, 0.15) 1px,
            rgba(102, 126, 234, 0.15) 3px
        );
    }
    60% {
        opacity: 0.7;
        background: repeating-linear-gradient(
            to bottom,
            transparent 0px,
            transparent 3px,
            rgba(79, 209, 197, 0.1) 3px,
            rgba(79, 209, 197, 0.1) 5px
        );
    }
    100% {
        opacity: 0;
    }
}

/* === Responsive: Below 768px === */
@media (max-width: 768px) {
    #dashboard {
        grid-template-columns: 1fr;
        grid-template-rows: 1fr auto 40px;
        grid-template-areas:
            "panel-a"
            "panel-b"
            "panel-c";
    }

    #panel-a {
        border-right: none;
    }

    #panel-a-inner {
        padding: 24px 20px 80px 20px;
    }

    h1[data-kinetic] {
        font-size: 32px;
    }

    .section-heading {
        font-size: 22px;
    }

    .body-text {
        font-size: 15px;
    }

    /* Panel B becomes horizontal ticker */
    #panel-b {
        max-height: 120px;
        border-bottom: 1px solid var(--border);
    }

    #panel-b-stream {
        display: flex;
        overflow-x: auto;
        overflow-y: hidden;
        white-space: nowrap;
        flex-direction: row;
        gap: 16px;
        padding: 8px 16px;
    }

    .stream-item {
        flex: 0 0 auto;
        min-width: 200px;
        border-bottom: none;
        border-right: 1px solid var(--border);
        padding: 8px 16px 8px 0;
    }

    .stream-text {
        white-space: normal;
    }

    .panel-b-ghost {
        display: none;
    }

    /* Panel C simplified */
    #panel-c {
        height: 40px;
        gap: 12px;
        padding: 0 12px;
        overflow-x: auto;
    }

    .breadcrumb {
        display: none;
    }

    .accent-numeral {
        font-size: 20px;
    }

    /* Simplified overlay */
    .overlay-heading {
        font-size: 28px;
    }

    #final-index-value {
        font-size: 80px;
    }

    /* Simplified animations on mobile */
    h1[data-kinetic] .char.jittering {
        text-shadow: -1px 0 var(--alert), 1px 0 var(--accent);
    }
}

/* === Selection Color === */
::selection {
    background: var(--accent);
    color: #ffffff;
}
