@import url('https://fonts.googleapis.com/css2?family=Zen+Dots&family=Noto+Serif+JP:wght@500&family=Nunito+Sans:wght@300;600&family=Share+Tech+Mono&display=swap');

:root {
    --color-midnight: #0A1628;
    --color-indigo: #0F2847;
    --color-teal: #1A6B5A;
    --color-seafoam: #A8E6CF;
    --color-gold: #D4A847;
    --color-pearl: #F0EDE5;
    --color-jade: #D4E8E0;
    --color-cyan: #5BA8A0;
    --color-sumi: #121820;

    --spring-ease: cubic-bezier(0.34, 1.56, 0.64, 1);
}

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

html {
    scroll-behavior: smooth;
}

html, body {
    width: 100%;
    overflow-x: hidden;
}

body {
    font-family: 'Nunito Sans', sans-serif;
    font-weight: 300;
    background: var(--color-midnight);
    color: rgba(212, 232, 224, 0.85);
    line-height: 1.75;
    font-size: clamp(0.95rem, 1.8vw, 1.15rem);
    cursor: none;
}

/* ============================================================
   BACKGROUND LAYERS
   ============================================================ */

#background-waves {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 0;
    pointer-events: none;
}

#seigaiha-layer {
    position: fixed;
    top: 0;
    left: 0;
    width: 200vw;
    height: 100vh;
    z-index: 1;
    pointer-events: none;
    opacity: 0.035;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='100' height='50' viewBox='0 0 100 50'%3E%3Cpath d='M0 50 A50 50 0 0 1 50 0 A50 50 0 0 1 100 50' fill='none' stroke='%235BA8A0' stroke-width='0.8'/%3E%3Cpath d='M25 50 A25 25 0 0 1 50 25 A25 25 0 0 1 75 50' fill='none' stroke='%235BA8A0' stroke-width='0.6'/%3E%3C/svg%3E");
    background-size: 100px 50px;
    animation: seigaihaDrift 60s linear infinite;
}

@keyframes seigaihaDrift {
    from { transform: translateX(0); }
    to { transform: translateX(-100px); }
}

#fallen-leaves-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 5;
    pointer-events: none;
    overflow: hidden;
}

.fallen-leaf {
    position: absolute;
    width: 10px;
    height: 10px;
    pointer-events: none;
    animation: leafFall 8s linear forwards;
}

.fallen-leaf svg {
    width: 100%;
    height: 100%;
}

@keyframes leafFall {
    0% {
        opacity: 0.4;
        transform: translate(0, 0) rotate(0deg);
    }
    100% {
        opacity: 0;
        transform: translate(80px, 100vh) rotate(360deg);
    }
}

/* ============================================================
   FIXED HUD
   ============================================================ */

.fixed-hud {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 50;
    pointer-events: none;
}

.hud-ring {
    position: fixed;
    top: 1.5rem;
    left: 1.5rem;
    width: 80px;
    height: 80px;
    pointer-events: none;
}

.hud-ring-bg {
    stroke: var(--color-cyan);
    opacity: 0.15;
}

.hud-ring-fill {
    stroke: var(--color-seafoam);
    opacity: 0.6;
    stroke-dasharray: 327;
    stroke-dashoffset: 327;
    transition: stroke-dashoffset 0.8s ease-out;
    transform: rotate(-90deg);
    transform-origin: 60px 60px;
}

.hud-ring-label {
    font-family: 'Share Tech Mono', monospace;
    font-size: 14px;
    fill: var(--color-cyan);
    opacity: 0.6;
}

.leaf-waypoints {
    position: fixed;
    right: 1.8rem;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    flex-direction: column;
    gap: 1.8rem;
    z-index: 55;
    pointer-events: auto;
}

.waypoint {
    width: 18px;
    height: 26px;
    background: none;
    border: none;
    cursor: none;
    padding: 0;
    color: var(--color-cyan);
    opacity: 0.3;
    transition: opacity 0.4s ease, color 0.4s ease, transform 0.4s var(--spring-ease);
    pointer-events: auto;
}

.waypoint:hover {
    opacity: 0.7;
    transform: scale(1.15);
}

.waypoint.active {
    opacity: 1;
    color: var(--color-seafoam);
    filter: drop-shadow(0 0 6px rgba(168, 230, 207, 0.4));
}

.ginkgo-icon {
    width: 100%;
    height: 100%;
}

/* ============================================================
   ENSO CURSOR
   ============================================================ */

.enso-cursor {
    position: fixed;
    width: 48px;
    height: 48px;
    z-index: 200;
    pointer-events: none;
    color: var(--color-seafoam);
    opacity: 0.2;
    transition: opacity 0.3s ease, transform 0.1s linear;
    will-change: transform;
}

.enso-cursor svg {
    width: 100%;
    height: 100%;
    animation: slowRotate 20s linear infinite;
}

.enso-cursor.hovering-panel {
    opacity: 0.4;
}

.enso-cursor.hovering-panel svg {
    transform: scale(1.15);
    transition: transform 0.4s var(--spring-ease);
}

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

/* ============================================================
   CURSOR TRAIL
   ============================================================ */

#cursor-trail-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 45;
    pointer-events: none;
    overflow: hidden;
}

.cursor-brushstroke {
    position: absolute;
    pointer-events: none;
    opacity: 0.3;
    animation: brushFade 2s ease-out forwards;
    will-change: opacity;
}

.cursor-brushstroke.gold-trail {
    color: var(--color-gold);
}

@keyframes brushFade {
    0% { opacity: 0.3; }
    100% { opacity: 0; }
}

/* ============================================================
   CHAMBERS
   ============================================================ */

.chamber {
    position: relative;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 6rem 2rem;
    z-index: 10;
}

.chamber-surface {
    background: linear-gradient(180deg,
        rgba(15, 40, 71, 0.3) 0%,
        rgba(10, 22, 40, 0.5) 100%
    );
}

.chamber-descent {
    background: linear-gradient(180deg,
        rgba(10, 22, 40, 0.4) 0%,
        rgba(10, 22, 40, 0.7) 100%
    );
}

.chamber-current {
    background: linear-gradient(180deg,
        rgba(10, 22, 40, 0.7) 0%,
        rgba(10, 22, 40, 0.9) 100%
    );
}

.chamber-trench {
    background: linear-gradient(180deg,
        rgba(10, 22, 40, 0.9) 0%,
        var(--color-midnight) 100%
    );
}

.chamber-bioluminescence {
    background: linear-gradient(180deg,
        var(--color-midnight) 0%,
        #060D18 100%
    );
}

/* ============================================================
   CONTENT PANELS
   ============================================================ */

.content-panel {
    position: relative;
    max-width: 56%;
    background: rgba(15, 40, 71, 0.65);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    padding: clamp(2rem, 4vw, 3.5rem);
    border-radius: 6px;
    border: 1px solid rgba(91, 168, 160, 0.15);
    box-shadow:
        0 0 40px rgba(10, 22, 40, 0.5),
        inset 0 0 30px rgba(15, 40, 71, 0.3);
}

.content-panel.wide {
    max-width: 65%;
}

.panel-hero {
    text-align: left;
    max-width: 60%;
    background: rgba(15, 40, 71, 0.45);
}

/* Panel reveal animation */
.reveal-panel {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

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

/* Preserve the slight rotation on visible panels */
.reveal-panel.visible[style*="rotate"] {
    opacity: 1;
}

/* ============================================================
   TYPOGRAPHY
   ============================================================ */

.chamber-title {
    font-family: 'Zen Dots', sans-serif;
    font-size: clamp(2.8rem, 7vw, 6rem);
    color: var(--color-seafoam);
    text-shadow: 0 0 30px rgba(168, 230, 207, 0.3);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    line-height: 1.1;
    margin-bottom: 1.2rem;
}

.tagline {
    font-family: 'Noto Serif JP', serif;
    font-size: clamp(1.1rem, 2.5vw, 1.6rem);
    font-weight: 500;
    color: var(--color-pearl);
    letter-spacing: 0.02em;
    opacity: 0.8;
}

.section-title {
    font-family: 'Noto Serif JP', serif;
    font-size: clamp(1.4rem, 3.5vw, 2.4rem);
    font-weight: 500;
    color: var(--color-pearl);
    letter-spacing: 0.02em;
    margin-bottom: 1.2rem;
}

.body-text {
    font-family: 'Nunito Sans', sans-serif;
    font-weight: 300;
    font-size: clamp(0.95rem, 1.8vw, 1.15rem);
    color: rgba(212, 232, 224, 0.85);
    line-height: 1.75;
    margin-bottom: 1rem;
}

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

.emphasis {
    font-weight: 600;
    color: var(--color-seafoam);
}

.pull-quote {
    font-family: 'Noto Serif JP', serif;
    font-size: clamp(1.2rem, 2.8vw, 1.8rem);
    font-weight: 500;
    color: var(--color-gold);
    letter-spacing: 0.02em;
    line-height: 1.5;
    font-style: italic;
}

.hud-text {
    font-family: 'Share Tech Mono', monospace;
    font-size: clamp(0.65rem, 1.2vw, 0.8rem);
    color: var(--color-cyan);
    opacity: 0.6;
    letter-spacing: 0.1em;
}

/* Bioluminescence chamber special typography */
.glow-title {
    color: var(--color-seafoam);
    text-shadow: 0 0 40px rgba(168, 230, 207, 0.5), 0 0 80px rgba(168, 230, 207, 0.2);
}

.glow-text {
    color: rgba(212, 232, 224, 0.95);
}

.glow-quote {
    color: var(--color-gold);
    text-shadow: 0 0 30px rgba(212, 168, 71, 0.3);
}

/* ============================================================
   ENSO MARKERS
   ============================================================ */

.enso-bg-marker {
    position: absolute;
    width: clamp(200px, 30vw, 300px);
    height: clamp(200px, 30vw, 300px);
    z-index: -1;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.4s ease;
}

.chamber-surface .enso-bg-marker {
    top: 15%;
    right: 20%;
    color: var(--color-seafoam);
}

.chamber-descent .enso-bg-marker {
    top: 10%;
    left: 8%;
    color: var(--color-teal);
}

.chamber-current .enso-bg-marker {
    bottom: 10%;
    right: 12%;
    color: var(--color-cyan);
}

.chamber-trench .enso-bg-marker {
    top: 8%;
    left: 15%;
    color: var(--color-teal);
}

.enso-draw-path {
    stroke: currentColor;
    opacity: 0.12;
    stroke-dasharray: 1000;
    stroke-dashoffset: 1000;
    transition: stroke-dashoffset 1.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.enso-bg-marker.drawn {
    opacity: 1;
}

.enso-bg-marker.drawn .enso-draw-path {
    stroke-dashoffset: 0;
}

.enso-final {
    position: absolute;
    width: clamp(250px, 40vw, 400px);
    height: clamp(250px, 40vw, 400px);
    top: 10%;
    left: 50%;
    transform: translateX(-50%);
    z-index: -1;
    pointer-events: none;
    color: var(--color-seafoam);
    opacity: 0;
    transition: opacity 0.4s ease;
}

.enso-final.drawn {
    opacity: 1;
}

.enso-final .enso-draw-path {
    stroke: currentColor;
    opacity: 0.2;
    stroke-dasharray: 1200;
    stroke-dashoffset: 1200;
    transition: stroke-dashoffset 1.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.enso-final.drawn .enso-draw-path {
    stroke-dashoffset: 0;
}

/* ============================================================
   LEAF & PLANT MOTIFS
   ============================================================ */

.bamboo-left {
    position: absolute;
    left: 3%;
    top: 10%;
    height: 80%;
    color: var(--color-teal);
    opacity: 0.4;
    animation: bambooSway 6s ease-in-out infinite alternate;
}

.bamboo-right {
    position: absolute;
    right: 3%;
    top: 5%;
    height: 90%;
    color: var(--color-teal);
    opacity: 0.35;
    animation: bambooSway 7s ease-in-out infinite alternate-reverse;
}

.bamboo-cluster {
    height: 100%;
    width: 40px;
}

@keyframes bambooSway {
    from { transform: rotate(-2deg); }
    to { transform: rotate(2deg); }
}

.ginkgo-divider-left {
    position: absolute;
    left: 6%;
    top: 15%;
    color: var(--color-teal);
    opacity: 0.3;
    animation: bambooSway 8s ease-in-out infinite alternate;
}

.ginkgo-divider-right {
    position: absolute;
    right: 6%;
    bottom: 15%;
    color: var(--color-teal);
    opacity: 0.25;
    animation: bambooSway 9s ease-in-out infinite alternate-reverse;
}

.ginkgo-large {
    width: 60px;
    height: 90px;
}

.monstera-bg {
    position: absolute;
    pointer-events: none;
    z-index: -1;
}

.monstera-left {
    left: -2%;
    bottom: 5%;
    color: var(--color-cyan);
}

.monstera-right {
    right: -2%;
    top: 10%;
    color: var(--color-cyan);
}

.monstera-silhouette {
    width: clamp(150px, 20vw, 250px);
    height: auto;
}

/* ============================================================
   BRUSHSTROKE DIVIDERS
   ============================================================ */

.brushstroke-divider {
    width: 100%;
    max-width: 300px;
    height: 20px;
    color: var(--color-teal);
    margin: 1.5rem 0;
    opacity: 0.4;
}

/* ============================================================
   HUD LABELS & DATA
   ============================================================ */

.hud-depth-label {
    position: absolute;
    bottom: 2rem;
    right: 3rem;
}

.hud-data-overlay {
    position: absolute;
    top: 15%;
    right: 4%;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

/* ============================================================
   WATER DROPLETS
   ============================================================ */

.water-droplets {
    display: flex;
    gap: 2rem;
    justify-content: center;
    margin-top: 2rem;
}

.droplet {
    width: 5px;
    height: 8px;
    background: var(--color-cyan);
    border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%;
    opacity: 0.4;
    animation: dripDissolve 3s ease-in-out infinite;
}

.droplet:nth-child(2) {
    animation-delay: 1s;
}

.droplet:nth-child(3) {
    animation-delay: 2s;
}

@keyframes dripDissolve {
    0% {
        opacity: 0.4;
        transform: translateY(0) scale(1);
    }
    50% {
        opacity: 0.2;
        transform: translateY(12px) scale(0.8);
    }
    100% {
        opacity: 0;
        transform: translateY(24px) scale(0.3);
    }
}

/* ============================================================
   BIOLUMINESCENT PARTICLES
   ============================================================ */

#bioluminescent-particles {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    overflow: hidden;
    z-index: -1;
}

.bio-particle {
    position: absolute;
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: var(--color-seafoam);
    opacity: 0;
    animation: bioRise 10s ease-in-out infinite;
}

@keyframes bioRise {
    0% {
        opacity: 0;
        transform: translateY(100%) scale(0.5);
    }
    20% {
        opacity: 0.35;
    }
    80% {
        opacity: 0.2;
    }
    100% {
        opacity: 0;
        transform: translateY(-100vh) scale(1.2);
    }
}

/* ============================================================
   DESCENT PANELS & CURRENT PANELS
   ============================================================ */

.descent-panels,
.current-panels {
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 800px;
    gap: 0;
}

.trench-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */

@media (max-width: 768px) {
    body {
        cursor: auto;
    }

    .fixed-hud {
        display: none;
    }

    .enso-cursor {
        display: none;
    }

    #cursor-trail-container {
        display: none;
    }

    .content-panel,
    .content-panel.wide,
    .panel-hero {
        max-width: 92%;
    }

    .chamber {
        padding: 4rem 1rem;
    }

    .bamboo-left,
    .bamboo-right,
    .ginkgo-divider-left,
    .ginkgo-divider-right {
        display: none;
    }

    .monstera-bg {
        opacity: 0.5;
    }

    .hud-data-overlay {
        display: none;
    }

    .hud-depth-label {
        right: 1rem;
        bottom: 1rem;
    }

    .descent-panels .content-panel,
    .current-panels .content-panel {
        margin-left: 0 !important;
        margin-right: 0 !important;
    }
}
