/* ==========================================================================
   scientific.quest - Cryogenic Research Observatory
   ========================================================================== */

/* CSS Custom Properties */
:root {
    --cryogenic-black: #080B14;
    --observatory-slate: #141827;
    --spectrometer-gray: #2A2F42;
    --quartz-silver: #B8BFD1;
    --phosphor-cyan: #72F5E8;
    --refraction-violet: #9B7AFF;
    --wavelength-amber: #F5C842;
    --specimen-white: #EDF0F7;

    --font-display: 'Outfit', sans-serif;
    --font-body: 'Instrument Sans', sans-serif;
    --font-mono: 'Azeret Mono', monospace;
}

/* Custom Cursor */
*, *::before, *::after {
    cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24'%3E%3Cline x1='12' y1='0' x2='12' y2='7' stroke='%2372F5E8' stroke-width='1'/%3E%3Cline x1='12' y1='17' x2='12' y2='24' stroke='%2372F5E8' stroke-width='1'/%3E%3Cline x1='0' y1='12' x2='7' y2='12' stroke='%2372F5E8' stroke-width='1'/%3E%3Cline x1='17' y1='12' x2='24' y2='12' stroke='%2372F5E8' stroke-width='1'/%3E%3Ccircle cx='12' cy='12' r='1.5' fill='%2372F5E8'/%3E%3Ccircle cx='12' cy='12' r='5' fill='none' stroke='%2372F5E8' stroke-width='0.5'/%3E%3C/svg%3E") 12 12, crosshair;
}

/* Reset */
html {
    box-sizing: border-box;
    scroll-behavior: smooth;
}

body {
    margin: 0;
    padding: 0;
    background-color: var(--cryogenic-black);
    color: var(--quartz-silver);
    font-family: var(--font-body);
    font-size: clamp(0.95rem, 1.2vw, 1.15rem);
    font-weight: 400;
    line-height: 1.72;
    letter-spacing: 0.01em;
    overflow-x: hidden;
}

/* ==========================================================================
   Isometric Dot Grid Background
   ========================================================================== */

.iso-grid-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
    background-image:
        radial-gradient(circle, var(--spectrometer-gray) 1.5px, transparent 1.5px);
    background-size: 40px 40px;
    opacity: 0.08;
}

/* ==========================================================================
   Navigation Reticle
   ========================================================================== */

.nav-reticle {
    position: fixed;
    top: 24px;
    right: 24px;
    z-index: 1000;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.3s ease;
}

.nav-reticle:hover {
    transform: scale(1.2);
}

.nav-reticle:hover svg {
    animation: reticle-spin 8s linear infinite;
}

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

.nav-reticle svg {
    cursor: pointer;
}

/* Radial Navigation */
.radial-nav {
    position: fixed;
    top: 0;
    right: 0;
    width: 100vw;
    height: 100vh;
    z-index: 999;
    pointer-events: none;
    clip-path: circle(0% at calc(100% - 48px) 48px);
    background: rgba(8, 11, 20, 0.95);
    transition: clip-path 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.radial-nav.open {
    clip-path: circle(150% at calc(100% - 48px) 48px);
    pointer-events: all;
}

.radial-nav-inner {
    position: absolute;
    top: 48px;
    right: 48px;
    width: 300px;
    height: 300px;
}

.radial-link {
    position: absolute;
    display: block;
    font-family: var(--font-display);
    font-size: 1.1rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--specimen-white);
    text-decoration: none;
    transition: color 0.3s ease;
    transform: translate(
        calc(cos(var(--angle)) * 130px),
        calc(sin(var(--angle)) * 130px)
    );
}

.radial-link:hover {
    color: var(--phosphor-cyan);
}

/* ==========================================================================
   Stations (Sections)
   ========================================================================== */

.station {
    position: relative;
    min-height: 100vh;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1;
    overflow: hidden;
}

.station-content {
    position: relative;
    z-index: 2;
    width: 100%;
    max-width: 1400px;
    padding: 60px 5vw;
}

/* ==========================================================================
   Station 1: Observation
   ========================================================================== */

.station-1 {
    background: var(--cryogenic-black);
}

.station-1 .station-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
}

.hero-text {
    text-align: center;
    opacity: 0;
    transform: translateY(40px);
    transition: opacity 1.2s ease, transform 1.2s ease;
}

.hero-text.in-view {
    opacity: 1;
    transform: translateY(0);
}

.hero-title {
    margin: 0;
    line-height: 1.05;
}

.hero-line-1 {
    display: block;
    font-family: var(--font-display);
    font-size: clamp(3.5rem, 10vw, 9rem);
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--specimen-white);
}

.hero-line-2 {
    display: block;
    font-family: var(--font-display);
    font-size: clamp(3.5rem, 10vw, 9rem);
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--phosphor-cyan);
}

.spectrometer-bar {
    width: 80vw;
    max-width: 1000px;
    height: 2px;
    margin: 30px auto 0;
    background: linear-gradient(90deg, var(--phosphor-cyan), var(--refraction-violet));
    transform: scaleX(0);
    transform-origin: left center;
    transition: transform 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94) 0.6s;
}

.hero-text.in-view .spectrometer-bar {
    transform: scaleX(1);
}

/* Lens Flare */
.lens-flare {
    position: absolute;
    pointer-events: none;
    z-index: 1;
}

.lens-flare-center {
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 300px;
    height: 300px;
    background:
        radial-gradient(ellipse 100% 100%, rgba(114, 245, 232, 0.12) 0%, transparent 70%),
        radial-gradient(ellipse 300% 30%, rgba(114, 245, 232, 0.06) 0%, transparent 50%);
    animation: lens-pulse 4s ease-in-out infinite;
}

@keyframes lens-pulse {
    0%, 100% { opacity: 0.6; transform: translate(-50%, -50%) scale(1); }
    50% { opacity: 1; transform: translate(-50%, -50%) scale(1.15); }
}

.lens-flare-tr {
    top: 0;
    right: 0;
    width: 200px;
    height: 200px;
    background:
        radial-gradient(ellipse 100% 100%, rgba(114, 245, 232, 0.1) 0%, transparent 70%),
        radial-gradient(ellipse 300% 20%, rgba(114, 245, 232, 0.05) 0%, transparent 50%);
}

/* ==========================================================================
   Station 2: Hypothesis
   ========================================================================== */

.station-2 {
    background: var(--cryogenic-black);
}

.z-pattern {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 60px;
    align-items: center;
}

/* Beveled Card */
.beveled-card {
    position: relative;
    background: var(--observatory-slate);
    padding: 48px;
    overflow: hidden;
    box-shadow:
        inset 1px 1px 0 rgba(255, 255, 255, 0.15),
        0 8px 32px rgba(0, 0, 0, 0.4);
}

.beveled-card .card-inner {
    position: relative;
    z-index: 2;
}

.hypothesis-card {
    opacity: 0;
    transition: opacity 1s ease;
}

.hypothesis-card.in-view {
    opacity: 1;
}

.section-header {
    font-family: var(--font-display);
    font-size: clamp(1.8rem, 3.5vw, 3rem);
    font-weight: 600;
    letter-spacing: 0.08em;
    color: var(--specimen-white);
    margin: 0 0 24px 0;
}

.body-text {
    color: var(--quartz-silver);
    margin: 0 0 16px 0;
}

/* Lattice Overlays */
.lattice-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
}

.lattice-0 {
    background:
        conic-gradient(from 0deg at 50% 50%, transparent 0deg, rgba(114, 245, 232, 0.04) 60deg, transparent 60deg) 0 0 / 60px 60px,
        repeating-linear-gradient(0deg, transparent, transparent 29px, rgba(114, 245, 232, 0.03) 29px, rgba(114, 245, 232, 0.03) 30px);
    opacity: 0.5;
}

.lattice-60 {
    background:
        conic-gradient(from 60deg at 50% 50%, transparent 0deg, rgba(114, 245, 232, 0.04) 60deg, transparent 60deg) 0 0 / 60px 60px,
        repeating-linear-gradient(60deg, transparent, transparent 29px, rgba(114, 245, 232, 0.03) 29px, rgba(114, 245, 232, 0.03) 30px);
    opacity: 0.5;
}

.lattice-120 {
    background:
        conic-gradient(from 120deg at 50% 50%, transparent 0deg, rgba(114, 245, 232, 0.04) 60deg, transparent 60deg) 0 0 / 60px 60px,
        repeating-linear-gradient(120deg, transparent, transparent 29px, rgba(114, 245, 232, 0.03) 29px, rgba(114, 245, 232, 0.03) 30px);
    opacity: 0.5;
}

.lattice-dense {
    background:
        conic-gradient(from 0deg at 50% 50%, transparent 0deg, rgba(114, 245, 232, 0.05) 60deg, transparent 60deg) 0 0 / 20px 20px,
        repeating-linear-gradient(0deg, transparent, transparent 19px, rgba(114, 245, 232, 0.04) 19px, rgba(114, 245, 232, 0.04) 20px);
    opacity: 0.7;
}

/* Oscilloscope */
.oscilloscope-container {
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.oscilloscope {
    width: 100%;
    height: 200px;
}

.sine-wave {
    stroke-dasharray: 800;
    stroke-dashoffset: 800;
    animation: wave-draw 4s linear infinite;
}

.wave-2 {
    animation-delay: -2s;
}

@keyframes wave-draw {
    0% { stroke-dashoffset: 800; }
    50% { stroke-dashoffset: 0; }
    100% { stroke-dashoffset: -800; }
}

/* ==========================================================================
   Station 3: Experiment
   ========================================================================== */

.station-3 {
    background: var(--cryogenic-black);
}

.z-top-left {
    grid-column: 1;
}

.z-bottom-right {
    grid-column: 2;
    display: flex;
    align-items: center;
    justify-content: center;
}

.polar-plot {
    width: 100%;
    max-width: 400px;
    animation: polar-rotate 120s linear infinite;
}

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

.data-label {
    margin: 8px 0;
}

.mono-text {
    font-family: var(--font-mono);
    font-size: 0.85em;
    letter-spacing: 0.04em;
    color: var(--phosphor-cyan);
}

.mono-text.amber {
    color: var(--wavelength-amber);
}

.mono-text.violet {
    color: var(--refraction-violet);
}

/* ==========================================================================
   Station 4: Analysis
   ========================================================================== */

.station-4 {
    background: var(--observatory-slate);
}

.station-4 .station-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
}

.dashboard-strip {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 48px;
    width: 100%;
    margin-top: 48px;
}

.chart-group {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.bar-chart {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    height: 280px;
    width: 100%;
    padding: 0 10px;
}

.bar {
    flex: 1;
    height: 100%;
    display: flex;
    align-items: flex-end;
    position: relative;
}

.bar-fill {
    width: 100%;
    height: 0%;
    transition: height 1.2s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    border-radius: 2px 2px 0 0;
}

.bar-cyan .bar-fill {
    background: linear-gradient(180deg, var(--phosphor-cyan), rgba(114, 245, 232, 0.3));
}

.bar-violet .bar-fill {
    background: linear-gradient(180deg, var(--refraction-violet), rgba(155, 122, 255, 0.3));
}

.bar-amber .bar-fill {
    background: linear-gradient(180deg, var(--wavelength-amber), rgba(245, 200, 66, 0.3));
}

.bar.in-view .bar-fill {
    height: var(--target-height);
}

.chart-label {
    margin-top: 20px;
    font-family: var(--font-mono);
    font-size: 0.75rem;
    letter-spacing: 0.08em;
    color: var(--quartz-silver);
    text-align: center;
}

.data-readout {
    display: flex;
    gap: 48px;
    margin-top: 48px;
    flex-wrap: wrap;
    justify-content: center;
}

.data-readout .mono-text {
    color: var(--quartz-silver);
}

.data-readout .cyan {
    color: var(--phosphor-cyan);
}

/* ==========================================================================
   Station 5: Synthesis
   ========================================================================== */

.station-5 {
    background: linear-gradient(180deg, var(--cryogenic-black) 0%, var(--observatory-slate) 100%);
}

.synthesis-content {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    text-align: center;
}

.synthesis-statement {
    font-family: var(--font-display);
    font-size: clamp(2rem, 5vw, 4.5rem);
    font-weight: 600;
    letter-spacing: 0.04em;
    color: var(--specimen-white);
    line-height: 1.2;
    max-width: 900px;
    margin: 0 auto;
}

/* ==========================================================================
   Station 6: Discovery
   ========================================================================== */

.station-6 {
    background: var(--cryogenic-black);
}

.discovery-content {
    position: relative;
    display: flex;
    align-items: flex-end;
    justify-content: flex-end;
    min-height: 100vh;
    padding-bottom: 80px;
}

.pulsing-grid {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
}

.pulsing-dot {
    position: absolute;
    width: 3px;
    height: 3px;
    border-radius: 50%;
    background: var(--spectrometer-gray);
    animation: dot-pulse 3s ease-in-out infinite;
    animation-delay: var(--delay);
}

@keyframes dot-pulse {
    0%, 100% { opacity: 0.08; transform: scale(1); }
    50% { opacity: 0.4; transform: scale(1.8); background: var(--phosphor-cyan); }
}

.discovery-bottom-right {
    position: relative;
    z-index: 2;
    text-align: right;
}

.domain-link {
    display: inline-block;
    text-decoration: none;
    cursor: pointer;
}

.discovery-domain {
    font-family: var(--font-display);
    font-size: 2rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    color: var(--specimen-white);
    transition: color 0.3s ease;
}

.domain-link:hover .discovery-domain {
    color: var(--phosphor-cyan);
}

.underline-draw {
    display: block;
    width: 100%;
    height: 4px;
    margin-top: 4px;
}

.underline-path {
    stroke-dasharray: 200;
    stroke-dashoffset: 200;
    transition: stroke-dashoffset 1s ease;
}

.discovery-bottom-right.in-view .underline-path {
    stroke-dashoffset: 0;
}

.quest-continues {
    font-family: var(--font-body);
    font-size: clamp(0.95rem, 1.2vw, 1.15rem);
    color: var(--quartz-silver);
    margin-top: 16px;
    letter-spacing: 0.01em;
}

/* ==========================================================================
   Isometric Transform for Station 2 & 3
   ========================================================================== */

.station-2 .station-content,
.station-3 .station-content {
    perspective: 1200px;
}

.station-2 .beveled-card {
    transform: rotateX(2deg) rotateY(-1deg);
    transition: opacity 1s ease, transform 0.6s ease;
}

.station-2 .beveled-card:hover {
    transform: rotateX(0deg) rotateY(0deg);
}

/* ==========================================================================
   Specimen Slide Sections (beveled floating cards)
   ========================================================================== */

.station-2,
.station-3,
.station-4 {
    margin: 60px 0;
}

.station-3 .station-content,
.station-4 .station-content {
    background: var(--observatory-slate);
    box-shadow:
        inset 1px 1px 0 rgba(255, 255, 255, 0.15),
        0 8px 32px rgba(0, 0, 0, 0.4);
}

/* ==========================================================================
   Responsive
   ========================================================================== */

@media (max-width: 768px) {
    .z-pattern {
        grid-template-columns: 1fr;
        gap: 40px;
    }

    .z-bottom-right {
        grid-column: 1;
    }

    .dashboard-strip {
        grid-template-columns: 1fr;
        gap: 40px;
    }

    .bar-chart {
        height: 200px;
    }

    .data-readout {
        flex-direction: column;
        align-items: center;
        gap: 16px;
    }

    .beveled-card {
        padding: 32px 24px;
    }

    .radial-nav-inner {
        width: 250px;
        height: 250px;
    }

    .radial-link {
        font-size: 0.9rem;
        transform: translate(
            calc(cos(var(--angle)) * 100px),
            calc(sin(var(--angle)) * 100px)
        );
    }
}

/* ==========================================================================
   Utility
   ========================================================================== */

.fade-in {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.8s ease, transform 0.8s ease;
}

.fade-in.in-view {
    opacity: 1;
    transform: translateY(0);
}
