/* =====================================================================
   aiice.io — Iridescent Sepia Codex
   Y2K futurism filtered through an antiquarian bookshop
   Interactive elements feature a brief iridescent shimmer on hover: a
   `linear-gradient` from `#A89CC8` to `#C9A84C` that sweeps across the
   element's background at 10% opacity via `background-position` animation.
   Intersection Observer triggers class changes on the left panel that morph
   the watercolor gradients (CSS transitions). Intersection Observer with
   `threshold: [0, 0.25, 0.5, 0.75, 1]` drives chapter state. [0
   ===================================================================== */

/* ---------- Root tokens ---------- */
:root {
    --c-vellum: #F2E8D5;        /* primary background */
    --c-foxed: #E8D8C0;         /* verso background */
    --c-umber: #3B2814;         /* deep ink */
    --c-gilt: #C9A84C;          /* accent gold */
    --c-lavender: #A89CC8;      /* y2k iridescent */
    --c-sienna: #B85C38;        /* warm accent */
    --c-shadow: #2A1A0A;        /* deep umber shadow */

    --c-vellum-alpha: rgba(242, 232, 213, 0.80);
    --c-gilt-alpha: rgba(201, 168, 76, 0.55);

    --ff-display: "Poiret One", "Cormorant Garamond", serif;
    --ff-secondary: "Cormorant Garamond", Georgia, serif;
    --ff-body: "EB Garamond", Georgia, "Times New Roman", serif;
    --ff-ui: "Josefin Sans", "Inter", "Helvetica Neue", sans-serif;

    --baseline: 28px;
    --ease-book: cubic-bezier(0.4, 0, 0.2, 1);
    --t-morph: 1.2s var(--ease-book);
}

/* ---------- Reset-ish ---------- */
*,
*::before,
*::after {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    padding: 0;
    background: var(--c-vellum);
    color: var(--c-umber);
    font-family: var(--ff-body);
    font-size: 17px;
    line-height: 1.75;
    letter-spacing: 0.01em;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    overflow-x: hidden;
    min-height: 100vh;
}

img, svg {
    display: block;
    max-width: 100%;
}

/* Custom scrollbar */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}
::-webkit-scrollbar-track {
    background: var(--c-vellum);
}
::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, var(--c-gilt), var(--c-sienna));
    border-radius: 6px;
    border: 2px solid var(--c-vellum);
}
::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, var(--c-sienna), var(--c-gilt));
}
html {
    scrollbar-color: var(--c-gilt) var(--c-vellum);
}

/* Selection */
::selection {
    background: var(--c-lavender);
    color: var(--c-shadow);
}

/* ---------- Book (grid container) ---------- */
.book {
    display: grid;
    grid-template-columns: 45fr 55fr;
    min-height: 100vh;
    position: relative;
    background: var(--c-vellum);
}

/* ===================================================================
   VERSO — Left panel (sticky, living frontispiece)
   =================================================================== */
.verso {
    position: sticky;
    top: 0;
    height: 100vh;
    overflow: hidden;
    background: radial-gradient(ellipse at center, var(--c-foxed) 0%, var(--c-vellum) 85%);
    border-right: 1px solid rgba(59, 40, 20, 0.08);
    isolation: isolate;
}

/* Watercolor stack — layered radial gradients that morph on chapter change */
.watercolor-stack {
    position: absolute;
    inset: 0;
    z-index: 0;
    pointer-events: none;
}

.watercolor {
    position: absolute;
    inset: -10%;
    filter: blur(40px);
    mix-blend-mode: multiply;
    opacity: 0.75;
    transition:
        background-image var(--t-morph),
        opacity var(--t-morph),
        filter var(--t-morph),
        transform var(--t-morph);
    will-change: opacity, filter, transform;
}

/* Default (chapter 1) — warm gold pool */
.watercolor.layer-1 {
    background-image: radial-gradient(circle at 30% 30%, rgba(201, 168, 76, 0.38), transparent 55%);
}
.watercolor.layer-2 {
    background-image: radial-gradient(circle at 70% 60%, rgba(184, 92, 56, 0.28), transparent 55%);
}
.watercolor.layer-3 {
    background-image: radial-gradient(circle at 50% 80%, rgba(168, 156, 200, 0.22), transparent 60%);
}
.watercolor.layer-4 {
    background-image: radial-gradient(circle at 20% 75%, rgba(59, 40, 20, 0.18), transparent 55%);
}

/* Chapter 2 — iridescent lavender pool */
.verso[data-active="2"] .watercolor.layer-1 {
    background-image: radial-gradient(circle at 65% 25%, rgba(168, 156, 200, 0.48), transparent 55%);
    transform: translate(-3%, 2%) rotate(4deg);
}
.verso[data-active="2"] .watercolor.layer-2 {
    background-image: radial-gradient(circle at 25% 55%, rgba(201, 168, 76, 0.30), transparent 60%);
    transform: translate(4%, -4%) rotate(-3deg);
}
.verso[data-active="2"] .watercolor.layer-3 {
    background-image: radial-gradient(circle at 75% 85%, rgba(184, 92, 56, 0.22), transparent 55%);
    transform: translate(-2%, -3%);
}
.verso[data-active="2"] .watercolor.layer-4 {
    background-image: radial-gradient(circle at 10% 20%, rgba(59, 40, 20, 0.14), transparent 60%);
    transform: translate(3%, 3%);
}

/* Chapter 3 — burnt sienna pool */
.verso[data-active="3"] .watercolor.layer-1 {
    background-image: radial-gradient(circle at 40% 70%, rgba(184, 92, 56, 0.42), transparent 55%);
    transform: translate(2%, -5%);
}
.verso[data-active="3"] .watercolor.layer-2 {
    background-image: radial-gradient(circle at 80% 30%, rgba(201, 168, 76, 0.38), transparent 55%);
    transform: translate(-4%, 3%) rotate(6deg);
}
.verso[data-active="3"] .watercolor.layer-3 {
    background-image: radial-gradient(circle at 20% 30%, rgba(168, 156, 200, 0.18), transparent 60%);
    transform: translate(3%, 4%);
}
.verso[data-active="3"] .watercolor.layer-4 {
    background-image: radial-gradient(circle at 60% 90%, rgba(42, 26, 10, 0.22), transparent 55%);
}

/* Chapter 4 — twilight umber pool */
.verso[data-active="4"] .watercolor.layer-1 {
    background-image: radial-gradient(circle at 50% 50%, rgba(59, 40, 20, 0.35), transparent 60%);
    transform: scale(1.05);
}
.verso[data-active="4"] .watercolor.layer-2 {
    background-image: radial-gradient(circle at 20% 20%, rgba(168, 156, 200, 0.30), transparent 55%);
    transform: translate(4%, 4%);
}
.verso[data-active="4"] .watercolor.layer-3 {
    background-image: radial-gradient(circle at 80% 80%, rgba(201, 168, 76, 0.26), transparent 55%);
    transform: translate(-4%, -4%);
}
.verso[data-active="4"] .watercolor.layer-4 {
    background-image: radial-gradient(circle at 30% 80%, rgba(184, 92, 56, 0.20), transparent 55%);
}

/* Paper grain via noisy SVG-like gradient */
.watercolor-grain {
    position: absolute;
    inset: 0;
    z-index: 1;
    pointer-events: none;
    opacity: 0.35;
    background-image:
        radial-gradient(circle at 13% 27%, rgba(59, 40, 20, 0.06) 0 1px, transparent 1px),
        radial-gradient(circle at 57% 71%, rgba(59, 40, 20, 0.05) 0 1px, transparent 1px),
        radial-gradient(circle at 83% 19%, rgba(59, 40, 20, 0.05) 0 1px, transparent 1px),
        radial-gradient(circle at 29% 83%, rgba(59, 40, 20, 0.04) 0 1px, transparent 1px);
    background-size: 7px 7px, 11px 11px, 13px 13px, 9px 9px;
    mix-blend-mode: multiply;
}

/* Y2K iridescent sheen over the verso */
.watercolor-sheen {
    position: absolute;
    inset: 0;
    z-index: 2;
    pointer-events: none;
    opacity: 0.18;
    mix-blend-mode: screen;
    background:
        linear-gradient(120deg,
            rgba(168, 156, 200, 0.00) 0%,
            rgba(168, 156, 200, 0.35) 30%,
            rgba(201, 168, 76, 0.30) 55%,
            rgba(184, 92, 56, 0.20) 75%,
            rgba(168, 156, 200, 0.00) 100%);
    background-size: 240% 240%;
    animation: sheenDrift 30s linear infinite;
}

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

/* Verso foreground content */
.verso-content {
    position: relative;
    z-index: 3;
    height: 100%;
    padding: 3.5rem 3rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;
    text-align: center;
    color: var(--c-umber);
}

.verso-top,
.verso-bottom {
    width: 100%;
}

.verso-kicker {
    font-family: var(--ff-ui);
    font-weight: 300;
    font-size: 0.75rem;
    letter-spacing: 0.28em;
    text-transform: uppercase;
    color: var(--c-umber);
    opacity: 0.7;
}

/* Site title */
.verso-center {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.25rem;
}

.site-title {
    margin: 0;
    font-family: var(--ff-display);
    font-weight: 400;
    font-size: clamp(3.5rem, 9vw, 8rem);
    line-height: 1;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.site-title-text {
    background-image: linear-gradient(135deg,
        var(--c-umber) 0%,
        var(--c-lavender) 45%,
        var(--c-gilt) 75%,
        var(--c-sienna) 100%);
    background-size: 300% 300%;
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    animation: titleShimmer 30s ease-in-out infinite;
    text-shadow: 0 0 40px rgba(201, 168, 76, 0.12);
}

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

/* Title rule (diamond + lines) */
.title-rule {
    position: relative;
    width: min(62%, 320px);
    height: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.title-rule::before,
.title-rule::after {
    content: "";
    flex: 1;
    height: 1px;
    background: linear-gradient(90deg, transparent 0%, var(--c-gilt) 50%, transparent 100%);
}
.rule-diamond {
    width: 10px;
    height: 10px;
    margin: 0 0.75rem;
    background: linear-gradient(135deg, var(--c-gilt), var(--c-sienna));
    transform: rotate(45deg);
    box-shadow: 0 0 8px rgba(201, 168, 76, 0.4);
}

.site-subtitle {
    margin: 0;
    font-family: var(--ff-secondary);
    font-style: italic;
    font-weight: 500;
    font-size: clamp(1rem, 1.5vw, 1.25rem);
    line-height: 1.5;
    color: var(--c-umber);
    opacity: 0.82;
    max-width: 28ch;
}

/* Sunburst ornament */
.sunburst {
    position: relative;
    width: 140px;
    height: 140px;
    margin-top: 1.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
}
.sunburst .ray {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 1px;
    height: 56px;
    background: linear-gradient(to top, transparent 0%, var(--c-gilt) 60%, var(--c-sienna) 100%);
    transform-origin: bottom center;
    opacity: 0.75;
}
.sunburst .ray:nth-child(1)  { transform: translate(-50%, -100%) rotate(0deg); }
.sunburst .ray:nth-child(2)  { transform: translate(-50%, -100%) rotate(30deg); }
.sunburst .ray:nth-child(3)  { transform: translate(-50%, -100%) rotate(60deg); }
.sunburst .ray:nth-child(4)  { transform: translate(-50%, -100%) rotate(90deg); }
.sunburst .ray:nth-child(5)  { transform: translate(-50%, -100%) rotate(120deg); }
.sunburst .ray:nth-child(6)  { transform: translate(-50%, -100%) rotate(150deg); }
.sunburst .ray:nth-child(7)  { transform: translate(-50%, -100%) rotate(180deg); }
.sunburst .ray:nth-child(8)  { transform: translate(-50%, -100%) rotate(210deg); }
.sunburst .ray:nth-child(9)  { transform: translate(-50%, -100%) rotate(240deg); }
.sunburst .ray:nth-child(10) { transform: translate(-50%, -100%) rotate(270deg); }
.sunburst .ray:nth-child(11) { transform: translate(-50%, -100%) rotate(300deg); }
.sunburst .ray:nth-child(12) { transform: translate(-50%, -100%) rotate(330deg); }

.sunburst-core {
    position: absolute;
    width: 22px;
    height: 22px;
    background: radial-gradient(circle, var(--c-gilt) 0%, var(--c-sienna) 60%, transparent 100%);
    border-radius: 50%;
    box-shadow: 0 0 16px rgba(201, 168, 76, 0.5);
    animation: coreBreath 6s ease-in-out infinite;
}
@keyframes coreBreath {
    0%, 100% { transform: scale(1); opacity: 1; }
    50%      { transform: scale(1.2); opacity: 0.85; }
}

/* Chapter indicator (bottom of verso) */
.chapter-indicator {
    display: inline-flex;
    align-items: baseline;
    gap: 0.75rem;
    padding: 0.75rem 1.25rem;
    border: 1px solid var(--c-gilt-alpha);
    border-radius: 999px;
    background: rgba(242, 232, 213, 0.55);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    color: var(--c-umber);
    transition: border-color var(--t-morph), background var(--t-morph);
}

.ci-label {
    font-family: var(--ff-ui);
    font-size: 0.625rem;
    letter-spacing: 0.28em;
    text-transform: uppercase;
    color: var(--c-sienna);
    opacity: 0.85;
}
.ci-numeral {
    font-family: var(--ff-display);
    font-size: 1.5rem;
    color: var(--c-sienna);
    letter-spacing: 0.08em;
    transition: color var(--t-morph);
}
.ci-title {
    font-family: var(--ff-secondary);
    font-style: italic;
    font-size: 0.95rem;
    color: var(--c-umber);
}

.verso-meta {
    margin-top: 1rem;
    font-family: var(--ff-ui);
    font-size: 0.7rem;
    letter-spacing: 0.24em;
    text-transform: uppercase;
    opacity: 0.6;
}

.dot-sep {
    margin: 0 0.5em;
    color: var(--c-gilt);
}

/* Marginalia — icons in the gutter */
.marginalia {
    position: absolute;
    top: 0;
    right: -18px;
    height: 100%;
    width: 36px;
    z-index: 4;
    display: flex;
    flex-direction: column;
    justify-content: space-around;
    align-items: center;
    padding: 3rem 0;
    color: var(--c-gilt);
    opacity: 0.4;
    pointer-events: none;
}
.margin-icon {
    width: 24px;
    height: 24px;
    opacity: 0;
    transform: translateY(8px);
    transition: opacity 0.8s ease, transform 0.8s ease;
}
.marginalia.revealed .margin-icon { opacity: 1; transform: translateY(0); }
.marginalia.revealed .margin-icon:nth-child(1) { transition-delay: 0.1s; }
.marginalia.revealed .margin-icon:nth-child(2) { transition-delay: 0.2s; }
.marginalia.revealed .margin-icon:nth-child(3) { transition-delay: 0.3s; }
.marginalia.revealed .margin-icon:nth-child(4) { transition-delay: 0.4s; }

/* ===================================================================
   RECTO — Right panel (scrollable narrative)
   =================================================================== */
.recto {
    position: relative;
    padding: 0;
    background: var(--c-vellum);
    color: var(--c-umber);
    min-height: 100vh;
}

.recto-nav {
    position: sticky;
    top: 0;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem 3rem;
    background: rgba(242, 232, 213, 0.85);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(201, 168, 76, 0.25);
}
.recto-nav-brand {
    font-family: var(--ff-display);
    font-size: 1.25rem;
    letter-spacing: 0.28em;
    text-transform: uppercase;
    color: var(--c-umber);
}
.recto-nav-links {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    gap: 1.5rem;
}
.recto-nav-links a {
    font-family: var(--ff-ui);
    font-weight: 300;
    font-size: 0.75rem;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: var(--c-umber);
    text-decoration: none;
    position: relative;
    padding: 0.25rem 0.1rem;
    transition: color 0.4s ease;
}
.recto-nav-links a::before {
    content: "";
    position: absolute;
    left: 0; right: 0; bottom: -2px;
    height: 1px;
    background: linear-gradient(90deg, var(--c-lavender), var(--c-gilt));
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.5s var(--ease-book);
}
.recto-nav-links a:hover { color: var(--c-sienna); }
.recto-nav-links a:hover::before { transform: scaleX(1); }

/* Chapter section */
.chapter {
    position: relative;
    padding: 5rem 4rem 3rem;
    max-width: none;
    overflow: visible;
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    column-gap: 40px;
}

/* Giant faint Roman numeral background */
.chapter::before {
    content: attr(data-numeral);
    position: absolute;
    top: 3rem;
    right: 3rem;
    font-family: var(--ff-display);
    font-size: clamp(6rem, 14vw, 11rem);
    line-height: 1;
    letter-spacing: 0.05em;
    color: var(--c-umber);
    opacity: 0.07;
    pointer-events: none;
    z-index: 0;
    user-select: none;
}

.chapter-numeral {
    display: none;
}

.chapter-head {
    position: relative;
    z-index: 1;
    margin-bottom: 2rem;
    grid-column: 1 / -1;
}

.chapter-label {
    display: inline-block;
    font-family: var(--ff-ui);
    font-weight: 300;
    font-size: 0.75rem;
    letter-spacing: 0.28em;
    text-transform: uppercase;
    color: var(--c-sienna);
    margin-bottom: 0.5rem;
}

.chapter-title {
    margin: 0;
    font-family: var(--ff-secondary);
    font-style: italic;
    font-weight: 500;
    font-size: clamp(1.5rem, 3vw, 2.4rem);
    line-height: 1.25;
    color: var(--c-umber);
    max-width: 22ch;
}

.chapter-body {
    position: relative;
    z-index: 1;
    max-width: 54ch;
    grid-column: 1 / span 5;
}

.chapter-body > p {
    margin: 0 0 var(--baseline) 0;
    max-width: 52ch;
}

/* Drop cap */
.chapter-intro .drop-cap {
    float: left;
    font-family: var(--ff-display);
    font-weight: 400;
    font-size: 4.5rem;
    line-height: 0.9;
    margin: 0.3rem 0.6rem 0 0;
    padding: 0.5rem 0.65rem;
    color: var(--c-sienna);
    text-shadow: 2px 2px 0 rgba(201, 168, 76, 0.25);
    border: 1px solid var(--c-gilt);
    position: relative;
    background: rgba(242, 232, 213, 0.6);
    transition: opacity 0.8s ease, transform 0.8s ease;
}
.chapter-intro .drop-cap::before,
.chapter-intro .drop-cap::after {
    content: "";
    position: absolute;
    width: 8px;
    height: 8px;
    border: 1px solid var(--c-gilt);
}
.chapter-intro .drop-cap::before {
    top: -4px; left: -4px;
    border-right: 0; border-bottom: 0;
}
.chapter-intro .drop-cap::after {
    bottom: -4px; right: -4px;
    border-left: 0; border-top: 0;
}

/* Drop cap entrance */
.chapter .drop-cap {
    opacity: 0;
    transform: translateY(20px);
}
.chapter.cap-in .drop-cap {
    opacity: 1;
    transform: translateY(0);
    transition: opacity 0.8s ease 0.3s, transform 0.8s ease 0.3s;
}

/* Pull-quote */
.pull-quote {
    position: relative;
    margin: calc(var(--baseline) * 1.5) 0 calc(var(--baseline) * 1.5) -3rem;
    padding: 1.25rem 1.5rem 1.25rem 2rem;
    border-left: 2px solid var(--c-gilt);
    background: rgba(242, 232, 213, 0.60);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    font-family: var(--ff-secondary);
    font-style: italic;
    font-size: 1.2rem;
    line-height: 1.55;
    color: var(--c-umber);
    max-width: 56ch;
    box-shadow: 0 2px 14px rgba(59, 40, 20, 0.06);
    transform: translateX(-30px);
    opacity: 0;
    transition: opacity 0.9s var(--ease-book), transform 0.9s var(--ease-book);
}
.chapter.pq-in .pull-quote {
    opacity: 1;
    transform: translateX(0);
}
.pull-quote.alt {
    border-left-color: var(--c-sienna);
    background: rgba(232, 216, 192, 0.55);
}
.pq-mark {
    position: absolute;
    left: -0.3rem;
    top: -0.6rem;
    font-family: var(--ff-display);
    font-size: 3rem;
    line-height: 1;
    color: var(--c-gilt);
    opacity: 0.7;
}
.pull-quote footer {
    margin-top: 0.75rem;
    font-family: var(--ff-ui);
    font-style: normal;
    font-size: 0.7rem;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: var(--c-sienna);
}

/* Decorative divider (Art Deco) */
.deco-divider {
    position: relative;
    border: 0;
    height: 24px;
    margin: 3rem auto;
    max-width: 420px;
    background: transparent;
    overflow: visible;
    grid-column: 1 / -1;
}
.deco-divider::before,
.deco-divider::after {
    content: "";
    position: absolute;
    top: 50%;
    height: 1px;
    width: calc(50% - 26px);
    background: linear-gradient(90deg, transparent 0%, var(--c-gilt) 40%, var(--c-sienna) 100%);
}
.deco-divider::before { left: 0; }
.deco-divider::after {
    right: 0;
    background: linear-gradient(90deg, var(--c-sienna) 0%, var(--c-gilt) 60%, transparent 100%);
}

/* Center diamond + fan (pseudo-overlay container via a wrapper span) */
.deco-divider {
    /* diamond is generated via a pseudo parent; simulate with an element we append */
}

/* We create the diamond via a single additional pseudo using clip-path on an overlay */
.deco-divider {
    position: relative;
}
/* central diamond using inline block trick: we'll actually place a separate rotating span.
   Since hr can't have children, we'll fake the diamond using a gradient-masked element. */
.deco-divider {
    background:
        linear-gradient(35deg, transparent 46%, rgba(201, 168, 76, 0.55) 47% 49%, transparent 50%) calc(50% - 34px) 50% / 28px 20px no-repeat,
        linear-gradient(-35deg, transparent 46%, rgba(201, 168, 76, 0.55) 47% 49%, transparent 50%) calc(50% + 34px) 50% / 28px 20px no-repeat,
        linear-gradient(-35deg, transparent 46%, rgba(201, 168, 76, 0.55) 47% 49%, transparent 50%) calc(50% - 34px) 50% / 28px 20px no-repeat,
        linear-gradient(35deg, transparent 46%, rgba(201, 168, 76, 0.55) 47% 49%, transparent 50%) calc(50% + 34px) 50% / 28px 20px no-repeat,
        radial-gradient(circle at center,
            var(--c-gilt) 0,
            var(--c-gilt) 3px,
            transparent 4px);
}
/* Fan lines via additional layered backgrounds on the hr itself */
.deco-divider::before,
.deco-divider::after {
    width: calc(50% - 40px);
}

/* Palette row */
.palette-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 0.75rem;
    margin: calc(var(--baseline)) 0;
    padding: 1rem;
    border: 1px solid rgba(201, 168, 76, 0.3);
    background: rgba(232, 216, 192, 0.35);
}
.swatch {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.3rem;
    padding: 0.5rem;
    border-radius: 2px;
    transition: transform 0.4s var(--ease-book), background 0.4s ease;
}
.swatch:hover {
    transform: translateY(-2px);
    background: rgba(242, 232, 213, 0.6);
}
.swatch-chip {
    width: 100%;
    height: 42px;
    background: var(--sw);
    border: 1px solid rgba(59, 40, 20, 0.15);
    box-shadow: inset 0 0 0 1px rgba(242, 232, 213, 0.4),
                0 1px 3px rgba(59, 40, 20, 0.08);
    position: relative;
    overflow: hidden;
}
.swatch-chip::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(120deg,
        rgba(168, 156, 200, 0.0) 30%,
        rgba(168, 156, 200, 0.5) 50%,
        rgba(201, 168, 76, 0.4) 60%,
        rgba(168, 156, 200, 0.0) 80%);
    background-size: 220% 100%;
    background-position: 100% 0;
    opacity: 0;
    transition: opacity 0.3s ease, background-position 1s ease;
}
.swatch:hover .swatch-chip::after {
    opacity: 1;
    background-position: 0 0;
}
.swatch-name {
    font-family: var(--ff-secondary);
    font-style: italic;
    font-size: 0.95rem;
    color: var(--c-umber);
}
.swatch-hex {
    font-family: var(--ff-ui);
    font-size: 0.65rem;
    letter-spacing: 0.2em;
    color: var(--c-sienna);
    text-transform: uppercase;
}

/* Folio list (Chapter III) */
.folio-list {
    list-style: none;
    margin: calc(var(--baseline)) 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}
.folio-list > li {
    display: grid;
    grid-template-columns: 3.5rem 1fr;
    gap: 1rem;
    padding: 1rem 1.25rem;
    border: 1px solid rgba(201, 168, 76, 0.28);
    background: rgba(242, 232, 213, 0.55);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    transition: transform 0.4s var(--ease-book), border-color 0.4s ease, box-shadow 0.4s ease;
    position: relative;
    overflow: hidden;
}
.folio-list > li::before {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(120deg,
        transparent 40%,
        rgba(168, 156, 200, 0.12) 50%,
        rgba(201, 168, 76, 0.12) 58%,
        transparent 70%);
    background-size: 200% 100%;
    background-position: 100% 0;
    transition: background-position 0.9s var(--ease-book);
    pointer-events: none;
}
.folio-list > li:hover {
    transform: translateX(-4px);
    border-color: var(--c-gilt);
    box-shadow: 0 4px 20px rgba(59, 40, 20, 0.10);
}
.folio-list > li:hover::before {
    background-position: 0 0;
}
.folio-num {
    font-family: var(--ff-display);
    font-size: 2rem;
    color: var(--c-sienna);
    line-height: 1;
    letter-spacing: 0.06em;
}
.folio-body { min-width: 0; }
.folio-title {
    margin: 0 0 0.35rem 0;
    font-family: var(--ff-secondary);
    font-style: italic;
    font-weight: 500;
    font-size: 1.2rem;
    color: var(--c-umber);
    line-height: 1.3;
}
.folio-body p {
    margin: 0;
    font-size: 1rem;
    line-height: 1.65;
    color: var(--c-umber);
    opacity: 0.9;
}

/* Colophon definition list */
.colophon {
    margin: calc(var(--baseline)) 0;
    padding: 1.25rem 1.5rem;
    border-top: 1px solid var(--c-gilt);
    border-bottom: 1px solid var(--c-gilt);
    background: rgba(232, 216, 192, 0.3);
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}
.col-row {
    display: grid;
    grid-template-columns: 11rem 1fr;
    gap: 1rem;
    align-items: baseline;
    padding-bottom: 0.75rem;
    border-bottom: 1px dashed rgba(59, 40, 20, 0.15);
}
.col-row:last-child { border-bottom: 0; padding-bottom: 0; }
.colophon dt {
    font-family: var(--ff-ui);
    font-weight: 300;
    font-size: 0.72rem;
    letter-spacing: 0.26em;
    text-transform: uppercase;
    color: var(--c-sienna);
}
.colophon dd {
    margin: 0;
    font-family: var(--ff-body);
    font-size: 1rem;
    line-height: 1.55;
    color: var(--c-umber);
}
.email {
    font-family: var(--ff-ui);
    letter-spacing: 0.15em;
    color: var(--c-sienna);
    background: linear-gradient(90deg, var(--c-lavender), var(--c-gilt));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    font-weight: 400;
}

/* Finis */
.finis {
    margin-top: calc(var(--baseline) * 1.5);
    text-align: center;
    font-family: var(--ff-display);
    font-size: 1.5rem;
    letter-spacing: 0.3em;
    text-transform: uppercase;
    color: var(--c-sienna);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
}
.finis-ornament {
    display: inline-block;
    width: 48px;
    height: 10px;
    position: relative;
}
.finis-ornament::before {
    content: "";
    position: absolute;
    left: 0; right: 16px; top: 50%;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--c-gilt));
}
.finis-ornament::after {
    content: "";
    position: absolute;
    right: 0; top: 50%;
    transform: translateY(-50%) rotate(45deg);
    width: 8px; height: 8px;
    background: var(--c-gilt);
}
.finis-ornament:last-child::before {
    left: 16px; right: 0;
    background: linear-gradient(90deg, var(--c-gilt), transparent);
}
.finis-ornament:last-child::after {
    right: auto; left: 0;
}

/* Recto footer */
.recto-foot {
    margin: 4rem 0 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid rgba(201, 168, 76, 0.3);
    font-family: var(--ff-ui);
    font-size: 0.7rem;
    letter-spacing: 0.24em;
    text-transform: uppercase;
    color: var(--c-umber);
    opacity: 0.7;
    text-align: center;
}

/* Chapter entrance */
.chapter {
    opacity: 0;
    transform: translateY(24px);
    transition: opacity 1s var(--ease-book), transform 1s var(--ease-book);
}
.chapter.in-view {
    opacity: 1;
    transform: translateY(0);
}

/* ===================================================================
   DOT NAV — Art Deco diamonds on the right edge
   =================================================================== */
.dot-nav {
    position: fixed;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 20;
    display: flex;
    flex-direction: column;
    gap: 1.1rem;
    padding: 0.8rem 0.5rem;
    background: rgba(242, 232, 213, 0.55);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    border: 1px solid rgba(201, 168, 76, 0.25);
    border-radius: 999px;
}
.dot {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 28px;
    text-decoration: none;
    color: var(--c-umber);
    transition: transform 0.4s ease;
}
.dot-diamond {
    width: 9px;
    height: 9px;
    background: transparent;
    border: 1px solid var(--c-gilt);
    transform: rotate(45deg);
    transition: background 0.4s ease, box-shadow 0.4s ease, transform 0.4s ease;
}
.dot-label {
    position: absolute;
    right: 26px;
    top: 50%;
    transform: translateY(-50%);
    font-family: var(--ff-display);
    font-size: 0.8rem;
    letter-spacing: 0.12em;
    color: var(--c-sienna);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    white-space: nowrap;
}
.dot:hover { transform: scale(1.1); }
.dot:hover .dot-label { opacity: 1; }
.dot:hover .dot-diamond {
    background: linear-gradient(135deg, var(--c-lavender), var(--c-gilt));
    box-shadow: 0 0 12px rgba(168, 156, 200, 0.5);
}
.dot.active .dot-diamond {
    background: linear-gradient(135deg, var(--c-gilt), var(--c-sienna));
    box-shadow: 0 0 10px rgba(201, 168, 76, 0.6);
    transform: rotate(45deg) scale(1.1);
}
.dot.active .dot-label { opacity: 0.9; }

/* ===================================================================
   HOVER shimmer utility (interactive iridescence)
   =================================================================== */
.recto-nav-brand {
    position: relative;
    background: linear-gradient(90deg, var(--c-umber), var(--c-umber));
    background-size: 200% 100%;
    background-position: 100% 0;
    -webkit-background-clip: text;
    background-clip: text;
    transition: background 0.6s var(--ease-book);
}
.recto-nav-brand:hover {
    background-image: linear-gradient(90deg, var(--c-lavender), var(--c-gilt), var(--c-sienna));
    background-size: 200% 100%;
    background-position: 0 0;
    color: transparent;
    -webkit-text-fill-color: transparent;
}

/* ===================================================================
   MOBILE ADAPTATION (< 900px)
   =================================================================== */
@media (max-width: 900px) {
    .book {
        grid-template-columns: 1fr;
    }
    .verso {
        position: sticky;
        top: 0;
        height: auto;
        min-height: 80px;
        max-height: 120px;
        padding: 0;
        border-right: 0;
        border-bottom: 1px solid rgba(201, 168, 76, 0.3);
        z-index: 15;
    }
    .verso-content {
        flex-direction: row;
        padding: 0.8rem 1.25rem;
        align-items: center;
        justify-content: space-between;
        gap: 1rem;
        text-align: left;
    }
    .verso-top, .verso-bottom { display: none; }
    .verso-center { flex-direction: row; align-items: center; gap: 0.75rem; }
    .site-title {
        font-size: 2rem;
        letter-spacing: 0.14em;
    }
    .title-rule, .site-subtitle, .sunburst { display: none; }
    .marginalia { display: none; }
    .recto-nav { padding: 0.8rem 1.25rem; }
    .recto-nav-links { gap: 0.75rem; }
    .recto-nav-links a { font-size: 0.65rem; letter-spacing: 0.18em; }
    .chapter { padding: 3rem 1.5rem 2rem; }
    .chapter-numeral { font-size: 4rem; top: 1rem; right: 1rem; }
    .pull-quote { margin-left: 0; }
    .col-row { grid-template-columns: 1fr; gap: 0.25rem; }
    .dot-nav { right: 8px; padding: 0.5rem 0.3rem; }
}

/* ===================================================================
   Smaller phones
   =================================================================== */
@media (max-width: 480px) {
    .recto-nav-links { display: none; }
    .palette-row { grid-template-columns: repeat(2, 1fr); }
}
