/* ============================================
   munju.im - Vaporwave Editorial Salon
   ============================================ */
:root {
    --cream-silk: #FAF3E8;
    --powder-blush: #F5E6EC;
    --soft-lilac: #EDE4F0;
    --plum-ink: #3B2C3D;
    --dusty-mauve: #C4A7B5;
    --faded-rose: #D4A0A0;
    --muted-teal: #8ABAB5;
    --warm-peach: #E8C4A0;
    --vintage-plum: #6B4C6E;
}

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { font-size: 16px; scroll-behavior: smooth; }
body {
    background: var(--cream-silk);
    color: var(--plum-ink);
    font-family: 'DM Sans', sans-serif;
    font-weight: 400;
    font-size: clamp(1rem, 1.1vw, 1.15rem);
    line-height: 1.72;
    letter-spacing: 0.01em;
    overflow-x: hidden;
    transition: background-color 800ms ease-in-out;
}

/* --- VHS Grain Overlay --- */
.grain-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    pointer-events: none;
    opacity: 0.03;
    mix-blend-mode: multiply;
    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.75' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='256' height='256' filter='url(%23n)' opacity='1'/%3E%3C/svg%3E");
    background-size: 256px 256px;
}

/* --- Grid-Line Underlay --- */
.grid-underlay {
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(to right, rgba(196, 167, 181, 0.05) 1px, transparent 1px),
        linear-gradient(to bottom, rgba(196, 167, 181, 0.05) 1px, transparent 1px);
    background-size: 80px 80px;
    pointer-events: none;
    z-index: 0;
}
.grid-underlay--reveal {
    opacity: 0;
    transition: opacity 1200ms ease-in-out;
    background-image:
        linear-gradient(to right, rgba(196, 167, 181, 0.15) 1px, transparent 1px),
        linear-gradient(to bottom, rgba(196, 167, 181, 0.15) 1px, transparent 1px);
    background-size: 80px 80px;
}
.grid-underlay--reveal.active {
    opacity: 1;
}

/* --- Navigation Pill --- */
.nav-pill {
    position: fixed;
    top: 24px;
    right: 24px;
    z-index: 1000;
    opacity: 0;
    transform: translateY(-10px);
    transition: opacity 600ms ease-in-out, transform 600ms ease-in-out;
    pointer-events: none;
}
.nav-pill.visible {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}
.nav-pill__btn {
    width: 48px;
    height: 48px;
    border-radius: 24px;
    border: 1px solid var(--dusty-mauve);
    background: rgba(250, 243, 232, 0.9);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
    transition: border-color 400ms ease-in-out, background 400ms ease-in-out;
}
.nav-pill__btn:hover {
    border-color: var(--faded-rose);
}
.nav-pill__line {
    display: block;
    width: 18px;
    height: 1px;
    background: var(--plum-ink);
    transition: transform 400ms ease-in-out, opacity 400ms ease-in-out;
}
.nav-pill.open .nav-pill__line:first-child {
    transform: translateY(3px) rotate(45deg);
}
.nav-pill.open .nav-pill__line:last-child {
    transform: translateY(-3px) rotate(-45deg);
}

/* --- Navigation Overlay --- */
.nav-overlay {
    position: fixed;
    inset: 0;
    z-index: 999;
    background: var(--soft-lilac);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 600ms ease-in-out;
}
.nav-overlay.open {
    opacity: 1;
    pointer-events: auto;
}
.nav-overlay__inner {
    display: flex;
    flex-direction: column;
    gap: 2rem;
    text-align: center;
}
.nav-overlay__link {
    font-family: 'Playfair Display', serif;
    font-weight: 700;
    font-size: clamp(2rem, 5vw, 3.5rem);
    letter-spacing: 0.02em;
    color: var(--plum-ink);
    text-decoration: none;
    transition: color 400ms ease-in-out;
}
.nav-overlay__link:hover {
    color: var(--faded-rose);
}

/* --- Acts (Sections) --- */
.act {
    position: relative;
    padding: clamp(2rem, 4vw, 4rem);
    transition: background-color 800ms ease-in-out;
}
.act-overture {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background: var(--cream-silk);
}
.act-thesis {
    background: var(--cream-silk);
    padding-top: clamp(4rem, 8vw, 8rem);
    padding-bottom: clamp(4rem, 8vw, 8rem);
}
.act-interlude {
    min-height: 100vh;
    background: var(--powder-blush);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    padding: 0;
    overflow: hidden;
}
.act-development {
    background: var(--powder-blush);
    padding-top: clamp(4rem, 8vw, 8rem);
    padding-bottom: clamp(4rem, 8vw, 8rem);
}
.act-gallery {
    background: var(--soft-lilac);
    padding-top: clamp(4rem, 8vw, 8rem);
    padding-bottom: clamp(4rem, 8vw, 8rem);
}
.act-colophon {
    min-height: 50vh;
    background: var(--cream-silk);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

/* --- Overture --- */
.geo-field {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}
.geo {
    position: absolute;
    opacity: 0.4;
}
.geo--circle { border-radius: 50%; }
.geo--rect { border-radius: 8px; }
.geo--triangle {
    width: 0; height: 0;
    border-left: 60px solid transparent;
    border-right: 60px solid transparent;
    border-bottom: 104px solid var(--dusty-mauve);
    background: none;
}
.geo--rose { background: var(--faded-rose); }
.geo--teal { background: var(--muted-teal); }
.geo--peach { background: var(--warm-peach); }
.geo--mauve { background: var(--dusty-mauve); }
.geo--sm { transform: scale(0.5); }

/* Geo positions and drift animations */
.geo-field .geo:nth-child(1) {
    width: 200px; height: 200px;
    top: 15%; left: 10%;
    animation: geoDrift1 25s ease-in-out infinite;
}
.geo-field .geo:nth-child(2) {
    width: 160px; height: 100px;
    top: 60%; right: 15%;
    animation: geoDrift2 30s ease-in-out infinite;
}
.geo-field .geo:nth-child(3) {
    width: 120px; height: 120px;
    top: 30%; right: 25%;
    animation: geoDrift3 22s ease-in-out infinite;
}
.geo-field .geo:nth-child(4) {
    top: 65%; left: 30%;
    animation: geoDrift4 28s ease-in-out infinite;
}
.geo-field .geo:nth-child(5) {
    width: 80px; height: 50px;
    top: 20%; right: 8%;
    animation: geoDrift1 35s ease-in-out infinite reverse;
}
.geo-field .geo:nth-child(6) {
    width: 60px; height: 60px;
    bottom: 20%; left: 20%;
    animation: geoDrift2 20s ease-in-out infinite reverse;
}

@keyframes geoDrift1 {
    0%, 100% { transform: translate(0, 0) rotate(0deg); }
    25% { transform: translate(30px, -20px) rotate(5deg); }
    50% { transform: translate(-20px, 30px) rotate(-3deg); }
    75% { transform: translate(15px, 15px) rotate(2deg); }
}
@keyframes geoDrift2 {
    0%, 100% { transform: translate(0, 0) rotate(0deg); }
    33% { transform: translate(-25px, 20px) rotate(-4deg); }
    66% { transform: translate(20px, -15px) rotate(3deg); }
}
@keyframes geoDrift3 {
    0%, 100% { transform: translate(0, 0) rotate(0deg); }
    50% { transform: translate(25px, 25px) rotate(6deg); }
}
@keyframes geoDrift4 {
    0%, 100% { transform: translate(0, 0) rotate(0deg); }
    33% { transform: translate(15px, -30px) rotate(-5deg); }
    66% { transform: translate(-20px, 10px) rotate(4deg); }
}

.overture-content {
    position: relative;
    z-index: 1;
    text-align: center;
}
.overture-title {
    font-family: 'Playfair Display', serif;
    font-weight: 700;
    font-size: clamp(3rem, 8vw, 7rem);
    letter-spacing: -0.02em;
    line-height: 1.05;
    color: var(--plum-ink);
    margin-bottom: 1.5rem;
}
.overture-subtitle {
    font-family: 'Space Mono', monospace;
    font-weight: 400;
    font-size: 0.75rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--dusty-mauve);
    margin-bottom: 3rem;
}
.overture-chevron {
    animation: chevronPulse 3s ease-in-out infinite;
}
@keyframes chevronPulse {
    0%, 100% { transform: translateY(0) scale(1); opacity: 0.5; }
    50% { transform: translateY(6px) scale(1.05); opacity: 1; }
}

/* --- Editorial Grid --- */
.editorial-grid {
    max-width: 1120px;
    margin: 0 auto;
    display: grid;
    gap: 40px;
    position: relative;
}
.editorial-grid--two-third {
    grid-template-columns: 4fr 2fr;
}
.editorial-grid--one-third {
    grid-template-columns: 2fr 4fr;
}

.editorial-primary {
    position: relative;
}
.editorial-sidebar {
    position: relative;
}

/* Column rule */
.column-rule {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 1px;
    background: var(--dusty-mauve);
    opacity: 0.2;
}
.editorial-grid--two-third .column-rule {
    right: calc(33.333% + 20px);
}
.column-rule--left {
    left: calc(33.333% + 20px);
    right: auto;
}

/* --- Typography --- */
.section-number {
    font-family: 'Space Mono', monospace;
    font-weight: 400;
    font-size: 0.75rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--dusty-mauve);
    display: block;
    margin-bottom: 0.5rem;
}
.section-heading {
    font-family: 'Playfair Display', serif;
    font-weight: 700;
    font-size: clamp(2rem, 5vw, 4rem);
    letter-spacing: -0.02em;
    line-height: 1.05;
    color: var(--plum-ink);
    margin-bottom: 2rem;
}
.body-text {
    font-family: 'DM Sans', sans-serif;
    font-weight: 300;
    font-size: clamp(1rem, 1.1vw, 1.15rem);
    line-height: 1.72;
    color: var(--plum-ink);
    margin-bottom: 1.5rem;
}
.body-text--colophon {
    max-width: 480px;
    text-align: center;
    margin-left: auto;
    margin-right: auto;
}

/* --- Pull Quotes --- */
.pull-quote {
    font-family: 'Playfair Display', serif;
    font-style: italic;
    font-weight: 400;
    font-size: clamp(1.4rem, 2.5vw, 2rem);
    line-height: 1.35;
    color: var(--plum-ink);
    padding: 2rem 0;
    margin: 2rem 0;
    position: relative;
    border-left: none;
}
.pull-quote::before,
.pull-quote::after {
    content: '';
    position: absolute;
    background: var(--dusty-mauve);
}
/* Partial rectangle frame: top-left corner */
.pull-quote::before {
    top: 0;
    left: -20px;
    width: 1px;
    height: 40px;
}
.pull-quote::after {
    top: 0;
    left: -20px;
    width: 40px;
    height: 1px;
}
.pull-quote--full {
    text-align: center;
    padding: 3rem 2rem;
    margin: 3rem 0;
}
.pull-quote--full::before {
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 1px;
    top: 0;
}
.pull-quote--full::after {
    display: none;
}

/* --- Sidebar --- */
.sidebar-composition {
    margin-bottom: 2rem;
}
.composition {
    width: 100%;
    aspect-ratio: 3 / 4;
    position: relative;
    border-radius: 4px;
    overflow: hidden;
}
.composition__texture {
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, var(--powder-blush), var(--cream-silk));
    filter: blur(0px) saturate(0.6) brightness(1.1);
}
.composition__texture--alt {
    background: linear-gradient(135deg, var(--soft-lilac), var(--powder-blush));
}
.composition__shape {
    position: absolute;
    opacity: 0.5;
}
.composition__shape--circle {
    width: 60%;
    height: 60%;
    border-radius: 50%;
    background: var(--faded-rose);
    top: 15%;
    left: 25%;
}
.composition__shape--rect {
    width: 50%;
    height: 35%;
    border-radius: 4px;
    background: var(--muted-teal);
    bottom: 10%;
    left: 10%;
}
.composition__shape--teal {
    background: var(--muted-teal);
    width: 55%;
    height: 40%;
    top: 10%;
    right: 10%;
    left: auto;
}
.composition__shape--peach {
    background: var(--warm-peach);
    width: 50%;
    height: 50%;
    bottom: 15%;
    left: 20%;
    top: auto;
}
.composition__grid {
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(to right, rgba(196, 167, 181, 0.1) 1px, transparent 1px),
        linear-gradient(to bottom, rgba(196, 167, 181, 0.1) 1px, transparent 1px);
    background-size: 30px 30px;
}

.figure-caption {
    font-family: 'Space Mono', monospace;
    font-weight: 400;
    font-size: 0.75rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--dusty-mauve);
    display: block;
    margin-top: 0.75rem;
}

.sidebar-meta {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 0.4rem 1rem;
    border-top: 1px solid rgba(196, 167, 181, 0.3);
    padding-top: 1rem;
}
.meta-label {
    font-family: 'Space Mono', monospace;
    font-weight: 400;
    font-size: 0.7rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--dusty-mauve);
}
.meta-value {
    font-family: 'DM Sans', sans-serif;
    font-weight: 400;
    font-size: 0.85rem;
    color: var(--plum-ink);
}

/* --- Interlude Spread --- */
.interlude-spread {
    position: relative;
    width: 100%;
    height: 100vh;
    overflow: hidden;
}
.spread-layer {
    position: absolute;
    inset: 0;
}
.spread-layer--texture {
    background: linear-gradient(135deg, var(--powder-blush) 0%, var(--soft-lilac) 50%, var(--cream-silk) 100%);
    filter: blur(0px) saturate(0.6) brightness(1.05);
}
.spread-layer--geo {
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1;
}
.spread-svg {
    width: 100%;
    height: 100%;
}
.spread-layer--grid {
    background-image:
        linear-gradient(to right, rgba(196, 167, 181, 0.08) 1px, transparent 1px),
        linear-gradient(to bottom, rgba(196, 167, 181, 0.08) 1px, transparent 1px);
    background-size: 80px 80px;
    z-index: 2;
}
.spread-caption {
    position: absolute;
    bottom: clamp(1.5rem, 3vw, 3rem);
    right: clamp(1.5rem, 3vw, 3rem);
    font-family: 'Space Mono', monospace;
    font-weight: 400;
    font-size: 0.75rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--dusty-mauve);
    z-index: 3;
}

/* Draw-line animation */
.draw-line {
    stroke-dasharray: 1200;
    stroke-dashoffset: 1200;
    transition: stroke-dashoffset 1.5s ease-in-out;
}
.draw-line--v {
    stroke-dasharray: 600;
    stroke-dashoffset: 600;
}
.act-interlude.in-view .draw-line {
    stroke-dashoffset: 0;
}

/* --- Gallery --- */
.gallery-header {
    max-width: 1120px;
    margin: 0 auto 3rem;
    text-align: center;
}
.gallery-grid {
    max-width: 1120px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: clamp(1rem, 2vw, 1.5rem);
}
.gallery-card {
    background: var(--cream-silk);
    border: 1px solid var(--dusty-mauve);
    border-radius: 8px;
    padding: clamp(1.5rem, 2vw, 2rem);
    transition: border-color 400ms ease-in-out, box-shadow 400ms ease-in-out;
    box-shadow: 0 2px 12px rgba(59, 44, 61, 0.06);
}
.gallery-card:nth-child(2),
.gallery-card:nth-child(4),
.gallery-card:nth-child(6) {
    transform: translateY(20px);
}
.gallery-card:hover {
    border-color: var(--faded-rose);
    box-shadow: 0 4px 20px rgba(59, 44, 61, 0.1);
}
.gallery-card__icon {
    width: 48px;
    height: 48px;
    margin-bottom: 1rem;
}
.gallery-card__icon svg {
    width: 100%;
    height: 100%;
}
.icon-anim {
    transition: transform 600ms ease-in-out, opacity 600ms ease-in-out;
    transform-origin: center;
}
.gallery-card:hover .icon-anim {
    transform: scale(1.3);
    opacity: 0.9;
}
.gallery-card__title {
    font-family: 'Playfair Display', serif;
    font-weight: 700;
    font-size: clamp(1.1rem, 1.5vw, 1.3rem);
    letter-spacing: -0.01em;
    color: var(--plum-ink);
    margin-bottom: 0.5rem;
}
.gallery-card__desc {
    font-family: 'DM Sans', sans-serif;
    font-weight: 300;
    font-size: clamp(0.85rem, 1vw, 0.95rem);
    line-height: 1.6;
    color: var(--plum-ink);
    opacity: 0.75;
}

/* --- Colophon --- */
.colophon-content {
    position: relative;
    z-index: 1;
    text-align: center;
}
.colophon-swash {
    width: 200px;
    height: 40px;
    margin: 2rem auto;
    display: block;
}
.swash-path {
    stroke-dasharray: 300;
    stroke-dashoffset: 300;
    transition: stroke-dashoffset 2s ease-in-out;
}
.act-colophon.in-view .swash-path {
    stroke-dashoffset: 0;
}
.colophon-sign-off {
    font-family: 'Space Mono', monospace;
    font-weight: 400;
    font-size: 0.75rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--dusty-mauve);
    margin-top: 1rem;
}

/* --- Fade Animation System --- */
[data-fade] {
    opacity: 0;
    transform: translateY(12px);
    transition: opacity 800ms ease-in-out, transform 800ms ease-in-out;
}
[data-fade].visible {
    opacity: 1;
    transform: translateY(0);
}

/* --- Link Styles --- */
a {
    color: var(--plum-ink);
    text-decoration: none;
    background-image: linear-gradient(var(--faded-rose), var(--faded-rose));
    background-size: 0% 1px;
    background-position: 0 100%;
    background-repeat: no-repeat;
    transition: background-size 400ms ease-in-out, color 400ms ease-in-out;
}
a:hover {
    color: var(--faded-rose);
    background-size: 100% 1px;
}

/* ============================
   RESPONSIVE
   ============================ */
@media (max-width: 900px) {
    .editorial-grid--two-third,
    .editorial-grid--one-third {
        grid-template-columns: 1fr;
    }
    .editorial-sidebar--left {
        order: -1;
    }
    .column-rule {
        display: none;
    }
    .gallery-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .gallery-card:nth-child(2),
    .gallery-card:nth-child(4),
    .gallery-card:nth-child(6) {
        transform: translateY(0);
    }
}
@media (max-width: 600px) {
    .gallery-grid {
        grid-template-columns: 1fr;
    }
    .overture-title {
        font-size: clamp(2.5rem, 12vw, 4rem);
    }
}
