/* =====================================================
   munju.im — McBling reverie
   Palette · High-contrast chrome
   Layout  · Ma-negative-space (asymmetric quadrant anchors)
   Type    · Kinetic-animated
   ===================================================== */

/* ------- CSS Custom Properties ------- */
:root {
    --void-black: #0A0A0A;
    --charcoal-velour: #1C1C1E;
    --hot-pink: #FF69B4;
    --rose-chrome: #FF85C8;
    --chrome-silver: #C0C0C0;
    --diamond-white: #F5F5FF;
    --platinum: #E8E0F0;
    --text-primary: #E8E8E8;
    --text-muted: #B0B0B0;
    --text-dim: #808080;
    --text-on-light: #4A4A4A;
    --flash-overlay: #FFFFFF;

    --rail-position: 88%;

    --font-display: "Playfair Display", "Lora", Georgia, serif;
    --font-body: "Urbanist", "Inter", "Space Grotesk", system-ui, sans-serif;
    --font-mono: "Space Mono", "Roboto Mono", "Courier New", monospace;
}

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

html {
    scroll-snap-type: y proximity;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-body);
    background-color: var(--void-black);
    color: var(--text-primary);
    overflow-x: hidden;
    line-height: 1.7;
    min-height: 100vh;
    position: relative;
}

/* ------- Grain overlay (atmospheric foundation) ------- */
.grain-overlay {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 200;
    opacity: 0.12;
    mix-blend-mode: screen;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='240' height='240' viewBox='0 0 240 240'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch' seed='5'/><feColorMatrix values='0 0 0 0 1  0 0 0 0 0.95  0 0 0 0 0.85  0 0 0 0.55 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
    background-size: 240px 240px;
    transition: opacity 220ms ease-out;
}

.grain-overlay.grain-flash {
    opacity: 0.4;
}

/* ------- Atmosphere wrapper (blobs + butterflies) ------- */
.atmosphere {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 1;
    overflow: hidden;
}

/* ------- Organic blobs ------- */
.blob {
    position: absolute;
    filter: blur(40px);
    animation: blobFloat 22s ease-in-out infinite;
    will-change: transform, d;
    backdrop-filter: blur(0.5px);
}

.blob path {
    transition: d 1.6s cubic-bezier(0.34, 1.2, 0.64, 1);
}

.blob-large {
    width: 70vmax;
    height: 70vmax;
    top: -10vmax;
    left: -15vmax;
    opacity: 0.04;
    animation-duration: 24s;
}

.blob-medium {
    width: 38vmax;
    height: 38vmax;
    bottom: 5vh;
    right: -8vmax;
    opacity: 0.07;
    animation-duration: 18s;
    animation-delay: -6s;
}

.blob-small {
    width: 18vmax;
    height: 18vmax;
    top: 35vh;
    right: 24vw;
    opacity: 0.05;
    animation-duration: 16s;
    animation-delay: -3s;
}

@keyframes blobFloat {
    0%, 100% {
        transform: translate3d(0, 0, 0) rotate(0deg) scale(1);
    }
    25% {
        transform: translate3d(2vw, -2vh, 0) rotate(4deg) scale(1.04);
    }
    50% {
        transform: translate3d(-1vw, 3vh, 0) rotate(-3deg) scale(0.97);
    }
    75% {
        transform: translate3d(-3vw, -1vh, 0) rotate(2deg) scale(1.02);
    }
}

/* ------- Butterfly silhouettes ------- */
.butterfly {
    position: fixed;
    pointer-events: none;
    opacity: 0.15;
    animation: butterflyRotate 120s linear infinite;
}

.butterfly-edge {
    width: 280px;
    height: auto;
    top: 18vh;
    right: -110px;
}

.butterfly-distant {
    width: 90px;
    height: auto;
    bottom: 12vh;
    left: 6vw;
    opacity: 0.1;
    animation-duration: 180s;
    animation-direction: reverse;
}

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

/* ------- Sparkle particle field ------- */
.sparkle-field {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 5;
    overflow: hidden;
}

.sparkle {
    position: absolute;
    width: 3px;
    height: 3px;
    background: var(--diamond-white);
    transform: rotate(45deg);
    opacity: 0;
    box-shadow:
        0 0 4px var(--diamond-white),
        0 0 10px rgba(255, 105, 180, 0.4);
    animation: sparkleLife 1100ms ease-out forwards;
}

.sparkle.sparkle-large {
    width: 4px;
    height: 4px;
}

@keyframes sparkleLife {
    0%   { opacity: 0; transform: rotate(45deg) scale(0.4); }
    18%  { opacity: 1; transform: rotate(45deg) scale(1); }
    60%  { opacity: 1; transform: rotate(45deg) scale(1); }
    100% { opacity: 0; transform: rotate(135deg) scale(0.6); }
}

/* ------- Chrome rail ------- */
.chrome-rail {
    position: fixed;
    top: 0;
    left: var(--rail-position);
    height: 100vh;
    width: 1px;
    pointer-events: none;
    z-index: 50;
    opacity: 0;
    animation: railFadeIn 1400ms ease-out 700ms forwards;
}

.chrome-rail-line {
    position: absolute;
    inset: 0;
    background: linear-gradient(
        to bottom,
        transparent 0%,
        rgba(192, 192, 192, 0.5) 12%,
        rgba(192, 192, 192, 0.7) 50%,
        rgba(192, 192, 192, 0.5) 88%,
        transparent 100%
    );
}

.chrome-rail-dot {
    position: absolute;
    left: -3px;
    top: 0;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--chrome-silver);
    box-shadow:
        0 0 6px var(--chrome-silver),
        0 0 12px rgba(255, 105, 180, 0.5);
    transition: top 220ms ease-out;
    animation: railDotPulse 2400ms ease-in-out infinite;
}

@keyframes railFadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

@keyframes railDotPulse {
    0%, 100% {
        box-shadow: 0 0 4px var(--chrome-silver), 0 0 8px rgba(255, 105, 180, 0.3);
        transform: scale(1);
    }
    50% {
        box-shadow: 0 0 10px var(--chrome-silver), 0 0 18px rgba(255, 105, 180, 0.6);
        transform: scale(1.2);
    }
}

/* ------- Camera flash ------- */
.camera-flash {
    position: fixed;
    inset: 0;
    background: var(--flash-overlay);
    opacity: 0;
    pointer-events: none;
    z-index: 250;
    transition: opacity 150ms ease-out;
    mix-blend-mode: screen;
}

.camera-flash.flashing {
    opacity: 0.85;
    transition-duration: 150ms;
}

.camera-flash.flashing-out {
    opacity: 0;
    transition-duration: 300ms;
}

/* ------- Main narrative container ------- */
.narrative {
    position: relative;
    z-index: 10;
    width: 100%;
}

.scene {
    position: relative;
    width: 100%;
    min-height: 100vh;
    padding: 12vh 8vw;
    display: flex;
    align-items: stretch;
    scroll-snap-align: start;
    overflow: hidden;
}

.scene-interstitial {
    min-height: 50vh;
    align-items: center;
    justify-content: center;
}

.scene-opening,
.scene-closing {
    align-items: center;
    justify-content: center;
}

/* ------- Content positioning (asymmetric quadrants) ------- */
.content {
    position: relative;
    width: 50%;
    max-width: 640px;
    z-index: 12;
}

.content-center {
    width: auto;
    text-align: center;
    margin: 0 auto;
}

.content-upper-left {
    align-self: flex-start;
    margin-right: auto;
    margin-left: 4vw;
    padding-top: 6vh;
}

.content-lower-right {
    align-self: flex-end;
    margin-left: auto;
    margin-right: 8vw;
    padding-bottom: 8vh;
    text-align: left;
}

.content-lower-left {
    align-self: flex-end;
    margin-right: auto;
    margin-left: 6vw;
    padding-bottom: 8vh;
}

/* ------- Display headline (kinetic) ------- */
.display-name,
.display-headline {
    font-family: var(--font-display);
    font-weight: 900;
    line-height: 1.02;
    letter-spacing: -0.02em;
    color: var(--text-primary);
    margin-bottom: 0.4em;
    background: linear-gradient(
        115deg,
        var(--hot-pink) 0%,
        var(--rose-chrome) 25%,
        var(--chrome-silver) 50%,
        var(--platinum) 75%,
        var(--hot-pink) 100%
    );
    background-size: 300% 100%;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;
    animation: shimmerSweep 6s linear infinite;
}

.display-name {
    font-size: clamp(72px, 14vw, 160px);
}

.display-name-closing {
    font-size: clamp(96px, 18vw, 220px);
}

.display-headline {
    font-size: clamp(40px, 6vw, 84px);
}

@keyframes shimmerSweep {
    0%   { background-position: 0% 50%; }
    100% { background-position: 300% 50%; }
}

/* ------- Kinetic character animation ------- */
.kinetic-text .char {
    display: inline-block;
    opacity: 0;
    transform: translateY(28px) scale(0.8);
    transition:
        opacity 600ms cubic-bezier(0.34, 1.56, 0.64, 1),
        transform 600ms cubic-bezier(0.34, 1.56, 0.64, 1);
    will-change: transform, opacity;
}

.kinetic-text .char-space {
    display: inline-block;
    width: 0.3em;
}

.kinetic-text.is-revealed .char {
    opacity: 1;
    transform: translateY(0) scale(1);
}

/* ------- Domain suffix + meta lines ------- */
.domain-suffix {
    font-family: var(--font-body);
    font-weight: 300;
    font-size: clamp(22px, 3vw, 36px);
    color: var(--chrome-silver);
    letter-spacing: 0.02em;
    margin-top: 0.4em;
    opacity: 0;
    transform: translateY(8px);
    transition: opacity 800ms ease-out, transform 800ms ease-out;
}

.is-revealed .domain-suffix,
.scene-opening.is-active .domain-suffix,
.scene-closing.is-active .domain-suffix {
    opacity: 1;
    transform: translateY(0);
    transition-delay: 1100ms;
}

.domain-suffix-closing {
    color: var(--rose-chrome);
}

.opening-meta,
.closing-meta {
    font-family: var(--font-mono);
    font-size: 11px;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--hot-pink);
    margin-top: 3rem;
    opacity: 0;
    transition: opacity 1000ms ease-out 1800ms;
}

.scene-opening.is-active .opening-meta,
.scene-closing.is-active .closing-meta {
    opacity: 1;
}

/* ------- Chapter meta label ------- */
.chapter-meta {
    font-family: var(--font-mono);
    font-size: 11px;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: var(--hot-pink);
    margin-bottom: 2.4rem;
    opacity: 0;
    transform: translateY(6px);
    transition: opacity 700ms ease-out, transform 700ms ease-out;
}

.is-active .chapter-meta {
    opacity: 1;
    transform: translateY(0);
}

/* ------- Body copy ------- */
.body-stack {
    margin-top: 2.6rem;
    max-width: 540px;
}

.body-paragraph {
    font-family: var(--font-body);
    font-weight: 400;
    font-size: clamp(15px, 1.1vw, 18px);
    line-height: 1.78;
    color: var(--text-muted);
    margin-bottom: 1.4em;
    opacity: 0;
    transform: translateY(14px);
    transition:
        opacity 900ms ease-out,
        transform 900ms ease-out;
}

.is-active .body-paragraph {
    opacity: 1;
    transform: translateY(0);
}

.is-active .body-paragraph:nth-of-type(1) { transition-delay: 800ms; }
.is-active .body-paragraph:nth-of-type(2) { transition-delay: 950ms; }
.is-active .body-paragraph:nth-of-type(3) { transition-delay: 1100ms; }
.is-active .body-paragraph:nth-of-type(4) { transition-delay: 1250ms; }

/* ------- Pull quote ------- */
.pull-quote {
    position: absolute;
    top: 16vh;
    left: 8vw;
    right: 14vw;
    font-family: var(--font-body);
    font-weight: 300;
    font-style: italic;
    font-size: clamp(22px, 2.6vw, 38px);
    line-height: 1.4;
    color: var(--text-primary);
    letter-spacing: -0.005em;
    z-index: 11;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 1100ms ease-out 400ms, transform 1100ms ease-out 400ms;
}

.is-active .pull-quote {
    opacity: 1;
    transform: translateY(0);
}

.quote-mark {
    font-family: var(--font-display);
    font-weight: 900;
    color: var(--hot-pink);
    font-size: 1.4em;
    line-height: 0;
    vertical-align: -0.35em;
    margin-right: 0.05em;
}

.quote-mark-close {
    margin-left: 0.05em;
    margin-right: 0;
}

/* ------- Interstitial accent line ------- */
.accent-line {
    font-family: var(--font-mono);
    font-size: clamp(13px, 1.1vw, 16px);
    letter-spacing: 0.32em;
    text-transform: uppercase;
    color: var(--hot-pink);
    text-align: center;
    opacity: 0;
    transform: translateY(8px);
    transition: opacity 900ms ease-out, transform 900ms ease-out;
    text-shadow: 0 0 14px rgba(255, 105, 180, 0.45);
}

.scene-interstitial.is-active .accent-line {
    opacity: 1;
    transform: translateY(0);
}

/* ------- Halo blob (ch.3) ------- */
.scene-halo {
    overflow: hidden;
}

.halo-blob {
    position: absolute;
    bottom: -10vh;
    left: -5vw;
    width: 70vmin;
    height: 70vmin;
    z-index: 8;
    opacity: 0;
    filter: blur(30px);
    transition: opacity 1500ms ease-out;
}

.halo-blob svg {
    width: 100%;
    height: 100%;
}

.halo-blob path {
    fill: var(--rose-chrome);
    opacity: 0.08;
    transition: d 2s cubic-bezier(0.34, 1.2, 0.64, 1);
    animation: blobFloat 20s ease-in-out infinite;
}

.scene-halo.is-active .halo-blob {
    opacity: 1;
}

/* ------- Scene state machine ------- */
.scene-opening.is-active .kinetic-text .char,
.scene-closing.is-active .kinetic-text .char {
    opacity: 1;
    transform: translateY(0) scale(1);
}

/* ------- Scale-hover pattern (text micro-interactions) ------- */
.display-headline,
.display-name {
    transition: transform 250ms cubic-bezier(0.34, 1.56, 0.64, 1);
}

.display-headline:hover,
.display-name:hover {
    transform: scale(1.015);
}

.body-paragraph {
    transition: transform 200ms cubic-bezier(0.34, 1.56, 0.64, 1),
                opacity 900ms ease-out,
                color 200ms ease-out;
}

.body-paragraph:hover {
    color: var(--text-primary);
}

.accent-line:hover,
.chapter-meta:hover,
.opening-meta:hover,
.closing-meta:hover {
    color: var(--rose-chrome);
    transition: color 180ms ease-out;
}

/* ------- Section background subtle gradient (charcoal velour suggestion) ------- */
.scene-chapter::before {
    content: "";
    position: absolute;
    inset: 0;
    background: radial-gradient(
        ellipse at 50% 50%,
        rgba(28, 28, 30, 0.5) 0%,
        rgba(10, 10, 10, 0) 60%
    );
    pointer-events: none;
    z-index: 0;
}

/* ------- Responsive tuning ------- */
@media (max-width: 900px) {
    .scene {
        padding: 10vh 5vw;
    }

    .content {
        width: 92%;
    }

    .content-upper-left,
    .content-lower-right,
    .content-lower-left {
        margin-left: 2vw;
        margin-right: 2vw;
    }

    .pull-quote {
        position: relative;
        top: auto;
        left: 0;
        right: 0;
        margin-bottom: 4vh;
    }

    .scene-chapter[data-scene="chapter-two"] {
        flex-direction: column;
        justify-content: flex-end;
    }

    :root {
        --rail-position: 94%;
    }

    .butterfly-edge {
        width: 180px;
        right: -80px;
    }
}

@media (max-width: 560px) {
    .display-name {
        font-size: clamp(56px, 18vw, 96px);
    }

    .display-headline {
        font-size: clamp(30px, 9vw, 52px);
    }
}
