/* mujun.quest - Maximalist Monochrome Paradox */

/* ========== RESET & BASE ========== */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-snap-type: y mandatory;
    overflow-y: auto;
    scroll-behavior: smooth;
}

body {
    background: #0e0e0e;
    color: #e0e0e0;
    font-family: 'Inter', sans-serif;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ========== FIXED LAYERS ========== */

#dust-particles {
    position: fixed;
    inset: 0;
    z-index: 1;
    pointer-events: none;
    width: 100vw;
    height: 100vh;
}

#grain-overlay {
    position: fixed;
    inset: 0;
    z-index: 2;
    pointer-events: none;
    mix-blend-mode: overlay;
    opacity: 0.08;
    filter: url(#grain-65);
    animation: grain-drift 8s ease-in-out infinite;
    transition: opacity 0.8s ease;
}

#grain-overlay::before {
    content: '';
    position: absolute;
    inset: -50%;
    width: 200%;
    height: 200%;
    background: transparent;
    filter: url(#grain-65);
}

body.scene-active-4 #grain-overlay {
    opacity: 0.18;
}

@keyframes grain-drift {
    0%, 100% { filter: url(#grain-65); }
    50% { filter: url(#grain-70); }
}

#progress-bar {
    position: fixed;
    left: 0;
    top: 0;
    width: 2px;
    height: 0;
    background: #b0b0b0;
    z-index: 10;
    transition: height 0.15s ease-out;
}

/* ========== SCENES (SHARED) ========== */

.scene {
    position: relative;
    min-height: 100vh;
    scroll-snap-align: start;
    overflow: hidden;
    display: flex;
    align-items: center;
}

.scene-content {
    position: relative;
    z-index: 3;
    width: 100%;
    height: 100vh;
    display: flex;
    align-items: center;
    padding: 4rem;
}

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

.kanji-display {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 700;
    font-size: clamp(8rem, 18vw, 14rem);
    letter-spacing: -0.03em;
    color: #e8e8e8;
    text-shadow: 0 0 80px rgba(180, 180, 180, 0.15);
    line-height: 1;
    user-select: none;
    flex-shrink: 0;
}

.secondary-headline {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 500;
    font-size: clamp(1.8rem, 3.5vw, 3rem);
    letter-spacing: 0.02em;
    text-transform: uppercase;
    color: #a0a0a0;
    margin-bottom: 1.5rem;
}

.body-text {
    font-family: 'Inter', sans-serif;
    font-weight: 400;
    font-size: clamp(0.85rem, 1.1vw, 1rem);
    line-height: 1.7;
    letter-spacing: 0.01em;
    color: #8a8a8a;
    max-width: 38ch;
    margin-bottom: 1.5rem;
}

.annotation {
    font-family: 'Inter', sans-serif;
    font-weight: 300;
    font-size: 0.7rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #606060;
    display: block;
}

/* ========== REVEAL ANIMATIONS ========== */

.reveal-left,
.reveal-right,
.reveal-diagonal,
.reveal-converge-left,
.reveal-converge-right,
.reveal-converge-top,
.reveal-converge-bottom {
    opacity: 0;
    transition: opacity 0.8s cubic-bezier(0.16, 1, 0.3, 1),
                transform 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

.reveal-left { transform: translateX(-60px); }
.reveal-right { transform: translateX(60px); }
.reveal-diagonal { transform: translate(-40px, 40px) rotate(-20deg); }
.reveal-converge-left { transform: translateX(-80px); }
.reveal-converge-right { transform: translateX(80px); }
.reveal-converge-top { transform: translateY(-60px); }
.reveal-converge-bottom { transform: translateY(60px); }

.reveal-left.revealed,
.reveal-right.revealed,
.reveal-diagonal.revealed,
.reveal-converge-left.revealed,
.reveal-converge-right.revealed,
.reveal-converge-top.revealed,
.reveal-converge-bottom.revealed {
    opacity: 1;
    transform: translate(0, 0) rotate(0deg);
}

/* ========== SCENE 1: THE SPEAR ========== */

.scene--spear {
    background: #0e0e0e;
}

.scene--spear .scene-content {
    display: flex;
    align-items: center;
    gap: 4rem;
    padding-left: 6vw;
}

.spear-shape {
    position: absolute;
    left: 3vw;
    top: 20vh;
    width: 3vw;
    height: 60vh;
    clip-path: polygon(50% 0, 100% 100%, 0 100%);
    background: #2e2e2e;
    z-index: 0;
    opacity: 0.6;
}

.scene-text-block {
    max-width: 42ch;
    padding-top: 2rem;
}

.spear-tip-shape {
    position: absolute;
    right: 4vw;
    top: 50%;
    transform: translateY(-50%);
    width: 0;
    height: 0;
    border-left: 4vw solid #2e2e2e;
    border-top: 2vh solid transparent;
    border-bottom: 2vh solid transparent;
}

/* ========== SCENE 2: THE DIAGONAL ========== */

.scene--diagonal {
    background: #1a1a1a;
}

.diagonal-upper {
    position: absolute;
    inset: 0;
    background: #0e0e0e;
    clip-path: polygon(0 0, 100% 0, 100% 65%, 0 100%);
    z-index: 0;
}

.diagonal-lower {
    position: absolute;
    inset: 0;
    background: #2e2e2e;
    clip-path: polygon(0 100%, 100% 65%, 100% 100%);
    z-index: 0;
}

.diagonal-line {
    position: absolute;
    inset: 0;
    z-index: 1;
    pointer-events: none;
    background: linear-gradient(
        155deg,
        transparent calc(50% - 0.5px),
        #4a4a4a calc(50% - 0.5px),
        #4a4a4a calc(50% + 0.5px),
        transparent calc(50% + 0.5px)
    );
}

.diagonal-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2.5rem;
    z-index: 2;
}

.diagonal-text-fragment {
    color: #808080;
    transform-origin: center center;
}

.diagonal-text-fragment:nth-child(1) { transform: translate(-40px, 40px) rotate(-20deg); }
.diagonal-text-fragment:nth-child(3) { transform: translate(-40px, 40px) rotate(-20deg); }
.diagonal-text-fragment:nth-child(5) { transform: translate(-40px, 40px) rotate(-20deg); }

.diagonal-text-fragment.revealed {
    transform: rotate(-20deg) !important;
    opacity: 1;
}

.diagonal-text-fragment .annotation,
.diagonal-text-fragment .body-text {
    transform: rotate(-20deg);
    display: inline-block;
}

.diagonal-kanji {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 700;
    font-size: clamp(4rem, 10vw, 8rem);
    color: #c8c8c8;
    letter-spacing: -0.03em;
    text-shadow: 0 0 60px rgba(180, 180, 180, 0.1);
}

/* ========== SCENE 3: THE SHIELD ========== */

.scene--shield {
    background: #0e0e0e;
}

.scene-content--shield {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 4rem;
    padding-right: 6vw;
    flex-direction: row-reverse;
}

.shield-bg-shape {
    position: absolute;
    right: 15vw;
    top: 25vh;
    width: 30vw;
    height: 50vh;
    border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%;
    background: #1a1a1a;
    border: 1px solid #4a4a4a;
    z-index: 0;
    opacity: 0.5;
}

.scene-text-block--shield {
    text-align: right;
}

.scene-text-block--shield .body-text {
    margin-left: auto;
}

.kanji-display--shield {
    text-align: right;
}

.shield-tip-shape {
    position: absolute;
    left: 4vw;
    top: 50%;
    transform: translateY(-50%);
    width: 6vw;
    height: 8vh;
    border-radius: 0 50% 50% 0;
    background: #2e2e2e;
    opacity: 0.5;
}

/* ========== SCENE 4: THE COLLISION ========== */

.scene--collision {
    background: #0e0e0e;
}

.aurora-bg {
    position: absolute;
    inset: 0;
    z-index: 0;
    opacity: 0;
    transition: opacity 1.5s ease;
    background:
        radial-gradient(ellipse at 30% 40%, #d8e8ec 0%, transparent 50%),
        radial-gradient(ellipse at 70% 60%, #e0d8ec 0%, transparent 50%),
        radial-gradient(ellipse at 50% 80%, #d8ecd8 0%, transparent 50%);
    background-size: 60% 60%, 50% 50%, 70% 70%;
    animation: aurora-shift 12s ease-in-out infinite;
    mix-blend-mode: screen;
}

.scene--collision.active .aurora-bg {
    opacity: 0.15;
}

@keyframes aurora-shift {
    0% { background-position: 0% 50%, 50% 0%, 100% 50%; }
    33% { background-position: 50% 100%, 0% 50%, 50% 0%; }
    66% { background-position: 100% 0%, 100% 100%, 0% 100%; }
    100% { background-position: 0% 50%, 50% 0%, 100% 50%; }
}

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

.collision-kanji-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 3rem;
}

.collision-kanji {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 700;
    font-size: clamp(6rem, 14vw, 12rem);
    letter-spacing: -0.03em;
    line-height: 1;
    user-select: none;
}

.collision-kanji--spear {
    color: #e0e0e0;
    text-shadow: 0 0 100px rgba(216, 232, 236, 0.2);
    margin-right: -2vw;
    z-index: 1;
}

.collision-kanji--shield {
    color: #c8c8c8;
    text-shadow: 0 0 100px rgba(224, 216, 236, 0.2);
    margin-left: -2vw;
    opacity: 0.8;
}

.collision-text {
    max-width: 50ch;
}

.collision-headline {
    color: #f0f0f0;
    font-size: clamp(2rem, 4vw, 3.5rem);
    margin-bottom: 2rem;
    text-shadow: 0 0 40px rgba(216, 236, 216, 0.15);
}

.collision-body {
    max-width: 50ch;
    margin-left: auto;
    margin-right: auto;
    text-align: center;
}

.collision-annotation {
    margin-top: 1rem;
    color: #6a6a6a;
    text-align: center;
}

.secondary-headline:hover {
    color: #a8a8a8;
    transition: color 0.4s ease;
}

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

@media (max-width: 768px) {
    .scene-content {
        padding: 2rem;
    }

    .scene--spear .scene-content {
        flex-direction: column;
        padding-left: 2rem;
        gap: 2rem;
    }

    .scene-content--shield {
        flex-direction: column-reverse;
        padding-right: 2rem;
        gap: 2rem;
    }

    .scene-text-block--shield {
        text-align: left;
    }

    .scene-text-block--shield .body-text {
        margin-left: 0;
    }

    .spear-shape {
        display: none;
    }

    .shield-bg-shape {
        display: none;
    }

    .spear-tip-shape,
    .shield-tip-shape {
        display: none;
    }

    .kanji-display {
        font-size: clamp(5rem, 25vw, 10rem);
    }

    .collision-kanji {
        font-size: clamp(4rem, 20vw, 8rem);
    }

    .diagonal-kanji {
        font-size: clamp(3rem, 15vw, 6rem);
    }
}
