/* ===========================================
   lune.dev — Lunar Observatory Styles
   =========================================== */

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

:root {
    --midnight-velvet: #1a1730;
    --dusk-plum: #2a2344;
    --honey-lantern: #d4be98;
    --aged-parchment: #e8dcc8;
    --candle-glow: #f0c862;
    --moonstone: #8b9dc3;
    --crater-red: #c45c5c;
    --surface-frost: rgba(42, 35, 68, 0.45);
    --ghost-wire: rgba(212, 190, 152, 0.15);
}

html {
    scroll-behavior: smooth;
}

body.lune-observatory {
    background: var(--midnight-velvet);
    color: var(--aged-parchment);
    font-family: 'Nunito Sans', sans-serif;
    font-weight: 400;
    font-size: clamp(1rem, 1.15vw, 1.125rem);
    line-height: 1.72;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

/* --- Background Canvas (z-0) --- */
.bg-canvas {
    position: fixed;
    inset: 0;
    z-index: 0;
    background: radial-gradient(ellipse at 75% 25%, #2a2344 0%, #1a1730 70%);
}

.bg-noise {
    position: absolute;
    inset: 0;
    opacity: 0.02;
    filter: url(#noiseFilter);
    background: white;
    pointer-events: none;
}

.noise-filter {
    position: absolute;
    width: 0;
    height: 0;
}

/* --- Floating Motes --- */
.mote {
    position: fixed;
    width: 2px;
    height: 2px;
    border-radius: 50%;
    background: var(--honey-lantern);
    opacity: 0;
    left: var(--x-start);
    top: var(--y-start);
    will-change: transform;
    contain: layout style;
    animation: mote-drift var(--duration) var(--delay) infinite linear;
    pointer-events: none;
    z-index: 1;
}

.mote:nth-child(odd) {
    width: 3px;
    height: 3px;
}

@keyframes mote-drift {
    0% {
        transform: translate(0, 0);
        opacity: 0;
    }
    10% {
        opacity: 0.12;
    }
    50% {
        opacity: 0.15;
    }
    90% {
        opacity: 0.08;
    }
    100% {
        transform: translate(
            calc(var(--x-end) - var(--x-start)),
            calc(var(--y-end) - var(--y-start))
        );
        opacity: 0;
    }
}

/* --- Circuit Traces (z-5) --- */
.circuit-traces {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 5;
    pointer-events: none;
}

.circuit-traces path {
    fill: none;
    stroke: var(--honey-lantern);
    stroke-width: 1;
    opacity: 0.2;
}

.circuit-traces .junction {
    fill: var(--honey-lantern);
    opacity: 0.3;
}

.circuit-traces .junction--key {
    animation: junction-pulse 4s ease-in-out infinite;
}

@keyframes junction-pulse {
    0%, 100% { opacity: 0.2; }
    50% { opacity: 0.5; }
}

/* --- HUD Chrome (z-20) --- */
.hud-chrome {
    position: fixed;
    inset: 0;
    z-index: 20;
    pointer-events: none;
}

.hud-bracket {
    position: absolute;
    width: 12px;
    height: 12px;
    border-color: var(--honey-lantern);
    border-style: solid;
    opacity: 0.3;
}

.hud-bracket--tl {
    top: 24px;
    left: 24px;
    border-width: 1px 0 0 1px;
}

.hud-bracket--tr {
    top: 24px;
    right: 72px;
    border-width: 1px 1px 0 0;
}

.hud-bracket--bl {
    bottom: 24px;
    left: 24px;
    border-width: 0 0 1px 1px;
}

.hud-bracket--br {
    bottom: 24px;
    right: 72px;
    border-width: 0 1px 1px 0;
}

.hud-status {
    position: absolute;
    display: flex;
    align-items: center;
    gap: 8px;
}

.hud-status::before {
    content: '';
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: var(--candle-glow);
    animation: junction-pulse 4s ease-in-out infinite;
}

.hud-status--1 {
    top: 28px;
    left: 48px;
}

.hud-status--2 {
    bottom: 28px;
    left: 48px;
}

.hud-status--3 {
    top: 28px;
    right: 96px;
}

.hud-label {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.7rem;
    font-weight: 400;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--honey-lantern);
    opacity: 0.4;
}

.hud-line--top {
    position: absolute;
    top: 48px;
    left: 40px;
    right: 88px;
    height: 1px;
    background: var(--ghost-wire);
}

.hud-line--bottom {
    position: absolute;
    bottom: 48px;
    left: 40px;
    right: 88px;
    height: 1px;
    background: var(--ghost-wire);
}

.hud-dot {
    position: absolute;
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: var(--honey-lantern);
    opacity: 0.25;
    animation: junction-pulse 4s ease-in-out infinite;
}

.hud-dot--1 { top: 46px; left: 40px; }
.hud-dot--2 { top: 46px; right: 88px; }
.hud-dot--3 { bottom: 46px; left: 40px; }
.hud-dot--4 { bottom: 46px; right: 88px; }

/* --- Nav Strip (z-30) --- */
.nav-strip {
    position: fixed;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    z-index: 30;
    display: flex;
    flex-direction: column;
    gap: 24px;
    padding: 16px;
    align-items: flex-end;
}

.nav-dot {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    cursor: pointer;
    text-decoration: none;
}

.nav-dot::after {
    content: '';
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--honey-lantern);
    opacity: 0.35;
    transition: all 0.4s ease;
    flex-shrink: 0;
}

.nav-dot:hover::after,
.nav-dot.active::after {
    width: 14px;
    height: 14px;
    opacity: 1;
    box-shadow: 0 0 12px rgba(240, 200, 98, 0.5);
}

.nav-label {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.7rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--honey-lantern);
    opacity: 0;
    white-space: nowrap;
    margin-right: 12px;
    transform: translateX(10px);
    transition: all 0.3s ease;
    pointer-events: none;
}

.nav-dot:hover .nav-label {
    opacity: 0.8;
    transform: translateX(0);
}

/* --- Content Plane (z-10) --- */
.content-plane {
    position: relative;
    z-index: 10;
}

/* --- Glass Panel Base --- */
.glass-panel {
    background: var(--surface-frost);
    backdrop-filter: blur(24px) saturate(1.2);
    -webkit-backdrop-filter: blur(24px) saturate(1.2);
    border: 1px solid var(--ghost-wire);
    border-radius: 8px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(212, 190, 152, 0.08);
    padding: 2.5rem 3rem;
    transform: perspective(800px) rotateX(var(--tilt-x, 0deg)) rotateY(var(--tilt-y, 0deg));
    opacity: 0;
    transition: transform 0.8s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.8s ease, border-color 0.3s ease;
}

.glass-panel.settled {
    transform: perspective(800px) rotateX(0deg) rotateY(0deg);
    opacity: 1;
}

.glass-panel:hover {
    border-color: rgba(212, 190, 152, 0.35);
}

/* --- Typography --- */
h1, h2 {
    font-family: 'Cormorant Garamond', serif;
    color: var(--honey-lantern);
    letter-spacing: 0.04em;
}

h2 {
    font-weight: 600;
    font-size: clamp(1.8rem, 3.5vw, 3rem);
    margin-bottom: 1.2rem;
}

p {
    max-width: 38em;
}

p + p {
    margin-top: 1rem;
}

/* --- Hero Section --- */
.hero-section {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.glass-panel--hero {
    position: relative;
    text-align: center;
    max-width: 700px;
    padding: 4rem 5rem;
    overflow: hidden;
}

.hero-border-glow {
    position: absolute;
    inset: -2px;
    border-radius: 10px;
    background: conic-gradient(from 0deg, #d4be98, #f0c862, #8b9dc3, #d4be98);
    z-index: -1;
    animation: border-rotate 30s linear infinite;
    opacity: 0.5;
}

@keyframes border-rotate {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.glass-panel--hero::before {
    content: '';
    position: absolute;
    inset: 1px;
    background: var(--surface-frost);
    backdrop-filter: blur(24px) saturate(1.2);
    -webkit-backdrop-filter: blur(24px) saturate(1.2);
    border-radius: 7px;
    z-index: -1;
}

.hero-title {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 300;
    font-size: clamp(3rem, 6vw, 5.5rem);
    color: var(--honey-lantern);
    letter-spacing: 0.04em;
    margin-bottom: 0.5rem;
}

.hero-subtitle {
    font-family: 'Nunito Sans', sans-serif;
    font-weight: 300;
    font-size: clamp(0.95rem, 1.2vw, 1.1rem);
    color: var(--aged-parchment);
    opacity: 0.8;
    line-height: 1.8;
}

/* --- Narrative Sections --- */
.narrative {
    min-height: 100vh;
    display: flex;
    align-items: center;
    padding: 6rem 8vw;
    gap: 2rem;
    position: relative;
    flex-wrap: wrap;
}

.glass-panel--primary {
    max-width: 60vw;
    flex: 1 1 500px;
}

.glass-panel--wide {
    max-width: 70vw;
    flex: 1 1 100%;
}

.glass-panel--aux {
    flex: 0 0 200px;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    text-align: center;
}

.aux-label {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.7rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--moonstone);
    opacity: 0.7;
}

.aux-value {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 300;
    font-size: 2.2rem;
    color: var(--candle-glow);
    letter-spacing: 0.04em;
}

.aux-detail {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.65rem;
    letter-spacing: 0.08em;
    color: var(--aged-parchment);
    opacity: 0.5;
}

/* --- Moon Phase Icons --- */
.phase-icon {
    position: absolute;
    top: 2rem;
    right: 80px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--honey-lantern);
    opacity: 0.3;
}

.phase--waxing-crescent {
    box-shadow: inset 6px 0 0 0 var(--midnight-velvet);
}

.phase--first-quarter {
    box-shadow: inset 10px 0 0 0 var(--midnight-velvet);
}

.phase--full {
    box-shadow: none;
    opacity: 0.4;
}

/* --- Closing Section --- */
.closing-section {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    background: radial-gradient(ellipse at 25% 75%, rgba(42, 35, 68, 0.4) 0%, transparent 70%);
}

.glass-panel--closing {
    text-align: center;
    max-width: 600px;
    padding: 4rem 5rem;
}

.closing-text {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 300;
    font-size: clamp(1.4rem, 2.5vw, 2rem);
    color: var(--honey-lantern);
    letter-spacing: 0.04em;
    line-height: 1.7;
}

/* --- Responsive --- */
@media (max-width: 768px) {
    .narrative {
        padding: 4rem 5vw;
        flex-direction: column;
    }

    .glass-panel--primary,
    .glass-panel--wide {
        max-width: 100%;
    }

    .glass-panel--aux {
        flex: 0 0 auto;
        width: 100%;
    }

    .glass-panel {
        padding: 2rem;
    }

    .glass-panel--hero,
    .glass-panel--closing {
        padding: 3rem 2rem;
    }

    .hud-bracket--tr,
    .hud-bracket--br,
    .hud-status--3 {
        right: 56px;
    }

    .hud-line--top,
    .hud-line--bottom {
        right: 56px;
    }

    .hud-dot--2,
    .hud-dot--4 {
        right: 56px;
    }

    .phase-icon {
        right: 60px;
    }
}
