/* ============================================================
   diplomacy.boo v2 — Victorian Diplomatic Archive
   ============================================================ */

/* --- PALETTE ---
   #F5E6C8  Aged Parchment      (primary background surface)
   #2B1810  Diplomatic Ink      (primary text, headlines)
   #3D2B1F  Archive Brown       (body text)
   #8B2500  Wax Seal Red        (accent, seals, important markers, hover)
   #5C1A00  Wax Seal Red Deep   (inner seal)
   #8B6914  Tarnished Brass     (ornamental rules, borders, decorative lines)
   #6B4423  Marginalia Umber    (annotation text, secondary accents)
   #1A120A  Shadow Between Pages(interleaf gaps, footer)
   #D4A24E  Candlelight Amber   (warm glow effects, highlights on hover)
   #EDE0C8  Vellum Cream        (card backgrounds, secondary surfaces)
   #5A4A3A  Ink Fade            (mono accents)
   #C4A46B  Brass Pale          (page gutter dashed)
   #D4C4A8  Card Rule           (faint horizontal rule lines on treaty cards)
   #E8D4B0  Closing Parchment   (slightly darker closing-folio surface)
*/

:root {
    --c-parchment: #F5E6C8;
    --c-ink: #2B1810;
    --c-archive-brown: #3D2B1F;
    --c-wax: #8B2500;
    --c-wax-deep: #5C1A00;
    --c-brass: #8B6914;
    --c-brass-pale: #C4A46B;
    --c-umber: #6B4423;
    --c-shadow: #1A120A;
    --c-amber: #D4A24E;
    --c-vellum: #EDE0C8;
    --c-ink-fade: #5A4A3A;
    --c-card-rule: #D4C4A8;
    --c-closing: #E8D4B0;

    --f-display: 'Playfair Display', 'Lora', Georgia, serif;
    --f-body: 'Lora', Georgia, 'Times New Roman', serif;
    --f-marginalia: 'Caveat', 'Lora', cursive;
    --f-mono: 'Courier Prime', 'Courier New', monospace;

    --gutter-major: 61.8%;
    --gutter-minor: 38.2%;

    --ease-page: cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* --- RESET --- */
*, *::before, *::after { box-sizing: border-box; }
html, body {
    margin: 0;
    padding: 0;
    background: var(--c-shadow);
    color: var(--c-archive-brown);
    font-family: var(--f-body);
    line-height: 1.85;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

body {
    position: relative;
    min-height: 100vh;
    font-size: clamp(15px, 1.05vw, 18px);
    scroll-behavior: smooth;
}

img { max-width: 100%; display: block; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }

/* --- PAPER TEXTURE LAYER --- */
.paper-texture {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 1;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='400' height='400'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='4' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0.18  0 0 0 0 0.10  0 0 0 0 0.06  0 0 0 0.18 0'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
    background-size: 400px 400px;
    opacity: 0.08;
    mix-blend-mode: multiply;
}

/* --- CANDLELIGHT FLICKER --- */
.candlelight-flicker {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 2;
    background: radial-gradient(ellipse 80vw 60vh at 50% 0%,
                rgba(212, 162, 78, 0.22) 0%,
                rgba(212, 162, 78, 0.08) 35%,
                transparent 70%);
    animation: candlelight-pulse 4s ease-in-out infinite alternate;
    will-change: opacity;
}
@keyframes candlelight-pulse {
    0%   { opacity: 0.55; }
    25%  { opacity: 0.78; }
    50%  { opacity: 0.62; }
    75%  { opacity: 0.84; }
    100% { opacity: 0.60; }
}

/* --- OPENING CURTAIN --- */
.opening-curtain {
    position: fixed;
    inset: 0;
    background: var(--c-shadow);
    z-index: 9000;
    pointer-events: none;
    opacity: 1;
    transition: opacity 1s var(--ease-page);
}
.opening-curtain::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse at center,
                transparent 0%,
                transparent 28%,
                rgba(26, 18, 10, 0.9) 78%,
                rgba(26, 18, 10, 1) 100%);
}
body.archive-open .opening-curtain { opacity: 0; }

/* --- BOOK CONTAINER --- */
.folio-book {
    position: relative;
    z-index: 5;
    background: var(--c-parchment);
    scroll-snap-type: y proximity;
    overflow-x: hidden;
}

/* --- FOLIO BASE --- */
.folio {
    position: relative;
    min-height: 90vh;
    padding: clamp(48px, 8vh, 96px) clamp(24px, 6vw, 88px);
    background: var(--c-parchment);
    scroll-snap-align: start;
    overflow: hidden;
}

.folio-title,
.folio-closing {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 0;
}

/* --- INTERLEAF (shadow between pages) --- */
.interleaf {
    position: relative;
    height: 30vh;
    background: linear-gradient(
        to bottom,
        var(--c-parchment) 0%,
        rgba(26, 18, 10, 0.92) 22%,
        rgba(26, 18, 10, 0.96) 50%,
        rgba(26, 18, 10, 0.92) 78%,
        var(--c-parchment) 100%
    );
    display: grid;
    place-items: center;
    z-index: 6;
}
.interleaf::before, .interleaf::after {
    content: '';
    position: absolute;
    left: 0; right: 0; height: 6px;
    pointer-events: none;
}
.interleaf::before {
    top: 0;
    background: linear-gradient(to bottom, rgba(26,18,10,0.0) 0%, rgba(26,18,10,0.4) 100%);
}
.interleaf::after {
    bottom: 0;
    background: linear-gradient(to top, rgba(26,18,10,0.0) 0%, rgba(26,18,10,0.4) 100%);
}
.ornament-rule {
    width: min(40vw, 380px);
    height: 24px;
    color: var(--c-brass);
    opacity: 0.85;
}

/* --- TITLE FOLIO --- */
.parchment-surface {
    position: relative;
    width: 100%;
    height: 100vh;
    display: grid;
    place-items: center;
    background: var(--c-parchment);
}
.parchment-surface-dim { background: var(--c-closing); }

.title-stack {
    text-align: center;
    max-width: 720px;
    padding: 0 24px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 18px;
}

/* --- WAX SEAL --- */
.wax-seal {
    --seal-size: 132px;
    position: relative;
    width: var(--seal-size);
    height: var(--seal-size);
    border-radius: 50%;
    background:
        radial-gradient(circle at 35% 32%,
            rgba(212, 162, 78, 0.85) 0%,
            rgba(139, 37, 0, 0.95) 28%,
            var(--c-wax) 55%,
            var(--c-wax-deep) 100%);
    box-shadow:
        inset 0 0 18px rgba(255, 220, 170, 0.18),
        inset -6px -8px 18px rgba(26, 18, 10, 0.55),
        inset 6px 8px 14px rgba(255, 220, 170, 0.12),
        0 6px 14px rgba(26, 18, 10, 0.45),
        0 0 0 1px rgba(26, 18, 10, 0.25);
    display: grid;
    place-items: center;
    transform: scale(0.5);
    opacity: 0;
    transition: transform 0.6s cubic-bezier(0.34, 1.56, 0.64, 1),
                opacity 0.6s var(--ease-page),
                box-shadow 0.6s ease;
}
.wax-seal-inner {
    position: relative;
    width: 76%; height: 76%;
    border-radius: 50%;
    border: 1px dashed rgba(245, 230, 200, 0.35);
    display: grid;
    place-items: center;
    background:
        radial-gradient(circle at 50% 50%,
            rgba(255, 220, 170, 0.10) 0%,
            transparent 60%);
}
.wax-seal-monogram {
    font-family: var(--f-display);
    font-weight: 700;
    font-style: italic;
    font-size: calc(var(--seal-size) * 0.26);
    letter-spacing: 0.14em;
    color: var(--c-parchment);
    text-shadow:
        0 1px 0 rgba(26, 18, 10, 0.55),
        0 -1px 0 rgba(255, 220, 170, 0.18);
    user-select: none;
}
.wax-seal-glow {
    position: absolute;
    inset: -22px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(212, 162, 78, 0.0) 50%, rgba(212, 162, 78, 0.0) 100%);
    pointer-events: none;
    transition: background 0.6s ease;
}
.wax-seal:hover {
    box-shadow:
        inset 0 0 24px rgba(255, 220, 170, 0.32),
        inset -6px -8px 18px rgba(26, 18, 10, 0.55),
        inset 6px 8px 14px rgba(255, 220, 170, 0.18),
        0 6px 14px rgba(26, 18, 10, 0.45),
        0 0 30px 10px rgba(212, 162, 78, 0.25);
}
.wax-seal.is-revealed {
    transform: scale(1);
    opacity: 1;
}
.wax-seal-glow-dim { display: none; }

/* Broken seal (closing) */
.wax-seal-broken { filter: saturate(0.82) brightness(0.92); }
.wax-seal-crack {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}
.wax-seal-crack path {
    stroke-dasharray: 320;
    stroke-dashoffset: 320;
    transition: stroke-dashoffset 1.5s ease-in;
}
.wax-seal-broken.is-cracked .wax-seal-crack path { stroke-dashoffset: 0; }

/* --- TITLE TEXT --- */
.title-domain {
    margin: 6px 0 0 0;
    font-family: var(--f-display);
    font-weight: 700;
    font-size: clamp(28px, 4.5vw, 56px);
    letter-spacing: 0.04em;
    color: var(--c-ink);
    line-height: 1.05;
    min-height: 1.2em;
}
.title-letters { display: inline-block; }
.title-letters .ch {
    display: inline-block;
    opacity: 0;
    transform: translateY(4px);
    transition: opacity 0.4s var(--ease-page),
                transform 0.4s var(--ease-page);
}
.title-letters .ch.is-on {
    opacity: 1;
    transform: translateY(0);
}

.title-underline {
    width: clamp(220px, 30vw, 360px);
    height: 14px;
    margin-top: -2px;
    color: var(--c-wax);
    overflow: visible;
}
.title-underline path {
    stroke-dasharray: 420;
    stroke-dashoffset: 420;
    transition: stroke-dashoffset 0.8s var(--ease-page);
}
.title-underline.is-drawn path { stroke-dashoffset: 0; }

.title-subtitle {
    margin: 22px 0 0 0;
    font-family: var(--f-body);
    font-style: italic;
    font-size: clamp(15px, 1.1vw, 19px);
    color: var(--c-archive-brown);
    max-width: 540px;
}
.title-subtitle em { color: var(--c-umber); font-weight: 700; font-style: italic; }

.archive-ref {
    margin-top: 14px;
    font-family: var(--f-mono);
    font-size: 13px;
    letter-spacing: 0.18em;
    color: var(--c-ink-fade);
    text-transform: uppercase;
}

.scroll-invitation {
    position: absolute;
    bottom: 5vh;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    opacity: 0;
    transition: opacity 0.6s var(--ease-page) 0.3s;
    animation: chev-pulse 2s ease-in-out infinite;
}
.scroll-invitation.is-on { opacity: 0.6; }
.scroll-invitation-text {
    font-family: var(--f-mono);
    font-size: 11px;
    letter-spacing: 0.22em;
    color: var(--c-brass);
    text-transform: uppercase;
}
.chevron {
    width: 22px; height: 11px;
}
@keyframes chev-pulse {
    0%, 100% { opacity: 0.4; }
    50%      { opacity: 0.8; }
}

/* --- FOLIO HEADER --- */
.folio-header {
    position: relative;
    margin-bottom: clamp(28px, 5vh, 56px);
    text-align: left;
    max-width: 1200px;
}
.folio-tab {
    display: inline-block;
    padding: 4px 10px;
    background: var(--c-vellum);
    border: 1px solid var(--c-brass);
    font-family: var(--f-mono);
    font-size: 12px;
    letter-spacing: 0.2em;
    color: var(--c-umber);
    text-transform: uppercase;
}
.folio-title {
    margin: 18px 0 12px 0;
    font-family: var(--f-display);
    font-weight: 700;
    font-style: italic;
    color: var(--c-ink);
    font-size: clamp(28px, 4vw, 52px);
    letter-spacing: 0.02em;
    line-height: 1.1;
}
.ornament-header {
    width: clamp(220px, 30vw, 320px);
    height: 18px;
    color: var(--c-brass);
    display: block;
    overflow: visible;
}
.ornament-header path {
    stroke-dasharray: 600;
    stroke-dashoffset: 600;
    transition: stroke-dashoffset 1.2s ease-out;
}
.folio.is-in-view .ornament-header path,
.ornament-rule.is-in-view path { stroke-dashoffset: 0; }
.ornament-rule path {
    stroke-dasharray: 700;
    stroke-dashoffset: 700;
    transition: stroke-dashoffset 1.2s ease-out;
}

.folio-dateline {
    margin: 12px 0 0 0;
    font-family: var(--f-mono);
    font-size: 12px;
    letter-spacing: 0.18em;
    color: var(--c-ink-fade);
    text-transform: uppercase;
}

/* --- TWO-COLUMN SPREAD --- */
.folio-spread {
    display: grid;
    grid-template-columns: var(--gutter-major) var(--gutter-minor);
    gap: clamp(24px, 4vw, 64px);
    align-items: start;
    max-width: 1240px;
    position: relative;
}
.folio-spread::before {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    left: var(--gutter-major);
    margin-left: calc(clamp(24px, 4vw, 64px) * -0.5);
    border-left: 2px dashed rgba(196, 164, 107, 0.3);
    pointer-events: none;
}
.folio-spread-reversed {
    grid-template-columns: var(--gutter-minor) var(--gutter-major);
}
.folio-spread-reversed::before {
    left: var(--gutter-minor);
}

.column-major {
    font-family: var(--f-body);
    color: var(--c-archive-brown);
    font-size: clamp(15px, 1.1vw, 19px);
    line-height: 1.85;
}
.column-major p {
    margin: 0 0 1.5em 0;
    text-align: justify;
    hyphens: auto;
}
.column-major em { color: var(--c-wax); font-style: italic; }
.column-major strong { color: var(--c-ink); font-weight: 700; }

/* --- DROP CAP --- */
.dropcap-paragraph { position: relative; }
.dropcap {
    float: left;
    font-family: var(--f-display);
    font-weight: 700;
    font-size: 4.6em;
    line-height: 0.85;
    padding: 0.05em 0.12em 0 0;
    margin-right: 0.06em;
    margin-top: 0.08em;
    color: var(--c-wax);
    font-style: italic;
}

/* --- MARGINALIA --- */
.column-minor {
    position: relative;
    padding-top: 12px;
    display: flex;
    flex-direction: column;
    gap: 28px;
}
.marginalia {
    font-family: var(--f-marginalia);
    color: var(--c-umber);
    font-size: clamp(15px, 1.1vw, 19px);
    line-height: 1.5;
    padding: 8px 14px;
    border-left: 2px solid var(--c-brass-pale);
    opacity: 0;
    transform: translateX(30px);
    transition: opacity 0.7s var(--ease-page),
                transform 0.7s var(--ease-page);
    will-change: transform, opacity;
}
.folio.is-in-view .marginalia { opacity: 1; transform: translateX(0); }

.marginalia p { margin: 0; }
.marginalia .mono-accent { color: var(--c-ink-fade); }
.marginalia em { color: var(--c-wax); font-style: italic; }
.marginalia-bracket {
    font-family: var(--f-display);
    font-style: italic;
    color: var(--c-wax);
    margin-right: 4px;
}
.marginalia-tilt-a { transform: translateX(30px) rotate(-1.6deg); }
.folio.is-in-view .marginalia-tilt-a { transform: translateX(0) rotate(-1.6deg); }
.marginalia-tilt-b { transform: translateX(30px) rotate(1.2deg); padding-left: 18px; }
.folio.is-in-view .marginalia-tilt-b { transform: translateX(0) rotate(1.2deg); }
.marginalia-tilt-c { transform: translateX(30px) rotate(-2.6deg); }
.folio.is-in-view .marginalia-tilt-c { transform: translateX(0) rotate(-2.6deg); }
.marginalia-tilt-d { transform: translateX(30px) rotate(2.2deg); }
.folio.is-in-view .marginalia-tilt-d { transform: translateX(0) rotate(2.2deg); }

/* --- MONO ACCENT --- */
.mono-accent {
    font-family: var(--f-mono);
    font-size: 0.86em;
    letter-spacing: 0.08em;
    color: var(--c-ink-fade);
}

/* --- TREATY GALLERY --- */
.folio-gallery { padding-bottom: 0; }
.gallery-intro {
    max-width: 720px;
    font-family: var(--f-body);
    font-style: italic;
    font-size: clamp(15px, 1.1vw, 19px);
    color: var(--c-archive-brown);
    margin: 0 0 24px 0;
}
.gallery-intro em { color: var(--c-wax); }

.gallery-controls {
    display: flex;
    gap: 10px;
    margin: 0 0 18px 0;
}
.gallery-arrow {
    width: 42px; height: 42px;
    border-radius: 50%;
    background: var(--c-vellum);
    border: 1px solid var(--c-brass);
    color: var(--c-ink);
    font-family: var(--f-display);
    font-size: 22px;
    line-height: 1;
    transition: background 0.3s ease, color 0.3s ease, box-shadow 0.4s ease;
}
.gallery-arrow:hover {
    background: var(--c-amber);
    color: var(--c-ink);
    box-shadow: 0 0 18px 4px rgba(212, 162, 78, 0.3);
}

.treaty-rail {
    display: flex;
    gap: 28px;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 30px 8px 60px 8px;
    scroll-snap-type: x proximity;
    scrollbar-width: thin;
    scrollbar-color: var(--c-brass) transparent;
    cursor: grab;
}
.treaty-rail::-webkit-scrollbar { height: 6px; }
.treaty-rail::-webkit-scrollbar-track { background: transparent; }
.treaty-rail::-webkit-scrollbar-thumb {
    background: var(--c-brass);
    border-radius: 3px;
}
.treaty-rail.is-grabbing { cursor: grabbing; }

/* --- TREATY CARDS --- */
.treaty-card {
    --rot: var(--card-rot, 0deg);
    flex: 0 0 280px;
    width: 280px;
    height: 380px;
    position: relative;
    background: var(--c-vellum);
    background-image: repeating-linear-gradient(
        to bottom,
        transparent 0,
        transparent 27px,
        var(--c-card-rule) 27px,
        var(--c-card-rule) 28px
    );
    color: var(--c-archive-brown);
    padding: 28px 22px 22px 22px;
    clip-path: polygon(0 0, calc(100% - 24px) 0, 100% 24px, 100% 100%, 0 100%);
    box-shadow:
        2px 4px 8px rgba(26, 18, 10, 0.18),
        6px 10px 22px rgba(26, 18, 10, 0.22);
    transform: rotate(var(--rot));
    transition: transform 0.5s var(--ease-page),
                box-shadow 0.5s var(--ease-page);
    scroll-snap-align: center;
    opacity: 0;
}
.treaty-card.is-on { opacity: 1; }
.treaty-card:hover {
    transform: rotate(0deg) translateY(-6px);
    box-shadow:
        2px 4px 12px rgba(26, 18, 10, 0.22),
        8px 14px 30px rgba(26, 18, 10, 0.32),
        0 0 26px 6px rgba(212, 162, 78, 0.18);
}
.treaty-fold {
    position: absolute;
    top: 0; right: 0;
    width: 24px; height: 24px;
    background: linear-gradient(135deg,
        var(--c-card-rule) 0%,
        var(--c-brass-pale) 50%,
        var(--c-brass) 100%);
    box-shadow: -1px 1px 2px rgba(26, 18, 10, 0.35);
    pointer-events: none;
}
.treaty-stamp {
    position: absolute;
    top: 18px; right: 36px;
    transform: rotate(-9deg);
    border: 1.5px solid var(--c-wax);
    color: var(--c-wax);
    padding: 2px 8px;
    font-family: var(--f-mono);
    font-weight: 700;
    font-size: 10px;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    background: rgba(245, 230, 200, 0.4);
}
.treaty-meta {
    margin: 0 0 10px 0;
    color: var(--c-ink-fade);
}
.treaty-title {
    margin: 0 0 12px 0;
    font-family: var(--f-display);
    font-weight: 700;
    font-style: italic;
    color: var(--c-ink);
    font-size: 22px;
    line-height: 1.15;
}
.treaty-blurb {
    margin: 0;
    font-family: var(--f-body);
    font-size: 14px;
    line-height: 1.6;
}
.treaty-foot {
    position: absolute;
    bottom: 16px; left: 22px; right: 22px;
    margin: 0;
    color: var(--c-umber);
    font-size: 11px;
    border-top: 1px solid var(--c-card-rule);
    padding-top: 8px;
}

/* --- REGISTER --- */
.register {
    max-width: 980px;
    background: rgba(237, 224, 200, 0.55);
    border: 1px solid var(--c-brass-pale);
    padding: clamp(24px, 4vw, 48px);
    box-shadow: inset 0 0 40px rgba(139, 105, 20, 0.06);
}
.register-list {
    list-style: none;
    counter-reset: register;
    padding: 0; margin: 0;
    display: grid;
    gap: 22px;
}
.register-entry {
    display: grid;
    grid-template-columns: 56px 1.2fr 1fr;
    grid-template-rows: auto auto;
    column-gap: 22px;
    row-gap: 4px;
    padding-bottom: 18px;
    border-bottom: 1px dashed rgba(196, 164, 107, 0.5);
}
.register-entry:last-child { border-bottom: 0; padding-bottom: 0; }
.register-num {
    font-family: var(--f-mono);
    font-size: 16px;
    color: var(--c-wax);
    letter-spacing: 0.1em;
    grid-column: 1; grid-row: 1 / span 2;
    align-self: start;
    padding-top: 2px;
}
.register-name {
    font-family: var(--f-display);
    font-style: italic;
    font-weight: 700;
    color: var(--c-ink);
    font-size: clamp(18px, 1.5vw, 24px);
    grid-column: 2; grid-row: 1;
}
.register-place {
    font-family: var(--f-mono);
    font-size: 12px;
    letter-spacing: 0.14em;
    color: var(--c-ink-fade);
    grid-column: 3; grid-row: 1;
    text-transform: uppercase;
    align-self: end;
}
.register-note {
    grid-column: 2 / span 2; grid-row: 2;
    font-family: var(--f-body);
    font-style: italic;
    color: var(--c-archive-brown);
    font-size: clamp(14px, 1vw, 17px);
    line-height: 1.7;
}

/* --- CLOSING FOLIO --- */
.folio-closing { background: var(--c-closing); }
.closing-title {
    margin: 22px 0 18px 0;
    font-family: var(--f-display);
    font-style: italic;
    font-weight: 700;
    color: var(--c-ink);
    font-size: clamp(26px, 3.6vw, 44px);
    letter-spacing: 0.04em;
}
.closing-body {
    max-width: 560px;
    font-family: var(--f-body);
    color: var(--c-archive-brown);
    font-size: clamp(15px, 1.1vw, 19px);
    line-height: 1.85;
    margin: 0 0 20px 0;
}
.closing-signoff {
    margin: 0 0 24px 0;
}
.closing-signoff .mono-accent {
    color: var(--c-umber);
    letter-spacing: 0.14em;
}

/* --- FOOTER --- */
.folio-footer {
    background: var(--c-shadow);
    color: var(--c-brass-pale);
    padding: 28px 24px;
    text-align: center;
    z-index: 7;
    position: relative;
}
.footer-line {
    margin: 0;
    font-family: var(--f-mono);
    font-size: 12px;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--c-brass);
    opacity: 0.85;
}

/* --- PROGRESS INDICATOR --- */
.folio-progress {
    position: fixed;
    top: 50%;
    right: 18px;
    transform: translateY(-50%);
    z-index: 100;
    pointer-events: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    opacity: 0;
    transition: opacity 0.6s var(--ease-page);
    color: var(--c-brass);
}
.folio-progress.is-on { opacity: 0.65; }
.progress-label {
    font-size: 10px;
    letter-spacing: 0.24em;
    text-transform: uppercase;
}
.progress-num {
    font-family: var(--f-display);
    font-style: italic;
    font-weight: 700;
    font-size: 26px;
    color: var(--c-wax);
    transition: color 0.4s ease;
}

/* --- RESPONSIVE --- */
@media (max-width: 880px) {
    .folio-spread,
    .folio-spread-reversed {
        grid-template-columns: 1fr;
    }
    .folio-spread::before { display: none; }
    .column-minor { padding-top: 0; }
    .register-entry {
        grid-template-columns: 36px 1fr;
        grid-template-rows: auto auto auto;
    }
    .register-place {
        grid-column: 2; grid-row: 2;
        align-self: start;
    }
    .register-note {
        grid-column: 2; grid-row: 3;
    }
    .folio-progress { display: none; }
}

@media (max-width: 540px) {
    .folio { padding: 64px 22px; }
    .wax-seal { --seal-size: 108px; }
    .title-domain { font-size: clamp(26px, 8vw, 44px); }
    .gallery-controls { display: none; }
}

/* --- REDUCED MOTION --- */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    .candlelight-flicker { animation: none; opacity: 0.65; }
    .opening-curtain { transition: none; opacity: 0; }
    .wax-seal { opacity: 1; transform: scale(1); }
    .marginalia { opacity: 1; transform: none !important; }
    .treaty-card { opacity: 1; }
    .title-letters .ch { opacity: 1; transform: none; }
    .title-underline path { stroke-dashoffset: 0; }
    .ornament-header path, .ornament-rule path { stroke-dashoffset: 0; }
    .scroll-invitation { animation: none; opacity: 0.6; }
}
