/* ========================================
   continua.club - Styles
   Chrome-metallic, horizontal-scroll, motion-heavy
   Palette: #C8CCD0, #1C1E22, #F0EBE0, #D4A843, #B8A9D4, #7AA882, #D4A9B8, #0E1117
   Fonts: Syne (display), Instrument Sans (body), Victor Mono (accent)
   ======================================== */

/* === CSS Custom Properties (Animated) === */
@property --chrome-hue {
    syntax: '<angle>';
    initial-value: 135deg;
    inherits: false;
}

@property --cursor-x {
    syntax: '<percentage>';
    initial-value: 50%;
    inherits: true;
}

@property --cursor-y {
    syntax: '<percentage>';
    initial-value: 50%;
    inherits: true;
}

@property --hue-shift {
    syntax: '<angle>';
    initial-value: 0deg;
    inherits: true;
}

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

html {
    overflow: hidden;
    height: 100%;
    width: 100%;
}

body {
    height: 100%;
    width: 100%;
    overflow: hidden;
    font-family: 'Instrument Sans', sans-serif;
    font-weight: 400;
    font-size: clamp(1rem, 1.2vw, 1.25rem);
    line-height: 1.7;
    letter-spacing: 0.005em;
    color: #1C1E22;
    background: #0E1117;
    filter: hue-rotate(var(--hue-shift));
}

/* === Chrome Gradient Background === */
#chrome-gradient {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    background: linear-gradient(var(--chrome-hue), #C8CCD0, #B8A9D4, #D4A9B8, #C8CCD0);
    background-size: 400% 400%;
    transition: --chrome-hue 0.05s linear;
}

/* === Cursor Lens Overlay === */
#cursor-lens {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    pointer-events: none;
    background: radial-gradient(circle at var(--cursor-x) var(--cursor-y), rgba(255,255,255,0.15), transparent 50%);
}

/* === SVG Thread Network === */
#thread-network {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2;
    pointer-events: none;
    overflow: visible;
}

#thread-network line {
    stroke: #B8A9D4;
    stroke-opacity: 0.4;
    stroke-width: 0.5;
}

/* === Particle Canvas === */
#particle-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 6;
    pointer-events: none;
}

/* === The Ribbon (Main Horizontal Scroll) === */
.ribbon {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    height: 100vh;
    width: 700vw;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x mandatory;
    scroll-behavior: smooth;
    position: relative;
    z-index: 3;
}

/* Hide scrollbar but keep functionality */
.ribbon::-webkit-scrollbar {
    display: none;
}

.ribbon {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

/* === Chamber Base === */
.chamber {
    flex: 0 0 100vw;
    width: 100vw;
    height: 100vh;
    scroll-snap-align: start;
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chamber__inner {
    position: relative;
    z-index: 2;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem 4rem;
}

.chamber__inner--scrollable {
    overflow-y: auto;
    scroll-snap-type: none;
}

.chamber__inner--scrollable::-webkit-scrollbar {
    width: 3px;
}

.chamber__inner--scrollable::-webkit-scrollbar-track {
    background: transparent;
}

.chamber__inner--scrollable::-webkit-scrollbar-thumb {
    background: rgba(184, 169, 212, 0.3);
    border-radius: 3px;
}

.chamber__title {
    font-family: 'Syne', sans-serif;
    font-weight: 800;
    font-size: clamp(3rem, 8vw, 7rem);
    letter-spacing: -0.02em;
    margin-bottom: 1.5rem;
    text-align: center;
}

.chamber__title--left {
    text-align: left;
}

/* === Knot Decorations === */
.knot-decoration {
    position: absolute;
    width: 200px;
    height: 200px;
    opacity: 0.2;
    z-index: 1;
    pointer-events: none;
}

.knot-decoration--trefoil {
    bottom: 3rem;
    left: 3rem;
}

.knot-decoration--bottom-right {
    bottom: 3rem;
    right: 3rem;
}

.knot-decoration--top-right {
    top: 3rem;
    right: 3rem;
}

.knot-decoration--bottom-left {
    bottom: 3rem;
    left: 3rem;
}

.knot-path {
    stroke-dasharray: 1000;
    stroke-dashoffset: 1000;
    transition: stroke-dashoffset 2s ease-out;
}

.knot-path.knot-visible {
    stroke-dashoffset: 0;
}

/* === Chamber 1: The Threshold === */
.chamber--threshold {
    background: transparent;
}

.threshold__title {
    font-family: 'Syne', sans-serif;
    font-weight: 800;
    font-size: clamp(4rem, 12vw, 10rem);
    letter-spacing: -0.03em;
    color: #1C1E22;
    position: relative;
    white-space: nowrap;
    overflow: visible;
}

.threshold__word {
    display: inline-block;
    background: linear-gradient(135deg, #1C1E22 0%, #B8A9D4 50%, #D4A9B8 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.threshold__dissolve {
    display: inline-block;
    width: 30vw;
    height: 100%;
    position: absolute;
    right: -30vw;
    top: 0;
    background: linear-gradient(to right, #B8A9D4, transparent);
    mask-image: linear-gradient(to right, rgba(0,0,0,0.3), transparent);
    -webkit-mask-image: linear-gradient(to right, rgba(0,0,0,0.3), transparent);
}

.threshold__subtitle {
    font-family: 'Victor Mono', monospace;
    font-style: italic;
    font-size: 0.85rem;
    color: #1C1E22;
    opacity: 0.6;
    margin-top: 1rem;
    text-align: center;
}

.threshold__arrow {
    position: absolute;
    right: 3rem;
    top: 50%;
    transform: translateY(-50%);
    animation: pulse-right 2s ease-in-out infinite;
    opacity: 0.7;
}

@keyframes pulse-right {
    0%, 100% { transform: translateY(-50%) translateX(0); opacity: 0.4; }
    50% { transform: translateY(-50%) translateX(10px); opacity: 0.9; }
}

/* === Chamber 2: The Gradient Chamber === */
.chamber--gradient {
    background: linear-gradient(135deg, rgba(200, 204, 208, 0.3) 0%, rgba(184, 169, 212, 0.3) 100%);
}

.gradient-blocks {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(2, 1fr);
    gap: 1.5rem;
    max-width: 900px;
    width: 100%;
    padding: 2rem;
}

.gradient-block {
    background: rgba(240, 235, 224, 0.85);
    border: 1px solid rgba(184, 169, 212, 0.3);
    border-radius: 8px;
    padding: 1.5rem;
    cursor: grab;
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.3s ease;
    position: relative;
    user-select: none;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.gradient-block:hover {
    transform: translateY(-4px) scale(1.02);
    box-shadow: 0 8px 32px rgba(184, 169, 212, 0.3);
    border-color: rgba(184, 169, 212, 0.6);
}

.gradient-block:active {
    cursor: grabbing;
}

.gradient-block__text {
    font-family: 'Instrument Sans', sans-serif;
    font-size: 0.95rem;
    line-height: 1.6;
    color: #1C1E22;
    margin-bottom: 0.75rem;
}

.gradient-block__label {
    font-family: 'Victor Mono', monospace;
    font-style: italic;
    font-size: 0.75rem;
    color: #B8A9D4;
    text-transform: lowercase;
}

/* === Chamber 3: The Interval === */
.chamber--interval {
    background: linear-gradient(180deg, #F0EBE0 0%, #C8CCD0 100%);
}

.interval__prose {
    font-family: 'Instrument Sans', sans-serif;
    max-width: 500px;
    text-align: center;
    color: #1C1E22;
    margin-bottom: 2rem;
    opacity: 0;
    transition: opacity 0.8s ease;
}

.interval__zoom-container {
    width: 300px;
    height: 300px;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border: 1px solid rgba(28, 30, 34, 0.1);
    border-radius: 4px;
}

.zoom-level {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(184, 169, 212, 0.4);
    position: relative;
    transform-origin: center center;
    will-change: transform;
    transition: transform 0.3s ease-out;
}

.zoom-level:nth-child(odd) {
    background: rgba(200, 204, 208, 0.15);
}

.zoom-level:nth-child(even) {
    background: rgba(240, 235, 224, 0.15);
}

.zoom-level > .zoom-level {
    width: 80%;
    height: 80%;
}

#deep-zoom-canvas {
    width: 100%;
    height: 100%;
    display: block;
}

.interval__hint {
    font-family: 'Victor Mono', monospace;
    font-style: italic;
    font-size: 0.7rem;
    color: #1C1E22;
    opacity: 0.4;
    margin-top: 1.5rem;
    text-align: center;
}

/* === Chamber 4: The Membership Lounge === */
.chamber--lounge {
    background: rgba(240, 235, 224, 0.6);
}

.lounge__layout {
    display: flex;
    flex-direction: row;
    gap: 4rem;
    max-width: 1100px;
    width: 100%;
    align-items: center;
}

.lounge__prose {
    flex: 1;
}

.lounge__prose .chamber__title {
    font-size: clamp(2rem, 5vw, 4.5rem);
}

.lounge__prose p {
    margin-bottom: 1.25rem;
    color: #1C1E22;
    font-weight: 400;
}

.lounge__graph {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

#membership-graph {
    width: 400px;
    height: 400px;
    border-radius: 12px;
    border: 1px solid rgba(122, 168, 130, 0.2);
    background: rgba(14, 17, 23, 0.05);
}

/* Living Green indicator pulse */
.lounge__graph::before {
    content: '';
    position: absolute;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #7AA882;
    top: 1rem;
    right: 1rem;
    box-shadow: 0 0 8px rgba(122, 168, 130, 0.5);
    animation: pulse-green 3s ease-in-out infinite;
}

@keyframes pulse-green {
    0%, 100% { opacity: 0.5; transform: scale(1); }
    50% { opacity: 1; transform: scale(1.2); }
}

/* === Chamber 5: The Archive Drift === */
.chamber--archive {
    background: linear-gradient(135deg, rgba(200, 204, 208, 0.4) 0%, rgba(212, 169, 184, 0.3) 100%);
}

.chamber--archive .chamber__inner {
    overflow: hidden;
    padding: 2rem;
}

.chamber--archive .chamber__title {
    margin-bottom: 2rem;
}

.archive__stream {
    display: flex;
    flex-direction: row;
    gap: 1.5rem;
    position: relative;
    width: max-content;
    will-change: transform;
}

.archive__stream.animating {
    animation: drift-stream 60s linear infinite;
}

@keyframes drift-stream {
    0% { transform: translateX(0); }
    100% { transform: translateX(-50%); }
}

.archive__card {
    flex: 0 0 280px;
    background: rgba(240, 235, 224, 0.9);
    border: 1px solid rgba(184, 169, 212, 0.25);
    border-radius: 8px;
    padding: 1.5rem;
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.3s ease;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.archive__card:hover {
    transform: scale(1.05) translateY(-4px);
    box-shadow: 0 12px 40px rgba(184, 169, 212, 0.2);
}

.archive__quote {
    font-family: 'Instrument Sans', sans-serif;
    font-size: 0.9rem;
    line-height: 1.65;
    color: #1C1E22;
    font-style: italic;
}

/* === Chamber 6: The Contemplation === */
.chamber--contemplation {
    background: linear-gradient(180deg, #1C1E22 0%, #0E1117 100%);
}

.chamber--contemplation .chamber__title {
    color: #C8CCD0;
}

.contemplation__content {
    max-width: 600px;
    text-align: center;
    position: relative;
}

.contemplation__text {
    color: #C8CCD0;
    margin-bottom: 1.5rem;
    opacity: 0;
    transition: opacity 0.8s ease;
}

.contemplation__stars {
    position: absolute;
    top: -200px;
    left: -200px;
    width: calc(100% + 400px);
    height: calc(100% + 400px);
    pointer-events: none;
    z-index: -1;
}

/* === Chamber 7: The Fold === */
.chamber--fold {
    background: #0E1117;
    perspective: 1200px;
}

.chamber--fold .chamber__inner {
    transform-style: preserve-3d;
    transition: transform 1s ease;
}

.fold__content {
    text-align: center;
    z-index: 2;
    position: relative;
}

.fold__title {
    color: #D4A9B8;
}

.fold__text {
    color: #C8CCD0;
    max-width: 500px;
    margin: 0 auto 2rem;
    opacity: 0;
    transition: opacity 0.8s ease;
}

.fold__counter {
    font-family: 'Victor Mono', monospace;
    font-size: 0.75rem;
    color: #D4A843;
    opacity: 0.7;
    margin-top: 2rem;
}

.fold__stars {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
}

/* === Dot Navigation === */
.dot-nav {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10;
    display: flex;
    align-items: center;
    gap: 24px;
}

.dot-nav__track {
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 1px;
    transform: translateY(-50%);
}

.dot-nav__line {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: #C8CCD0;
}

.dot-nav__line-fill {
    position: absolute;
    top: 0;
    left: 0;
    height: 1px;
    width: 0%;
    background: #B8A9D4;
    transition: width 0.3s ease;
}

.dot-nav__dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    border: 1px solid #C8CCD0;
    background: transparent;
    cursor: pointer;
    position: relative;
    z-index: 1;
    transition: all 0.3s ease;
    padding: 0;
    outline: none;
}

.dot-nav__dot--active {
    background: #D4A843;
    border-color: #D4A843;
    width: 10px;
    height: 10px;
    box-shadow: 0 0 8px rgba(212, 168, 67, 0.4);
}

.dot-nav__dot:hover {
    background: rgba(212, 168, 67, 0.5);
    border-color: #D4A843;
}

/* === Fade-in text === */
.fade-in-text {
    opacity: 0;
    transition: opacity 0.8s ease;
}

.fade-in-text.visible {
    opacity: 1;
}

/* === Star particles (for dark chambers) === */
.star {
    position: absolute;
    width: 2px;
    height: 2px;
    background: #fff;
    border-radius: 50%;
    animation: twinkle var(--twinkle-duration, 3s) ease-in-out infinite;
    animation-delay: var(--twinkle-delay, 0s);
}

@keyframes twinkle {
    0%, 100% { opacity: 0.1; }
    50% { opacity: 0.7; }
}

/* === Selection color === */
::selection {
    background: rgba(184, 169, 212, 0.3);
    color: #1C1E22;
}

/* === Responsive adjustments === */
@media (max-width: 768px) {
    .lounge__layout {
        flex-direction: column;
        gap: 2rem;
    }

    .gradient-blocks {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
        padding: 1rem;
    }

    .chamber__inner {
        padding: 1.5rem 2rem;
    }

    #membership-graph {
        width: 280px;
        height: 280px;
    }

    .chamber__title {
        font-size: clamp(2rem, 6vw, 4rem);
    }

    .threshold__title {
        font-size: clamp(3rem, 10vw, 6rem);
    }

    .archive__card {
        flex: 0 0 220px;
        padding: 1rem;
    }

    .archive__quote {
        font-size: 0.8rem;
    }

    .interval__zoom-container {
        width: 220px;
        height: 220px;
    }

    .lounge__prose .chamber__title {
        text-align: center;
    }
}
