/* ============================================================
   mujun.art — Paradox Gallery
   Blobitecture + Glitch-Art / Editorial-Flow Layout
   ============================================================ */

:root {
    /* Palette — Sunset-Warm */
    --warm-parchment: #FAF4ED;
    --dusk-cream: #F0E6D8;
    --deep-umber: #2C1810;
    --warm-stone: #6B5744;
    --sunset-coral: #E8734A;
    --dried-rose: #C4566A;
    --apricot-glow: #F5B88C;
    --faded-mauve: #D4A0B0;
    --electric-tangerine: #FF6A2B;
    --indigo-dusk: #3D2B5A;
    --tarnished-gold: #D4A574;
    --muted-sandstone: #B8A08A;
    --e8dcc8: #E8DCC8;

    /* Glitch config */
    --glitch-offset: 2px;
    --glitch-duration: 400ms;
}

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

html {
    scroll-behavior: smooth;
}

/* ---- Body & Background ---- */
body {
    font-family: 'DM Sans', sans-serif;
    font-weight: 400;
    font-size: clamp(1rem, 1.1vw + 0.5rem, 1.25rem);
    line-height: 1.75;
    color: var(--deep-umber);
    background: radial-gradient(ellipse at 30% 40%, var(--warm-parchment) 0%, var(--dusk-cream) 60%, var(--e8dcc8) 100%);
    background-attachment: fixed;
    overflow-x: hidden;
    position: relative;
    -webkit-font-smoothing: antialiased;
}

/* Paper grain texture overlay */
.paper-grain {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9999;
    opacity: 0.03;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.7' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
    background-repeat: repeat;
    background-size: 256px 256px;
}

.paper-grain-filter {
    position: absolute;
    width: 0;
    height: 0;
}

/* ---- Scroll Progress Line ---- */
.scroll-progress-line {
    position: fixed;
    left: 0;
    top: 0;
    width: 1px;
    height: 0%;
    background-color: var(--tarnished-gold);
    z-index: 1000;
    pointer-events: none;
    transition: none;
}

/* ---- Editorial Flow ---- */
.editorial-flow {
    position: relative;
    width: 100%;
}

/* ---- Plate (base) ---- */
.plate {
    position: relative;
    width: 100%;
    overflow: hidden;
}

/* ---- Plate Numbers (marginalia) ---- */
.plate-number {
    position: absolute;
    top: 5vh;
    left: 3vw;
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 300;
    font-size: clamp(0.7rem, 0.8vw, 0.875rem);
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--muted-sandstone);
    writing-mode: vertical-rl;
    text-orientation: mixed;
    z-index: 20;
    opacity: 0;
    transition: opacity 1.2s ease;
}

.plate-number span {
    display: inline;
}

.plate.revealed .plate-number {
    opacity: 1;
}

/* ============================================================
   PLATE I — HERO
   ============================================================ */
.plate-hero {
    min-height: 150vh;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding-bottom: 12vh;
    background-color: var(--warm-parchment);
}

/* Hero Blob */
.hero-blob {
    position: absolute;
    width: 70vw;
    height: 60vh;
    top: 15vh;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(135deg, var(--apricot-glow) 0%, var(--faded-mauve) 50%, var(--dried-rose) 100%);
    border-radius: 42% 58% 70% 30% / 45% 55% 60% 40%;
    box-shadow:
        0 30px 80px rgba(212, 160, 176, 0.3),
        0 10px 30px rgba(196, 86, 106, 0.1);
    z-index: 1;
    animation: hero-morph 22s cubic-bezier(0.37, 0, 0.63, 1) infinite;
}

@keyframes hero-morph {
    0%   { border-radius: 42% 58% 70% 30% / 45% 55% 60% 40%; }
    20%  { border-radius: 55% 45% 38% 62% / 62% 38% 55% 45%; }
    40%  { border-radius: 30% 70% 55% 45% / 50% 65% 35% 60%; }
    60%  { border-radius: 65% 35% 45% 55% / 38% 62% 50% 50%; }
    80%  { border-radius: 48% 52% 62% 38% / 55% 45% 65% 35%; }
    100% { border-radius: 42% 58% 70% 30% / 45% 55% 60% 40%; }
}

/* Scanlines overlay on blobs */
.scanlines {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border-radius: inherit;
    background-image: repeating-linear-gradient(
        0deg,
        transparent 0px,
        transparent 3px,
        rgba(61, 43, 90, 0.06) 3px,
        rgba(61, 43, 90, 0.06) 4px
    );
    pointer-events: none;
}

.scanlines-heavy {
    background-image: repeating-linear-gradient(
        0deg,
        transparent 0px,
        transparent 2px,
        rgba(61, 43, 90, 0.08) 2px,
        rgba(61, 43, 90, 0.08) 3px
    );
}

/* Accent blobs (decorative, parallax) */
.accent-blob {
    position: absolute;
    border-radius: 58% 42% 45% 55% / 50% 60% 40% 50%;
    background: linear-gradient(135deg, var(--apricot-glow) 0%, var(--faded-mauve) 100%);
    opacity: 0.25;
    z-index: 0;
    animation: accent-morph 18s cubic-bezier(0.37, 0, 0.63, 1) infinite;
    pointer-events: none;
}

.accent-blob-1 {
    width: 18vw;
    height: 18vw;
    top: 8vh;
    right: 8vw;
    animation-delay: -5s;
}

.accent-blob-2 {
    width: 12vw;
    height: 12vw;
    bottom: 25vh;
    left: 6vw;
    animation-delay: -12s;
    background: linear-gradient(135deg, var(--faded-mauve) 0%, var(--dried-rose) 100%);
    opacity: 0.15;
}

@keyframes accent-morph {
    0%   { border-radius: 58% 42% 45% 55% / 50% 60% 40% 50%; }
    33%  { border-radius: 40% 60% 55% 45% / 60% 40% 50% 50%; }
    66%  { border-radius: 50% 50% 40% 60% / 45% 55% 60% 40%; }
    100% { border-radius: 58% 42% 45% 55% / 50% 60% 40% 50%; }
}

/* Hero text block */
.hero-text-block {
    position: relative;
    z-index: 10;
    margin-left: 12vw;
    padding-right: 15vw;
}

.site-title {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 700;
    font-size: clamp(2.8rem, 7vw, 5.5rem);
    letter-spacing: -0.02em;
    color: var(--deep-umber);
    line-height: 1.05;
    position: relative;
}

.site-subtitle {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 300;
    font-size: clamp(0.7rem, 0.8vw, 0.875rem);
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--muted-sandstone);
    margin-top: 16px;
}

/* ---- Glitch effect (RGB split) ---- */
[data-glitch].glitch-active {
    animation: rgb-split var(--glitch-duration) steps(2) 1;
}

@keyframes rgb-split {
    0% {
        text-shadow: none;
    }
    25% {
        text-shadow:
            var(--glitch-offset) 0 0 var(--sunset-coral),
            calc(var(--glitch-offset) * -1) 0 0 var(--indigo-dusk);
    }
    50% {
        text-shadow:
            calc(var(--glitch-offset) * -1.5) 1px 0 var(--sunset-coral),
            var(--glitch-offset) -1px 0 var(--indigo-dusk);
    }
    75% {
        text-shadow:
            1px calc(var(--glitch-offset) * 0.5) 0 var(--sunset-coral),
            -1px calc(var(--glitch-offset) * -0.5) 0 var(--indigo-dusk);
    }
    100% {
        text-shadow: none;
    }
}

/* Continuous subtle RGB split for Plate IV quote */
.pull-quote.continuous-glitch {
    animation: continuous-rgb 4s ease-in-out infinite;
}

@keyframes continuous-rgb {
    0%, 100% {
        text-shadow: none;
    }
    30%, 70% {
        text-shadow:
            1px 0 0 var(--sunset-coral),
            -1px 0 0 var(--indigo-dusk);
    }
}

/* ============================================================
   PLATE II — FRACTURE
   ============================================================ */
.fracture-plate {
    min-height: 70vh;
    background-color: var(--dusk-cream);
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 10vh 0;
    padding-left: 12vw;
    padding-right: 10vw;
    clip-path: polygon(0 0, 100% 3%, 98% 97%, 0 100%);
    position: relative;
}

.fracture-edge-pixels {
    position: absolute;
    top: 0;
    right: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 5;
}

.pixel-dot {
    position: absolute;
    background-color: var(--electric-tangerine);
    opacity: 0;
    transition: opacity 0.6s ease;
}

.pixel-dot.visible {
    opacity: 0.7;
}

.fracture-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4vw;
    max-width: 900px;
    position: relative;
    z-index: 10;
}

.fracture-col p {
    font-family: 'DM Sans', sans-serif;
    font-weight: 400;
    font-size: clamp(1rem, 1.1vw + 0.5rem, 1.25rem);
    line-height: 1.75;
    color: var(--deep-umber);
}

.fracture-col em {
    font-weight: 500;
    color: var(--warm-stone);
}

/* Footnotes */
.footnote {
    margin-top: 40px;
    position: relative;
    z-index: 10;
}

.footnote-rule {
    display: block;
    width: 60px;
    height: 0.5px;
    background-color: var(--muted-sandstone);
    margin-bottom: 12px;
}

.footnote em {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 300;
    font-size: clamp(0.7rem, 0.8vw, 0.875rem);
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--muted-sandstone);
    font-style: normal;
}

/* ============================================================
   PLATE III — BLOB GALLERY
   ============================================================ */
.plate-gallery {
    min-height: 180vh;
    background-color: var(--warm-parchment);
    padding: 15vh 0;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.gallery-blobs {
    display: flex;
    flex-direction: column;
    gap: 12vh;
    width: 100%;
    padding: 0 8vw;
    position: relative;
    z-index: 10;
}

.gallery-item {
    display: flex;
    flex-direction: column;
    opacity: 0;
    transform: scale(0.92) translateY(30px);
    transition: opacity 0.6s cubic-bezier(0.34, 1.56, 0.64, 1),
                transform 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.gallery-item.revealed {
    opacity: 1;
    transform: scale(1) translateY(0);
}

.gallery-item-left {
    align-self: flex-start;
    margin-left: 4vw;
}

.gallery-item-right {
    align-self: flex-end;
    margin-right: 4vw;
    align-items: flex-end;
    text-align: right;
}

.gallery-blob {
    position: relative;
    width: 45vw;
    height: 30vh;
    box-shadow:
        0 20px 60px rgba(212, 160, 176, 0.25),
        0 8px 20px rgba(196, 86, 106, 0.08);
}

.gallery-blob-1 {
    background: linear-gradient(135deg, var(--apricot-glow) 0%, var(--faded-mauve) 100%);
    border-radius: 50% 50% 40% 60% / 55% 45% 55% 45%;
    animation: gallery-morph-1 20s cubic-bezier(0.37, 0, 0.63, 1) infinite;
}

.gallery-blob-2 {
    background: linear-gradient(160deg, var(--faded-mauve) 0%, var(--dried-rose) 70%, var(--sunset-coral) 100%);
    border-radius: 40% 60% 55% 45% / 50% 60% 40% 50%;
    animation: gallery-morph-2 23s cubic-bezier(0.37, 0, 0.63, 1) infinite;
}

.gallery-blob-3 {
    background: linear-gradient(120deg, var(--dried-rose) 0%, var(--apricot-glow) 50%, var(--faded-mauve) 100%);
    border-radius: 55% 45% 50% 50% / 45% 55% 45% 55%;
    animation: gallery-morph-3 18s cubic-bezier(0.37, 0, 0.63, 1) infinite;
}

@keyframes gallery-morph-1 {
    0%   { border-radius: 50% 50% 40% 60% / 55% 45% 55% 45%; }
    33%  { border-radius: 60% 40% 50% 50% / 45% 55% 40% 60%; }
    66%  { border-radius: 45% 55% 55% 45% / 60% 40% 55% 45%; }
    100% { border-radius: 50% 50% 40% 60% / 55% 45% 55% 45%; }
}

@keyframes gallery-morph-2 {
    0%   { border-radius: 40% 60% 55% 45% / 50% 60% 40% 50%; }
    33%  { border-radius: 55% 45% 45% 55% / 40% 50% 60% 50%; }
    66%  { border-radius: 50% 50% 60% 40% / 55% 45% 50% 50%; }
    100% { border-radius: 40% 60% 55% 45% / 50% 60% 40% 50%; }
}

@keyframes gallery-morph-3 {
    0%   { border-radius: 55% 45% 50% 50% / 45% 55% 45% 55%; }
    33%  { border-radius: 45% 55% 40% 60% / 55% 45% 60% 40%; }
    66%  { border-radius: 60% 40% 55% 45% / 40% 60% 45% 55%; }
    100% { border-radius: 55% 45% 50% 50% / 45% 55% 45% 55%; }
}

.gallery-label {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 300;
    font-size: clamp(0.7rem, 0.8vw, 0.875rem);
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--muted-sandstone);
    margin-top: 24px;
}

.gallery-annotation {
    font-family: 'DM Sans', sans-serif;
    font-weight: 400;
    font-size: clamp(0.85rem, 0.9vw, 1rem);
    line-height: 1.7;
    color: var(--warm-stone);
    max-width: 420px;
    margin-top: 8px;
    font-style: italic;
}

.accent-blob-3 {
    width: 15vw;
    height: 15vw;
    bottom: 10vh;
    right: 5vw;
    animation-delay: -8s;
}

/* ============================================================
   PLATE IV — PULL QUOTE / DEEP FRACTURE
   ============================================================ */
.plate-quote {
    min-height: 80vh;
    align-items: flex-start;
}

.quote-block {
    position: relative;
    max-width: 750px;
    z-index: 10;
}

.quote-mark {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 700;
    font-size: clamp(8rem, 15vw, 14rem);
    color: var(--dried-rose);
    opacity: 0.2;
    position: absolute;
    top: -0.35em;
    left: -0.15em;
    line-height: 1;
    z-index: 0;
    pointer-events: none;
}

.pull-quote {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 700;
    font-size: clamp(1.8rem, 4vw, 3.5rem);
    letter-spacing: -0.02em;
    color: var(--deep-umber);
    line-height: 1.25;
    position: relative;
    z-index: 1;
}

.quote-footnote {
    max-width: 750px;
}

/* ============================================================
   PLATE V — FINAL BLOB
   ============================================================ */
.plate-final {
    min-height: 140vh;
    background-color: var(--dusk-cream);
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 15vh 0;
}

.final-blob {
    position: relative;
    width: clamp(320px, 75vw, 900px);
    min-height: 55vh;
    background: linear-gradient(150deg, var(--faded-mauve) 0%, var(--dried-rose) 60%, var(--sunset-coral) 100%);
    border-radius: 48% 52% 58% 42% / 40% 60% 38% 62%;
    box-shadow:
        0 40px 100px rgba(196, 86, 106, 0.2),
        0 15px 40px rgba(212, 160, 176, 0.15);
    z-index: 5;
    animation: final-morph 25s cubic-bezier(0.37, 0, 0.63, 1) infinite;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8vh 6vw;
}

@keyframes final-morph {
    0%   { border-radius: 48% 52% 58% 42% / 40% 60% 38% 62%; }
    15%  { border-radius: 58% 42% 45% 55% / 55% 45% 52% 48%; }
    30%  { border-radius: 42% 58% 52% 48% / 48% 52% 60% 40%; }
    45%  { border-radius: 55% 45% 40% 60% / 60% 40% 45% 55%; }
    60%  { border-radius: 45% 55% 60% 40% / 42% 58% 48% 52%; }
    75%  { border-radius: 52% 48% 48% 52% / 55% 45% 55% 45%; }
    100% { border-radius: 48% 52% 58% 42% / 40% 60% 38% 62%; }
}

.final-blob-content {
    position: relative;
    z-index: 10;
    max-width: 580px;
}

.final-title {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 700;
    font-size: clamp(2rem, 4vw, 3.5rem);
    letter-spacing: -0.02em;
    color: var(--warm-parchment);
    margin-bottom: 28px;
    line-height: 1.1;
}

.final-text {
    font-family: 'DM Sans', sans-serif;
    font-weight: 400;
    font-size: clamp(0.95rem, 1vw, 1.15rem);
    line-height: 1.75;
    color: var(--warm-parchment);
    opacity: 0.9;
    margin-bottom: 20px;
}

.final-text:last-child {
    margin-bottom: 0;
}

.accent-blob-4 {
    width: 20vw;
    height: 20vw;
    top: 8vh;
    left: 5vw;
    animation-delay: -3s;
    background: linear-gradient(135deg, var(--dried-rose) 0%, var(--indigo-dusk) 100%);
    opacity: 0.1;
}

/* ============================================================
   CODA
   ============================================================ */
.coda-plate {
    min-height: 60vh;
    background-color: var(--warm-parchment);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 10vh 0 8vh;
    gap: 48px;
}

.coda-space {
    text-align: center;
}

.coda-kanji {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 300;
    font-size: clamp(3rem, 10vw, 6rem);
    letter-spacing: 0.12em;
    color: var(--muted-sandstone);
    line-height: 1.2;
}

.coda-annotation {
    font-family: 'DM Sans', sans-serif;
    font-weight: 400;
    font-size: clamp(0.85rem, 0.9vw, 1rem);
    color: var(--warm-stone);
    margin-top: 16px;
    font-style: italic;
}

.return-blob {
    width: 5vw;
    min-width: 48px;
    max-width: 64px;
    height: 5vw;
    min-height: 48px;
    max-height: 64px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--apricot-glow) 0%, var(--faded-mauve) 100%);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--warm-parchment);
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1),
                box-shadow 0.4s ease;
    box-shadow: 0 8px 24px rgba(212, 160, 176, 0.3);
}

.return-blob:hover {
    transform: scale(1.12);
    box-shadow: 0 12px 36px rgba(212, 160, 176, 0.45);
}

/* ============================================================
   GLITCH FLASH OVERLAY (scroll-triggered)
   ============================================================ */
.glitch-flash {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--electric-tangerine);
    opacity: 0;
    pointer-events: none;
    z-index: 9998;
    transition: opacity 0.05s ease;
}

.glitch-flash.flash {
    opacity: 0.08;
}

/* ============================================================
   REVEAL ANIMATIONS
   ============================================================ */
.plate-hero {
    opacity: 1;
}

.plate:not(.plate-hero) {
    opacity: 0;
    transform: translateY(40px);
    transition: opacity 0.9s cubic-bezier(0.25, 0.46, 0.45, 0.94),
                transform 0.9s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.plate:not(.plate-hero).revealed {
    opacity: 1;
    transform: translateY(0);
}

/* Hero starts visible but fades in slightly */
.plate-hero .hero-text-block {
    opacity: 0;
    transform: translateY(24px);
    transition: opacity 1s cubic-bezier(0.25, 0.46, 0.45, 0.94) 0.3s,
                transform 1s cubic-bezier(0.25, 0.46, 0.45, 0.94) 0.3s;
}

.plate-hero.revealed .hero-text-block {
    opacity: 1;
    transform: translateY(0);
}

.plate-hero .hero-blob {
    opacity: 0;
    transform: translateX(-50%) scale(0.9);
    transition: opacity 1.2s ease 0.1s, transform 1.2s cubic-bezier(0.34, 1.56, 0.64, 1) 0.1s;
}

.plate-hero.revealed .hero-blob {
    opacity: 1;
    transform: translateX(-50%) scale(1);
}

/* ============================================================
   RESPONSIVE — MOBILE
   ============================================================ */
@media (max-width: 768px) {
    .hero-text-block {
        margin-left: 6vw;
        padding-right: 6vw;
    }

    .plate-number {
        left: 2vw;
        font-size: 0.65rem;
    }

    .hero-blob {
        width: 90vw;
        height: 45vh;
        top: 12vh;
    }

    .fracture-plate {
        padding-left: 6vw;
        padding-right: 6vw;
        clip-path: polygon(0 0, 100% 1.5%, 99% 98.5%, 0 100%);
    }

    .fracture-content {
        grid-template-columns: 1fr;
        gap: 24px;
    }

    .gallery-blobs {
        padding: 0 4vw;
    }

    .gallery-blob {
        width: 80vw;
        height: 25vh;
    }

    .gallery-item-left,
    .gallery-item-right {
        margin-left: 0;
        margin-right: 0;
        align-self: stretch;
        align-items: flex-start;
        text-align: left;
    }

    .final-blob {
        width: 90vw;
        min-height: 45vh;
        padding: 6vh 6vw;
    }

    .accent-blob {
        display: none;
    }

    .quote-mark {
        font-size: 6rem;
    }

    .pull-quote {
        font-size: clamp(1.5rem, 5vw, 2.5rem);
    }

    .plate-hero {
        min-height: 120vh;
    }

    .plate-gallery {
        min-height: auto;
    }

    .scroll-progress-line {
        display: none;
    }
}

@media (max-width: 480px) {
    .site-title {
        font-size: 2.4rem;
    }

    .hero-blob {
        width: 95vw;
        height: 38vh;
    }

    .final-blob {
        padding: 5vh 5vw;
    }
}
