/* ============================================
   mujun.cafe — Design Language Stylesheet
   Triadic near-neutral palette · Muji aesthetic
   Immersive-scroll chamber architecture
   ============================================ */

/* Palette from DESIGN.md:
   #8B7355 Roasted Sesame (Primary Warm)
   #5B7367 Stone Moss (Primary Cool)
   #6B5B73 Dusk Plum (Primary Violet)
   #F7F3EE Washi (Background)
   #EDE8E0 Steam (Surface)
   #2C2520 Charred Oak (Text Primary)
   #4A4035 Driftwood (Text Secondary)
   #A09080 Pebble (Text Tertiary)
   #B8C8D0 Bubble Opal (Accent)
   #C4B5A3 (Navigation / Ceramic)
   #000000 (avoided per design)
   #FFFFFF (avoided per design)
*/

:root {
    --roasted-sesame: #8B7355;
    --stone-moss: #5B7367;
    --dusk-plum: #6B5B73;
    --washi: #F7F3EE;
    --steam: #EDE8E0;
    --charred-oak: #2C2520;
    --driftwood: #4A4035;
    --pebble: #A09080;
    --bubble-opal: #B8C8D0;
    --ceramic: #C4B5A3;
    --ease-bubble: cubic-bezier(0.23, 1, 0.32, 1);
}

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

html {
    font-size: 17px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: 'Nunito', sans-serif;
    font-weight: 400;
    background-color: var(--washi);
    color: var(--driftwood);
    line-height: 1.75;
    overflow-x: hidden;
    position: relative;
}

/* ============================================
   Layer 0: Background Grain (Washi Texture)
   ============================================ */
.bg-grain-layer {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
    background-color: var(--washi);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='4' height='4'%3E%3Crect x='0' y='0' width='1' height='1' fill='%23C4B5A3' fill-opacity='0.03'/%3E%3Crect x='2' y='1' width='1' height='1' fill='%23A09080' fill-opacity='0.02'/%3E%3Crect x='1' y='3' width='1' height='1' fill='%23C4B5A3' fill-opacity='0.025'/%3E%3Crect x='3' y='2' width='1' height='1' fill='%238B7355' fill-opacity='0.015'/%3E%3C/svg%3E");
    background-repeat: repeat;
    will-change: transform;
}

/* ============================================
   Ceramic Background Circles (scattered motifs)
   ============================================ */
.ceramic-bg-layer {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    pointer-events: none;
    overflow: hidden;
}

.ceramic-bg-circle {
    position: absolute;
    pointer-events: none;
}

/* ============================================
   Steam Wisps
   ============================================ */
.steam-layer {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 5;
    pointer-events: none;
    overflow: hidden;
}

.steam-wisp {
    position: absolute;
    opacity: 0;
    transition: opacity 2s ease;
}

.steam-wisp.visible {
    opacity: 1;
}

/* ============================================
   Layer 2: Atmospheric Floating Elements
   ============================================ */
.atmospheric-layer {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 30;
    pointer-events: none;
    overflow: hidden;
}

.atmo-bubble {
    position: absolute;
    border-radius: 50%;
    pointer-events: none;
    will-change: transform, opacity;
    background: radial-gradient(circle at 35% 35%, transparent 40%, rgba(184, 200, 208, 0.08) 85%, rgba(184, 200, 208, 0.04) 100%);
    border: 0.5px solid rgba(184, 200, 208, 0.12);
}

.atmo-bubble::after {
    content: '';
    position: absolute;
    top: 22%;
    left: 28%;
    width: 15%;
    height: 15%;
    border-radius: 50%;
    background: rgba(250, 250, 250, 0.2);
}

/* ============================================
   Navigation
   ============================================ */
.chamber-nav {
    position: fixed;
    left: 32px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 40;
    display: flex;
    flex-direction: column;
    align-items: center;
    height: 240px;
}

.nav-line {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 1px;
    height: 100%;
    background-color: var(--ceramic);
    opacity: 0.3;
}

.nav-marker {
    position: relative;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background-color: transparent;
    border: 1px solid var(--ceramic);
    opacity: 0.3;
    margin-bottom: 34px;
    z-index: 1;
    transition: background-color 0.6s var(--ease-bubble), opacity 0.6s var(--ease-bubble), border-color 0.6s var(--ease-bubble);
    cursor: pointer;
}

.nav-marker:last-child {
    margin-bottom: 0;
}

.nav-marker.active {
    background-color: var(--roasted-sesame);
    border-color: var(--roasted-sesame);
    opacity: 1;
}

.nav-marker:hover {
    opacity: 0.6;
}

/* ============================================
   Chamber Sequence (Layer 1: Content)
   ============================================ */
.chamber-sequence {
    position: relative;
    z-index: 10;
}

.chamber {
    position: relative;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    overflow: hidden;
}

.chamber-content {
    position: relative;
    max-width: 640px;
    width: 100%;
    padding: 0 40px;
    z-index: 2;
}

.chamber-content--center {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.chamber-content--offset-high {
    align-self: center;
    margin-top: -10vh;
}

/* ============================================
   Chamber Transition Zones (200px fade)
   ============================================ */
.chamber::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 200px;
    background: linear-gradient(to bottom, transparent, var(--washi));
    pointer-events: none;
    z-index: 3;
    opacity: 0.4;
}

.chamber:last-child::after {
    display: none;
}

/* ============================================
   Chamber 1: Arrival
   ============================================ */
.chamber-1 {
    background: transparent;
}

.bubble-cluster {
    position: relative;
    width: 200px;
    height: 160px;
    margin-bottom: 40px;
}

.bubble-cluster .water-bubble {
    position: absolute;
    opacity: 0;
    transition: opacity 1s var(--ease-bubble);
}

.bubble-cluster .water-bubble.visible {
    opacity: 1;
}

.wb-1 { top: 10px; left: 70px; }
.wb-2 { top: 40px; left: 20px; }
.wb-3 { top: 0; left: 140px; }
.wb-4 { top: 70px; left: 110px; }
.wb-5 { top: 50px; left: 150px; }
.wb-6 { top: 90px; left: 50px; }
.wb-7 { top: 80px; left: 0px; }

@keyframes bubble-drift {
    0% { transform: translateY(0) translateX(0); }
    25% { transform: translateY(-6px) translateX(3px); }
    50% { transform: translateY(-12px) translateX(0); }
    75% { transform: translateY(-6px) translateX(-3px); }
    100% { transform: translateY(0) translateX(0); }
}

.bubble-cluster .water-bubble.visible.wb-1 { animation: bubble-drift 7s ease-in-out infinite; }
.bubble-cluster .water-bubble.visible.wb-2 { animation: bubble-drift 8s ease-in-out infinite 0.5s; }
.bubble-cluster .water-bubble.visible.wb-3 { animation: bubble-drift 6s ease-in-out infinite 1s; }
.bubble-cluster .water-bubble.visible.wb-4 { animation: bubble-drift 9s ease-in-out infinite 0.3s; }
.bubble-cluster .water-bubble.visible.wb-5 { animation: bubble-drift 7.5s ease-in-out infinite 0.8s; }
.bubble-cluster .water-bubble.visible.wb-6 { animation: bubble-drift 8.5s ease-in-out infinite 1.2s; }
.bubble-cluster .water-bubble.visible.wb-7 { animation: bubble-drift 6.5s ease-in-out infinite 0.6s; }

.site-title {
    font-family: 'Nunito', sans-serif;
    font-weight: 700;
    font-size: clamp(2rem, 5vw, 3.5rem);
    color: var(--charred-oak);
    letter-spacing: 0.02em;
    opacity: 0;
    transform: translateY(12px);
    transition: opacity 1.2s var(--ease-bubble), transform 1.2s var(--ease-bubble);
}

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

.site-subtitle {
    font-family: 'M PLUS Rounded 1c', sans-serif;
    font-weight: 400;
    font-size: 13px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--roasted-sesame);
    margin-top: 16px;
    opacity: 0;
    transform: translateY(8px);
    transition: opacity 1s var(--ease-bubble), transform 1s var(--ease-bubble);
}

.site-subtitle.visible {
    opacity: 1;
    transform: translateY(0);
}

/* ============================================
   Chamber 2: The Paradox
   ============================================ */
.chamber-2 {
    background: transparent;
}

.chamber-2-glow {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 800px;
    height: 800px;
    transform: translate(-50%, -50%);
    background: radial-gradient(ellipse at 40% 45%, rgba(139, 115, 85, 0.08) 0%, transparent 70%);
    pointer-events: none;
    z-index: 0;
}

.paradox-line {
    font-family: 'Nunito', sans-serif;
    font-weight: 400;
    font-size: 17px;
    line-height: 1.85;
    color: var(--driftwood);
    max-width: 540px;
    margin-bottom: 32px;
    opacity: 0;
    transform: translateY(12px);
    transition: opacity 0.6s var(--ease-bubble), transform 0.6s var(--ease-bubble);
    position: relative;
    z-index: 1;
    text-align: center;
}

.paradox-line.visible {
    opacity: 1;
    transform: translateY(0);
}

.paradox-line:last-child {
    margin-bottom: 0;
}

/* ============================================
   Chamber 3: Stillness
   ============================================ */
.chamber-3 {
    background: transparent;
}

/* Stone Moss green hue shift in background grain */
.chamber-3::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='4' height='4'%3E%3Crect x='0' y='0' width='1' height='1' fill='%235B7367' fill-opacity='0.02'/%3E%3Crect x='2' y='3' width='1' height='1' fill='%235B7367' fill-opacity='0.015'/%3E%3C/svg%3E");
    background-repeat: repeat;
    pointer-events: none;
    z-index: 0;
}

.ceramic-circle-motif {
    position: relative;
    z-index: 1;
    margin-bottom: 40px;
    opacity: 0;
    transition: opacity 1.5s var(--ease-bubble);
}

.ceramic-circle-motif.visible {
    opacity: 1;
    animation: slow-rotate 120s linear infinite;
}

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

.stillness-quote {
    position: relative;
    z-index: 1;
    max-width: 480px;
    opacity: 0;
    transform: translateY(12px);
    transition: opacity 1s var(--ease-bubble) 0.3s, transform 1s var(--ease-bubble) 0.3s;
}

.stillness-quote.visible {
    opacity: 1;
    transform: translateY(0);
}

.quote-accent {
    display: block;
    font-family: 'Nunito', sans-serif;
    font-weight: 300;
    font-size: clamp(2.5rem, 6vw, 4rem);
    color: var(--stone-moss);
    opacity: 0.4;
    margin-bottom: 20px;
    letter-spacing: 0.1em;
}

.stillness-quote p {
    font-family: 'Nunito', sans-serif;
    font-weight: 300;
    font-size: 15px;
    line-height: 2;
    color: var(--driftwood);
}

/* ============================================
   Chamber 4: Depth
   ============================================ */
.chamber-4 {
    background: transparent;
}

.layered-panels {
    position: relative;
    width: 100%;
    max-width: 580px;
    min-height: 400px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.depth-panel {
    position: relative;
    background: rgba(237, 232, 224, 0.6);
    border: 1px solid var(--pebble);
    padding: 40px 36px;
    margin-bottom: 24px;
    max-width: 520px;
    width: 100%;
    opacity: 0;
    transition: opacity 0.8s var(--ease-bubble), transform 0.8s var(--ease-bubble);
}

.depth-panel.visible {
    opacity: 1;
}

.depth-panel p {
    font-family: 'Nunito', sans-serif;
    font-weight: 400;
    font-size: 16px;
    line-height: 1.8;
    color: var(--charred-oak);
}

.depth-panel-1 {
    transform: rotate(1.5deg) translateY(20px);
    z-index: 1;
}

.depth-panel-1.visible {
    transform: rotate(1.5deg) translateY(0);
}

.depth-panel-2 {
    transform: rotate(-0.5deg) translateY(20px);
    z-index: 2;
    border-left: 2px solid var(--dusk-plum);
}

.depth-panel-2.visible {
    transform: rotate(-0.5deg) translateY(0);
}

.depth-panel-3 {
    transform: rotate(0.8deg) translateY(20px);
    z-index: 1;
}

.depth-panel-3.visible {
    transform: rotate(0.8deg) translateY(0);
}

/* ============================================
   Chamber 5: Surface
   ============================================ */
.chamber-5 {
    background: transparent;
}

/* Intensified grain for the Surface chamber (6% opacity vs normal 3%) */
.chamber-5::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='4' height='4'%3E%3Crect x='0' y='0' width='1' height='1' fill='%23C4B5A3' fill-opacity='0.05'/%3E%3Crect x='2' y='1' width='1' height='1' fill='%23A09080' fill-opacity='0.04'/%3E%3Crect x='1' y='3' width='1' height='1' fill='%23C4B5A3' fill-opacity='0.045'/%3E%3Crect x='3' y='2' width='1' height='1' fill='%238B7355' fill-opacity='0.03'/%3E%3C/svg%3E");
    background-repeat: repeat;
    pointer-events: none;
    z-index: 0;
}

.surface-bubble-container {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    z-index: 1;
}

.surface-bubble {
    margin-bottom: 32px;
    opacity: 0;
    transform: scale(0.9);
    transition: opacity 1s var(--ease-bubble), transform 2s var(--ease-bubble);
}

.surface-bubble.visible {
    opacity: 1;
    transform: scale(1);
}

.surface-bubble.expanding {
    transform: scale(1.5);
    transition: transform 3s var(--ease-bubble);
}

.surface-bubble.split {
    opacity: 0;
    transform: scale(0.5);
    transition: opacity 0.8s var(--ease-bubble), transform 0.8s var(--ease-bubble);
}

.bubble-text {
    font-family: 'Nunito', sans-serif;
    font-weight: 300;
    font-size: 15px;
    line-height: 2;
    color: var(--driftwood);
    max-width: 420px;
    opacity: 0;
    transform: translateY(12px);
    transition: opacity 0.8s var(--ease-bubble) 0.4s, transform 0.8s var(--ease-bubble) 0.4s;
}

.bubble-text.visible {
    opacity: 1;
    transform: translateY(0);
}

/* Split bubble pair */
.split-bubble-pair {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 300px;
    height: 200px;
    pointer-events: none;
}

.split-bubble-a,
.split-bubble-b {
    position: absolute;
    top: 50%;
    left: 50%;
    opacity: 0;
    transition: all 1.2s var(--ease-bubble);
}

.split-bubble-a.visible {
    opacity: 1;
    transform: translate(-100%, -50%);
}

.split-bubble-b.visible {
    opacity: 1;
    transform: translate(20%, -50%);
}

/* ============================================
   Chamber 6: Departure
   ============================================ */
.chamber-6 {
    background: transparent;
    position: relative;
}

.departure-glow {
    position: absolute;
    width: 600px;
    height: 600px;
    border-radius: 50%;
    pointer-events: none;
    opacity: 0;
    transition: opacity 2s var(--ease-bubble);
}

.departure-glow.visible {
    opacity: 1;
}

/* Roasted Sesame glow — top-left */
.departure-glow-warm {
    top: -200px;
    left: -200px;
    background: radial-gradient(circle at center, rgba(139, 115, 85, 0.06) 0%, transparent 70%);
}

/* Stone Moss glow — bottom-right */
.departure-glow-moss {
    bottom: -200px;
    right: -200px;
    background: radial-gradient(circle at center, rgba(91, 115, 103, 0.06) 0%, transparent 70%);
}

/* Dusk Plum glow — center-left */
.departure-glow-plum {
    top: 30%;
    left: -100px;
    background: radial-gradient(circle at center, rgba(107, 91, 115, 0.05) 0%, transparent 70%);
}

.departure-word {
    font-family: 'Nunito', sans-serif;
    font-weight: 300;
    font-size: 14px;
    letter-spacing: 0.15em;
    color: var(--pebble);
    opacity: 0;
    transition: opacity 2s var(--ease-bubble);
    position: relative;
    z-index: 2;
}

.departure-word.visible {
    opacity: 1;
}

.departure-bubbles {
    position: relative;
    width: 140px;
    height: 80px;
    margin-top: 40px;
    z-index: 2;
}

.tiny-bubble {
    position: absolute;
    opacity: 0;
    transition: opacity 1s var(--ease-bubble);
}

.tiny-bubble.visible {
    opacity: 1;
}

.tb-1 { bottom: 0; left: 20px; animation: tiny-drift-1 6s ease-in-out infinite; }
.tb-2 { bottom: 10px; left: 50px; animation: tiny-drift-2 7s ease-in-out infinite 0.3s; }
.tb-3 { bottom: 5px; left: 80px; animation: tiny-drift-3 5.5s ease-in-out infinite 0.7s; }
.tb-4 { bottom: 15px; left: 35px; animation: tiny-drift-1 8s ease-in-out infinite 1s; }
.tb-5 { bottom: 0; left: 65px; animation: tiny-drift-2 6.5s ease-in-out infinite 0.5s; }
.tb-6 { bottom: 8px; left: 100px; animation: tiny-drift-3 7.5s ease-in-out infinite 0.9s; }

@keyframes tiny-drift-1 {
    0%, 100% { transform: translateY(0) translateX(0); }
    50% { transform: translateY(-20px) translateX(3px); }
}

@keyframes tiny-drift-2 {
    0%, 100% { transform: translateY(0) translateX(0); }
    50% { transform: translateY(-25px) translateX(-2px); }
}

@keyframes tiny-drift-3 {
    0%, 100% { transform: translateY(0) translateX(0); }
    50% { transform: translateY(-18px) translateX(4px); }
}

/* ============================================
   Monospace Accent (DM Mono)
   ============================================ */
.mono-accent {
    font-family: 'DM Mono', monospace;
    font-weight: 300;
    font-size: 14px;
    color: var(--pebble);
}

/* ============================================
   Accent Label (M PLUS Rounded 1c)
   ============================================ */
.accent-label {
    font-family: 'M PLUS Rounded 1c', sans-serif;
    font-weight: 400;
    font-size: 13px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--roasted-sesame);
}

/* ============================================
   Bubble Merge Animation
   ============================================ */
@keyframes bubble-merge {
    0% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.15); opacity: 0.8; }
    100% { transform: scale(1.3); opacity: 0; }
}

.atmo-bubble.merging {
    animation: bubble-merge 0.8s var(--ease-bubble) forwards;
}

.atmo-bubble.merged-target {
    transition: width 0.8s var(--ease-bubble), height 0.8s var(--ease-bubble);
}

/* ============================================
   Responsive
   ============================================ */
@media (max-width: 768px) {
    .chamber-nav {
        left: 16px;
        height: 180px;
    }

    .nav-marker {
        margin-bottom: 26px;
    }

    .chamber-content {
        padding: 0 24px;
    }

    .layered-panels {
        max-width: 100%;
    }

    .depth-panel {
        padding: 28px 24px;
    }

    .depth-panel-1 { transform: rotate(0.5deg) translateY(20px); }
    .depth-panel-1.visible { transform: rotate(0.5deg) translateY(0); }
    .depth-panel-2 { transform: rotate(-0.3deg) translateY(20px); }
    .depth-panel-2.visible { transform: rotate(-0.3deg) translateY(0); }
    .depth-panel-3 { transform: rotate(0.3deg) translateY(20px); }
    .depth-panel-3.visible { transform: rotate(0.3deg) translateY(0); }

    .bubble-cluster {
        width: 160px;
        height: 130px;
    }

    .departure-glow {
        width: 300px;
        height: 300px;
    }
}

@media (max-width: 480px) {
    .chamber-nav {
        display: none;
    }

    .site-title {
        font-size: clamp(1.6rem, 8vw, 2.5rem);
    }

    .paradox-line {
        font-size: 15px;
    }

    .depth-panel {
        padding: 24px 20px;
    }
}
