/* ======================================================
   digitaltelomere.com - CRT Terminal Monitoring Station
   ====================================================== */

/* --- CSS Variables / Palette --- */
:root {
    --terminal-black: #0b0e14;
    --phosphor-amber: #d4a017;
    --signal-green: #00c853;
    --alert-coral: #e05545;
    --scan-blue: #1e2a3a;
    --ghost-white: #c8cdd4;
    --deep-indigo: #141b27;
}

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

html {
    scroll-behavior: smooth;
}

body {
    background: var(--terminal-black);
    color: var(--ghost-white);
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 400;
    font-size: clamp(14px, 1.1vw, 17px);
    line-height: 1.85;
    overflow-x: hidden;
}

/* --- Scan-line Overlay --- */
#scanline-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9999;
    background: repeating-linear-gradient(
        to bottom,
        transparent 0px,
        transparent 1px,
        rgba(255, 255, 255, 0.015) 1px,
        rgba(255, 255, 255, 0.015) 2px
    );
}

#scanline-bright {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 2px;
    background: rgba(212, 160, 23, 0.08);
    pointer-events: none;
    z-index: 10000;
    animation: scanlineSweep 15s linear infinite;
}

@keyframes scanlineSweep {
    0% { top: -2px; }
    100% { top: 100vh; }
}

/* --- Data Stream Particles --- */
#particles {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}

#particles .particle {
    position: absolute;
    width: 2px;
    height: 2px;
    border-radius: 50%;
    background: var(--scan-blue);
    opacity: 0.4;
    animation: particleDrift 20s linear infinite;
}

@keyframes particleDrift {
    0% { transform: translateY(-10px); }
    100% { transform: translateY(10px); }
}

/* --- Status Bar / Header --- */
#status-bar {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 40px;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    background: var(--terminal-black);
    border-bottom: 1px solid var(--scan-blue);
    opacity: 0;
}

#status-bar.visible {
    opacity: 1;
}

#status-bar-line {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 1px;
    width: 0;
    background: var(--phosphor-amber);
    transition: width 0.6s ease-out;
}

#status-bar.visible #status-bar-line {
    width: 100%;
}

/* --- Navigation --- */
#main-nav {
    display: flex;
    gap: 24px;
}

.nav-item {
    font-family: 'Share Tech Mono', monospace;
    font-size: clamp(11px, 1vw, 14px);
    color: var(--ghost-white);
    text-decoration: none;
    letter-spacing: 0.15em;
    position: relative;
    opacity: 0;
    transform: translateX(20px);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.nav-item.visible {
    opacity: 1;
    transform: translateX(0);
}

.nav-item .nav-prefix {
    color: var(--phosphor-amber);
}

.nav-item::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 0;
    width: 0;
    height: 1px;
    background: var(--phosphor-amber);
    transition: width 0.2s ease;
}

.nav-item:hover::after {
    width: 100%;
}

.nav-item.active::before {
    content: '\2588';
    position: absolute;
    right: -14px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 10px;
    color: var(--phosphor-amber);
    animation: cursorBlink 1.06s step-end infinite;
}

/* --- Status Indicator Lights --- */
#status-indicators {
    display: flex;
    gap: 10px;
    align-items: center;
}

.status-light {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.status-light.visible {
    opacity: 1;
}

.status-green {
    background: var(--signal-green);
    box-shadow: 0 0 6px rgba(0, 200, 83, 0.5);
}

.status-amber, .status-amber2 {
    background: var(--phosphor-amber);
    box-shadow: 0 0 6px rgba(212, 160, 23, 0.5);
}

.status-red {
    background: var(--alert-coral);
    box-shadow: 0 0 6px rgba(224, 85, 69, 0.5);
}

.status-light.pulse {
    animation: statusPulse 2s ease-in-out infinite;
}

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

/* --- Cursor Blink Animation --- */
@keyframes cursorBlink {
    0%, 49% { opacity: 1; }
    50%, 100% { opacity: 0; }
}

.cursor-blink {
    display: inline-block;
    width: 8px;
    height: 14px;
    background: var(--phosphor-amber);
    animation: cursorBlink 1.06s step-end infinite;
    vertical-align: middle;
    margin-left: 2px;
}

/* --- Boot Sequence --- */
#boot-sequence {
    width: 100%;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--terminal-black);
    position: relative;
    z-index: 1;
}

#boot-content {
    text-align: center;
}

#boot-title {
    font-family: 'Share Tech Mono', monospace;
    font-size: clamp(28px, 5vw, 64px);
    font-weight: 400;
    color: var(--phosphor-amber);
    letter-spacing: 0.15em;
    text-transform: uppercase;
    display: inline;
    white-space: nowrap;
}

#boot-subtitle {
    font-family: 'IBM Plex Mono', monospace;
    font-size: clamp(12px, 1.2vw, 16px);
    color: var(--ghost-white);
    opacity: 0;
    margin-top: 16px;
    letter-spacing: 0.08em;
    transition: opacity 0.6s ease;
}

#boot-subtitle.visible {
    opacity: 0.6;
}

/* --- Boot scan-line effect --- */
#boot-sequence::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 2px;
    background: rgba(212, 160, 23, 0.15);
    z-index: 2;
    opacity: 0;
}

#boot-sequence.scanning::before {
    opacity: 1;
    animation: bootScan 0.6s ease-out forwards;
}

@keyframes bootScan {
    0% { top: 0; }
    100% { top: 100%; }
}

/* --- Split Panel Layout --- */
#split-panel {
    display: flex;
    gap: 0;
    position: relative;
    z-index: 1;
    min-height: 100vh;
}

#log-panel {
    flex: 0 0 60%;
    padding: 40px 30px 60px 30px;
}

#data-panel {
    flex: 0 0 40%;
    background: var(--deep-indigo);
    border-left: 1px solid var(--scan-blue);
    padding: 20px;
    position: sticky;
    top: 40px;
    height: calc(100vh - 40px);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* --- Diagnostic Panels --- */
.diagnostic-panel {
    border: 1px solid var(--scan-blue);
    margin-bottom: 0;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.3);
    opacity: 0;
    transform: translateY(15px);
    transition: opacity 0.4s ease-out, transform 0.4s ease-out;
}

.diagnostic-panel.revealed {
    opacity: 1;
    transform: translateY(0);
}

.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 14px;
    background: var(--deep-indigo);
    border-bottom: 1px solid var(--scan-blue);
    transition: border-color 0.2s ease;
}

.diagnostic-panel:hover .panel-header {
    border-color: var(--phosphor-amber);
}

.panel-id {
    font-family: 'Share Tech Mono', monospace;
    font-size: clamp(11px, 1vw, 14px);
    font-weight: 400;
    color: var(--phosphor-amber);
    letter-spacing: 0.15em;
    text-transform: uppercase;
}

.header-light {
    opacity: 1 !important;
}

.panel-body {
    padding: 20px;
}

/* --- Log Entries --- */
.log-entry {
    margin-bottom: 20px;
}

.log-entry:last-child {
    margin-bottom: 0;
}

.log-timestamp {
    font-family: 'Overpass Mono', monospace;
    font-size: clamp(10px, 0.8vw, 13px);
    color: var(--phosphor-amber);
    letter-spacing: 0.08em;
    display: block;
    margin-bottom: 2px;
}

.log-class {
    font-family: 'Overpass Mono', monospace;
    font-size: clamp(10px, 0.8vw, 13px);
    letter-spacing: 0.08em;
    display: block;
    margin-bottom: 6px;
}

.log-class[class] {
    color: var(--signal-green);
}

.log-entry:nth-child(odd) .log-class {
    color: var(--signal-green);
}

.log-entry:nth-child(even) .log-class {
    color: var(--phosphor-amber);
}

.log-text {
    color: var(--ghost-white);
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 400;
    font-size: clamp(14px, 1.1vw, 17px);
    line-height: 1.85;
}

/* --- Diamond Dividers --- */
.diamond-divider {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 30px 0;
    position: relative;
}

.diamond-divider::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 1px;
    background: var(--scan-blue);
}

.diamond {
    display: block;
    width: 6px;
    height: 6px;
    border: 1px solid var(--phosphor-amber);
    transform: rotate(45deg);
    position: relative;
    z-index: 1;
    background: var(--terminal-black);
}

/* --- Telomere Bar Chart --- */
#telomere-chart {
    flex: 1;
    position: relative;
    margin: 15px 0;
    overflow: hidden;
    min-height: 200px;
}

#chart-grid {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background:
        repeating-linear-gradient(
            to right,
            var(--scan-blue) 0px,
            var(--scan-blue) 1px,
            transparent 1px,
            transparent 20px
        ),
        repeating-linear-gradient(
            to bottom,
            var(--scan-blue) 0px,
            var(--scan-blue) 1px,
            transparent 1px,
            transparent 20px
        );
    opacity: 0.5;
}

#chart-bars {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: flex-end;
    gap: 2px;
    padding: 0 4px;
}

.chart-bar {
    flex: 1;
    min-width: 0;
    border-radius: 1px 1px 0 0;
    transition: height 1.2s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    height: 0;
}

#chart-labels {
    position: absolute;
    bottom: -18px;
    left: 0;
    width: 100%;
    display: flex;
    justify-content: space-between;
    padding: 0 4px;
}

.chart-label {
    font-family: 'Overpass Mono', monospace;
    font-size: 9px;
    color: var(--ghost-white);
    opacity: 0.4;
    letter-spacing: 0.08em;
}

/* --- Chart Stats --- */
#chart-stats {
    padding: 12px 0 0 0;
    border-top: 1px solid var(--scan-blue);
    margin-top: auto;
}

.stat-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 5px 0;
    border-bottom: 1px solid rgba(30, 42, 58, 0.5);
}

.stat-row:last-child {
    border-bottom: none;
}

.stat-label {
    font-family: 'Overpass Mono', monospace;
    font-size: clamp(10px, 0.8vw, 13px);
    color: var(--ghost-white);
    opacity: 0.6;
    letter-spacing: 0.08em;
}

.stat-value {
    font-family: 'Share Tech Mono', monospace;
    font-size: clamp(12px, 1vw, 15px);
    color: var(--signal-green);
    letter-spacing: 0.1em;
}

/* --- Terminal Log Footer --- */
#terminal-footer {
    position: relative;
    z-index: 1;
    border-top: 1px solid var(--scan-blue);
    background: var(--terminal-black);
    margin-top: 40px;
}

#terminal-footer .panel-header {
    border-bottom: 1px solid var(--scan-blue);
}

#terminal-log {
    height: 180px;
    overflow: hidden;
    position: relative;
    background: var(--terminal-black);
}

#terminal-log-content {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    padding: 10px 20px;
}

#terminal-log-content.scrolling {
    animation: terminalScroll 30s linear infinite;
}

@keyframes terminalScroll {
    0% { transform: translateY(0); }
    100% { transform: translateY(-50%); }
}

.log-line {
    font-family: 'IBM Plex Mono', monospace;
    font-size: clamp(11px, 0.9vw, 14px);
    color: var(--signal-green);
    line-height: 1.8;
    white-space: nowrap;
    opacity: 0.85;
}

/* --- Mobile Responsive --- */
@media (max-width: 768px) {
    #split-panel {
        flex-direction: column;
    }

    #log-panel {
        flex: 1 1 auto;
        padding: 20px 15px 40px 15px;
    }

    #data-panel {
        flex: 1 1 auto;
        position: relative;
        top: 0;
        height: auto;
        min-height: 400px;
        border-left: none;
        border-top: 1px solid var(--scan-blue);
    }

    #main-nav {
        gap: 12px;
    }

    .nav-item {
        font-size: 10px;
    }

    #status-indicators {
        gap: 6px;
    }
}

/* --- Selection Color --- */
::selection {
    background: var(--phosphor-amber);
    color: var(--terminal-black);
}

/* --- Scrollbar Styling --- */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: var(--terminal-black);
}

::-webkit-scrollbar-thumb {
    background: var(--scan-blue);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--phosphor-amber);
}
