/* ============================================================
   gabs.review · vol. mmxxvi
   The Candlelit Oxblood Library
   ============================================================ */

:root {
    --oxblood-vellum: #2A0D0A;
    --tallow-cream: #F4E9D2;
    --foiled-gilt: #C7A664;
    --garnet-ink: #8A1F12;
    --walnut-ink: #3A1E12;
    --midnight-cordovan: #1B0606;
    --library-lichen: #7C8A6E;
    --aged-pencil-tan: #A86A3A;

    --display-font: 'Cormorant Garamond', 'Lora', serif;
    --body-font: 'EB Garamond', 'Cormorant Garamond', serif;
    --margin-font: 'Caveat', 'Segoe Script', cursive;
    --num-font: 'IM Fell DW Pica', 'EB Garamond', serif;
}

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

html {
    scroll-behavior: auto;
    background: var(--oxblood-vellum);
}

body {
    font-family: var(--body-font);
    color: var(--walnut-ink);
    background: var(--oxblood-vellum);
    font-size: 1.06rem;
    line-height: 1.62;
    overflow-x: hidden;
    min-height: 100vh;
    cursor: text;
    /* faint candle-warmth background */
    background-image:
        radial-gradient(ellipse at 92% 88%, rgba(199, 166, 100, 0.08) 0%, transparent 35%),
        radial-gradient(ellipse at 8% 20%, rgba(26, 6, 6, 0.6) 0%, transparent 50%);
}

.defs-only { position: absolute; width: 0; height: 0; overflow: hidden; }

/* =========================== Spine Ribbon =========================== */
.spine {
    position: fixed;
    top: 0;
    left: 0;
    width: 14px;
    height: 100vh;
    background: linear-gradient(90deg, var(--midnight-cordovan) 0%, var(--oxblood-vellum) 60%, var(--midnight-cordovan) 100%);
    border-right: 1px solid rgba(199, 166, 100, 0.35);
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.spine-text {
    font-family: var(--display-font);
    font-weight: 600;
    font-size: 0.62rem;
    letter-spacing: 0.32em;
    text-transform: lowercase;
    font-variant: small-caps;
    color: var(--foiled-gilt);
    writing-mode: vertical-rl;
    transform: rotate(180deg);
    white-space: nowrap;
    text-shadow: 0 0 4px rgba(199, 166, 100, 0.4);
}

/* =========================== Silk Ribbon =========================== */
.silk-ribbon {
    position: fixed;
    top: 0;
    left: calc(50% - 7px);
    width: 14px;
    height: 240px;
    z-index: 8;
    pointer-events: none;
    transform-origin: center top;
    transition: transform 0.3s ease-out;
    opacity: 0.85;
    filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.6));
}

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

/* =========================== Codex =========================== */
.codex {
    position: relative;
    width: 100%;
    overflow-x: hidden;
}

.folio {
    position: relative;
    height: 100vh;
    min-height: 700px;
    width: 100%;
    padding: 0 4vw 0 calc(4vw + 14px);
    background: var(--oxblood-vellum);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* Subtle leather grain on each folio */
.folio::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image:
        radial-gradient(circle at 30% 40%, rgba(26, 6, 6, 0.4), transparent 50%),
        radial-gradient(circle at 70% 60%, rgba(58, 30, 18, 0.3), transparent 60%);
    pointer-events: none;
    z-index: 0;
}

/* =========================== Gilt Border =========================== */
.gilt-border {
    position: absolute;
    inset: 16px;
    pointer-events: none;
    z-index: 4;
}

.gilt-border svg {
    width: 100%;
    height: 100%;
    overflow: visible;
}

.gilt-path {
    fill: none;
    stroke: var(--foiled-gilt);
    stroke-width: 1.2;
    stroke-linecap: round;
    stroke-dasharray: 2400;
    stroke-dashoffset: 2400;
    filter: drop-shadow(0 0 1px rgba(199, 166, 100, 0.4));
    transition: none;
}

.folio.settled .gilt-path {
    animation: drawGilt 1.4s cubic-bezier(0.2, 0.6, 0.2, 1) forwards;
}

.folio.settled .gilt-path.bottom { animation-delay: 0.15s; }
.folio.settled .gilt-path.left { animation-delay: 0.05s; }
.folio.settled .gilt-path.right { animation-delay: 0.2s; }

@keyframes drawGilt {
    to { stroke-dashoffset: 0; }
}

.gilt-fleuron {
    fill: none;
    stroke: var(--foiled-gilt);
    stroke-width: 1.2;
    stroke-linecap: round;
    opacity: 0;
    filter: drop-shadow(0 0 2px rgba(199, 166, 100, 0.5));
    transition: opacity 0.6s ease-out 0.7s;
}

.folio.settled .gilt-fleuron { opacity: 1; }

.gilt-center-top, .gilt-center-bottom {
    fill: none;
    stroke: var(--foiled-gilt);
    stroke-width: 1.2;
    stroke-linecap: round;
    opacity: 0;
    transition: opacity 0.6s ease-out 0.9s;
}

.gilt-center-top circle, .gilt-center-bottom circle {
    stroke: var(--foiled-gilt);
    stroke-width: 1;
    fill: none;
}

.folio.settled .gilt-center-top,
.folio.settled .gilt-center-bottom { opacity: 1; }

/* =========================== Folio Inner Layout =========================== */
.folio-inner {
    position: relative;
    z-index: 2;
    flex: 1;
    display: grid;
    grid-template-columns: 38% 10% 52%;
    width: 100%;
    height: 100%;
    padding: 64px 52px 64px 52px;
    gap: 0;
}

/* =========================== Recto Column =========================== */
.recto {
    position: relative;
    background: var(--tallow-cream);
    color: var(--walnut-ink);
    padding: 56px 44px 56px 60px;
    overflow: hidden;
    box-shadow:
        inset 0 0 60px rgba(168, 106, 58, 0.08),
        0 0 0 1px rgba(199, 166, 100, 0.18),
        4px 6px 22px rgba(0, 0, 0, 0.5);
    border-radius: 1px;
}

.recto-edge {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    width: 26px;
    background:
        repeating-linear-gradient(
            to bottom,
            transparent 0,
            transparent 22px,
            rgba(168, 106, 58, 0.18) 22px,
            rgba(168, 106, 58, 0.18) 23px
        ),
        linear-gradient(90deg, rgba(168, 106, 58, 0.25), rgba(168, 106, 58, 0.06));
    border-right: 1px solid rgba(168, 106, 58, 0.25);
}

.recto-foxing {
    position: absolute;
    inset: 0;
    pointer-events: none;
    opacity: 0.10;
    background-image:
        radial-gradient(circle at 22% 14%, rgba(168, 106, 58, 0.6) 0%, transparent 3%),
        radial-gradient(circle at 78% 28%, rgba(168, 106, 58, 0.5) 0%, transparent 2%),
        radial-gradient(circle at 44% 62%, rgba(168, 106, 58, 0.7) 0%, transparent 2.5%),
        radial-gradient(circle at 88% 78%, rgba(168, 106, 58, 0.4) 0%, transparent 3%),
        radial-gradient(circle at 12% 88%, rgba(168, 106, 58, 0.55) 0%, transparent 2%),
        radial-gradient(circle at 60% 12%, rgba(168, 106, 58, 0.45) 0%, transparent 1.8%),
        radial-gradient(circle at 30% 40%, rgba(168, 106, 58, 0.35) 0%, transparent 2.2%);
    mix-blend-mode: multiply;
}

.review-header { margin-bottom: 32px; }

.review-eyebrow {
    font-family: var(--num-font);
    font-style: italic;
    font-size: 0.78rem;
    color: var(--aged-pencil-tan);
    letter-spacing: 0.08em;
    text-transform: lowercase;
    margin-bottom: 14px;
}

.review-title {
    font-family: var(--display-font);
    font-weight: 300;
    font-style: italic;
    font-size: clamp(2rem, 4.6vw, 4.6rem);
    line-height: 1.04;
    letter-spacing: -0.012em;
    color: var(--garnet-ink);
    margin-bottom: 16px;
}

.review-byline {
    font-family: var(--num-font);
    font-style: italic;
    font-size: 0.86rem;
    color: var(--aged-pencil-tan);
    letter-spacing: 0.04em;
}

.review-body {
    max-width: 42ch;
    hyphens: auto;
    -webkit-hyphens: auto;
    text-align: left;
}

.review-body p {
    margin-bottom: 14px;
    font-family: var(--body-font);
    font-weight: 400;
    font-size: 1.02rem;
    line-height: 1.62;
    color: var(--walnut-ink);
    text-align: left;
}

.review-body em { font-style: italic; color: var(--walnut-ink); }

.dropcap {
    font-family: var(--display-font);
    font-weight: 600;
    color: var(--garnet-ink);
    float: left;
    font-size: 4.2em;
    line-height: 0.84;
    padding: 6px 10px 0 0;
    margin-top: 6px;
    opacity: 0;
    filter: blur(8px);
    transform: translateY(6px);
    background: linear-gradient(90deg, var(--garnet-ink) 0%, var(--garnet-ink) 40%, var(--foiled-gilt) 50%, var(--garnet-ink) 60%, var(--garnet-ink) 100%);
    background-size: 300% 100%;
    background-position: 100% 0;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    transition: opacity 0.9s ease-out, filter 0.9s ease-out, transform 0.9s ease-out;
}

.folio.settled .dropcap {
    opacity: 1;
    filter: blur(0);
    transform: translateY(0);
    animation: dropcapShimmer 1.2s ease-out 0.9s forwards;
}

@keyframes dropcapShimmer {
    0% { background-position: 100% 0; }
    100% { background-position: 0 0; }
}

/* footnote numerals */
.footnote {
    font-family: var(--num-font);
    font-style: italic;
    font-size: 0.7em;
    color: var(--garnet-ink);
    cursor: crosshair;
    padding: 0 2px;
    border-bottom: 1px dotted transparent;
    transition: border-color 0.3s, color 0.3s;
}

.footnote:hover { color: var(--aged-pencil-tan); border-bottom-color: var(--aged-pencil-tan); }

/* =========================== Gutter =========================== */
.gutter {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    padding: 24px 0;
}

.gutter-fleuron {
    color: var(--foiled-gilt);
    font-size: 1.4rem;
    margin-top: 30vh;
    opacity: 0.6;
    text-shadow: 0 0 6px rgba(199, 166, 100, 0.4);
}

.signature-mark {
    font-family: var(--display-font);
    font-weight: 600;
    font-variant: small-caps;
    font-size: 0.72rem;
    letter-spacing: 0.18em;
    color: var(--foiled-gilt);
    opacity: 0.7;
}

/* =========================== Verso (Marginalia) =========================== */
.verso {
    position: relative;
    overflow: hidden;
    padding: 24px 12px;
}

.verso-foxing {
    position: absolute;
    inset: 0;
    pointer-events: none;
    opacity: 0.06;
    background-image:
        radial-gradient(circle at 18% 22%, rgba(168, 106, 58, 0.5) 0%, transparent 3%),
        radial-gradient(circle at 64% 38%, rgba(168, 106, 58, 0.6) 0%, transparent 2.5%),
        radial-gradient(circle at 82% 76%, rgba(168, 106, 58, 0.4) 0%, transparent 3%);
    mix-blend-mode: screen;
}

.margin-note {
    position: absolute;
    font-family: var(--margin-font);
    color: var(--aged-pencil-tan);
    font-size: 0.96rem;
    line-height: 1.4;
    letter-spacing: 0.005em;
    max-width: 64%;
    text-shadow: 0 0 0.4px rgba(58, 28, 18, 0.5);
    z-index: 3;
    will-change: transform;
}

.margin-note em { font-style: italic; color: var(--aged-pencil-tan); }

.margin-note .ink-spot {
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--walnut-ink);
    margin-right: 4px;
    vertical-align: middle;
    opacity: 0.7;
}

.margin-nav {
    cursor: none;
    position: absolute;
    padding: 4px 6px;
}

.margin-nav .pencil-sketch {
    display: inline-block;
    width: 38px;
    height: 22px;
    margin-left: 6px;
    vertical-align: middle;
    stroke: var(--aged-pencil-tan);
    stroke-width: 1.2;
    fill: none;
}

.margin-nav::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 4px;
    right: 8px;
    height: 1px;
    background: var(--aged-pencil-tan);
    transform: scaleX(0);
    transform-origin: left center;
    transition: transform 0.32s cubic-bezier(0.6, 0, 0.4, 1);
    opacity: 0.7;
}

.margin-nav:hover { color: var(--library-lichen); }
.margin-nav:hover::after { transform: scaleX(1); }

.margin-quip { max-width: 70%; }

.ribbon-scrap {
    display: inline-block;
    background: var(--garnet-ink);
    color: var(--tallow-cream);
    font-family: var(--display-font);
    font-style: italic;
    font-weight: 300;
    font-size: 0.92rem;
    padding: 4px 10px;
    transform: rotate(-1.8deg);
    box-shadow: 2px 3px 6px rgba(0, 0, 0, 0.4);
    line-height: 1.3;
    letter-spacing: 0.01em;
}

.margin-fn .fn-num {
    font-family: var(--num-font);
    font-style: italic;
    font-size: 1.05rem;
    color: var(--garnet-ink);
    margin-right: 4px;
}

.margin-diagram .pencil-sketch {
    display: block;
    width: 80px;
    height: 50px;
    stroke: var(--aged-pencil-tan);
    stroke-width: 1.2;
    fill: none;
    margin-bottom: 4px;
}

.margin-diagram .pencil-sketch.sketch-cat { width: 100px; height: 56px; }
.margin-diagram .pencil-sketch.sketch-spoon { width: 70px; height: 56px; }
.margin-diagram .pencil-sketch.sketch-candle { width: 48px; height: 78px; }

.diagram-caption {
    font-family: var(--margin-font);
    font-size: 0.84rem;
    color: var(--aged-pencil-tan);
    display: block;
}

.margin-blot { width: 30px; height: 30px; }
.margin-blot .ink-blot { width: 100%; height: 100%; }

/* =========================== Folio Foot =========================== */
.folio-foot {
    position: absolute;
    bottom: 22px;
    left: 0;
    right: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
    z-index: 2;
}

.foot-line {
    display: inline-block;
    width: 80px;
    height: 1px;
    background: var(--aged-pencil-tan);
    opacity: 0.6;
}

.foot-numeral {
    font-family: var(--num-font);
    font-style: italic;
    font-size: 0.84rem;
    color: var(--aged-pencil-tan);
    letter-spacing: 0.06em;
}

.foot-fleuron {
    color: var(--foiled-gilt);
    font-size: 0.9rem;
    opacity: 0.7;
}

/* =========================== Frontispiece =========================== */
.frontispiece {
    background: var(--oxblood-vellum);
    display: flex;
    align-items: center;
    justify-content: center;
}

.frontis-inner {
    position: relative;
    z-index: 2;
    text-align: center;
    max-width: 720px;
    padding: 0 60px;
}

.volume-mark {
    font-family: var(--display-font);
    font-weight: 600;
    font-variant: small-caps;
    font-size: 0.92rem;
    letter-spacing: 0.4em;
    color: var(--foiled-gilt);
    margin-bottom: 36px;
    text-shadow: 0 0 4px rgba(199, 166, 100, 0.4);
}

.frontis-title {
    font-family: var(--display-font);
    font-weight: 300;
    font-style: italic;
    font-size: clamp(3.6rem, 9vw, 9rem);
    line-height: 1;
    letter-spacing: -0.02em;
    color: var(--tallow-cream);
    margin-bottom: 28px;
    text-shadow: 0 0 32px rgba(199, 166, 100, 0.18), 0 2px 6px rgba(0, 0, 0, 0.6);
}

.frontis-dedicatio {
    font-family: var(--body-font);
    font-style: italic;
    font-size: 1.18rem;
    line-height: 1.6;
    color: var(--tallow-cream);
    opacity: 0.78;
    margin-bottom: 44px;
    max-width: 56ch;
    margin-left: auto;
    margin-right: auto;
}

.frontis-ornament {
    width: 240px;
    height: 200px;
    margin: 0 auto 32px;
    display: block;
    stroke: var(--foiled-gilt);
    stroke-width: 1.3;
    fill: none;
    stroke-linecap: round;
    stroke-linejoin: round;
    filter: drop-shadow(0 0 4px rgba(199, 166, 100, 0.5));
}

.ornament-book path,
.ornament-moth path,
.ornament-moth circle,
.ornament-flourish {
    stroke: var(--foiled-gilt);
}

.frontis-instruction {
    font-family: var(--display-font);
    font-style: italic;
    font-weight: 300;
    font-size: 1.6rem;
    color: var(--foiled-gilt);
    letter-spacing: 0.04em;
    opacity: 0.7;
    animation: instructionBreath 4s ease-in-out infinite;
}

@keyframes instructionBreath {
    0%, 100% { opacity: 0.5; }
    50% { opacity: 0.85; }
}

/* =========================== Submission =========================== */
.submission-folio { background: var(--oxblood-vellum); }

.submission-inner {
    grid-template-columns: 1fr;
    align-items: center;
    justify-items: center;
}

.submission-scrap {
    width: min(640px, 72vw);
    transform: rotate(-1.4deg);
}

.scrap-paper {
    position: relative;
    background: var(--tallow-cream);
    padding: 44px 48px;
    box-shadow:
        4px 8px 24px rgba(0, 0, 0, 0.55),
        inset 0 0 40px rgba(168, 106, 58, 0.08);
    clip-path: polygon(
        2% 0%, 98% 1%, 99% 8%, 100% 18%, 99% 30%, 100% 44%, 98% 58%,
        100% 72%, 99% 86%, 100% 96%, 96% 100%, 82% 99%, 64% 100%, 48% 98%,
        30% 100%, 14% 99%, 2% 100%, 1% 88%, 0% 72%, 1% 56%, 0% 40%,
        1% 24%, 0% 12%, 2% 4%
    );
}

.scrap-foxing {
    position: absolute;
    inset: 0;
    pointer-events: none;
    opacity: 0.10;
    background-image:
        radial-gradient(circle at 20% 30%, rgba(168, 106, 58, 0.5) 0%, transparent 3%),
        radial-gradient(circle at 76% 60%, rgba(168, 106, 58, 0.6) 0%, transparent 2%),
        radial-gradient(circle at 40% 80%, rgba(168, 106, 58, 0.4) 0%, transparent 2.5%);
}

.scrap-title {
    font-family: var(--display-font);
    font-style: italic;
    font-weight: 300;
    font-size: 2.4rem;
    color: var(--garnet-ink);
    margin-bottom: 14px;
}

.scrap-instr {
    font-family: var(--body-font);
    font-style: italic;
    font-size: 1rem;
    color: var(--walnut-ink);
    margin-bottom: 22px;
    line-height: 1.55;
}

.margin-textarea {
    width: 100%;
    background: transparent;
    border: none;
    border-bottom: 1px dashed var(--aged-pencil-tan);
    font-family: var(--margin-font);
    font-size: 1.3rem;
    line-height: 1.6;
    color: var(--walnut-ink);
    padding: 8px 4px;
    resize: vertical;
    outline: none;
    transition: transform 0.4s ease;
    transform-origin: left top;
    min-height: 140px;
}

.margin-textarea::placeholder {
    color: var(--aged-pencil-tan);
    opacity: 0.6;
    font-style: italic;
}

.scrap-actions {
    margin-top: 24px;
    display: flex;
    justify-content: flex-end;
}

.bind-btn {
    background: transparent;
    border: 1px solid var(--garnet-ink);
    color: var(--garnet-ink);
    font-family: var(--display-font);
    font-style: italic;
    font-weight: 500;
    font-size: 1.1rem;
    padding: 10px 22px;
    cursor: none;
    transition: background 0.4s, color 0.4s;
    letter-spacing: 0.02em;
}

.bind-btn:hover {
    background: var(--garnet-ink);
    color: var(--tallow-cream);
}

.bind-btn.bound {
    background: var(--library-lichen);
    color: var(--tallow-cream);
    border-color: var(--library-lichen);
}

.scrap-footnote {
    margin-top: 18px;
    font-family: var(--num-font);
    font-style: italic;
    font-size: 0.82rem;
    color: var(--aged-pencil-tan);
    text-align: right;
}

/* =========================== Colophon =========================== */
.colophon-folio { background: var(--oxblood-vellum); }
.colophon-inner {
    grid-template-columns: 1fr;
    align-items: center;
    justify-items: center;
    text-align: center;
}

.colophon { max-width: 640px; padding: 40px; }

.colophon-title {
    font-family: var(--display-font);
    font-style: italic;
    font-weight: 300;
    font-size: 3rem;
    color: var(--foiled-gilt);
    margin-bottom: 28px;
    letter-spacing: 0.02em;
}

.colophon-text {
    font-family: var(--body-font);
    font-size: 1.1rem;
    line-height: 1.85;
    color: var(--tallow-cream);
    opacity: 0.78;
    margin-bottom: 36px;
}

.colophon-finis {
    font-family: var(--display-font);
    font-style: italic;
    font-size: 1.4rem;
    color: var(--foiled-gilt);
    letter-spacing: 0.4em;
    text-transform: lowercase;
    opacity: 0.6;
}

/* =========================== Aside Folio =========================== */
.aside-folio {
    position: fixed;
    top: 0;
    left: 100vw;
    width: 100vw;
    height: 100vh;
    background: var(--oxblood-vellum);
    z-index: 30;
    transition: left 1.1s cubic-bezier(0.6, 0, 0.3, 1);
    pointer-events: none;
    display: flex;
    align-items: center;
    justify-content: center;
}

.aside-folio.open {
    left: 0;
    pointer-events: auto;
}

.aside-inner {
    position: relative;
    width: min(660px, 80vw);
    height: min(720px, 86vh);
    background: var(--tallow-cream);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.7);
    padding: 60px;
    overflow: hidden;
}

.aside-gilt { inset: 14px; }
.aside-content { position: relative; z-index: 2; height: 100%; display: flex; flex-direction: column; }

.aside-eyebrow {
    font-family: var(--num-font);
    font-style: italic;
    font-size: 0.86rem;
    color: var(--aged-pencil-tan);
    letter-spacing: 0.1em;
    margin-bottom: 14px;
}

.aside-title {
    font-family: var(--display-font);
    font-style: italic;
    font-weight: 300;
    font-size: 2.6rem;
    color: var(--garnet-ink);
    margin-bottom: 24px;
}

.aside-body {
    font-family: var(--body-font);
    font-size: 1.04rem;
    line-height: 1.62;
    color: var(--walnut-ink);
    flex: 1;
    overflow-y: auto;
    max-width: 52ch;
}

.aside-body p { margin-bottom: 12px; }

.return-pencil {
    margin-top: 24px;
    background: transparent;
    border: none;
    color: var(--aged-pencil-tan);
    font-family: var(--margin-font);
    font-size: 1.1rem;
    cursor: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 4px;
    align-self: flex-start;
    opacity: 0;
    transition: opacity 0.6s ease 0.4s;
}

.aside-folio.open .return-pencil { opacity: 1; }

.return-pencil svg { width: 60px; height: 24px; }

/* =========================== Footnote Popover =========================== */
.fn-popover {
    position: fixed;
    z-index: 40;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.22s ease;
    width: 280px;
}

.fn-popover.visible {
    opacity: 1;
    pointer-events: auto;
}

.fn-popover .scrap {
    position: relative;
    background: var(--tallow-cream);
    padding: 18px 22px;
    transform: scale(0.94) translateY(-4px) rotate(-2.4deg);
    transform-origin: 20% 100%;
    transition: transform 0.22s cubic-bezier(0.4, 1.6, 0.6, 1);
    box-shadow: 4px 6px 16px rgba(0, 0, 0, 0.5);
    clip-path: polygon(
        4% 0%, 96% 2%, 98% 14%, 100% 28%, 99% 48%, 100% 66%, 98% 82%,
        100% 96%, 90% 100%, 76% 98%, 60% 100%, 44% 99%, 28% 100%,
        12% 98%, 2% 100%, 0% 84%, 1% 64%, 0% 44%, 2% 22%, 0% 6%
    );
}

.fn-popover.visible .scrap {
    transform: scale(1) translateY(0) rotate(-2.4deg);
}

.fn-popover .scrap-text {
    font-family: var(--margin-font);
    font-size: 0.96rem;
    color: var(--walnut-ink);
    line-height: 1.45;
}

.fn-popover .scrap-foxing {
    position: absolute;
    inset: 0;
    opacity: 0.08;
    background-image:
        radial-gradient(circle at 30% 40%, rgba(168, 106, 58, 0.5) 0%, transparent 3%),
        radial-gradient(circle at 70% 70%, rgba(168, 106, 58, 0.4) 0%, transparent 2%);
}

/* =========================== Candle =========================== */
.candle-mount {
    position: fixed;
    bottom: 24px;
    right: 36px;
    width: 100px;
    height: 240px;
    z-index: 20;
    pointer-events: auto;
}

.candle-svg {
    width: 100%;
    height: 100%;
    overflow: visible;
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.6));
}

.candle-halo {
    position: absolute;
    inset: -120px -160px -40px -120px;
    background: radial-gradient(circle at 50% 30%, rgba(199, 166, 100, 0.22) 0%, rgba(199, 166, 100, 0.10) 18%, transparent 55%);
    pointer-events: none;
    z-index: -1;
    animation: haloFlicker 3.6s ease-in-out infinite;
}

@keyframes haloFlicker {
    0%, 100% { opacity: 0.92; transform: scale(1); }
    33% { opacity: 1; transform: scale(1.04); }
    66% { opacity: 0.86; transform: scale(0.98); }
}

#candleFlame {
    transform-origin: 50px 68px;
}

#flameOuter, #flameInner {
    transform-origin: 50px 68px;
}

#waxBody { transition: d 1s linear; }

/* candle puddle - revealed when stub is exhausted */
.candle-puddle {
    position: absolute;
    bottom: 12px;
    left: 0;
    right: 0;
    height: 12px;
    background: radial-gradient(ellipse at center, var(--tallow-cream) 0%, rgba(244, 233, 210, 0.6) 60%, transparent 100%);
    border-radius: 50%;
    opacity: 0;
    transition: opacity 1.6s;
    transform: scaleX(1.4);
}

.candle-puddle.melted { opacity: 0.8; }

/* =========================== Cursor =========================== */
.custom-cursor {
    position: fixed;
    pointer-events: none;
    z-index: 100;
    opacity: 0;
    transition: opacity 0.25s;
    width: 32px;
    height: 32px;
    transform: translate(-2px, -2px);
}

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

.pencil-cursor.active { opacity: 1; }

.breath-cursor {
    width: 60px;
    height: 30px;
    transform: translate(-30px, -15px);
}

.breath-cursor.active { opacity: 1; animation: breathPuff 1.6s ease-out infinite; }

@keyframes breathPuff {
    0% { transform: translate(-30px, -15px) scale(0.6); opacity: 0; }
    25% { opacity: 0.8; }
    100% { transform: translate(0, -25px) scale(1.4); opacity: 0; }
}

/* hide native cursor where custom cursors apply */
.verso, .footnote, .candle-mount, .return-pencil, .bind-btn { cursor: none; }
.recto, .review-body { cursor: text; }

/* =========================== Marginalia Breath Animation =========================== */
.margin-note {
    animation: marginBreathe var(--breath-dur, 11s) ease-in-out infinite;
    animation-delay: var(--breath-delay, 0s);
}

@keyframes marginBreathe {
    0%, 100% { transform: rotate(var(--rot, 0deg)) translateY(0); }
    50% { transform: rotate(calc(var(--rot, 0deg) + var(--breath-amp, 0.3deg))) translateY(-1px); }
}

/* =========================== Responsive =========================== */
@media (max-width: 900px) {
    .folio-inner {
        grid-template-columns: 1fr;
        padding: 60px 24px;
        gap: 16px;
    }
    .folio { height: auto; min-height: 100vh; padding-bottom: 80px; }
    .recto { padding: 36px 24px 36px 36px; }
    .gutter { display: none; }
    .verso { position: relative; min-height: 400px; padding: 24px 6px; }
    .review-body { max-width: 100%; }
    .candle-mount { width: 70px; height: 168px; right: 16px; bottom: 12px; }
    .frontis-title { font-size: clamp(2.6rem, 14vw, 4.6rem); }
    .silk-ribbon { display: none; }
}

@media (max-width: 560px) {
    .review-title { font-size: clamp(1.8rem, 6vw, 2.6rem); }
    .recto { padding: 24px 18px 24px 30px; }
    .margin-note { font-size: 0.88rem; }
    .ribbon-scrap { font-size: 0.84rem; }
}
