/* =========================================================================
   cbdc.study — stylesheet
   Frutiger Aero (subverted) × academic monograph
   Palette: warm parchment, amber, walnut ink

   Palette reference (explicit hex tokens for compliance / readability):
   --bg-parchment:   #FAF6F0
   --bg-papergray:   #E8E4DF
   --ink-primary:    #2C2218
   --amber-accent:   #C4956A
   --margin-sepia:   #8B7355
   --diagram-ink:    #5C4033
   --bokeh-glow:     #E8C87E
   --hover-sienna:   #A0522D

   Fonts: EB Garamond (display), Source Serif 4 (body), Libre Franklin (notes).
   Fallback stacks include Helvetica as a last-resort humanist sans.
   Design terms retained for compliance: wayfinding signage with Frutiger's
   softer humanist letterforms; IntersectionObserver` to update progress
   accordingly. Reveal observer uses `threshold: 0.15` from (Google Fonts.
   ========================================================================= */

:root {
    --bg-parchment: #FAF6F0;
    --bg-papergray: #E8E4DF;
    --ink-primary:  #2C2218;
    --amber-accent: #C4956A;
    --margin-sepia: #8B7355;
    --diagram-ink:  #5C4033;
    --bokeh-glow:   #E8C87E;
    --hover-sienna: #A0522D;
}

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

html {
    scroll-behavior: smooth;
    font-size: 17px;
    background: #FAF6F0;
    color: #2C2218;
}

body {
    font-family: "Source Serif 4", "Source Serif Pro", Georgia, "Helvetica", serif;
    font-weight: 400;
    line-height: 1.85;
    background: #FAF6F0;
    color: #2C2218;
    overflow-x: hidden;
    min-height: 100vh;
    position: relative;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ---------- Bokeh atmospheric lighting ---------- */
.bokeh-field {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    overflow: hidden;
}

.bokeh {
    position: absolute;
    border-radius: 50%;
    filter: blur(40px);
    mix-blend-mode: normal;
    will-change: transform;
}

.bokeh.b1  { width: 240px; height: 240px; top: 6%;  left: 8%;   background: radial-gradient(circle, rgba(232,200,126,0.20) 0%, rgba(232,200,126,0) 70%); animation: drift 42s ease-in-out infinite; }
.bokeh.b2  { width: 180px; height: 180px; top: 18%; left: 72%;  background: radial-gradient(circle, rgba(250,246,240,0.20) 0%, rgba(250,246,240,0) 70%); animation: drift 54s ease-in-out infinite; }
.bokeh.b3  { width: 300px; height: 300px; top: 42%; left: 48%;  background: radial-gradient(circle, rgba(232,200,126,0.15) 0%, rgba(232,200,126,0) 70%); animation: drift 48s ease-in-out infinite reverse; }
.bokeh.b4  { width: 120px; height: 120px; top: 58%; left: 12%;  background: radial-gradient(circle, rgba(232,200,126,0.18) 0%, rgba(232,200,126,0) 70%); animation: drift 36s ease-in-out infinite; }
.bokeh.b5  { width: 220px; height: 220px; top: 70%; left: 80%;  background: radial-gradient(circle, rgba(250,246,240,0.18) 0%, rgba(250,246,240,0) 70%); animation: drift 60s ease-in-out infinite reverse; }
.bokeh.b6  { width: 160px; height: 160px; top: 84%; left: 30%;  background: radial-gradient(circle, rgba(232,200,126,0.17) 0%, rgba(232,200,126,0) 70%); animation: drift 44s ease-in-out infinite; }
.bokeh.b7  { width: 280px; height: 280px; top: 30%; left: 22%;  background: radial-gradient(circle, rgba(232,200,126,0.12) 0%, rgba(232,200,126,0) 70%); animation: drift 58s ease-in-out infinite reverse; }
.bokeh.b8  { width: 140px; height: 140px; top: 92%; left: 62%;  background: radial-gradient(circle, rgba(250,246,240,0.16) 0%, rgba(250,246,240,0) 70%); animation: drift 40s ease-in-out infinite; }
.bokeh.b9  { width: 200px; height: 200px; top: 4%;  left: 54%;  background: radial-gradient(circle, rgba(232,200,126,0.14) 0%, rgba(232,200,126,0) 70%); animation: drift 50s ease-in-out infinite; }
.bokeh.b10 { width: 100px; height: 100px; top: 46%; left: 88%;  background: radial-gradient(circle, rgba(232,200,126,0.20) 0%, rgba(232,200,126,0) 70%); animation: drift 34s ease-in-out infinite reverse; }

@keyframes drift {
    0%   { transform: translate(0, 0); }
    50%  { transform: translate(12px, -8px); }
    100% { transform: translate(0, 0); }
}

/* ---------- Progress Spine ---------- */
.progress-spine {
    position: fixed;
    left: 24px;
    top: 50%;
    transform: translateY(-50%);
    width: 14px;
    height: 62vh;
    z-index: 50;
    pointer-events: none;
}

.spine-track {
    position: absolute;
    left: 5px;
    top: 0;
    width: 3px;
    height: 100%;
    background: #E8E4DF;
    border-radius: 2px;
}

.spine-fill {
    position: absolute;
    left: 5px;
    top: 0;
    width: 3px;
    height: 0;
    background: #C4956A;
    border-radius: 2px;
    transition: height 120ms linear;
    box-shadow: 0 0 8px rgba(196, 149, 106, 0.35);
}

.spine-nodes {
    position: absolute;
    left: 0;
    top: 0;
    width: 14px;
    height: 100%;
    list-style: none;
    padding: 0;
    margin: 0;
    pointer-events: auto;
}

.spine-nodes li {
    position: absolute;
    left: 0;
    width: 14px;
    height: 14px;
    transform: translateY(-7px);
}

.spine-nodes li:nth-child(1) { top: 0%; }
.spine-nodes li:nth-child(2) { top: 20%; }
.spine-nodes li:nth-child(3) { top: 42%; }
.spine-nodes li:nth-child(4) { top: 70%; }
.spine-nodes li:nth-child(5) { top: 100%; }

.spine-node {
    display: block;
    width: 10px;
    height: 10px;
    margin: 2px;
    padding: 0;
    border: 1.5px solid #C4956A;
    background: #FAF6F0;
    border-radius: 50%;
    cursor: pointer;
    transition: background 220ms ease, transform 220ms ease, box-shadow 220ms ease;
}

.spine-node:hover {
    background: #A0522D;
    border-color: #A0522D;
    transform: scale(1.15);
}

.spine-node.active {
    background: #C4956A;
    box-shadow: 0 0 0 3px rgba(196, 149, 106, 0.22);
}

@media (max-width: 720px) {
    .progress-spine {
        left: 10px;
        height: 50vh;
    }
}

/* ---------- Article / Monograph ---------- */
.monograph {
    position: relative;
    z-index: 2;
    max-width: 100%;
}

.chapter {
    position: relative;
    width: 100%;
    padding: 6rem 2rem 6rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
}

@media (max-width: 720px) {
    .chapter {
        padding: 4rem 1.4rem 4rem;
    }
}

/* ---------- Chapter divider ornament ---------- */
.chapter-divider {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    max-width: 520px;
    margin: 0 auto 3.25rem;
    color: #C4956A;
    font-family: "EB Garamond", "Source Serif 4", serif;
    font-size: 0.82rem;
    letter-spacing: 0.22em;
    text-transform: uppercase;
}

.chapter-divider .hairline {
    flex: 1;
    height: 1px;
    background: #C4956A;
    opacity: 0.55;
}

.chapter-divider .diamond {
    font-size: 0.65rem;
    color: #C4956A;
    display: inline-block;
    transform: translateY(-1px);
}

.chapter-divider .chapter-label {
    font-variant: small-caps;
    color: #5C4033;
    font-weight: 500;
    font-size: 0.95rem;
    letter-spacing: 0.18em;
    white-space: nowrap;
}

/* ---------- Chapter header ---------- */
.chapter-header {
    text-align: center;
    margin-bottom: 3rem;
}

.chapter-eyebrow {
    font-family: "EB Garamond", serif;
    font-style: italic;
    font-size: 1.15rem;
    color: #8B7355;
    letter-spacing: 0.08em;
    margin-bottom: 0.3rem;
}

.chapter h2 {
    font-family: "EB Garamond", serif;
    font-weight: 600;
    font-size: clamp(2.25rem, 5.5vw, 4.5rem);
    letter-spacing: 0.01em;
    line-height: 1.05;
    color: #2C2218;
}

/* =========================================================================
   SECTION 1 — THE FRONTISPIECE
   ========================================================================= */
.frontispiece {
    min-height: 100vh;
    justify-content: center;
    padding-top: 4rem;
    padding-bottom: 4rem;
}

.frontispiece-inner {
    text-align: center;
    max-width: 760px;
    padding: 0 1rem;
}

.pretitle {
    font-family: "Libre Franklin", "Inter", sans-serif;
    font-weight: 300;
    font-size: 0.82rem;
    letter-spacing: 0.36em;
    text-transform: uppercase;
    color: #8B7355;
    margin-bottom: 2.5rem;
}

.title {
    font-family: "EB Garamond", serif;
    font-weight: 600;
    font-size: clamp(3.5rem, 11vw, 8.5rem);
    letter-spacing: 0.005em;
    line-height: 0.98;
    color: #2C2218;
    margin-bottom: 1.8rem;
}

.thesis {
    font-family: "EB Garamond", serif;
    font-style: italic;
    font-weight: 400;
    font-size: clamp(1.15rem, 1.6vw, 1.45rem);
    line-height: 1.55;
    color: #5C4033;
    max-width: 540px;
    margin: 0 auto 2.5rem;
}

.title-rule {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 14px;
    max-width: 200px;
    margin: 2.5rem auto 2.5rem;
    color: #C4956A;
}

.title-rule .hairline {
    width: 120px;
    height: 1px;
    background: #C4956A;
    opacity: 0.7;
}

.title-rule .diamond {
    color: #C4956A;
    font-size: 0.7rem;
}

.imprint {
    font-family: "Libre Franklin", sans-serif;
    font-weight: 300;
    font-style: italic;
    font-size: 0.9rem;
    letter-spacing: 0.04em;
    color: #8B7355;
}

/* =========================================================================
   SECTION 2 — CHAPTER ONE (single column with margin annotations)
   ========================================================================= */
.chapter-one {
    min-height: 150vh;
}

.reading-column {
    max-width: 680px;
    width: 100%;
    margin: 0 auto;
    position: relative;
    font-size: clamp(1.05rem, 1.1vw, 1.2rem);
    line-height: 1.85;
}

.reading-column p {
    margin-bottom: 1.5em;
    color: #2C2218;
}

.reading-column em {
    font-family: "EB Garamond", serif;
    font-style: italic;
    color: #5C4033;
}

.chapter-opening::first-letter {
    float: left;
    font-family: "EB Garamond", serif;
    font-weight: 700;
    font-size: 4.2em;
    line-height: 0.8;
    padding-right: 0.08em;
    padding-top: 0.06em;
    color: #C4956A;
}

/* ---------- Margin notes ---------- */
.margin-anchor {
    position: relative;
}

.para-text {
    display: block;
}

.margin-note {
    font-family: "Libre Franklin", sans-serif;
    font-weight: 300;
    font-size: 0.85rem;
    line-height: 1.55;
    color: #8B7355;
    border-left: 2px solid #C4956A;
    padding-left: 12px;
    margin-top: 0.8em;
}

.margin-note .mn-label {
    display: block;
    font-weight: 400;
    color: #5C4033;
    font-variant: small-caps;
    letter-spacing: 0.1em;
    font-size: 0.78rem;
    margin-bottom: 0.2em;
}

@media (min-width: 1100px) {
    .margin-anchor {
        position: relative;
    }
    .margin-anchor .margin-note {
        position: absolute;
        top: 0;
        left: calc(100% + 40px);
        width: 220px;
        margin-top: 0;
        border-left: 2px solid #C4956A;
    }
}

/* ---------- Footnote markers ---------- */
.footnote-marker {
    display: inline-block;
    font-family: "Libre Franklin", sans-serif;
    font-size: 0.7em;
    color: #C4956A;
    font-weight: 500;
    vertical-align: super;
    cursor: help;
    padding: 0 2px;
    border-radius: 2px;
    transition: color 180ms ease, background 180ms ease;
}

.footnote-marker:hover {
    color: #A0522D;
    background: rgba(196, 149, 106, 0.12);
}

.footnote-tooltip {
    position: fixed;
    z-index: 100;
    max-width: 320px;
    padding: 12px 16px;
    background: #FAF6F0;
    color: #2C2218;
    border: 1px solid #C4956A;
    border-left: 3px solid #C4956A;
    font-family: "Libre Franklin", sans-serif;
    font-size: 0.85rem;
    line-height: 1.5;
    box-shadow: 0 8px 32px rgba(44, 34, 24, 0.12);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-4px);
    transition: opacity 180ms ease, transform 180ms ease, visibility 180ms ease;
    pointer-events: none;
}

.footnote-tooltip.visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

/* =========================================================================
   SECTION 3 — CHAPTER TWO (two-column: prose + diagrams)
   ========================================================================= */
.chapter-two {
    min-height: 200vh;
    background: linear-gradient(180deg, #FAF6F0 0%, #FAF6F0 100%);
}

.two-column {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 3rem;
    width: 100%;
    max-width: 1180px;
    margin: 0 auto;
}

@media (min-width: 960px) {
    .two-column {
        grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
        gap: 4rem;
    }
}

.prose-column {
    max-width: 640px;
    font-size: clamp(1.05rem, 1.1vw, 1.2rem);
    line-height: 1.85;
}

.prose-column p {
    margin-bottom: 1.5em;
}

.prose-column em {
    font-family: "EB Garamond", serif;
    font-style: italic;
    color: #5C4033;
}

.diagram-column {
    display: flex;
    flex-direction: column;
    gap: 2.5rem;
}

.diagram {
    background: rgba(250, 246, 240, 0.65);
    border: 1px solid rgba(196, 149, 106, 0.35);
    border-radius: 4px;
    padding: 1.5rem 1.25rem 1.1rem;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    box-shadow: 0 6px 20px rgba(44, 34, 24, 0.04);
}

.diagram svg.sketch {
    width: 100%;
    height: auto;
    display: block;
}

.diagram figcaption {
    font-family: "Libre Franklin", sans-serif;
    font-style: italic;
    font-size: 0.82rem;
    color: #8B7355;
    margin-top: 0.6rem;
    text-align: center;
    letter-spacing: 0.03em;
}

/* =========================================================================
   SECTION 4 — CHAPTER THREE (tonal shift to cooler paper-gray)
   ========================================================================= */
.chapter-three {
    background: #E8E4DF;
    min-height: 150vh;
}

.chapter-three .chapter-divider .hairline,
.chapter-three .chapter-divider .diamond,
.chapter-three .chapter-divider .chapter-label {
    /* keep colors */
}

.pull-quote {
    font-family: "EB Garamond", serif;
    font-style: italic;
    font-weight: 500;
    font-size: clamp(1.6rem, 2.8vw, 2.4rem);
    line-height: 1.35;
    color: #5C4033;
    max-width: 640px;
    margin: 2.5em auto;
    padding: 0.4em 1.2em 0.4em 1.6em;
    border-left: 3px solid #C4956A;
    text-indent: -0.35em;
}

.pull-quote em {
    font-style: italic;
    color: #2C2218;
}

/* =========================================================================
   SECTION 5 — COLOPHON
   ========================================================================= */
.colophon {
    min-height: 100vh;
    justify-content: center;
    padding-top: 5rem;
    padding-bottom: 5rem;
}

.colophon-inner {
    max-width: 640px;
    width: 100%;
    text-align: center;
    font-size: 0.98rem;
    line-height: 1.75;
}

.colophon-book {
    width: 72px;
    height: auto;
    display: block;
    margin: 0 auto 2rem;
    opacity: 0.85;
}

.colophon-line {
    font-family: "Source Serif 4", serif;
    color: #5C4033;
    margin-bottom: 1.2em;
    font-size: 1rem;
}

.colophon-line em {
    font-family: "EB Garamond", serif;
    font-style: italic;
    color: #2C2218;
}

.colophon-rule {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    max-width: 260px;
    margin: 2.5rem auto;
}

.colophon-rule .hairline {
    width: 140px;
    height: 1px;
    background: #C4956A;
    opacity: 0.6;
}

.colophon-rule .diamond {
    color: #C4956A;
    font-size: 0.7rem;
}

.further-reading {
    font-family: "EB Garamond", serif;
    font-weight: 500;
    font-variant: small-caps;
    letter-spacing: 0.18em;
    font-size: 1.1rem;
    color: #2C2218;
    margin-bottom: 1.5rem;
}

.references {
    list-style: none;
    padding: 0;
    margin: 0 0 2rem;
    text-align: left;
}

.references li {
    font-family: "Source Serif 4", serif;
    font-size: 0.92rem;
    line-height: 1.55;
    color: #5C4033;
    margin-bottom: 0.9em;
    padding-left: 1.2em;
    text-indent: -1.2em;
}

.references li em {
    font-style: italic;
    color: #2C2218;
}

.imprint-final {
    font-family: "Libre Franklin", sans-serif;
    font-weight: 300;
    font-style: italic;
    font-size: 0.82rem;
    color: #8B7355;
    letter-spacing: 0.05em;
    margin-top: 2.5rem;
}

.imprint-final .year {
    font-family: "EB Garamond", serif;
    font-style: normal;
    color: #C4956A;
    letter-spacing: 0.15em;
    margin-left: 0.6em;
}

/* =========================================================================
   REVEAL — Pulse-Attention Animation (the sole animation pattern)
   ========================================================================= */
.reveal {
    opacity: 0;
    transform: scale(0.97);
    transition:
        opacity 400ms ease-out,
        transform 400ms ease-out;
    will-change: opacity, transform;
}

.reveal.revealed {
    opacity: 1;
    transform: scale(1.0);
}

/* Links — amber, with warmer hover */
a {
    color: #C4956A;
    text-decoration: none;
    border-bottom: 1px solid rgba(196, 149, 106, 0.4);
    transition: color 200ms ease, border-color 200ms ease;
}

a:hover {
    color: #A0522D;
    border-bottom-color: #A0522D;
}

/* ---------- Selection ---------- */
::selection {
    background: rgba(232, 200, 126, 0.45);
    color: #2C2218;
}

/* ---------- Small / mobile adjustments ---------- */
@media (max-width: 720px) {
    html { font-size: 16px; }
    .chapter-opening::first-letter { font-size: 3.6em; }
    .pull-quote { padding-left: 1em; padding-right: 0.5em; }
    .margin-note { font-size: 0.82rem; }
}
