/* ============================================================
   economic.day - The Daily Annals of Commerce
   A leather-bound almanac of money.
   ============================================================ */

:root {
    --paper: #F0E6D2;
    --paper-2: #E8DCC0;
    --ink: #2A1A0E;
    --ink-2: #6B4A2E;
    --ribbon: #8E2A1F;
    --brass: #A8762E;
    --moss: #3D5641;
    --leather: #1A1208;
    --leather-2: #2A1A0E;

    --gutter-col: 28px;
    --gutter-spine: 64px;
    --baseline: 28px;

    --serif-body: 'Cormorant Garamond', 'EB Garamond', Georgia, serif;
    --serif-caption: 'EB Garamond', 'Cormorant Garamond', Georgia, serif;
    --serif-archive: 'IM Fell English SC', 'Cormorant Garamond', Georgia, serif;
    --serif-data: 'Old Standard TT', 'EB Garamond', Georgia, serif;

    --turn-dur: 1100ms;
    --turn-ease: cubic-bezier(0.55, 0.05, 0.22, 1);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

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

body {
    font-family: var(--serif-body);
    font-size: 16px;
    line-height: 1.62;
    color: var(--ink);
    font-variant-numeric: oldstyle-nums;
    font-feature-settings: "liga", "dlig";
    background: #14100A;
    background-image:
        radial-gradient(ellipse at 30% 20%, rgba(168, 118, 46, 0.06), transparent 60%),
        radial-gradient(ellipse at 70% 80%, rgba(61, 86, 65, 0.04), transparent 50%),
        repeating-linear-gradient(45deg, rgba(0,0,0,0.04) 0 2px, transparent 2px 8px),
        radial-gradient(circle at center, #2A1A0E 0%, #14100A 80%);
    perspective: 1800px;
    perspective-origin: 50% 50%;
}

/* Wood-grain undertone behind everything */
body::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: 0;
    background:
        repeating-linear-gradient(91deg,
            rgba(74, 46, 26, 0.18) 0 2px,
            transparent 2px 14px),
        linear-gradient(180deg, #1F1408 0%, #2A1A0E 50%, #14100A 100%);
    pointer-events: none;
}

/* ============================================================
   Volume Spine (persistent left)
   ============================================================ */
.volume-spine {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 22px;
    z-index: 200;
    background:
        linear-gradient(180deg, #1A1208 0%, #2A1A0E 8%, #1A1208 50%, #2A1A0E 92%, #1A1208 100%),
        linear-gradient(90deg, #14100A, #2A1A0E, #14100A);
    background-blend-mode: multiply;
    box-shadow:
        inset -2px 0 4px rgba(0, 0, 0, 0.6),
        inset 2px 0 1px rgba(168, 118, 46, 0.12),
        4px 0 18px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 14vh;
    cursor: default;
}

.spine-band {
    width: 100%;
    padding: 10px 0;
    background:
        linear-gradient(180deg,
            rgba(168, 118, 46, 0.3) 0%,
            rgba(168, 118, 46, 0.45) 40%,
            rgba(168, 118, 46, 0.3) 100%);
    border-top: 0.6px solid rgba(168, 118, 46, 0.5);
    border-bottom: 0.6px solid rgba(168, 118, 46, 0.5);
    box-shadow: inset 0 0 6px rgba(0, 0, 0, 0.4);
    cursor: pointer;
    transition: filter 220ms ease;
}

.spine-band:hover {
    filter: brightness(1.3);
}

.spine-stamp {
    display: block;
    color: var(--brass);
    font-family: var(--serif-archive);
    font-size: 8px;
    letter-spacing: 0.18em;
    text-align: center;
    writing-mode: vertical-rl;
    transform: rotate(180deg);
    text-shadow: 0 0 2px rgba(168, 118, 46, 0.4);
}

.spine-headband, .spine-tailband {
    position: absolute;
    left: 0;
    width: 22px;
    height: 6px;
    background:
        repeating-linear-gradient(90deg,
            #8E2A1F 0 2px,
            #6B4A2E 2px 4px,
            #E8DCC0 4px 6px);
    box-shadow: inset 0 0 2px rgba(0,0,0,0.5);
}

.spine-headband { top: 0; }
.spine-tailband { bottom: 0; }

/* ============================================================
   Bookmark Ribbon
   ============================================================ */
.bookmark-ribbon {
    position: fixed;
    top: 0;
    left: 30%;
    width: 14px;
    height: 70vh;
    z-index: 150;
    background:
        linear-gradient(180deg, #8E2A1F 0%, #7A2218 60%, #5C1810 100%);
    background-image:
        repeating-linear-gradient(180deg,
            rgba(255, 255, 255, 0.04) 0 1px,
            transparent 1px 3px),
        linear-gradient(90deg, rgba(0,0,0,0.2), transparent 30%, transparent 70%, rgba(0,0,0,0.2));
    box-shadow:
        2px 0 4px rgba(0, 0, 0, 0.4),
        inset 1px 0 0 rgba(255, 255, 255, 0.08);
    pointer-events: none;
    transition: left 240ms ease;
}

.ribbon-fold {
    position: absolute;
    bottom: -8px;
    left: 0;
    width: 14px;
    height: 14px;
    background: #5C1810;
    clip-path: polygon(0 0, 100% 0, 50% 100%, 0 50%);
}

/* ============================================================
   The Volume (paginated container)
   ============================================================ */
.volume {
    position: fixed;
    inset: 0;
    z-index: 10;
    transform-style: preserve-3d;
    overflow: hidden;
}

/* Each spread = an open book */
.spread {
    position: absolute;
    inset: 0;
    display: grid;
    grid-template-columns: 1fr 1fr;
    background: var(--paper);
    background-image:
        radial-gradient(ellipse at 20% 30%, rgba(232, 220, 192, 0.5), transparent 60%),
        radial-gradient(ellipse at 80% 70%, rgba(232, 220, 192, 0.4), transparent 60%),
        url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='200' height='200'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' seed='5'/><feColorMatrix values='0 0 0 0 0.16  0 0 0 0 0.10  0 0 0 0 0.05  0 0 0 0.06 0'/></filter><rect width='200' height='200' filter='url(%23n)' opacity='0.5'/></svg>"),
        repeating-conic-gradient(from 0deg at 50% 50%,
            rgba(74, 46, 26, 0.012) 0deg 20deg,
            transparent 20deg 40deg),
        var(--paper);
    box-shadow:
        inset 0 0 80px rgba(74, 46, 26, 0.18),
        inset 0 0 200px rgba(74, 46, 26, 0.08),
        0 24px 60px rgba(0, 0, 0, 0.55),
        0 0 0 22px transparent;
    transform-origin: center center;
    transform: translateX(110%);
    transition: transform var(--turn-dur) var(--turn-ease);
    will-change: transform;
    pointer-events: none;
    padding-left: 22px; /* room for the spine */
}

.spread.active {
    transform: translateX(0);
    pointer-events: auto;
    z-index: 20;
}

.spread.prev {
    transform: translateX(-110%);
    z-index: 15;
}

.spread.turning-out {
    transform: translateX(-110%);
    z-index: 30;
}

.spread.turning-in {
    transform: translateX(0);
    z-index: 25;
}

/* Center gutter shadow - per DESIGN.md, #4A2E1A at 22% opacity fading to transparent */
.spread:not(.spread--cover)::after {
    content: "";
    position: absolute;
    top: 0;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 18px;
    pointer-events: none;
    background: linear-gradient(90deg,
        transparent 0%,
        rgba(74, 46, 26, 0.22) 50%,
        transparent 100%);
    border-left: 0.4px solid #4A2E1A22;
    z-index: 4;
}

/* Page (verso/recto) */
.page {
    position: relative;
    height: 100%;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 56px 64px 80px 64px;
}

.page--verso {
    border-right: 0.4px solid rgba(74, 46, 26, 0.2);
    padding-right: 80px; /* generous spine gutter */
}

.page--recto {
    padding-left: 80px;
    padding-right: 80px;
}

.page::-webkit-scrollbar {
    width: 6px;
}
.page::-webkit-scrollbar-track {
    background: rgba(74, 46, 26, 0.05);
}
.page::-webkit-scrollbar-thumb {
    background: rgba(107, 74, 46, 0.4);
    border-radius: 3px;
}

.page-inner {
    max-width: 600px;
    margin: 0 auto;
    position: relative;
}

/* ============================================================
   Folio numerals (top corners) and Running heads (bottom)
   ============================================================ */
.folio {
    position: absolute;
    top: 24px;
    font-family: var(--serif-body);
    font-size: 11px;
    font-weight: 400;
    letter-spacing: 0.18em;
    color: var(--ink-2);
    text-transform: uppercase;
    font-variant: small-caps;
    font-variant-numeric: oldstyle-nums;
}

.page--verso .folio { left: 64px; }
.page--recto .folio { right: 64px; }

.running-head {
    position: absolute;
    bottom: 24px;
    font-family: var(--serif-body);
    font-size: 11px;
    font-style: italic;
    color: var(--ink-2);
    letter-spacing: 0.04em;
    border-top: 0.6px solid var(--ink-2);
    padding-top: 6px;
    width: calc(100% - 128px);
}

.running-head--verso {
    left: 64px;
    text-transform: uppercase;
    font-variant: small-caps;
    letter-spacing: 0.12em;
    font-style: normal;
}

.running-head--recto {
    right: 64px;
    text-align: right;
}

/* ============================================================
   Cover (frontispiece, dark leather)
   ============================================================ */
.spread--cover {
    grid-template-columns: 1fr;
    background: var(--leather);
    background-image: none;
    box-shadow:
        inset 0 0 200px rgba(0, 0, 0, 0.7),
        0 24px 60px rgba(0, 0, 0, 0.7);
}

.cover {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: var(--leather);
    display: flex;
    align-items: center;
    justify-content: center;
}

.cover-leather {
    position: absolute;
    inset: 0;
    background:
        radial-gradient(ellipse at 30% 20%, #2E1F12 0%, #1A1208 60%),
        radial-gradient(ellipse at 70% 80%, #1F1408 0%, transparent 50%);
    background-blend-mode: multiply;
}

.cover-grain {
    position: absolute;
    inset: 0;
    background-image:
        url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='400' height='400'><filter id='leather'><feTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='3' seed='9'/><feColorMatrix values='0 0 0 0 0.10  0 0 0 0 0.05  0 0 0 0 0.02  0 0 0 0.4 0'/></filter><rect width='400' height='400' filter='url(%23leather)'/></svg>"),
        repeating-radial-gradient(circle at 50% 50%,
            rgba(168, 118, 46, 0.02) 0 1px,
            transparent 1px 6px);
    opacity: 0.7;
    mix-blend-mode: overlay;
}

.cover-corner {
    position: absolute;
    width: 80px;
    height: 80px;
    z-index: 3;
}
.cover-corner--tl { top: 24px; left: 40px; }
.cover-corner--tr { top: 24px; right: 24px; transform: scaleX(-1); }
.cover-corner--bl { bottom: 24px; left: 40px; transform: scaleY(-1); }
.cover-corner--br { bottom: 24px; right: 24px; transform: scale(-1, -1); }

.cover-content {
    position: relative;
    z-index: 4;
    text-align: center;
    color: var(--brass);
    padding: 40px;
    max-width: 600px;
}

.cover-mark {
    font-family: var(--serif-archive);
    font-size: 12px;
    letter-spacing: 0.36em;
    color: var(--brass);
    margin-bottom: 32px;
    text-shadow: 0 0 8px rgba(168, 118, 46, 0.4);
    opacity: 0.75;
}

.cover-title {
    font-family: var(--serif-archive);
    font-size: clamp(3.6rem, 7.2vw, 5.6rem);
    font-weight: 600;
    letter-spacing: 0.12em;
    line-height: 0.96;
    color: var(--brass);
    text-shadow:
        0 0 1px rgba(168, 118, 46, 0.6),
        0 2px 8px rgba(0, 0, 0, 0.5),
        0 -1px 0 rgba(0, 0, 0, 0.8);
    margin-bottom: 24px;
}

.cover-amp {
    display: inline-block;
    font-size: 0.4em;
    color: var(--brass);
    opacity: 0.7;
    transform: translateY(-0.3em);
}

.cover-rule {
    width: 200px;
    height: 1px;
    margin: 0 auto 28px;
    background: linear-gradient(90deg,
        transparent 0%,
        var(--brass) 30%,
        var(--brass) 70%,
        transparent 100%);
    box-shadow: 0 0 4px rgba(168, 118, 46, 0.3);
}

.cover-volume, .cover-date {
    font-family: var(--serif-archive);
    font-size: 14px;
    letter-spacing: 0.24em;
    color: var(--brass);
    opacity: 0.85;
    margin-bottom: 8px;
}

.cover-imprint {
    margin-top: 48px;
    font-family: var(--serif-body);
    font-size: 13px;
    font-style: italic;
    color: var(--brass);
    opacity: 0.6;
    line-height: 1.6;
}

.cover-imprint-line {
    margin-top: 4px;
    letter-spacing: 0.04em;
}

.cover-open {
    position: absolute;
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 5;
    background: transparent;
    border: 0.6px solid var(--brass);
    color: var(--brass);
    font-family: var(--serif-archive);
    font-size: 12px;
    letter-spacing: 0.18em;
    padding: 14px 32px;
    cursor: pointer;
    transition: all 320ms ease;
}

.cover-open:hover {
    background: rgba(168, 118, 46, 0.1);
    box-shadow: 0 0 16px rgba(168, 118, 46, 0.3);
    letter-spacing: 0.22em;
}

.cover-open svg {
    width: 60px;
    height: 24px;
    margin-top: 8px;
    display: block;
    margin-left: auto;
    margin-right: auto;
}

.cover-paperweight {
    position: absolute;
    top: 64px;
    right: 96px;
    width: 64px;
    height: 64px;
    z-index: 4;
    --shadow-x: -4px;
    --shadow-y: 4px;
}

.paperweight-disc {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background:
        radial-gradient(circle at 35% 30%, #D4A14A 0%, #A8762E 40%, #6B4A2E 80%, #3A2812 100%);
    box-shadow:
        inset 2px 2px 4px rgba(255, 220, 150, 0.4),
        inset -2px -2px 6px rgba(0, 0, 0, 0.6);
}

.paperweight-shadow {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.5);
    transform: translate(var(--shadow-x), var(--shadow-y));
    z-index: -1;
    filter: blur(4px);
    transition: transform 200ms ease-out;
}

/* Cover open animation */
.spread--cover.opening {
    transform-origin: left center;
    animation: coverOpen 1800ms cubic-bezier(0.55, 0.05, 0.22, 1) forwards;
}

@keyframes coverOpen {
    0%   { transform: rotateY(0) translateZ(0); }
    100% { transform: rotateY(-160deg) translateZ(0); }
}

/* ============================================================
   Masthead
   ============================================================ */
.masthead {
    text-align: center;
    margin-bottom: 56px;
    padding-bottom: 28px;
    border-bottom: 0.6px solid var(--ink-2);
}

.masthead-title {
    font-family: var(--serif-archive);
    font-size: clamp(3rem, 6vw, 4.6rem);
    font-weight: 600;
    letter-spacing: 0.10em;
    color: var(--ink);
    line-height: 1;
    margin-bottom: 12px;
    text-shadow: 0 1px 0 rgba(255, 255, 255, 0.3);
}

.masthead-secondary {
    font-family: var(--serif-archive);
    font-size: 12px;
    letter-spacing: 0.32em;
    color: var(--ink-2);
    margin-bottom: 16px;
}

.masthead-rule {
    width: 60%;
    margin: 12px auto;
    height: 1px;
    background: linear-gradient(90deg,
        transparent 0%,
        var(--ink-2) 20%,
        var(--ink) 50%,
        var(--ink-2) 80%,
        transparent 100%);
}

.masthead-meta {
    display: flex;
    justify-content: space-around;
    font-family: var(--serif-body);
    font-size: 11px;
    font-style: italic;
    color: var(--ink-2);
    letter-spacing: 0.04em;
}

/* ============================================================
   Typography
   ============================================================ */
.section-heading {
    font-family: var(--serif-body);
    font-size: clamp(1.9rem, 3.4vw, 2.7rem);
    font-weight: 500;
    color: var(--ink);
    letter-spacing: 0.06em;
    text-transform: uppercase;
    font-variant: small-caps;
    margin-bottom: 8px;
    position: relative;
    padding-bottom: 14px;
    line-height: 1.1;
}

.section-heading::after {
    content: "";
    position: absolute;
    bottom: 0;
    left: 0;
    width: 60%;
    height: 0.6px;
    background: var(--ink);
}

.kicker {
    font-family: var(--serif-archive);
    font-size: 11px;
    letter-spacing: 0.24em;
    color: var(--ink-2);
    margin-bottom: 28px;
    text-transform: uppercase;
}

.essay {
    margin-bottom: 28px;
}

.essay p {
    margin-bottom: 14px;
    text-align: justify;
    hyphens: auto;
    -webkit-hyphens: auto;
}

.dropcap-para {
    margin-top: 8px;
}

.dropcap {
    float: left;
    font-family: var(--serif-archive);
    font-size: 5.2em;
    line-height: 0.85;
    color: var(--brass);
    margin: 0.04em 0.08em -0.04em 0;
    padding-right: 0.04em;
    text-shadow:
        0 1px 0 rgba(0, 0, 0, 0.2),
        0 -1px 0 rgba(255, 255, 255, 0.2);
    font-weight: 400;
}

.pull-quote {
    font-family: var(--serif-body);
    font-size: 22px;
    font-weight: 300;
    font-style: italic;
    line-height: 1.4;
    color: var(--ink);
    margin: 32px 0;
    padding: 0 28px;
    text-indent: -0.4em;
    text-align: left;
}

.pull-quote::before {
    content: "";
    display: block;
    width: 40px;
    height: 0.6px;
    background: var(--ink-2);
    margin-bottom: 16px;
    margin-left: 0.4em;
}

.frontispiece-prose {
    margin-top: 24px;
}

.frontispiece-epigraph {
    text-align: center;
    font-style: italic;
    color: var(--ink-2);
    margin-top: 24px;
}

.hairline-rule {
    width: 80px;
    height: 0.6px;
    background: var(--ink-2);
    margin: 28px auto;
}

/* superscript references */
.superscript-ref {
    color: var(--ribbon);
    font-feature-settings: "sups";
    font-size: 0.75em;
    cursor: pointer;
    vertical-align: super;
    line-height: 0;
    padding: 0 1px;
    border-bottom: 0.4px dotted var(--ribbon);
    transition: color 160ms;
}

.superscript-ref:hover {
    color: var(--brass);
}

.superscript-ref::before {
    content: attr(data-num);
}

/* Section divider with fleurons */
.section-divider {
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 36px 0;
    gap: 12px;
}

.section-divider svg {
    width: 80px;
    height: 24px;
    flex-shrink: 0;
}

.section-divider-label {
    font-family: var(--serif-archive);
    font-size: 11px;
    letter-spacing: 0.24em;
    color: var(--ink-2);
    text-transform: uppercase;
}

.section-divider--final {
    margin-top: 60px;
}

/* ============================================================
   Table of Contents
   ============================================================ */
.toc-list {
    list-style: none;
    margin-top: 32px;
}

.toc-entry {
    display: grid;
    grid-template-columns: 30px 1fr 60px;
    grid-template-areas: "folio title page";
    align-items: baseline;
    margin-bottom: 18px;
    padding: 6px 0;
    cursor: pointer;
    transition: color 200ms ease;
    position: relative;
}

.toc-folio {
    grid-area: folio;
    font-family: var(--serif-archive);
    font-size: 12px;
    color: var(--ink-2);
    letter-spacing: 0.08em;
}

.toc-title {
    grid-area: title;
    font-family: var(--serif-body);
    font-size: 16px;
    font-style: italic;
    color: var(--ink);
}

.toc-leader {
    position: absolute;
    bottom: 8px;
    left: 30px;
    right: 60px;
    height: 0;
    border-bottom: 1px dotted var(--ink-2);
    z-index: 1;
}

.toc-page {
    grid-area: page;
    font-family: var(--serif-archive);
    font-size: 11px;
    color: var(--ink-2);
    text-align: right;
    background: var(--paper);
    padding-left: 8px;
    position: relative;
    z-index: 2;
}

.toc-entry:hover {
    color: var(--brass);
}

.toc-entry:hover .toc-title {
    color: var(--brass);
    font-weight: 500;
}

.toc-entry .toc-title {
    background: var(--paper);
    padding-right: 8px;
    position: relative;
    z-index: 2;
}

/* ============================================================
   Sundial
   ============================================================ */
.sundial {
    position: absolute;
    top: 24px;
    right: 12px;
    width: 96px;
    z-index: 6;
}

.sundial-face {
    position: relative;
    width: 96px;
    height: 96px;
    border-radius: 50%;
    background:
        radial-gradient(circle at 38% 32%, #E0B265 0%, #B88634 30%, #6B4A2E 70%, #3A2812 100%),
        conic-gradient(from 0deg,
            #A8762E 0deg, #6B4A2E 30deg, #A8762E 60deg, #6B4A2E 90deg,
            #A8762E 120deg, #6B4A2E 150deg, #A8762E 180deg, #6B4A2E 210deg,
            #A8762E 240deg, #6B4A2E 270deg, #A8762E 300deg, #6B4A2E 330deg,
            #A8762E 360deg);
    background-blend-mode: overlay;
    box-shadow:
        inset 1px 1px 3px rgba(255, 220, 150, 0.4),
        inset -2px -2px 6px rgba(0, 0, 0, 0.6),
        0 4px 12px rgba(58, 40, 18, 0.5);
}

.sundial-face::before {
    content: "";
    position: absolute;
    inset: 8px;
    border-radius: 50%;
    border: 0.6px solid rgba(58, 40, 18, 0.4);
    background:
        radial-gradient(circle at 40% 30%, rgba(224, 178, 101, 0.4) 0%, transparent 60%),
        repeating-conic-gradient(from 0deg at 50% 50%,
            rgba(58, 40, 18, 0.3) 0deg 1deg,
            transparent 1deg 30deg);
}

.sundial-glyph {
    position: absolute;
    color: rgba(58, 40, 18, 0.4);
    font-size: 11px;
    line-height: 1;
    width: 14px;
    height: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 1200ms ease, text-shadow 1200ms ease;
}

.sundial-glyph.lit {
    color: var(--brass);
    text-shadow: 0 0 6px rgba(168, 118, 46, 0.7);
}

.sundial-glyph--n { top: 6px; left: 41px; }
.sundial-glyph--s { bottom: 6px; left: 41px; }
.sundial-glyph--e { right: 6px; top: 41px; }
.sundial-glyph--w { left: 6px; top: 41px; }

.sundial-gnomon {
    position: absolute;
    top: 12px;
    left: 47px;
    width: 2px;
    height: 36px;
    background: linear-gradient(180deg, #2A1A0E 0%, #6B4A2E 100%);
    transform-origin: 1px 36px;
    transform: rotate(0deg);
    box-shadow: 1px 1px 2px rgba(0, 0, 0, 0.4);
    transition: transform 800ms ease-out;
}

.sundial-center {
    position: absolute;
    top: 44px;
    left: 44px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: radial-gradient(circle, #E0B265 0%, #6B4A2E 70%, #2A1A0E 100%);
    box-shadow: inset 0 0 1px rgba(0,0,0,0.6);
}

.sundial-caption {
    margin-top: 6px;
    font-family: var(--serif-body);
    font-size: 10px;
    color: var(--ink-2);
    text-align: center;
    font-style: italic;
}

/* ============================================================
   Plates (tipped-in foldout charts and photos)
   ============================================================ */
.plate {
    position: relative;
    margin: 32px 0;
    transition: transform 320ms ease;
    transform-origin: left center;
}

.plate-paper {
    position: relative;
    background: var(--paper-2);
    padding: 24px 24px 18px 24px;
    box-shadow:
        inset 0 0 30px rgba(74, 46, 26, 0.08),
        6px 6px 14px rgba(42, 26, 14, 0.18);
    filter: url(#deckle-soft);
    background-image:
        url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='100' height='100'><filter id='gp'><feTurbulence type='fractalNoise' baseFrequency='1.2' numOctaves='2' seed='3'/><feColorMatrix values='0 0 0 0 0.4  0 0 0 0 0.29  0 0 0 0 0.18  0 0 0 0.07 0'/></filter><rect width='100' height='100' filter='url(%23gp)'/></svg>"),
        radial-gradient(ellipse at 80% 80%, rgba(168, 118, 46, 0.08), transparent 60%),
        var(--paper-2);
}

.plate:hover {
    transform: translateY(-4px) rotate(-0.4deg);
}

.plate-fold-shadow {
    position: absolute;
    bottom: -6px;
    left: 4%;
    right: 4%;
    height: 14px;
    background: radial-gradient(ellipse at center, rgba(42, 26, 14, 0.18) 0%, transparent 70%);
    pointer-events: none;
    z-index: -1;
}

.plate-chart {
    width: 100%;
    height: auto;
    display: block;
    margin-bottom: 12px;
}

.plate-caption {
    font-family: var(--serif-caption);
    font-size: 13px;
    line-height: 1.4;
    font-style: italic;
    color: var(--ink-2);
    border-top: 0.4px solid var(--ink-2);
    padding-top: 6px;
}

.plate-fold-tab {
    position: absolute;
    bottom: 12px;
    right: 12px;
    width: 24px;
    height: 24px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
    transition: transform 220ms ease;
}

.plate-fold-tab:hover {
    transform: scale(1.18) rotate(8deg);
}

.plate-fold-tab svg {
    width: 100%;
    height: 100%;
}

.plate-foxing {
    position: absolute;
    top: -10%;
    right: -10%;
    width: 60%;
    height: 60%;
    background: radial-gradient(ellipse at 70% 30%,
        rgba(168, 118, 46, 0.12) 0%,
        rgba(168, 118, 46, 0.04) 30%,
        transparent 60%);
    pointer-events: none;
    border-radius: 50%;
}

.plate-foxing--alt {
    top: auto;
    bottom: -10%;
    right: auto;
    left: -10%;
    background: radial-gradient(ellipse at 30% 70%,
        rgba(168, 118, 46, 0.10) 0%,
        rgba(168, 118, 46, 0.03) 30%,
        transparent 60%);
}

.plate-fold-marginalia {
    position: absolute;
    top: 24px;
    left: 100%;
    width: 220px;
    margin-left: 16px;
    font-family: var(--serif-body);
    font-size: 12px;
    line-height: 1.5;
    color: var(--ink-2);
    font-style: italic;
    opacity: 0;
    transition: opacity 320ms ease, transform 320ms ease;
    transform: translateX(-12px);
    pointer-events: none;
}

.plate-fold-marginalia p {
    margin-bottom: 8px;
}

.plate.unfolded {
    transform: scaleX(1.25) translateY(-2px);
    z-index: 50;
}

.plate.unfolded .plate-fold-marginalia {
    opacity: 1;
    transform: translateX(0);
    pointer-events: auto;
}

.plate.unfolded .plate-fold-tab {
    transform: rotate(180deg);
}

/* Photo plates */
.photo-plate {
    padding: 28px 28px 20px 28px;
}

.photo-frame {
    position: relative;
    width: 100%;
    aspect-ratio: 3 / 2;
    overflow: hidden;
    box-shadow:
        inset 0 0 40px rgba(42, 26, 14, 0.15),
        0 2px 6px rgba(42, 26, 14, 0.1);
    filter: sepia(0.12) contrast(0.96);
}

.photo-svg {
    width: 100%;
    height: 100%;
    display: block;
}

.photo-corner {
    position: absolute;
    width: 14px;
    height: 14px;
    background: rgba(74, 46, 26, 0.6);
    z-index: 2;
    box-shadow: inset 0 0 2px rgba(0, 0, 0, 0.4);
}

.photo-corner--tl { top: 0; left: 0; clip-path: polygon(0 0, 100% 0, 0 100%); }
.photo-corner--tr { top: 0; right: 0; clip-path: polygon(0 0, 100% 0, 100% 100%); }
.photo-corner--bl { bottom: 0; left: 0; clip-path: polygon(0 0, 0 100%, 100% 100%); }
.photo-corner--br { bottom: 0; right: 0; clip-path: polygon(100% 0, 100% 100%, 0 100%); }

/* ============================================================
   Data tables
   ============================================================ */
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-family: var(--serif-data);
    font-size: 13px;
    line-height: 1.55;
    color: var(--ink);
    margin: 28px 0;
    font-variant-numeric: tabular-nums oldstyle-nums;
}

.data-table thead th {
    font-family: var(--serif-archive);
    font-size: 11px;
    font-weight: 400;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--ink-2);
    text-align: left;
    border-bottom: 0.6px solid var(--ink);
    padding: 6px 8px;
}

.data-table thead th.num {
    text-align: right;
}

.data-table tbody td {
    padding: 6px 8px;
    border-bottom: 0.4px solid rgba(107, 74, 46, 0.4);
}

.data-table tbody tr:last-child td {
    border-bottom: 0.6px solid var(--ink);
}

.data-table .num {
    text-align: right;
    font-variant-numeric: tabular-nums oldstyle-nums;
}

.data-table .gain { color: var(--moss); }
.data-table .loss { color: var(--ribbon); }

.data-table tbody tr:hover {
    background: rgba(168, 118, 46, 0.06);
}

.data-table--policy {
    margin-top: 20px;
    margin-bottom: 24px;
}

/* ============================================================
   Marginalia
   ============================================================ */
.marginalia {
    position: absolute;
    top: 80px;
    right: 12px;
    width: 180px;
    font-family: var(--serif-body);
    font-size: 12px;
    line-height: 1.45;
    color: var(--ink-2);
    z-index: 8;
}

.margin-note {
    margin-bottom: 22px;
    padding-left: 22px;
    position: relative;
    transition: background 220ms ease;
    padding: 6px 6px 6px 22px;
    border-radius: 1px;
}

.margin-note.highlighted {
    background: rgba(168, 118, 46, 0.12);
}

.margin-num {
    position: absolute;
    left: 0;
    top: 6px;
    font-family: var(--serif-archive);
    color: var(--brass);
    font-size: 11px;
    font-weight: 400;
}

.margin-glyph {
    width: 14px;
    height: 14px;
    position: absolute;
    right: 4px;
    top: 6px;
    opacity: 0.7;
}

.margin-note p {
    font-style: italic;
    letter-spacing: 0.04em;
}

.leader-svg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 7;
}

.leader-svg svg {
    width: 100%;
    height: 100%;
}

/* ============================================================
   Ticker
   ============================================================ */
.ticker {
    position: absolute;
    bottom: 56px;
    left: 64px;
    right: 64px;
    height: 24px;
    overflow: hidden;
    border-top: 0.4px solid var(--ink-2);
    border-bottom: 0.4px solid var(--ink-2);
    background: var(--paper-2);
    box-shadow: inset 0 0 8px rgba(74, 46, 26, 0.1);
    font-family: var(--serif-data);
    font-size: 11px;
    color: var(--ink);
    font-variant-numeric: tabular-nums oldstyle-nums;
    z-index: 6;
}

.ticker-track {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    display: flex;
    align-items: center;
    white-space: nowrap;
    animation: tickerScroll 90s linear infinite;
}

.ticker-track span {
    flex-shrink: 0;
    padding-right: 32px;
    letter-spacing: 0.04em;
}

@keyframes tickerScroll {
    0%   { transform: translateX(0); }
    100% { transform: translateX(-50%); }
}

/* ============================================================
   Cabinet of Curiosities
   ============================================================ */
.cabinet {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(3, 1fr);
    gap: 8px;
    margin: 32px 0;
    padding: 12px;
    background:
        radial-gradient(ellipse at center, rgba(168, 118, 46, 0.06), transparent 70%),
        var(--paper-2);
    border: 0.6px solid var(--ink-2);
    box-shadow:
        inset 0 0 14px rgba(74, 46, 26, 0.18),
        0 4px 10px rgba(0, 0, 0, 0.1);
    aspect-ratio: 1.1;
}

.cabinet-cell {
    background: var(--paper);
    border: 0.4px solid rgba(107, 74, 46, 0.4);
    padding: 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    transition: all 320ms ease;
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.cabinet-cell::before {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg,
        transparent 0%,
        transparent 48%,
        rgba(168, 118, 46, 0.04) 50%,
        transparent 52%,
        transparent 100%);
    pointer-events: none;
}

.cabinet-cell:hover {
    transform: translateY(-2px) rotate(-0.4deg);
    box-shadow:
        0 6px 12px rgba(74, 46, 26, 0.2),
        inset 0 0 8px rgba(168, 118, 46, 0.06);
}

.cabinet-art {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
}

.cabinet-art svg {
    width: 100%;
    height: 100%;
    max-height: 88px;
}

.cabinet-cell--centre {
    background: var(--paper-2);
    border: 0.6px solid var(--ink-2);
}

.cabinet-label {
    font-family: var(--serif-caption);
    font-size: 10px;
    font-style: italic;
    color: var(--ink-2);
    text-align: center;
    margin-top: 6px;
    letter-spacing: 0.02em;
}

/* ============================================================
   Notation list
   ============================================================ */
.notation-list {
    list-style: none;
    margin: 24px 0;
    padding: 0;
}

.notation-list li {
    display: grid;
    grid-template-columns: 24px 1fr;
    gap: 12px;
    margin-bottom: 14px;
    padding: 6px 0;
    font-style: italic;
    color: var(--ink);
    border-bottom: 0.3px dotted var(--ink-2);
    padding-bottom: 12px;
}

.notation-glyph {
    width: 14px;
    height: 14px;
    margin-top: 4px;
    opacity: 0.8;
}

/* ============================================================
   Colophon / Signature
   ============================================================ */
.colophon-essay {
    margin-top: 28px;
}

.signature-block {
    margin: 40px 0;
    text-align: center;
}

.signature {
    width: 200px;
    height: 60px;
    display: block;
    margin: 0 auto;
}

.signature-line {
    font-family: var(--serif-archive);
    font-size: 11px;
    letter-spacing: 0.18em;
    color: var(--ink-2);
    text-align: center;
    margin-top: 8px;
}

.closing-line {
    text-align: center;
    color: var(--ink-2);
    margin-top: 32px;
    font-size: 14px;
}

.return-cover {
    display: block;
    margin: 32px auto 0;
    background: transparent;
    border: 0.6px solid var(--ink);
    color: var(--ink);
    font-family: var(--serif-archive);
    font-size: 11px;
    letter-spacing: 0.24em;
    padding: 12px 28px;
    cursor: pointer;
    text-transform: uppercase;
    transition: all 220ms ease;
}

.return-cover:hover {
    background: rgba(168, 118, 46, 0.1);
    border-color: var(--brass);
    color: var(--brass);
}

/* ============================================================
   Page Corner (turn-page button)
   ============================================================ */
.page-corner {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 56px;
    height: 56px;
    border: none;
    background: transparent;
    cursor: pointer;
    padding: 0;
    z-index: 12;
    transition: transform 240ms ease;
}

.page-corner svg {
    width: 100%;
    height: 100%;
    filter: drop-shadow(2px -2px 4px rgba(74, 46, 26, 0.3));
}

.page-corner:hover {
    transform: translateY(-2px) rotate(-0.4deg);
}

/* ============================================================
   Crease Light (during page-turn)
   ============================================================ */
.crease-light {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 100;
    opacity: 0;
    background: linear-gradient(90deg,
        transparent 0%,
        transparent var(--crease-pos, 50%),
        rgba(255, 240, 200, 0.5) calc(var(--crease-pos, 50%) + 1%),
        transparent calc(var(--crease-pos, 50%) + 4%),
        transparent 100%);
    transition: opacity 180ms ease;
}

.crease-light.active {
    opacity: 1;
}

/* ============================================================
   Page Indicator
   ============================================================ */
.page-indicator {
    position: fixed;
    bottom: 12px;
    right: 12px;
    z-index: 250;
    color: rgba(168, 118, 46, 0.6);
    font-family: var(--serif-archive);
    font-size: 11px;
    letter-spacing: 0.18em;
    background: rgba(20, 16, 10, 0.6);
    padding: 4px 12px;
    border: 0.4px solid rgba(168, 118, 46, 0.3);
    pointer-events: none;
}

/* ============================================================
   3D page-turn effect
   ============================================================ */
.spread.flipping {
    transform-style: preserve-3d;
    transition: transform var(--turn-dur) var(--turn-ease);
}

.spread.flipping.out {
    transform-origin: left center;
    animation: pageOut var(--turn-dur) var(--turn-ease) forwards;
}

@keyframes pageOut {
    0%   { transform: translateX(0) rotateY(0); }
    50%  { transform: translateX(0) rotateY(-90deg); }
    100% { transform: translateX(0) rotateY(-180deg); }
}

@keyframes pageIn {
    0%   { transform: translateX(110%) rotateY(0); opacity: 0; }
    100% { transform: translateX(0) rotateY(0); opacity: 1; }
}

.spread.entering {
    animation: pageIn var(--turn-dur) var(--turn-ease) forwards;
}

/* Marginalia stagger reveal */
.spread.active .margin-note {
    opacity: 0;
    animation: marginFadeIn 600ms ease forwards;
}
.spread.active .margin-note:nth-child(1) { animation-delay: 60ms; }
.spread.active .margin-note:nth-child(2) { animation-delay: 120ms; }
.spread.active .margin-note:nth-child(3) { animation-delay: 180ms; }
.spread.active .margin-note:nth-child(4) { animation-delay: 240ms; }

@keyframes marginFadeIn {
    0%   { opacity: 0; transform: translateX(8px); }
    100% { opacity: 1; transform: translateX(0); }
}

/* ============================================================
   Responsive: narrow viewport (single recto)
   ============================================================ */
@media (max-width: 980px) {
    .spread {
        grid-template-columns: 1fr;
    }

    .page--verso {
        display: none;
    }

    .page--recto {
        padding: 48px 32px 80px 32px;
    }

    .spread:not(.spread--cover)::after {
        top: 0;
        left: 0;
        right: 0;
        bottom: auto;
        width: 100%;
        height: 14px;
        background: linear-gradient(180deg,
            rgba(74, 46, 26, 0.32) 0%,
            transparent 100%);
        transform: none;
    }

    .marginalia {
        position: relative;
        top: auto;
        right: auto;
        width: 100%;
        margin: 28px 0;
        padding: 16px;
        border: 0.4px solid var(--ink-2);
        background: rgba(232, 220, 192, 0.4);
    }

    .ticker {
        left: 32px;
        right: 32px;
    }

    .running-head {
        width: calc(100% - 64px);
    }

    .running-head--verso {
        display: none;
    }

    .folio {
        right: 32px;
    }

    .page--recto .folio {
        right: 32px;
    }

    .cabinet {
        aspect-ratio: 1;
    }

    .plate-fold-marginalia {
        position: relative;
        left: auto;
        margin: 12px 0 0 0;
        width: 100%;
    }

    .sundial {
        right: 0;
    }

    .cover-paperweight {
        right: 32px;
        top: 32px;
    }
}

@media (max-width: 600px) {
    .page--recto {
        padding: 40px 20px 70px 20px;
    }

    .cover-paperweight {
        width: 48px;
        height: 48px;
        right: 20px;
        top: 20px;
    }

    .pull-quote {
        font-size: 18px;
        padding: 0 12px;
    }

    .data-table {
        font-size: 12px;
    }

    .toc-entry {
        grid-template-columns: 24px 1fr 50px;
    }

    .ticker {
        left: 20px;
        right: 20px;
    }

    .running-head {
        width: calc(100% - 40px);
    }
    .folio {
        right: 20px !important;
        left: auto !important;
    }
}
