/* ============================================
   mujun.quest - Design Language Implementation
   Palette: Dopamine-neon on near-black
   Layout: Parallax-sections with asymmetric offset
   Typography: Dela Gothic One / Literata / Azeret Mono
   ============================================ */

:root {
    --void-black: #0A0A0F;
    --ink-wash: #151519;
    --parchment: #E8E2D9;
    --stone: #7A756D;
    --spear-pink: #FF2D78;
    --shield-cyan: #00F5D4;
    --koan-violet: #B14AED;
    --satori-gold: #FFD700;
    --accent: #FF2D78;
    --white: #FFFFFF;
}

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

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

body {
    font-family: 'Literata', serif;
    font-weight: 400;
    background-color: var(--void-black);
    color: var(--parchment);
    line-height: 1.75;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

/* ============================================
   Fixed Elements
   ============================================ */

.fixed-domain-label {
    position: fixed;
    top: 24px;
    left: 24px;
    font-family: 'Azeret Mono', monospace;
    font-weight: 300;
    font-size: 0.75rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--parchment);
    opacity: 1;
    z-index: 100;
    transition: opacity 0.6s ease;
}

.fixed-domain-label.faded {
    opacity: 0.3;
}

/* Scroll Progress Indicator */
.scroll-progress {
    position: fixed;
    top: 0;
    right: 0;
    width: 2px;
    height: 0%;
    background: var(--accent);
    z-index: 100;
    transition: background-color 0.3s ease;
}

/* Return to Top Button */
.return-top {
    position: fixed;
    bottom: 32px;
    right: 32px;
    background: none;
    border: none;
    cursor: pointer;
    z-index: 100;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.5s ease, transform 0.5s ease;
    pointer-events: none;
}

.return-top.visible {
    opacity: 0.6;
    transform: translateY(0);
    pointer-events: auto;
}

.return-top:hover {
    opacity: 1;
}

.return-top:hover .return-enso-circle {
    stroke-dashoffset: 0;
    transition: stroke-dashoffset 0.4s ease;
}

.return-enso-circle {
    transition: stroke-dashoffset 0.4s ease;
}

/* ============================================
   Main Journey Container
   ============================================ */

.koan-journey {
    position: relative;
}

/* ============================================
   Sections - General
   ============================================ */

.section {
    position: relative;
    overflow: hidden;
}

/* ============================================
   Parallax Layers
   ============================================ */

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

.layer-bg {
    z-index: 1;
    will-change: transform, filter;
    filter: blur(2px);
    transition: filter 0.8s ease;
}

.layer-bg.focused {
    filter: blur(0px);
}

.layer-mid {
    z-index: 5;
    display: flex;
    align-items: center;
    position: relative;
}

.layer-fg {
    z-index: 3;
    pointer-events: none;
    will-change: transform;
}

/* ============================================
   Opening Void Section
   ============================================ */

.opening-void {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.opening-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    z-index: 10;
}

.domain-title {
    font-family: 'Dela Gothic One', sans-serif;
    font-size: clamp(4rem, 10vw, 8rem);
    font-weight: 400;
    letter-spacing: 0.04em;
    color: var(--parchment);
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 1.5s cubic-bezier(0.25, 0.1, 0.25, 1), transform 1.5s cubic-bezier(0.25, 0.1, 0.25, 1);
}

.domain-title.revealed {
    opacity: 1;
    transform: translateY(0);
}

.opening-subtitle {
    font-family: 'Azeret Mono', monospace;
    font-weight: 300;
    font-size: 0.7rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--stone);
    margin-top: 24px;
    opacity: 0;
    transition: opacity 1.2s cubic-bezier(0.25, 0.1, 0.25, 1) 0.8s;
}

.opening-subtitle.revealed {
    opacity: 1;
}

/* Opening Background Ripples */
.opening-ripples {
    width: 100%;
    height: 100%;
    opacity: 0;
    transition: opacity 2s ease 1.5s;
}

.opening-ripples.revealed {
    opacity: 1;
}

/* Scroll Down Indicator */
.scroll-down-indicator {
    position: absolute;
    bottom: 48px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10;
    opacity: 0;
    transition: opacity 1s ease 2.5s;
}

.scroll-down-indicator.revealed {
    opacity: 0.6;
}

.scroll-line {
    width: 1px;
    height: 40px;
    background: linear-gradient(to bottom, transparent, var(--parchment));
    animation: scrollPulse 2s ease-in-out infinite;
}

@keyframes scrollPulse {
    0%, 100% { transform: scaleY(1); opacity: 0.6; }
    50% { transform: scaleY(1.3); opacity: 1; }
}

/* ============================================
   Koan Sections
   ============================================ */

.koan-section {
    min-height: 100vh;
    display: flex;
    align-items: center;
    position: relative;
}

/* Section Glow */
.section-glow {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 80vw;
    height: 80vw;
    max-width: 900px;
    max-height: 900px;
    border-radius: 50%;
    background: radial-gradient(circle, var(--accent) 0%, transparent 70%);
    opacity: 0;
    z-index: 0;
    pointer-events: none;
    filter: blur(60px);
    transition: opacity 1.2s ease;
}

.koan-section.in-view .section-glow {
    opacity: 0.1;
}

/* Koan Content Block */
.koan-content {
    position: relative;
    z-index: 10;
    width: max(320px, min(55vw, 680px));
    padding: 60px 0;
}

.content-left {
    margin-left: 8vw;
    margin-right: auto;
}

.content-right {
    margin-left: auto;
    margin-right: 8vw;
}

.koan-number {
    font-family: 'Azeret Mono', monospace;
    font-weight: 300;
    font-size: 0.7rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--accent);
    opacity: 0.6;
    display: block;
    margin-bottom: 16px;
}

.koan-title {
    font-family: 'Dela Gothic One', sans-serif;
    font-size: clamp(2.5rem, 7vw, 5rem);
    font-weight: 400;
    letter-spacing: 0.04em;
    line-height: 1.1;
    margin-bottom: 32px;
    opacity: 0;
    transform: translateY(40px);
    transition: opacity 0.8s cubic-bezier(0.25, 0.1, 0.25, 1), transform 0.8s cubic-bezier(0.25, 0.1, 0.25, 1);
}

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

/* Title overhang - break outside the content measure by 15% */
.koan-title {
    width: 115%;
}

.content-right .koan-title {
    margin-left: -15%;
}

/* Accent colors per section */
#koan1 { --accent: #FF2D78; }
#koan1 .koan-title { color: #FF2D78; }

#koan2 { --accent: #00F5D4; }
#koan2 .koan-title { color: #00F5D4; }

#koan3 { --accent: #B14AED; }
#koan3 .koan-title { color: #B14AED; }

#koan4 { --accent: #FFD700; }
#koan4 .koan-title { color: #FFD700; }

.koan-body p {
    font-family: 'Literata', serif;
    font-size: clamp(1rem, 1.8vw, 1.2rem);
    line-height: 1.75;
    color: var(--parchment);
    margin-bottom: 20px;
    opacity: 0;
    transform: translateY(40px);
    transition: opacity 0.8s cubic-bezier(0.25, 0.1, 0.25, 1), transform 0.8s cubic-bezier(0.25, 0.1, 0.25, 1);
}

.koan-body p.visible {
    opacity: 1;
    transform: translateY(0);
}

.koan-aside {
    color: var(--stone);
    font-style: italic;
}

.koan-aside em {
    font-family: 'Literata', serif;
    font-weight: 400;
}

/* ============================================
   Background Patterns
   ============================================ */

.bg-pattern {
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
}

/* SVG draw animation for paths */
.draw-path {
    stroke-dasharray: 1000;
    stroke-dashoffset: 1000;
    transition: stroke-dashoffset 4s cubic-bezier(0.25, 0.1, 0.25, 1);
}

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

/* SVG draw animation for circles */
.draw-circle {
    stroke-dasharray: 2000;
    stroke-dashoffset: 2000;
    transition: stroke-dashoffset 5s cubic-bezier(0.25, 0.1, 0.25, 1);
}

.draw-circle.drawn {
    stroke-dashoffset: 0;
}

/* ============================================
   Floating Kanji (Foreground Layer)
   ============================================ */

.floating-kanji {
    position: absolute;
    font-family: 'Dela Gothic One', sans-serif;
    font-size: 20vw;
    font-weight: 400;
    opacity: 0.07;
    pointer-events: none;
    user-select: none;
    will-change: transform;
}

.kanji-1 {
    color: #FF2D78;
    top: 10%;
    right: 5%;
}

.kanji-2 {
    color: #00F5D4;
    top: 15%;
    left: 3%;
}

.kanji-3 {
    color: #B14AED;
    top: 20%;
    right: 8%;
}

.kanji-4 {
    color: #FFD700;
    top: 12%;
    left: 5%;
}

/* ============================================
   Breath Zones
   ============================================ */

.breath-zone {
    height: 25vh;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.enso {
    opacity: 0;
    transition: opacity 1.5s ease;
}

.enso.visible {
    opacity: 0.5;
}

.enso-path {
    stroke-dasharray: 300;
    stroke-dashoffset: 300;
    transition: stroke-dashoffset 2s cubic-bezier(0.25, 0.1, 0.25, 1);
}

.enso.visible .enso-path {
    stroke-dashoffset: 30;
}

/* ============================================
   Closing Section
   ============================================ */

.closing-section {
    min-height: 80vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    gap: 32px;
}

.closing-lines {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    opacity: 0;
    transition: opacity 1.5s ease;
}

.closing-lines.visible {
    opacity: 1;
}

.color-line {
    width: min(60vw, 400px);
    height: 1px;
    opacity: 0.8;
    transform: scaleX(0);
    transition: transform 1s cubic-bezier(0.25, 0.1, 0.25, 1);
}

.closing-lines.visible .color-line {
    transform: scaleX(1);
}

.closing-lines.visible .color-line:nth-child(1) { transition-delay: 0.1s; }
.closing-lines.visible .color-line:nth-child(2) { transition-delay: 0.3s; }
.closing-lines.visible .color-line:nth-child(3) { transition-delay: 0.5s; }
.closing-lines.visible .color-line:nth-child(4) { transition-delay: 0.7s; }

.closing-domain {
    font-family: 'Dela Gothic One', sans-serif;
    font-size: clamp(2rem, 5vw, 3.5rem);
    font-weight: 400;
    letter-spacing: 0.04em;
    color: var(--parchment);
    opacity: 0;
    transition: opacity 1s ease 0.5s;
}

.closing-domain.visible {
    opacity: 0.8;
}

.closing-enso {
    opacity: 0;
    transition: opacity 1s ease 1s;
}

.closing-enso.visible {
    opacity: 0.4;
}

.closing-enso-circle {
    transition: stroke-dashoffset 2.5s cubic-bezier(0.25, 0.1, 0.25, 1) 1.2s;
}

.closing-enso.visible .closing-enso-circle {
    stroke-dashoffset: 0;
}

/* ============================================
   Responsive
   ============================================ */

@media (max-width: 768px) {
    .koan-content {
        width: 90%;
        padding: 40px 0;
    }

    .content-left {
        margin-left: 5vw;
    }

    .content-right {
        margin-right: 5vw;
        margin-left: auto;
    }

    .koan-title {
        width: 100%;
        font-size: clamp(2rem, 8vw, 3.5rem);
    }

    .content-right .koan-title {
        margin-left: 0;
    }

    .floating-kanji {
        font-size: 30vw;
        opacity: 0.05;
    }

    .fixed-domain-label {
        font-size: 0.65rem;
    }

    .return-top {
        bottom: 20px;
        right: 20px;
    }

    .section-glow {
        width: 120vw;
        height: 120vw;
    }
}

@media (max-width: 480px) {
    .koan-content {
        width: 92%;
    }

    .content-left,
    .content-right {
        margin-left: 4vw;
        margin-right: 4vw;
    }

    .domain-title {
        font-size: clamp(2.5rem, 12vw, 5rem);
    }
}
