/* ============================================================
   parallel.day — Styles
   Surreal architectural duality, split-screen narrative
   ============================================================ */

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

html {
    scroll-behavior: smooth;
    overflow-x: hidden;
}

body {
    font-family: 'Commissioner', sans-serif;
    font-weight: 300;
    font-size: clamp(0.95rem, 1.2vw, 1.15rem);
    line-height: 1.75;
    color: #3A3650;
    background: #E8DFF5;
    overflow-x: hidden;
    position: relative;
}

/* ----- Central Dividing Line ----- */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 50%;
    width: 1px;
    height: 100vh;
    background: #C9B8DB;
    z-index: 100;
    transform: translateX(-50%);
    animation: breatheLine 4s ease-in-out infinite;
    pointer-events: none;
}

body.hide-divider::before {
    opacity: 0 !important;
    transition: opacity 1.5s ease;
}

body.intro-active::before {
    opacity: 0;
}

body.divider-thick::before {
    width: 3px;
    animation: breatheLine 4s ease-in-out infinite, oscillateLine 3s ease-in-out infinite;
}

body.divider-fast::before {
    animation: breatheLine 1.5s ease-in-out infinite;
}

@keyframes breatheLine {
    0%, 100% { opacity: 0.3; }
    50% { opacity: 1; }
}

@keyframes oscillateLine {
    0%, 100% { transform: translateX(-50%); }
    25% { transform: translateX(calc(-50% + 8px)); }
    75% { transform: translateX(calc(-50% - 8px)); }
}

/* ----- Sections / Acts ----- */
.act {
    min-height: 120vh;
    position: relative;
    overflow: hidden;
}

/* ----- Split Grid ----- */
.split-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: clamp(1px, 0.2vw, 4px);
    width: 100%;
}

.half {
    padding: clamp(2rem, 5vw, 6rem);
}

.half-left {
    background: #FDF6EC;
}

.half-right {
    background: #EBF0F7;
}

.content-block {
    margin-bottom: clamp(4rem, 8vh, 10rem);
}

.decoration-row .half {
    padding-top: 0;
    padding-bottom: clamp(2rem, 4vh, 4rem);
}

/* ----- Act 5 Swap: warm on right, cool on left ----- */
.swapped .swapped-left {
    background: #EBF0F7;
}

.swapped .swapped-right {
    background: #FDF6EC;
}

/* ----- Act 6 Converging ----- */
.converging .half-left,
.converging .half-right {
    background: #E8DFF5;
    transition: background 2s ease;
}

/* ----- Typography ----- */
.font-left {
    font-family: 'Commissioner', sans-serif;
    font-weight: 300;
}

.act-title-left {
    font-family: 'Playfair Display', serif;
    font-weight: 700;
    font-size: clamp(2.5rem, 6vw, 7rem);
    letter-spacing: -0.02em;
    line-height: 1.15;
    color: #3A3650;
    margin-bottom: clamp(2rem, 4vh, 4rem);
}

.font-right {
    font-family: 'Commissioner', sans-serif;
    font-weight: 300;
}

.act-title-right {
    font-family: 'Commissioner', sans-serif;
    font-weight: 600;
    font-size: clamp(2.5rem, 6vw, 7rem);
    letter-spacing: 0.01em;
    line-height: 1.2;
    color: #3A3650;
    margin-bottom: clamp(2rem, 4vh, 4rem);
}

.act-number {
    display: block;
    font-size: clamp(1.1rem, 1.8vw, 1.5rem);
    margin-bottom: 0.5rem;
}

.accent-left {
    color: #D4956A;
}

.accent-right {
    color: #6A8FD4;
}

.act-title-converge {
    font-family: 'Commissioner', sans-serif;
    font-weight: 500;
    font-size: clamp(2.5rem, 6vw, 7rem);
    letter-spacing: 0.01em;
    line-height: 1.2;
    color: #3A3650;
    margin-bottom: clamp(2rem, 4vh, 4rem);
}

.accent-converge {
    color: #C9B8DB;
}

.font-converge {
    font-family: 'Commissioner', sans-serif;
    font-weight: 400;
}

.font-merge {
    font-family: 'Commissioner', sans-serif;
    font-weight: 400;
    font-size: clamp(1rem, 1.3vw, 1.2rem);
    line-height: 1.75;
}

.body-text em {
    font-style: italic;
    color: #C9B8DB;
}

/* ----- Act 1 Intro ----- */
.act-1 {
    background: #E8DFF5;
}

.act-intro {
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.domain-title {
    font-family: 'Playfair Display', serif;
    font-weight: 700;
    font-size: clamp(4rem, 10vw, 10rem);
    color: #3A3650;
    position: absolute;
    transition: all 1.5s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    white-space: nowrap;
}

.domain-title-left,
.domain-title-right {
    opacity: 0;
    pointer-events: none;
}

.domain-title-left {
    font-family: 'Playfair Display', serif;
    color: #D4956A;
}

.domain-title-right {
    font-family: 'Commissioner', sans-serif;
    font-weight: 600;
    color: #6A8FD4;
}

/* States managed by JS */
.act-intro.splitting .domain-title:not(.domain-title-left):not(.domain-title-right) {
    opacity: 0;
}

.act-intro.splitting .domain-title-left {
    opacity: 1;
    transform: translateX(-25vw);
}

.act-intro.splitting .domain-title-right {
    opacity: 1;
    transform: translateX(25vw);
}

/* ----- Act SVG Illustrations ----- */
.act-svg {
    width: 100%;
    padding: clamp(1rem, 3vw, 3rem) 0;
}

.act-svg-full {
    background: linear-gradient(to right, #FDF6EC 50%, #EBF0F7 50%);
}

.act-1 .act-svg-full {
    background: linear-gradient(to right, #FDF6EC 50%, #EBF0F7 50%);
}

.act-5 .act-svg-full {
    background: linear-gradient(to right, #EBF0F7 50%, #FDF6EC 50%);
}

.act-6 .act-svg-full {
    background: #E8DFF5;
}

.illustration {
    width: 100%;
    height: auto;
    display: block;
    max-height: 300px;
}

/* ----- Line Decorations ----- */
.line-decoration {
    width: 100%;
    height: 40px;
    display: block;
}

.line-decoration path {
    stroke-dasharray: 1500;
    stroke-dashoffset: 1500;
    transition: stroke-dashoffset 1.2s ease-out;
}

.line-decoration.animate-in path {
    stroke-dashoffset: 0;
}

.line-angle path {
    transition-duration: 0.8s;
}

/* ----- Window Elements (Act 2) ----- */
.window-element {
    margin: clamp(2rem, 4vh, 4rem) 0;
}

.window-frame {
    width: 100%;
    max-width: 300px;
    height: 200px;
    border: 2px solid #C9B8DB;
    position: relative;
    overflow: hidden;
}

.window-gradient {
    width: 100%;
    height: 100%;
}

.gradient-sunrise {
    background: linear-gradient(180deg, #FDF6EC 0%, #D4956A 100%);
}

.gradient-moonrise {
    background: linear-gradient(180deg, #EBF0F7 0%, #2E2A3B 100%);
}

.window-left .window-frame {
    margin-left: auto;
    margin-right: auto;
}

.window-right .window-frame {
    margin-left: auto;
    margin-right: auto;
}

/* ----- Fold Points ----- */
.fold-point {
    height: 20vh;
    background: #F5EDDA;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    perspective: 1200px;
    overflow: hidden;
}

.fold-reveal {
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transform: perspective(1200px) rotateX(15deg);
    transition: opacity 0.8s ease, transform 0.8s ease;
}

.fold-point.fold-active .fold-reveal {
    opacity: 1;
    transform: perspective(1200px) rotateX(0deg);
}

/* ----- Mirrored Glyph ----- */
.mirrored-glyph {
    animation: slowSpin 60s linear infinite;
}

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

.mirrored-glyph-final {
    animation: slowSpin 60s linear infinite;
}

/* ----- Merge Section (Act 4) ----- */
.merge-section {
    background: #E8DFF5;
    padding: clamp(4rem, 8vh, 10rem) clamp(2rem, 10vw, 16rem);
    text-align: center;
    min-height: 80vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.merge-content {
    max-width: 700px;
    margin: 0 auto;
}

.merge-content .body-text {
    margin-bottom: clamp(2rem, 4vh, 4rem);
}

/* ----- Final Section (Act 6) ----- */
.final-section {
    background: #E8DFF5;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: clamp(2rem, 5vw, 6rem);
}

.final-text {
    font-family: 'Playfair Display', serif;
    font-weight: 700;
    font-size: clamp(2rem, 5vw, 5rem);
    color: #3A3650;
    line-height: 1.2;
    margin-bottom: clamp(3rem, 6vh, 6rem);
    max-width: 900px;
}

.final-glyph {
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ----- Floating Particles ----- */
#particles {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 50;
    overflow: hidden;
}

.particle {
    position: absolute;
    border-radius: 50%;
    opacity: 0.15;
}

.particle-left {
    background: #D4956A;
}

.particle-right {
    background: #6A8FD4;
}

.p1 {
    width: 6px; height: 6px;
    top: 10%;
    left: 15%;
    animation: driftA 28s linear infinite;
}

.p2 {
    width: 4px; height: 4px;
    top: 30%;
    left: 25%;
    animation: driftB 35s linear infinite;
    animation-delay: -5s;
}

.p3 {
    width: 8px; height: 8px;
    top: 55%;
    left: 10%;
    animation: driftC 22s linear infinite;
    animation-delay: -10s;
}

.p4 {
    width: 5px; height: 5px;
    top: 75%;
    left: 35%;
    animation: driftD 32s linear infinite;
    animation-delay: -3s;
}

.p5 {
    width: 7px; height: 7px;
    top: 20%;
    left: 40%;
    animation: driftE 26s linear infinite;
    animation-delay: -15s;
}

.p6 {
    width: 4px; height: 4px;
    top: 85%;
    left: 20%;
    animation: driftF 40s linear infinite;
    animation-delay: -8s;
}

.p7 {
    width: 5px; height: 5px;
    top: 15%;
    left: 65%;
    animation: driftG 30s linear infinite;
    animation-delay: -2s;
}

.p8 {
    width: 7px; height: 7px;
    top: 40%;
    left: 75%;
    animation: driftH 24s linear infinite;
    animation-delay: -12s;
}

.p9 {
    width: 4px; height: 4px;
    top: 60%;
    left: 85%;
    animation: driftI 36s linear infinite;
    animation-delay: -7s;
}

.p10 {
    width: 6px; height: 6px;
    top: 80%;
    left: 70%;
    animation: driftJ 28s linear infinite;
    animation-delay: -20s;
}

.p11 {
    width: 8px; height: 8px;
    top: 25%;
    left: 55%;
    animation: driftK 33s linear infinite;
    animation-delay: -4s;
}

.p12 {
    width: 5px; height: 5px;
    top: 90%;
    left: 60%;
    animation: driftL 38s linear infinite;
    animation-delay: -16s;
}

/* Particle drift keyframes - each travels a unique path */
@keyframes driftA {
    0% { transform: translate(0, 0); }
    25% { transform: translate(20vw, -10vh); }
    50% { transform: translate(40vw, 5vh); }
    75% { transform: translate(15vw, -8vh); }
    100% { transform: translate(0, 0); }
}

@keyframes driftB {
    0% { transform: translate(0, 0); }
    25% { transform: translate(-10vw, 15vh); }
    50% { transform: translate(25vw, 8vh); }
    75% { transform: translate(10vw, -12vh); }
    100% { transform: translate(0, 0); }
}

@keyframes driftC {
    0% { transform: translate(0, 0); }
    25% { transform: translate(30vw, -5vh); }
    50% { transform: translate(15vw, -20vh); }
    75% { transform: translate(35vw, -10vh); }
    100% { transform: translate(0, 0); }
}

@keyframes driftD {
    0% { transform: translate(0, 0); }
    25% { transform: translate(-15vw, -10vh); }
    50% { transform: translate(20vw, -15vh); }
    75% { transform: translate(5vw, 10vh); }
    100% { transform: translate(0, 0); }
}

@keyframes driftE {
    0% { transform: translate(0, 0); }
    25% { transform: translate(10vw, 20vh); }
    50% { transform: translate(-5vw, 10vh); }
    75% { transform: translate(20vw, 5vh); }
    100% { transform: translate(0, 0); }
}

@keyframes driftF {
    0% { transform: translate(0, 0); }
    25% { transform: translate(25vw, -15vh); }
    50% { transform: translate(10vw, -25vh); }
    75% { transform: translate(30vw, -5vh); }
    100% { transform: translate(0, 0); }
}

@keyframes driftG {
    0% { transform: translate(0, 0); }
    25% { transform: translate(-20vw, 10vh); }
    50% { transform: translate(-30vw, -5vh); }
    75% { transform: translate(-10vw, 15vh); }
    100% { transform: translate(0, 0); }
}

@keyframes driftH {
    0% { transform: translate(0, 0); }
    25% { transform: translate(-15vw, -15vh); }
    50% { transform: translate(-25vw, 10vh); }
    75% { transform: translate(-5vw, -8vh); }
    100% { transform: translate(0, 0); }
}

@keyframes driftI {
    0% { transform: translate(0, 0); }
    25% { transform: translate(-10vw, 20vh); }
    50% { transform: translate(-35vw, 5vh); }
    75% { transform: translate(-20vw, -10vh); }
    100% { transform: translate(0, 0); }
}

@keyframes driftJ {
    0% { transform: translate(0, 0); }
    25% { transform: translate(-25vw, -8vh); }
    50% { transform: translate(-10vw, -20vh); }
    75% { transform: translate(-30vw, 5vh); }
    100% { transform: translate(0, 0); }
}

@keyframes driftK {
    0% { transform: translate(0, 0); }
    25% { transform: translate(-20vw, 12vh); }
    50% { transform: translate(-40vw, -3vh); }
    75% { transform: translate(-15vw, 8vh); }
    100% { transform: translate(0, 0); }
}

@keyframes driftL {
    0% { transform: translate(0, 0); }
    25% { transform: translate(-5vw, -18vh); }
    50% { transform: translate(-20vw, -8vh); }
    75% { transform: translate(-30vw, -15vh); }
    100% { transform: translate(0, 0); }
}

/* ----- Navigation Arrows ----- */
#nav-arrows {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 1rem;
    z-index: 200;
}

.nav-arrow {
    width: 40px;
    height: 40px;
    border: 1px solid #C9B8DB;
    background: rgba(232, 223, 245, 0.8);
    backdrop-filter: blur(4px);
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.3s ease, border-color 0.3s ease;
    color: #3A3650;
}

.nav-arrow:hover {
    background: rgba(201, 184, 219, 0.4);
    border-color: #3A3650;
}

.nav-arrow-left svg {
    transform: rotate(15deg);
}

.nav-arrow-right svg {
    transform: rotate(-15deg);
}

/* ----- Reveal Animations ----- */
.reveal-block {
    opacity: 0;
    transform: translateX(0);
    transition: opacity 0.8s ease, transform 0.8s ease;
}

.reveal-block[data-side="left"] {
    transform: translateX(-40px);
}

.reveal-block[data-side="right"] {
    transform: translateX(40px);
}

.reveal-block.visible {
    opacity: 1;
    transform: translateX(0);
}

/* Echo blocks (Act 3) */
.echo-block {
    opacity: 0;
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.echo-left {
    transform: translateX(-30px);
}

.echo-right {
    transform: translateX(30px);
}

.echo-block.visible {
    opacity: 1;
    transform: translateX(0);
}

/* ----- Responsive ----- */
@media (max-width: 768px) {
    .split-grid {
        grid-template-columns: 1fr;
    }

    .half {
        padding: clamp(1.5rem, 4vw, 3rem);
    }

    body::before {
        display: none;
    }

    #nav-arrows {
        bottom: 1rem;
    }

    .act-intro.splitting .domain-title-left {
        transform: translateX(0) translateY(-2rem);
    }

    .act-intro.splitting .domain-title-right {
        transform: translateX(0) translateY(2rem);
    }

    .domain-title {
        font-size: clamp(2.5rem, 8vw, 5rem);
    }

    .final-text {
        font-size: clamp(1.5rem, 5vw, 3rem);
    }

    .merge-section {
        padding: clamp(2rem, 6vw, 4rem) clamp(1.5rem, 4vw, 3rem);
    }
}

/* ----- Reduced Motion ----- */
@media (prefers-reduced-motion: reduce) {
    body::before {
        animation: none;
        opacity: 0.6;
    }

    .particle {
        animation: none !important;
    }

    .mirrored-glyph {
        animation: none !important;
    }

    .reveal-block,
    .echo-block {
        opacity: 1;
        transform: none;
        transition: none;
    }

    .fold-reveal {
        opacity: 1;
        transform: none;
        transition: none;
    }

    .line-decoration path {
        stroke-dasharray: none;
        stroke-dashoffset: 0;
        transition: none;
    }

    .domain-title {
        transition: none;
    }
}
