/* ============================================================
   ringworld.quest — Sci-Fi HUD Overlay Stylesheet
   Palette: #0a0e17 #2a3040 #00d4ff #ffd54f #1a6b5a #e8edf5
   Fonts: Orbitron/Space Odyssey (display), Exo 2 (body), Share Tech Mono (data)
   Note: "Space Odyssey" aesthetic mapped to Orbitron (Google Fonts substitute)
   ============================================================ */

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

:root {
    --void-black:     #0a0e17;
    --ring-steel:     #2a3040;
    --halo-cyan:      #00d4ff;
    --solar-gold:     #ffd54f;
    --atmo-teal:      #1a6b5a;
    --hull-white:     #e8edf5;
    --panel-bg:       rgba(42, 48, 64, 0.72);
    --panel-border:   rgba(0, 212, 255, 0.30);
    --panel-clip:     polygon(0 0, calc(100% - 16px) 0, 100% 16px, 100% 100%, 16px 100%, 0 calc(100% - 16px));
    --font-display:   'Orbitron', 'Inter', sans-serif;
    --font-body:      'Exo 2', 'Inter', sans-serif;
    --font-mono:      'Share Tech Mono', 'Courier New', monospace;
}

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: var(--void-black);
    color: var(--hull-white);
    font-family: var(--font-body);
    font-weight: 300;
    line-height: 1.7;
}

/* ── Star Field Background (CSS only) ─────────────────────── */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    z-index: 0;
    background-image:
        radial-gradient(1px 1px at 15%  8%,  rgba(232,237,245,0.8) 0%, transparent 100%),
        radial-gradient(1px 1px at 73%  17%, rgba(232,237,245,0.6) 0%, transparent 100%),
        radial-gradient(1px 1px at 42%  3%,  rgba(232,237,245,0.9) 0%, transparent 100%),
        radial-gradient(1px 1px at 88%  62%, rgba(232,237,245,0.5) 0%, transparent 100%),
        radial-gradient(1px 1px at 5%   45%, rgba(232,237,245,0.7) 0%, transparent 100%),
        radial-gradient(1px 1px at 61%  78%, rgba(232,237,245,0.4) 0%, transparent 100%),
        radial-gradient(1px 1px at 30%  55%, rgba(232,237,245,0.6) 0%, transparent 100%),
        radial-gradient(1px 1px at 95%  28%, rgba(232,237,245,0.8) 0%, transparent 100%),
        radial-gradient(2px 2px at 52%  40%, rgba(0,212,255,0.3)   0%, transparent 100%),
        radial-gradient(1px 1px at 80%  90%, rgba(232,237,245,0.5) 0%, transparent 100%),
        radial-gradient(1px 1px at 20%  85%, rgba(232,237,245,0.6) 0%, transparent 100%),
        radial-gradient(2px 2px at 67%  50%, rgba(255,213,79,0.2)  0%, transparent 100%),
        radial-gradient(1px 1px at 38%  70%, rgba(232,237,245,0.4) 0%, transparent 100%),
        radial-gradient(1px 1px at 10%  30%, rgba(232,237,245,0.7) 0%, transparent 100%),
        radial-gradient(1px 1px at 55%  15%, rgba(232,237,245,0.9) 0%, transparent 100%),
        radial-gradient(1px 1px at 90%  48%, rgba(232,237,245,0.5) 0%, transparent 100%),
        radial-gradient(2px 2px at 25%  22%, rgba(0,212,255,0.25)  0%, transparent 100%),
        radial-gradient(1px 1px at 47%  92%, rgba(232,237,245,0.3) 0%, transparent 100%),
        radial-gradient(1px 1px at 78%  35%, rgba(232,237,245,0.6) 0%, transparent 100%),
        radial-gradient(1px 1px at 3%   68%, rgba(232,237,245,0.7) 0%, transparent 100%),
        radial-gradient(1px 1px at 85%  12%, rgba(232,237,245,0.5) 0%, transparent 100%),
        radial-gradient(1px 1px at 33%  38%, rgba(232,237,245,0.4) 0%, transparent 100%),
        radial-gradient(2px 2px at 60%  25%, rgba(232,237,245,0.3) 0%, transparent 100%),
        radial-gradient(1px 1px at 14%  58%, rgba(232,237,245,0.6) 0%, transparent 100%),
        radial-gradient(1px 1px at 97%  75%, rgba(232,237,245,0.4) 0%, transparent 100%);
    pointer-events: none;
}

/* ── Parallax Background Layers ───────────────────────────── */
.bg-layer {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 1;
    will-change: transform;
    transition: transform 0.05s linear;
}

#bg-layer-stars {
    background:
        radial-gradient(ellipse 200% 60% at 50% 100%, rgba(26, 107, 90, 0.08) 0%, transparent 60%),
        radial-gradient(ellipse 100% 40% at 20% 80%, rgba(0,212,255,0.03) 0%, transparent 50%);
}

#bg-layer-ring {
    background:
        radial-gradient(ellipse 120% 30% at 50% 85%, rgba(26,107,90,0.12) 0%, transparent 70%),
        linear-gradient(to bottom, transparent 70%, rgba(42,48,64,0.15) 100%);
}

#bg-layer-haze {
    background:
        radial-gradient(ellipse 80% 20% at 50% 90%, rgba(0,212,255,0.06) 0%, transparent 100%),
        linear-gradient(to bottom, transparent 80%, rgba(26,107,90,0.08) 100%);
}

/* ── Horizon SVG ──────────────────────────────────────────── */
#horizon-svg {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 35vh;
    z-index: 2;
    pointer-events: none;
}

/* ── Scan-Line Overlay ────────────────────────────────────── */
#scanline-overlay {
    position: fixed;
    inset: 0;
    z-index: 3;
    pointer-events: none;
    background: repeating-linear-gradient(
        to bottom,
        transparent 0px,
        transparent 1px,
        rgba(0, 212, 255, 0.025) 1px,
        rgba(0, 212, 255, 0.025) 2px
    );
    animation: scanline-scroll 8s linear infinite;
}

@keyframes scanline-scroll {
    0%   { background-position: 0 0; }
    100% { background-position: 0 100px; }
}

/* ── Progress Ring Indicator ──────────────────────────────── */
#progress-container {
    position: fixed;
    top: 1rem;
    left: 50%;
    transform: translateX(-50%);
    z-index: 20;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.3rem;
    pointer-events: none;
}

#progress-svg {
    display: block;
    width: 80vw;
    height: 40px;
    overflow: visible;
}

#position-readout {
    font-family: var(--font-mono);
    font-size: 0.65rem;
    color: rgba(232, 237, 245, 0.5);
    letter-spacing: 0.1em;
    text-align: center;
}

/* ── Main Horizontal Scroll Container ─────────────────────── */
#ring-scroll {
    position: relative;
    z-index: 10;
    width: 100vw;
    height: 100vh;
    overflow-x: scroll;
    overflow-y: hidden;
    scroll-snap-type: x mandatory;
    display: flex;
    flex-direction: row;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

#ring-scroll::-webkit-scrollbar {
    display: none;
}

/* ── Ring Sections ────────────────────────────────────────── */
.ring-section {
    position: relative;
    flex: 0 0 100vw;
    width: 100vw;
    height: 100vh;
    scroll-snap-align: start;
    display: flex;
    align-items: stretch;
    overflow: hidden;
}

.section-inner {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4rem 2rem 2rem;
    gap: 2rem;
}

/* Split layout 60/40 */
.split-60-40 {
    flex-direction: row;
    align-items: stretch;
    padding: 4rem 2rem 2rem;
    gap: 0;
}

.visual-half {
    flex: 0 0 60%;
    position: relative;
    overflow: hidden;
}

.data-half {
    flex: 0 0 40%;
    display: flex;
    align-items: center;
    padding: 1rem 1.5rem;
}

/* ── HUD Panel ────────────────────────────────────────────── */
.hud-panel {
    background: var(--panel-bg);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    clip-path: var(--panel-clip);
    border: 1px solid var(--panel-border);
    position: relative;
    padding: 1.5rem;
}

.hud-panel::before {
    content: '';
    position: absolute;
    inset: 0;
    background: repeating-linear-gradient(
        to bottom,
        transparent 0px,
        transparent 1px,
        rgba(0, 212, 255, 0.02) 1px,
        rgba(0, 212, 255, 0.02) 2px
    );
    animation: panel-scanlines 6s linear infinite;
    pointer-events: none;
    z-index: 0;
}

@keyframes panel-scanlines {
    0%   { background-position: 0 0; }
    100% { background-position: 0 80px; }
}

.hud-panel > * {
    position: relative;
    z-index: 1;
}

/* ── HUD Header ───────────────────────────────────────────── */
.hud-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.65rem;
    letter-spacing: 0.15em;
    border-bottom: 1px solid rgba(0, 212, 255, 0.15);
    padding-bottom: 0.5rem;
    margin-bottom: 1rem;
    text-transform: uppercase;
}

/* ── Typography Utilities ─────────────────────────────────── */
.mono {
    font-family: var(--font-mono);
    font-size: 0.8rem;
}

.mono-label {
    font-family: var(--font-mono);
    font-size: 0.7rem;
}

.cyan  { color: var(--halo-cyan); }
.gold  { color: var(--solar-gold); }
.dim   { color: rgba(232, 237, 245, 0.4); }

/* ── Display Title (Hero) ─────────────────────────────────── */
.display-title {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: clamp(2rem, 4vw, 3.5rem);
    letter-spacing: 0.15em;
    text-transform: uppercase;
    line-height: 1.1;
    color: var(--hull-white);
    margin-bottom: 0.8rem;
}

.display-title .cyan {
    text-shadow: 0 0 20px rgba(0, 212, 255, 0.6);
}

/* ── Section Title ────────────────────────────────────────── */
.section-title {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: clamp(1.4rem, 2.5vw, 2.2rem);
    letter-spacing: 0.15em;
    text-transform: uppercase;
    line-height: 1.1;
    color: var(--hull-white);
    margin-bottom: 1rem;
}

/* ── Hero Panel ───────────────────────────────────────────── */
#sec-hero .section-inner {
    flex-direction: row;
    align-items: center;
    padding: 5rem 3rem 2rem;
    gap: 3rem;
}

.hero-panel {
    flex: 0 0 45%;
    min-width: 340px;
}

.hero-tagline {
    font-family: var(--font-body);
    font-weight: 300;
    font-size: 0.9rem;
    color: rgba(232, 237, 245, 0.75);
    margin-bottom: 1.5rem;
    line-height: 1.7;
}

.hud-data-row {
    display: flex;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.data-item {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.data-label {
    font-family: var(--font-mono);
    font-size: 0.6rem;
    color: rgba(232, 237, 245, 0.4);
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.data-value {
    font-family: var(--font-mono);
    font-size: 0.85rem;
    font-weight: 400;
    letter-spacing: 0.05em;
}

.scroll-hint {
    font-size: 0.7rem;
    letter-spacing: 0.2em;
    color: rgba(232, 237, 245, 0.5);
    animation: pulse-hint 2.5s ease-in-out infinite;
}

@keyframes pulse-hint {
    0%, 100% { opacity: 0.5; }
    50%       { opacity: 1; }
}

/* ── Ring Cross-Section Diagram ───────────────────────────── */
.ring-diagram-container {
    flex: 1 1 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 300px;
    max-width: 55%;
}

#ring-diagram {
    width: 100%;
    height: auto;
    max-height: 75vh;
    overflow: visible;
}

/* SVG animated path draw */
.diag-label {
    font-family: var(--font-mono);
    font-size: 10px;
    letter-spacing: 0.05em;
}

.diag-label-title {
    font-family: var(--font-mono);
    font-size: 9px;
    letter-spacing: 0.1em;
}

/* Path draw animations */
#rdiag-outer-top,
#rdiag-inner-top,
#rdiag-rim-left,
#rdiag-rim-right,
#rdiag-shadow1,
#rdiag-shadow2,
#rdiag-shadow3,
#rdiag-cable1,
#rdiag-cable2,
#rdiag-cable3,
#rdiag-earth,
#rdiag-star {
    stroke-dasharray: 2000;
    stroke-dashoffset: 2000;
    animation: draw-path 0.8s ease forwards;
}

#rdiag-outer-top  { animation-delay: 0.0s; }
#rdiag-inner-top  { animation-delay: 0.4s; }
#rdiag-rim-left   { animation-delay: 0.8s; }
#rdiag-rim-right  { animation-delay: 0.8s; }
#rdiag-shadow1    { animation-delay: 1.2s; }
#rdiag-shadow2    { animation-delay: 1.6s; }
#rdiag-shadow3    { animation-delay: 2.0s; }
#rdiag-cable1     { animation-delay: 2.0s; }
#rdiag-cable2     { animation-delay: 2.0s; }
#rdiag-cable3     { animation-delay: 2.0s; }
#rdiag-earth      { animation-delay: 2.4s; }
#rdiag-star       { animation-delay: 2.8s; }

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

/* ── Spec List (Data Panels) ──────────────────────────────── */
.spec-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.spec-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    padding: 0.3rem 0;
    border-bottom: 1px solid rgba(0, 212, 255, 0.07);
    font-size: 0.8rem;
}

.spec-label {
    font-family: var(--font-mono);
    font-size: 0.65rem;
    color: rgba(232, 237, 245, 0.45);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    flex: 0 0 auto;
    white-space: nowrap;
}

.spec-value {
    font-family: var(--font-body);
    font-weight: 500;
    font-size: 0.8rem;
    color: var(--hull-white);
    text-align: right;
    flex: 1;
}

.warning-tag {
    font-family: var(--font-mono);
    font-size: 0.65rem;
    letter-spacing: 0.1em;
    color: rgba(232, 237, 245, 0.5);
    border-top: 1px solid rgba(0, 212, 255, 0.1);
    padding-top: 0.5rem;
    margin-top: 0.5rem;
    text-transform: uppercase;
}

/* ── Data Panel (full) ────────────────────────────────────── */
.data-panel {
    width: 100%;
}

/* ── Section SVGs ─────────────────────────────────────────── */
.section-svg {
    width: 100%;
    height: 100%;
    max-height: 85vh;
}

.full-svg {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.ring-visual-bg {
    position: absolute;
    inset: 0;
    background:
        linear-gradient(135deg, rgba(26,107,90,0.12) 0%, transparent 50%),
        linear-gradient(to bottom, rgba(10,14,23,0.4) 0%, transparent 100%);
}

/* ── Scale Comparison Section ─────────────────────────────── */
#sec-scale .section-inner {
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    padding: 5rem 4rem 3rem;
    gap: 1.5rem;
}

.scale-panel {
    max-width: 500px;
}

.scale-viz {
    width: 100%;
}

.scale-bar-container {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    width: 100%;
    max-width: 700px;
}

.scale-bar-row {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.scale-bar-label {
    font-family: var(--font-mono);
    font-size: 0.65rem;
    letter-spacing: 0.08em;
    color: rgba(232, 237, 245, 0.5);
    text-transform: uppercase;
    flex: 0 0 180px;
    white-space: nowrap;
}

.scale-bar-track {
    flex: 1;
    height: 4px;
    background: rgba(42, 48, 64, 0.8);
    border: 1px solid rgba(0, 212, 255, 0.1);
    overflow: hidden;
    position: relative;
}

.scale-bar-fill {
    height: 100%;
    background: var(--halo-cyan);
    width: 0;
    animation: bar-fill 1.5s ease forwards;
    animation-delay: 0.5s;
    transform-origin: left;
}

.scale-bar-fill.overflow-bar {
    background: var(--solar-gold);
    box-shadow: 0 0 8px rgba(255, 213, 79, 0.5);
}

@keyframes bar-fill {
    to { width: var(--target-width, 100%); }
}

.scale-bar-value {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    letter-spacing: 0.05em;
    flex: 0 0 80px;
    text-align: right;
}

.scale-annotation-row {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.annotation-card {
    padding: 1rem 1.2rem;
    min-width: 140px;
}

.ann-value {
    font-family: var(--font-display);
    font-size: 1.2rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    line-height: 1.2;
}

.ann-label {
    font-family: var(--font-mono);
    font-size: 0.6rem;
    color: rgba(232, 237, 245, 0.4);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    margin-top: 0.3rem;
}

/* ── Atmosphere Visual Section ────────────────────────────── */
.atmo-visual {
    overflow: hidden;
    position: relative;
}

/* ── Navigation Grid Section ──────────────────────────────── */
#sec-navigation .section-inner {
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 5rem 3rem 2rem;
    gap: 1.5rem;
}

.nav-panel {
    max-width: 500px;
    align-self: flex-start;
}

.nav-grid-container {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.nav-grid-svg {
    width: 100%;
    max-width: 900px;
    height: auto;
}

.coord-readouts {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    justify-content: center;
}

.coord-item {
    padding: 0.7rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    min-width: 180px;
}

.coord-value {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    letter-spacing: 0.08em;
    font-weight: 700;
}

/* Navigation pulse animation */
.nav-pulse {
    animation: nav-ring-pulse 2s ease-out infinite;
}

@keyframes nav-ring-pulse {
    0%   { r: 6;  opacity: 0.8; }
    100% { r: 30; opacity: 0; }
}

/* ── Quest Section ────────────────────────────────────────── */
#sec-quest .section-inner {
    flex-direction: row;
    align-items: center;
    justify-content: center;
    padding: 4rem 3rem 3rem;
}

.quest-panel {
    max-width: 700px;
    width: 100%;
}

.center-panel {
    margin: 0 auto;
}

.quest-body {
    display: flex;
    flex-direction: column;
    gap: 1.2rem;
}

.quest-text {
    font-family: var(--font-body);
    font-weight: 300;
    font-size: 0.9rem;
    color: rgba(232, 237, 245, 0.75);
    line-height: 1.8;
}

.mission-params {
    display: flex;
    flex-direction: column;
    gap: 0.7rem;
}

.mission-item {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    padding: 0.5rem 0;
    border-bottom: 1px solid rgba(0, 212, 255, 0.08);
}

.mission-icon {
    font-family: var(--font-mono);
    font-size: 0.85rem;
    font-weight: 700;
    flex: 0 0 24px;
    margin-top: 0.15rem;
}

.mission-text {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.mission-title {
    font-family: var(--font-display);
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--hull-white);
}

.mission-sub {
    font-family: var(--font-mono);
    font-size: 0.62rem;
    color: rgba(232, 237, 245, 0.4);
    letter-spacing: 0.06em;
}

.terminal-prompt {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: rgba(232, 237, 245, 0.35);
    letter-spacing: 0.1em;
    margin-top: 0.5rem;
}

.blink-cursor {
    color: var(--halo-cyan);
    animation: blink 1s step-end infinite;
}

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

/* ── Scale Markers ────────────────────────────────────────── */
.scale-marker {
    position: absolute;
    pointer-events: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.3rem;
    z-index: 5;
}

.scale-line {
    width: 1px;
    height: 40px;
    background: linear-gradient(to bottom, var(--halo-cyan), transparent);
}

.scale-label {
    font-family: var(--font-mono);
    font-size: 0.55rem;
    letter-spacing: 0.08em;
    color: rgba(0, 212, 255, 0.5);
    text-transform: uppercase;
    white-space: nowrap;
}

.fixed-sm .scale-line {
    height: 20px;
}

/* ── Return Indicator ─────────────────────────────────────── */
.return-indicator {
    position: absolute;
    bottom: 3rem;
    right: 2rem;
    font-family: var(--font-mono);
    font-size: 0.65rem;
    letter-spacing: 0.15em;
    color: rgba(232, 237, 245, 0.25);
    animation: pulse-hint 3s ease-in-out infinite;
}

/* ── Reduced Motion Support ───────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
    * {
        animation: none !important;
        transition: none !important;
    }
    #rdiag-outer-top,
    #rdiag-inner-top,
    #rdiag-rim-left,
    #rdiag-rim-right,
    #rdiag-shadow1,
    #rdiag-shadow2,
    #rdiag-shadow3,
    #rdiag-cable1,
    #rdiag-cable2,
    #rdiag-cable3,
    #rdiag-earth,
    #rdiag-star {
        stroke-dashoffset: 0;
    }
    .scale-bar-fill {
        width: 100% !important;
    }
    .bg-layer {
        transform: none !important;
    }
}

/* ── Responsive adjustments ───────────────────────────────── */
@media (max-width: 900px) {
    #sec-hero .section-inner {
        flex-direction: column;
        padding: 4rem 1.5rem 1.5rem;
        gap: 1.5rem;
    }
    .hero-panel {
        flex: 0 0 auto;
        min-width: unset;
        width: 100%;
    }
    .ring-diagram-container {
        max-width: 100%;
        width: 100%;
    }
    .split-60-40 {
        flex-direction: column;
    }
    .visual-half,
    .data-half {
        flex: 0 0 50%;
    }
    .scale-bar-label {
        flex: 0 0 120px;
    }
}
