/* ============================================
   prototype.bar — Submerged Inventor's Journal
   ============================================ */

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

:root {
    --warm-bg: #f4ede1;
    --cool-bg: #1a3a40;
    --sepia-ink: #3b2a1a;
    --bleached-shell: #e8dfd0;
    --coral: #c87f5a;
    --patina: #5a9e8a;
    --crystal: #a8d4d0;
    --bioluminescent: #d4a843;
    --tech-green: #7a9e8e;
    --mid-depth-1: #8a7a68;
    --mid-depth-2: #4a5a58;
    --text-body-warm: #4a3f35;
    --text-body-cool: #d4cbbf;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Nunito Sans', sans-serif;
    font-weight: 300;
    background-color: var(--warm-bg);
    color: var(--sepia-ink);
    overflow-x: hidden;
    position: relative;
    transition: background-color 0.6s ease;
}

.svg-filters {
    position: absolute;
    width: 0;
    height: 0;
    overflow: hidden;
}

/* --- Paper Texture Overlay --- */
.paper-texture {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1000;
    background-image:
        radial-gradient(ellipse at 40% 30%, rgba(244, 237, 225, 0.15) 0%, rgba(59, 42, 26, 0.06) 100%);
    box-shadow: inset 0 0 200px rgba(59, 42, 26, 0.08);
    opacity: 0.5;
}

/* --- Scan Line (glitch) --- */
.scan-line {
    position: fixed;
    left: 0;
    width: 100%;
    height: 1px;
    background-color: var(--crystal);
    opacity: 0;
    z-index: 9999;
    pointer-events: none;
    transform: translateY(-100vh);
}

.scan-line.active {
    opacity: 0.4;
    animation: scanSweep 200ms linear forwards;
}

@keyframes scanSweep {
    from { transform: translateY(-10vh); }
    to   { transform: translateY(110vh); }
}

/* --- Navigation Word --- */
.nav-word {
    position: fixed;
    top: 2rem;
    left: 2rem;
    z-index: 500;
}

.nav-label {
    font-family: 'Caveat', cursive;
    font-size: 0.75rem;
    color: var(--sepia-ink);
    opacity: 0.4;
    transition: color 0.6s ease, opacity 0.3s ease;
}

body[data-zone="cool"] .nav-label {
    color: var(--bleached-shell);
}

/* --- Scroll Indicator --- */
.scroll-indicator {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    display: flex;
    flex-direction: column;
    gap: 8px;
    z-index: 500;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.scroll-indicator:hover {
    opacity: 1;
}

.crystal-dot {
    width: 10px;
    height: 12px;
    clip-path: polygon(50% 0%, 100% 35%, 80% 100%, 20% 100%, 0% 35%);
    background-color: var(--patina);
    opacity: 0.25;
    transition: opacity 0.3s ease, background-color 0.3s ease;
}

.crystal-dot.active {
    opacity: 0.8;
    background-color: var(--crystal);
}

/* --- Opening Section --- */
.opening {
    position: relative;
    height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding-left: 12vw;
}

.title-main {
    font-family: 'Caveat', cursive;
    font-weight: 700;
    font-size: clamp(3rem, 7vw, 5rem);
    color: var(--sepia-ink);
    opacity: 0;
    transition: opacity 1200ms ease;
}

.title-main.visible {
    opacity: 1;
}

.title-sub {
    display: block;
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 300;
    font-size: 0.8rem;
    letter-spacing: 0.15em;
    color: var(--patina);
    opacity: 0;
    transition: opacity 800ms ease;
    margin-top: 0.5rem;
}

.title-sub.visible {
    opacity: 1;
}

/* --- Opening Crystal --- */
.crystal-opening {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 400px;
    height: 400px;
    z-index: 2;
}

.crystal-opening .crystal-path {
    fill: var(--crystal);
    fill-opacity: 0;
    stroke: var(--patina);
    stroke-width: 0.5;
    stroke-opacity: 0.3;
    stroke-dasharray: 1000;
    stroke-dashoffset: 1000;
}

.crystal-opening.animate .crystal-path {
    animation: crystalDraw 2000ms cubic-bezier(0.25, 0.1, 0.25, 1) forwards;
}

.crystal-opening.animate .crystal-path:nth-child(2) { animation-delay: 200ms; }
.crystal-opening.animate .crystal-path:nth-child(3) { animation-delay: 400ms; }
.crystal-opening.animate .crystal-path:nth-child(4) { animation-delay: 600ms; }
.crystal-opening.animate .crystal-path:nth-child(5) { animation-delay: 800ms; }
.crystal-opening.animate .crystal-path:nth-child(6) { animation-delay: 1000ms; }

@keyframes crystalDraw {
    0% {
        stroke-dashoffset: 1000;
        fill-opacity: 0;
    }
    70% {
        stroke-dashoffset: 0;
        fill-opacity: 0;
    }
    100% {
        stroke-dashoffset: 0;
        fill-opacity: 0.12;
    }
}

/* --- Content Islands --- */
.content-island {
    position: relative;
    margin-left: var(--island-x, 10vw);
    max-width: 520px;
    opacity: 0;
    transition: opacity 900ms ease-out;
}

.content-island.visible {
    opacity: 1;
}

/* Vertical spacing between islands */
.island-1 { margin-top: 25vh; }
.island-2 { margin-top: 35vh; }
.island-3 { margin-top: 40vh; }
.island-4 { margin-top: 30vh; }
.island-5 { margin-top: 45vh; }

.island-inner {
    position: relative;
    z-index: 3;
}

/* Hover temperature shift */
.content-island::before {
    content: '';
    position: absolute;
    top: -2rem;
    left: -2rem;
    right: -2rem;
    bottom: -2rem;
    border-radius: 50%;
    opacity: 0;
    transition: opacity 0.4s ease;
    pointer-events: none;
    z-index: 1;
}

.content-island[data-zone="warm"]::before {
    background: radial-gradient(ellipse at center, rgba(168, 212, 208, 0.08) 0%, transparent 70%);
}

.content-island[data-zone="cool"]::before {
    background: radial-gradient(ellipse at center, rgba(200, 127, 90, 0.08) 0%, transparent 70%);
}

.content-island:hover::before {
    opacity: 1;
}

/* Island typography */
.island-title {
    font-family: 'Caveat', cursive;
    font-weight: 700;
    font-size: clamp(2rem, 5vw, 4rem);
    line-height: 1.2;
    margin-bottom: 1rem;
    color: var(--sepia-ink);
}

.island-body {
    font-family: 'Nunito Sans', sans-serif;
    font-weight: 300;
    font-size: clamp(0.95rem, 1.1vw, 1.1rem);
    line-height: 1.85;
    max-width: 48ch;
    color: var(--text-body-warm);
    margin-bottom: 1.2rem;
}

.island-label {
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 300;
    font-size: 0.7rem;
    letter-spacing: 0.12em;
    text-transform: lowercase;
    color: var(--patina);
}

/* Cool zone text colors */
.content-island[data-zone="cool"] .island-title {
    color: var(--bleached-shell);
}

.content-island[data-zone="cool"] .island-body {
    color: var(--text-body-cool);
}

.content-island[data-zone="cool"] .island-label {
    color: var(--crystal);
}

/* --- Crystal Macros on Islands --- */
.crystal-macro {
    position: absolute;
    z-index: 2;
    pointer-events: none;
}

.crystal-macro .crystal-path {
    fill: var(--crystal);
    fill-opacity: 0;
    stroke: var(--patina);
    stroke-width: 0.5;
    stroke-opacity: 0.3;
    stroke-dasharray: 800;
    stroke-dashoffset: 800;
}

.content-island.visible .crystal-macro .crystal-path {
    animation: crystalDraw 2500ms cubic-bezier(0.25, 0.1, 0.25, 1) forwards;
}

.content-island.visible .crystal-macro .crystal-path:nth-child(2) { animation-delay: 300ms; }
.content-island.visible .crystal-macro .crystal-path:nth-child(3) { animation-delay: 600ms; }
.content-island.visible .crystal-macro .crystal-path:nth-child(4) { animation-delay: 900ms; }

.crystal-1 { width: 200px; height: 200px; bottom: -40px; right: -60px; }
.crystal-2 { width: 250px; height: 250px; bottom: -60px; left: -80px; }
.crystal-3 { width: 220px; height: 220px; bottom: -50px; right: -70px; }
.crystal-4 { width: 180px; height: 180px; bottom: -30px; left: -60px; }
.crystal-5 { width: 200px; height: 200px; bottom: -40px; right: -50px; }

/* --- Tide Marks --- */
.tide-mark {
    display: block;
    width: 80%;
    height: 10px;
    margin: 10vh auto;
    overflow: visible;
}

.tide-path {
    fill: none;
    stroke: var(--patina);
    stroke-width: 1;
    stroke-opacity: 0.25;
    stroke-dasharray: 8 16;
}

/* --- Blueprint Ghost Diagrams --- */
.blueprint-ghost {
    position: relative;
    pointer-events: none;
    z-index: 1;
}

.blueprint-ghost svg {
    display: block;
}

.ghost-1 {
    width: 300px;
    margin-left: 60vw;
    margin-top: 8vh;
    color: var(--sepia-ink);
    opacity: 0.06;
}

.ghost-2 {
    width: 280px;
    margin-left: 10vw;
    margin-top: 10vh;
    color: var(--crystal);
    opacity: 0.08;
}

/* --- Meso Crystals --- */
.meso-crystal {
    pointer-events: none;
    z-index: 1;
}

.meso-1 {
    width: 60px;
    margin-left: 75vw;
    margin-top: -5vh;
}

.meso-2 {
    width: 50px;
    margin-left: 20vw;
    margin-top: 5vh;
}

.meso-3 {
    width: 70px;
    margin-left: 80vw;
    margin-top: -8vh;
}

/* --- Final Spacer --- */
.final-spacer {
    height: 30vh;
}

/* --- Responsive --- */
@media (max-width: 768px) {
    .content-island {
        margin-left: 6vw !important;
        max-width: calc(100vw - 12vw);
    }

    .crystal-opening {
        width: 250px;
        height: 250px;
    }

    .crystal-macro {
        display: none;
    }

    .blueprint-ghost {
        display: none;
    }

    .meso-crystal {
        display: none;
    }
}
