/* The Calcutta Gazetteer — hand-built prop pages. Kept out of the generator via preserveDirs. */

:root {
  --desk-1: #191108;
  --desk-2: #2a1c0e;
  --ink: #2a2118;
  --ink-faint: #4d4234;
  --meg: #58381b;
  --meg-faint: #6d4b28;
  --gilt: #c9a75c;
  --gilt-deep: #8f7133;
  --leather: #3b1f12;
  --leather-dark: #24120a;
  --paper-edge: rgba(43, 28, 12, 0.55);
}

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

html { scroll-behavior: smooth; }

body {
  background-color: var(--desk-1);
  background-image:
    radial-gradient(ellipse 120% 70% at 50% -10%, rgba(255, 196, 110, 0.10), transparent 60%),
    radial-gradient(ellipse 140% 120% at 50% 55%, var(--desk-2), var(--desk-1) 85%);
  background-attachment: fixed;
  color: var(--ink);
  font-family: 'IM Fell English', serif;
  min-height: 100vh;
  padding: 0 0 8rem;
}

/* ---- return ribbon ---- */
.ribbon {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  max-width: 1100px;
  margin: 0 auto;
  padding: 1.1rem 1.4rem 0.4rem;
  font-family: 'IM Fell English SC', serif;
  font-size: 0.95rem;
  letter-spacing: 0.14em;
}
.ribbon a {
  color: var(--gilt);
  text-decoration: none;
  border-bottom: 1px solid rgba(201, 167, 92, 0.35);
  padding-bottom: 1px;
}
.ribbon a:hover { color: #e8cf95; border-bottom-color: #e8cf95; }
.ribbon .plate { color: rgba(201, 167, 92, 0.55); }

/* ---- the leaves ---- */
.book { max-width: 1100px; margin: 1.2rem auto 0; padding: 0 1.2rem; }

.leaf {
  position: relative;
  background:
    linear-gradient(rgba(242, 231, 205, 0.28), rgba(238, 224, 194, 0.34)),
    url('assets/paper-deep.jpg');
  background-size: cover;
  background-position: center;
  max-width: 980px;
  margin: 0 auto 2.6rem;
  padding: 2.6rem 3.2rem 2.4rem;
  box-shadow:
    0 1px 2px rgba(0,0,0,0.5),
    0 14px 44px rgba(0,0,0,0.55),
    inset 0 0 60px rgba(96, 68, 30, 0.18),
    inset 0 0 6px rgba(70, 48, 20, 0.25);
  border-radius: 2px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 215px;
  column-gap: 2.2rem;
  opacity: 0;
  transform: translateY(18px);
  animation: settle 0.9s ease-out forwards;
}
.leaf:nth-child(odd)  { transform: translateY(18px) rotate(-0.35deg); }
.leaf:nth-child(even) { transform: translateY(18px) rotate(0.3deg); }
.leaf:nth-child(1) { animation-delay: 0.05s; }
.leaf:nth-child(2) { animation-delay: 0.15s; }
.leaf:nth-child(3) { animation-delay: 0.25s; }
.leaf:nth-child(n+4) { animation-delay: 0.35s; }

@keyframes settle {
  to { opacity: 1; transform: translateY(0) rotate(var(--tilt, 0deg)); }
}
.leaf:nth-child(odd)  { --tilt: -0.35deg; }
.leaf:nth-child(even) { --tilt: 0.3deg; }

@media (prefers-reduced-motion: reduce) {
  .leaf { animation: none; opacity: 1; transform: none; }
}

/* running head spans both columns */
.running-head {
  grid-column: 1 / -1;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-family: 'IM Fell English SC', serif;
  font-size: 0.86rem;
  letter-spacing: 0.22em;
  color: var(--ink-faint);
  border-bottom: 1px solid rgba(74, 60, 40, 0.45);
  padding-bottom: 0.35rem;
  margin-bottom: 1.6rem;
}

.print { grid-column: 1; font-size: 1.16rem; line-height: 1.68; }
.margin-col { grid-column: 2; position: relative; }

.print h2 {
  font-family: 'IM Fell English SC', serif;
  font-weight: 400;
  font-size: 1.5rem;
  letter-spacing: 0.12em;
  text-align: center;
  margin: 0.2rem 0 0.4rem;
}
.print .fleuron {
  text-align: center;
  color: var(--ink-faint);
  font-size: 1.05rem;
  letter-spacing: 0.6em;
  margin-bottom: 1.15rem;
}
.print p {
  margin-bottom: 1rem;
  text-align: justify;
  hyphens: auto;
}
.print p.opener::first-letter {
  font-size: 3.4em;
  line-height: 0.82;
  float: left;
  padding: 0.06em 0.09em 0 0;
  color: var(--ink);
}
.print em { font-style: italic; }

/* period wage table */
.print table {
  border-collapse: collapse;
  margin: 1.2rem auto 0.4rem;
  font-size: 0.98rem;
  min-width: 82%;
}
.print table caption {
  font-family: 'IM Fell English SC', serif;
  font-size: 0.92rem;
  letter-spacing: 0.18em;
  padding-bottom: 0.45rem;
}
.print th {
  font-family: 'IM Fell English SC', serif;
  font-weight: 400;
  letter-spacing: 0.1em;
  border-top: 2px solid var(--ink);
  border-bottom: 1px solid var(--ink);
  padding: 0.35rem 1rem;
  text-align: left;
}
.print td { padding: 0.3rem 1rem; border-bottom: 1px dotted rgba(74,60,40,0.4); }
.print tr:last-child td { border-bottom: 2px solid var(--ink); }
.print td:last-child, .print th:last-child { text-align: right; }

/* catchword, the period page-turn cue */
.catchword {
  grid-column: 1;
  text-align: right;
  font-style: italic;
  font-size: 0.95rem;
  color: var(--ink-faint);
  margin-top: 1.4rem;
}

/* ink underlines in the print, Meg's hand at work */
.u-ink {
  text-decoration: underline wavy rgba(88, 56, 27, 0.75);
  text-decoration-thickness: 1.5px;
  text-underline-offset: 3px;
}

/* ---- Meg's marginalia ---- */
.meg {
  font-family: 'La Belle Aurore', cursive;
  color: var(--meg);
  font-size: 1.22rem;
  line-height: 1.32;
  transform: rotate(-1.6deg);
  margin-bottom: 1.6rem;
  position: relative;
}
.meg.tilt-r { transform: rotate(1.2deg); }
.meg .manicule {
  font-family: serif;
  font-size: 1.05rem;
  color: var(--meg-faint);
  display: block;
  margin-bottom: 0.1rem;
}
.meg-sig { display: block; text-align: right; margin-top: 0.2rem; }

/* long notes crowd the foot of the page, as real margins fill */
.meg-foot {
  grid-column: 1 / -1;
  font-family: 'La Belle Aurore', cursive;
  color: var(--meg);
  font-size: 1.24rem;
  line-height: 1.34;
  border-top: 1px solid rgba(88, 56, 27, 0.35);
  margin-top: 1.3rem;
  padding-top: 0.8rem;
  transform: rotate(-0.5deg);
}

/* ---- title leaf ---- */
.title-leaf { text-align: center; }
.title-leaf .print { grid-column: 1 / -1; }
.title-leaf h1 {
  font-family: 'IM Fell English SC', serif;
  font-weight: 400;
  font-size: clamp(1.9rem, 4.5vw, 3rem);
  letter-spacing: 0.1em;
  line-height: 1.15;
  margin: 1rem 0 0.4rem;
}
.title-leaf .t-or, .title-leaf .t-sub {
  font-style: italic;
  font-size: 1.15rem;
  margin: 0.5rem auto;
  max-width: 34rem;
  text-align: center;
}
.title-leaf .t-by {
  font-family: 'IM Fell English SC', serif;
  letter-spacing: 0.2em;
  margin: 1.2rem 0 0.2rem;
  text-align: center;
}
.title-leaf .t-rule {
  width: 38%;
  margin: 1.1rem auto;
  border: 0;
  border-top: 1px solid var(--ink);
}
.title-leaf .t-rule.thick { border-top-width: 3px; }
.title-leaf .t-imprint {
  font-size: 0.98rem;
  letter-spacing: 0.06em;
  margin-top: 1.2rem;
  text-align: center;
}
.flyleaf-note {
  font-family: 'La Belle Aurore', cursive;
  color: var(--meg);
  font-size: 1.55rem;
  transform: rotate(-3.5deg);
  margin: 2.2rem auto 0.6rem;
  max-width: 26rem;
  text-align: center;
}

/* ---- gazetteer cover (index) ---- */
.cover-board {
  max-width: 640px;
  margin: 3.5rem auto 0;
  background:
    radial-gradient(ellipse at 30% 20%, rgba(255,255,255,0.05), transparent 55%),
    linear-gradient(160deg, var(--leather), var(--leather-dark) 80%);
  border: 1px solid rgba(0,0,0,0.6);
  border-radius: 6px;
  box-shadow: 0 18px 60px rgba(0,0,0,0.65), inset 0 0 0 3px rgba(201,167,92,0.5), inset 0 0 0 9px transparent, inset 0 0 0 10px rgba(201,167,92,0.28), inset 0 0 90px rgba(0,0,0,0.5);
  padding: 3.4rem 2.6rem;
  text-align: center;
}
.cover-board h1 {
  font-family: 'IM Fell English SC', serif;
  font-weight: 400;
  color: var(--gilt);
  font-size: clamp(1.8rem, 5vw, 2.6rem);
  letter-spacing: 0.18em;
  text-shadow: 0 1px 0 rgba(0,0,0,0.8), 0 0 18px rgba(201,167,92,0.25);
  margin-bottom: 0.4rem;
}
.cover-board .cover-sub {
  color: rgba(201,167,92,0.75);
  font-style: italic;
  font-size: 1.05rem;
  margin-bottom: 2.2rem;
}
.cover-board .cover-orn { color: var(--gilt-deep); letter-spacing: 0.8em; margin: 1.4rem 0; }

.shelf { list-style: none; margin: 0.4rem 0 1rem; }
.shelf li { margin: 1.1rem 0; }
.shelf a {
  display: block;
  background:
    linear-gradient(rgba(240, 228, 200, 0.86), rgba(232, 216, 180, 0.9)),
    url('assets/paper-light.jpg');
  background-size: cover;
  color: var(--ink);
  text-decoration: none;
  padding: 1.05rem 1.2rem 0.95rem;
  border-radius: 2px;
  box-shadow: 0 3px 10px rgba(0,0,0,0.5), inset 0 0 22px rgba(96,68,30,0.15);
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}
.shelf a:hover {
  transform: translateY(-3px) rotate(-0.4deg);
  box-shadow: 0 10px 26px rgba(0,0,0,0.6), inset 0 0 22px rgba(96,68,30,0.15);
}
.shelf .entry-title {
  font-family: 'IM Fell English SC', serif;
  font-size: 1.25rem;
  letter-spacing: 0.12em;
  display: block;
}
.shelf .entry-sub {
  font-style: italic;
  font-size: 0.98rem;
  color: var(--ink-faint);
  display: block;
  margin-top: 0.15rem;
}
.shelf .entry-held {
  opacity: 0.55;
  pointer-events: none;
}
.cover-foot {
  color: rgba(201,167,92,0.5);
  font-size: 0.85rem;
  font-style: italic;
  margin-top: 2rem;
}
.credits {
  max-width: 640px;
  margin: 1.6rem auto 0;
  text-align: center;
  color: rgba(201,167,92,0.35);
  font-size: 0.78rem;
  font-style: italic;
}
.credits a { color: rgba(201,167,92,0.5); }

/* ---- small screens: margins fold into the page ---- */
@media (max-width: 940px) {
  .leaf { grid-template-columns: 1fr; padding: 1.8rem 1.4rem 1.6rem; }
  .margin-col { grid-column: 1; }
  .meg {
    background: rgba(88, 56, 27, 0.06);
    border-left: 2px solid rgba(88, 56, 27, 0.4);
    padding: 0.55rem 0.8rem 0.4rem;
    transform: rotate(-0.8deg);
    max-width: 34rem;
  }
  .catchword { display: none; }
  .print p { text-align: left; }
}

/* ---- pamphlet leaves: full-measure, no margin column ---- */
.pamphlet { grid-template-columns: 1fr; }
.pamphlet .print { grid-column: 1 / -1; }
.pamphlet .running-head { grid-column: 1 / -1; }

/* ---- atlas plates ---- */
.plate-leaf .print { grid-column: 1 / -1; }
.plate-no {
  text-align: right;
  font-family: 'IM Fell English SC', serif;
  font-size: 0.9rem;
  letter-spacing: 0.24em;
  color: var(--ink-faint);
  margin-bottom: 0.8rem;
}
.plate-frame {
  border: 1px solid var(--ink);
  outline: 3px double var(--ink);
  outline-offset: 4px;
  margin: 0.4rem auto 1.1rem;
  padding: 10px;
  background: rgba(238, 227, 200, 0.35);
  cursor: zoom-in;
  display: block;
  max-width: 760px;
  transition: box-shadow 0.25s ease;
}
.plate-frame:hover { box-shadow: 0 6px 22px rgba(43, 28, 12, 0.35); }
.plate-frame img {
  display: block;
  width: 100%;
  height: auto;
  mix-blend-mode: multiply;
  filter: sepia(0.32) saturate(0.72) contrast(0.96);
}
.plate-title {
  font-family: 'IM Fell English SC', serif;
  font-size: 1.35rem;
  letter-spacing: 0.16em;
  text-align: center;
  margin-bottom: 0.15rem;
}
.plate-caption {
  font-style: italic;
  text-align: center;
  font-size: 1.02rem;
  color: var(--ink-faint);
  max-width: 34rem;
  margin: 0 auto 0.5rem;
}
.plate-imprint {
  text-align: center;
  font-size: 0.82rem;
  letter-spacing: 0.08em;
  color: var(--ink-faint);
  margin-bottom: 0.4rem;
}
.plate-hint {
  text-align: center;
  font-size: 0.8rem;
  font-style: italic;
  color: var(--ink-faint);
  opacity: 0.7;
}
.plate-meg {
  font-family: 'La Belle Aurore', cursive;
  color: var(--meg);
  font-size: 1.25rem;
  text-align: center;
  transform: rotate(-1deg);
  margin-top: 0.9rem;
}

/* ---- map lightbox ---- */
.map-lightbox {
  position: fixed;
  inset: 0;
  background: rgba(18, 12, 6, 0.94);
  display: none;
  z-index: 50;
  overflow: hidden;
  cursor: grab;
}
.map-lightbox.open { display: block; }
.map-lightbox.dragging { cursor: grabbing; }
.map-lightbox img {
  position: absolute;
  top: 0; left: 0;
  transform-origin: 0 0;
  user-select: none;
  -webkit-user-drag: none;
  max-width: none;
}
.map-lightbox .lb-close {
  position: fixed;
  top: 1rem; right: 1.4rem;
  font-family: 'IM Fell English SC', serif;
  color: var(--gilt);
  background: none;
  border: 1px solid rgba(201,167,92,0.5);
  border-radius: 3px;
  padding: 0.3rem 0.9rem;
  font-size: 1rem;
  letter-spacing: 0.15em;
  cursor: pointer;
  z-index: 51;
}
.map-lightbox .lb-help {
  position: fixed;
  bottom: 1rem; left: 50%;
  transform: translateX(-50%);
  color: rgba(201,167,92,0.6);
  font-style: italic;
  font-size: 0.85rem;
  pointer-events: none;
}

/* ---- layered viewer (stage + story overlay) ---- */
#lb-stage {
  position: absolute;
  top: 0; left: 0;
  transform-origin: 0 0;
}
.map-lightbox #lb-stage img {
  position: static;
  display: block;
  width: 100%;
  height: 100%;
}
#lb-overlay {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  font-family: 'IM Fell English SC', serif;
}
#lb-overlay .pin circle {
  r: 26px;
  fill: none;
  stroke: #8a2f1f;
  stroke-width: 7;
  paint-order: stroke;
}
#lb-overlay .pin.approx circle { stroke-dasharray: 14 10; }
#lb-overlay .pin text, #lb-overlay .area text, #lb-overlay .edge-arrow text, #lb-overlay .route-label {
  fill: #8a2f1f;
  font-size: 52px;
  letter-spacing: 0.06em;
  paint-order: stroke;
  stroke: rgba(243, 233, 205, 0.85);
  stroke-width: 10px;
  stroke-linejoin: round;
}
#lb-overlay .area text {
  font-size: 64px;
  font-style: italic;
  letter-spacing: 0.22em;
  opacity: 0.85;
}
#lb-overlay .route {
  fill: none;
  stroke: #8a2f1f;
  stroke-width: 8;
  stroke-dasharray: 26 18;
  opacity: 0.8;
}
#lb-overlay .edge-arrow path {
  fill: none;
  stroke: #8a2f1f;
  stroke-width: 9;
  marker-end: none;
}
.lb-controls {
  position: fixed;
  top: 1rem; left: 1.4rem;
  display: none;
  gap: 0.6rem;
  z-index: 51;
}
.lb-toggle {
  font-family: 'IM Fell English SC', serif;
  letter-spacing: 0.12em;
  font-size: 0.95rem;
  padding: 0.3rem 0.9rem;
  background: rgba(59, 31, 18, 0.85);
  color: rgba(201, 167, 92, 0.55);
  border: 1px solid rgba(201, 167, 92, 0.4);
  border-radius: 3px;
  cursor: pointer;
}
.lb-toggle[aria-pressed="true"] {
  color: #e8cf95;
  border-color: rgba(201, 167, 92, 0.85);
  box-shadow: inset 0 0 12px rgba(201, 167, 92, 0.2);
}

/* ---- the season: stationery ---- */
.desk { max-width: 1020px; margin: 1.4rem auto 0; padding: 0 1.2rem; }
.stationery {
  position: relative;
  margin: 0 auto 2.4rem;
  background:
    linear-gradient(rgba(250, 244, 228, 0.92), rgba(244, 235, 212, 0.95)),
    url('assets/paper-light.jpg');
  background-size: cover;
  color: var(--ink);
  box-shadow: 0 2px 4px rgba(0,0,0,0.45), 0 12px 34px rgba(0,0,0,0.5), inset 0 0 26px rgba(120, 92, 40, 0.10);
  border-radius: 2px;
  padding: 2.2rem 2.4rem;
  opacity: 0;
  transform: translateY(16px);
  animation: settle 0.8s ease-out forwards;
}
.stationery:nth-child(odd) { --tilt: -0.7deg; }
.stationery:nth-child(even) { --tilt: 0.6deg; }
.stationery:nth-child(1) { animation-delay: 0.05s; }
.stationery:nth-child(2) { animation-delay: 0.15s; }
.stationery:nth-child(3) { animation-delay: 0.25s; }
.stationery:nth-child(n+4) { animation-delay: 0.35s; }

.card-engraved {
  max-width: 640px;
  text-align: center;
  border: 1px solid rgba(60, 46, 26, 0.65);
  outline: 1px solid rgba(60, 46, 26, 0.35);
  outline-offset: 5px;
}
.script {
  font-family: 'Pinyon Script', cursive;
  font-weight: 400;
  color: var(--ink);
}
.card-engraved h1.script { font-size: clamp(2.6rem, 6vw, 3.8rem); margin: 0.3rem 0 0.4rem; }
.card-engraved h2.script { font-size: 2.1rem; margin: 0.2rem 0; }
.card-engraved .small-caps {
  font-family: 'IM Fell English SC', serif;
  letter-spacing: 0.22em;
  font-size: 0.95rem;
}
.card-engraved p { margin: 0.45rem 0; font-size: 1.08rem; }
.card-engraved .names { font-size: 1.14rem; line-height: 1.55; }
.card-engraved .card-rule { width: 30%; margin: 0.8rem auto; border: 0; border-top: 1px solid rgba(60,46,26,0.5); }

.wax-seal {
  position: absolute;
  right: 1.6rem; bottom: 1.4rem;
  width: 58px; height: 58px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #a5372a, #6f1f16 70%);
  box-shadow: inset 0 2px 5px rgba(255,255,255,0.25), inset 0 -3px 6px rgba(0,0,0,0.45), 0 2px 6px rgba(0,0,0,0.4);
}
.wax-seal::after {
  content: "A";
  position: absolute; inset: 0;
  display: grid; place-items: center;
  font-family: 'IM Fell English SC', serif;
  font-size: 1.5rem;
  color: rgba(255, 214, 200, 0.55);
  text-shadow: 0 -1px 1px rgba(0,0,0,0.5);
}

.clipping {
  max-width: 560px;
  background:
    linear-gradient(rgba(238, 230, 208, 0.94), rgba(230, 220, 194, 0.96)),
    url('assets/paper-light.jpg');
  background-size: cover;
  padding: 1.5rem 1.7rem;
  font-size: 1.02rem;
}
.clipping .clip-head {
  font-family: 'IM Fell English SC', serif;
  text-align: center;
  letter-spacing: 0.2em;
  border-top: 3px double var(--ink);
  border-bottom: 1px solid var(--ink);
  padding: 0.3rem 0;
  margin-bottom: 0.8rem;
  font-size: 1.05rem;
}
.clipping p { text-align: justify; hyphens: auto; margin-bottom: 0.6rem; }
.clipping .clip-src { font-style: italic; font-size: 0.85rem; color: var(--ink-faint); text-align: right; margin: 0; }

.almanac { max-width: 560px; }
.almanac .alm-row {
  display: flex;
  gap: 1rem;
  align-items: baseline;
  padding: 0.55rem 0;
  border-bottom: 1px dotted rgba(74,60,40,0.45);
}
.almanac .alm-row:last-child { border-bottom: 0; }
.almanac .alm-date {
  font-family: 'IM Fell English SC', serif;
  white-space: nowrap;
  min-width: 7.5rem;
  letter-spacing: 0.06em;
}
.almanac .alm-what { font-size: 1.05rem; }
.almanac .moon { font-size: 0.85rem; color: var(--ink-faint); font-style: italic; }

.memo {
  max-width: 520px;
  font-family: 'La Belle Aurore', cursive;
  font-size: 1.35rem;
  line-height: 1.5;
  color: var(--meg);
  transform: rotate(-1.2deg);
}
.memo ul { list-style: none; margin: 0.4rem 0 0; }
.memo li { margin: 0.35rem 0; }
.memo li::before { content: "— "; }
.memo .memo-head {
  font-size: 1.5rem;
  border-bottom: 1px solid rgba(88,56,27,0.35);
  padding-bottom: 0.25rem;
  margin-bottom: 0.5rem;
}
@media (max-width: 700px) {
  .stationery { padding: 1.5rem 1.2rem; }
}
