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

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-weight: 400;
    font-size: clamp(1.05rem, 1.2vw, 1.25rem);
    line-height: 1.72;
    color: #e8e0d4;
    background-color: #0b1628;
    transition: background-color 2s ease-in-out;
    overflow-x: hidden;
}

/* === NOISE TEXTURES === */
.leather-texture {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='300' height='300'%3E%3Cfilter id='n'%3E%3CfeTurbulence baseFrequency='0.9' numOctaves='6' type='fractalNoise' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.04'/%3E%3C/svg%3E");
}

/* === OPENING FOLIO === */
.section-folio {
    position: relative;
    width: 100%;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    background: linear-gradient(170deg, #0b1628 0%, #162a4a 100%);
    overflow: hidden;
}

.section-folio::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='400' height='400'%3E%3Cfilter id='n'%3E%3CfeTurbulence baseFrequency='0.9' numOctaves='6' type='fractalNoise' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.06'/%3E%3C/svg%3E");
    pointer-events: none;
}

.folio-content {
    position: relative;
    z-index: 2;
    padding-left: 38.2%;
    padding-right: 8vw;
}

@media (max-width: 1024px) {
    .folio-content {
        padding-left: 8vw;
    }
}

.hero-title {
    font-family: 'Playfair Display', Georgia, serif;
    font-weight: 700;
    font-size: clamp(3.5rem, 12vw, 9rem);
    letter-spacing: -0.01em;
    line-height: 1;
    color: #e8e0d4;
    transform: scale(1.08);
    opacity: 0;
    animation: heroEntrance 1.2s cubic-bezier(0.68, -0.55, 0.265, 1.55) 0.3s forwards;
}

@keyframes heroEntrance {
    to {
        transform: scale(1);
        opacity: 1;
    }
}

.hero-subtitle {
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-weight: 300;
    font-style: italic;
    font-size: clamp(1.1rem, 2vw, 1.6rem);
    color: #8fa3b8;
    margin-top: 0.8em;
}

.hero-rule {
    width: 40%;
    margin-top: 1.5em;
}

.gold-rule {
    height: 1px;
    background: #c9a96e;
    width: 0%;
}

.gold-rule.animate {
    animation: ruleExtend 1.4s cubic-bezier(0.68, -0.55, 0.265, 1.55) forwards;
}

@keyframes ruleExtend {
    to { width: 100%; }
}

.hero-rule.animate {
    animation: heroRuleExtend 1.4s cubic-bezier(0.68, -0.55, 0.265, 1.55) 0.8s forwards;
}

@keyframes heroRuleExtend {
    to { width: 40%; }
}

/* Quill flourish */
.quill-flourish {
    position: relative;
    width: 60px;
    height: 30px;
    margin-top: 1.5em;
    opacity: 0.4;
}

.quill-flourish::before {
    content: '';
    position: absolute;
    width: 40px;
    height: 40px;
    border: 1px solid #c9a96e;
    border-radius: 0 50% 50% 0;
    border-left: none;
    top: -10px;
    left: 0;
}

.quill-flourish::after {
    content: '';
    position: absolute;
    width: 30px;
    height: 30px;
    border: 1px solid #c9a96e;
    border-radius: 50% 0 0 50%;
    border-right: none;
    top: 0;
    left: 20px;
}

/* === MARBLE INTERLEAF === */
.section-marble {
    position: relative;
    width: 100%;
    height: 60vh;
    overflow: hidden;
    background:
        radial-gradient(ellipse at 30% 50%, #1e4d6e 0%, #1a2744 50%, #0b1628 100%);
}

.section-marble::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        conic-gradient(from 17deg at 25% 40%, transparent 0deg, rgba(212, 223, 231, 0.06) 30deg, transparent 60deg, rgba(201, 169, 110, 0.04) 120deg, transparent 180deg, rgba(212, 223, 231, 0.05) 240deg, transparent 300deg),
        conic-gradient(from 43deg at 70% 30%, transparent 0deg, rgba(201, 169, 110, 0.05) 45deg, transparent 90deg, rgba(212, 223, 231, 0.06) 160deg, transparent 200deg, rgba(201, 169, 110, 0.03) 280deg, transparent 340deg),
        conic-gradient(from 71deg at 50% 70%, transparent 0deg, rgba(212, 223, 231, 0.04) 60deg, transparent 120deg, rgba(201, 169, 110, 0.05) 200deg, transparent 260deg, rgba(212, 223, 231, 0.04) 320deg, transparent 360deg);
    mix-blend-mode: overlay;
}

.marble-overlay {
    position: absolute;
    inset: 0;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='500' height='500'%3E%3Cfilter id='m'%3E%3CfeTurbulence baseFrequency='0.65' numOctaves='4' seed='3' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23m)' opacity='0.08'/%3E%3C/svg%3E");
    mix-blend-mode: multiply;
    backdrop-filter: blur(2px);
}

@media (max-width: 640px) {
    .section-marble {
        height: 40vh;
    }
}

/* === CHAPTER SECTIONS === */
.section-chapter {
    position: relative;
    min-height: 120vh;
    width: 100%;
    padding: 8vh 8vw 12vh;
    background: linear-gradient(180deg, #162a4a 0%, #1c1915 100%);
}

.section-chapter::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='400' height='400'%3E%3Cfilter id='l'%3E%3CfeTurbulence baseFrequency='0.9' numOctaves='6' type='fractalNoise' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23l)' opacity='0.04'/%3E%3C/svg%3E");
    pointer-events: none;
    box-shadow: inset 0 0 200px rgba(12, 8, 4, 0.5);
}

.chapter-column {
    position: relative;
    max-width: 38em;
    margin-left: auto;
    z-index: 2;
}

@media (max-width: 1200px) {
    .chapter-column {
        margin-left: auto;
        margin-right: auto;
    }
}

.chapter-heading {
    font-family: 'Playfair Display', Georgia, serif;
    font-weight: 700;
    font-size: clamp(1.8rem, 4vw, 3rem);
    letter-spacing: 0.02em;
    color: #e8e0d4;
    margin-bottom: 1em;
    margin-top: 0.5em;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.8s ease, transform 0.8s ease;
}

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

.chapter-rule {
    width: 0%;
    max-width: 120px;
}

.chapter-rule.animate {
    animation: ruleExtend 1.4s cubic-bezier(0.68, -0.55, 0.265, 1.55) forwards;
}

.annotation-rule {
    width: 0%;
    max-width: 80px;
}

.annotation-rule.animate {
    animation: ruleExtend 1.4s cubic-bezier(0.68, -0.55, 0.265, 1.55) forwards;
}

.chapter-body {
    color: #e8e0d4;
    margin-bottom: 1.4em;
}

.chapter-body em {
    font-style: italic;
    color: #d4dfe7;
}

/* Drop Caps */
.drop-cap {
    float: left;
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 4.5em;
    line-height: 0.8;
    color: #c9a96e;
    margin-right: 0.1em;
    padding-top: 0.05em;
    font-weight: 700;
    transform: scale(0.85);
    opacity: 0;
    transition: transform 0.8s cubic-bezier(0.68, -0.55, 0.265, 1.55), opacity 0.8s ease;
}

.drop-cap.visible {
    transform: scale(1);
    opacity: 1;
}

/* Pull Quotes */
.pull-quote {
    font-family: 'Playfair Display', Georgia, serif;
    font-weight: 400;
    font-style: italic;
    font-size: clamp(1.3rem, 2.5vw, 1.8rem);
    color: #d4dfe7;
    line-height: 1.5;
    margin: 2em 0;
    padding: 1.5em;
    border-left: 2px solid #c9a96e;
    opacity: 0;
    transform: translateX(-30px);
    transition: opacity 0.9s cubic-bezier(0.68, -0.55, 0.265, 1.55), transform 0.9s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    backdrop-filter: blur(4px);
    background: rgba(11, 22, 40, 0.3);
}

.pull-quote.visible {
    opacity: 1;
    transform: translateX(0);
}

@media (min-width: 1200px) {
    .pull-quote {
        position: relative;
        left: -12em;
        width: 18em;
        border-left: 2px solid #c9a96e;
    }
}

/* Margin Markers */
.margin-marker {
    position: absolute;
    left: 3vw;
    top: 10vh;
    font-family: 'DM Mono', monospace;
    font-size: 0.7rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #8fa3b8;
    writing-mode: vertical-rl;
    transform: rotate(180deg);
    opacity: 0;
    transition: opacity 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    z-index: 3;
}

.margin-marker.visible {
    opacity: 1;
}

@media (max-width: 640px) {
    .margin-marker {
        display: none;
    }
}

/* === ANNOTATION SECTIONS === */
#annotation-1 { background-color: #0d1b2a; }
#annotation-2 { background-color: #0a2e38; }
#annotation-3 { background-color: #1c1915; }
#colophon-bg { background-color: #0f1a2e; }

.section-annotation {
    position: relative;
    width: 100%;
    padding: 8vh 8vw 10vh;
}

.section-annotation::before {
    content: '';
    position: absolute;
    inset: 0;
    box-shadow: inset 0 0 200px rgba(12, 8, 4, 0.3);
    pointer-events: none;
}

.annotation-column {
    position: relative;
    max-width: 38em;
    margin: 0 auto;
    z-index: 2;
}

/* === COLOPHON === */
.section-colophon {
    position: relative;
    width: 100%;
    min-height: 60vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(170deg, #0b1628 0%, #162a4a 100%);
    backdrop-filter: saturate(0.6);
}

.colophon-content {
    text-align: center;
    max-width: 30em;
    padding: 4em 2em;
}

.colophon-text {
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-weight: 400;
    font-size: 0.85rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #8fa3b8;
    line-height: 2;
}

.colophon-year {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 1.1rem;
    color: #c9a96e;
    letter-spacing: 0.2em;
    margin-top: 0.5em;
}

.colophon-spacer {
    height: 1em;
}

.colophon-rule {
    max-width: 200px;
    margin: 1.5em auto;
}

.colophon-rule.animate {
    animation: ruleExtend 1.4s cubic-bezier(0.68, -0.55, 0.265, 1.55) forwards;
}

/* === RESPONSIVE === */
@media (max-width: 640px) {
    .hero-title {
        font-size: clamp(2.5rem, 10vw, 4rem);
    }

    body {
        line-height: 1.8;
    }
}

/* Selection */
::selection {
    background: rgba(201, 169, 110, 0.3);
    color: #e8e0d4;
}
