/* ============================================
   munju.wiki - Neon Pastoral Japanese Minimalism
   ============================================ */

/* --- CSS Custom Properties --- */
:root {
    /* Palette */
    --midnight-indigo: #0a0612;
    --deep-murasaki: #1a0a2e;
    --twilight-plum: #2d1b4e;
    --neon-rose: #ff2d8a;
    --electric-violet: #7b2ff7;
    --acid-chartreuse: #c8ff00;
    --moonlit-paper: #f0e6f6;
    --soft-lavender: #c8b8e0;

    /* Neon Glow Variables */
    --neon: rgba(255, 45, 138, 0.6);
    --neon-dim: rgba(255, 45, 138, 0.25);
    --neon-faint: rgba(255, 45, 138, 0.1);
    --violet-glow: rgba(123, 47, 247, 0.5);
    --violet-dim: rgba(123, 47, 247, 0.2);

    /* Scroll position (updated by JS) */
    --scroll-y: 0px;

    /* Parallax speeds */
    --parallax-bg: -0.3;
    --parallax-content: 0;
    --parallax-overlay: 0.15;
}

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

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

body {
    background-color: var(--midnight-indigo);
    color: var(--soft-lavender);
    font-family: 'Noto Sans JP', sans-serif;
    font-weight: 300;
    font-size: clamp(0.95rem, 1.1vw, 1.15rem);
    line-height: 1.85;
    letter-spacing: 0.015em;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* --- Parallax Container --- */
.parallax-container {
    position: relative;
    width: 100%;
}

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

/* --- Layer System --- */
.bg-layer {
    position: absolute;
    inset: 0;
    z-index: 1;
    transform: translateY(calc(var(--scroll-y) * var(--parallax-bg)));
    will-change: transform;
    pointer-events: none;
}

.content-layer {
    position: relative;
    z-index: 2;
    transform: translateY(calc(var(--scroll-y) * var(--parallax-content)));
}

.overlay-layer {
    position: absolute;
    inset: 0;
    z-index: 3;
    transform: translateY(calc(var(--scroll-y) * var(--parallax-overlay)));
    will-change: transform;
    pointer-events: none;
}

/* --- Watercolor Washes --- */
.watercolor-wash {
    position: absolute;
    border-radius: 50%;
    pointer-events: none;
    will-change: transform, opacity;
}

.wash-violet {
    background: radial-gradient(ellipse at center, rgba(123, 47, 247, 0.15) 0%, rgba(123, 47, 247, 0.05) 50%, transparent 70%);
}

.wash-magenta {
    background: radial-gradient(ellipse at center, rgba(255, 45, 138, 0.12) 0%, rgba(255, 45, 138, 0.04) 50%, transparent 70%);
}

.wash-chartreuse {
    background: radial-gradient(ellipse at center, rgba(200, 255, 0, 0.08) 0%, rgba(200, 255, 0, 0.02) 50%, transparent 70%);
}

/* Section 0 washes */
.wash-1 {
    width: 80vw;
    height: 80vh;
    bottom: -10%;
    right: -15%;
    filter: blur(100px);
    opacity: 0;
    transition: opacity 1200ms ease-out;
}

.wash-1.visible {
    opacity: 1;
}

.wash-2 {
    width: 60vw;
    height: 60vh;
    top: -5%;
    left: -10%;
    filter: blur(80px);
    opacity: 0;
    transition: opacity 1200ms ease-out;
}

.wash-2.visible {
    opacity: 1;
}

/* Section 1 washes */
.wash-3 {
    width: 70vw;
    height: 70vh;
    top: 10%;
    right: -20%;
    filter: blur(90px);
    opacity: 0.15;
}

.wash-4 {
    width: 50vw;
    height: 50vh;
    bottom: 5%;
    left: -10%;
    filter: blur(70px);
    opacity: 0.12;
}

.wash-5 {
    width: 30vw;
    height: 30vh;
    top: 40%;
    left: 30%;
    filter: blur(120px);
    opacity: 0.08;
}

/* Section 2 washes */
.wash-6 {
    width: 75vw;
    height: 65vh;
    top: 5%;
    left: -15%;
    filter: blur(100px);
    opacity: 0.14;
}

.wash-7 {
    width: 55vw;
    height: 55vh;
    bottom: -5%;
    right: -10%;
    filter: blur(80px);
    opacity: 0.12;
}

/* Section 3 washes */
.wash-8 {
    width: 65vw;
    height: 75vh;
    top: -10%;
    right: -5%;
    filter: blur(110px);
    opacity: 0.15;
}

.wash-9 {
    width: 45vw;
    height: 45vh;
    bottom: 10%;
    left: 5%;
    filter: blur(75px);
    opacity: 0.1;
}

.wash-10 {
    width: 25vw;
    height: 25vh;
    top: 50%;
    right: 20%;
    filter: blur(100px);
    opacity: 0.06;
}

/* Section 4 washes */
.wash-11 {
    width: 80vw;
    height: 60vh;
    top: 15%;
    left: -20%;
    filter: blur(90px);
    opacity: 0.13;
}

.wash-12 {
    width: 60vw;
    height: 70vh;
    bottom: -10%;
    right: -15%;
    filter: blur(100px);
    opacity: 0.16;
}

/* Section 5 (Terminus) washes - fully saturated */
.wash-13 {
    width: 90vw;
    height: 80vh;
    top: 5%;
    left: -10%;
    filter: blur(80px);
    opacity: 0.25;
}

.wash-14 {
    width: 70vw;
    height: 70vh;
    bottom: -5%;
    right: -5%;
    filter: blur(90px);
    opacity: 0.2;
}

.wash-15 {
    width: 40vw;
    height: 40vh;
    top: 30%;
    left: 30%;
    filter: blur(100px);
    opacity: 0.1;
}

/* --- Bokashi Gradient Transitions --- */
.bokashi-top,
.bokashi-bottom {
    position: absolute;
    left: 0;
    right: 0;
    height: 15vh;
    z-index: 4;
    pointer-events: none;
}

.bokashi-top {
    top: 0;
    background: linear-gradient(to bottom, var(--midnight-indigo) 0%, transparent 100%);
}

.bokashi-bottom {
    bottom: 0;
    background: linear-gradient(to top, var(--midnight-indigo) 0%, transparent 100%);
}

.section-narrative:nth-child(odd) .bokashi-top {
    background: linear-gradient(to bottom, var(--deep-murasaki) 0%, transparent 100%);
}

.section-narrative:nth-child(odd) .bokashi-bottom {
    background: linear-gradient(to top, var(--deep-murasaki) 0%, transparent 100%);
}

/* --- Section Dividers --- */
.section-divider {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(to right, transparent 0%, rgba(255, 45, 138, 0.4) 30%, rgba(255, 45, 138, 0.4) 70%, transparent 100%);
    z-index: 5;
}

/* --- Navigation Dots --- */
.section-nav {
    position: fixed;
    right: 2rem;
    top: 50%;
    transform: translateY(-50%);
    z-index: 100;
    display: flex;
    flex-direction: column;
    gap: 1.2rem;
    align-items: center;
}

.nav-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    border: 1px solid var(--electric-violet);
    background: transparent;
    cursor: pointer;
    position: relative;
    transition: all 0.4s ease;
    pointer-events: all;
}

.nav-dot.active {
    background: var(--neon-rose);
    border-color: var(--neon-rose);
    animation: neon-pulse 3s ease-in-out infinite;
}

.nav-dot:hover {
    border-color: var(--neon-rose);
    box-shadow: 0 0 8px var(--neon), 0 0 16px var(--neon-dim);
}

.nav-label {
    position: absolute;
    right: 1.5rem;
    top: 50%;
    transform: translateY(-50%);
    font-family: 'Space Mono', monospace;
    font-weight: 400;
    font-size: clamp(0.65rem, 0.8vw, 0.8rem);
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--electric-violet);
    white-space: nowrap;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.nav-dot:hover .nav-label {
    opacity: 1;
}

/* --- Section 0: Threshold --- */
.section-threshold {
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--midnight-indigo);
    min-height: 100vh;
}

.threshold-content {
    text-align: center;
    position: relative;
    z-index: 2;
}

.site-title {
    font-family: 'Playfair Display', serif;
    font-weight: 700;
    font-size: clamp(3.5rem, 9vw, 7rem);
    color: var(--neon-rose);
    letter-spacing: -0.02em;
    line-height: 1.15;
    text-shadow: 0 0 20px rgba(255, 45, 138, 0.6), 0 0 60px rgba(255, 45, 138, 0.25);
    margin-bottom: 0.5rem;
}

.title-letter {
    display: inline-block;
    opacity: 0;
    transform: translateY(12px);
    transition: opacity 400ms ease-out, transform 400ms ease-out;
}

.title-letter.visible {
    opacity: 1;
    transform: translateY(0);
}

.title-line {
    width: 60px;
    height: 2px;
    margin: 0.8rem auto;
    opacity: 0;
    transition: opacity 600ms ease-out;
}

.title-line.visible {
    opacity: 1;
    animation: neon-pulse 3s ease-in-out infinite;
}

.site-subtitle {
    font-family: 'Space Mono', monospace;
    font-weight: 400;
    font-size: clamp(0.8rem, 1.2vw, 1rem);
    color: var(--electric-violet);
    letter-spacing: 0.2em;
    opacity: 0;
    transition: opacity 400ms ease-out;
}

.site-subtitle.visible {
    opacity: 1;
}

.scroll-chevron {
    margin-top: 3rem;
    font-size: 1.5rem;
    color: var(--soft-lavender);
    opacity: 0;
    animation: breathe 2.5s ease-in-out infinite;
    cursor: pointer;
    transition: opacity 400ms ease-out;
    pointer-events: all;
    position: relative;
    z-index: 10;
}

.scroll-chevron.visible {
    opacity: 0.5;
}

/* --- Content Grid --- */
.content-grid {
    display: grid;
    grid-template-columns: [edge-left] minmax(2rem, 1fr) [content-start] minmax(0, 42rem) [content-end] minmax(2rem, 1fr) [edge-right];
    padding: clamp(4rem, 10vh, 8rem) 0;
    min-height: 100vh;
    align-content: center;
}

.content-grid > * {
    grid-column: content-start / content-end;
}

/* --- Section Numbers --- */
.section-number {
    font-family: 'Space Mono', monospace;
    font-weight: 400;
    font-size: clamp(0.65rem, 0.8vw, 0.8rem);
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--electric-violet);
    margin-bottom: 1rem;
}

/* --- Neon Lines --- */
.neon-line {
    height: 2px;
    background: var(--neon-rose);
    box-shadow: 0 0 8px rgba(255, 45, 138, 0.5), 0 0 24px rgba(255, 45, 138, 0.2);
    transform: scaleX(0);
    transform-origin: center;
    transition: transform 800ms ease-out;
}

.neon-line.visible {
    transform: scaleX(1);
}

.section-line {
    width: 40px;
    margin-bottom: 2rem;
    transform-origin: left;
}

/* --- Section Headings --- */
.section-heading {
    font-family: 'Playfair Display', serif;
    font-weight: 700;
    font-size: clamp(1.8rem, 4vw, 3rem);
    color: var(--moonlit-paper);
    letter-spacing: -0.02em;
    line-height: 1.15;
    margin-bottom: 2rem;
}

/* --- Body Text --- */
.body-text {
    color: rgba(200, 184, 224, 0.9);
    margin-bottom: 1.6em;
    max-width: 42rem;
}

/* --- Pull Quotes --- */
.pull-quote {
    font-family: 'Playfair Display', serif;
    font-weight: 400;
    font-size: clamp(1.4rem, 3vw, 2.2rem);
    color: var(--moonlit-paper);
    letter-spacing: 0.01em;
    line-height: 1.4;
    margin-top: 2rem;
    padding-left: 1.5rem;
    border-left: 2px solid var(--neon-rose);
    box-shadow: -2px 0 8px rgba(255, 45, 138, 0.3);
}

/* --- Blur-Focus Reveal Pattern --- */
.blur-reveal {
    filter: blur(12px);
    opacity: 0;
    transform: translateY(20px);
    transition: filter 800ms ease-out, opacity 600ms ease-out, transform 700ms ease-out;
}

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

.blur-reveal[data-delay="1"] {
    transition-delay: 120ms;
}

.blur-reveal[data-delay="2"] {
    transition-delay: 240ms;
}

.blur-reveal[data-delay="3"] {
    transition-delay: 360ms;
}

/* --- Ensou Marks --- */
.ensou-mark {
    position: absolute;
    top: 2rem;
    left: 2rem;
    width: 60px;
    height: 60px;
    z-index: 2;
    opacity: 0.6;
}

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

.terminus-ensou {
    position: relative;
    top: auto;
    left: auto;
    margin: 0 auto 2rem;
}

/* --- Bubbles --- */
.bubble {
    position: absolute;
    left: var(--bx);
    top: var(--by);
    width: var(--bsize);
    height: var(--bsize);
    mix-blend-mode: screen;
    pointer-events: none;
    opacity: 0;
    animation: bubble-drift var(--bdur) ease-in-out infinite alternate;
    animation-delay: var(--bdelay);
    transition: transform 0.4s ease-out, opacity 0.4s ease-out;
}

.bubble.bubble-visible {
    opacity: 0.7;
}

.bubble-outer {
    fill: url(#bubbleGrad);
    stroke: rgba(123, 47, 247, 0.3);
    stroke-width: 1;
}

/* Fallback fill when no gradient def */
.bubble-outer {
    fill: radial-gradient(circle at 30% 30%, rgba(200, 255, 0, 0.3) 0%, rgba(255, 45, 138, 0.2) 40%, rgba(123, 47, 247, 0.1) 70%, transparent 100%);
}

.bubble svg .bubble-outer {
    fill: rgba(123, 47, 247, 0.15);
    stroke: rgba(123, 47, 247, 0.3);
    stroke-width: 1;
}

.bubble .bubble-highlight {
    fill: rgba(255, 255, 255, 0.15);
}

.bubble-static {
    animation: none;
}

/* --- Terminus Section --- */
.section-terminus {
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--midnight-indigo);
}

.terminus-content {
    text-align: center;
    position: relative;
    z-index: 2;
}

.terminus-heading {
    font-family: 'Playfair Display', serif;
    font-weight: 400;
    font-size: clamp(1.8rem, 4vw, 3rem);
    color: var(--moonlit-paper);
    letter-spacing: -0.02em;
    line-height: 1.15;
    margin-bottom: 1.5rem;
}

.terminus-line {
    width: 80px;
    margin: 0 auto 2rem;
}

.terminus-text {
    font-family: 'Space Mono', monospace;
    font-weight: 400;
    font-size: clamp(0.8rem, 1vw, 1rem);
    color: var(--electric-violet);
    letter-spacing: 0.15em;
    text-transform: uppercase;
}

.terminus-bg .watercolor-wash {
    opacity: 0.25;
}

.terminus-overlay .bubble-static {
    opacity: 0.5;
}

/* --- Animations --- */
@keyframes neon-pulse {
    0%, 100% {
        box-shadow: 0 0 4px var(--neon), 0 0 12px var(--neon-dim);
    }
    50% {
        box-shadow: 0 0 8px var(--neon), 0 0 24px var(--neon-dim), 0 0 48px var(--neon-faint);
    }
}

@keyframes breathe {
    0%, 100% {
        transform: translateY(0);
        opacity: 0.5;
    }
    50% {
        transform: translateY(8px);
        opacity: 1;
    }
}

@keyframes bubble-drift {
    0% {
        transform: translate(0, 0) scale(1);
    }
    25% {
        transform: translate(10px, -15px) scale(1.02);
    }
    50% {
        transform: translate(-8px, -25px) scale(0.98);
    }
    75% {
        transform: translate(12px, -10px) scale(1.03);
    }
    100% {
        transform: translate(-5px, -30px) scale(1);
    }
}

/* --- Responsive --- */
@media (max-width: 768px) {
    .section-nav {
        right: 1rem;
        gap: 1rem;
    }

    .nav-label {
        display: none;
    }

    .content-grid {
        grid-template-columns: [edge-left] 1.5rem [content-start] 1fr [content-end] 1.5rem [edge-right];
    }

    .ensou-mark {
        width: 40px;
        height: 40px;
        top: 1rem;
        left: 1rem;
    }

    .bubble {
        opacity: 0.4;
    }

    .bubble.bubble-visible {
        opacity: 0.4;
    }
}

@media (max-width: 480px) {
    .section-nav {
        right: 0.5rem;
    }

    .pull-quote {
        font-size: clamp(1.1rem, 2.5vw, 1.6rem);
    }
}
