/* ============================================
   mysterious.boo - Victorian Maritime Mysticism
   ============================================ */

/* CSS Custom Properties */
:root {
    --color-storm-slate: #2C3E50;
    --color-seafoam: #A8D5BA;
    --color-brass: #B08D57;
    --color-ivory: #F5F0E8;
    --color-squall: #6B5B7B;
    --color-kelp: #7A9E7E;
    --color-tidepool: #4A8B9F;
    --color-fog: #E8E4DF;
    --parallax-bg: 0.3;
    --parallax-mid: 0.6;
    --parallax-fg: 1.0;
    --font-display: 'Playfair Display', Georgia, serif;
    --font-body: 'Lora', 'Times New Roman', serif;
    --font-mono: 'DM Mono', 'Courier New', monospace;
}

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

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

body {
    background-color: var(--color-ivory);
    color: var(--color-storm-slate);
    font-family: var(--font-body);
    font-weight: 400;
    font-size: clamp(1rem, 2.2vw, 1.2rem);
    line-height: 1.75;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

/* ============================================
   Opening Sequence Overlay
   ============================================ */
.opening-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--color-ivory);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    transition: opacity 0.8s ease-out;
}

.opening-overlay.fade-out {
    opacity: 0;
    pointer-events: none;
}

.harmonic-intro {
    position: absolute;
}

.intro-circle {
    fill: none;
    stroke: var(--color-brass);
    stroke-width: 1;
    stroke-dasharray: 1000;
    stroke-dashoffset: 1000;
}

.intro-circle-outer {
    animation: draw-circle 1.2s ease-in-out forwards;
    stroke-dasharray: 943;
    stroke-dashoffset: 943;
}

.intro-circle-mid {
    animation: draw-circle-mid 0.8s ease-in-out 0.4s forwards;
    stroke-dasharray: 565;
    stroke-dashoffset: 565;
}

.intro-circle-inner {
    animation: draw-circle-inner 0.5s ease-in-out 0.7s forwards;
    stroke-dasharray: 189;
    stroke-dashoffset: 189;
}

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

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

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

.intro-title {
    position: relative;
    z-index: 1;
    font-family: var(--font-display);
    font-weight: 900;
    font-size: clamp(2.2rem, 7vw, 4.5rem);
    letter-spacing: 0.03em;
    color: var(--color-storm-slate);
    opacity: 0;
    animation: fade-in-title 0.6s ease-out 1.2s forwards;
}

.intro-boo {
    color: var(--color-squall);
}

@keyframes fade-in-title {
    to { opacity: 1; }
}

/* ============================================
   Navigation Rail
   ============================================ */
.nav-rail {
    position: fixed;
    right: 24px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    z-index: 100;
    padding: 20px 0;
}

.nav-rail-line {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 0;
    border-left: 1px solid rgba(176, 141, 87, 0.4);
    border-right: 1px solid rgba(176, 141, 87, 0.4);
    left: 50%;
    transform: translateX(-50%);
    width: 2px;
}

.nav-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--color-brass);
    border: none;
    cursor: pointer;
    position: relative;
    z-index: 1;
    transition: width 0.3s ease, height 0.3s ease, transform 0.4s ease-out;
    padding: 0;
}

.nav-dot.active {
    width: 12px;
    height: 12px;
}

.nav-dot-ring {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 1px solid var(--color-brass);
    opacity: 0;
    pointer-events: none;
}

.nav-dot.active .nav-dot-ring {
    animation: sonar-ping 2s ease-out infinite;
}

@keyframes sonar-ping {
    0% {
        width: 12px;
        height: 12px;
        opacity: 0.8;
    }
    100% {
        width: 30px;
        height: 30px;
        opacity: 0;
    }
}

/* ============================================
   Parallax Sections
   ============================================ */
.parallax-section {
    position: relative;
    width: 100%;
    min-height: 100vh;
    overflow: hidden;
}

.parallax-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    will-change: transform;
}

.parallax-bg {
    z-index: 1;
}

.parallax-mid {
    z-index: 2;
}

.parallax-fg {
    position: relative;
    z-index: 3;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
}

/* Fog Bank Transitions */
.fog-bank {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 60px;
    background: linear-gradient(to bottom, transparent 0%, var(--color-fog) 100%);
    z-index: 10;
    pointer-events: none;
}

/* Stippled Depth Gradient */
.parallax-section {
    background-color: var(--color-ivory);
    background-image:
        repeating-radial-gradient(
            circle at center,
            var(--color-storm-slate) 0px,
            var(--color-storm-slate) 0.5px,
            transparent 0.5px,
            transparent 8px
        );
    background-size: 8px 8px;
}

.section-hero {
    background-image:
        repeating-radial-gradient(
            circle,
            rgba(44, 62, 80, 0.02) 0px,
            rgba(44, 62, 80, 0.02) 0.5px,
            transparent 0.5px,
            transparent 8px
        );
}

.section-haunts {
    background-image:
        repeating-radial-gradient(
            circle,
            rgba(44, 62, 80, 0.025) 0px,
            rgba(44, 62, 80, 0.025) 0.5px,
            transparent 0.5px,
            transparent 8px
        );
}

.section-instruments {
    background-image:
        repeating-radial-gradient(
            circle,
            rgba(44, 62, 80, 0.03) 0px,
            rgba(44, 62, 80, 0.03) 0.5px,
            transparent 0.5px,
            transparent 8px
        );
}

.section-charting {
    background-image:
        repeating-radial-gradient(
            circle,
            rgba(44, 62, 80, 0.04) 0px,
            rgba(44, 62, 80, 0.04) 0.5px,
            transparent 0.5px,
            transparent 8px
        );
}

.section-signal {
    background-image:
        repeating-radial-gradient(
            circle,
            rgba(44, 62, 80, 0.025) 0px,
            rgba(44, 62, 80, 0.025) 0.5px,
            transparent 0.5px,
            transparent 8px
        );
}

/* ============================================
   Content Blocks
   ============================================ */
.section-content {
    max-width: 720px;
    width: 100%;
    padding: 60px 24px;
    margin: 0 auto;
    position: relative;
}

.hero-content {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding-top: 0;
    padding-bottom: 0;
}

.section-number {
    font-family: var(--font-mono);
    font-size: clamp(0.7rem, 1.5vw, 0.85rem);
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--color-kelp);
    display: block;
    margin-bottom: 8px;
}

.section-heading {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: clamp(1.6rem, 4vw, 3rem);
    letter-spacing: 0.03em;
    color: var(--color-storm-slate);
    margin-bottom: 16px;
}

.body-text {
    color: #3D4F5F;
    margin-bottom: 1.5em;
}

.body-text:last-child {
    margin-bottom: 0;
}

/* ============================================
   Domain Title - Kinetic Typography
   ============================================ */
.domain-title {
    font-family: var(--font-display);
    font-weight: 900;
    font-size: clamp(2.8rem, 8vw, 5.5rem);
    letter-spacing: 0.03em;
    color: var(--color-storm-slate);
    margin-bottom: 24px;
    white-space: nowrap;
}

.kinetic-letter {
    display: inline-block;
    animation: letter-wave 3s ease-in-out infinite;
}

.boo-letter {
    color: var(--color-squall);
    animation: letter-wave 3s ease-in-out infinite, boo-flicker 3s ease-in-out infinite;
}

@keyframes letter-wave {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-8px); }
}

@keyframes boo-flicker {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

/* Synchronized kinetic letters (Section 5) */
.kinetic-letter-sync {
    display: inline-block;
    animation: letter-wave-sync 3s ease-in-out infinite;
}

.boo-letter-sync {
    color: var(--color-squall);
    animation: letter-wave-sync 3s ease-in-out infinite, boo-flicker-sync 3s ease-in-out infinite;
}

@keyframes letter-wave-sync {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-8px); }
}

@keyframes boo-flicker-sync {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

/* Hero tagline */
.hero-tagline {
    font-family: var(--font-body);
    font-weight: 500;
    font-style: italic;
    font-size: clamp(1rem, 2.5vw, 1.4rem);
    color: #3D4F5F;
    margin-bottom: 40px;
}

/* ============================================
   Sine Wave Dividers
   ============================================ */
.sine-divider {
    width: 100%;
    height: 30px;
    margin: 16px 0 28px;
    overflow: visible;
}

.sine-path {
    fill: none;
    stroke: var(--color-seafoam);
    stroke-width: 1;
    animation: sine-translate 8s linear infinite;
}

@keyframes sine-translate {
    0% { transform: translateX(0); }
    100% { transform: translateX(-200px); }
}

.sine-wave-hero {
    width: 100%;
    max-width: 720px;
    height: 30px;
    margin-bottom: 30px;
    overflow: visible;
}

.sine-path-hero {
    fill: none;
    stroke: var(--color-seafoam);
    stroke-width: 1;
    stroke-dasharray: 1200;
    stroke-dashoffset: 1200;
}

.sine-path-hero.animate {
    animation: draw-sine 1s ease-out forwards;
}

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

/* Background sine waves */
.sine-wave-bg {
    position: absolute;
    top: 50%;
    left: 0;
    width: 100%;
    height: 200px;
    transform: translateY(-50%);
    opacity: 0.3;
}

.sine-bg-1 { animation: sine-translate 12s linear infinite; }
.sine-bg-2 { animation: sine-translate 16s linear infinite reverse; }
.sine-bg-3 { animation: sine-translate 10s linear infinite; }

.sine-wave-bg .sine-path {
    stroke: var(--color-seafoam);
    stroke-width: 1;
    fill: none;
}

/* ============================================
   Scroll Chevron
   ============================================ */
.scroll-chevron {
    font-family: var(--font-mono);
    font-size: clamp(0.7rem, 1.5vw, 0.85rem);
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--color-kelp);
    cursor: pointer;
    animation: chevron-bob 2s ease-in-out infinite;
}

.chevron-text {
    display: inline-block;
}

@keyframes chevron-bob {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(6px); }
}

/* ============================================
   Harmonic Circles
   ============================================ */
.harmonic-circles {
    position: absolute;
    will-change: transform;
}

.harmonic-circles circle {
    fill: none;
    stroke: var(--color-brass);
    stroke-width: 1;
    opacity: 0.25;
}

.hc-hero {
    width: 500px;
    height: 500px;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.hc-instruments-1 {
    width: 350px;
    height: 350px;
    top: 10%;
    right: -80px;
}

.hc-instruments-2 {
    width: 250px;
    height: 250px;
    bottom: 15%;
    left: -60px;
}

.hc-signal {
    width: 600px;
    height: 600px;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.hc-signal circle {
    opacity: 0.15;
}

/* ============================================
   Radial Compass Points
   ============================================ */
.radial-compass {
    position: absolute;
    width: 400px;
    height: 400px;
    will-change: transform;
}

.radial-compass line {
    stroke: var(--color-brass);
    stroke-width: 1;
    opacity: 0.15;
}

.rc-hero {
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    animation: compass-rotate 60s linear infinite;
}

.rc-haunts {
    top: 20%;
    right: -100px;
    animation: compass-rotate 60s linear infinite reverse;
}

.rc-charting {
    bottom: 10%;
    left: -80px;
    animation: compass-rotate 60s linear infinite;
}

.rc-signal {
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    animation: compass-rotate 60s linear infinite reverse;
}

@keyframes compass-rotate {
    0% { rotate: 0deg; }
    100% { rotate: 360deg; }
}

/* ============================================
   Filigree Frame Ornaments
   ============================================ */
.filigree-frame {
    position: absolute;
    top: 15%;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 780px;
    height: 70%;
    pointer-events: none;
}

.filigree-frame-hero {
    top: 20%;
    height: 60%;
}

.filigree-corner {
    position: absolute;
    width: 40px;
    height: 40px;
    transition: transform 0.3s ease-out, opacity 0.3s ease-out;
}

.filigree-corner path {
    fill: none;
    stroke: var(--color-brass);
    stroke-width: 1.5;
    opacity: 0.5;
}

.filigree-corner circle {
    fill: var(--color-brass);
    opacity: 0.5;
}

.filigree-tl { top: 0; left: 24px; }
.filigree-tr { top: 0; right: 24px; }
.filigree-bl { bottom: 0; left: 24px; }
.filigree-br { bottom: 0; right: 24px; }

/* Hover embrace effect on section content */
.parallax-section:hover .filigree-tl { transform: translate(4px, 4px); }
.parallax-section:hover .filigree-tr { transform: translate(-4px, 4px); }
.parallax-section:hover .filigree-bl { transform: translate(4px, -4px); }
.parallax-section:hover .filigree-br { transform: translate(-4px, -4px); }

.parallax-section:hover .filigree-corner path,
.parallax-section:hover .filigree-corner circle {
    opacity: 0.8;
}

/* ============================================
   Circuit Traces (Section 4)
   ============================================ */
.circuit-traces {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

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

.circuit-path {
    fill: none;
    stroke: var(--color-kelp);
    stroke-width: 1;
    opacity: 0.10;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.circuit-node {
    fill: var(--color-kelp);
    opacity: 0.10;
}

/* ============================================
   Instruments Section
   ============================================ */
.instrument-item {
    display: flex;
    align-items: center;
    gap: 32px;
    margin-bottom: 48px;
}

.instrument-item:last-child {
    margin-bottom: 0;
}

.instrument-visual {
    flex-shrink: 0;
    width: 140px;
    height: 140px;
}

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

.instrument-ring {
    fill: none;
    stroke: var(--color-brass);
    stroke-width: 1;
    opacity: 0.4;
}

.instrument-ring-small {
    fill: none;
    stroke: var(--color-brass);
    stroke-width: 1;
    opacity: 0.3;
}

.instrument-line {
    stroke: var(--color-brass);
    stroke-width: 0.5;
    opacity: 0.25;
}

.instrument-sine {
    fill: none;
    stroke: var(--color-seafoam);
    stroke-width: 1;
    opacity: 0.6;
}

.instrument-dot {
    fill: var(--color-brass);
    opacity: 0.5;
}

.instrument-trace {
    stroke: var(--color-brass);
    stroke-width: 1;
    opacity: 0.3;
    fill: none;
}

.instrument-center {
    fill: var(--color-brass);
    opacity: 0.6;
}

.instrument-name {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: clamp(1.1rem, 2.5vw, 1.4rem);
    letter-spacing: 0.03em;
    color: var(--color-brass);
    margin-bottom: 8px;
}

.instrument-text {
    flex: 1;
}

/* ============================================
   Signal Section (Section 5)
   ============================================ */
.signal-content {
    text-align: center;
}

.signal-domain-reprise {
    margin: 32px 0;
}

.signal-closing {
    font-family: var(--font-body);
    font-weight: 500;
    font-style: italic;
    font-size: clamp(1rem, 2.5vw, 1.3rem);
    color: var(--color-squall);
    margin-top: 32px;
}

/* ============================================
   Scroll Reveal
   ============================================ */
.scroll-reveal {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.5s ease-out, transform 0.5s ease-out;
}

.scroll-reveal.visible {
    opacity: 1;
    transform: translateY(0);
}

/* ============================================
   SVG Stroke Draw Animation
   ============================================ */
.stroke-draw circle,
.stroke-draw path,
.stroke-draw line {
    stroke-dasharray: 1000;
    stroke-dashoffset: 1000;
    transition: stroke-dashoffset 1.2s ease-in-out;
}

.stroke-draw.animate circle,
.stroke-draw.animate path,
.stroke-draw.animate line {
    stroke-dashoffset: 0;
}

/* ============================================
   Magnetic Link Underline
   ============================================ */
a {
    color: var(--color-tidepool);
    text-decoration: none;
    position: relative;
    display: inline-block;
    transition: transform 0.4s ease-out;
}

a::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    width: 0;
    height: 1px;
    background-color: var(--color-tidepool);
    transition: width 0.3s ease-out;
}

a:hover::after {
    width: 100%;
}

/* ============================================
   Expanding Circles Animation (Section 5)
   ============================================ */
.expanding-circles.animate circle {
    animation: expand-pulse 4s ease-in-out infinite;
}

.expanding-circles.animate circle:nth-child(1) { animation-delay: 0s; }
.expanding-circles.animate circle:nth-child(2) { animation-delay: 0.3s; }
.expanding-circles.animate circle:nth-child(3) { animation-delay: 0.6s; }
.expanding-circles.animate circle:nth-child(4) { animation-delay: 0.9s; }
.expanding-circles.animate circle:nth-child(5) { animation-delay: 1.2s; }

@keyframes expand-pulse {
    0%, 100% { opacity: 0.15; transform-origin: center; }
    50% { opacity: 0.30; }
}

/* ============================================
   Prefers Reduced Motion
   ============================================ */
@media (prefers-reduced-motion: reduce) {
    .kinetic-letter,
    .boo-letter,
    .kinetic-letter-sync,
    .boo-letter-sync {
        animation: none !important;
    }

    .scroll-chevron {
        animation: none !important;
    }

    .sine-path {
        animation: none !important;
    }

    .sine-bg-1, .sine-bg-2, .sine-bg-3 {
        animation: none !important;
    }

    .radial-compass {
        animation: none !important;
    }

    .nav-dot-ring {
        animation: none !important;
    }

    .scroll-reveal {
        opacity: 1 !important;
        transform: none !important;
    }

    .expanding-circles.animate circle {
        animation: none !important;
    }

    .intro-circle {
        stroke-dashoffset: 0 !important;
        animation: none !important;
    }

    .intro-title {
        opacity: 1 !important;
        animation: none !important;
    }
}

/* ============================================
   Responsive - Mobile (below 768px)
   ============================================ */
@media (max-width: 768px) {
    .nav-rail {
        position: fixed;
        right: auto;
        top: auto;
        bottom: 16px;
        left: 50%;
        transform: translateX(-50%);
        flex-direction: row;
        gap: 16px;
        padding: 12px 20px;
        background: rgba(245, 240, 232, 0.9);
        border-radius: 20px;
        border: 1px solid rgba(176, 141, 87, 0.2);
    }

    .nav-rail-line {
        display: none;
    }

    .section-content {
        padding: 40px 24px;
    }

    .filigree-frame {
        display: none;
    }

    .harmonic-circles,
    .radial-compass {
        opacity: 0.15;
    }

    .instrument-item {
        flex-direction: column;
        text-align: center;
    }

    .instrument-visual {
        width: 100px;
        height: 100px;
    }

    .hc-hero {
        width: 300px;
        height: 300px;
    }

    .domain-title {
        font-size: clamp(2rem, 10vw, 3.5rem);
    }
}
