/* =========================================
   continua.club — Swiss Nostalgia
   Midnight Blue Continuum
   ========================================= */

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

:root {
    /* Color Palette — Midnight Blue Continuum */
    --abyssal-navy: #0d1b2a;
    --midnight-core: #1b2838;
    --twilight-ink: #1f3044;
    --ghost-architecture: #1a2744;
    --aged-vellum: #e8dcc8;
    --moonlit-parchment: #f0e6d3;
    --tungsten-amber: #c4923a;
    --steel-twilight: #4a6fa5;
    --horizon-line: #2a4066;

    /* Typography Scale */
    --heading-primary: clamp(2.4rem, 5.5vw, 4.8rem);
    --heading-secondary: clamp(1.4rem, 2.8vw, 2.2rem);
    --body-size: clamp(1rem, 1.3vw, 1.15rem);
    --mono-size: 0.8rem;
    --annotation-size: 0.75rem;
    --nav-size: clamp(0.85rem, 1.5vw, 1.1rem);
}

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

body {
    background-color: var(--abyssal-navy);
    color: var(--aged-vellum);
    font-family: 'Source Serif 4', 'Georgia', serif;
    font-weight: 300;
    font-size: var(--body-size);
    line-height: 1.72;
    letter-spacing: 0.01em;
    overflow-x: hidden;
    transition: background-color 1.5s ease;
}

/* --- Navigation --- */
#site-nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    padding: 1rem 2rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.nav-rule {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background-color: var(--horizon-line);
}

.nav-title {
    font-family: 'Cormorant Garamond', 'Georgia', serif;
    font-weight: 300;
    font-size: var(--nav-size);
    letter-spacing: 0.06em;
    color: var(--moonlit-parchment);
}

.nav-infinity {
    opacity: 0.6;
    margin-top: 2px;
}

/* --- Temporal Tick Marks --- */
#temporal-ticks {
    position: fixed;
    left: 0.75rem;
    top: 0;
    bottom: 0;
    width: 1px;
    z-index: 50;
    pointer-events: none;
}

.tick-mark {
    position: absolute;
    left: 0;
    width: 1px;
    background-color: var(--horizon-line);
}

/* --- Data Stream Ribbons --- */
#data-ribbons {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    pointer-events: none;
    opacity: 0.5;
}

/* --- Peripheral Skeletons --- */
.peripheral-skeletons {
    position: fixed;
    top: 0;
    bottom: 0;
    width: 80px;
    z-index: 2;
    pointer-events: none;
}

.peripheral-left {
    left: 0;
}

.peripheral-right {
    right: 0;
}

.peripheral-skeleton {
    position: absolute;
    border: 1px solid var(--ghost-architecture);
    border-radius: 2px;
    animation: skeleton-pulse 4s ease-in-out infinite;
}

.peripheral-left .peripheral-skeleton {
    left: 0.5rem;
}

.peripheral-right .peripheral-skeleton {
    right: 0.5rem;
}

/* Stagger pulse start times */
.peripheral-skeleton:nth-child(1) { animation-delay: 0s; }
.peripheral-skeleton:nth-child(2) { animation-delay: 0.7s; }
.peripheral-skeleton:nth-child(3) { animation-delay: 1.4s; }
.peripheral-skeleton:nth-child(4) { animation-delay: 2.1s; }
.peripheral-skeleton:nth-child(5) { animation-delay: 2.8s; }
.peripheral-skeleton:nth-child(6) { animation-delay: 3.5s; }

@keyframes skeleton-pulse {
    0%, 100% { opacity: 0.08; }
    50% { opacity: 0.18; }
}

/* --- Main Content --- */
#continuum {
    position: relative;
    z-index: 10;
}

/* --- Content Zones (Sections) --- */
.content-zone {
    position: relative;
    min-height: 100vh;
    padding: 10vh 5vw;
    transition: background-color 2s ease;
}

.zone-entry {
    min-height: 100vh;
    padding: 0;
}

/* --- Skeleton Fields --- */
.skeleton-field {
    position: relative;
    width: 100%;
    height: 100vh;
}

.skeleton-shape {
    position: absolute;
    border: 1px solid var(--ghost-architecture);
    border-radius: 2px;
    animation: skeleton-pulse-stagger 4s ease-in-out infinite;
}

.skeleton-shape:nth-child(1) { animation-duration: 3.2s; animation-delay: 0s; }
.skeleton-shape:nth-child(2) { animation-duration: 4.1s; animation-delay: 0.5s; }
.skeleton-shape:nth-child(3) { animation-duration: 3.5s; animation-delay: 1.0s; }
.skeleton-shape:nth-child(4) { animation-duration: 4.5s; animation-delay: 0.3s; }
.skeleton-shape:nth-child(5) { animation-duration: 3.8s; animation-delay: 1.5s; }
.skeleton-shape:nth-child(6) { animation-duration: 4.3s; animation-delay: 0.8s; }
.skeleton-shape:nth-child(7) { animation-duration: 3.6s; animation-delay: 1.2s; }
.skeleton-shape:nth-child(8) { animation-duration: 4.0s; animation-delay: 0.2s; }
.skeleton-shape:nth-child(9) { animation-duration: 3.4s; animation-delay: 1.8s; }
.skeleton-shape:nth-child(10) { animation-duration: 4.2s; animation-delay: 0.6s; }
.skeleton-shape:nth-child(11) { animation-duration: 3.7s; animation-delay: 1.3s; }

@keyframes skeleton-pulse-stagger {
    0%, 100% { opacity: 0.08; }
    50% { opacity: 0.18; }
}

/* Skeleton lookahead */
.skeleton-lookahead {
    position: relative;
    height: 30vh;
    width: 100%;
}

.final-field {
    height: 60vh;
}

/* Ghost with mark */
.ghost-with-mark {
    display: flex;
    align-items: center;
    justify-content: center;
}

.ghost-mark {
    font-family: 'Caveat', cursive;
    font-size: 1rem;
    color: var(--ghost-architecture);
    opacity: 0.4;
}

/* --- Content Blocks (Flow Positions) --- */
.content-block {
    position: relative;
    max-width: 55%;
    padding: 2rem 0;
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.8s cubic-bezier(0.25, 0.1, 0.25, 1.0),
                transform 0.8s cubic-bezier(0.25, 0.1, 0.25, 1.0);
}

.content-block.revealed {
    opacity: 1;
    transform: translateY(0);
}

/* Bézier-derived flow positions — content drifts laterally */
.flow-pos-left {
    margin-left: 15%;
}

.flow-pos-center {
    margin-left: 25%;
}

.flow-pos-center-right {
    margin-left: 40%;
}

.flow-pos-right {
    margin-left: 50%;
}

/* --- Typography --- */
.display-heading {
    font-family: 'Cormorant Garamond', 'Georgia', serif;
    color: var(--moonlit-parchment);
    letter-spacing: 0.06em;
    line-height: 1.18;
    margin-bottom: 1.5rem;
}

.display-heading.primary {
    font-weight: 600;
    font-size: var(--heading-primary);
}

.display-heading.secondary {
    font-weight: 300;
    font-size: var(--heading-secondary);
}

.body-text {
    font-family: 'Source Serif 4', 'Georgia', serif;
    font-weight: 300;
    font-size: var(--body-size);
    line-height: 1.72;
    letter-spacing: 0.01em;
    color: var(--aged-vellum);
    margin-bottom: 1.2rem;
}

.metadata-label {
    display: inline-block;
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 300;
    font-size: var(--mono-size);
    letter-spacing: 0.05em;
    color: var(--steel-twilight);
    margin-top: 0.75rem;
}

/* --- Annotation Labels (hand-drawn feel) --- */
.annotation-label {
    position: absolute;
    font-family: 'Caveat', cursive;
    font-weight: 400;
    font-size: var(--annotation-size);
    color: var(--aged-vellum);
    opacity: 0;
    transition: opacity 0.6s ease 0.2s;
    pointer-events: none;
}

.annotation-label.warm {
    color: var(--tungsten-amber);
}

.annotation-label.visible {
    opacity: 0.7;
}

/* --- Pause Zones --- */
.pause-zone {
    position: relative;
    height: 35vh;
    width: 100%;
}

.pause-zone.large {
    height: 45vh;
}

.pause-zone.final-pause {
    height: 25vh;
}

/* --- Continuity Curves (SVG) --- */
.continuity-curve {
    position: absolute;
    width: 70%;
    height: auto;
    left: 15%;
    top: 50%;
    transform: translateY(-50%);
}

.continuity-curve.wide-curve {
    width: 85%;
    left: 7.5%;
}

.continuity-curve path {
    stroke-dasharray: 2000;
    stroke-dashoffset: 2000;
    transition: stroke-dashoffset 2.5s cubic-bezier(0.25, 0.1, 0.25, 1.0);
}

.continuity-curve.drawn path {
    stroke-dashoffset: 0;
}

.inflection-dot {
    opacity: 0;
    transition: opacity 0.8s ease 1.5s;
}

.continuity-curve.drawn .inflection-dot {
    opacity: 0.6;
}

/* --- Infinity Motifs --- */
.infinity-motif {
    position: absolute;
    width: 80px;
    height: 40px;
}

.infinity-motif.gestural {
    width: 120px;
    height: 60px;
}

.infinity-motif.wispy {
    width: 140px;
    height: 70px;
}

.infinity-motif.final-infinity {
    width: 100px;
    height: 50px;
}

.infinity-motif path {
    stroke-dasharray: 500;
    stroke-dashoffset: 500;
}

.infinity-motif.drawing path {
    animation: infinity-draw-loop 8s linear infinite;
}

@keyframes infinity-draw-loop {
    0% { stroke-dashoffset: 500; }
    50% { stroke-dashoffset: 0; }
    100% { stroke-dashoffset: -500; }
}

/* --- Phase Space Dots --- */
.phase-dots-cluster {
    position: absolute;
    width: 40px;
    height: 40px;
}

.phase-dot {
    display: block;
    position: absolute;
    width: 3px;
    height: 3px;
    border-radius: 50%;
    animation: phase-drift 20s ease-in-out infinite alternate;
}

.phase-dot.cool {
    background-color: var(--steel-twilight);
}

.phase-dot.warm {
    background-color: var(--tungsten-amber);
}

.phase-dot:nth-child(1) { top: 0; left: 0; animation-delay: 0s; }
.phase-dot:nth-child(2) { top: 10px; left: 15px; animation-delay: -3s; }
.phase-dot:nth-child(3) { top: 5px; left: 30px; animation-delay: -6s; }
.phase-dot:nth-child(4) { top: 20px; left: 8px; animation-delay: -9s; }
.phase-dot:nth-child(5) { top: 25px; left: 25px; animation-delay: -12s; }
.phase-dot:nth-child(6) { top: 15px; left: 5px; animation-delay: -15s; }
.phase-dot:nth-child(7) { top: 30px; left: 18px; animation-delay: -18s; }

.phase-dots-cluster.dense .phase-dot {
    width: 4px;
    height: 4px;
    animation-duration: 16s;
}

@keyframes phase-drift {
    0% { transform: translate(0, 0); }
    25% { transform: translate(var(--dx), var(--dy)); }
    50% { transform: translate(calc(var(--dx) * -0.5), calc(var(--dy) * 0.7)); }
    75% { transform: translate(calc(var(--dx) * 0.8), calc(var(--dy) * -0.6)); }
    100% { transform: translate(calc(var(--dx) * -0.3), calc(var(--dy) * 0.4)); }
}

/* --- Scroll-Driven Background Atmosphere --- */
body.bg-abyssal { background-color: var(--abyssal-navy); }
body.bg-midnight { background-color: var(--midnight-core); }
body.bg-twilight { background-color: var(--twilight-ink); }

/* --- Reveal Animations (clip-path based) --- */
.reveal-target {
    clip-path: inset(0 0 100% 0);
    transition: clip-path 0.8s cubic-bezier(0.25, 0.1, 0.25, 1.0);
}

.reveal-target.revealed {
    clip-path: inset(0 0 0% 0);
}

/* Override the opacity/transform for revealed state since we use clip-path */
.content-block.reveal-target {
    opacity: 1;
    transform: none;
    clip-path: inset(0 0 100% 0);
    transition: clip-path 0.8s cubic-bezier(0.25, 0.1, 0.25, 1.0);
}

.content-block.reveal-target.revealed {
    clip-path: inset(0 0 0% 0);
}

/* --- Responsive --- */
@media (max-width: 768px) {
    .content-block {
        max-width: 85%;
    }

    .flow-pos-left {
        margin-left: 8%;
    }

    .flow-pos-center {
        margin-left: 10%;
    }

    .flow-pos-center-right {
        margin-left: 12%;
    }

    .flow-pos-right {
        margin-left: 10%;
    }

    .continuity-curve {
        width: 90%;
        left: 5%;
    }

    .peripheral-skeletons {
        display: none;
    }

    #temporal-ticks {
        display: none;
    }

    .pause-zone {
        height: 25vh;
    }

    .pause-zone.large {
        height: 35vh;
    }
}

@media (max-width: 480px) {
    .content-block {
        max-width: 92%;
    }

    .flow-pos-left,
    .flow-pos-center,
    .flow-pos-center-right,
    .flow-pos-right {
        margin-left: 5%;
    }
}
