:root {
    --abyssal-ink: #0b1628;
    --mariners-shadow: #132742;
    --foam-crest: #e0f0f4;
    --bioluminescent: #4fd1c5;
    --shrine-flame: #f6a623;
    --corroded-neon: #d4654a;
    --drowned-circuit: #3a5f8a;
    --fog-signal: #8b7fad;
    --deep-void: #060d18;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    background: var(--abyssal-ink);
    color: var(--foam-crest);
    font-family: 'Nunito Sans', sans-serif;
    font-weight: 300;
    font-size: clamp(0.95rem, 1.5vw, 1.15rem);
    line-height: 1.75;
    letter-spacing: 0.01em;
    overflow-x: hidden;
}

.zone {
    position: relative;
    width: 100%;
}

/* Hexagonal clip-path */
.hex {
    clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
}

/* ===== FOG PARTICLES ===== */
.fog-layer {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
}

.fog-particle {
    position: absolute;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(139, 127, 173, 0.08), transparent);
    will-change: transform;
}

.fp-1 { width: 400px; height: 400px; top: -100px; left: -100px; animation: drift1 35s linear infinite; }
.fp-2 { width: 300px; height: 300px; top: 20%; left: 60%; animation: drift2 45s linear infinite; }
.fp-3 { width: 500px; height: 500px; top: 40%; left: -150px; animation: drift3 55s linear infinite; }
.fp-4 { width: 350px; height: 350px; top: 60%; left: 70%; animation: drift4 40s linear infinite; }
.fp-5 { width: 250px; height: 250px; top: 80%; left: 30%; animation: drift5 30s linear infinite; }
.fp-6 { width: 450px; height: 450px; top: 10%; left: 40%; animation: drift6 50s linear infinite; }
.fp-7 { width: 200px; height: 200px; top: 50%; left: 80%; animation: drift1 60s linear infinite; }
.fp-8 { width: 380px; height: 380px; top: 70%; left: 10%; animation: drift2 38s linear infinite; }

@keyframes drift1 { 0% { transform: translate(0, 0); } 50% { transform: translate(120px, 80px); } 100% { transform: translate(0, 0); } }
@keyframes drift2 { 0% { transform: translate(0, 0); } 50% { transform: translate(-100px, 60px); } 100% { transform: translate(0, 0); } }
@keyframes drift3 { 0% { transform: translate(0, 0); } 50% { transform: translate(80px, -50px); } 100% { transform: translate(0, 0); } }
@keyframes drift4 { 0% { transform: translate(0, 0); } 50% { transform: translate(-60px, -80px); } 100% { transform: translate(0, 0); } }
@keyframes drift5 { 0% { transform: translate(0, 0); } 50% { transform: translate(90px, 40px); } 100% { transform: translate(0, 0); } }
@keyframes drift6 { 0% { transform: translate(0, 0); } 50% { transform: translate(-70px, 70px); } 100% { transform: translate(0, 0); } }

/* ===== ZONE 1 — THE LANTERN ===== */
#zone-lantern {
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

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

#constellation-svg {
    width: 100%;
    height: 100%;
}

.lantern-frame {
    position: relative;
    z-index: 2;
    opacity: 0;
    animation: lanternFadeIn 1.2s cubic-bezier(0.16, 1, 0.3, 1) 0.4s forwards;
}

@keyframes lanternFadeIn {
    to { opacity: 1; }
}

.hero-hex {
    width: clamp(280px, 50vw, 500px);
    height: clamp(320px, 55vw, 560px);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    background: var(--mariners-shadow);
}

.watercolor-wash {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    animation: watercolorBloom 2s ease-out 1.6s forwards;
    filter: blur(40px);
    mix-blend-mode: multiply;
}

.hero-hex .watercolor-wash {
    background:
        radial-gradient(ellipse at 30% 40%, rgba(58, 95, 138, 0.35), transparent 60%),
        radial-gradient(ellipse at 70% 60%, rgba(79, 209, 197, 0.25), transparent 50%),
        radial-gradient(ellipse at 50% 80%, rgba(139, 127, 173, 0.2), transparent 55%);
}

@keyframes watercolorBloom {
    0% { opacity: 0; transform: scale(0.5); }
    100% { opacity: 1; transform: scale(1); }
}

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

.hero-title {
    font-family: 'Bungee Hairline', cursive;
    font-weight: 400;
    font-size: clamp(3rem, 8vw, 6rem);
    color: var(--foam-crest);
    letter-spacing: 0.12em;
    line-height: 1.05;
    text-transform: uppercase;
    animation: titleGlow 4s ease-in-out infinite;
}

@keyframes titleGlow {
    0%, 100% { text-shadow: 0 0 20px rgba(79, 209, 197, 0.2); }
    50% { text-shadow: 0 0 40px rgba(79, 209, 197, 0.4); }
}

.hero-subtitle {
    font-family: 'Nunito Sans', sans-serif;
    font-weight: 300;
    font-size: clamp(0.9rem, 1.5vw, 1.1rem);
    color: #a8c4d0;
    margin-top: 1.5rem;
    opacity: 0;
    animation: lanternFadeIn 1s ease 2.4s forwards;
}

.candle-glow {
    position: absolute;
    border-radius: 50%;
    pointer-events: none;
    animation: flicker 3s ease-in-out infinite;
}

.candle-hero {
    width: 200px;
    height: 200px;
    top: -40px;
    right: -60px;
    background: radial-gradient(circle, rgba(246, 166, 35, 0.3), transparent 70%);
    animation-delay: 0.5s;
}

@keyframes flicker {
    0%, 100% { opacity: 0.85; transform: scale(1); }
    25% { opacity: 0.7; transform: scale(0.97); }
    50% { opacity: 0.9; transform: scale(1.02); }
    75% { opacity: 0.75; transform: scale(0.99); }
}

/* Satellite orbit */
.satellite-orbit {
    position: absolute;
    width: clamp(350px, 60vw, 650px);
    height: clamp(350px, 60vw, 650px);
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    animation: orbit 90s linear infinite;
    z-index: 2;
    pointer-events: none;
}

@keyframes orbit {
    from { transform: translate(-50%, -50%) rotate(0deg); }
    to { transform: translate(-50%, -50%) rotate(360deg); }
}

.satellite {
    position: absolute;
    width: 45px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Fira Code', monospace;
    font-size: 1rem;
    color: var(--bioluminescent);
    background: rgba(19, 39, 66, 0.6);
}

.satellite:nth-child(1) { top: 0; left: 50%; transform: translateX(-50%) rotate(0deg); }
.satellite:nth-child(2) { top: 50%; right: 0; transform: translateY(-50%) rotate(0deg); }
.satellite:nth-child(3) { bottom: 0; left: 50%; transform: translateX(-50%) rotate(0deg); }
.satellite:nth-child(4) { top: 50%; left: 0; transform: translateY(-50%) rotate(0deg); }

/* ===== CIRCUIT-KELP ===== */
.circuit-kelp-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
}

.tendril {
    stroke-dashoffset: 1000;
    transition: stroke-dashoffset 0.1s linear;
}

/* ===== ZONE 2 — THE REEF ===== */
#zone-reef {
    min-height: 150vh;
    padding: 10vh 5vw;
    position: relative;
}

.honeycomb-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 2rem;
    max-width: 1200px;
    margin: 0 auto;
}

.hex-cell {
    width: 100%;
    aspect-ratio: 1 / 1.15;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    position: relative;
    background: var(--mariners-shadow);
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.8s ease, transform 0.8s ease;
}

.hex-cell.visible {
    opacity: 1;
    transform: translateY(0);
}

.text-cell .cell-text {
    font-family: 'Nunito Sans', sans-serif;
    font-weight: 300;
    color: #a8c4d0;
    font-size: clamp(0.85rem, 1.2vw, 1rem);
    text-align: center;
    line-height: 1.7;
}

.data-cell {
    gap: 0.5rem;
}

.data-annotation {
    font-family: 'Fira Code', monospace;
    font-size: clamp(0.7rem, 1vw, 0.85rem);
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--bioluminescent);
}

.candle-cell {
    background: rgba(19, 39, 66, 0.4);
}

.candle-small {
    width: 120px;
    height: 120px;
    background: radial-gradient(circle, rgba(246, 166, 35, 0.25), transparent 70%);
    position: relative;
}

.cell-word {
    font-family: 'Bungee Hairline', cursive;
    font-weight: 400;
    font-size: 1.4rem;
    color: var(--foam-crest);
    letter-spacing: 0.12em;
    margin-top: 0.5rem;
}

/* Watercolor variants */
.wash-variant-1 {
    background:
        radial-gradient(ellipse at 40% 30%, rgba(58, 95, 138, 0.3), transparent 55%),
        radial-gradient(ellipse at 60% 70%, rgba(79, 209, 197, 0.2), transparent 50%);
    opacity: 1;
    animation: none;
    filter: blur(30px);
}

.wash-variant-2 {
    background:
        radial-gradient(ellipse at 30% 60%, rgba(139, 127, 173, 0.3), transparent 55%),
        radial-gradient(ellipse at 70% 30%, rgba(58, 95, 138, 0.25), transparent 50%);
    opacity: 1;
    animation: none;
    filter: blur(35px);
}

.wash-variant-3 {
    background:
        radial-gradient(ellipse at 50% 50%, rgba(79, 209, 197, 0.3), transparent 55%),
        radial-gradient(ellipse at 20% 80%, rgba(139, 127, 173, 0.2), transparent 50%);
    opacity: 1;
    animation: none;
    filter: blur(30px);
}

.watercolor-cell {
    background: var(--mariners-shadow);
}

/* Underline draw animation */
.underline-draw {
    background-image: linear-gradient(var(--corroded-neon), var(--corroded-neon));
    background-size: 0% 2px;
    background-position: left bottom;
    background-repeat: no-repeat;
    transition: background-size 0.6s ease;
    padding-bottom: 2px;
}

.underline-draw.drawn {
    background-size: 100% 2px;
}

/* ===== ZONE 3 — THE SIGNAL ===== */
#zone-signal {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    background: linear-gradient(to bottom, var(--mariners-shadow), var(--abyssal-ink), var(--deep-void));
}

.scatter-hex {
    position: absolute;
    width: 150px;
    height: 170px;
    transition: transform 1.5s cubic-bezier(0.68, -0.55, 0.27, 1.55), opacity 1s ease;
}

.scatter-hex[data-scatter="top-left"] { top: 30%; left: 30%; }
.scatter-hex[data-scatter="top-right"] { top: 25%; right: 30%; }
.scatter-hex[data-scatter="bottom-left"] { bottom: 30%; left: 25%; }
.scatter-hex[data-scatter="bottom-right"] { bottom: 25%; right: 25%; }

.scatter-hex.scattered {
    opacity: 0;
}
.scatter-hex.scattered[data-scatter="top-left"] { transform: translate(-200px, -200px); }
.scatter-hex.scattered[data-scatter="top-right"] { transform: translate(200px, -200px); }
.scatter-hex.scattered[data-scatter="bottom-left"] { transform: translate(-200px, 200px); }
.scatter-hex.scattered[data-scatter="bottom-right"] { transform: translate(200px, 200px); }

.signal-content {
    position: relative;
    z-index: 3;
    text-align: center;
    max-width: 600px;
    padding: 2rem;
}

.candle-large {
    width: 300px;
    height: 300px;
    top: -100px;
    left: 50%;
    transform: translateX(-50%);
    background: radial-gradient(circle, rgba(246, 166, 35, 0.35), transparent 65%);
    animation-duration: 3.5s;
}

.signal-text {
    font-family: 'Nunito Sans', sans-serif;
    font-weight: 300;
    color: #a8c4d0;
    font-size: clamp(1rem, 1.8vw, 1.2rem);
    line-height: 1.8;
    margin-bottom: 3rem;
}

.signal-closing {
    font-family: 'Nunito Sans', sans-serif;
    font-weight: 400;
    font-size: clamp(1.2rem, 2vw, 1.5rem);
    color: var(--foam-crest);
    line-height: 2;
}

.signal-closing .underline-draw {
    margin: 0 0.2em;
}

/* ===== REDUCED MOTION ===== */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation: none !important;
        transition: none !important;
    }
    .lantern-frame, .hero-subtitle, .hex-cell, .watercolor-wash {
        opacity: 1 !important;
        transform: none !important;
    }
    .underline-draw {
        background-size: 100% 2px !important;
    }
}
