/* === Design Palette: #b8a99a #d4b87a #7d8c6e #2b2d2a #5a5d58 #8a7b6b #c4a265 #f5f2ed #e8e3db === */

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

html {
    scroll-behavior: smooth;
    background-color: #f5f2ed;
    overflow-x: hidden;
}

body {
    font-family: 'Source Sans 3', sans-serif;
    font-weight: 300;
    font-size: clamp(1rem, 1.8vw, 1.25rem);
    line-height: 1.75;
    color: #5a5d58;
    background-color: #f5f2ed;
    -webkit-font-smoothing: antialiased;
}

/* === Bokeh Background === */
#bokeh-layer {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
    overflow: hidden;
}

.bokeh-circle {
    position: absolute;
    border-radius: 50%;
    pointer-events: none;
    will-change: transform;
}

/* === Leaf Veins Layer === */
#veins-layer {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    pointer-events: none;
    opacity: 0.04;
}

#veins-layer svg {
    width: 100%;
    height: 100%;
}

/* === Main Content === */
main {
    position: relative;
    z-index: 2;
    max-width: 1400px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: 0 2vw;
    padding: 0 4vw;
}

/* === Chapter Sections === */
.chapter {
    min-height: 100vh;
    display: flex;
    align-items: center;
    opacity: 0;
    transform: translateY(40px);
    transition: opacity 1.2s cubic-bezier(0.23, 1, 0.32, 1),
                transform 1.2s cubic-bezier(0.23, 1, 0.32, 1);
}

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

/* Ma-negative-space: alternating left/right placement */
.chapter--left {
    grid-column: 1 / 6;
}

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

.chapter__content {
    padding: 8vh 0;
}

/* === Chapter Number === */
.chapter__number {
    display: block;
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 300;
    font-size: 0.75rem;
    letter-spacing: 0.2em;
    color: #b8a99a;
    margin-bottom: 2rem;
    text-transform: uppercase;
}

/* === Chapter Title === */
.chapter__title {
    font-family: 'Playfair Display', serif;
    font-weight: 700;
    font-size: clamp(2.5rem, 6vw, 5.5rem);
    letter-spacing: -0.03em;
    line-height: 1.05;
    color: #2b2d2a;
    margin-bottom: 2.5rem;
}

/* === Gold Rule === */
.chapter__rule {
    width: 60px;
    height: 1px;
    background: linear-gradient(90deg, #d4b87a, #c4a265);
    margin-bottom: 2.5rem;
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 1s cubic-bezier(0.23, 1, 0.32, 1) 0.4s;
}

.chapter.is-visible .chapter__rule {
    transform: scaleX(1);
}

/* === Body Text === */
.chapter__body {
    font-family: 'Source Sans 3', sans-serif;
    font-weight: 300;
    font-size: clamp(1rem, 1.8vw, 1.25rem);
    line-height: 1.75;
    color: #5a5d58;
    margin-bottom: 1.5rem;
    max-width: 540px;
}

.chapter__body:last-child {
    margin-bottom: 0;
}

/* === Colophon === */
.colophon {
    grid-column: 1 / -1;
    padding: 12vh 0 6vh;
    text-align: center;
}

.colophon__text {
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 300;
    font-size: 0.7rem;
    letter-spacing: 0.15em;
    color: #b8a99a;
    text-transform: uppercase;
}

/* === Scroll-linked Background Shift === */
body.zone-1 { background-color: #f5f2ed; }
body.zone-2 { background-color: #f0ece5; }
body.zone-3 { background-color: #ebe7df; }
body.zone-4 { background-color: #f0ece5; }
body.zone-5 { background-color: #f5f2ed; }

body {
    transition: background-color 1.5s ease;
}

/* === Accent Colors === */
.chapter[data-chapter="3"] .chapter__rule {
    background: linear-gradient(90deg, #7d8c6e, #8a7b6b);
}

.chapter[data-chapter="5"] .chapter__number {
    color: #8a7b6b;
}

.colophon {
    border-top: 1px solid #e8e3db;
}

/* === Responsive === */
@media (max-width: 768px) {
    .chapter--left,
    .chapter--right {
        grid-column: 2 / 12;
    }

    .chapter {
        min-height: 80vh;
    }

    .chapter__title {
        font-size: clamp(2rem, 8vw, 3.5rem);
    }
}
