/* ===================================
   LRX.SH - Subsystem Monitor Dashboard
   Translucent Frost / Retro Sci-Fi Mission Control
   Fonts: Share Tech Mono, Orbitron, IBM Plex Mono" Light (Google Fonts)
   Interval: 7s gauge refresh
   =================================== */

:root {
    --void: #07080a;
    --panel: rgba(14, 18, 24, 0.85);
    --frost: #7eb8cc;
    --frost-bright: #a4d4e4;
    --amber: #c7944a;
    --fault: #b34747;
    --nominal: #4a8c6f;
    --text: #d0e4ec;
    --ghost: rgba(173, 216, 230, 0.45);
    --etch: rgba(173, 216, 230, 0.12);
    --bloom: rgba(126, 184, 204, 0.15);
}

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

html, body {
    width: 100vw;
    height: 100vh;
    overflow: hidden;
    background: var(--void);
    color: var(--text);
    font-family: 'Share Tech Mono', monospace;
    font-size: clamp(0.75rem, 1.2vw, 0.9rem);
    letter-spacing: 0.08em;
    line-height: 1.7;
}

/* ---- DASHBOARD GRID ---- */
body {
    display: grid;
    grid-template-columns: 1fr 1fr 2fr 2fr 2fr 2fr 2fr 2fr 1fr 1fr 1fr 1fr;
    grid-template-rows: 48px 1fr 1fr 1fr 1fr 1fr 1fr 32px;
    gap: 2px;
}

/* Grid gap glow effect */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    pointer-events: none;
    background:
        repeating-linear-gradient(to right, transparent, transparent calc((100% - 22px) / 12), var(--etch) calc((100% - 22px) / 12), var(--etch) calc((100% - 22px) / 12 + 2px)),
        repeating-linear-gradient(to bottom, transparent, transparent calc((100% - 14px) / 8), var(--etch) calc((100% - 14px) / 8), var(--etch) calc((100% - 14px) / 8 + 2px));
    z-index: 0;
    opacity: 0.3;
}

/* ---- STATUS BAR ---- */
#status-bar {
    grid-column: 1 / -1;
    grid-row: 1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    background: var(--panel);
    border-bottom: 1px solid var(--etch);
    z-index: 10;
    font-size: clamp(0.6rem, 0.9vw, 0.7rem);
    letter-spacing: 0.2em;
    text-transform: uppercase;
}

.status-left {
    color: var(--ghost);
}

.status-right {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--ghost);
}

.status-indicator {
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--nominal);
}

.status-indicator.active {
    background: var(--amber);
    box-shadow: 0 0 6px var(--amber), 0 0 12px rgba(199, 148, 74, 0.3);
    animation: blink-amber 2s ease-in-out infinite;
}

@keyframes blink-amber {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

#utc-clock {
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 300;
    font-variant-numeric: tabular-nums;
    font-size: clamp(0.65rem, 1vw, 0.85rem);
}

/* ---- GAUGE STRIP (Left) ---- */
#gauge-strip {
    grid-column: 1 / 3;
    grid-row: 2 / 8;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-evenly;
    padding: 10px 8px;
    background: var(--panel);
    border-right: 1px solid var(--etch);
    z-index: 5;
}

.gauge-module {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    width: 100%;
}

.gauge-label {
    font-size: 8px;
    letter-spacing: 0.3em;
    text-transform: uppercase;
    color: var(--ghost);
    font-family: 'Share Tech Mono', monospace;
}

.gauge-svg {
    width: 80%;
    max-width: 100px;
    height: auto;
}

.gauge-bg {
    fill: none;
    stroke: var(--etch);
    stroke-width: 6;
    stroke-linecap: round;
}

.gauge-fill {
    fill: none;
    stroke: var(--frost);
    stroke-width: 6;
    stroke-linecap: round;
    stroke-dasharray: 126;
    stroke-dashoffset: 126;
    transition: stroke-dashoffset 1.5s cubic-bezier(0.4, 0, 0.2, 1);
    filter: drop-shadow(0 0 4px var(--bloom));
}

.gauge-value {
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 300;
    font-variant-numeric: tabular-nums;
    font-size: clamp(0.65rem, 1vw, 0.85rem);
    color: var(--frost-bright);
}

/* ---- CIRCUIT TRACE OVERLAY ---- */
.circuit-overlay {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 2;
}

.trace {
    fill: none;
    stroke: var(--frost);
    stroke-width: 1;
    stroke-opacity: 0.25;
    stroke-dasharray: 2000;
    stroke-dashoffset: 2000;
    animation: draw-trace 2500ms cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.trace-nw, .trace-nw-b { animation-delay: 800ms; }
.trace-ne, .trace-ne-b { animation-delay: 1200ms; }
.trace-sw, .trace-sw-b { animation-delay: 1600ms; }
.trace-se, .trace-se-b { animation-delay: 2000ms; }
.trace-decor-1 { animation-delay: 1000ms; stroke-opacity: 0.15; }
.trace-decor-2 { animation-delay: 1400ms; stroke-opacity: 0.15; }

.via {
    fill: rgba(126, 184, 204, 0.08);
    stroke: var(--frost);
    stroke-width: 0.5;
    stroke-opacity: 0.3;
    opacity: 0;
    animation: fade-in-via 400ms ease forwards;
}

.via-nw, .via-nw-b { animation-delay: 3300ms; }
.via-ne, .via-ne-b { animation-delay: 3700ms; }
.via-sw, .via-sw-b { animation-delay: 4100ms; }
.via-se, .via-se-b { animation-delay: 4500ms; }
.via-decor-1 { animation-delay: 3500ms; }
.via-decor-2 { animation-delay: 3900ms; }

@keyframes draw-trace {
    to { stroke-dashoffset: 0; }
}

@keyframes fade-in-via {
    to { opacity: 1; }
}

/* ---- QUADRANTS (shared) ---- */
.quadrant {
    background: var(--panel);
    border: 1px solid rgba(173, 216, 230, 0.25);
    box-shadow: inset 0 0 20px rgba(173, 216, 230, 0.04);
    position: relative;
    overflow: hidden;
    z-index: 3;
    display: flex;
    flex-direction: column;
}

.panel-header {
    font-size: clamp(0.6rem, 0.9vw, 0.7rem);
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: rgba(126, 184, 204, 0.6);
    padding: 8px 12px 4px;
    line-height: 1;
    font-family: 'Share Tech Mono', monospace;
    flex-shrink: 0;
}

.panel-content {
    flex: 1;
    padding: 8px 12px 12px;
    overflow: hidden;
}

/* ---- BOOT ANIMATION ---- */
.panel-boot {
    opacity: 0;
    animation: panel-fade-in 600ms ease forwards;
}

#status-bar { animation-delay: 300ms; }
#gauge-strip { animation-delay: 1000ms; }
#quad-nw { animation-delay: 2000ms; }
#quad-ne { animation-delay: 2600ms; }
#quad-sw { animation-delay: 3200ms; }
#quad-se { animation-delay: 3800ms; }
#command-bar { animation-delay: 4400ms; }

@keyframes panel-fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* ---- QUADRANT NW: Identity ---- */
#quad-nw {
    grid-column: 3 / 8;
    grid-row: 2 / 5;
}

.nw-content {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 16px;
}

.site-title {
    font-family: 'Orbitron', sans-serif;
    font-weight: 700;
    font-size: clamp(2.5rem, 5vw, 4.5rem);
    letter-spacing: 0.15em;
    color: var(--text);
    text-shadow:
        0 0 10px rgba(173, 216, 230, 0.3),
        0 0 40px rgba(173, 216, 230, 0.1);
    line-height: 1;
}

.site-tagline {
    color: var(--ghost);
    font-size: clamp(0.65rem, 1vw, 0.8rem);
    line-height: 1.8;
    max-width: 50ch;
}

.status-readout {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 8px;
}

.readout-line {
    display: flex;
    align-items: center;
    gap: 16px;
}

.readout-label {
    font-size: clamp(0.55rem, 0.8vw, 0.65rem);
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: rgba(126, 184, 204, 0.5);
    min-width: 7ch;
}

.readout-value {
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 300;
    font-variant-numeric: tabular-nums;
    font-size: clamp(0.65rem, 1vw, 0.85rem);
    color: var(--frost-bright);
}

.readout-value.nominal {
    color: var(--nominal);
}

/* ---- QUADRANT NE: Generative Canvas ---- */
#quad-ne {
    grid-column: 8 / -1;
    grid-row: 2 / 5;
}

.ne-content {
    padding: 0;
    position: relative;
}

#circuit-canvas {
    width: 100%;
    height: 100%;
    display: block;
}

/* ---- QUADRANT SW: Log Feed ---- */
#quad-sw {
    grid-column: 3 / 8;
    grid-row: 5 / 8;
}

.sw-content {
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--frost) transparent;
}

.sw-content::-webkit-scrollbar {
    width: 4px;
}
.sw-content::-webkit-scrollbar-track {
    background: transparent;
}
.sw-content::-webkit-scrollbar-thumb {
    background: rgba(126, 184, 204, 0.3);
    border-radius: 2px;
}

#log-feed {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.log-entry {
    font-size: clamp(0.6rem, 0.85vw, 0.75rem);
    line-height: 1.5;
    color: var(--ghost);
    opacity: 0;
    animation: log-appear 300ms ease forwards;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.log-entry .log-ts {
    color: rgba(126, 184, 204, 0.35);
    margin-right: 8px;
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 300;
}

.log-entry .log-msg {
    color: var(--ghost);
}

.log-entry.warn .log-msg {
    color: var(--amber);
}

.log-entry.error .log-msg {
    color: var(--fault);
}

.log-entry.ok .log-msg {
    color: var(--nominal);
}

@keyframes log-appear {
    from { opacity: 0; transform: translateY(4px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ---- QUADRANT SE: Radar ---- */
#quad-se {
    grid-column: 8 / -1;
    grid-row: 5 / 8;
}

.se-content {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px;
}

#radar-svg {
    width: 100%;
    height: 100%;
    max-width: 300px;
    max-height: 300px;
}

.radar-ring {
    fill: none;
    stroke: var(--ghost);
    stroke-width: 0.5;
    stroke-dasharray: 1000;
    stroke-dashoffset: 1000;
    animation: draw-ring 1500ms ease forwards;
}

.radar-ring:nth-child(1) { animation-delay: 3800ms; }
.radar-ring:nth-child(2) { animation-delay: 4000ms; }
.radar-ring:nth-child(3) { animation-delay: 4200ms; }
.radar-ring:nth-child(4) { animation-delay: 4400ms; }
.radar-ring:nth-child(5) { animation-delay: 4600ms; }

@keyframes draw-ring {
    to { stroke-dashoffset: 0; }
}

.radar-cross {
    stroke: var(--etch);
    stroke-width: 0.5;
    opacity: 0;
    animation: fade-in-via 400ms ease forwards;
    animation-delay: 4800ms;
}

.radar-sweep-group {
    transform-origin: 150px 150px;
    animation: radar-spin 6s linear infinite;
    animation-delay: 5000ms;
    opacity: 0;
}

@keyframes radar-spin {
    0% { opacity: 1; transform: rotate(0deg); }
    0.1% { opacity: 1; }
    100% { opacity: 1; transform: rotate(360deg); }
}

.radar-blip {
    fill: var(--frost-bright);
    opacity: 0;
    animation: blip-appear 4s ease forwards;
}

@keyframes blip-appear {
    0% { opacity: 0; }
    10% { opacity: 0.9; }
    100% { opacity: 0; }
}

/* ---- COMMAND BAR ---- */
#command-bar {
    grid-column: 1 / -1;
    grid-row: 8;
    display: flex;
    align-items: center;
    padding: 0 20px;
    background: var(--panel);
    border-top: 1px solid var(--etch);
    z-index: 10;
    font-size: clamp(0.65rem, 1vw, 0.8rem);
    font-family: 'Share Tech Mono', monospace;
    gap: 8px;
}

.cmd-prompt {
    color: var(--nominal);
}

#cmd-text {
    color: var(--frost-bright);
}

.cmd-cursor {
    display: inline-block;
    width: 8px;
    height: 1.1em;
    background: var(--amber);
    animation: cursor-blink 1s step-end infinite;
    vertical-align: text-bottom;
}

@keyframes cursor-blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}

/* ---- UTILITY ---- */
::selection {
    background: var(--frost);
    color: var(--void);
}
