/* ==========================================================================
   CODEX QUATTUOR-NIHIL-QUATTUOR (FOL. 404R)
   Pure HTML + CSS Medieval Illuminated Manuscript (Zero JS, Zero External Assets)
   ========================================================================== */

:root {
  /* Medieval Pigments */
  --vellum-light: #f6edd9;
  --vellum-mid: #ecdec0;
  --vellum-dark: #d8c298;
  --vellum-edge: #b89b67;

  --ink-iron: #21150e;
  --ink-brown: #3d2718;
  --ink-faded: #6e5239;

  --vermilion: #b3241a;
  --vermilion-dark: #80150d;
  --lapis: #1b3b73;
  --lapis-light: #2c59a3;
  --verdigris: #2b664c;

  --gold-bright: #f7e27c;
  --gold-mid: #d4af37;
  --gold-deep: #8f6508;

  --oak-dark: #120b07;
  --oak-mid: #21150d;
  --oak-warm: #332014;

  /* Typography (Pure System Fonts — No external font files) */
  --font-book: "Palatino", "Palatino Linotype", "Book Antiqua", "Hoefler Text", "Garamond", Georgia, serif;
  --font-display: "Palatino", "Book Antiqua", "Hoefler Text", Georgia, serif;
  --font-gloss: "Apple Chancery", "Palatino", "Palatino Linotype", "Book Antiqua", Georgia, serif;
}

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

html {
  background-color: var(--oak-dark);
  color: var(--ink-iron);
  font-family: var(--font-book);
  font-size: 17px;
  line-height: 1.65;
}

body {
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  /* Carved Monastery Oak Desk background */
  background:
    radial-gradient(ellipse at 50% 20%, rgba(74, 45, 22, 0.45) 0%, transparent 70%),
    repeating-linear-gradient(
      90deg,
      #140c07 0px,
      #19100a 38px,
      #120b06 76px,
      #1c120b 114px
    );
  position: relative;
}

/* Visually hidden checkbox toggles for CSS-only interactivity */
.sr-toggle {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

/* ==========================================================================
   1. AMBIENT CANDLELIGHT & NIGHTFALL OVERLAY (SCROLL-DRIVEN)
   ========================================================================== */
.ambient-lighting {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 50;
  overflow: hidden;
}

.candle-glow-beam {
  position: absolute;
  inset: -10%;
  /* Driven by document scroll: shifts from bright golden Vespers to deep midnight Matins to low ember Lauds */
  animation-name: scriptorium-light-shift;
  animation-timing-function: linear;
  animation-fill-mode: both;
  animation-timeline: scroll(root);
}

.dawn-rim-light {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    180deg,
    rgba(98, 134, 196, 0.22) 0%,
    rgba(62, 86, 145, 0.08) 35%,
    transparent 70%
  );
  opacity: 0;
  animation-name: dawn-arrival;
  animation-timing-function: linear;
  animation-fill-mode: both;
  animation-timeline: scroll(root);
}

@keyframes scriptorium-light-shift {
  0% {
    background: radial-gradient(
      circle at 82% 38%,
      rgba(255, 210, 115, 0.18) 0%,
      rgba(255, 175, 65, 0.06) 38%,
      rgba(15, 9, 5, 0.28) 75%,
      rgba(8, 5, 3, 0.55) 100%
    );
  }
  38% {
    background: radial-gradient(
      circle at 82% 48%,
      rgba(255, 190, 85, 0.20) 0%,
      rgba(235, 135, 40, 0.08) 34%,
      rgba(12, 7, 5, 0.48) 70%,
      rgba(5, 3, 4, 0.72) 100%
    );
  }
  72% {
    background: radial-gradient(
      circle at 82% 58%,
      rgba(255, 155, 55, 0.24) 0%,
      rgba(205, 95, 25, 0.10) 28%,
      rgba(10, 7, 14, 0.64) 64%,
      rgba(4, 3, 8, 0.84) 100%
    );
  }
  100% {
    background: radial-gradient(
      circle at 82% 66%,
      rgba(255, 110, 30, 0.28) 0%,
      rgba(180, 65, 15, 0.11) 22%,
      rgba(12, 12, 24, 0.68) 58%,
      rgba(5, 6, 14, 0.86) 100%
    );
  }
}

@keyframes dawn-arrival {
  0%, 75% {
    opacity: 0;
  }
  100% {
    opacity: 1;
  }
}

/* Override when reader fits a fresh taper (#relight-candle) */
#relight-candle:checked ~ .ambient-lighting .candle-glow-beam {
  animation: none;
  background: radial-gradient(
    circle at 82% 38%,
    rgba(255, 220, 130, 0.22) 0%,
    rgba(255, 180, 75, 0.08) 45%,
    rgba(15, 9, 5, 0.22) 80%,
    rgba(8, 5, 3, 0.42) 100%
  );
}

/* Override when reader snuffs the candle (#snuff-candle) */
#snuff-candle:checked ~ .ambient-lighting .candle-glow-beam {
  animation: none;
  background: radial-gradient(
    circle at 50% 30%,
    rgba(70, 95, 145, 0.18) 0%,
    rgba(12, 16, 28, 0.72) 65%,
    rgba(4, 6, 12, 0.9) 100%
  );
}

/* ==========================================================================
   2. FIXED SCRIPTORIUM CANDLE DOCK & MELTING BEESWAX TAPER
   ========================================================================== */
.scriptorium-candle-dock {
  position: fixed;
  right: max(12px, calc((100vw - 1180px) / 2 - 40px));
  top: 50%;
  transform: translateY(-50%);
  width: 148px;
  z-index: 45;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 12px 10px;
  background: linear-gradient(180deg, rgba(28, 18, 11, 0.92), rgba(17, 10, 6, 0.95));
  border: 1.5px solid #6b4e23;
  border-radius: 8px;
  box-shadow:
    0 12px 32px rgba(0, 0, 0, 0.85),
    inset 0 0 18px rgba(212, 175, 55, 0.08);
  color: var(--vellum-light);
}

/* Canonical Hours Dial */
.canonical-dial {
  width: 100%;
  text-align: center;
  border-bottom: 1px solid rgba(212, 175, 55, 0.3);
  padding-bottom: 6px;
}

.dial-title {
  font-size: 0.65rem;
  letter-spacing: 0.16em;
  color: var(--gold-mid);
  font-weight: bold;
  margin-bottom: 4px;
}

.dial-hours {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 0.68rem;
  font-style: italic;
  color: rgba(246, 237, 217, 0.55);
}

.hour-mark {
  padding: 1px 4px;
  border-radius: 3px;
  transition: color 0.2s;
  animation-timing-function: linear;
  animation-fill-mode: both;
  animation-timeline: scroll(root);
}

.h-vespers { animation-name: highlight-vespers; }
.h-compline { animation-name: highlight-compline; }
.h-matins { animation-name: highlight-matins; }
.h-lauds { animation-name: highlight-lauds; }

@keyframes highlight-vespers {
  0%, 24% { color: #ffe89e; background: rgba(179, 36, 26, 0.45); font-weight: bold; }
  28%, 100% { color: rgba(246, 237, 217, 0.45); background: transparent; font-weight: normal; }
}
@keyframes highlight-compline {
  0%, 24% { color: rgba(246, 237, 217, 0.45); background: transparent; }
  28%, 52% { color: #ffe89e; background: rgba(179, 36, 26, 0.45); font-weight: bold; }
  56%, 100% { color: rgba(246, 237, 217, 0.45); background: transparent; }
}
@keyframes highlight-matins {
  0%, 52% { color: rgba(246, 237, 217, 0.45); background: transparent; }
  56%, 78% { color: #ffe89e; background: rgba(179, 36, 26, 0.45); font-weight: bold; }
  82%, 100% { color: rgba(246, 237, 217, 0.45); background: transparent; }
}
@keyframes highlight-lauds {
  0%, 78% { color: rgba(246, 237, 217, 0.45); background: transparent; }
  82%, 100% { color: #ffe89e; background: rgba(179, 36, 26, 0.45); font-weight: bold; }
}

/* Candle Stage: Flex column anchored at bottom so flame rides top of melting shaft */
.candle-stage {
  position: relative;
  width: 100%;
  height: 295px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
}

.candle-BurnTrack {
  position: relative;
  z-index: 4;
  margin-bottom: -3px;
  animation-name: flame-scroll-stage;
  animation-timing-function: linear;
  animation-fill-mode: both;
  animation-timeline: scroll(root);
}

@keyframes flame-scroll-stage {
  0%, 75% {
    transform: scale(1);
    filter: hue-rotate(0deg);
  }
  92% {
    transform: scale(0.86, 0.78);
    filter: hue-rotate(-10deg);
  }
  100% {
    transform: scale(0.68, 0.62);
    filter: hue-rotate(-18deg);
  }
}

.flame-assembly {
  position: relative;
  width: 40px;
  height: 54px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
}

/* Continuous organic flickering flame */
.flame-halo {
  position: absolute;
  bottom: 6px;
  width: 78px;
  height: 78px;
  border-radius: 50%;
  background: radial-gradient(
    circle,
    rgba(255, 200, 75, 0.55) 0%,
    rgba(255, 130, 20, 0.25) 45%,
    transparent 72%
  );
  animation: halo-pulse 1.9s ease-in-out infinite alternate;
  pointer-events: none;
}

.flame-outer {
  position: relative;
  width: 18px;
  height: 38px;
  background: radial-gradient(
    ellipse at 50% 78%,
    #ff9a1f 0%,
    #ff5e0e 58%,
    rgba(212, 35, 10, 0.1) 100%
  );
  border-radius: 50% 50% 38% 38% / 68% 68% 32% 32%;
  box-shadow: 0 0 18px 4px rgba(255, 155, 30, 0.65);
  transform-origin: 50% 92%;
  animation: candle-flicker 2.2s ease-in-out infinite;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding-bottom: 2px;
}

.flame-inner {
  width: 11px;
  height: 25px;
  background: linear-gradient(180deg, #ffea79 0%, #ffc233 65%, #d96b14 100%);
  border-radius: 50% 50% 40% 40% / 70% 70% 30% 30%;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding-bottom: 2px;
}

.flame-core {
  width: 6px;
  height: 12px;
  background: linear-gradient(180deg, #ffffff 0%, #fff3b0 65%, #3a5ba0 100%);
  border-radius: 50%;
}

.wick {
  width: 2.5px;
  height: 7px;
  background: linear-gradient(180deg, #ff4500 0%, #1c130e 45%, #1c130e 100%);
  border-radius: 1px;
}

.smoke-wisp {
  position: absolute;
  bottom: 42px;
  width: 8px;
  height: 26px;
  border-left: 1.5px solid rgba(215, 210, 200, 0.28);
  border-radius: 50%;
  filter: blur(1px);
  animation: smoke-rise 3.2s ease-in-out infinite;
}

@keyframes candle-flicker {
  0%   { transform: rotate(-2deg) scale(1, 1) skewX(-1deg); }
  20%  { transform: rotate(3deg) scale(0.96, 1.05) skewX(2deg); }
  40%  { transform: rotate(-3.5deg) scale(1.03, 0.94) skewX(-3deg); }
  60%  { transform: rotate(1.5deg) scale(0.98, 1.04) skewX(1deg); }
  80%  { transform: rotate(-1.5deg) scale(1.02, 0.97) skewX(-2deg); }
  100% { transform: rotate(2deg) scale(1, 1.02) skewX(1.5deg); }
}

@keyframes halo-pulse {
  0%   { transform: scale(0.92); opacity: 0.8; }
  100% { transform: scale(1.12); opacity: 1; }
}

@keyframes smoke-rise {
  0%   { transform: translateY(0) translateX(0) scaleX(0.8); opacity: 0.15; }
  50%  { transform: translateY(-10px) translateX(3px) scaleX(1.3); opacity: 0.4; }
  100% { transform: translateY(-22px) translateX(-3px) scaleX(0.9); opacity: 0; }
}

/* Beeswax Candle Shaft (shrinks on scroll) */
.candle-shaft-wrap {
  position: relative;
  z-index: 3;
  display: flex;
  justify-content: center;
  width: 100%;
}

.candle-shaft {
  position: relative;
  width: 34px;
  height: 158px;
  background: linear-gradient(
    90deg,
    #b58b43 0%,
    #e6c37a 28%,
    #f7dfb0 52%,
    #d4ac5d 80%,
    #946d2b 100%
  );
  border-radius: 4px 4px 2px 2px;
  box-shadow:
    inset 0 4px 8px rgba(255, 220, 140, 0.85),
    0 2px 8px rgba(0, 0, 0, 0.55);
  overflow: visible;
  animation-name: melt-candle-shaft;
  animation-timing-function: linear;
  animation-fill-mode: both;
  animation-timeline: scroll(root);
}

@keyframes melt-candle-shaft {
  0%   { height: 158px; }
  33%  { height: 114px; }
  66%  { height: 68px; }
  100% { height: 24px; }
}

/* Translucent glowing top rim of melted wax */
.wax-rim {
  position: absolute;
  top: -3px;
  left: -1px;
  right: -1px;
  height: 7px;
  background: radial-gradient(ellipse at center, #fff2bd 0%, #e5b962 75%, #b88c3b 100%);
  border-radius: 50%;
  box-shadow: 0 0 10px rgba(255, 195, 75, 0.75);
}

/* Animated wax drips sliding down the candle as you scroll */
.wax-drip {
  position: absolute;
  width: 5px;
  background: linear-gradient(180deg, #fae5b8 0%, #deb868 75%, #f5dca8 100%);
  border-radius: 3px 3px 50% 50%;
  box-shadow: 1px 1px 2px rgba(60, 38, 10, 0.35);
  animation-timing-function: linear;
  animation-fill-mode: both;
  animation-timeline: scroll(root);
}

.drip-1 {
  left: 3px;
  top: 2px;
  animation-name: drip-run-1;
}

.drip-2 {
  right: 4px;
  top: 3px;
  width: 6px;
  animation-name: drip-run-2;
}

.drip-3 {
  left: 14px;
  top: 2px;
  width: 4.5px;
  animation-name: drip-run-3;
}

@keyframes drip-run-1 {
  0%   { height: 8px; }
  50%  { height: 48px; }
  100% { height: 18px; }
}
@keyframes drip-run-2 {
  0%   { height: 14px; }
  60%  { height: 56px; }
  100% { height: 22px; }
}
@keyframes drip-run-3 {
  0%   { height: 4px; }
  75%  { height: 34px; }
  100% { height: 15px; }
}

/* King Alfred's time-measuring notches on the candle */
.candle-notches {
  position: absolute;
  inset: 10px 0 6px 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: center;
  overflow: hidden;
  pointer-events: none;
}

.candle-notches span {
  font-size: 0.52rem;
  color: rgba(92, 56, 14, 0.7);
  border-bottom: 1px solid rgba(92, 56, 14, 0.35);
  width: 65%;
  text-align: center;
  line-height: 1.1;
}

/* Candlestick base & growing wax pool */
.candlestick-base {
  position: relative;
  width: 108px;
  height: 62px;
  margin-top: -6px;
  z-index: 2;
}

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

.wax-pool {
  position: absolute;
  top: 2px;
  left: 50%;
  transform: translateX(-50%) scale(0.45, 0.5);
  width: 68px;
  height: 14px;
  background: radial-gradient(ellipse at center, #f5deb0 0%, #d4ab59 75%, #9e7528 100%);
  border-radius: 50%;
  z-index: 3;
  animation-name: pool-accumulate;
  animation-timing-function: linear;
  animation-fill-mode: both;
  animation-timeline: scroll(root);
}

@keyframes pool-accumulate {
  0%   { transform: translateX(-50%) scale(0.35, 0.4); opacity: 0.6; }
  100% { transform: translateX(-50%) scale(1.08, 1.15); opacity: 1; }
}

/* Interactive Candle Buttons */
.candle-controls {
  display: flex;
  flex-direction: column;
  gap: 4px;
  width: 100%;
  margin-top: 6px;
}

.candle-btn {
  display: block;
  text-align: center;
  font-size: 0.68rem;
  padding: 3px 6px;
  border-radius: 4px;
  background: rgba(212, 175, 55, 0.14);
  border: 1px solid rgba(212, 175, 55, 0.45);
  color: var(--vellum-light);
  cursor: pointer;
  user-select: none;
  transition: background 0.2s, transform 0.15s;
}

.candle-btn:hover {
  background: rgba(212, 175, 55, 0.28);
}

.candle-btn:active {
  transform: scale(0.96);
}

.when-relit,
.when-snuffed {
  display: none;
}

/* State overrides for #relight-candle and #snuff-candle */
#relight-candle:checked ~ .scriptorium-candle-dock .candle-shaft {
  animation: none;
  height: 158px;
}
#relight-candle:checked ~ .scriptorium-candle-dock .candle-BurnTrack {
  animation: none;
  transform: scale(1);
}
#relight-candle:checked ~ .scriptorium-candle-dock .when-normal {
  display: none;
}
#relight-candle:checked ~ .scriptorium-candle-dock .when-relit {
  display: inline;
  color: var(--gold-bright);
}

#snuff-candle:checked ~ .scriptorium-candle-dock .flame-outer,
#snuff-candle:checked ~ .scriptorium-candle-dock .flame-halo {
  opacity: 0;
  transform: scale(0);
  transition: opacity 0.25s, transform 0.25s;
}
#snuff-candle:checked ~ .scriptorium-candle-dock .smoke-wisp {
  opacity: 0.85;
  height: 46px;
}
#snuff-candle:checked ~ .scriptorium-candle-dock .when-lit {
  display: none;
}
#snuff-candle:checked ~ .scriptorium-candle-dock .when-snuffed {
  display: inline;
  color: #ffb366;
}

/* Inkhorn & Resting Quill in the Dock */
.inkhorn-station {
  position: relative;
  width: 100%;
  padding-top: 8px;
  border-top: 1px solid rgba(212, 175, 55, 0.25);
  display: flex;
  flex-direction: column;
  align-items: center;
}

.dock-quill-wrap {
  width: 66px;
  height: 54px;
  margin-bottom: -24px;
  margin-left: 18px;
  transform-origin: 18% 90%;
  animation: dock-quill-nod 4s ease-in-out infinite;
}

@keyframes dock-quill-nod {
  0%, 100% { transform: rotate(0deg); }
  35%      { transform: rotate(-8deg) translateY(-2px); }
  70%      { transform: rotate(5deg); }
}

.dock-quill-svg,
.inkpot-svg {
  width: 100%;
  height: auto;
  display: block;
}

.inkpot-svg {
  width: 58px;
}

.inkpot-caption {
  font-size: 0.62rem;
  font-style: italic;
  color: rgba(246, 237, 217, 0.65);
  margin-top: 2px;
}

/* ==========================================================================
   3. LECTERN DESK & AGED CALFSKIN VELLUM FOLIO
   ========================================================================== */
.lectern-desk {
  max-width: 1130px;
  margin: 28px auto 14vh;
  padding: 0 172px 0 20px; /* Leave room on right for the fixed candle dock */
  position: relative;
  z-index: 10;
}

.lectern-clamps {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 42px;
  margin-bottom: -10px;
  position: relative;
  z-index: 15;
}

.brass-clamp {
  width: 38px;
  height: 22px;
  background: linear-gradient(90deg, #6e4e16, #f0d078, #8c641e);
  border: 2px solid #2e1d05;
  border-radius: 4px 4px 2px 2px;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.6);
}

.lectern-chain {
  flex: 1;
  height: 4px;
  margin: 0 24px;
  background: repeating-linear-gradient(90deg, #8c641e 0 8px, transparent 8px 12px);
  opacity: 0.6;
}

/* The Calfskin Vellum Sheet */
.vellum-folio {
  position: relative;
  background-color: var(--vellum-light);
  background-image:
    /* Warm central vellum glow & aged deckle edges */
    radial-gradient(ellipse at 50% 35%, rgba(255, 250, 235, 0.65) 0%, transparent 65%),
    radial-gradient(circle at 12% 18%, rgba(184, 145, 86, 0.16) 0%, transparent 28%),
    radial-gradient(circle at 88% 62%, rgba(168, 126, 68, 0.18) 0%, transparent 32%),
    radial-gradient(circle at 22% 84%, rgba(175, 132, 72, 0.15) 0%, transparent 26%),
    linear-gradient(
      90deg,
      #cfb482 0%,
      #ebdcc0 4%,
      #f6edd9 14%,
      #f4ead4 86%,
      #e8d6b3 96%,
      #c7a975 100%
    );
  border-radius: 6px 8px 5px 7px;
  border: 2px solid #9e7f4d;
  box-shadow:
    0 24px 60px rgba(0, 0, 0, 0.85),
    0 4px 14px rgba(0, 0, 0, 0.6),
    inset 0 0 42px rgba(138, 98, 42, 0.32);
  padding: 34px 36px 56px;
}

/* Subtle double-ruled outer margin frame on the vellum */
.vellum-folio::before {
  content: "";
  position: absolute;
  inset: 14px;
  border: 1.5px solid rgba(179, 36, 26, 0.32);
  outline: 1px solid rgba(179, 36, 26, 0.18);
  outline-offset: -5px;
  pointer-events: none;
}

/* Folio Running Header */
.folio-running-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 12px 10px;
  border-bottom: 1.5px double rgba(179, 36, 26, 0.45);
  font-size: 0.82rem;
  color: var(--vermilion-dark);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.folio-ornament {
  font-size: 1.2rem;
  color: var(--gold-deep);
}

/* ==========================================================================
   4. ILLUMINATED FRONTISPIECE & RUBRIC
   ========================================================================== */
.illuminated-frontispiece {
  text-align: center;
  margin-top: 14px;
  margin-bottom: 26px;
}

.illuminated-border-top {
  width: 100%;
  margin-bottom: 14px;
}

.vine-border-svg {
  width: 100%;
  height: auto;
  display: block;
  filter: drop-shadow(0 3px 5px rgba(33, 21, 14, 0.25));
}

.manuscript-title {
  margin: 8px 0 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.title-sub {
  font-size: 0.92rem;
  font-style: italic;
  font-weight: normal;
  color: var(--vermilion);
  letter-spacing: 0.06em;
}

.title-main {
  font-family: var(--font-display);
  font-size: clamp(1.45rem, 2.7vw, 2.1rem);
  font-weight: bold;
  letter-spacing: 0.1em;
  color: var(--lapis);
  text-shadow:
    1px 1px 0 var(--gold-bright),
    2px 2px 3px rgba(33, 21, 14, 0.22);
}

.title-numeral {
  font-size: 0.95rem;
  color: var(--gold-deep);
  background: linear-gradient(90deg, transparent, rgba(212, 175, 55, 0.22), transparent);
  padding: 2px 24px;
  letter-spacing: 0.14em;
}

/* Vermilion Incipit Rubric Box */
.incipit-rubric {
  max-width: 720px;
  margin: 0 auto 14px;
  padding: 10px 18px;
  background: rgba(179, 36, 26, 0.05);
  border-top: 1px solid rgba(179, 36, 26, 0.35);
  border-bottom: 1px solid rgba(179, 36, 26, 0.35);
  color: var(--vermilion);
  font-style: italic;
  font-size: 0.94rem;
}

.rubric-line {
  margin: 2px 0;
  border-bottom: 1px dashed rgba(179, 36, 26, 0.18);
}

.rubric-mark {
  font-style: normal;
  font-weight: bold;
  color: var(--lapis);
}

.scroll-invitation {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 0.82rem;
  color: var(--ink-brown);
  background: rgba(212, 175, 55, 0.16);
  border: 1px solid rgba(143, 101, 8, 0.4);
  padding: 4px 16px;
  border-radius: 20px;
  margin-top: 4px;
}

.manicule-down {
  display: inline-block;
  font-size: 1.15rem;
  color: var(--vermilion);
  animation: bob-down 1.4s ease-in-out infinite alternate;
}

@keyframes bob-down {
  0%   { transform: translateY(-2px); }
  100% { transform: translateY(3px); }
}

/* ==========================================================================
   5. MANUSCRIPT 3-COLUMN LAYOUT & SCROLL-INKED LINES
   ========================================================================== */
.manuscript-body {
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.chronicle-watch {
  display: grid;
  grid-template-columns: 138px 1fr 146px;
  gap: 14px;
  align-items: start;
}

/* Center Ruled Column (with authentic vertical red-lead margin lines) */
.ruled-column {
  position: relative;
  padding: 8px 16px 14px;
  border-left: 2px double rgba(179, 36, 26, 0.35);
  border-right: 2px double rgba(179, 36, 26, 0.35);
  background: rgba(255, 252, 244, 0.28);
}

.watch-rubric {
  margin: 0 0 10px;
  padding-bottom: 4px;
  border-bottom: 1px solid rgba(179, 36, 26, 0.35);
  font-size: 0.94rem;
  font-weight: bold;
  color: var(--vermilion);
  letter-spacing: 0.02em;
}

.pilcrow-red {
  color: var(--vermilion);
  font-size: 1.15rem;
  margin-right: 4px;
}

.pilcrow-blue {
  color: var(--lapis);
  font-size: 1.15rem;
  margin-right: 4px;
}

/* Historiated Initial Block in Watch I */
.historiated-block {
  display: flex;
  flex-direction: column;
}

.historiated-top-row {
  display: grid;
  grid-template-columns: 108px 1fr;
  gap: 12px;
  align-items: center;
}

.historiated-initial {
  width: 108px;
  height: 108px;
}

.initial-svg {
  width: 100%;
  height: 100%;
  display: block;
  filter: drop-shadow(2px 3px 4px rgba(33, 21, 14, 0.35));
}

/* Spider dangling inside the 404 archway of the initial */
.arch-spider {
  animation: spider-yo-yo 3.6s ease-in-out infinite alternate;
  transform-origin: 65px 34px;
}

@keyframes spider-yo-yo {
  0%   { transform: translateY(-6px); }
  100% { transform: translateY(6px); }
}

/* --------------------------------------------------------------------------
   SCROLL-DRIVEN INKING LINES & ACTIVE SCRIBING QUILL
   -------------------------------------------------------------------------- */
.verse-stanza {
  display: flex;
  flex-direction: column;
}

.ms-line {
  position: relative;
  display: block;
  min-height: 2.05rem;
  padding: 3px 4px 2px;
  /* Medieval red-lead horizontal ruling line */
  border-bottom: 1px solid rgba(179, 36, 26, 0.22);
  font-size: 0.91rem;
  line-height: 1.72;
  color: var(--ink-iron);
}

/* The ink reveal mask driven by scroll view() timeline */
.ms-ink {
  display: block;
  -webkit-mask-image: linear-gradient(
    90deg,
    #000000 0%,
    #000000 47.5%,
    rgba(0, 0, 0, 0.4) 49.5%,
    transparent 50.5%,
    transparent 100%
  );
  mask-image: linear-gradient(
    90deg,
    #000000 0%,
    #000000 47.5%,
    rgba(0, 0, 0, 0.4) 49.5%,
    transparent 50.5%,
    transparent 100%
  );
  -webkit-mask-size: 200% 100%;
  mask-size: 200% 100%;
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;

  animation-name: ink-sweep;
  animation-timing-function: linear;
  animation-fill-mode: both;
  animation-timeline: view();
  animation-range: cover 13% cover 18%;
}

@keyframes ink-sweep {
  0% {
    -webkit-mask-position: 100% 0%;
    mask-position: 100% 0%;
    filter: sepia(0.6) brightness(1.3);
  }
  85% {
    filter: sepia(0.25) brightness(1.08);
  }
  100% {
    -webkit-mask-position: 0% 0%;
    mask-position: 0% 0%;
    filter: sepia(0) brightness(1);
  }
}

/* The Active Goose Quill that glides across each line as it inks on scroll! */
.ms-quill {
  position: absolute;
  top: -19px;
  left: 0%;
  width: 44px;
  height: 44px;
  pointer-events: none;
  z-index: 20;
  opacity: 0;
  animation-name: quill-glide-line;
  animation-timing-function: linear;
  animation-fill-mode: both;
  animation-timeline: view();
  animation-range: cover 13% cover 18%;
}

/* Inner pseudo-element performs continuous time-based hand scribbling motion */
.ms-quill::before {
  content: "";
  display: block;
  width: 100%;
  height: 100%;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 64 64'%3E%3Cpath d='M6,58 L18,42 C28,22 44,8 60,4 C54,18 42,36 24,46 L6,58 Z' fill='%23fbf6eb' stroke='%234a3219' stroke-width='1.8'/%3E%3Cpath d='M4,60 L60,4' stroke='%23b3241a' stroke-width='1.6'/%3E%3Ccircle cx='4' cy='60' r='2.5' fill='%23b3241a'/%3E%3C/svg%3E");
  background-size: contain;
  background-repeat: no-repeat;
  transform-origin: 6% 94%;
  animation: quill-scribble-bob 0.32s ease-in-out infinite alternate;
  filter: drop-shadow(2px 4px 3px rgba(0, 0, 0, 0.35));
}

@keyframes quill-glide-line {
  0% {
    left: 0%;
    opacity: 0;
  }
  4% {
    left: 3%;
    opacity: 1;
  }
  92% {
    left: 88%;
    opacity: 1;
  }
  100% {
    left: 96%;
    opacity: 0;
  }
}

@keyframes quill-scribble-bob {
  0%   { transform: rotate(-6deg) translateY(0px); }
  100% { transform: rotate(8deg) translateY(-3px); }
}

/* Inline Calligraphic Highlights inside Verse Lines */
.first-word-caps {
  font-variant: small-caps;
  font-weight: bold;
  letter-spacing: 0.06em;
  color: var(--lapis);
  font-size: 1.08rem;
}

.rubric-inline {
  color: var(--vermilion);
  font-style: italic;
}

.gilded-num {
  display: inline-block;
  padding: 0 5px;
  background: linear-gradient(135deg, #f7e27c, #d4af37);
  color: #3b2304;
  font-weight: bold;
  border-radius: 3px;
  border: 1px solid #8f6508;
  font-size: 0.86rem;
  line-height: 1.3;
}

.drop-cap-inline {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.65rem;
  height: 1.65rem;
  margin-right: 2px;
  font-family: var(--font-display);
  font-weight: bold;
  font-size: 1.15rem;
  border-radius: 3px;
  border: 1.5px solid var(--gold-mid);
  box-shadow: 1px 1px 3px rgba(0, 0, 0, 0.25);
  vertical-align: text-bottom;
}

.blue-cap {
  background: var(--lapis);
  color: var(--gold-bright);
}

.red-cap {
  background: var(--vermilion);
  color: var(--gold-bright);
}

.gold-cap {
  background: linear-gradient(135deg, #d4af37, #8f6508);
  color: #fff8dc;
}

/* Inter-Stanza Ornamental Dividers */
.stanza-divider {
  width: 68%;
  margin: -6px auto;
}

.divider-svg {
  width: 100%;
  height: 26px;
  display: block;
}

.flourish-path {
  stroke-dasharray: 460;
  stroke-dashoffset: 460;
  animation-name: draw-flourish;
  animation-timing-function: linear;
  animation-fill-mode: both;
  animation-timeline: view();
  animation-range: cover 5% cover 30%;
}

@keyframes draw-flourish {
  to { stroke-dashoffset: 0; }
}

/* ==========================================================================
   6. MARGINALIA, DRÔLERIES & NO-JS INTERACTIONS
   ========================================================================== */
.margin-col {
  font-size: 0.78rem;
  line-height: 1.4;
  color: var(--ink-brown);
}

/* --- Drôlerie 1: The Trumpet-Blowing Hare (Watch I Left Margin) --- */
.drolerie-hare {
  position: relative;
  padding: 6px;
  border-radius: 6px;
  transition: background 0.2s;
  cursor: pointer;
}

.drolerie-hare:hover,
.drolerie-hare:focus {
  background: rgba(212, 175, 55, 0.15);
  outline: none;
}

.hare-svg {
  width: 100%;
  max-width: 132px;
  height: auto;
  display: block;
  margin: 0 auto;
}

.hare-horn {
  transform-origin: 58px 54px;
  animation: horn-toot 2.2s ease-in-out infinite alternate;
}

@keyframes horn-toot {
  0%   { transform: rotate(-3deg); }
  100% { transform: rotate(5deg) scale(1.03); }
}

.hare-notes {
  position: absolute;
  top: 2px;
  right: 4px;
  display: flex;
  gap: 4px;
  pointer-events: none;
}

.neume {
  font-size: 0.72rem;
  font-weight: bold;
  color: var(--vermilion);
  animation: note-float 2.6s ease-in-out infinite;
}

.n-2 {
  animation-delay: 0.8s;
  color: var(--lapis);
  font-size: 0.65rem;
}

.n-3 {
  animation-delay: 1.6s;
}

@keyframes note-float {
  0%   { transform: translateY(6px) scale(0.85); opacity: 0; }
  45%  { opacity: 1; }
  100% { transform: translateY(-12px) scale(1.1); opacity: 0; }
}

.drolerie-caption {
  text-align: center;
  margin-top: 4px;
  font-size: 0.73rem;
}

.hover-secret {
  display: block;
  margin-top: 3px;
  color: var(--vermilion);
  font-weight: bold;
  opacity: 0;
  transform: translateY(-3px);
  transition: opacity 0.25s, transform 0.25s;
}

.drolerie-hare:hover .hover-secret,
.drolerie-hare:focus .hover-secret {
  opacity: 1;
  transform: translateY(0);
}

/* --- Marginal Gloss Boxes --- */
.marginal-gloss {
  padding: 8px 10px;
  background: rgba(235, 220, 188, 0.55);
  border: 1px solid rgba(143, 101, 8, 0.45);
  border-left: 3px solid var(--vermilion);
  border-radius: 3px;
  font-family: var(--font-gloss);
}

.gloss-header {
  font-weight: bold;
  color: var(--lapis);
  border-bottom: 1px dotted rgba(27, 59, 115, 0.35);
  margin-bottom: 4px;
  padding-bottom: 2px;
  font-size: 0.76rem;
}

.marginal-gloss p {
  margin: 0;
  font-size: 0.74rem;
}

.pigeon-svg {
  width: 100%;
  max-width: 105px;
  height: auto;
  display: block;
  margin: 6px auto 0;
  animation: pigeon-tilt 3s ease-in-out infinite alternate;
}

@keyframes pigeon-tilt {
  0%   { transform: rotate(-3deg); }
  100% { transform: rotate(5deg); }
}

/* --- Drôlerie 2: Tutivillus the Misbehaving Ink-Imp (Watch II Left Margin) --- */
.imp-card {
  display: block;
  cursor: pointer;
  user-select: none;
  text-align: center;
  padding: 6px;
  border-radius: 6px;
  border: 1px dashed transparent;
  transition: border-color 0.2s, background 0.2s;
}

.imp-card:hover {
  border-color: var(--vermilion);
  background: rgba(179, 36, 26, 0.06);
}

.imp-speech {
  background: #fff9ea;
  border: 1px solid var(--ink-brown);
  border-radius: 8px;
  padding: 4px 6px;
  font-size: 0.69rem;
  color: var(--ink-iron);
  margin-bottom: 4px;
  box-shadow: 1px 2px 4px rgba(0, 0, 0, 0.12);
}

.speech-poked {
  display: none;
  color: var(--vermilion);
  font-weight: bold;
}

.imp-svg {
  width: 100%;
  max-width: 122px;
  height: auto;
  display: block;
  margin: 0 auto;
}

.imp-creature {
  transform-origin: 62px 105px;
  animation: imp-peek 2.8s ease-in-out infinite alternate;
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.imp-pupil {
  animation: imp-eyes-dart 3.2s steps(2, end) infinite;
}

@keyframes imp-peek {
  0%   { transform: translateY(4px) rotate(-3deg); }
  100% { transform: translateY(-5px) rotate(4deg); }
}

@keyframes imp-eyes-dart {
  0%, 100% { transform: translateX(-1.5px); }
  50%      { transform: translateX(2px); }
}

/* When Tutivillus is clicked (#poke-imp:checked) */
#poke-imp:checked + .imp-card .imp-creature {
  animation: none;
  transform: translateY(18px) scale(0.88) rotate(-12deg);
}
#poke-imp:checked + .imp-card .speech-default {
  display: none;
}
#poke-imp:checked + .imp-card .speech-poked {
  display: inline;
}

.imp-hint {
  display: block;
  font-size: 0.68rem;
  color: var(--vermilion);
  margin-top: 2px;
}

/* --- INTERACTION #1: Sewn-On Vellum Patch (Schedula Consuta) --- */
.schedula-wrapper {
  perspective: 700px;
}

.schedula-container {
  position: relative;
  min-height: 176px;
}

.linen-stitches {
  display: flex;
  justify-content: space-around;
  color: var(--vermilion);
  font-size: 0.72rem;
  font-weight: bold;
  letter-spacing: -1px;
  margin-bottom: -3px;
  position: relative;
  z-index: 5;
}

/* Secret interior underneath the flap */
.schedula-inside {
  background: #f9f2e2;
  border: 1.5px solid #8f6508;
  border-radius: 3px;
  padding: 10px 8px 8px;
  box-shadow: inset 0 2px 8px rgba(33, 21, 14, 0.18);
  text-align: center;
}

.secret-heading {
  font-weight: bold;
  color: var(--vermilion);
  font-size: 0.74rem;
  margin-bottom: 4px;
}

.secret-doodle {
  width: 100%;
  max-width: 110px;
  height: auto;
  display: block;
  margin: 0 auto 4px;
}

.secret-confession {
  margin: 0 0 6px;
  font-size: 0.69rem;
  line-height: 1.35;
  color: var(--ink-iron);
}

.schedula-close-btn {
  display: inline-block;
  font-size: 0.66rem;
  color: var(--lapis);
  text-decoration: underline;
  cursor: pointer;
}

/* Outer Vellum Flap that swings open in 3D */
.schedula-flap {
  position: absolute;
  inset: 6px 0 0 0;
  background: linear-gradient(160deg, #ecdab4 0%, #dcc394 100%);
  border: 1.5px solid #8c6a38;
  border-top: 2.5px dashed var(--vermilion);
  border-radius: 3px 3px 6px 6px;
  box-shadow: 0 6px 14px rgba(33, 21, 14, 0.32);
  padding: 16px 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  text-align: center;
  cursor: pointer;
  user-select: none;
  transform-origin: top center;
  transition: transform 0.65s cubic-bezier(0.34, 1.4, 0.64, 1), opacity 0.45s;
  backface-visibility: hidden;
  z-index: 4;
}

.schedula-flap:hover {
  transform: rotateX(22deg);
}

.flap-seal {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--vermilion);
  color: var(--gold-bright);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.flap-title {
  font-weight: bold;
  color: var(--ink-iron);
  font-size: 0.82rem;
}

.flap-sub {
  font-style: italic;
  font-size: 0.68rem;
  color: var(--ink-faded);
}

.flap-cta {
  margin-top: 4px;
  font-size: 0.7rem;
  color: var(--vermilion-dark);
  font-weight: bold;
}

.manicule-tap {
  display: inline-block;
  animation: tap-right 0.9s ease-in-out infinite alternate;
}

@keyframes tap-right {
  0%   { transform: translateX(-2px); }
  100% { transform: translateX(3px); }
}

/* Checked state: Flap folds all the way up and reveals the confession underneath */
#toggle-schedula:checked ~ .schedula-container .schedula-flap {
  transform: rotateX(175deg);
  opacity: 0;
  pointer-events: none;
}

/* ==========================================================================
   7. DRÔLERIE FRIEZE: THE KNIGHT VS. THE GIANT 404 SNAIL (SCROLL-DRIVEN)
   ========================================================================== */
.snail-battle-frieze {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  padding: 12px 32px 8px;
  margin: 4px 12px;
  background: rgba(212, 175, 55, 0.08);
  border-top: 1px solid rgba(43, 102, 76, 0.3);
  border-bottom: 1px solid rgba(43, 102, 76, 0.3);
  border-radius: 4px;
}

.snail-combatant {
  position: relative;
  width: 145px;
  cursor: pointer;
  animation-name: snail-advance;
  animation-timing-function: linear;
  animation-fill-mode: both;
  animation-timeline: view();
  animation-range: entry 0% cover 65%;
}

@keyframes snail-advance {
  0%   { transform: translateX(0px); }
  100% { transform: translateX(135px); }
}

.snail-svg,
.knight-svg {
  width: 100%;
  height: auto;
  display: block;
}

.snail-stalks {
  transform-origin: 130px 44px;
  animation: stalks-wiggle 1.8s ease-in-out infinite alternate;
}

@keyframes stalks-wiggle {
  0%   { transform: rotate(-5deg); }
  100% { transform: rotate(7deg); }
}

.knight-combatant {
  position: relative;
  width: 125px;
  cursor: pointer;
}

.knight-body {
  transform-origin: 85px 75px;
  animation: knight-shiver 0.45s ease-in-out infinite alternate;
}

.surrender-flag {
  transform-origin: 48px 52px;
  animation: flag-wave 1.3s ease-in-out infinite alternate;
}

@keyframes knight-shiver {
  0%   { transform: rotate(2deg) translateX(-1px); }
  100% { transform: rotate(7deg) translateX(2px); }
}

@keyframes flag-wave {
  0%   { transform: rotate(-8deg); }
  100% { transform: rotate(10deg); }
}

.snail-speech,
.knight-speech {
  position: absolute;
  top: -22px;
  left: 0;
  white-space: nowrap;
  background: #fff9eb;
  border: 1px solid var(--ink-brown);
  padding: 2px 7px;
  border-radius: 6px;
  font-size: 0.68rem;
  font-style: italic;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 0.2s, transform 0.2s;
  pointer-events: none;
  z-index: 10;
}

.knight-speech {
  left: auto;
  right: 0;
}

.snail-combatant:hover .snail-speech,
.snail-combatant:focus .snail-speech,
.knight-combatant:hover .knight-speech,
.knight-combatant:focus .knight-speech {
  opacity: 1;
  transform: translateY(0);
}

.frieze-caption {
  flex: 0 0 100%;
  order: 3;
  text-align: center;
  font-size: 0.74rem;
  color: var(--verdigris);
  border-top: 2px solid var(--verdigris);
  margin-top: -2px;
  padding: 6px 12px 2px;
}

/* ==========================================================================
   8. INTERACTION #2: THE PALIMPSEST BONE-SCRAPER (WATCH III)
   ========================================================================== */
.palimpsest-tool-box {
  background: rgba(235, 220, 188, 0.7);
  border: 1.5px solid #8c5828;
  border-radius: 5px;
  padding: 8px;
  text-align: center;
}

.tool-badge {
  font-size: 0.68rem;
  font-weight: bold;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--vermilion-dark);
  margin-bottom: 4px;
}

.rasorium-svg {
  width: 96px;
  height: auto;
  display: block;
  margin: 0 auto 4px;
  animation: knife-gleam 2.8s ease-in-out infinite alternate;
}

@keyframes knife-gleam {
  0%   { transform: rotate(-4deg); }
  100% { transform: rotate(6deg) translateY(-2px); }
}

.tool-desc {
  margin: 0 0 8px;
  font-size: 0.7rem;
  line-height: 1.35;
}

.rasorium-btn {
  display: block;
  padding: 5px 8px;
  background: var(--vermilion);
  color: #fff8e7;
  font-weight: bold;
  font-size: 0.72rem;
  border-radius: 4px;
  border: 1px solid #4a0b06;
  cursor: pointer;
  user-select: none;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.25);
  transition: background 0.2s, transform 0.15s;
}

.rasorium-btn:hover {
  background: var(--vermilion-dark);
}

.rasorium-btn:active {
  transform: scale(0.97);
}

.btn-scraped {
  display: none;
}

.palimpsest-stage {
  position: relative;
}

.layer-palimpsest {
  display: none;
  padding: 8px 10px;
  background:
    repeating-linear-gradient(
      -25deg,
      rgba(168, 134, 82, 0.12) 0px,
      rgba(168, 134, 82, 0.12) 4px,
      transparent 4px,
      transparent 10px
    ),
    rgba(224, 202, 162, 0.65);
  border: 1px dashed rgba(143, 27, 19, 0.5);
  border-radius: 4px;
}

.palimpsest-watermark {
  font-size: 0.68rem;
  letter-spacing: 0.15em;
  color: var(--vermilion);
  font-weight: bold;
  text-align: center;
  margin-bottom: 6px;
}

.palimpsest-line {
  padding: 4px 2px;
  border-bottom: 1px solid rgba(139, 90, 43, 0.25);
  font-size: 0.9rem;
  font-family: var(--font-gloss);
  color: #59412a;
}

.palimpsest-line del {
  opacity: 0.6;
  text-decoration-color: var(--vermilion);
}

.scrawl-red {
  color: var(--vermilion);
  font-weight: bold;
  font-style: italic;
}

.scrawl-brown {
  color: var(--ink-iron);
  font-style: italic;
}

.palimpsest-sketch {
  width: 100%;
  max-width: 280px;
  height: auto;
  display: block;
  margin: 6px auto 0;
}

/* When #scrape-palimpsest is checked */
.watch-matins:has(#scrape-palimpsest:checked) .btn-unscraped {
  display: none;
}

.watch-matins:has(#scrape-palimpsest:checked) .btn-scraped {
  display: inline;
}

.watch-matins:has(#scrape-palimpsest:checked) .rasorium-btn {
  background: var(--lapis);
  border-color: #0e2245;
}

#scrape-palimpsest:checked ~ .palimpsest-stage .layer-official {
  display: none;
}

#scrape-palimpsest:checked ~ .palimpsest-stage .layer-palimpsest {
  display: block;
  animation: scrape-reveal 0.45s ease-out both;
}

@keyframes scrape-reveal {
  0% {
    clip-path: inset(0 100% 0 0);
    filter: contrast(1.4) sepia(0.5);
  }
  100% {
    clip-path: inset(0 0 0 0);
    filter: contrast(1) sepia(0);
  }
}

/* HTTP Headers Gloss List */
.medieval-headers {
  margin: 4px 0 0;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 3px 6px;
  font-size: 0.7rem;
}

.medieval-headers dt {
  font-weight: bold;
  color: var(--vermilion-dark);
}

.medieval-headers dd {
  margin: 0;
  color: var(--ink-iron);
}

/* Dawn Rooster & Explicit Diamond in Watch IV */
.rooster-svg {
  width: 78px;
  height: auto;
  display: block;
  margin: 0 auto 4px;
}

.explicit-colophon {
  margin-top: 16px;
  text-align: center;
  color: var(--vermilion);
  line-height: 1.45;
}

.explicit-line-1 {
  margin: 0;
  font-size: 0.82rem;
  font-weight: bold;
  letter-spacing: 0.1em;
}

.explicit-line-2 {
  margin: 2px 0;
  font-size: 0.78rem;
  font-style: italic;
  color: var(--ink-brown);
}

.explicit-line-3 {
  margin: 2px 0;
  font-size: 0.74rem;
  font-weight: bold;
  color: var(--lapis);
  letter-spacing: 0.12em;
}

.explicit-line-4 {
  margin: 0;
  font-size: 0.9rem;
  color: var(--gold-deep);
}

.manicule-down-cluster {
  text-align: center;
  font-size: 1.2rem;
  color: var(--vermilion);
  margin-top: 4px;
}

/* ==========================================================================
   9. FOOTER INTERACTIONS: RED WAX SEAL (#3) & FOLIO VERSO PAGE TURN (#4)
   ========================================================================== */
.folio-bottom-charter {
  margin-top: 26px;
  padding-top: 18px;
  border-top: 2px double rgba(179, 36, 26, 0.4);
  display: flex;
  flex-wrap: wrap;
  justify-content: space-around;
  align-items: flex-start;
  gap: 24px;
}

/* --- INTERACTION #3: The Abbot's Red Wax Seal --- */
.charter-seal-station {
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
}

.parchment-plica {
  width: 36px;
  height: 28px;
  background: linear-gradient(90deg, #d8c298, #f2e5c9, #cfb482);
  border-left: 1px solid #9e7f4d;
  border-right: 1px solid #9e7f4d;
  margin-bottom: -12px;
  box-shadow: 0 3px 6px rgba(0, 0, 0, 0.2);
}

.wax-seal-widget {
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: pointer;
  user-select: none;
}

.wax-blob {
  width: 112px;
  height: 112px;
  filter: drop-shadow(0 6px 10px rgba(35, 8, 5, 0.5));
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.wax-seal-widget:hover .wax-blob {
  transform: scale(1.05);
}

.wax-seal-widget:active .wax-blob {
  transform: scale(0.92);
}

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

/* Unstamped vs Stamped appearance */
.seal-impression {
  opacity: 0.22;
  transform: scale(0.86);
  transform-origin: 65px 65px;
  transition: opacity 0.35s ease, transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.when-stamped {
  display: none;
}

.seal-prompt {
  margin-top: 6px;
  font-size: 0.78rem;
  font-weight: bold;
  color: var(--vermilion-dark);
  background: rgba(179, 36, 26, 0.08);
  border: 1px solid rgba(179, 36, 26, 0.35);
  padding: 3px 12px;
  border-radius: 14px;
}

#press-wax-seal:checked ~ .wax-seal-widget .seal-impression {
  opacity: 1;
  transform: scale(1);
}

#press-wax-seal:checked ~ .wax-seal-widget .wax-blob {
  transform: scale(1.06) rotate(-4deg);
}

#press-wax-seal:checked ~ .wax-seal-widget .when-unstamped {
  display: none;
}

#press-wax-seal:checked ~ .wax-seal-widget .when-stamped {
  display: inline;
  color: var(--verdigris);
}

/* --- INTERACTION #4: Turn the Leaf Corner (Inspect Fol. 404 Verso) --- */
.verso-turn-station {
  flex: 1;
  min-width: 290px;
  max-width: 480px;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}

.corner-peel-trigger {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  background: linear-gradient(135deg, #e5cf9e 0%, #c9ab72 100%);
  border: 1.5px solid #7d5d2b;
  border-radius: 20px 4px 18px 4px;
  color: var(--ink-iron);
  font-weight: bold;
  font-size: 0.84rem;
  cursor: pointer;
  user-select: none;
  box-shadow:
    -3px 4px 10px rgba(33, 21, 14, 0.28),
    inset 1px 1px 0 rgba(255, 255, 255, 0.5);
  transition: transform 0.25s, box-shadow 0.25s;
}

.corner-peel-trigger:hover {
  transform: translate(-3px, -2px) rotate(-1.5deg);
  box-shadow: -6px 8px 16px rgba(33, 21, 14, 0.35);
}

.peel-label-open {
  display: none;
}

/* The Verso Sheet (Back of the Parchment) */
.verso-sheet {
  width: 100%;
  max-height: 0;
  opacity: 0;
  overflow: hidden;
  transform-origin: bottom right;
  transform: perspective(900px) rotateY(-25deg) scale(0.95);
  transition:
    max-height 0.6s cubic-bezier(0.25, 1, 0.5, 1),
    opacity 0.45s ease,
    transform 0.55s cubic-bezier(0.25, 1, 0.5, 1);
}

.verso-inner {
  margin-top: 12px;
  padding: 16px 18px;
  /* Rougher flesh-side / hair-side of the verso calfskin */
  background:
    radial-gradient(circle at 80% 25%, rgba(168, 130, 74, 0.22), transparent 55%),
    linear-gradient(135deg, #e2cda3 0%, #ead8b5 50%, #d4ba8a 100%);
  border: 2px solid #876838;
  border-radius: 6px;
  box-shadow:
    inset 0 0 24px rgba(89, 58, 18, 0.28),
    0 10px 24px rgba(0, 0, 0, 0.35);
}

.verso-header {
  display: flex;
  justify-content: space-between;
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--vermilion-dark);
  border-bottom: 1px solid rgba(143, 27, 19, 0.3);
  padding-bottom: 4px;
}

/* Mirrored ink bleed-through from the front side of the vellum! */
.verso-bleedthrough {
  margin: 6px 0 8px;
  font-size: 0.78rem;
  font-weight: bold;
  letter-spacing: 0.12em;
  color: rgba(33, 21, 14, 0.22);
  transform: scaleX(-1);
  text-align: center;
  filter: blur(0.6px);
  user-select: none;
}

.verso-grid {
  display: grid;
  grid-template-columns: 1.25fr 1fr;
  gap: 12px;
  align-items: center;
}

.verso-notes h3 {
  margin: 0 0 6px;
  font-size: 0.88rem;
  color: var(--lapis);
}

.verso-tally {
  list-style: none;
  padding: 0;
  margin: 0 0 10px;
  font-size: 0.76rem;
}

.verso-tally li {
  display: flex;
  justify-content: space-between;
  border-bottom: 1px dotted rgba(61, 39, 24, 0.3);
  padding: 2px 0;
}

.verso-wayfinder {
  margin: 0;
  font-size: 0.76rem;
  line-height: 1.45;
}

.abbey-gate-link {
  color: var(--vermilion);
  font-weight: bold;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.abbey-gate-link:hover {
  color: var(--lapis);
}

.verso-map-svg {
  width: 100%;
  height: auto;
  display: block;
  background: rgba(246, 237, 217, 0.55);
  border-radius: 4px;
}

/* Checked state: unfolds the Verso leaf */
#turn-folio-leaf:checked ~ .corner-peel-trigger .peel-label-closed {
  display: none;
}

#turn-folio-leaf:checked ~ .corner-peel-trigger .peel-label-open {
  display: inline;
  color: var(--vermilion-dark);
}

#turn-folio-leaf:checked ~ .verso-sheet {
  max-height: 420px;
  opacity: 1;
  transform: perspective(900px) rotateY(0deg) scale(1);
}

/* Oak Lectern Bottom Ledge */
.lectern-ledge {
  height: 26px;
  margin: -6px -12px 0;
  background: linear-gradient(180deg, #3b2414 0%, #24150b 55%, #120a05 100%);
  border: 2px solid #59381f;
  border-radius: 4px;
  box-shadow: 0 16px 32px rgba(0, 0, 0, 0.9);
  display: flex;
  align-items: center;
  justify-content: center;
}

.ledge-groove {
  width: 82%;
  height: 5px;
  background: #120a05;
  border-radius: 3px;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.9);
}

/* ==========================================================================
   10. RESPONSIVE ADAPTATION FOR SMALLER WINDOWS
   ========================================================================== */
@media (max-width: 1024px) {
  .lectern-desk {
    padding: 0 156px 0 14px;
  }
  .chronicle-watch {
    grid-template-columns: 124px 1fr 132px;
    gap: 10px;
  }
}

@media (max-width: 820px) {
  .scriptorium-candle-dock {
    top: auto;
    bottom: 10px;
    right: 10px;
    transform: none;
    width: 118px;
    padding: 8px 6px;
    scale: 0.88;
    transform-origin: bottom right;
  }
  .inkhorn-station {
    display: none;
  }
  .lectern-desk {
    padding: 0 12px;
  }
  .vellum-folio {
    padding: 24px 18px 42px;
  }
  .chronicle-watch {
    grid-template-columns: 1fr;
  }
  .margin-col {
    max-width: 340px;
    margin: 0 auto;
  }
  .verso-grid {
    grid-template-columns: 1fr;
  }
}
