/* ============================================
   continua.club v2 -- Styles
   Surreal dreamscape, immersive scroll
   ============================================ */

/* --- CSS Custom Properties --- */
:root {
    --deep-liminal: #0d0a1e;
    --obsidian-pool: #12101f;
    --horizon-amber: #d4956a;
    --amethyst-haze: #8b6fc0;
    --parchment-mist: #e8e0d4;
    --fossil-grey: #7a7571;
    --cerulean-drift: #3d7a9e;
    --verdigris: #5a9e7b;
    --ember-glow: #c75b3a;

    --font-display: 'Cormorant Garamond', Georgia, serif;
    --font-body: 'Nunito Sans', 'Segoe UI', sans-serif;
    --font-mono: 'Overpass Mono', 'Courier New', monospace;

    --golden-ratio: 61.8%;
}

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

html {
    scroll-behavior: smooth;
    scroll-snap-type: y proximity;
    overflow-x: hidden;
    background: var(--deep-liminal);
}

body {
    font-family: var(--font-body);
    font-weight: 300;
    font-size: clamp(16px, 1.4vw, 20px);
    line-height: 1.75;
    letter-spacing: 0.02em;
    color: var(--parchment-mist);
    background: var(--deep-liminal);
    overflow-x: hidden;
}

/* --- Noise Texture Overlay --- */
.noise-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9999;
    opacity: 0.04;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
    background-repeat: repeat;
    background-size: 256px 256px;
}

/* --- Perspective Container --- */
.perspective-container {
    perspective: 1000px;
    transform-style: preserve-3d;
    position: relative;
}

/* --- Depth Layers --- */
.depth-layer {
    transform-style: preserve-3d;
}

.layer-0 {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    transform: translateZ(-300px) scale(1.3);
    pointer-events: none;
    z-index: 0;
}

.layer-1 {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    transform: translateZ(-150px) scale(1.15);
    pointer-events: none;
    z-index: 1;
}

.layer-2 {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 2;
}

.layer-3 {
    position: relative;
    z-index: 3;
}

/* --- Floating Number Sequences (Layer 0) --- */
.floating-numbers {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

.float-num {
    position: absolute;
    font-family: var(--font-mono);
    font-size: 10px;
    color: var(--parchment-mist);
    opacity: 0.08;
    letter-spacing: 0.06em;
    animation: floatUp linear infinite;
    white-space: nowrap;
}

@keyframes floatUp {
    from {
        transform: translateY(0);
    }
    to {
        transform: translateY(-100vh);
    }
}

/* --- Geometric Forms (Layer 1) --- */
.geometric-forms {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.geo-shape {
    position: absolute;
    width: 200px;
    height: 200px;
}

.geo-circle-1 {
    top: 15%;
    left: 8%;
    animation: geoRotate 120s linear infinite, geoDriftX 30s ease-in-out infinite alternate;
}

.geo-triangle-1 {
    top: 45%;
    right: 12%;
    animation: geoRotate 100s linear infinite reverse, geoDriftX 25s ease-in-out infinite alternate-reverse;
}

.geo-rect-1 {
    top: 70%;
    left: 15%;
    width: 160px;
    height: 160px;
    animation: geoRotate 140s linear infinite, geoDriftX 35s ease-in-out infinite alternate;
}

.geo-circle-2 {
    top: 25%;
    right: 5%;
    width: 150px;
    height: 150px;
    animation: geoRotate 110s linear infinite reverse, geoDriftX 28s ease-in-out infinite alternate;
}

.geo-triangle-2 {
    top: 60%;
    left: 3%;
    width: 180px;
    height: 180px;
    animation: geoRotate 130s linear infinite, geoDriftX 32s ease-in-out infinite alternate-reverse;
}

.geo-rect-2 {
    top: 85%;
    right: 10%;
    width: 140px;
    height: 140px;
    animation: geoRotate 150s linear infinite reverse, geoDriftX 27s ease-in-out infinite alternate;
}

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

@keyframes geoDriftX {
    from { margin-left: -20px; }
    to { margin-left: 20px; }
}

/* --- Horizon Line (Layer 2) --- */
.horizon-line {
    position: absolute;
    top: var(--golden-ratio);
    left: 0;
    width: 100%;
    height: 1px;
    background: var(--horizon-amber);
    opacity: 0.4;
    animation: horizonBreathe 8s ease-in-out infinite;
}

@keyframes horizonBreathe {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(0.5px); }
}

/* ==================================
   THE THRESHOLD
   ================================== */
.threshold {
    position: relative;
    height: 100vh;
    overflow: hidden;
    scroll-snap-align: start;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--deep-liminal);
}

.threshold-sky {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: var(--golden-ratio);
    background: linear-gradient(to bottom, var(--deep-liminal) 0%, #1a1230 40%, var(--horizon-amber) 100%);
    opacity: 0;
    transition: opacity 1s cubic-bezier(0.16, 1, 0.3, 1);
}

.threshold-sky.revealed {
    opacity: 1;
}

.threshold-pool {
    position: absolute;
    top: var(--golden-ratio);
    left: 0;
    width: 100%;
    height: 38.2%;
    background: var(--obsidian-pool);
    opacity: 0;
    transition: opacity 1s cubic-bezier(0.16, 1, 0.3, 1);
}

.threshold-pool.revealed {
    opacity: 1;
}

.horizon-line-threshold {
    position: absolute;
    top: var(--golden-ratio);
    left: 50%;
    width: 0;
    height: 1px;
    background: var(--horizon-amber);
    opacity: 0;
    transform: translateX(-50%);
    transition: width 1.2s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.5s ease;
}

.horizon-line-threshold.visible {
    width: 100%;
    opacity: 0.7;
}

.threshold-content {
    position: absolute;
    top: var(--golden-ratio);
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    z-index: 10;
}

.site-title {
    font-family: var(--font-display);
    font-weight: 300;
    font-style: italic;
    font-size: clamp(40px, 7vw, 96px);
    letter-spacing: 0.15em;
    color: var(--parchment-mist);
    line-height: 1.15;
    white-space: nowrap;
}

.title-char {
    display: inline-block;
    opacity: 0;
    transform: translateY(8px);
    transition: opacity 0.4s ease, transform 0.4s ease;
    transition-delay: calc(var(--i) * 60ms + 3000ms);
}

.title-char.visible {
    opacity: 1;
    transform: translateY(0);
}

.title-reflection {
    font-family: var(--font-display);
    font-weight: 300;
    font-style: italic;
    font-size: clamp(40px, 7vw, 96px);
    letter-spacing: 0.15em;
    color: var(--parchment-mist);
    line-height: 1.15;
    white-space: nowrap;
    transform: scaleY(-1);
    opacity: 0.3;
    filter: blur(2px);
    margin-top: 4px;
}

.reflect-char {
    display: inline-block;
    opacity: 0;
    transform: translateY(-8px);
    transition: opacity 0.4s ease, transform 0.4s ease;
    transition-delay: calc(var(--i) * 60ms + 3200ms);
}

.reflect-char.visible {
    opacity: 1;
    transform: translateY(0);
}

.scroll-prompt {
    position: absolute;
    bottom: 12%;
    left: 50%;
    transform: translateX(-50%);
    font-family: var(--font-mono);
    font-size: 13px;
    font-weight: 400;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--fossil-grey);
    opacity: 0;
    animation: scrollPromptFade 2s ease 4500ms forwards;
    z-index: 10;
}

@keyframes scrollPromptFade {
    0% { opacity: 0; }
    30% { opacity: 0.6; }
    70% { opacity: 0.6; }
    100% { opacity: 0; }
}

/* ==================================
   CORRIDORS
   ================================== */
.corridor {
    position: relative;
    min-height: 120vh;
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: 2vw;
    scroll-snap-align: start;
    overflow: hidden;
}

.corridor-atmosphere {
    position: sticky;
    top: 0;
    height: 100vh;
    width: 18%;
    opacity: 0;
    transition: opacity 1.5s ease;
    z-index: 0;
}

.corridor-atmosphere-left {
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    background: linear-gradient(to right, var(--accent) 0%, transparent 100%);
    opacity: 0.08;
}

.corridor-atmosphere-right {
    position: absolute;
    right: 0;
    top: 0;
    height: 100%;
    background: linear-gradient(to left, var(--accent) 0%, transparent 100%);
    opacity: 0.08;
}

.corridor.in-view .corridor-atmosphere-left,
.corridor.in-view .corridor-atmosphere-right {
    opacity: 0.15;
}

.horizon-line-section {
    position: absolute;
    top: var(--golden-ratio);
    left: 0;
    width: 100%;
    height: 1px;
    background: var(--horizon-amber);
    opacity: 0.25;
    animation: horizonBreathe 8s ease-in-out infinite;
}

.corridor-content {
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 10vh 0;
    max-width: 720px;
    opacity: 0;
    transform: translateY(40px);
    transition: opacity 1.2s ease, transform 1.2s ease;
    z-index: 1;
}

.corridor.in-view .corridor-content {
    opacity: 1;
    transform: translateY(0);
}

.corridor-content-left {
    grid-column: 2 / 7;
}

.corridor-content-right {
    grid-column: 7 / 12;
}

.corridor-heading {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: clamp(32px, 5.5vw, 80px);
    letter-spacing: 0.08em;
    line-height: 1.15;
    color: var(--parchment-mist);
    margin-bottom: 1.5em;
}

.corridor-text {
    color: var(--parchment-mist);
    margin-bottom: 1.5em;
}

/* Corridor-specific heading accents */
.corridor-1 .corridor-heading {
    color: var(--cerulean-drift);
}

.corridor-2 .corridor-heading {
    color: var(--amethyst-haze);
}

.corridor-3 .corridor-heading {
    color: var(--verdigris);
}

/* --- Dissolve Zones --- */
.dissolve-zone {
    height: 40vh;
    position: relative;
}

.dissolve-1-2 {
    background: linear-gradient(
        to bottom,
        rgba(61, 122, 158, 0.08) 0%,
        var(--deep-liminal) 50%,
        rgba(139, 111, 192, 0.08) 100%
    );
}

.dissolve-2-3 {
    background: linear-gradient(
        to bottom,
        rgba(139, 111, 192, 0.08) 0%,
        var(--deep-liminal) 50%,
        rgba(90, 158, 123, 0.08) 100%
    );
}

.dissolve-3-atrium {
    background: linear-gradient(
        to bottom,
        rgba(90, 158, 123, 0.08) 0%,
        var(--deep-liminal) 100%
    );
}

/* ==================================
   THE ATRIUM
   ================================== */
.atrium {
    position: relative;
    min-height: 200vh;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    overflow: hidden;
    scroll-snap-align: start;
    background: radial-gradient(
        ellipse at center,
        rgba(139, 111, 192, 0.06) 0%,
        rgba(61, 122, 158, 0.04) 25%,
        rgba(90, 158, 123, 0.03) 50%,
        rgba(212, 149, 106, 0.02) 75%,
        var(--deep-liminal) 100%
    );
}

.atrium-rings {
    position: sticky;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100vmin;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.rings-svg {
    width: 100%;
    height: 100%;
}

.atrium-text {
    position: sticky;
    top: 40vh;
    text-align: center;
    padding: 0 2vw;
    z-index: 5;
    margin-top: 30vh;
}

.atrium-heading {
    font-family: var(--font-display);
    font-weight: 300;
    font-style: italic;
    font-size: clamp(24px, 4vw, 56px);
    letter-spacing: 0.08em;
    line-height: 1.3;
    color: var(--parchment-mist);
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 1.5s ease, transform 1.5s ease;
}

.atrium.in-view .atrium-heading {
    opacity: 0.8;
    transform: translateY(0);
}

.ring-counter {
    position: fixed;
    bottom: 24px;
    right: 24px;
    font-family: var(--font-mono);
    font-size: 13px;
    font-weight: 400;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--fossil-grey);
    opacity: 0;
    transition: opacity 0.6s ease;
    z-index: 100;
}

.ring-counter.visible {
    opacity: 0.6;
}

.counter-label {
    margin-right: 0.5em;
}

/* ==================================
   SVG RING ANIMATION
   ================================== */
.ring-circle {
    fill: none;
    stroke: var(--parchment-mist);
    stroke-width: 0.5;
    animation: ringPulse 3s ease-out forwards;
}

@keyframes ringPulse {
    from {
        opacity: 0;
        transform-origin: center;
    }
    to {
        opacity: var(--ring-opacity, 0.3);
    }
}

/* ==================================
   ENTRANCE ANIMATION OVERRIDE
   ================================== */
body.loading {
    background: var(--deep-liminal);
}

body.loading .noise-overlay {
    opacity: 0;
    transition: opacity 1s ease 0.5s;
}

body.loaded .noise-overlay {
    opacity: 0.04;
}

body.loading .threshold-sky,
body.loading .threshold-pool {
    opacity: 0;
}

body.loading .layer-0,
body.loading .layer-1,
body.loading .layer-2 {
    opacity: 0;
    transition: opacity 2s ease 2s;
}

body.loaded .layer-0,
body.loaded .layer-1,
body.loaded .layer-2 {
    opacity: 1;
}

/* ==================================
   RESPONSIVE
   ================================== */
@media (max-width: 768px) {
    .corridor {
        display: flex;
        flex-direction: column;
        align-items: center;
    }

    .corridor-content-left,
    .corridor-content-right {
        grid-column: auto;
        padding: 10vh 6vw;
        max-width: 100%;
    }

    .corridor-atmosphere-left,
    .corridor-atmosphere-right {
        width: 10%;
    }

    .geo-shape {
        width: 120px;
        height: 120px;
    }

    .atrium-rings {
        width: 140vmin;
    }

    .threshold-content {
        padding: 0 4vw;
    }

    .site-title,
    .title-reflection {
        white-space: normal;
        word-break: break-word;
    }
}
