/* ============================================
   miris.tech - HUD Observatory Styles
   ============================================ */

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

html {
    scroll-behavior: smooth;
    overflow-x: hidden;
}

body {
    background: #0C1420;
    color: #A0B8D0;
    font-family: 'Work Sans', sans-serif;
    font-size: 0.95rem;
    line-height: 1.75;
    font-weight: 400;
    min-height: 100vh;
    overflow-x: hidden;
}

/* --- Mountain Landscape Backdrop --- */
#mountain-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    overflow: hidden;
    opacity: 0;
    animation: landscapeFadeIn 1.5s ease-out 0.2s forwards;
}

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

.mountain-ridge {
    position: absolute;
    bottom: 0;
    left: -5%;
    width: 110%;
    will-change: transform;
}

.ridge-far {
    height: 35vh;
    background: #0C1420;
    clip-path: polygon(
        0% 100%,
        0% 65%,
        5% 55%,
        12% 40%,
        18% 35%,
        25% 30%,
        30% 25%,
        35% 30%,
        40% 35%,
        45% 28%,
        50% 22%,
        55% 18%,
        60% 22%,
        65% 30%,
        70% 25%,
        75% 20%,
        80% 28%,
        85% 35%,
        90% 30%,
        95% 38%,
        100% 45%,
        100% 100%
    );
    z-index: 1;
}

.ridge-mid {
    height: 28vh;
    background: #142030;
    clip-path: polygon(
        0% 100%,
        0% 60%,
        8% 50%,
        15% 38%,
        22% 45%,
        28% 35%,
        35% 42%,
        42% 30%,
        48% 38%,
        55% 28%,
        62% 35%,
        68% 40%,
        75% 32%,
        82% 45%,
        88% 38%,
        95% 50%,
        100% 55%,
        100% 100%
    );
    z-index: 2;
}

.ridge-near {
    height: 20vh;
    background: #1C2840;
    clip-path: polygon(
        0% 100%,
        0% 55%,
        6% 48%,
        12% 52%,
        20% 42%,
        28% 50%,
        35% 45%,
        42% 55%,
        50% 40%,
        58% 50%,
        65% 45%,
        72% 52%,
        80% 42%,
        88% 50%,
        94% 45%,
        100% 52%,
        100% 100%
    );
    z-index: 3;
}

/* --- HUD Grid Layout --- */
#hud-grid {
    position: relative;
    z-index: 10;
    display: grid;
    grid-template-columns: minmax(40px, 1fr) minmax(40px, 1fr) repeat(8, 1fr) minmax(40px, 1fr) minmax(40px, 1fr);
    min-height: 100vh;
    padding-bottom: 80px;
}

/* --- Status Strips (Flanking) --- */
.status-strip {
    grid-row: 1 / -1;
    overflow: hidden;
    position: relative;
    opacity: 0;
    padding-top: 60px;
}

#left-strip {
    grid-column: 1 / 3;
    transform: translateX(-100%);
    animation: stripSlideLeft 300ms ease-out 2s forwards;
}

#right-strip {
    grid-column: 11 / 13;
    transform: translateX(100%);
    animation: stripSlideRight 300ms ease-out 2.2s forwards;
}

@keyframes stripSlideLeft {
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes stripSlideRight {
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.strip-scroll {
    display: flex;
    flex-direction: column;
    animation: scrollUp 60s linear infinite;
}

.strip-scroll.reverse {
    animation: scrollDown 60s linear infinite;
}

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

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

.strip-item {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.65rem;
    font-weight: 400;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: rgba(100, 160, 220, 0.4);
    padding: 8px 12px;
    white-space: nowrap;
    border-bottom: 1px solid rgba(100, 160, 220, 0.08);
}

/* --- Central Viewport --- */
#central-viewport {
    grid-column: 3 / 11;
    padding: 80px 40px 60px;
    display: flex;
    flex-direction: column;
    gap: 60px;
}

/* --- HUD Panel Style --- */
.hud-panel {
    background: rgba(20, 30, 50, 0.4);
    border: 1px solid rgba(100, 160, 220, 0.3);
    border-radius: 4px;
    position: relative;
    padding: 32px 36px;
    opacity: 0;
    transform: translateY(30px);
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.hud-panel.visible {
    opacity: 1;
    transform: translateY(0);
    transition: opacity 0.4s ease, transform 0.5s ease, border-color 0.3s ease, box-shadow 0.3s ease;
}

.hud-panel:hover {
    border-color: rgba(100, 160, 220, 0.6);
    box-shadow: 0 0 20px rgba(100, 160, 220, 0.08), inset 0 0 20px rgba(100, 160, 220, 0.03);
}

/* Hero panel special treatment */
.hero-panel {
    text-align: center;
    padding: 60px 36px;
    opacity: 0;
    animation: heroMaterialize 0.6s ease-out 1.7s forwards;
    transform: translateY(0);
}

.hero-panel.visible {
    opacity: 1;
}

@keyframes heroMaterialize {
    0% { opacity: 0; }
    100% { opacity: 1; transform: translateY(0); }
}

/* --- Bracket Corner Decorations --- */
.bracket-corner {
    position: absolute;
    width: 12px;
    height: 12px;
    transition: border-color 0.3s ease;
}

.bracket-corner.tl {
    top: -1px;
    left: -1px;
    border-top: 2px solid #40B8B0;
    border-left: 2px solid #40B8B0;
}

.bracket-corner.tr {
    top: -1px;
    right: -1px;
    border-top: 2px solid #40B8B0;
    border-right: 2px solid #40B8B0;
}

.bracket-corner.bl {
    bottom: -1px;
    left: -1px;
    border-bottom: 2px solid #40B8B0;
    border-left: 2px solid #40B8B0;
}

.bracket-corner.br {
    bottom: -1px;
    right: -1px;
    border-bottom: 2px solid #40B8B0;
    border-right: 2px solid #40B8B0;
}

.hud-panel:hover .bracket-corner {
    border-color: #D4A040;
}

/* --- Scan Line --- */
.scan-line {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, #40B8B0, transparent);
    opacity: 0;
    transform: translateY(0);
    pointer-events: none;
    z-index: 5;
}

.hud-panel.scanning .scan-line {
    opacity: 0.7;
    animation: scanSweep 2s ease-in-out forwards;
}

.hud-panel:hover .scan-line {
    opacity: 0.5;
    animation: scanSweep 1.5s ease-in-out;
}

@keyframes scanSweep {
    0% {
        transform: translateY(0);
        opacity: 0.7;
    }
    90% {
        opacity: 0.7;
    }
    100% {
        transform: translateY(calc(100% + 200px));
        opacity: 0;
    }
}

/* --- Panel Content --- */
.panel-content {
    position: relative;
    z-index: 2;
}

.panel-content .panel-body {
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.4s ease 0.3s, transform 0.4s ease 0.3s;
}

.hud-panel.revealed .panel-content .panel-body {
    opacity: 1;
    transform: translateY(0);
}

/* Typography */
.site-title {
    font-family: 'Playfair Display', serif;
    font-size: clamp(2.2rem, 5vw, 4rem);
    font-weight: 700;
    letter-spacing: 0.02em;
    color: #E0EAF5;
    margin-bottom: 12px;
}

.site-title .teal {
    color: #40B8B0;
}

.subtitle {
    font-family: 'Work Sans', sans-serif;
    font-size: 1.1rem;
    font-weight: 400;
    color: #7080C0;
    margin-bottom: 16px;
    letter-spacing: 0.05em;
}

.hud-label {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.75rem;
    font-weight: 400;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: #64A0DC;
    margin-bottom: 16px;
}

.panel-title {
    font-family: 'Playfair Display', serif;
    font-size: clamp(1.8rem, 3.5vw, 3rem);
    font-weight: 700;
    letter-spacing: 0.02em;
    color: #E0EAF5;
    margin-bottom: 8px;
}

.panel-body {
    font-family: 'Work Sans', sans-serif;
    font-size: 0.95rem;
    line-height: 1.75;
    font-weight: 400;
    color: #A0B8D0;
}

/* --- Polaroid Frame Style --- */
.polaroid-frame {
    background: #E0EAF5;
    border-radius: 3px;
    padding: 12px 12px 48px 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4), 2px 3px 8px rgba(0, 0, 0, 0.2);
    position: relative;
    opacity: 0;
    transform: translateY(30px) rotate(-0.5deg);
    max-width: 700px;
    margin: 0 auto;
}

.polaroid-frame:nth-of-type(even) {
    transform: translateY(30px) rotate(0.8deg);
}

.polaroid-frame.visible {
    opacity: 1;
    transform: translateY(0) rotate(-0.5deg);
    transition: opacity 0.5s ease, transform 0.6s ease;
}

.polaroid-frame:nth-of-type(even).visible {
    transform: translateY(0) rotate(0.8deg);
}

.polaroid-inner {
    position: relative;
    overflow: hidden;
    border-radius: 2px;
    min-height: 280px;
    background: linear-gradient(180deg, #0C1420 0%, #142030 60%, #1C2840 100%);
}

.polaroid-landscape {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.polaroid-ridge {
    position: absolute;
    bottom: 0;
    left: -5%;
    width: 110%;
}

.polaroid-ridge.ridge-1 {
    height: 40%;
    background: #142030;
    clip-path: polygon(
        0% 100%,
        0% 50%,
        10% 35%,
        20% 45%,
        30% 30%,
        40% 40%,
        50% 25%,
        60% 35%,
        70% 28%,
        80% 40%,
        90% 30%,
        100% 42%,
        100% 100%
    );
}

.polaroid-ridge.ridge-2 {
    height: 30%;
    background: #1C2840;
    clip-path: polygon(
        0% 100%,
        0% 55%,
        12% 45%,
        25% 55%,
        38% 40%,
        50% 50%,
        62% 42%,
        75% 55%,
        88% 45%,
        100% 52%,
        100% 100%
    );
}

.polaroid-hud-overlay {
    position: relative;
    z-index: 2;
    padding: 28px 24px;
}

.polaroid-hud-overlay .panel-title {
    color: #E0EAF5;
    text-shadow: 0 1px 8px rgba(0, 0, 0, 0.6);
}

.polaroid-hud-overlay .hud-label {
    color: #40B8B0;
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.5);
}

.polaroid-hud-overlay .panel-body {
    color: #A0B8D0;
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.5);
    font-size: 0.9rem;
}

.polaroid-caption {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #E0EAF5;
}

.caption-text {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.7rem;
    font-weight: 400;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #1C2840;
    opacity: 0.6;
}

/* --- Status Grid (System Status Panel) --- */
.status-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 12px;
    margin-top: 16px;
}

.status-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    background: rgba(12, 20, 32, 0.4);
    border-radius: 3px;
    border: 1px solid rgba(100, 160, 220, 0.1);
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.status-dot.active {
    background: #40B8B0;
    box-shadow: 0 0 6px rgba(64, 184, 176, 0.5);
    animation: dotPulse 2s ease-in-out infinite;
}

.status-dot.warn {
    background: #D4A040;
    box-shadow: 0 0 6px rgba(212, 160, 64, 0.5);
    animation: dotPulse 1.2s ease-in-out infinite;
}

@keyframes dotPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.status-name {
    font-family: 'Work Sans', sans-serif;
    font-size: 0.85rem;
    color: #A0B8D0;
    flex: 1;
}

.status-value {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.7rem;
    font-weight: 500;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: #40B8B0;
}

.status-item:last-child .status-value {
    color: #D4A040;
}

/* --- Bottom Telemetry Bar --- */
#telemetry-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 60px;
    z-index: 100;
    background: linear-gradient(180deg, rgba(12, 20, 32, 0.85) 0%, rgba(12, 20, 32, 0.95) 100%);
    border-top: 1px solid rgba(100, 160, 220, 0.2);
    display: flex;
    align-items: center;
    padding: 0 24px;
    gap: 20px;
    transform: translateY(100%);
    animation: telemetrySlideUp 500ms ease-out 1.7s forwards;
    backdrop-filter: blur(8px);
}

@keyframes telemetrySlideUp {
    to { transform: translateY(0); }
}

.telemetry-section {
    display: flex;
    align-items: center;
    gap: 8px;
}

.telemetry-label {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.65rem;
    font-weight: 500;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: rgba(100, 160, 220, 0.6);
    min-width: 28px;
}

.sparkline {
    display: block;
    opacity: 0.8;
}

.telemetry-value {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.75rem;
    font-weight: 400;
    letter-spacing: 0.05em;
    color: #E0EAF5;
    min-width: 36px;
    text-align: right;
}

.telemetry-divider {
    width: 1px;
    height: 30px;
    background: rgba(100, 160, 220, 0.2);
    flex-shrink: 0;
}

/* Gauge Section */
.gauge-section {
    display: flex;
    gap: 12px;
}

.gauge {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}

.gauge-svg {
    width: 30px;
    height: 30px;
}

.gauge-fill {
    transition: stroke-dasharray 0.5s ease;
}

.gauge-label {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.55rem;
    font-weight: 400;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: rgba(100, 160, 220, 0.5);
}

/* Status Dots in Telemetry */
.status-dots-section {
    display: flex;
    gap: 6px;
    align-items: center;
}

.status-dot-small {
    width: 6px;
    height: 6px;
    border-radius: 50%;
}

.status-dot-small.active {
    background: #40B8B0;
    box-shadow: 0 0 4px rgba(64, 184, 176, 0.5);
}

.status-dot-small.warn {
    background: #D4A040;
    box-shadow: 0 0 4px rgba(212, 160, 64, 0.5);
    animation: dotPulse 1.2s ease-in-out infinite;
}

/* System Message */
.telemetry-message {
    margin-left: auto;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.7rem;
    font-weight: 400;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #40B8B0;
    opacity: 0;
    animation: systemReady 0.5s ease-out 2.8s forwards;
}

@keyframes systemReady {
    0% { opacity: 0; }
    50% { opacity: 1; }
    100% { opacity: 1; }
}

/* System message blinking after initial display */
.telemetry-message.blink {
    animation: messageBlink 3s ease-in-out;
}

@keyframes messageBlink {
    0% { opacity: 1; }
    10% { opacity: 0; }
    20% { opacity: 1; }
    30% { opacity: 0; }
    40% { opacity: 1; }
    100% { opacity: 1; }
}

/* --- Responsive Design --- */
@media (max-width: 1024px) {
    #hud-grid {
        grid-template-columns: 1fr;
    }

    .status-strip {
        display: none;
    }

    #central-viewport {
        grid-column: 1;
        padding: 60px 20px 80px;
    }

    .polaroid-frame {
        max-width: 100%;
    }
}

@media (max-width: 768px) {
    #central-viewport {
        padding: 40px 16px 80px;
        gap: 40px;
    }

    .hud-panel {
        padding: 24px 20px;
    }

    .site-title {
        font-size: clamp(1.8rem, 8vw, 2.8rem);
    }

    .panel-title {
        font-size: clamp(1.4rem, 5vw, 2rem);
    }

    .ridge-far {
        display: none;
    }

    .ridge-mid {
        height: 22vh;
    }

    #telemetry-bar {
        height: 44px;
        padding: 0 12px;
        gap: 10px;
    }

    .telemetry-section:nth-child(n+4) {
        display: none;
    }

    .gauge-section {
        display: none;
    }

    .status-dots-section {
        display: none;
    }

    .telemetry-divider {
        display: none;
    }

    .sparkline {
        width: 50px;
    }

    .status-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    #central-viewport {
        padding: 30px 12px 70px;
        gap: 30px;
    }

    .hud-panel {
        padding: 20px 16px;
    }

    .polaroid-frame {
        padding: 8px 8px 40px 8px;
    }

    .polaroid-inner {
        min-height: 220px;
    }

    .polaroid-hud-overlay {
        padding: 20px 16px;
    }
}

/* --- Utility Classes --- */
.hidden {
    display: none;
}

/* Subtle background gradient overlay for depth */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(ellipse at 50% 30%, rgba(100, 160, 220, 0.03) 0%, transparent 70%);
    pointer-events: none;
    z-index: 1;
}

/* HUD grid lines subtle overlay */
body::after {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image:
        linear-gradient(rgba(100, 160, 220, 0.02) 1px, transparent 1px),
        linear-gradient(90deg, rgba(100, 160, 220, 0.02) 1px, transparent 1px);
    background-size: 60px 60px;
    pointer-events: none;
    z-index: 1;
}
