/* ============================================
   sustaining.quest — styles
   Cinematic horizontal scroll narrative
   ============================================ */

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

:root {
    --parchment: #f0ece4;
    --deep-navy: #1a2a42;
    --scholarly-blue: #2c4a6e;
    --steel-blue: #3a4f6a;
    --cerulean: #5b8fbf;
    --medium-blue: #4a7ba8;
    --ice-blue: #e8f0fd;
    --pale-blue: #f4f7fb;
    --gold-accent: #c49a3a;
    --muted-blue: #7a9bb8;
    --light-cerulean: #94b8db;
    --soft-blue: #a0c4e8;
    --fog-blue: #c8d8e8;
}

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

body {
    font-family: 'Lora', serif;
    background-color: var(--parchment);
    color: var(--deep-navy);
    height: 100vh;
    overflow: hidden;
    cursor: default;
}

/* --- Horizontal Scroll Container --- */
.horizontal-scroll-container {
    width: 100vw;
    height: 100vh;
    overflow: hidden;
    position: relative;
}

.horizontal-track {
    display: flex;
    height: 100vh;
    will-change: transform;
    transition: transform 0.05s linear;
    position: relative;
}

/* --- The Spine --- */
.spine {
    position: fixed;
    top: 50%;
    left: 0;
    width: 100%;
    height: 1px;
    background: var(--cerulean);
    opacity: 0.12;
    z-index: 1;
    pointer-events: none;
}

/* --- Progress Bar --- */
.progress-bar {
    position: fixed;
    top: 0;
    left: 0;
    height: 2px;
    width: 0%;
    background: linear-gradient(90deg, var(--cerulean), var(--medium-blue));
    z-index: 100;
    transition: width 0.3s ease;
}

/* --- Chapter Navigation --- */
.chapter-nav {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 1rem;
    z-index: 100;
}

.nav-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    border: 1.5px solid var(--cerulean);
    background: transparent;
    cursor: pointer;
    transition: all 0.4s ease;
    padding: 0;
}

.nav-dot.active {
    background: var(--cerulean);
    transform: scale(1.3);
}

.nav-dot:hover {
    background: var(--muted-blue);
}

/* --- Chapters --- */
.chapter {
    min-width: 100vw;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4rem 6rem;
    position: relative;
    flex-shrink: 0;
}

.chapter-content {
    max-width: 1200px;
    width: 100%;
    position: relative;
    z-index: 2;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.8s ease, transform 0.8s ease;
}

.chapter.visible .chapter-content {
    opacity: 1;
    transform: translateY(0);
}

/* --- Title Chapter --- */
.chapter-title .chapter-content {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
}

.title-illustration {
    width: 200px;
    height: 200px;
}

.site-title {
    font-family: 'Playfair Display', serif;
    font-weight: 700;
    font-style: italic;
    font-size: clamp(2.8rem, 5vw, 4.5rem);
    color: var(--scholarly-blue);
    letter-spacing: -0.02em;
    line-height: 1.1;
}

.title-dot {
    color: var(--gold-accent);
}

.site-subtitle {
    font-family: 'Inter', sans-serif;
    font-weight: 300;
    font-size: clamp(0.9rem, 1.5vw, 1.1rem);
    color: var(--steel-blue);
    letter-spacing: 0.04em;
    max-width: 400px;
}

.scroll-hint {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-top: 2rem;
    animation: hintPulse 3s ease-in-out infinite;
}

.hint-text {
    font-family: 'Space Mono', monospace;
    font-size: 0.7rem;
    color: var(--muted-blue);
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.hint-arrow {
    opacity: 0.6;
}

@keyframes hintPulse {
    0%, 100% { opacity: 0.5; transform: translateX(0); }
    50% { opacity: 1; transform: translateX(5px); }
}

/* --- Chapter Headers --- */
.chapter-header {
    display: flex;
    align-items: baseline;
    gap: 1.5rem;
    margin-bottom: 2.5rem;
}

.chapter-number {
    font-family: 'Space Mono', monospace;
    font-size: 0.75rem;
    color: var(--cerulean);
    letter-spacing: 0.1em;
    opacity: 0.6;
}

.chapter-title h2,
h2.chapter-title {
    font-family: 'Playfair Display', serif;
    font-weight: 700;
    font-style: italic;
    font-size: clamp(2rem, 4vw, 3.2rem);
    color: var(--scholarly-blue);
    letter-spacing: -0.02em;
}

/* --- Chapter Body --- */
.chapter-body {
    display: flex;
    gap: 4rem;
    align-items: center;
}

.chapter-body.two-column {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4rem;
    align-items: center;
}

.chapter-body.two-column.reverse {
    direction: rtl;
}

.chapter-body.two-column.reverse > * {
    direction: ltr;
}

.chapter-body.centered {
    flex-direction: column;
    text-align: center;
    align-items: center;
}

/* --- Text --- */
.text-column {
    display: flex;
    flex-direction: column;
    gap: 1.2rem;
}

.text-column.wide {
    max-width: 700px;
}

.body-text {
    font-family: 'Lora', serif;
    font-size: clamp(0.95rem, 1.3vw, 1.1rem);
    line-height: 1.75;
    color: var(--deep-navy);
    max-width: 55ch;
}

.body-text.large {
    font-size: clamp(1.1rem, 1.6vw, 1.3rem);
    line-height: 1.8;
    max-width: 60ch;
}

.body-text em {
    font-style: italic;
    color: var(--scholarly-blue);
}

.annotation-text {
    font-family: 'Space Mono', monospace;
    font-size: 0.72rem;
    color: var(--muted-blue);
    letter-spacing: 0.02em;
    line-height: 1.6;
    padding-left: 1rem;
    border-left: 1.5px solid var(--cerulean);
    opacity: 0.7;
    margin-top: 0.5rem;
}

.annotation-text .italic {
    font-style: italic;
}

.annotation-text .mono {
    font-style: normal;
}

/* --- Illustrations --- */
.illustration-column {
    display: flex;
    align-items: center;
    justify-content: center;
}

.svg-illustration {
    width: 100%;
    max-width: 380px;
    height: auto;
}

/* Breathing animation for SVGs */
.breathing {
    animation: breathe 6s ease-in-out infinite;
}

@keyframes breathe {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.015); }
}

/* --- Horizon Line (final chapter) --- */
.horizon-line {
    width: 100%;
    max-width: 600px;
    margin-top: 3rem;
}

.horizon-line svg {
    width: 100%;
    height: auto;
}

/* --- Colophon --- */
.colophon {
    font-family: 'Space Mono', monospace;
    font-size: 0.7rem;
    color: var(--muted-blue);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    margin-top: 3rem;
    opacity: 0.5;
}

/* --- Chapter separator markers on spine --- */
.chapter::after {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--cerulean);
    opacity: 0.25;
    transform: translate(-3px, -3px);
}

.chapter-title::after {
    display: none;
}

/* --- Reveal animations for elements --- */
.chapter .body-text,
.chapter .annotation-text {
    opacity: 0;
    transform: translateY(15px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.chapter.visible .body-text,
.chapter.visible .annotation-text {
    opacity: 1;
    transform: translateY(0);
}

.chapter.visible .body-text:nth-child(1) { transition-delay: 0.1s; }
.chapter.visible .body-text:nth-child(2) { transition-delay: 0.25s; }
.chapter.visible .body-text:nth-child(3) { transition-delay: 0.4s; }
.chapter.visible .annotation-text { transition-delay: 0.55s; }

.chapter .svg-illustration {
    opacity: 0;
    transition: opacity 1s ease 0.3s;
}

.chapter.visible .svg-illustration {
    opacity: 1;
}

/* --- Responsive --- */
@media (max-width: 900px) {
    .chapter {
        padding: 3rem;
    }

    .chapter-body.two-column {
        grid-template-columns: 1fr;
        gap: 2rem;
    }

    .chapter-body.two-column.reverse {
        direction: ltr;
    }

    .svg-illustration {
        max-width: 260px;
    }

    .body-text {
        max-width: 100%;
    }
}

@media (max-width: 600px) {
    .chapter {
        padding: 2rem 1.5rem;
    }

    .chapter-header {
        gap: 0.75rem;
    }

    .title-illustration {
        width: 140px;
        height: 140px;
    }
}
