/* mysterious.quest - Retro-Futuristic Scholarly Research Interface */
/* Navy-Metallic Palette | Modular-Blocks Layout | Grid-Lines Motif */

:root {
    --bg-deep: #070d1a;
    --bg-module: #0d1828;
    --bg-module-alt: #111e30;
    --border-frame: #2a3a5e;
    --border-bright: #4a6a8e;
    --accent-signal: #7aaace;
    --accent-amber: #d4a44a;
    --accent-alert: #c45a4a;
    --text-body: #b8c8d8;
    --text-heading: #e0e8f0;
    --text-annotation: #6a8aae;
    --grid-subtle: #1a2a42;

    --font-display: 'Space Grotesk', sans-serif;
    --font-body: 'Inter', sans-serif;
    --font-mono: 'IBM Plex Mono', monospace;

    --grid-gap: 2px;
    --grid-major: 60px;
    --grid-minor: 20px;
}

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

html {
    scroll-behavior: smooth;
}

body {
    background-color: var(--bg-deep);
    color: var(--text-body);
    font-family: var(--font-body);
    font-weight: 400;
    font-size: clamp(0.95rem, 1.8vw, 1.1rem);
    line-height: 1.75;
    overflow-x: hidden;
}

/* Grid Background */
.grid-background {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
    opacity: 0;
    transition: opacity 0.8s ease;
    background:
        radial-gradient(ellipse at 50% 50%, var(--bg-module) 0%, var(--bg-deep) 70%),
        repeating-linear-gradient(
            to right,
            var(--grid-subtle) 0px,
            var(--grid-subtle) 1px,
            transparent 1px,
            transparent var(--grid-major)
        ),
        repeating-linear-gradient(
            to bottom,
            var(--grid-subtle) 0px,
            var(--grid-subtle) 1px,
            transparent 1px,
            transparent var(--grid-major)
        );
    background-size: 100% 100%, var(--grid-major) var(--grid-major), var(--grid-major) var(--grid-major);
}

.grid-background.visible {
    opacity: 1;
}

.grid-background::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image:
        radial-gradient(circle, var(--border-frame) 1.5px, transparent 1.5px);
    background-size: calc(var(--grid-major) * 4) calc(var(--grid-major) * 4);
    background-position: 0 0;
    opacity: 0;
    transition: opacity 0.6s ease 0.4s;
}

.grid-background.dots-visible::after {
    opacity: 1;
}

/* Navigation */
#nav-bar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.5rem;
    background: rgba(7, 13, 26, 0.92);
    border-bottom: 1px solid var(--border-frame);
    z-index: 1000;
    backdrop-filter: blur(8px);
}

.nav-site-id {
    font-family: var(--font-mono);
    font-size: 12px;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--text-annotation);
}

.nav-sections {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.nav-section-link {
    font-family: var(--font-mono);
    font-size: clamp(0.65rem, 1.2vw, 0.8rem);
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--text-annotation);
    cursor: pointer;
    transition: color 0.2s ease, text-shadow 0.2s ease;
}

.nav-section-link:hover {
    color: var(--accent-signal);
}

.nav-section-link.active {
    color: var(--accent-signal);
    animation: navPulse 4s ease-in-out infinite;
}

.nav-separator {
    font-family: var(--font-mono);
    font-size: clamp(0.65rem, 1.2vw, 0.8rem);
    color: var(--border-frame);
    letter-spacing: 0.14em;
}

@keyframes navPulse {
    0%, 100% { text-shadow: 0 0 6px var(--accent-signal); }
    50% { text-shadow: 0 0 14px var(--accent-signal); }
}

/* Hero Section */
.hero-section {
    position: relative;
    width: 100%;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1;
    overflow: hidden;
}

.hero-content {
    text-align: center;
    position: relative;
    z-index: 2;
    padding: 3rem;
}

.hero-domain-name {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: clamp(3rem, 8vw, 7rem);
    letter-spacing: 0.06em;
    color: var(--text-heading);
    line-height: 1.1;
    opacity: 0;
}

.hero-domain-name.revealed {
    opacity: 1;
}

.hero-domain-name .char {
    display: inline-block;
    opacity: 0;
    transform: translateY(4px);
}

.hero-domain-name .char.visible {
    opacity: 1;
    transform: translateY(0);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.hero-domain-name .char.flash {
    text-shadow: 0 0 20px var(--accent-signal);
    transition: text-shadow 0.4s ease;
}

.hero-domain-name .char.no-flash {
    text-shadow: none;
    transition: text-shadow 0.4s ease;
}

.hero-subtitle {
    font-family: var(--font-mono);
    font-size: clamp(0.65rem, 1.2vw, 0.8rem);
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--text-annotation);
    margin-top: 1.5rem;
    opacity: 0;
    transform: translateY(8px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.hero-subtitle.visible {
    opacity: 1;
    transform: translateY(0);
}

/* Hero border animation */
.hero-border-animator {
    position: absolute;
    top: 15%;
    left: 10%;
    right: 10%;
    bottom: 15%;
    pointer-events: none;
    border: 1px solid transparent;
    transition: border-color 0.6s ease;
}

.hero-border-animator.active {
    border-color: var(--border-bright);
}

/* Corner Brackets */
.corner-bracket {
    position: absolute;
    width: 8px;
    height: 8px;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.corner-bracket.visible {
    opacity: 1;
}

.corner-bracket.top-left {
    top: 4px;
    left: 4px;
    border-top: 1px solid var(--border-bright);
    border-left: 1px solid var(--border-bright);
}

.corner-bracket.top-right {
    top: 4px;
    right: 4px;
    border-top: 1px solid var(--border-bright);
    border-right: 1px solid var(--border-bright);
}

.corner-bracket.bottom-left {
    bottom: 4px;
    left: 4px;
    border-bottom: 1px solid var(--border-bright);
    border-left: 1px solid var(--border-bright);
}

.corner-bracket.bottom-right {
    bottom: 4px;
    right: 4px;
    border-bottom: 1px solid var(--border-bright);
    border-right: 1px solid var(--border-bright);
}

/* Scanning Line */
.scanning-line {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--accent-signal), transparent);
    opacity: 0;
    z-index: 3;
    transform: translateY(-100%);
    pointer-events: none;
}

.scanning-line.sweep {
    opacity: 0.5;
    animation: scanSweepDown 1.2s ease-out forwards;
}

@keyframes scanSweepDown {
    0% { transform: translateY(0); }
    100% { transform: translateY(100vh); }
}

/* Grid Sections */
.grid-section {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-columns: repeat(16, 1fr);
    grid-template-rows: repeat(auto-fill, minmax(60px, 1fr));
    gap: var(--grid-gap);
    padding: 2rem 2rem 4rem;
    max-width: 1440px;
    margin: 0 auto;
    min-height: 80vh;
}

/* Module Base */
.module {
    position: relative;
    background: var(--bg-module);
    border: 1px solid var(--border-bright);
    overflow: hidden;
    transition: border-color 0.2s ease;
}

.module:hover {
    border-color: var(--accent-signal);
}

.module:hover > .corner-bracket {
    border-color: var(--accent-signal);
}

/* Module Header */
.module-header {
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 0.75rem;
    border-bottom: 1px solid var(--border-frame);
    background: rgba(13, 24, 40, 0.6);
}

.module-designation {
    font-family: var(--font-mono);
    font-size: 10px;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--text-annotation);
}

/* Status Dots */
.status-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--accent-amber);
    animation: statusBlink 2s ease-in-out infinite;
}

.status-dot-alert {
    background: var(--accent-alert);
    animation: statusBlinkAlert 1.5s ease-in-out infinite;
}

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

@keyframes statusBlinkAlert {
    0%, 100% { opacity: 1; background: var(--accent-alert); }
    50% { opacity: 0.3; }
}

/* Module Types */
.module-primary {
    padding: 0;
}

.module-primary .module-content {
    padding: 2.5rem;
}

.module-readout {
    background: linear-gradient(180deg, #0a1628, #0d1e35);
}

.module-readout .module-content {
    padding: 1rem 1.25rem;
}

.module-indicator {
    display: flex;
    flex-direction: column;
    animation: indicatorPulse 4s ease-in-out infinite;
}

@keyframes indicatorPulse {
    0%, 100% { border-color: var(--border-bright); }
    50% { border-color: var(--accent-signal); }
}

.module-indicator:hover {
    animation: none;
    border-color: var(--accent-signal);
}

.module-indicator:hover .status-dot {
    box-shadow: 0 0 12px var(--accent-amber);
    animation: statusDotHoverPulse 0.5s ease-out;
}

@keyframes statusDotHoverPulse {
    0% { box-shadow: 0 0 2px var(--accent-amber); }
    50% { box-shadow: 0 0 12px var(--accent-amber); }
    100% { box-shadow: 0 0 6px var(--accent-amber); }
}

.indicator-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1;
    padding: 1rem;
    position: relative;
    z-index: 2;
}

.indicator-value {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: clamp(1.1rem, 2vw, 1.6rem);
    letter-spacing: 0.06em;
    color: var(--text-heading);
}

.indicator-label {
    font-family: var(--font-mono);
    font-size: clamp(0.55rem, 1vw, 0.7rem);
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--text-annotation);
    margin-top: 0.5rem;
}

/* Crosshair */
.crosshair {
    position: absolute;
    top: 24px;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    z-index: 1;
}

.crosshair::before,
.crosshair::after {
    content: '';
    position: absolute;
    background: var(--border-frame);
}

.crosshair::before {
    top: 50%;
    left: 0;
    right: 0;
    height: 1px;
}

.crosshair::after {
    left: 50%;
    top: 0;
    bottom: 0;
    width: 1px;
}

/* Strip Module */
.module-strip {
    display: flex;
    flex-direction: column;
    justify-content: center;
    border: 1px solid var(--border-frame);
    overflow: hidden;
    position: relative;
}

.strip-waveform {
    position: absolute;
    top: 0;
    left: 0;
    width: 200%;
    height: 100%;
    pointer-events: none;
}

.waveform-svg {
    width: 100%;
    height: 100%;
}

.waveform-path {
    fill: none;
    stroke: var(--accent-signal);
    stroke-width: 1;
    opacity: 0.4;
    animation: waveformScroll 120s linear infinite;
}

.waveform-path-2 {
    animation-duration: 90s;
}

.waveform-path-3 {
    animation-duration: 60s;
    stroke: var(--accent-alert);
    opacity: 0.3;
}

@keyframes waveformScroll {
    0% { transform: translateX(0); }
    100% { transform: translateX(-50%); }
}

.strip-marquee {
    position: relative;
    overflow: hidden;
    white-space: nowrap;
    z-index: 2;
    padding: 0 1rem;
}

.marquee-content {
    display: inline-block;
    font-family: var(--font-mono);
    font-size: clamp(0.6rem, 1vw, 0.75rem);
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--text-annotation);
    animation: marqueeScroll 30s linear infinite;
}

.module-strip:hover .marquee-content {
    animation-play-state: paused;
}

@keyframes marqueeScroll {
    0% { transform: translateX(100%); }
    100% { transform: translateX(-100%); }
}

/* Scanning Line within modules */
.scanning-line-module {
    position: absolute;
    top: 24px;
    left: 0;
    width: 100%;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--accent-signal), transparent);
    opacity: 0.2;
    animation: moduleScan 6s ease-in-out infinite;
    pointer-events: none;
    z-index: 5;
}

.module:hover .scanning-line-module {
    animation-duration: 3s;
}

@keyframes moduleScan {
    0% { top: 24px; }
    100% { top: calc(100% - 2px); }
}

/* Module Content Typography */
.module-content h2 {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: clamp(1.6rem, 3.5vw, 2.8rem);
    letter-spacing: 0.06em;
    color: var(--text-heading);
    margin-bottom: 1.25rem;
    line-height: 1.2;
}

.module-content p {
    color: var(--text-body);
    margin-bottom: 1.5em;
    font-size: clamp(0.95rem, 1.8vw, 1.1rem);
    line-height: 1.75;
}

.module-content p:last-child {
    margin-bottom: 0;
}

/* Readout Lines */
.readout-line {
    font-family: var(--font-mono);
    font-size: clamp(0.65rem, 1.2vw, 0.8rem);
    letter-spacing: 0.08em;
    color: var(--text-body);
    margin-bottom: 0.5em;
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.readout-ts {
    color: var(--text-annotation);
    font-weight: 400;
    min-width: 8ch;
}

/* Conclusion Note */
.conclusion-note {
    font-family: var(--font-mono);
    font-size: clamp(0.8rem, 1.4vw, 1rem);
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--accent-signal);
    text-align: center;
    margin-top: 2rem;
}

/* Anomaly Void */
.anomaly-void {
    background: linear-gradient(180deg, rgba(10, 22, 40, 0.95), rgba(7, 13, 26, 0.98));
    border-color: var(--accent-alert);
}

.anomaly-void:hover {
    border-color: var(--accent-alert);
    box-shadow: 0 0 20px rgba(196, 90, 74, 0.15);
}

/* Footer */
.footer-content {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.footer-text {
    font-family: var(--font-mono);
    font-size: clamp(0.6rem, 1vw, 0.75rem);
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--text-annotation);
    opacity: 0.6;
}

/* Module Reveal Animation */
.module-reveal {
    opacity: 0;
    transform: translateY(12px);
    transition: opacity 0.5s ease-out, transform 0.5s ease-out;
}

.module-reveal.revealed {
    opacity: 1;
    transform: translateY(0);
}

/* Secondary grid pattern within primary modules */
.module-primary::before {
    content: '';
    position: absolute;
    top: 24px;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    z-index: 0;
    background:
        repeating-linear-gradient(
            to right,
            var(--bg-module-alt) 0px,
            var(--bg-module-alt) 1px,
            transparent 1px,
            transparent var(--grid-minor)
        ),
        repeating-linear-gradient(
            to bottom,
            var(--bg-module-alt) 0px,
            var(--bg-module-alt) 1px,
            transparent 1px,
            transparent var(--grid-minor)
        );
    opacity: 0.5;
}

.module-primary .module-content {
    position: relative;
    z-index: 1;
}

/* Responsive */
@media (max-width: 768px) {
    .grid-section {
        display: flex;
        flex-direction: column;
        gap: var(--grid-gap);
        padding: 1rem;
    }

    .module {
        width: 100%;
    }

    .module-primary .module-content {
        padding: 1.5rem;
    }

    .module-indicator {
        min-height: 120px;
    }

    .module-strip {
        min-height: 50px;
    }

    .module-readout .module-content {
        padding: 0.75rem 1rem;
    }

    .hero-border-animator {
        top: 20%;
        left: 5%;
        right: 5%;
        bottom: 20%;
    }

    #nav-bar {
        padding: 0 0.75rem;
    }

    .nav-sections {
        gap: 0.25rem;
    }
}

@media (max-width: 480px) {
    .nav-separator {
        display: none;
    }

    .nav-sections {
        gap: 0.75rem;
    }
}

/* Selection */
::selection {
    background: var(--accent-signal);
    color: var(--bg-deep);
}
