/* ============================================================
   continua.club — Styles
   Palette: #1E0F08, #8B4A2B, #F5E6D3, #D4873F, #3D1F12, #B87A56, #E8A848, #2A1810
   Fonts: Caveat, Cormorant Garamond, Inconsolata
   ============================================================ */

/* --- CSS Custom Properties --- */
:root {
    --deep-ground: #1E0F08;
    --warm-ground: #8B4A2B;
    --light-surface: #F5E6D3;
    --accent-glow: #D4873F;
    --shadow-wash: #3D1F12;
    --annotation-ink: #B87A56;
    --bokeh-warm: #E8A848;
    --burnt-umber: #2A1810;

    --font-display: 'Caveat', cursive;
    --font-body: 'Cormorant Garamond', serif;
    --font-utility: 'Inconsolata', monospace;

    --ease-reveal: cubic-bezier(0.25, 0.46, 0.45, 0.94);
    --ease-depth: cubic-bezier(0.22, 1.0, 0.36, 1.0);
}

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

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

body {
    background-color: var(--deep-ground);
    color: var(--light-surface);
    font-family: var(--font-body);
    font-weight: 400;
    font-size: clamp(1rem, 1.8vw, 1.25rem);
    line-height: 1.75;
    letter-spacing: 0.01em;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* --- Film Grain Overlay --- */
body::after {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    z-index: 9999;
    opacity: 0.04;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='grain'%3E%3CfeTurbulence baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='200' height='200' filter='url(%23grain)'/%3E%3C/svg%3E");
    background-repeat: repeat;
}

/* --- Sections --- */
.section {
    position: relative;
    min-height: 120vh;
    overflow: hidden;
    width: 100%;
}

.section-inner {
    position: relative;
    width: 100%;
    height: 100%;
    min-height: 120vh;
}

/* Diagonal clip-paths — alternating directions */
.section-threshold {
    background: linear-gradient(168deg, var(--deep-ground) 0%, var(--deep-ground) 70%, var(--warm-ground) 100%);
    clip-path: polygon(0 0, 100% 0, 100% calc(100% - 4vw), 0 100%);
    z-index: 5;
}

.section-unraveling {
    background: linear-gradient(192deg, var(--warm-ground) 0%, var(--warm-ground) 70%, var(--shadow-wash) 100%);
    clip-path: polygon(0 4vw, 100% 0, 100% 100%, 0 calc(100% - 4vw));
    margin-top: -4vw;
    z-index: 4;
}

.section-archive {
    background: linear-gradient(168deg, var(--shadow-wash) 0%, var(--warm-ground) 30%, var(--light-surface) 100%);
    clip-path: polygon(0 0, 100% 4vw, 100% calc(100% - 4vw), 0 100%);
    margin-top: -4vw;
    z-index: 3;
}

.section-thread {
    background: linear-gradient(192deg, var(--burnt-umber) 0%, var(--deep-ground) 40%, var(--shadow-wash) 100%);
    clip-path: polygon(0 4vw, 100% 0, 100% 100%, 0 calc(100% - 4vw));
    margin-top: -4vw;
    z-index: 2;
}

.section-continuation {
    background: linear-gradient(168deg, var(--shadow-wash) 0%, var(--deep-ground) 50%, var(--warm-ground) 100%);
    clip-path: polygon(0 0, 100% 4vw, 100% 100%, 0 100%);
    margin-top: -4vw;
    z-index: 1;
}

/* --- Diagonal Edge Line --- */
.section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 10;
    box-shadow: inset 0 -20px 40px rgba(30, 15, 8, 0.3);
}

/* --- Depth Planes --- */
.depth-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    transform: translateZ(-80px) scale(1.067);
    transform-style: preserve-3d;
    pointer-events: none;
    z-index: 1;
}

.depth-mid {
    position: relative;
    z-index: 2;
    transform: translateZ(0);
    transform-style: preserve-3d;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 120vh;
    padding: 15vh 8vw;
}

.depth-fg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    transform: translateZ(40px) scale(0.967);
    transform-style: preserve-3d;
    pointer-events: none;
    z-index: 3;
}

/* --- Bokeh Circles --- */
.bokeh {
    position: absolute;
    border-radius: 50%;
    background: radial-gradient(circle at center, var(--bokeh-warm) 0%, transparent 70%);
    animation: float linear infinite;
    pointer-events: none;
    will-change: transform;
}

@keyframes float {
    0% { transform: translateY(0px); }
    50% { transform: translateY(-30px); }
    100% { transform: translateY(0px); }
}

/* --- Geometric Circles (Background Decoration) --- */
.geo-circle {
    position: absolute;
    border-radius: 50%;
    border: 1px solid var(--annotation-ink);
    opacity: 0.10;
    pointer-events: none;
}

/* --- Cross Markers --- */
.cross-marker {
    position: absolute;
    font-family: var(--font-utility);
    font-size: 1.2rem;
    font-weight: 300;
    color: var(--annotation-ink);
    opacity: 0.25;
    pointer-events: none;
    letter-spacing: 0;
}

/* --- Typography --- */
.site-title {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: clamp(3rem, 10vw, 7rem);
    letter-spacing: 0.02em;
    color: var(--light-surface);
    text-align: center;
    margin-bottom: 2rem;
    line-height: 1.1;
}

.section-epigraph {
    font-family: var(--font-display);
    font-weight: 500;
    font-size: clamp(1.6rem, 3.5vw, 2.8rem);
    color: var(--light-surface);
    text-align: center;
    line-height: 1.4;
    margin-bottom: 4rem;
    max-width: 700px;
}

/* Section 3 (archive) sits on light background */
.section-archive .section-epigraph {
    color: var(--burnt-umber);
}

.threshold-subtitle {
    font-family: var(--font-body);
    font-weight: 300;
    font-size: clamp(1.1rem, 2vw, 1.5rem);
    line-height: 1.8;
    text-align: center;
    color: var(--light-surface);
    opacity: 0.85;
    max-width: 550px;
    margin: 0 auto;
}

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

/* --- Body Text --- */
.body-text {
    font-family: var(--font-body);
    font-weight: 400;
    font-size: clamp(1rem, 1.8vw, 1.25rem);
    line-height: 1.75;
    letter-spacing: 0.01em;
    color: var(--light-surface);
    max-width: 620px;
}

.body-text em {
    font-style: italic;
    font-weight: 300;
    color: var(--accent-glow);
}

/* --- Text Blocks (Section 2) --- */
.unraveling-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3rem;
    width: 100%;
    max-width: 800px;
}

.text-block {
    width: 100%;
    display: flex;
    justify-content: center;
}

.text-block-1 {
    align-self: flex-start;
    padding-left: 2vw;
}

.text-block-2 {
    align-self: center;
}

.text-block-3 {
    align-self: flex-end;
    padding-right: 2vw;
}

/* --- Archive Fragments (Section 3) --- */
.archive-content {
    position: relative;
    width: 100%;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.archive-fragment {
    position: absolute;
    max-width: 380px;
    padding: 1.5rem 2rem;
    background: rgba(245, 230, 211, 0.06);
    border-left: 2px solid rgba(212, 135, 63, 0.3);
}

.fragment-date {
    font-family: var(--font-utility);
    font-weight: 300;
    font-size: 0.75rem;
    color: var(--annotation-ink);
    opacity: 0.6;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    display: block;
    margin-bottom: 0.5rem;
}

.fragment-text {
    font-family: var(--font-body);
    font-weight: 400;
    font-size: clamp(0.95rem, 1.5vw, 1.1rem);
    line-height: 1.7;
    color: var(--burnt-umber);
}

.fragment-verdict {
    display: block;
    margin-top: 0.5rem;
    font-family: var(--font-display);
    font-weight: 500;
    font-size: 1rem;
    color: var(--accent-glow);
    font-style: italic;
}

.fragment-word {
    display: block;
    margin-top: 0.75rem;
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 1.8rem;
    color: var(--accent-glow);
    letter-spacing: 0.04em;
}

/* --- Thread SVG (Section 4) --- */
.thread-svg-container {
    width: 100%;
    max-width: 1000px;
    margin: 0 auto;
    position: relative;
}

.thread-svg {
    width: 100%;
    height: auto;
    overflow: visible;
}

.thread-path {
    stroke: var(--accent-glow);
    stroke-width: 2;
    stroke-linecap: round;
    fill: none;
}

.thread-label {
    font-family: 'Caveat', cursive;
    font-size: 28px;
    font-weight: 500;
    fill: var(--light-surface);
    transition: opacity 1.2s var(--ease-reveal);
}

/* --- Continuation (Section 5) --- */
.continuation-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2.5rem;
    text-align: center;
    max-width: 700px;
}

.continuation-text {
    text-align: center;
}

.continuation-text .body-text {
    text-align: center;
}

.closing-phrase {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: clamp(1.4rem, 3vw, 2.2rem);
    color: var(--light-surface);
    line-height: 1.5;
    opacity: 0.9;
}

.final-word {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: clamp(2rem, 6vw, 4rem);
    color: var(--accent-glow);
    letter-spacing: 0.03em;
    line-height: 1.2;
    text-shadow: 0 0 40px rgba(212, 135, 63, 0.3);
}

/* --- Annotations / Marginalia --- */
.annotation {
    position: absolute;
    font-family: var(--font-display);
    font-weight: 400;
    font-size: clamp(0.85rem, 1.5vw, 1.1rem);
    color: var(--annotation-ink);
    opacity: 0;
    pointer-events: none;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    gap: 0.4em;
    transition: opacity 1.2s var(--ease-reveal), text-shadow 0.6s ease;
}

.annotation.visible {
    opacity: 0.7;
    pointer-events: auto;
}

.annotation:hover {
    text-shadow: 0 0 20px rgba(212, 135, 63, 0.25);
}

.annotation-date {
    font-family: var(--font-utility);
    font-weight: 300;
    font-size: 0.75rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    opacity: 0.6;
}

.symbol {
    display: inline-block;
    vertical-align: middle;
}

/* --- Floating Quotation Marks --- */
.floating-quote {
    position: absolute;
    font-family: var(--font-display);
    font-size: 120px;
    color: var(--light-surface);
    opacity: 0.05;
    pointer-events: none;
    line-height: 1;
}

.floating-quote.left {
    top: 15%;
    left: 5%;
}

.floating-quote.right {
    bottom: 15%;
    right: 5%;
}

/* --- Progressive Disclosure / Reveal --- */
.reveal-element {
    opacity: 0;
    transform: translateY(20px);
    filter: blur(4px);
    transition: opacity 1.2s var(--ease-reveal),
                transform 1.2s var(--ease-reveal),
                filter 1.2s var(--ease-reveal);
}

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

/* Staggered annotation reveals */
.annotation-1 { transition-delay: 0s; }
.annotation-2 { transition-delay: 0.3s; }
.annotation-3 { transition-delay: 0s; }
.annotation-4 { transition-delay: 0.3s; }
.annotation-5 { transition-delay: 0.6s; }
.annotation-6 { transition-delay: 0s; }
.annotation-7 { transition-delay: 0.3s; }
.annotation-8 { transition-delay: 0s; }
.annotation-9 { transition-delay: 0.3s; }
.annotation-10 { transition-delay: 0s; }
.annotation-11 { transition-delay: 0.3s; }

/* Staggered archive fragment reveals */
.fragment-1.revealed { transition-delay: 0s; }
.fragment-2.revealed { transition-delay: 0.2s; }
.fragment-3.revealed { transition-delay: 0.4s; }
.fragment-4.revealed { transition-delay: 0.6s; }
.fragment-5.revealed { transition-delay: 0.8s; }
.fragment-6.revealed { transition-delay: 1.0s; }
.fragment-7.revealed { transition-delay: 1.2s; }

/* --- Responsive Adjustments --- */
@media (max-width: 768px) {
    .depth-mid {
        padding: 15vh 6vw;
    }

    .archive-fragment {
        position: relative;
        top: auto !important;
        left: auto !important;
        max-width: 100%;
        margin-bottom: 2rem;
        transform: none !important;
    }

    .archive-content {
        min-height: auto;
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 0;
    }

    .text-block-1,
    .text-block-2,
    .text-block-3 {
        align-self: center;
        padding-left: 0;
        padding-right: 0;
    }

    .floating-quote {
        font-size: 80px;
    }

    .annotation {
        font-size: 0.85rem;
    }
}

@media (max-width: 480px) {
    .section {
        min-height: 100vh;
    }

    .section-inner {
        min-height: 100vh;
    }

    .depth-mid {
        padding: 12vh 5vw;
    }

    .site-title {
        font-size: clamp(2.5rem, 12vw, 4rem);
    }
}