/* mujun.day -- ma-negative-space, border-animate, deep-burgundy */

:root {
    --kurenai: #6B1D2A;
    --enji: #8C3A4B;
    --sakura-nezumi: #B8848E;
    --shiroi: #F5EDE3;
    --kinari: #EDE4D8;
    --sumi: #2E2226;
    --awa: #F0C9D4;
    --murasaki-cha: #4A2036;

    --font-display: 'Nunito', system-ui, sans-serif;
    --font-secondary: 'Quicksand', 'Nunito', sans-serif;
    --font-body: 'Nunito Sans', 'Nunito', system-ui, sans-serif;
}

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

html, body {
    background-color: var(--shiroi);
    color: var(--sumi);
    font-family: var(--font-body);
    font-size: 16px;
    line-height: 1.85;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
}

body {
    min-height: 100vh;
}

#scroll-container {
    position: relative;
    width: 100%;
}

/* ---------- Scenes ---------- */

.scene {
    position: relative;
    width: 100%;
    overflow: hidden;
    transition: background-color 3s ease-in-out;
}

.scene.ku {
    min-height: 100vh;
    background-color: var(--shiroi);
}

.scene.jitsu {
    min-height: 80vh;
    padding: 14vh 0;
    background-color: var(--kinari);
}

.scene-opening {
    background-color: var(--shiroi);
}

.scene-spear {
    background-color: var(--kinari);
}

.scene-shield {
    background-color: var(--shiroi);
    min-height: 100vh;
    padding: 12vh 0;
}

.scene-mujun {
    background-color: var(--murasaki-cha);
    min-height: 150vh;
    padding: 10vh 0;
    color: var(--shiroi);
}

.scene-resolution {
    background-color: var(--shiroi);
    min-height: 100vh;
}

/* ---------- Ma transitions ---------- */

.ma-transition {
    width: 100%;
    height: 24vh;
    transition: background-color 3s ease-in-out;
}

.ma-transition.mt-1 {
    background: linear-gradient(to bottom, var(--shiroi), var(--kinari));
}

.ma-transition.mt-2 {
    background: linear-gradient(to bottom, var(--kinari), var(--shiroi));
}

.ma-transition.mt-3 {
    background: linear-gradient(to bottom, var(--shiroi), var(--murasaki-cha));
}

.ma-transition.mt-4 {
    background: linear-gradient(to bottom, var(--murasaki-cha), var(--shiroi));
}

/* ---------- Domain mark (Scene 1) ---------- */

.domain-mark {
    position: absolute;
    bottom: 8vh;
    left: 6vw;
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 14px;
    color: var(--kurenai);
    letter-spacing: 0.04em;
}

.dm-letter {
    display: inline-block;
    opacity: 0;
    transform: translateY(8px);
    transition: opacity 600ms ease-out, transform 600ms ease-out;
}

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

.dm-dot {
    color: var(--enji);
}

/* ---------- Bubble cluster (opening) ---------- */

.bubble-cluster {
    position: absolute;
    inset: 0;
    pointer-events: none;
}

.bubble {
    position: absolute;
    left: var(--x);
    top: var(--y);
    width: var(--size);
    height: var(--size);
    border-radius: 50%;
    background: var(--kurenai);
    opacity: 0;
    animation: bubble-fade-in 2s ease-out forwards, bubble-drift var(--dur, 20s) ease-in-out infinite;
    animation-delay: calc(1.5s + var(--delay, 0s)), calc(2s + var(--delay, 0s));
}

.bubble[style*="--tone: awa"] {
    background: var(--awa);
}

.bubble::before {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background: conic-gradient(from 220deg at 35% 35%, rgba(255, 255, 255, 0.18) 0deg, rgba(255, 255, 255, 0) 60deg);
    opacity: 0.6;
}

@keyframes bubble-fade-in {
    from { opacity: 0; transform: scale(0.6); }
    to   { opacity: var(--opacity, 0.2); transform: scale(1); }
}

@keyframes bubble-drift {
    0%   { transform: translate(0, 0); }
    25%  { transform: translate(20px, -14px); }
    50%  { transform: translate(40px, 6px); }
    75%  { transform: translate(18px, 18px); }
    100% { transform: translate(0, 0); }
}

/* ---------- Scene 2: Spear ---------- */

.scene-spear {
    display: grid;
    grid-template-columns: 1fr 1fr;
    align-items: center;
    gap: 0;
    position: relative;
    min-height: 100vh;
}

.spear-line {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    height: 100%;
    width: 2px;
    pointer-events: none;
}

.spear-svg {
    width: 100%;
    height: 100%;
    display: block;
}

.spear-stroke {
    stroke-dasharray: 800;
    stroke-dashoffset: 800;
    transition: stroke-dashoffset 2s linear;
}

.scene-spear.is-active .spear-stroke {
    stroke-dashoffset: 0;
}

.iso-cluster {
    position: relative;
    height: 70vh;
    width: 100%;
}

.iso-cluster .iso-icon {
    position: absolute;
    top: var(--top);
    left: var(--left);
    opacity: 0;
    transform: translateY(12px);
    transition: opacity 800ms ease-out, transform 800ms ease-out;
}

.scene-spear.is-active .iso-cluster .iso-icon {
    opacity: 1;
    transform: translateY(0);
}

.scene-spear.is-active .iso-cluster .iso-icon:nth-child(1) { transition-delay: 600ms; }
.scene-spear.is-active .iso-cluster .iso-icon:nth-child(2) { transition-delay: 900ms; }
.scene-spear.is-active .iso-cluster .iso-icon:nth-child(3) { transition-delay: 1200ms; }

.iso-icon {
    cursor: default;
    position: relative;
}

.iso-icon::after,
.iso-icon::before {
    content: "";
    position: absolute;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--awa);
    opacity: 0;
    pointer-events: none;
    left: 50%;
    top: 0;
    transform: translateX(-50%);
}

.iso-icon:hover::after {
    animation: bubble-rise 1.4s ease-out forwards;
}

.iso-icon:hover::before {
    animation: bubble-rise 1.4s ease-out 0.2s forwards;
    width: 4px;
    height: 4px;
    left: 60%;
}

@keyframes bubble-rise {
    0%   { opacity: 0; transform: translate(-50%, 0) scale(0.6); }
    20%  { opacity: 0.8; }
    100% { opacity: 0; transform: translate(-50%, -40px) scale(1); }
}

/* ---------- Content blocks ---------- */

.content-block {
    position: relative;
    max-width: 460px;
    padding: 32px;
    border: 1px solid var(--sakura-nezumi);
    background: transparent;
    animation: border-pulse 4s ease-in-out infinite;
}

.scene.is-active .content-block {
    border-color: var(--kurenai);
    transition: border-color 800ms ease-out;
}

@keyframes border-pulse {
    0%, 100% { border-width: 1px; }
    50%      { border-width: 2px; }
}

.content-right {
    margin-left: 8%;
    margin-right: auto;
    margin-top: 6vh;
}

.content-far-right {
    margin-left: auto;
    margin-right: 6%;
    margin-top: 18vh;
    max-width: 440px;
}

.content-mujun {
    position: relative;
    z-index: 5;
    margin-left: auto;
    margin-right: 8%;
    max-width: 480px;
    border-color: rgba(245, 237, 227, 0.5);
    background: rgba(46, 34, 38, 0.35);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.eyebrow {
    font-family: var(--font-secondary);
    font-weight: 500;
    font-size: 13px;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--enji);
    margin-bottom: 18px;
    display: block;
}

.eyebrow-light {
    color: var(--awa);
}

.display {
    font-family: var(--font-display);
    font-weight: 800;
    font-size: clamp(28px, 3.8vw, 48px);
    line-height: 1.15;
    letter-spacing: 0.01em;
    color: var(--kurenai);
    margin-bottom: 24px;
}

.display-light {
    color: var(--shiroi);
}

.body {
    font-family: var(--body, var(--font-body));
    font-weight: 400;
    font-size: 16px;
    line-height: 1.85;
    color: var(--sumi);
    margin-bottom: 16px;
}

.body-light {
    color: var(--shiroi);
    opacity: 0.92;
}

.kanji-glyph {
    position: absolute;
    top: -28px;
    left: -12px;
    font-family: var(--font-display);
    font-weight: 800;
    font-size: 84px;
    color: var(--kurenai);
    opacity: 0.08;
    pointer-events: none;
    line-height: 1;
}

.kanji-right {
    left: auto;
    right: -12px;
    top: -36px;
}

.kanji-mujun {
    color: var(--awa);
    opacity: 0.16;
    font-size: 110px;
    top: -40px;
    right: -18px;
    left: auto;
}

/* ---------- Scene 3: Shield ---------- */

.scene-shield {
    display: grid;
    grid-template-columns: 1fr 1fr;
    align-items: center;
    position: relative;
}

.shield-stage {
    position: relative;
    width: 100%;
    height: 70vh;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    padding-left: 8%;
}

.shield-svg {
    display: block;
    overflow: visible;
}

.shield-circle {
    stroke-dasharray: 1300;
    stroke-dashoffset: 1300;
    transform-origin: center;
    transition: stroke-dashoffset 2.4s ease-in-out;
    animation: shield-pulse 5s ease-in-out infinite;
}

.scene-shield.is-active .shield-circle {
    stroke-dashoffset: 0;
}

@keyframes shield-pulse {
    0%, 100% { stroke-width: 2; opacity: 0.9; }
    50%      { stroke-width: 2.6; opacity: 1; }
}

.shield-bubbles {
    position: absolute;
    left: 8%;
    top: 50%;
    transform: translateY(-50%);
    width: 420px;
    height: 420px;
    pointer-events: none;
}

.sb {
    position: absolute;
    border-radius: 50%;
    background: var(--awa);
    opacity: 0;
    animation: sb-fade-in 1.6s ease-out 0.4s forwards;
}

.scene-shield.is-active .sb {
    opacity: 1;
}

.sb-1  { width: 14px; height: 14px; left: 30%; top: 28%; background: var(--kurenai); opacity: 0; animation: sb-fade-in 1.6s ease-out 0.6s forwards, bounce-1 4.2s ease-in-out infinite 1.2s; }
.sb-2  { width: 22px; height: 22px; left: 55%; top: 36%; animation: sb-fade-in 1.6s ease-out 0.8s forwards, bounce-2 5.1s ease-in-out infinite 1.4s; }
.sb-3  { width: 10px; height: 10px; left: 42%; top: 60%; background: var(--sakura-nezumi); animation: sb-fade-in 1.6s ease-out 0.7s forwards, bounce-3 4.6s ease-in-out infinite 1.0s; }
.sb-4  { width: 18px; height: 18px; left: 64%; top: 58%; animation: sb-fade-in 1.6s ease-out 0.9s forwards, bounce-4 5.4s ease-in-out infinite 1.6s; }
.sb-5  { width: 8px;  height: 8px;  left: 38%; top: 44%; background: var(--kurenai); opacity: 0; animation: sb-fade-in 1.6s ease-out 1.0s forwards, bounce-5 3.9s ease-in-out infinite 0.8s; }
.sb-6  { width: 26px; height: 26px; left: 50%; top: 50%; background: var(--awa); animation: sb-fade-in 1.6s ease-out 1.1s forwards, bounce-6 5.8s ease-in-out infinite 2.0s; }
.sb-7  { width: 12px; height: 12px; left: 60%; top: 30%; background: var(--sakura-nezumi); animation: sb-fade-in 1.6s ease-out 0.8s forwards, bounce-1 4.7s ease-in-out infinite 1.5s; }
.sb-8  { width: 16px; height: 16px; left: 32%; top: 66%; animation: sb-fade-in 1.6s ease-out 1.0s forwards, bounce-2 5.2s ease-in-out infinite 1.8s; }
.sb-9  { width: 8px;  height: 8px;  left: 70%; top: 48%; background: var(--kurenai); animation: sb-fade-in 1.6s ease-out 1.2s forwards, bounce-3 4.4s ease-in-out infinite 0.6s; }
.sb-10 { width: 20px; height: 20px; left: 44%; top: 38%; animation: sb-fade-in 1.6s ease-out 0.9s forwards, bounce-4 5.5s ease-in-out infinite 1.3s; }

@keyframes sb-fade-in {
    from { opacity: 0; transform: scale(0.4); }
    to   { opacity: 0.6; transform: scale(1); }
}

@keyframes bounce-1 {
    0%, 100% { transform: translate(0, 0); }
    50%      { transform: translate(28px, -22px); }
}
@keyframes bounce-2 {
    0%, 100% { transform: translate(0, 0); }
    50%      { transform: translate(-32px, 24px); }
}
@keyframes bounce-3 {
    0%, 100% { transform: translate(0, 0); }
    50%      { transform: translate(22px, 30px); }
}
@keyframes bounce-4 {
    0%, 100% { transform: translate(0, 0); }
    50%      { transform: translate(-26px, -28px); }
}
@keyframes bounce-5 {
    0%, 100% { transform: translate(0, 0); }
    50%      { transform: translate(34px, 14px); }
}
@keyframes bounce-6 {
    0%, 100% { transform: translate(0, 0); }
    50%      { transform: translate(-18px, -34px); }
}

/* ---------- Scene 4: Mujun (climax) ---------- */

.mujun-stage {
    position: relative;
    width: 100%;
    min-height: 130vh;
}

.mujun-spear {
    position: absolute;
    top: 0;
    left: 38%;
    width: 4px;
    height: 100%;
    pointer-events: none;
}

.mujun-spear-stroke {
    stroke-dasharray: 1400;
    stroke-dashoffset: 1400;
    transition: stroke-dashoffset 2.6s linear;
}

.scene-mujun.is-active .mujun-spear-stroke {
    stroke-dashoffset: 0;
}

.mujun-shield {
    position: absolute;
    top: 30%;
    left: 38%;
    transform: translate(-50%, -50%);
    pointer-events: none;
}

.mujun-shield-circle {
    stroke-dasharray: 1520;
    stroke-dashoffset: 1520;
    transform-origin: center;
    transition: stroke-dashoffset 2.8s ease-in-out 0.4s;
    animation: mujun-shield-pulse 6s ease-in-out infinite 3s;
}

.scene-mujun.is-active .mujun-shield-circle {
    stroke-dashoffset: 0;
}

@keyframes mujun-shield-pulse {
    0%, 100% { stroke-width: 2; }
    50%      { stroke-width: 3; }
}

.constellation {
    position: absolute;
    top: 8%;
    left: 18%;
    width: 56%;
    height: 80%;
    pointer-events: none;
}

.constellation .iso-icon {
    position: absolute;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 1s ease-out, transform 1s ease-out;
}

.scene-mujun.is-active .constellation .iso-icon {
    opacity: 1;
    transform: translateY(0);
}

.scene-mujun.is-active .c-1 { transition-delay: 1.0s; }
.scene-mujun.is-active .c-2 { transition-delay: 1.3s; }
.scene-mujun.is-active .c-3 { transition-delay: 1.6s; }
.scene-mujun.is-active .c-4 { transition-delay: 1.9s; }
.scene-mujun.is-active .c-5 { transition-delay: 2.2s; }
.scene-mujun.is-active .c-6 { transition-delay: 2.5s; }
.scene-mujun.is-active .c-7 { transition-delay: 2.8s; }

.c-1 { top: 8%;  left: 12%; animation: float-y 7s ease-in-out infinite 1s; }
.c-2 { top: 22%; left: 48%; animation: float-y 8s ease-in-out infinite 0s; }
.c-3 { top: 36%; left: 28%; animation: float-y 9s ease-in-out infinite 2s; }
.c-4 { top: 54%; left: 60%; animation: float-y 6.5s ease-in-out infinite 1.5s; }
.c-5 { top: 68%; left: 18%; animation: float-y 7.5s ease-in-out infinite 0.5s; }
.c-6 { top: 78%; left: 52%; animation: float-y 8.5s ease-in-out infinite 2.5s; }
.c-7 { top: 88%; left: 36%; animation: float-y 9.5s ease-in-out infinite 1.2s; }

@keyframes float-y {
    0%, 100% { translate: 0 0; }
    50%      { translate: 0 -10px; }
}

/* ---------- Scene 5: Resolution ---------- */

.scene-resolution {
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.centered-mark {
    text-align: center;
    z-index: 2;
}

.centered-kanji {
    display: block;
    font-family: var(--font-display);
    font-weight: 700;
    font-size: clamp(36px, 5vw, 64px);
    color: var(--kurenai);
    letter-spacing: 0.08em;
    margin-bottom: 14px;
    opacity: 0;
    transform: translateY(8px);
    transition: opacity 1.2s ease-out 0.3s, transform 1.2s ease-out 0.3s;
}

.centered-roman {
    display: block;
    font-family: var(--font-secondary);
    font-weight: 600;
    font-size: 24px;
    color: var(--enji);
    letter-spacing: 0.16em;
    text-transform: lowercase;
    opacity: 0;
    transform: translateY(6px);
    transition: opacity 1.2s ease-out 0.6s, transform 1.2s ease-out 0.6s;
}

.scene-resolution.is-active .centered-kanji,
.scene-resolution.is-active .centered-roman {
    opacity: 1;
    transform: translateY(0);
}

.bubble-drift {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 1;
}

.bd {
    position: absolute;
    left: var(--x);
    top: calc(var(--y) + 24vh);
    width: var(--size);
    height: var(--size);
    border-radius: 50%;
    background: var(--kurenai);
    opacity: 0;
    animation: bd-fade 1.6s ease-out forwards, bd-drift 8s ease-in-out infinite;
    animation-delay: calc(0.6s + var(--delay)), calc(2s + var(--delay));
}

.bd[style*="--tone: awa"] {
    background: var(--awa);
}

@keyframes bd-fade {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: var(--opacity, 0.2); transform: translateY(0); }
}

@keyframes bd-drift {
    0%, 100% { transform: translate(0, 0); }
    50%      { transform: translate(0, -8px); }
}

.torii-corner {
    position: absolute;
    bottom: 6vh;
    right: 6vw;
    opacity: 0.4;
}

/* ---------- Dot navigation ---------- */

.dot-nav {
    position: fixed;
    top: 50%;
    right: 4%;
    transform: translateY(-50%);
    display: flex;
    flex-direction: column;
    gap: 18px;
    z-index: 50;
    mix-blend-mode: difference;
}

.dot {
    position: relative;
    display: block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--kurenai);
    transition: all 400ms ease-out;
    text-decoration: none;
}

.dot.is-active {
    width: 12px;
    height: 12px;
    background: var(--enji);
    box-shadow: 0 0 0 1px var(--enji);
}

.dot:hover {
    width: 12px;
    height: 12px;
    background: var(--enji);
    box-shadow: 0 0 0 1px var(--enji);
}

.dot-tooltip {
    position: absolute;
    right: 22px;
    top: 50%;
    transform: translateY(-50%);
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 11px;
    color: var(--kurenai);
    background: var(--shiroi);
    padding: 4px 10px;
    border: 1px solid var(--sakura-nezumi);
    white-space: nowrap;
    opacity: 0;
    transition: opacity 400ms ease-out;
    pointer-events: none;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.dot:hover .dot-tooltip {
    opacity: 1;
}

/* ---------- Responsive ---------- */

@media (max-width: 900px) {
    .scene-spear,
    .scene-shield {
        grid-template-columns: 1fr;
    }

    .iso-cluster {
        height: 30vh;
    }

    .content-right,
    .content-far-right,
    .content-mujun {
        margin: 4vh auto;
        max-width: 86%;
    }

    .shield-stage {
        height: 50vh;
        justify-content: center;
        padding-left: 0;
    }

    .shield-svg {
        width: 320px;
        height: 320px;
    }

    .shield-bubbles {
        left: 50%;
        transform: translate(-50%, -50%);
        width: 320px;
        height: 320px;
    }

    .mujun-shield {
        width: 380px;
        height: 380px;
    }

    .mujun-spear {
        left: 50%;
    }

    .mujun-shield {
        left: 50%;
    }

    .constellation {
        left: 8%;
        width: 84%;
    }

    .dot-nav {
        right: 2%;
    }

    .display {
        font-size: clamp(24px, 6vw, 36px);
    }

    .kanji-glyph {
        font-size: 64px;
    }

    .kanji-mujun {
        font-size: 80px;
    }
}

/* ---------- Initial reveal helpers ---------- */

.scene .content-block,
.scene .display,
.scene .body,
.scene .eyebrow,
.scene .kanji-glyph {
    transition: opacity 900ms ease-out, transform 900ms ease-out, color 800ms ease-out;
}
