/* === continua.st — Styles === */

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

:root {
    --twilight-void: #0f0a1a;
    --dusky-violet: #1a1028;
    --amber-glow: #d4943a;
    --teal-depth: #1a3d4a;
    --burnished-cream: #e8d5c4;
    --pale-fog: #c8c0b8;
    --faded-rose: #d4a0a0;
    --muted-lavender: #9a8fad;
    --rose-gold: #b8766a;
    --obsidian: #08060e;
}

html, body {
    height: 100%;
    overflow: hidden;
    background: var(--twilight-void);
    color: var(--pale-fog);
    font-family: 'Instrument Serif', serif;
}

/* --- Scan Line Overlay --- */
body::after {
    content: '';
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 9999;
    background: repeating-linear-gradient(
        to bottom,
        transparent,
        transparent 2px,
        rgba(154, 143, 173, 0.04) 2px,
        rgba(154, 143, 173, 0.04) 3px
    );
    animation: scanPulse 6s ease-in-out infinite;
}

@keyframes scanPulse {
    0%, 100% { opacity: 0.3; }
    50% { opacity: 0.7; }
}

/* --- Scroll Container --- */
#scroll-container {
    width: 100%;
    height: 100vh;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x proximity;
    white-space: nowrap;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

#scroll-container::-webkit-scrollbar {
    display: none;
}

/* --- Panels --- */
.panel {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100vw;
    height: 100vh;
    flex-shrink: 0;
    white-space: normal;
    position: relative;
    overflow: hidden;
    scroll-snap-align: start;
}

.panel-content {
    position: relative;
    z-index: 2;
    max-width: 90vw;
    padding: 2rem;
}

/* --- Typography --- */
.display-title {
    font-family: 'Bodoni Moda', serif;
    font-weight: 700;
    font-style: italic;
    font-size: clamp(3rem, 8vw, 7rem);
    letter-spacing: -0.02em;
    color: var(--burnished-cream);
    line-height: 1.1;
    margin-bottom: 1.5rem;
}

.body-meditation {
    font-family: 'Instrument Serif', serif;
    font-weight: 400;
    font-size: clamp(1rem, 1.6vw, 1.25rem);
    line-height: 1.85;
    color: var(--pale-fog);
    max-width: 38ch;
    margin-bottom: 1.2rem;
}

.accent-label {
    font-family: 'Share Tech Mono', monospace;
    font-weight: 400;
    font-size: clamp(0.7rem, 1vw, 0.85rem);
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--muted-lavender);
    opacity: 0.7;
}

/* --- Text Reveal Animation --- */
.text-reveal {
    opacity: 0;
    transform: translateY(20px);
    filter: blur(4px);
    transition: opacity 1.2s ease, transform 1.2s ease, filter 1.2s ease;
}

.text-reveal.visible {
    opacity: 1;
    transform: translateY(0);
    filter: blur(0);
}

/* --- Panel 1: The Threshold --- */
.panel-threshold {
    background: linear-gradient(135deg, var(--obsidian) 0%, var(--twilight-void) 40%, var(--dusky-violet) 100%);
}

.panel-threshold .panel-content {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.panel-threshold .display-title {
    color: var(--faded-rose);
    font-size: clamp(4rem, 10vw, 9rem);
}

.panel-threshold .body-meditation {
    max-width: 32ch;
    text-align: center;
}

.panel-threshold .accent-label {
    margin-top: 3rem;
    animation: fadeInOut 3s ease-in-out infinite;
}

@keyframes fadeInOut {
    0%, 100% { opacity: 0.3; }
    50% { opacity: 0.8; }
}

/* --- Panel 2: Continuity of Perception --- */
.panel-perception {
    background: linear-gradient(to right, var(--twilight-void) 0%, #2a1a18 30%, var(--dusky-violet) 70%, #1a1030 100%);
}

.perception-content {
    display: flex;
    flex-direction: column;
    gap: 6rem;
    max-width: 80vw;
}

.text-upper {
    align-self: flex-start;
    padding-left: 5vw;
}

.text-upper .display-title {
    color: var(--faded-rose);
}

.text-lower {
    align-self: flex-end;
    padding-right: 5vw;
    text-align: right;
}

.text-lower .body-meditation {
    margin-left: auto;
}

/* Drifting Column Fragments */
.column-fragment {
    position: absolute;
    width: 100px;
    height: 250px;
    z-index: 1;
    will-change: transform;
    opacity: 0.15;
}

.fragment-1 {
    top: 10%;
    left: 15%;
}

.fragment-2 {
    top: 55%;
    left: 50%;
}

.fragment-3 {
    top: 20%;
    left: 78%;
}

/* --- Panel 3: The Unbroken Stream --- */
.panel-stream {
    background: linear-gradient(to right, var(--teal-depth) 0%, #0d1f2a 50%, var(--twilight-void) 100%);
}

#flow-river {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
}

.stream-content {
    z-index: 2;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.stream-content .display-title {
    color: var(--burnished-cream);
    text-shadow: 0 0 40px rgba(26, 61, 74, 0.5);
}

/* --- Panel 4: Memory and Persistence --- */
.panel-memory {
    background: linear-gradient(135deg, var(--dusky-violet) 0%, var(--twilight-void) 50%, var(--dusky-violet) 100%);
}

.memory-content {
    width: 85vw;
    max-width: 85vw;
}

.memory-content .display-title {
    text-align: center;
    margin-bottom: 3rem;
    color: var(--faded-rose);
}

.card-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(2, auto);
    gap: 1.5rem;
}

.memory-card {
    background: linear-gradient(135deg, transparent 0%, rgba(26, 16, 40, 0.4) 100%);
    backdrop-filter: blur(12px) saturate(0.8);
    -webkit-backdrop-filter: blur(12px) saturate(0.8);
    border: 1px solid rgba(154, 143, 173, 0.2);
    border-radius: 8px;
    padding: 2rem;
    transition: all 0.6s cubic-bezier(0.23, 1, 0.32, 1);
}

.memory-card .accent-label {
    display: block;
    margin-bottom: 1rem;
}

.memory-card .body-meditation {
    max-width: none;
    font-size: clamp(0.9rem, 1.2vw, 1.1rem);
}

.memory-card.card-near {
    box-shadow: 0 0 20px rgba(212, 148, 58, 0.1);
}

.memory-card.card-far {
    opacity: 0.75;
}

.memory-card:hover {
    border-color: rgba(154, 143, 173, 0.4);
    box-shadow: 0 0 30px rgba(212, 148, 58, 0.15);
    transform: scale(1.02);
}

/* --- Panel 5: The Eternal Return --- */
.panel-return {
    background: linear-gradient(to right, var(--dusky-violet) 0%, var(--rose-gold) 40%, var(--faded-rose) 70%, var(--dusky-violet) 100%);
}

.return-content {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.return-content .display-title {
    color: var(--burnished-cream);
}

.large-type {
    font-size: clamp(4rem, 10vw, 9rem);
}

.sub-display {
    font-size: clamp(1.5rem, 3vw, 2.5rem);
    color: var(--faded-rose);
    margin-top: 2rem;
    max-width: 30ch;
}

/* --- Panel 6: Dissolution --- */
.panel-dissolution {
    background: linear-gradient(135deg, var(--dusky-violet) 0%, var(--twilight-void) 60%, var(--obsidian) 100%);
}

.dissolution-content {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.dissolution-content .display-title {
    color: var(--faded-rose);
    opacity: 0.7;
}

.dissolution-content .body-meditation {
    opacity: 0.6;
}

.dissolution-content .accent-label {
    margin-top: 3rem;
    animation: fadeInOut 4s ease-in-out infinite;
}

/* --- Temporal Ribbon --- */
#temporal-ribbon {
    position: fixed;
    top: calc(50vh - 50px);
    left: 0;
    width: 100%;
    height: 100px;
    z-index: 3;
    pointer-events: none;
    overflow: visible;
}

#ribbon-line {
    transition: filter 0.3s ease;
}

.braid-path {
    opacity: 0;
    stroke-dasharray: 20 10;
    transition: opacity 0.8s ease;
}

.braid-path.active {
    opacity: 1;
    animation: braidFlow 12s linear infinite;
}

@keyframes braidFlow {
    0% { stroke-dashoffset: 0; }
    100% { stroke-dashoffset: -300; }
}

/* --- Progress Arc --- */
#progress-arc {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 44px;
    height: 44px;
    z-index: 100;
}

.progress-bg {
    fill: none;
    stroke: rgba(154, 143, 173, 0.15);
    stroke-width: 2;
}

.progress-fill {
    fill: none;
    stroke: var(--muted-lavender);
    stroke-width: 2;
    opacity: 0.5;
    stroke-linecap: round;
    stroke-dasharray: 113.1;
    stroke-dashoffset: 113.1;
    transform: rotate(-90deg);
    transform-origin: center;
    transition: stroke-dashoffset 0.15s ease;
}

.progress-text {
    font-family: 'Share Tech Mono', monospace;
    font-size: 8px;
    fill: var(--muted-lavender);
    opacity: 0.5;
}

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

    .perception-content {
        gap: 3rem;
    }

    .text-upper {
        padding-left: 2vw;
    }

    .text-lower {
        padding-right: 2vw;
    }

    .memory-content {
        width: 95vw;
        max-width: 95vw;
    }

    .column-fragment {
        display: none;
    }
}

@media (max-width: 480px) {
    .card-grid {
        grid-template-columns: 1fr;
    }
}
