/* loves.quest — graffiti-tagged scholar's cabinet
   palette: gold-black-luxury  |  fonts: Cormorant Garamond, EB Garamond, Permanent Marker, Special Elite
*/

/* ---------- Tokens ---------- */
:root {
    --obsidian: #0A0908;
    --walnut: #1C1815;
    --burnished: #D4AF37;
    --burnished-deep: #B8860B;
    --vellum-gilt: #F4E4A6;
    --antique-brass: #8B6914;
    --aged-vellum: #E8DFC4;
    --cinnabar: #9B2226;
    --espresso: #3D2817;

    --gold-foil: linear-gradient(135deg, #B8860B 0%, #F4E4A6 50%, #D4AF37 100%);
    --gold-foil-deep: linear-gradient(135deg, #8B6914 0%, #D4AF37 50%, #B8860B 100%);

    --rail-w: 320px;

    --serif-display: "Cormorant Garamond", "EB Garamond", Georgia, serif;
    --serif-body: "EB Garamond", "Cormorant Garamond", Georgia, serif;
    --tag-font: "Permanent Marker", "Cormorant Garamond", cursive;
    --type-font: "Special Elite", "Courier New", monospace;
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
    background: var(--obsidian);
    color: var(--aged-vellum);
    font-family: var(--serif-body);
    font-size: 18px;
    line-height: 1.62;
    overflow-x: hidden;
    cursor: none;
    padding-right: var(--rail-w);
    position: relative;
    min-height: 100vh;
}

/* paper grain & vignette overlays */
.paper-grain {
    position: fixed; inset: 0; pointer-events: none; z-index: 1;
    background-image:
        radial-gradient(1px 1px at 20% 30%, rgba(232,223,196,0.04) 50%, transparent 51%),
        radial-gradient(1px 1px at 70% 60%, rgba(232,223,196,0.03) 50%, transparent 51%),
        radial-gradient(1px 1px at 40% 80%, rgba(232,223,196,0.04) 50%, transparent 51%),
        radial-gradient(2px 2px at 90% 20%, rgba(232,223,196,0.02) 50%, transparent 51%);
    background-size: 200px 200px, 240px 240px, 320px 320px, 410px 410px;
    mix-blend-mode: overlay;
    opacity: 0.7;
}
.vignette {
    position: fixed; inset: 0; pointer-events: none; z-index: 2;
    background: radial-gradient(ellipse at center, transparent 50%, rgba(10,9,8,0.65) 100%),
                linear-gradient(to right, rgba(61,40,23,0.3), transparent 8%, transparent 92%, rgba(61,40,23,0.3));
}

/* ---------- Custom Cursor (manicule) ---------- */
.manicule {
    position: fixed; top: 0; left: 0;
    width: 36px; height: 36px;
    pointer-events: none;
    z-index: 9999;
    transform: translate(-8px, -8px);
    transition: transform 0.05s linear;
    filter: drop-shadow(0 1px 2px rgba(0,0,0,0.6));
}
.manicule svg { width: 100%; height: 100%; }
.manicule.aerosol path:first-of-type { fill: var(--burnished); }

/* ---------- Frontispiece ---------- */
.frontispiece {
    position: relative;
    min-height: 85vh;
    padding: 4rem 6rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 5;
}
.rule {
    width: 100%;
    max-width: 1200px;
    display: flex; align-items: center; gap: 1.2rem;
    color: var(--burnished);
    font-family: var(--serif-display);
}
.rule-line {
    flex: 1; height: 1px;
    background: var(--gold-foil);
    box-shadow: 0 1px 0 rgba(244,228,166,0.15);
}
.rule-mark {
    font-size: 1.4rem;
    color: var(--burnished);
    font-style: italic;
}
.rule-mark.center { font-size: 1.8rem; color: var(--vellum-gilt); }

.frontispiece-inner {
    margin: 3rem 0;
    text-align: center;
    max-width: 1100px;
    position: relative;
}
.folio-tag {
    font-family: var(--type-font);
    font-size: 0.78rem;
    letter-spacing: 0.18em;
    color: var(--antique-brass);
    text-transform: lowercase;
    margin-bottom: 2rem;
}
.frontispiece-title {
    font-family: var(--serif-display);
    font-style: italic;
    font-weight: 700;
    font-size: clamp(72px, 11vw, 148px);
    line-height: 0.96;
    letter-spacing: -0.01em;
    background: var(--gold-foil);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    text-shadow: 0 0 24px rgba(212,175,55,0.18);
    position: relative;
    z-index: 2;
    filter: contrast(1.04);
}
.frontispiece-title .word-dot { color: transparent; background: linear-gradient(135deg, var(--cinnabar), #c44a4a); -webkit-background-clip: text; background-clip: text; }
.frontispiece-title .word { display: inline-block; }

.amor-tag {
    position: absolute;
    top: -10%;
    left: -2%;
    width: 104%;
    height: 130%;
    pointer-events: none;
    z-index: 3;
    opacity: 0;
    transform: rotate(-9deg);
    animation: tagFadeIn 1.4s 0.6s forwards;
}
.amor-stroke {
    stroke-dasharray: 1800;
    stroke-dashoffset: 1800;
    animation: spray 1.4s 0.6s ease-out forwards;
}
.amor-text {
    font-family: var(--tag-font);
    font-size: 132px;
    fill: url(#goldFoil);
    opacity: 0;
    animation: amorAppear 0.6s 1.6s forwards;
    paint-order: stroke;
    stroke: var(--obsidian);
    stroke-width: 2;
}
.drips path {
    stroke-dasharray: 100;
    stroke-dashoffset: 100;
    animation: drip 2.5s 1.8s ease-in forwards;
}
.drips .drip-2 { animation-delay: 2.0s; }
.drips .drip-3 { animation-delay: 2.2s; }

@keyframes spray { to { stroke-dashoffset: 0; } }
@keyframes drip { to { stroke-dashoffset: 0; } }
@keyframes amorAppear { to { opacity: 0.92; } }
@keyframes tagFadeIn { to { opacity: 1; } }

.epigraph {
    font-family: var(--serif-display);
    font-style: italic;
    margin-top: 2.5rem;
    color: var(--vellum-gilt);
    font-size: 1.3rem;
}
.epigraph.latin {
    font-size: 1.6rem;
    color: var(--burnished);
    letter-spacing: 0.01em;
}
.epigraph.gloss {
    font-size: 1.05rem;
    color: var(--aged-vellum);
    margin-top: 0.4rem;
    opacity: 0.88;
}

.cinnabar { color: var(--cinnabar); font-style: normal; }

.bookplate {
    display: inline-flex;
    align-items: center;
    gap: 1.2rem;
    margin-top: 3rem;
    padding: 0.9rem 2.6rem;
    border: 1px solid var(--burnished-deep);
    border-radius: 2px;
    background: linear-gradient(180deg, rgba(28,24,21,0.9), rgba(10,9,8,0.95));
    box-shadow:
        inset 0 0 0 1px rgba(212,175,55,0.18),
        0 4px 24px rgba(0,0,0,0.5);
    font-family: var(--serif-display);
    font-style: italic;
    font-weight: 500;
    letter-spacing: 0.4em;
    color: var(--vellum-gilt);
    cursor: none;
    position: relative;
    transition: transform 0.4s cubic-bezier(.2,.7,.3,1.4), box-shadow 0.4s ease;
}
.bookplate::before, .bookplate::after {
    content: '';
    position: absolute; inset: 6px;
    border: 1px solid rgba(212,175,55,0.28);
    pointer-events: none;
}
.bookplate::after { inset: 10px; border-color: rgba(212,175,55,0.12); }
.bookplate:hover {
    transform: translateY(-3px) scale(1.02);
    box-shadow:
        inset 0 0 0 1px rgba(244,228,166,0.32),
        0 12px 40px rgba(212,175,55,0.18);
}
.bookplate-flourish {
    color: var(--burnished);
    font-size: 1.3rem;
    letter-spacing: 0;
}
.bookplate-verb {
    background: var(--gold-foil);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    font-size: 1.1rem;
}

/* ---------- Prologue ---------- */
.prologue {
    position: relative;
    max-width: 880px;
    margin: 6rem auto 4rem;
    padding: 4rem 5rem;
    background: var(--walnut);
    border: 1px solid rgba(212,175,55,0.22);
    box-shadow:
        inset 0 0 0 1px rgba(232,223,196,0.04),
        0 8px 32px rgba(0,0,0,0.4);
    z-index: 5;
}
.prologue::before {
    content: '';
    position: absolute; inset: 12px;
    border: 1px solid rgba(212,175,55,0.1);
    pointer-events: none;
}
.folio-marker {
    font-family: var(--type-font);
    font-size: 0.78rem;
    letter-spacing: 0.16em;
    color: var(--antique-brass);
    margin-bottom: 1rem;
}
.prologue-title {
    font-family: var(--serif-display);
    font-style: italic;
    font-weight: 700;
    font-size: clamp(40px, 5vw, 64px);
    line-height: 1.05;
    color: var(--vellum-gilt);
    margin-bottom: 2rem;
    background: var(--gold-foil);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}
.prologue-body p {
    font-family: var(--serif-body);
    font-size: 1.08rem;
    line-height: 1.72;
    color: var(--aged-vellum);
    text-align: justify;
    hanging-punctuation: first last;
    margin-bottom: 1.4rem;
}
.prologue-body .lead { font-size: 1.18rem; }

.dropcap {
    float: left;
    font-family: var(--serif-display);
    font-style: italic;
    font-weight: 700;
    font-size: 5.4rem;
    line-height: 0.86;
    margin: 0.16em 0.16em 0 0;
    background: var(--gold-foil);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    text-shadow: 0 1px 0 rgba(0,0,0,0.5);
    -webkit-text-stroke: 0.5px var(--espresso);
}
.dropcap-mini {
    font-family: var(--serif-display);
    font-style: italic;
    font-weight: 700;
    font-size: 1.6em;
    line-height: 0.9;
    color: var(--vellum-gilt);
    margin-right: 0.04em;
}

.subhead {
    font-family: var(--serif-display);
    font-style: italic;
    font-variant: small-caps;
    font-weight: 500;
    font-size: 1.3rem;
    color: var(--burnished);
    letter-spacing: 0.05em;
    margin: 2rem 0 0.8rem;
}

.prologue-graffiti {
    position: absolute;
    top: 3rem;
    right: -120px;
    width: 240px;
    text-align: center;
    transform: rotate(8deg);
    pointer-events: none;
}
.prologue-graffiti .crown {
    display: block;
    color: var(--burnished);
    font-size: 1.4rem;
    margin-bottom: -0.4rem;
}
.prologue-graffiti .tag-text {
    display: block;
    font-family: var(--tag-font);
    font-size: 64px;
    background: var(--gold-foil);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    line-height: 1;
    paint-order: stroke;
    -webkit-text-stroke: 2px var(--espresso);
    filter: drop-shadow(2px 2px 0 var(--antique-brass));
}
.prologue-graffiti .tag-drip {
    display: block;
    width: 4px; height: 28px;
    margin: 0 auto;
    background: var(--gold-foil-deep);
    margin-left: 30%;
    border-radius: 0 0 4px 4px;
    transform: translateY(-4px);
    opacity: 0.85;
}

/* ---------- The Stacks ---------- */
.stacks-wrap {
    position: relative;
    padding: 4rem 6rem 6rem 6rem;
    z-index: 5;
}
.stacks-header {
    text-align: center;
    margin-bottom: 3.5rem;
}
.stacks-title {
    font-family: var(--serif-display);
    font-style: italic;
    font-weight: 700;
    font-size: clamp(48px, 6vw, 78px);
    background: var(--gold-foil);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    margin-bottom: 0.6rem;
}
.stacks-sub {
    font-family: var(--serif-display);
    font-style: italic;
    color: var(--aged-vellum);
    opacity: 0.78;
    font-size: 1.15rem;
}

.masonry {
    column-count: 3;
    column-gap: 1.6rem;
    max-width: 1480px;
    margin: 0 auto;
}
@media (max-width: 1280px) { .masonry { column-count: 2; } }
@media (max-width: 720px) { .masonry { column-count: 1; } }

.tile {
    break-inside: avoid;
    page-break-inside: avoid;
    -webkit-column-break-inside: avoid;
    margin-bottom: 1.6rem;
    background: linear-gradient(180deg, #211c19 0%, var(--walnut) 100%);
    border: 1px solid rgba(212,175,55,0.18);
    padding: 1.8rem 1.6rem 1.6rem 2rem;
    position: relative;
    overflow: hidden;
    box-shadow:
        inset 0 0 0 1px rgba(232,223,196,0.04),
        0 2px 12px rgba(0,0,0,0.35);
    transform: translateY(20px);
    opacity: 0;
    transition:
        transform 0.5s cubic-bezier(.2,.7,.3,1.2),
        opacity 0.6s ease,
        box-shadow 0.4s ease;
    cursor: none;
}
.tile.visible { transform: translateY(0); opacity: 1; }
.tile:hover {
    transform: translateY(-4px) scale(1.02) rotate(-0.3deg);
    box-shadow:
        inset 0 0 0 1px rgba(244,228,166,0.18),
        4px 8px 0 rgba(0,0,0,0.4),
        8px 14px 24px rgba(0,0,0,0.5),
        12px 22px 40px rgba(0,0,0,0.35);
    z-index: 6;
}

/* tile heights — height jitter via min-height */
.tile-h-s { min-height: 180px; }
.tile-h-m { min-height: 280px; }
.tile-h-l { min-height: 340px; }
.tile-h-xl { min-height: 460px; }

/* gilt fore-edge */
.gilt-edge {
    position: absolute;
    top: 0; right: 0;
    width: 4px; height: 100%;
    background: var(--gold-foil-deep);
    box-shadow: -1px 0 4px rgba(244,228,166,0.15);
    transition: width 0.4s ease;
}
.tile:hover .gilt-edge { width: 8px; }

/* book spine on chapter tiles */
.spine {
    position: absolute;
    top: 0; left: 0;
    width: 18px; height: 100%;
    background:
        linear-gradient(90deg, var(--obsidian), var(--walnut) 60%, transparent),
        repeating-linear-gradient(0deg,
            var(--burnished-deep) 0,
            var(--burnished-deep) 2px,
            transparent 2px,
            transparent 32px);
    border-right: 1px solid rgba(244,228,166,0.18);
}

.folio-num {
    font-family: var(--type-font);
    font-size: 0.74rem;
    letter-spacing: 0.14em;
    color: var(--antique-brass);
    text-transform: lowercase;
    margin-bottom: 0.4rem;
}
.roman {
    font-family: var(--serif-display);
    font-style: italic;
    font-weight: 700;
    font-size: 2.2rem;
    background: var(--gold-foil);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    line-height: 1;
    margin-bottom: 0.8rem;
}
.tile-title {
    font-family: var(--serif-display);
    font-style: normal;
    font-weight: 500;
    font-size: 1.5rem;
    line-height: 1.18;
    color: var(--vellum-gilt);
    margin-bottom: 0.8rem;
}
.tile-title em {
    font-style: italic;
    color: var(--burnished);
}
.tile-excerpt {
    font-family: var(--serif-body);
    font-size: 0.98rem;
    line-height: 1.6;
    color: var(--aged-vellum);
    opacity: 0.86;
    text-align: justify;
}
.tile-meta {
    margin-top: 1rem;
    font-family: var(--type-font);
    font-size: 0.76rem;
    color: var(--antique-brass);
    letter-spacing: 0.08em;
}

/* graffiti tiles */
.tile-graffiti {
    background:
        radial-gradient(ellipse at 30% 70%, rgba(184,134,11,0.12), transparent 60%),
        var(--obsidian);
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem 1rem;
    border-color: rgba(212,175,55,0.1);
}
.tile-graffiti .crown {
    color: var(--burnished);
    font-size: 1.6rem;
    margin-bottom: -0.4rem;
}
.tile-graffiti .graffiti-text {
    font-family: var(--tag-font);
    font-size: clamp(54px, 7vw, 96px);
    line-height: 1;
    background: var(--gold-foil);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    paint-order: stroke;
    -webkit-text-stroke: 2px var(--obsidian);
    filter: drop-shadow(3px 3px 0 var(--antique-brass));
    transform: rotate(-4deg);
    letter-spacing: 0.02em;
}
.tile-graffiti .graffiti-drip {
    display: block;
    width: 5px; height: 36px;
    background: linear-gradient(180deg, var(--burnished), var(--antique-brass));
    border-radius: 0 0 50% 50%;
    margin-top: -8px;
    margin-left: 28%;
    opacity: 0.85;
}

/* footnote tiles */
.tile-footnote {
    background:
        linear-gradient(180deg, rgba(28,24,21,0.95), rgba(10,9,8,0.95));
}
.footnote-glyph {
    font-family: var(--serif-display);
    font-size: 2.6rem;
    color: var(--cinnabar);
    line-height: 1;
    margin-bottom: 0.6rem;
    text-shadow: 0 0 8px rgba(155,34,38,0.25);
}
.footnote-cite {
    font-family: var(--serif-body);
    font-size: 0.96rem;
    line-height: 1.55;
    color: var(--aged-vellum);
    font-style: italic;
}
.footnote-cite q::before { content: '\201C'; color: var(--burnished); margin-right: 1px; }
.footnote-cite q::after { content: '\201D'; color: var(--burnished); margin-left: 1px; }
.footnote-cite em { font-style: italic; color: var(--vellum-gilt); }

/* plate tiles */
.tile-plate {
    padding: 0;
    background: var(--obsidian);
    overflow: hidden;
}
.plate-svg {
    display: block;
    width: 100%;
    height: auto;
    border-bottom: 1px solid rgba(212,175,55,0.18);
}
.plate-caption {
    padding: 0.8rem 1.2rem;
    font-family: var(--serif-display);
    font-style: italic;
    color: var(--aged-vellum);
    font-size: 0.95rem;
    text-align: center;
    background: var(--walnut);
}
.plate-caption em { color: var(--vellum-gilt); }

.censored {
    background: var(--gold-foil-deep);
    color: var(--gold-foil-deep);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    position: relative;
    padding: 0 4px;
}
.censored::after {
    content: '';
    position: absolute;
    inset: 4% 0;
    background: var(--gold-foil-deep);
    border-radius: 1px;
    box-shadow: 0 0 4px rgba(184,134,11,0.4);
    z-index: 1;
}
.censored {
    background: transparent;
    color: transparent;
    -webkit-background-clip: initial;
    background-clip: initial;
}

/* ---------- Marginalia Rail ---------- */
.marginalia {
    position: fixed;
    top: 0; right: 0;
    width: var(--rail-w);
    height: 100vh;
    padding: 2.4rem 1.6rem 2rem 1.4rem;
    background:
        linear-gradient(270deg, var(--walnut) 0%, rgba(28,24,21,0.92) 100%);
    border-left: 1px solid rgba(212,175,55,0.22);
    box-shadow: inset 4px 0 12px rgba(0,0,0,0.4);
    z-index: 50;
    overflow: hidden;
}
.marginalia::before {
    content: '';
    position: absolute;
    left: 0; top: 0;
    width: 4px; height: 100%;
    background: var(--gold-foil-deep);
    opacity: 0.9;
}
.marginalia-head {
    border-bottom: 1px solid rgba(212,175,55,0.18);
    padding-bottom: 1rem;
    margin-bottom: 1.4rem;
}
.rail-label {
    font-family: var(--serif-display);
    font-style: italic;
    font-variant: small-caps;
    font-size: 1.05rem;
    letter-spacing: 0.16em;
    color: var(--burnished);
    margin-bottom: 0.4rem;
}
.reading-status {
    font-family: var(--type-font);
    font-size: 0.72rem;
    color: var(--antique-brass);
    letter-spacing: 0.06em;
    display: flex; align-items: center; gap: 0.5rem;
}
.status-dot {
    width: 6px; height: 6px;
    background: var(--cinnabar);
    border-radius: 50%;
    box-shadow: 0 0 6px var(--cinnabar);
    animation: pulse 1.6s ease-in-out infinite;
}
@keyframes pulse {
    0%, 100% { opacity: 0.7; transform: scale(1); }
    50% { opacity: 1; transform: scale(1.2); }
}

.marginalia-list {
    list-style: none;
    will-change: transform;
}
.ann {
    font-family: var(--type-font);
    font-size: 0.84rem;
    line-height: 1.55;
    color: var(--aged-vellum);
    padding: 0.8rem 0;
    border-bottom: 1px dashed rgba(232,223,196,0.08);
    opacity: 0;
    transform: translateY(8px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}
.ann.revealed { opacity: 0.92; transform: translateY(0); }
.ann em {
    font-style: italic;
    color: var(--vellum-gilt);
    font-family: var(--serif-display);
}

/* ---------- Reader Overlay (FLIP target) ---------- */
.reader-overlay {
    position: fixed;
    inset: 0;
    background: rgba(10,9,8,0);
    backdrop-filter: blur(0px);
    z-index: 80;
    pointer-events: none;
    transition: background 0.4s ease, backdrop-filter 0.4s ease;
}
.reader-overlay.active {
    background: rgba(10,9,8,0.78);
    backdrop-filter: blur(6px);
    pointer-events: auto;
}
.reader-frame {
    position: absolute;
    background: linear-gradient(180deg, var(--walnut), var(--obsidian));
    border: 1px solid var(--burnished-deep);
    box-shadow:
        inset 0 0 0 1px rgba(244,228,166,0.12),
        0 24px 64px rgba(0,0,0,0.7);
    overflow: hidden;
    will-change: transform, width, height;
    opacity: 0;
}
.reader-overlay.active .reader-frame { opacity: 1; }

.reader-close {
    position: absolute;
    top: 1.2rem; right: 1.2rem;
    width: 36px; height: 36px;
    background: transparent;
    border: 1px solid var(--burnished);
    color: var(--vellum-gilt);
    font-family: var(--serif-display);
    font-size: 1.4rem;
    line-height: 32px;
    cursor: none;
    z-index: 5;
    transition: background 0.3s ease, transform 0.3s ease;
}
.reader-close:hover { background: rgba(212,175,55,0.15); transform: rotate(90deg); }

.reader-pane {
    display: grid;
    grid-template-columns: 1.6fr 1fr;
    height: 100%;
    overflow-y: auto;
    opacity: 0;
    transition: opacity 0.45s 0.2s ease;
}
.reader-overlay.active .reader-pane { opacity: 1; }
.reader-col {
    padding: 3rem 3rem 4rem;
    overflow-y: auto;
}
.reader-col-left {
    border-right: 1px solid rgba(212,175,55,0.2);
}
.reader-col-right {
    background: rgba(10,9,8,0.5);
}
.reader-title {
    font-family: var(--serif-display);
    font-style: italic;
    font-weight: 500;
    font-size: clamp(32px, 3.4vw, 52px);
    line-height: 1.1;
    background: var(--gold-foil);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    margin-bottom: 2rem;
}
.reader-body {
    font-family: var(--serif-body);
    font-size: 1.05rem;
    line-height: 1.75;
    color: var(--aged-vellum);
    text-align: justify;
}
.reader-body p { margin-bottom: 1.2rem; }
.reader-body p:first-child::first-letter {
    float: left;
    font-family: var(--serif-display);
    font-style: italic;
    font-weight: 700;
    font-size: 4.6rem;
    line-height: 0.86;
    margin: 0.16em 0.18em 0 0;
    background: var(--gold-foil);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    -webkit-text-stroke: 0.5px var(--espresso);
}
.reader-marginalia {
    list-style: none;
}
.reader-marginalia li {
    font-family: var(--type-font);
    font-size: 0.84rem;
    color: var(--aged-vellum);
    padding: 0.7rem 0;
    border-bottom: 1px dashed rgba(232,223,196,0.08);
    line-height: 1.55;
}
.reader-marginalia li em {
    font-family: var(--serif-display);
    font-style: italic;
    color: var(--vellum-gilt);
}

/* ---------- Colophon ---------- */
.colophon {
    position: relative;
    z-index: 5;
    padding: 5rem 6rem 6rem;
    background: linear-gradient(180deg, var(--obsidian), #050403 100%);
    border-top: 1px solid rgba(212,175,55,0.18);
    margin-top: 6rem;
}
.colophon-rule {
    display: flex;
    align-items: center;
    gap: 1.2rem;
    margin-bottom: 3rem;
    color: var(--burnished);
    font-family: var(--serif-display);
}
.colophon-body {
    max-width: 760px;
    margin: 0 auto;
    text-align: center;
    position: relative;
}
.colophon-mark {
    font-family: var(--serif-display);
    font-size: 3rem;
    color: var(--burnished);
    margin-bottom: 1.6rem;
    opacity: 0.75;
}
.colophon-text {
    font-family: var(--serif-display);
    font-style: italic;
    font-size: 1.1rem;
    line-height: 1.7;
    color: var(--aged-vellum);
    opacity: 0.86;
}
.colophon-text em { font-style: italic; color: var(--vellum-gilt); }
.small-caps { font-variant: small-caps; letter-spacing: 0.08em; color: var(--burnished); }

.colophon-tag {
    margin-top: 2.4rem;
    display: inline-block;
    transform: rotate(-6deg);
}
.colophon-tag .crown {
    display: block;
    color: var(--burnished);
    font-size: 1.2rem;
    margin-bottom: -0.3rem;
}
.colophon-tag .graffiti-text {
    font-family: var(--tag-font);
    font-size: 56px;
    background: var(--gold-foil);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    paint-order: stroke;
    -webkit-text-stroke: 2px var(--obsidian);
    filter: drop-shadow(2px 2px 0 var(--antique-brass));
}

.ambient-toggle {
    margin-top: 2.6rem;
    background: transparent;
    border: 1px solid var(--burnished-deep);
    color: var(--vellum-gilt);
    font-family: var(--type-font);
    font-size: 0.78rem;
    letter-spacing: 0.14em;
    padding: 0.6rem 1.4rem;
    cursor: none;
    display: inline-flex;
    align-items: center;
    gap: 0.7rem;
    transition: background 0.3s ease, border-color 0.3s ease;
}
.ambient-toggle:hover { border-color: var(--burnished); background: rgba(212,175,55,0.08); }
.ambient-dot {
    width: 8px; height: 8px;
    background: var(--antique-brass);
    border-radius: 50%;
    transition: background 0.3s ease, box-shadow 0.3s ease;
}
.ambient-toggle[aria-pressed="true"] .ambient-dot {
    background: var(--burnished);
    box-shadow: 0 0 8px var(--burnished);
}

/* ---------- Shimmer on gold-foil text ---------- */
.frontispiece-title,
.stacks-title,
.prologue-title,
.reader-title {
    position: relative;
    isolation: isolate;
}
.frontispiece-title::after,
.stacks-title::after,
.prologue-title::after,
.reader-title::after {
    content: '';
    position: absolute;
    top: 0; left: -120%;
    width: 8%; height: 100%;
    background: linear-gradient(105deg,
        transparent 0%,
        rgba(244,228,166,0.4) 50%,
        transparent 100%);
    transform: skewX(-20deg);
    animation: shimmer 9s ease-in-out infinite;
    pointer-events: none;
    mix-blend-mode: screen;
}
@keyframes shimmer {
    0% { left: -120%; opacity: 0; }
    8% { opacity: 1; }
    18% { left: 220%; opacity: 0; }
    100% { left: 220%; opacity: 0; }
}

/* ---------- Reduced layout for narrow screens ---------- */
@media (max-width: 980px) {
    body { padding-right: 0; }
    .marginalia {
        position: static;
        width: 100%;
        height: auto;
        border-left: none;
        border-top: 1px solid rgba(212,175,55,0.22);
    }
    .frontispiece { padding: 3rem 1.5rem; }
    .prologue { padding: 2.5rem 1.6rem; margin: 4rem 1rem; }
    .prologue-graffiti { display: none; }
    .stacks-wrap { padding: 3rem 1.5rem; }
    .colophon { padding: 4rem 1.5rem; }
    .reader-pane { grid-template-columns: 1fr; }
    .reader-col { padding: 2rem 1.5rem 3rem; }
}
