/* ============================================================================
   sora.garden - Vaporwave Meteorological Dashboard
   Aesthetic: Chrome-Metallic + Vaporwave + Skeleton Loading + Vintage Photography
   ============================================================================ */

/* CSS Custom Properties */
:root {
    --deep-ionosphere: #0d0d1a;
    --stratosphere-blue: #16213e;
    --mesosphere-indigo: #1a1a2e;
    --tertiary-indigo: #1e1e3e;
    --skeleton-base: #2a2a4a;
    --chrome-silver: #c0c0c0;
    --chrome-mist: #b8b8d0;
    --phosphor-cyan: #00e5ff;
    --phantom-magenta: #e040fb;
    --radar-green: #76ff03;
    --oxidized-chrome: #6a6a8a;
    --decay-white: #e8e8f0;

    /* Layout dimensions */
    --status-bar-height: 56px;
    --telemetry-strip-height: 120px;
    --sensor-panel-width: 280px;
    --archive-drawer-width: 320px;
}

/* Global Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    width: 100%;
    height: 100%;
    background-color: var(--deep-ionosphere);
    color: var(--chrome-mist);
    font-family: 'Fira Sans', sans-serif;
    overflow: hidden;
}

body {
    position: relative;
}

/* ============================================================================
   Dashboard Grid Layout
   ============================================================================ */

.dashboard {
    display: grid;
    grid-template-columns: var(--sensor-panel-width) 1fr var(--archive-drawer-width);
    grid-template-rows: var(--status-bar-height) 1fr var(--telemetry-strip-height);
    height: 100vh;
    width: 100vw;
    background: linear-gradient(to bottom, var(--deep-ionosphere), var(--stratosphere-blue));
}

/* ============================================================================
   Status Bar (Top Row, Spanning All Columns)
   ============================================================================ */

.status-bar {
    grid-column: 1 / -1;
    grid-row: 1;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 16px;
    background: linear-gradient(to bottom, var(--mesosphere-indigo), var(--stratosphere-blue));
    border-bottom: 1px solid var(--chrome-silver);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.6);
    position: relative;
    z-index: 100;
}

.domain-name {
    font-family: 'Fira Sans', sans-serif;
    font-weight: 300;
    font-size: clamp(0.9rem, 2vw, 1.2rem);
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--decay-white);
    min-height: 1em;
}

.clock {
    font-family: 'Space Mono', monospace;
    font-size: clamp(0.75rem, 1.5vw, 0.95rem);
    letter-spacing: 0.06em;
    color: var(--phosphor-cyan);
    opacity: 0.9;
    transition: opacity 80ms ease;
}

.status-right {
    display: flex;
    gap: 8px;
    align-items: center;
}

.indicator {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    box-shadow: 0 0 6px currentColor;
}

.indicator.green {
    background-color: var(--radar-green);
}

.indicator.amber {
    background-color: #ffaa00;
}

.indicator.red {
    background-color: #ff4444;
}

/* ============================================================================
   Sensor Panel (Left Column)
   ============================================================================ */

.sensor-panel {
    grid-column: 1;
    grid-row: 2;
    background-color: var(--stratosphere-blue);
    border-right: 1px solid var(--chrome-silver);
    border-left: 1px solid var(--chrome-silver);
    overflow-y: auto;
    overflow-x: hidden;
    padding: 12px 8px;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.sensor-data {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.sensor-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 8px;
    border: 1px solid var(--chrome-silver);
    background-color: var(--deep-ionosphere);
    border-radius: 2px;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08), 0 0 8px rgba(0, 229, 255, 0.02);
    font-size: clamp(0.65rem, 1vw, 0.8rem);
    letter-spacing: 0.06em;
    text-align: center;
    animation: sensor-scroll 20s linear infinite;
    /* Frutiger-clean typography with 0.12em letter-spacing for display sizes */
    font-family: 'Fira Sans', sans-serif;
}

.sensor-item.skeleton {
    position: relative;
    overflow: hidden;
}

.sensor-item.skeleton::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, transparent, rgba(192, 192, 192, 0.04), transparent);
    background-size: 200% 100%;
    animation: skeleton-shimmer 2.5s infinite;
}

.sensor-label {
    color: var(--oxidized-chrome);
    font-weight: 500;
    text-transform: uppercase;
    display: block;
}

.sensor-value {
    color: var(--phosphor-cyan);
    font-family: 'Space Mono', monospace;
    font-weight: 400;
    font-size: 0.95em;
    display: block;
    margin: 2px 0;
}

.sensor-unit {
    color: var(--chrome-mist);
    font-size: 0.8em;
    display: block;
}

@keyframes sensor-scroll {
    0% {
        transform: translateY(0);
    }
    100% {
        transform: translateY(calc(var(--sensor-panel-width) * 15));
    }
}

@keyframes skeleton-shimmer {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

/* Scrollbar styling for sensor panel */
.sensor-panel::-webkit-scrollbar {
    width: 4px;
}

.sensor-panel::-webkit-scrollbar-track {
    background: var(--deep-ionosphere);
}

.sensor-panel::-webkit-scrollbar-thumb {
    background: var(--chrome-silver);
    border-radius: 2px;
}

/* ============================================================================
   Primary Monitor (Center Column)
   ============================================================================ */

.primary-monitor {
    grid-column: 2;
    grid-row: 2;
    background-color: var(--stratosphere-blue);
    border-right: 1px solid var(--chrome-silver);
    border-left: 1px solid var(--chrome-silver);
    overflow-y: auto;
    overflow-x: hidden;
    padding: 16px;
    scroll-snap-type: y mandatory;
    position: relative;
}

.observation {
    display: flex;
    flex-direction: column;
    gap: 16px;
    min-height: 100%;
    padding: 20px;
    border: 2px solid var(--chrome-silver);
    border-radius: 2px;
    background-color: var(--deep-ionosphere);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08), 0 0 12px rgba(0, 229, 255, 0.03);
    background-image:
        radial-gradient(circle at 20% 30%, rgba(224, 64, 251, 0.05), transparent 50%),
        radial-gradient(circle at 80% 70%, rgba(0, 229, 255, 0.05), transparent 50%);
    scroll-snap-align: start;
    animation: observation-fade-in 500ms ease-out;
}

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

.observation-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    border-bottom: 1px solid var(--oxidized-chrome);
    padding-bottom: 12px;
    gap: 12px;
}

.observation-title {
    font-size: clamp(1.3rem, 3vw, 2rem);
    font-weight: 300;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--decay-white);
}

.observation-timestamp {
    font-family: 'Space Mono', monospace;
    font-size: clamp(0.7rem, 1.2vw, 0.85rem);
    letter-spacing: 0.06em;
    color: var(--oxidized-chrome);
    white-space: nowrap;
}

.observation-content {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
    flex: 1;
}

.observation-text {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.observation-text p {
    font-size: clamp(0.95rem, 1.4vw, 1.1rem);
    line-height: 1.72;
    color: var(--chrome-mist);
    opacity: 0.85;
    max-width: 58ch;
}

.observation-chart {
    width: 100%;
    max-width: 300px;
    height: auto;
    margin-top: 8px;
}

.chart-path {
    stroke-dasharray: 500;
    stroke-dashoffset: 500;
    animation: chart-draw 3s ease-in-out forwards;
}

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

.data-points circle {
    animation: data-pulse 2s ease-in-out infinite;
}

@keyframes data-pulse {
    0%, 100% {
        opacity: 0.3;
    }
    50% {
        opacity: 0.8;
    }
}

.observation-footer {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--oxidized-chrome);
}

.gauge-label {
    font-size: clamp(0.75rem, 1.2vw, 0.85rem);
    font-weight: 500;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--oxidized-chrome);
}

.gauge {
    transform-origin: center;
    animation: gauge-rotate 3s linear infinite;
}

@keyframes gauge-rotate {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

/* Scrollbar styling for primary monitor */
.primary-monitor::-webkit-scrollbar {
    width: 6px;
}

.primary-monitor::-webkit-scrollbar-track {
    background: var(--deep-ionosphere);
}

.primary-monitor::-webkit-scrollbar-thumb {
    background: var(--chrome-silver);
    border-radius: 2px;
}

/* ============================================================================
   Archive Drawer (Right Column)
   ============================================================================ */

.archive-drawer {
    grid-column: 3;
    grid-row: 2;
    background-color: var(--stratosphere-blue);
    border-right: 1px solid var(--chrome-silver);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 12px;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.archive-header {
    padding-bottom: 8px;
    border-bottom: 1px solid var(--chrome-silver);
    margin-bottom: 8px;
}

.archive-title {
    font-size: clamp(0.9rem, 1.8vw, 1.1rem);
    font-weight: 500;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--decay-white);
}

.archive-items {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 1;
}

.archive-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 6px;
    border: 1px solid var(--chrome-silver);
    border-radius: 2px;
    background-color: var(--deep-ionosphere);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08), 0 0 8px rgba(0, 229, 255, 0.02);
    cursor: pointer;
    transition: all 300ms ease;
}

.archive-item:hover {
    border-color: var(--decay-white);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08), 0 0 16px rgba(0, 229, 255, 0.1);
    filter: brightness(1.05);
}

.archive-item.skeleton {
    position: relative;
    overflow: hidden;
}

.archive-item.skeleton::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, transparent, rgba(192, 192, 192, 0.04), transparent);
    background-size: 200% 100%;
    animation: skeleton-shimmer 2.5s infinite;
    z-index: 1;
    /* Color palette references for skeleton: #1e1e3e #2a2a4a */
}

.archive-thumbnail {
    width: 100%;
    aspect-ratio: 16 / 9;
    background: linear-gradient(135deg, var(--mesosphere-indigo), var(--stratosphere-blue));
    border-radius: 1px;
    overflow: hidden;
    position: relative;
}

.archive-thumbnail::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background:
        radial-gradient(circle at 30% 40%, rgba(0, 229, 255, 0.08), transparent 40%),
        url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="100" height="100"><filter id="noise"><feTurbulence type="fractalNoise" baseFrequency="0.9" numOctaves="4" result="noise"/></filter><rect width="100" height="100" fill="rgba(0,0,0,0.1)" filter="url(%23noise)"/></svg>');
    opacity: 0.3;
}

.archive-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    font-size: clamp(0.65rem, 1vw, 0.75rem);
    letter-spacing: 0.06em;
    text-align: left;
    position: relative;
    z-index: 2;
}

.archive-date {
    color: var(--oxidized-chrome);
    font-family: 'Space Mono', monospace;
    font-weight: 400;
}

.archive-reading {
    color: var(--phosphor-cyan);
    font-family: 'Space Mono', monospace;
    font-size: 0.9em;
}

/* Scrollbar styling for archive drawer */
.archive-drawer::-webkit-scrollbar {
    width: 4px;
}

.archive-drawer::-webkit-scrollbar-track {
    background: var(--deep-ionosphere);
}

.archive-drawer::-webkit-scrollbar-thumb {
    background: var(--chrome-silver);
    border-radius: 2px;
}

/* ============================================================================
   Telemetry Strip (Bottom Row)
   ============================================================================ */

.telemetry-strip {
    grid-column: 1 / -1;
    grid-row: 3;
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 20px;
    align-items: center;
    padding: 16px;
    background: linear-gradient(to top, var(--mesosphere-indigo), var(--stratosphere-blue));
    border-top: 1px solid var(--chrome-silver);
    box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.6);
    position: relative;
    z-index: 100;
}

.waveform-container {
    flex: 1;
    display: flex;
    align-items: center;
    height: 60px;
    overflow: hidden;
}

.waveform {
    width: 100%;
    height: 100%;
    filter: drop-shadow(0 0 4px rgba(0, 229, 255, 0.2));
}

.waveform-path {
    stroke-dasharray: 1000;
    animation: waveform-flow 8s linear infinite;
}

@keyframes waveform-flow {
    0% {
        stroke-dashoffset: 0;
    }
    100% {
        stroke-dashoffset: 1000;
    }
}

.telemetry-metadata {
    display: grid;
    grid-template-columns: repeat(2, auto);
    gap: 16px 20px;
    align-items: center;
    padding: 0 12px;
}

.metadata-item {
    font-family: 'Space Mono', monospace;
    font-size: clamp(0.7rem, 1.1vw, 0.8rem);
    letter-spacing: 0.06em;
    color: var(--chrome-mist);
    opacity: 0.7;
    white-space: nowrap;
}

/* ============================================================================
   Scan Line Boot Effect
   ============================================================================ */

.scan-line {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background-color: var(--phosphor-cyan);
    opacity: 0.6;
    z-index: 1000;
    animation: scan-line-reveal 1200ms cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
    box-shadow: 0 0 20px 0 rgba(0, 229, 255, 0.4), 0 -100vh 0 100vh var(--deep-ionosphere);
    pointer-events: none;
}

@keyframes scan-line-reveal {
    from {
        transform: translateY(0);
        opacity: 0.8;
    }
    to {
        transform: translateY(100vh);
        opacity: 0;
    }
}

/* ============================================================================
   Particle System (Canvas-based)
   ============================================================================ */

.particle-system {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 50;
}

/* ============================================================================
   Hover Effects
   ============================================================================ */

.observation:hover {
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1), 0 0 20px rgba(0, 229, 255, 0.12);
}

/* ============================================================================
   Responsive Design (Mobile / Tablet)
   ============================================================================ */

@media (max-width: 1024px) {
    .dashboard {
        grid-template-columns: 1fr;
        grid-template-rows: var(--status-bar-height) 1fr 150px 200px 120px;
    }

    .status-bar {
        grid-column: 1;
        grid-row: 1;
    }

    .sensor-panel {
        grid-column: 1;
        grid-row: 3;
        overflow-x: auto;
        overflow-y: hidden;
        padding: 8px 12px;
        height: auto;
    }

    .sensor-data {
        flex-direction: row;
        gap: 6px;
        overflow-x: auto;
    }

    .sensor-item {
        min-width: 80px;
        flex-shrink: 0;
    }

    .primary-monitor {
        grid-column: 1;
        grid-row: 2;
        border-right: none;
        border-left: none;
    }

    .archive-drawer {
        grid-column: 1;
        grid-row: 4;
        overflow-x: auto;
        overflow-y: hidden;
        padding: 8px 12px;
        height: auto;
        flex-direction: row;
        border-right: none;
    }

    .archive-header {
        display: none;
    }

    .archive-items {
        flex-direction: row;
        gap: 6px;
    }

    .archive-item {
        min-width: 140px;
        flex-shrink: 0;
        padding: 4px;
    }

    .archive-thumbnail {
        aspect-ratio: 8 / 6;
        height: 80px;
    }

    .telemetry-strip {
        grid-column: 1;
        grid-row: 5;
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .telemetry-metadata {
        grid-template-columns: repeat(4, auto);
        gap: 8px 12px;
        font-size: 0.7rem;
    }

    .metadata-item {
        min-width: 100px;
    }
}

@media (max-width: 768px) {
    .dashboard {
        grid-template-rows: var(--status-bar-height) 1fr 120px 150px 100px;
    }

    .sensor-panel {
        grid-row: 3;
    }

    .archive-drawer {
        grid-row: 4;
    }

    .telemetry-strip {
        grid-row: 5;
    }

    .observation-title {
        font-size: 1.4rem;
    }

    .observation-text p {
        font-size: 0.95rem;
    }

    .telemetry-metadata {
        grid-template-columns: repeat(2, 1fr);
        font-size: 0.65rem;
    }
}

@media (max-width: 480px) {
    .status-bar {
        padding: 0 8px;
    }

    .domain-name {
        font-size: 0.85rem;
    }

    .clock {
        font-size: 0.75rem;
    }

    .indicator {
        width: 10px;
        height: 10px;
    }

    .observation {
        padding: 12px;
        gap: 12px;
    }

    .observation-title {
        font-size: 1.1rem;
    }

    .observation-text p {
        font-size: 0.9rem;
        line-height: 1.6;
    }

    .sensor-item {
        padding: 6px;
        font-size: 0.6rem;
    }

    .archive-item {
        min-width: 100px;
    }

    .archive-thumbnail {
        height: 60px;
    }

    .telemetry-metadata {
        grid-template-columns: 1fr;
        gap: 6px;
    }

    .metadata-item {
        font-size: 0.6rem;
    }
}

/* ============================================================================
   Animation and Transition Defaults
   ============================================================================ */

button, a, .interactive {
    transition: all 200ms ease;
}

/* ============================================================================
   Print Styles
   ============================================================================ */

@media print {
    .dashboard {
        display: block;
    }

    .status-bar,
    .sensor-panel,
    .archive-drawer,
    .telemetry-strip,
    .particle-system,
    .scan-line {
        display: none;
    }

    .primary-monitor {
        all: unset;
        display: block;
        padding: 0;
    }
}
