/* ============================================
   a6c.boo — Surreal Dreamscape
   ============================================ */

:root {
    --void: #0B0B2B;
    --ether: #2A1B4E;
    --phantom: #C8C0D8;
    --pulse: #9B6DFF;
    --breath: #A8F0D4;
    --bone: #E8E4F0;
    --wound: #8B3A5E;
    --ember: #D4A843;
    --muted: #7B6FA0;

    --cursor-x: 50%;
    --cursor-y: 50%;
}

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

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

body {
    background: var(--void);
    color: var(--phantom);
    font-family: 'Nunito Sans', sans-serif;
    font-weight: 300;
    line-height: 1.75;
    overflow-x: hidden;
    cursor: none;
}

/* ---- Typography ---- */
h1, h2, h3 {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 300;
    letter-spacing: 0.12em;
    line-height: 1.1;
    text-transform: lowercase;
    color: var(--bone);
}

h2 {
    font-size: clamp(2rem, 4vw, 3.5rem);
    margin-bottom: 1rem;
}

p {
    margin-bottom: 1em;
}

.card-label {
    font-family: 'Silkscreen', cursive;
    font-size: 0.7rem;
    font-weight: 400;
    letter-spacing: 0.2em;
    color: var(--muted);
    text-transform: uppercase;
    display: block;
    margin-bottom: 0.75rem;
}

/* ---- Cursor Glow ---- */
#cursor-glow {
    position: fixed;
    top: 0;
    left: 0;
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(155, 109, 255, 0.12) 0%, transparent 70%);
    pointer-events: none;
    z-index: 9999;
    transform: translate(-50%, -50%);
    will-change: transform;
    mix-blend-mode: screen;
}

/* ---- Ghost Cursors ---- */
.ghost-cursor {
    position: fixed;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: radial-gradient(circle, var(--pulse) 0%, transparent 70%);
    pointer-events: none;
    z-index: 9998;
    will-change: transform;
}

#ghost-1 {
    opacity: 0.08;
    animation: ghostDrift1 45s linear infinite;
}
#ghost-2 {
    opacity: 0.12;
    animation: ghostDrift2 38s linear infinite;
}
#ghost-3 {
    opacity: 0.06;
    animation: ghostDrift3 52s linear infinite;
}
#ghost-4 {
    opacity: 0.10;
    animation: ghostDrift4 41s linear infinite;
}
#ghost-5 {
    opacity: 0.07;
    animation: ghostDrift5 60s linear infinite;
}
#ghost-6 {
    opacity: 0.09;
    animation: ghostDrift6 35s linear infinite;
}
#ghost-7 {
    opacity: 0.05;
    animation: ghostDrift7 55s linear infinite;
}

@keyframes ghostDrift1 {
    0%   { transform: translate(10vw, 5vh); }
    15%  { transform: translate(70vw, 25vh); }
    35%  { transform: translate(30vw, 60vh); }
    55%  { transform: translate(80vw, 80vh); }
    75%  { transform: translate(20vw, 40vh); }
    100% { transform: translate(10vw, 5vh); }
}
@keyframes ghostDrift2 {
    0%   { transform: translate(85vw, 90vh); }
    20%  { transform: translate(40vw, 50vh); }
    40%  { transform: translate(60vw, 15vh); }
    60%  { transform: translate(15vw, 70vh); }
    80%  { transform: translate(75vw, 35vh); }
    100% { transform: translate(85vw, 90vh); }
}
@keyframes ghostDrift3 {
    0%   { transform: translate(50vw, 10vh); }
    25%  { transform: translate(90vw, 45vh); }
    50%  { transform: translate(20vw, 85vh); }
    75%  { transform: translate(60vw, 30vh); }
    100% { transform: translate(50vw, 10vh); }
}
@keyframes ghostDrift4 {
    0%   { transform: translate(5vw, 50vh); }
    20%  { transform: translate(55vw, 10vh); }
    40%  { transform: translate(90vw, 60vh); }
    60%  { transform: translate(35vw, 90vh); }
    80%  { transform: translate(70vw, 20vh); }
    100% { transform: translate(5vw, 50vh); }
}
@keyframes ghostDrift5 {
    0%   { transform: translate(75vw, 70vh); }
    30%  { transform: translate(10vw, 20vh); }
    60%  { transform: translate(80vw, 50vh); }
    100% { transform: translate(75vw, 70vh); }
}
@keyframes ghostDrift6 {
    0%   { transform: translate(30vw, 80vh); }
    25%  { transform: translate(65vw, 15vh); }
    50%  { transform: translate(15vw, 55vh); }
    75%  { transform: translate(85vw, 75vh); }
    100% { transform: translate(30vw, 80vh); }
}
@keyframes ghostDrift7 {
    0%   { transform: translate(60vw, 30vh); }
    20%  { transform: translate(25vw, 75vh); }
    45%  { transform: translate(80vw, 15vh); }
    70%  { transform: translate(45vw, 90vh); }
    100% { transform: translate(60vw, 30vh); }
}

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

.particle {
    position: absolute;
    opacity: 0.05;
    will-change: transform;
}

.particle-circle {
    border-radius: 50%;
    background: var(--phantom);
}

.particle-line {
    height: 1px;
    background: var(--pulse);
    transform-origin: center;
}

.particle-rect {
    border: 1px solid var(--phantom);
    background: transparent;
}

/* ---- Typographic Apparitions ---- */
.apparition {
    position: fixed;
    font-family: 'Cormorant Garamond', serif;
    font-weight: 300;
    color: var(--bone);
    pointer-events: none;
    z-index: 0;
    white-space: nowrap;
}

.apparition-1 {
    font-size: 12vw;
    opacity: 0.025;
    top: 15vh;
    left: 5vw;
    animation: apparitionFloat1 220s linear infinite;
}
.apparition-2 {
    font-size: 18vw;
    opacity: 0.02;
    top: 35vh;
    right: -5vw;
    animation: apparitionFloat2 280s linear infinite;
}
.apparition-3 {
    font-size: 10vw;
    opacity: 0.03;
    top: 55vh;
    left: 20vw;
    animation: apparitionFloat3 200s linear infinite;
}
.apparition-4 {
    font-size: 15vw;
    opacity: 0.025;
    top: 70vh;
    right: 10vw;
    animation: apparitionFloat4 260s linear infinite;
}
.apparition-5 {
    font-size: 8vw;
    opacity: 0.03;
    top: 85vh;
    left: 40vw;
    animation: apparitionFloat5 240s linear infinite;
}
.apparition-6 {
    font-size: 14vw;
    opacity: 0.02;
    top: 45vh;
    left: -5vw;
    animation: apparitionFloat6 300s linear infinite;
}

@keyframes apparitionFloat1 {
    0%   { transform: rotate(0deg) translateY(0); }
    50%  { transform: rotate(180deg) translateY(-30vh); }
    100% { transform: rotate(360deg) translateY(0); }
}
@keyframes apparitionFloat2 {
    0%   { transform: rotate(0deg) translateY(0); }
    50%  { transform: rotate(-180deg) translateY(20vh); }
    100% { transform: rotate(-360deg) translateY(0); }
}
@keyframes apparitionFloat3 {
    0%   { transform: rotate(0deg) translateY(0); }
    50%  { transform: rotate(180deg) translateY(-25vh); }
    100% { transform: rotate(360deg) translateY(0); }
}
@keyframes apparitionFloat4 {
    0%   { transform: rotate(0deg) translateY(0); }
    50%  { transform: rotate(-180deg) translateY(15vh); }
    100% { transform: rotate(-360deg) translateY(0); }
}
@keyframes apparitionFloat5 {
    0%   { transform: rotate(0deg) translateY(0); }
    50%  { transform: rotate(180deg) translateY(-20vh); }
    100% { transform: rotate(360deg) translateY(0); }
}
@keyframes apparitionFloat6 {
    0%   { transform: rotate(0deg) translateY(0); }
    50%  { transform: rotate(180deg) translateY(25vh); }
    100% { transform: rotate(360deg) translateY(0); }
}

/* ---- Chambers (common) ---- */
.chamber {
    position: relative;
    min-height: 100vh;
    overflow: hidden;
}

.chamber-bg {
    position: absolute;
    top: -10%;
    left: -10%;
    width: 120%;
    height: 120%;
    z-index: 0;
    pointer-events: none;
}

/* ---- Phase-Shift Lines ---- */
.phase-shift-line {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 20px;
    z-index: 5;
    overflow: visible;
}

.phase-shift-line svg {
    width: 100%;
    height: 100%;
    display: block;
}

.phase-line-svg {
    stroke-dasharray: 2000;
    stroke-dashoffset: 2000;
    transition: stroke-dashoffset 1.5s ease;
}

.phase-line-svg.drawn {
    stroke-dashoffset: 0;
}

/* Phase-shift chromatic band */
.chamber::after {
    content: '';
    position: absolute;
    bottom: -10px;
    left: 0;
    width: 100%;
    height: 20px;
    z-index: 4;
    backdrop-filter: hue-rotate(30deg) saturate(1.5);
    -webkit-backdrop-filter: hue-rotate(30deg) saturate(1.5);
    pointer-events: none;
}

/* ---- Chamber 1: The Threshold ---- */
.chamber-1 {
    background: var(--void);
    display: flex;
    clip-path: polygon(0 0, 100% 0, 100% 92%, 0 100%);
    z-index: 10;
}

.chamber-1-bg {
    background:
        radial-gradient(ellipse at 20% 50%, rgba(42, 27, 78, 0.4) 0%, transparent 60%),
        radial-gradient(ellipse at 80% 30%, rgba(155, 109, 255, 0.08) 0%, transparent 50%),
        radial-gradient(ellipse at 50% 80%, rgba(139, 58, 94, 0.06) 0%, transparent 40%);
    animation: nebulaShift1 45s ease-in-out infinite alternate;
}

@keyframes nebulaShift1 {
    0%   { background-position: 0% 0%, 100% 0%, 50% 100%; }
    100% { background-position: 20% 20%, 80% 20%, 30% 80%; }
}

.threshold-left {
    position: relative;
    z-index: 3;
    width: 65%;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    clip-path: polygon(0 0, 100% 0, 75% 100%, 0 100%);
    background: var(--void);
}

.breathing-title {
    font-family: 'Cormorant Garamond', serif;
    font-size: clamp(3rem, 8vw, 7rem);
    letter-spacing: 0.15em;
    color: var(--bone);
    text-shadow:
        0 0 40px rgba(155, 109, 255, 0.15),
        0 2px 8px rgba(0, 0, 0, 0.5);
    animation: breathe 8s ease-in-out infinite;
    text-transform: lowercase;
}

@keyframes breathe {
    0%, 100% { font-weight: 300; opacity: 0.85; }
    50%      { font-weight: 600; opacity: 1; }
}

.threshold-right {
    position: relative;
    z-index: 3;
    width: 35%;
    min-height: 100vh;
    display: flex;
    align-items: center;
    padding: 2rem 3rem 2rem 5rem;
    background: linear-gradient(135deg, var(--bone) 0%, transparent 80%);
    clip-path: polygon(25% 0, 100% 0, 100% 100%, 0 100%);
    margin-left: -10%;
}

.intro-text {
    font-size: clamp(0.9rem, 1.2vw, 1.1rem);
    color: var(--void);
    font-weight: 300;
    line-height: 1.9;
    max-width: 320px;
    text-shadow: 0 1px 2px rgba(232, 228, 240, 0.3);
}

/* ---- Chamber 2: The Gallery ---- */
.chamber-2 {
    background: var(--ether);
    clip-path: polygon(0 5%, 100% 0, 100% 95%, 0 100%);
    z-index: 9;
    margin-top: -8vh;
    padding: 12vh 5vw 10vh;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 3vw;
    flex-wrap: wrap;
}

.chamber-2-bg {
    background:
        radial-gradient(ellipse at 30% 40%, rgba(155, 109, 255, 0.1) 0%, transparent 50%),
        radial-gradient(ellipse at 70% 60%, rgba(168, 240, 212, 0.05) 0%, transparent 40%),
        conic-gradient(from 180deg at 50% 50%, rgba(42, 27, 78, 0.3) 0%, transparent 30%, rgba(139, 58, 94, 0.05) 50%, transparent 70%);
    animation: nebulaShift2 55s ease-in-out infinite alternate;
}

@keyframes nebulaShift2 {
    0%   { background-position: 0% 50%, 100% 50%, 50% 50%; }
    100% { background-position: 30% 30%, 70% 70%, 60% 40%; }
}

.gallery-card {
    position: relative;
    z-index: 3;
    background: rgba(11, 11, 43, 0.5);
    border: 1px solid rgba(200, 192, 216, 0.08);
    padding: 2.5rem;
    max-width: 340px;
    flex: 1 1 280px;
    box-shadow: 0 0 50px rgba(155, 109, 255, 0.08);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    transition: transform 0.3s ease;
}

.gallery-card h2 {
    font-size: clamp(1.4rem, 2.5vw, 2rem);
}

.gallery-card p {
    font-size: 0.92rem;
    color: var(--phantom);
    line-height: 1.75;
}

.gallery-card-1 {
    transform: rotate(-2deg);
}
.gallery-card-2 {
    transform: rotate(1deg);
    margin-top: 4vh;
}
.gallery-card-3 {
    transform: rotate(-1.5deg);
}

/* ---- Chamber 3: The Corridor ---- */
.chamber-3 {
    background: linear-gradient(180deg, var(--ether) 0%, #1a0f35 100%);
    clip-path: polygon(0 3%, 100% 0, 100% 97%, 0 100%);
    z-index: 8;
    margin-top: -6vh;
    padding: 15vh 0;
    display: flex;
    justify-content: center;
    align-items: center;
}

.chamber-3-bg {
    background:
        radial-gradient(ellipse at 50% 30%, rgba(155, 109, 255, 0.06) 0%, transparent 50%),
        radial-gradient(ellipse at 40% 70%, rgba(42, 27, 78, 0.5) 0%, transparent 60%);
    animation: nebulaShift3 60s ease-in-out infinite alternate;
}

@keyframes nebulaShift3 {
    0%   { background-position: 50% 0%, 40% 100%; }
    100% { background-position: 55% 20%, 45% 80%; }
}

.corridor-content {
    position: relative;
    z-index: 3;
    max-width: 480px;
    padding: 0 2rem;
    display: flex;
}

.corridor-line-pulse {
    flex-shrink: 0;
    width: 2px;
    background: var(--breath);
    margin-right: 2rem;
    animation: linePulse 4s ease-in-out infinite;
    align-self: stretch;
}

@keyframes linePulse {
    0%, 100% { opacity: 0.2; }
    50%      { opacity: 0.5; }
}

.corridor-text h2 {
    font-size: clamp(1.8rem, 3.5vw, 2.8rem);
    margin-bottom: 1.5rem;
}

.corridor-text p {
    font-size: 0.95rem;
    line-height: 1.85;
    margin-bottom: 1.5em;
}

/* ---- Chamber 4: The Mirror ---- */
.chamber-4 {
    background: linear-gradient(180deg, #1a0f35 0%, #110a28 100%);
    clip-path: polygon(0 4%, 100% 0, 100% 96%, 0 100%);
    z-index: 7;
    margin-top: -6vh;
    padding: 15vh 0;
    display: flex;
    justify-content: center;
    align-items: center;
}

.chamber-4-bg {
    background:
        radial-gradient(ellipse at 60% 40%, rgba(139, 58, 94, 0.08) 0%, transparent 50%),
        radial-gradient(ellipse at 30% 70%, rgba(155, 109, 255, 0.06) 0%, transparent 40%),
        conic-gradient(from 90deg at 50% 50%, rgba(42, 27, 78, 0.2) 0%, transparent 25%, rgba(168, 240, 212, 0.03) 50%, transparent 75%);
    animation: nebulaShift4 50s ease-in-out infinite alternate;
}

@keyframes nebulaShift4 {
    0%   { background-position: 0% 0%, 100% 100%, 50% 50%; }
    100% { background-position: 20% 20%, 80% 80%, 60% 40%; }
}

.mirror-content {
    position: relative;
    z-index: 3;
    max-width: 600px;
    padding: 0 2rem;
}

.mirror-original {
    padding: 2.5rem;
    background: rgba(11, 11, 43, 0.4);
    border: 1px solid rgba(200, 192, 216, 0.06);
    box-shadow: 0 0 60px rgba(155, 109, 255, 0.06);
}

.mirror-original h2 {
    font-size: clamp(1.6rem, 3vw, 2.5rem);
}

.mirror-line {
    height: 2px;
    background: linear-gradient(90deg, transparent 0%, var(--pulse) 50%, transparent 100%);
    opacity: 0.6;
    margin: 0;
}

.mirror-reflection {
    padding: 2.5rem;
    background: rgba(11, 11, 43, 0.4);
    border: 1px solid rgba(200, 192, 216, 0.04);
    transform: scaleY(-1);
    opacity: 0.15;
    filter: blur(2px);
    -webkit-filter: blur(2px);
    pointer-events: none;
}

/* ---- Chamber 5: The Dissolution ---- */
.chamber-5 {
    background: var(--void);
    z-index: 6;
    margin-top: -6vh;
    padding: 15vh 0 0;
    min-height: 120vh;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.chamber-5-bg {
    background:
        radial-gradient(ellipse at 50% 20%, rgba(42, 27, 78, 0.2) 0%, transparent 50%);
    animation: nebulaShift5 60s ease-in-out infinite alternate;
}

@keyframes nebulaShift5 {
    0%   { background-position: 50% 0%; }
    100% { background-position: 55% 10%; }
}

.dissolution-timeline {
    position: relative;
    z-index: 3;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3rem;
    padding: 0 2rem;
    max-width: 600px;
    width: 100%;
}

.timeline-entry {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 0.5rem;
}

.timeline-date {
    font-family: 'Silkscreen', cursive;
    font-size: 0.75rem;
    letter-spacing: 0.2em;
    color: var(--breath);
    opacity: 0.6;
}

.timeline-phrase {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 300;
    font-size: clamp(1rem, 2vw, 1.4rem);
    color: var(--phantom);
    letter-spacing: 0.08em;
    line-height: 1.4;
}

.timeline-entry:nth-child(1) .timeline-phrase { opacity: 0.9; }
.timeline-entry:nth-child(2) .timeline-phrase { opacity: 0.8; }
.timeline-entry:nth-child(3) .timeline-phrase { opacity: 0.7; }
.timeline-entry:nth-child(4) .timeline-phrase { opacity: 0.6; }
.timeline-entry:nth-child(5) .timeline-phrase { opacity: 0.5; }
.timeline-entry:nth-child(6) .timeline-phrase { opacity: 0.4; }
.timeline-entry:nth-child(7) .timeline-phrase { opacity: 0.3; }
.timeline-entry:nth-child(8) .timeline-phrase { opacity: 0.2; }
.timeline-entry:nth-child(9) .timeline-phrase { opacity: 0.1; }

.timeline-entry:nth-child(n+5) .timeline-date {
    opacity: 0.3;
}
.timeline-entry:nth-child(n+7) .timeline-date {
    opacity: 0.15;
}
.timeline-entry:nth-child(9) .timeline-date {
    opacity: 0.08;
}

.dissolution-void {
    flex-grow: 1;
    min-height: 30vh;
    width: 100%;
    background: linear-gradient(180deg, transparent 0%, var(--void) 100%);
}

/* ---- Reveal Animation (slide-reveal on scroll) ---- */
.reveal-slide {
    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-slide[data-direction="left"] {
    transform: translateX(-40px);
}

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

.reveal-slide.revealed {
    opacity: 1;
    transform: translateX(0);
}

/* Gallery cards keep their rotation after reveal */
.gallery-card-1.revealed {
    transform: rotate(-2deg) translateX(0);
}
.gallery-card-2.revealed {
    transform: rotate(1deg) translateX(0);
}
.gallery-card-3.revealed {
    transform: rotate(-1.5deg) translateX(0);
}

/* ---- Reduced Motion ---- */
@media (prefers-reduced-motion: reduce) {
    .breathing-title {
        animation: none;
        font-weight: 300;
    }

    .ghost-cursor {
        animation: none;
        display: none;
    }

    .apparition {
        animation: none;
    }

    .particle {
        animation: none !important;
    }

    .chamber-bg {
        animation: none;
    }

    .corridor-line-pulse {
        animation: none;
        opacity: 0.35;
    }

    .reveal-slide {
        opacity: 1;
        transform: none !important;
        transition: none;
    }

    .phase-line-svg {
        stroke-dasharray: none;
        stroke-dashoffset: 0;
    }
}

/* ---- Mobile Adjustments ---- */
@media (max-width: 768px) {
    .chamber-1 {
        flex-direction: column;
        clip-path: polygon(0 0, 100% 0, 100% 95%, 0 100%);
    }

    .threshold-left {
        width: 100%;
        min-height: 60vh;
        clip-path: none;
    }

    .threshold-right {
        width: 100%;
        min-height: 40vh;
        clip-path: none;
        margin-left: 0;
        padding: 2rem;
        background: linear-gradient(180deg, var(--bone) 0%, transparent 90%);
        align-items: flex-start;
    }

    .intro-text {
        max-width: 100%;
    }

    .chamber-2 {
        padding: 10vh 4vw 8vh;
        gap: 2rem;
    }

    .gallery-card {
        max-width: 100%;
    }

    .corridor-content {
        padding: 0 1.5rem;
    }

    .mirror-content {
        padding: 0 1.5rem;
    }
}
