/* ============================================================
   Pat & Mena's Recipe Box — the whole look lives here.
   Aged-paper heirloom: warm cream, deckled page edges, restrained
   grain. Phone-first; desktop gets the two-page spread.
   ============================================================ */

/* tokens live in css/tokens.css */

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

html, body {
  height: 100%;
  overflow: hidden;
  font-family: var(--serif);
  color: var(--ink);
  /* the table: the runner itself lives on #cloth so its edges can feather */
  background: #e9e0cf;
  -webkit-text-size-adjust: 100%;
}

/* the couple's table runner, centered under the book, muted by a beige
   wash, its edges feathered so the fabric melts into the table */
#cloth {
  position: fixed;
  inset: -16px;
  z-index: 0;
  pointer-events: none;
  background:
    linear-gradient(rgba(238, 229, 213, 0.45), rgba(238, 229, 213, 0.45)),
    url("../images/tablecloth2.webp") center / cover no-repeat;
  -webkit-mask-image:
    linear-gradient(to right, transparent, #000 clamp(70px, 9vw, 140px), #000 calc(100% - clamp(70px, 9vw, 140px)), transparent),
    linear-gradient(to bottom, transparent, #000 clamp(60px, 9vh, 120px), #000 calc(100% - clamp(60px, 9vh, 120px)), transparent);
  -webkit-mask-composite: source-in;
  mask-image:
    linear-gradient(to right, transparent, #000 clamp(70px, 9vw, 140px), #000 calc(100% - clamp(70px, 9vw, 140px)), transparent),
    linear-gradient(to bottom, transparent, #000 clamp(60px, 9vh, 120px), #000 calc(100% - clamp(60px, 9vh, 120px)), transparent);
  mask-composite: intersect;
}
/* the tangerine runner won; the alternates stay reachable by URL.
   /?cloth=tangerine — the same runner under a heavier beige wash
   /?cloth=green     — the original green runner */
[data-cloth="tangerine"] #cloth {
  background:
    linear-gradient(rgba(238, 229, 213, 0.72), rgba(238, 229, 213, 0.72)),
    url("../images/tablecloth2.webp") center / cover no-repeat;
}
[data-cloth="green"] #cloth {
  background:
    linear-gradient(rgba(238, 229, 213, 0.72), rgba(238, 229, 213, 0.72)),
    url("../images/tablecloth.jpg?v=2") center / cover no-repeat;
}

#stage { z-index: 1; }

/* once the reader flips past the cover, the room dims: a lamp-like
   vignette settles over the table so the pages become the light source.
   sits above the cloth, below the book */
#stage::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(ellipse 74% 80% at 50% 46%,
    rgba(46, 34, 22, 0) 38%,
    rgba(46, 34, 22, 0.22) 64%,
    rgba(46, 34, 22, 0.5) 100%);
  opacity: 0;
  transition: opacity 0.9s ease;
}
html.-inside #stage::before { opacity: 1; }

#stage {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

#book-wrap { position: relative; }

/* ---------- pages ---------- */

.page {
  overflow: hidden;
  background: transparent;
}

/* the sheet of paper itself — deckle baked into an SVG image so it
   rasterizes once and stays cheap during flip animations */
.paper {
  position: absolute;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 400 560' preserveAspectRatio='none'%3E%3Cdefs%3E%3Cfilter id='d' x='-6%25' y='-6%25' width='112%25' height='112%25'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.09 0.14' numOctaves='3' seed='7'/%3E%3CfeDisplacementMap in='SourceGraphic' scale='9' xChannelSelector='R' yChannelSelector='G'/%3E%3C/filter%3E%3C/defs%3E%3Crect x='10' y='10' width='380' height='540' fill='%23f5efe8' filter='url(%23d)'/%3E%3C/svg%3E");
  background-size: 100% 100%;
}
/* soft shading toward the spine */
.shade {
  position: absolute;
  inset: 2.5%;
  background: linear-gradient(105deg, rgba(120, 90, 50, 0.06), rgba(120, 90, 50, 0) 14%);
  pointer-events: none;
}
.page.-left .shade {
  background: linear-gradient(255deg, rgba(120, 90, 50, 0.08), rgba(120, 90, 50, 0) 14%);
}

/* landscape spreads: the spine-side edge is cut flush (rect extends past
   the viewBox on that side), outer edges stay deckled */
.page.-left .paper {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 400 560' preserveAspectRatio='none'%3E%3Cdefs%3E%3Cfilter id='d' x='-6%25' y='-6%25' width='112%25' height='112%25'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.09 0.14' numOctaves='3' seed='7'/%3E%3CfeDisplacementMap in='SourceGraphic' scale='9' xChannelSelector='R' yChannelSelector='G'/%3E%3C/filter%3E%3C/defs%3E%3Crect x='10' y='10' width='400' height='540' fill='%23f5efe8' filter='url(%23d)'/%3E%3C/svg%3E");
}
.page.-right .paper {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 400 560' preserveAspectRatio='none'%3E%3Cdefs%3E%3Cfilter id='d' x='-6%25' y='-6%25' width='112%25' height='112%25'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.09 0.14' numOctaves='3' seed='7'/%3E%3CfeDisplacementMap in='SourceGraphic' scale='9' xChannelSelector='R' yChannelSelector='G'/%3E%3C/filter%3E%3C/defs%3E%3Crect x='-10' y='10' width='400' height='540' fill='%23f5efe8' filter='url(%23d)'/%3E%3C/svg%3E");
}

/* soft shadow grounding the book on the backdrop */
#book-wrap::before {
  content: "";
  position: absolute;
  inset: 4% 2.5%;
  background: rgba(84, 68, 50, 0.28);
  filter: blur(24px);
  border-radius: 12px;
  z-index: -1;
}

/* past the cover the cloth is busy: the shadow deepens and spreads into
   a pool of shade around the pages, so the type stays foremost */
#book-wrap.-inside::before {
  inset: -7% -10%;
  background: radial-gradient(closest-side,
    rgba(58, 44, 30, 0.5),
    rgba(58, 44, 30, 0.34) 58%,
    rgba(58, 44, 30, 0) 100%);
  filter: blur(14px);
}


/* restrained grain, over the paper only */
.grain {
  position: absolute;
  inset: 2.5%;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3CfeColorMatrix values='0 0 0 0 0.42 0 0 0 0 0.33 0 0 0 0 0.20 0 0 0 0.5 0'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)'/%3E%3C/svg%3E");
  opacity: 0.10;
  pointer-events: none;
}

.content {
  position: absolute;
  inset: 0;
  padding: 9% 10% 12%;
}

.pagefoot {
  position: absolute;
  bottom: 4.5%;
  left: 10%;
  right: 10%;
  display: flex;
  justify-content: space-between;
  font-size: 0.62rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

/* ---------- recipe typography ---------- */

.r-title {
  font-family: var(--display);
  font-size: 1.22rem;
  line-height: 1.2;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 0.3rem;
}
.r-title::after {
  content: "";
  display: block;
  width: 2.2rem;
  border-bottom: 1.5px solid var(--accent-soft);
  margin-top: 0.45rem;
  opacity: 0.65;
}

.r-credit {
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin: 0.55rem 0 0.1rem;
}
.r-creditnote {
  font-size: 0.78rem;
  font-style: italic;
  color: var(--ink-faint);
  margin-bottom: 0.2rem;
}

.r-memory {
  font-style: italic;
  font-size: 0.86rem;
  line-height: 1.45;
  color: var(--ink-soft);
  margin: 0.55rem 0 0.2rem;
  padding-left: 0.75rem;
  border-left: 2px solid rgba(142, 59, 42, 0.4);
}

.r-meta {
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  color: var(--ink-faint);
  margin-top: 0.5rem;
}

.r-heading {
  font-size: 0.74rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0.9rem 0 0.35rem;
}

.r-ing, .r-step, .r-text {
  font-size: 0.85rem;
  line-height: 1.42;
  margin-bottom: 0.28rem;
}

.r-ing {
  padding-left: 0.85rem;
  position: relative;
}
.r-ing::before {
  content: "·";
  position: absolute;
  left: 0.1rem;
  color: var(--accent-soft);
}

.r-step {
  padding-left: 1.5rem;
  position: relative;
}
.r-step .n {
  position: absolute;
  left: 0;
  top: 0;
  font-size: 0.72rem;
  font-style: italic;
  color: var(--accent-soft);
}

.r-text { font-style: italic; color: var(--ink-soft); }

.r-note {
  margin-top: 0.75rem;
  padding: 0.55rem 0.7rem;
  font-size: 0.78rem;
  line-height: 1.4;
  background: rgba(142, 59, 42, 0.05);
  border: 1px solid rgba(41, 41, 50, 0.25);
  border-radius: 1px;
}
.r-note .lbl {
  font-style: normal;
  font-size: 0.66rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  display: block;
  margin-bottom: 0.15rem;
}

.r-continued {
  font-size: 0.72rem;
  font-style: italic;
  color: var(--ink-faint);
  margin-bottom: 0.6rem;
}
.r-continued b { color: var(--ink-soft); font-weight: 600; }

/* ---------- cover ---------- */

.page.-cover .shade { display: none; }
.page.-cover .grain { opacity: 0.12; }
.cover-frame {
  position: absolute;
  inset: 4%;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 400 560' preserveAspectRatio='none'%3E%3Cdefs%3E%3Cfilter id='w' x='-4%25' y='-4%25' width='108%25' height='108%25'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.015 0.02' numOctaves='2' seed='11'/%3E%3CfeDisplacementMap in='SourceGraphic' scale='6' xChannelSelector='R' yChannelSelector='G'/%3E%3C/filter%3E%3C/defs%3E%3Cg fill='none' stroke='%23292932' filter='url(%23w)'%3E%3Crect x='16' y='16' width='368' height='528' stroke-width='1.8'/%3E%3Crect x='26' y='26' width='348' height='508' stroke-width='0.8'/%3E%3C/g%3E%3C/svg%3E");
  background-size: 100% 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: var(--ink);
  padding: 10%;
}
.cover-kicker {
  font-size: 0.62rem;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin-bottom: 1.3rem;
}
.cover-title {
  font-family: var(--display);
  font-size: 2.05rem;
  line-height: 1.15;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
.cover-amp { font-style: italic; font-weight: 400; text-transform: none; }
.cover-orn { margin: 1.2rem 0; color: var(--accent); }
.cover-sub {
  font-style: italic;
  font-size: 0.9rem;
  color: var(--ink-soft);
  max-width: 16em;
}
/* the occasion: a hairline, then marriage line, date and place all in
   the same quiet letterspaced caps */
.cover-occasion,
.cover-date {
  font-size: 0.58rem;
  letter-spacing: 0.17em;
  line-height: 1.7;
  text-transform: uppercase;
  color: var(--ink-faint);
  max-width: 22em;
}
.cover-occasion {
  margin-top: 1.5rem;
  max-width: 24em;
  text-wrap: balance;
}
.cover-occasion::before {
  content: "";
  display: block;
  width: 2.2rem;
  margin: 0 auto 0.8rem;
  border-bottom: 1px solid var(--accent-soft);
  opacity: 0.65;
}
.cover-date { margin-top: 0; }
.cover-place { display: block; }

/* ---------- dedication & dividers & colophon ---------- */

.center-page {
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}
.ded-heading {
  font-family: var(--display);
  font-size: 1.3rem;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 1rem;
  text-wrap: balance;   /* the box-plate heading runs to two lines */
}
.ded-body {
  font-style: italic;
  font-size: 0.84rem;
  line-height: 1.52;
  color: var(--ink-soft);
  max-width: 23em;
  margin-bottom: 0.7rem;
}
.ded-signoff {
  margin-top: 1rem;
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  color: var(--ink-faint);
}

.div-kicker {
  font-size: 0.64rem;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin-bottom: 0.9rem;
}
.div-title {
  font-family: var(--display);
  font-size: 1.35rem;
  line-height: 1.4;
  font-weight: 600;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--ink);
  max-width: 13em;
}
.div-orn { margin: 1.2rem 0; color: var(--accent); }
.div-list {
  font-style: italic;
  font-size: 0.8rem;
  line-height: 1.6;
  color: var(--ink-soft);
}
/* slot reserved for Anette's section illustrations */
.div-art { min-height: 12%; }

.colo-text {
  font-style: italic;
  font-size: 0.84rem;
  line-height: 1.65;
  color: var(--ink-soft);
  max-width: 20em;
  margin-bottom: 0.7rem;
}

/* ---------- index-card tabs on the book edges ---------- */

#book { position: relative; z-index: 1; }

#tabs {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}
.tab {
  position: absolute;
  pointer-events: auto;
  writing-mode: vertical-rl;
  text-orientation: mixed;
  box-sizing: border-box;
  width: 34px;
  padding: 13px 0;
  text-align: center;
  font-family: var(--serif);
  font-size: var(--fs-micro);
  letter-spacing: var(--track-tab);
  text-transform: uppercase;
  color: var(--tab-text);
  background: var(--tab-color, var(--accent));
  border: none;
  border-radius: 8px;
  box-shadow: 0 3px 9px rgba(60, 50, 40, 0.35);
  cursor: pointer;
  transition: left 0.65s ease-in-out, opacity 0.4s ease;
}
/* arch on the outer edge, like the site's Gothic windows */
.tab.-side-right { border-radius: 6px 17px 17px 6px; }
.tab.-side-left  { border-radius: 17px 6px 6px 17px; }
/* inset ivory keyline, like a printed index card */
.tab::before {
  content: "";
  position: absolute;
  inset: 3px;
  border: 1px solid rgba(245, 239, 232, 0.4);
  border-radius: inherit;
  pointer-events: none;
}
.tab.-hidden { opacity: 0; pointer-events: none; }
.tab.-active {
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
}
@media (max-aspect-ratio: 6/5) {
  .tab { width: 27px; font-size: 0.54rem; padding: 8px 0; letter-spacing: 0.1em; }
}

/* hint line under the book */
#hint {
  position: fixed;
  z-index: 30;
  left: 0; right: 0;
  text-align: center;
  font-size: 0.66rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(41, 41, 50, 0.55);
  pointer-events: none;
  transition: opacity 1s ease;
}
#hint { bottom: calc(12px + env(safe-area-inset-bottom)); }

/* offscreen measuring room for pagination */
#measure {
  position: absolute;
  left: -10000px;
  top: 0;
  visibility: hidden;
}


/* chapter medallion sits larger than inline ornaments */
.div-orn svg { width: 44px; height: 44px; }

/* ---------- artwork ---------- */

/* chapter sketches: multiply blends the white paper of the scan into the ivory page */
.div-art {
  height: 30%;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  margin-bottom: 0.7rem;
}
/* Anette's pencil illustrations: transparent spot art, floated naturally */
.div-art { height: 27%; flex-shrink: 0; margin-bottom: 0.5rem; }
.div-art img {
  max-height: 100%;
  max-width: 80%;
  object-fit: contain;
  mix-blend-mode: multiply;
}
/* crowded chapters (many recipes) trade the medallion for breathing room */
.center-page.-crowded .div-art { height: 21%; }
.center-page.-crowded .div-orn { display: none; }
.center-page.-crowded .div-title { margin-top: 0.2rem; }
.center-page.-crowded .div-list { font-size: 0.76rem; line-height: 1.5; }

/* ---------- index of recipes ---------- */

.idx-head { text-align: center; margin-bottom: 0.9rem; }
.idx-title {
  font-family: var(--display);
  font-size: 1.25rem;
  font-weight: 600;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--ink);
}
.idx-sec {
  font-size: 0.68rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0.8rem 0 0.3rem;
}
.idx-row {
  display: flex;
  align-items: baseline;
  gap: 0.45em;
  font-size: 0.85rem;
  line-height: 1.5;
  padding-bottom: 0.18rem;   /* padding, not margin: no dead gap between rows */
  cursor: pointer;
}
.idx-row .t { flex-shrink: 1; }
.idx-row .dots {
  flex: 1;
  border-bottom: 1px dotted var(--ink-faint);
  transform: translateY(-0.28em);
  min-width: 1.5em;
}
.idx-row .pg { color: var(--ink-soft); font-size: 0.78rem; }

/* ---------- marginalia (guest notes in handwriting) ---------- */

.r-marginalia {
  font-family: "Caveat", cursive;
  font-size: 1.12rem;
  line-height: 1.22;
  color: var(--hand-1);
  margin: 0.8rem 0 0.2rem;
  padding-left: 0.6rem;
}
/* scattered, hand-placed: each note leans and sits a little differently */
.r-marginalia.-v0 { transform: rotate(-2.1deg); width: 86%; margin-right: auto; }
.r-marginalia.-v1 { transform: rotate(1.7deg); width: 82%; margin-left: auto; margin-top: 1.1rem; color: var(--hand-2); font-size: 1.2rem; }
.r-marginalia.-v2 { transform: rotate(-0.7deg); width: 90%; margin: 1rem auto 0.2rem; color: var(--hand-3); }
.r-marginalia.-v3 { transform: rotate(2.4deg); width: 78%; margin-left: 10%; margin-top: 0.9rem; font-size: 1.04rem; color: var(--hand-4); }
.mn-made {
  display: inline-block;
  font-size: 0.9rem;
  color: var(--accent);
  border: 1px solid rgba(142, 59, 42, 0.5);
  border-radius: 999px;
  padding: 0 0.5em;
  transform: rotate(-2deg);
  margin-right: 0.25em;
}
.mn-sig { display: block; text-align: right; opacity: 0.8; font-size: 0.95rem; }

.r-notelink { margin-top: 0.8rem; }
.notelink {
  font-family: var(--serif);
  font-style: italic;
  font-size: 0.72rem;
  color: var(--ink-faint);
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  letter-spacing: 0.04em;
}
.notelink:hover { color: var(--accent); }

/* ---------- still-open page buttons ---------- */

.open-actions {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-top: 0.8rem;
  align-items: center;
}
.open-btn {
  display: inline-block;
  font-family: var(--serif);
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid rgba(41, 41, 50, 0.55);
  padding: 0.5em 1.15em;
  cursor: pointer;
  text-decoration: none;
}
.open-btn:hover { color: var(--accent); border-color: var(--accent); }

/* ---------- note modal ---------- */

#note-modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(41, 41, 50, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
#note-modal[hidden] { display: none; }
.nm-card {
  position: relative;
  width: min(420px, 100%);
  max-height: 90vh;
  overflow-y: auto;
  background: var(--paper);
  color: var(--ink);
  padding: 1.6rem 1.5rem 1.4rem;
  border: 1px solid rgba(41, 41, 50, 0.6);
  box-shadow: 0 12px 40px rgba(41, 41, 50, 0.35);
  font-family: var(--serif);
}
.nm-close {
  position: absolute;
  top: 0.4rem; right: 0.6rem;
  font-size: 1.4rem;
  background: none; border: none;
  color: var(--ink-faint);
  cursor: pointer;
}
.nm-heading {
  font-family: var(--display);
  font-size: 1.15rem;
  font-weight: 600;
  margin-bottom: 0.4rem;
}
.nm-sub { font-size: 0.8rem; font-style: italic; color: var(--ink-soft); margin-bottom: 1rem; }
.nm-hp { display: none; }
.nm-field { display: block; font-size: 0.72rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-soft); margin-bottom: 0.8rem; }
.nm-field input, .nm-field select, .nm-field textarea {
  display: block;
  width: 100%;
  margin-top: 0.3rem;
  font-family: var(--serif);
  font-size: 0.95rem;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.5);
  border: 1px solid rgba(41, 41, 50, 0.4);
  padding: 0.45em 0.6em;
  box-sizing: border-box;
}
.nm-checkline { display: block; font-size: 0.85rem; margin-bottom: 0.8rem; }
.nm-submit { width: 100%; margin-top: 0.2rem; }
#note-thanks { font-style: italic; font-size: 0.95rem; padding: 1rem 0 0.4rem; }

/* ---------- print: the whole book as linear pages ---------- */

#print-book { display: none; }

@media print {
  #stage, #tabs, #hint, #note-modal, #measure { display: none !important; }
  body::before, body::after { display: none !important; }
  html, body { overflow: visible; height: auto; background: white; }
  #print-book { display: block; }
  .print-page {
    page-break-after: always;
    padding: 12mm 14mm;
    position: relative;
    min-height: 90vh;
  }
  .print-page .cover-frame { position: static; background: none; border: 2px double var(--ink); padding: 24mm 10mm; }
  .print-page .center-page { height: auto; }
  .print-page .div-art { height: auto; }
  .print-page .div-art img { max-height: 220px; }
  .print-foot {
    margin-top: 8mm;
    font-size: 8pt;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--ink-faint);
    text-align: center;
  }
  .r-notelink { display: none; }
}

/* focus ring only for keyboard navigation, not lingering after taps */
.tab:focus:not(:focus-visible) { outline: none; }
.tab:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }


/* chapter divider lists are tappable */
.div-item { display: block; cursor: pointer; }
.div-item:hover { color: var(--accent); }

/* cover/back page sit alone on half the spread: shadow follows the paper */
#book-wrap.-half-right::before { inset: 4% 2.5% 4% 51%; }
#book-wrap.-half-left::before  { inset: 4% 51% 4% 2.5%; }

/* ---------- the still-open guestbook, flowing across pages ---------- */

.so-heading {
  font-family: var(--display);
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--ink);
  text-align: center;
  margin: 0.3rem 0 0.6rem;
}
.so-body {
  font-style: italic;
  font-size: 0.8rem;
  line-height: 1.45;
  color: var(--ink-soft);
  max-width: 23em;
  margin: 0 auto 0.55rem;
  text-align: center;
}
.so-notes-head {
  font-size: 0.7rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--accent);
  text-align: center;
  margin: 1.4rem 0 0.7rem;
}

/* ============================================================
   FULL EDITIONS — /?edition=artbook | almanac | modern
   Each is palette + type + recipe-page layout. Shared pieces first.
   ============================================================ */

.r-split { display: grid; grid-template-columns: 38% 1fr; gap: 1.1rem; margin-top: 0.9rem; align-items: start; }
.r-col-ing .r-heading:first-child, .r-col-steps .r-heading:first-child { margin-top: 0; }
.r-metaline { font-size: 0.62rem; letter-spacing: 0.2em; text-transform: uppercase; color: var(--ink-soft); }
.r-metaline .sep { margin: 0 0.55em; opacity: 0.5; }
.r-rule { border-top: 1px solid var(--ink); margin: 0.5rem 0; }
.r-ing-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.05rem 0.9rem; }

/* ---------- ART BOOK: Inscription layout, Ink & Stone palette ---------- */
[data-edition="artbook"] {
  --display: "Italiana", "Playfair Display", serif;
  --serif: "Cormorant Garamond", "Iowan Old Style", Georgia, serif;
  --fs-body: 0.93rem;
  --fs-quote: 0.95rem;
  --fs-label: 0.7rem;
  --fs-title: 1.18rem;
}
[data-edition="artbook"] .r-title {
  font-weight: 400;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  line-height: 1.25;
}
[data-edition="artbook"] .r-title::after { display: none; }
[data-edition="artbook"] .r-metaline { margin-top: 0.5rem; font-size: 0.6rem; letter-spacing: 0.22em; }
[data-edition="artbook"] .r-heading { letter-spacing: 0.24em; font-size: 0.66rem; margin: 0.2rem 0 0.6rem; }
[data-edition="artbook"] .r-ing { padding-left: 0; letter-spacing: 0.03em; line-height: 1.45; margin-bottom: 0.42rem; }
[data-edition="artbook"] .r-ing::before { display: none; }
[data-edition="artbook"] .r-step { padding-left: 0; letter-spacing: 0.02em; margin-bottom: 0.6rem; }
[data-edition="artbook"] .r-step .n { display: none; }
[data-edition="artbook"] .r-memory { border-left: none; padding-left: 0; letter-spacing: 0.02em; }
[data-edition="artbook"] .r-continued { letter-spacing: 0.12em; text-transform: uppercase; font-style: normal; font-size: 0.6rem; }
[data-edition="artbook"] .r-continued b { font-weight: 400; }
[data-edition="artbook"] .cover-title { font-weight: 400; letter-spacing: 0.18em; font-size: 1.9rem; }
[data-edition="artbook"] .div-title { font-weight: 400; letter-spacing: 0.2em; }
[data-edition="artbook"] .idx-title, [data-edition="artbook"] .so-heading, [data-edition="artbook"] .ded-heading { font-weight: 400; letter-spacing: 0.14em; text-transform: uppercase; font-size: 1.15rem; }
[data-edition="artbook"] .tab { font-family: var(--serif); letter-spacing: 0.2em; }

/* ---------- ALMANAC: 1920s cookbook layout, Aged Tracery palette ---------- */
[data-edition="almanac"] {
  --display: "Libre Caslon Text", "Playfair Display", serif;
  --serif: "Libre Caslon Text", "Iowan Old Style", Georgia, serif;
  --fs-body: 0.8rem;
  --fs-title: 1.08rem;
}
[data-edition="almanac"] .r-band {
  font-size: 0.58rem; letter-spacing: 0.34em; text-transform: uppercase; text-align: center;
  padding: 0.35rem 0; margin-bottom: 1.1rem;
  border-top: 1.5px solid var(--ink); border-bottom: 1.5px solid var(--ink);
  box-shadow: 0 3px 0 -1.5px var(--ink), 0 -3px 0 -1.5px var(--ink);
}
[data-edition="almanac"] .r-title { font-weight: 700; text-align: center; }
[data-edition="almanac"] .r-title::after { margin: 0.45rem auto 0; }
[data-edition="almanac"] .r-credit, [data-edition="almanac"] .r-creditnote { text-align: center; }
[data-edition="almanac"] .r-memory { border-left: none; padding: 0 0.5rem; text-align: center; }
[data-edition="almanac"] .r-heading { text-align: center; color: var(--ink-soft); letter-spacing: 0.26em; font-size: 0.62rem; margin: 0.7rem 0 0.3rem; }
[data-edition="almanac"] .r-ing { padding-left: 0; font-size: 0.78rem; line-height: 1.35; margin-bottom: 0.15rem; }
[data-edition="almanac"] .r-ing-list .r-ing { margin-bottom: 0.2rem; }
/* two independent typeset columns, balanced, read top-to-bottom */
[data-edition="almanac"] .r-ing-cols { columns: 2; column-gap: 1.1rem; column-fill: balance; }
[data-edition="almanac"] .r-ing-cols .r-ing { break-inside: avoid; }
[data-edition="almanac"] .r-ing::before { display: none; }
[data-edition="almanac"] .r-step { padding-left: 0; text-align: justify; hyphens: auto; margin-bottom: 0.45rem; line-height: 1.45; }
[data-edition="almanac"] .r-step .n { display: none; }
[data-edition="almanac"] .r-meta { text-align: center; font-style: italic; letter-spacing: 0; }
[data-edition="almanac"] .r-note { border-style: solid; border-width: 1px 0; border-radius: 0; background: none; padding: 0.5rem 0; }
[data-edition="almanac"] .pagefoot { justify-content: center; }
[data-edition="almanac"] .pagefoot span:first-child { display: none; }
[data-edition="almanac"] .cover-title { font-weight: 700; letter-spacing: 0.1em; }
[data-edition="almanac"] .div-title { font-weight: 700; }

/* ---------- MODERN COOKBOOK: Card layout, Sketchbook palette ---------- */
[data-edition="modern"] {
  --display: "Fraunces", "Playfair Display", serif;
  --serif: "EB Garamond", "Iowan Old Style", Georgia, serif;
  --sans: "Manrope", "Helvetica Neue", Arial, sans-serif;
  --fs-body: 0.88rem;
  --fs-title: 1.28rem;
}
[data-edition="modern"] .r-title { text-align: center; font-weight: 600; }
[data-edition="modern"] .r-title::after { display: none; }
[data-edition="modern"] .r-rule { margin: 0.55rem 0 0; }
[data-edition="modern"] .r-rule + .r-metaline { padding: 0.4rem 0; text-align: center; }
[data-edition="modern"] .r-metaline { font-family: var(--sans); font-size: 0.56rem; letter-spacing: 0.16em; }
[data-edition="modern"] .r-split { grid-template-columns: 40% 1fr; gap: 0.9rem; margin-top: 0.8rem; }
[data-edition="modern"] .r-col-ing { background: rgba(217, 166, 131, 0.22); padding: 0.6rem 0.65rem; }
[data-edition="modern"] .r-heading { font-family: var(--sans); font-size: 0.56rem; letter-spacing: 0.18em; font-weight: 600; color: var(--ink); margin: 0.6rem 0 0.4rem; }
[data-edition="modern"] .r-ing { padding-left: 0; line-height: 1.4; margin-bottom: 0.3rem; }
[data-edition="modern"] .r-ing::before { display: none; }
[data-edition="modern"] .r-step { padding-left: 1.35rem; line-height: 1.45; margin-bottom: 0.4rem; }
[data-edition="modern"] .r-step .n { font-family: var(--sans); font-style: normal; font-weight: 600; font-size: 0.66rem; top: 0.1rem; color: var(--accent); }
[data-edition="modern"] .r-memory { text-align: center; border-left: none; padding: 0; }
[data-edition="modern"] .r-note { border: none; border-top: 1px dashed rgba(41,41,50,0.35); border-radius: 0; background: none; padding: 0.55rem 0 0; font-style: italic; }
[data-edition="modern"] .r-note .lbl { font-family: var(--sans); }
[data-edition="modern"] .r-credit, [data-edition="modern"] .idx-sec, [data-edition="modern"] .div-kicker, [data-edition="modern"] .cover-kicker, [data-edition="modern"] .cover-date, [data-edition="modern"] .pagefoot, [data-edition="modern"] .so-notes-head { font-family: var(--sans); }
[data-edition="modern"] .tab { font-family: var(--sans); font-weight: 600; letter-spacing: 0.14em; }
[data-edition="modern"] .idx-row .pg { font-family: var(--sans); font-size: 0.66rem; }
@media (max-aspect-ratio: 6/5) {
  [data-edition="modern"] .r-split { grid-template-columns: 1fr; }
  [data-edition="artbook"] .r-split { grid-template-columns: 42% 1fr; gap: 0.8rem; }
}


/* cover + guestbook illustrations */
.cover-art { height: 30%; margin: 0.9rem 0 0.4rem; display: flex; align-items: center; justify-content: center; }
.cover-art img { max-height: 100%; max-width: 78%; object-fit: contain; mix-blend-mode: multiply; }
.so-art { height: 11%; display: flex; align-items: flex-end; justify-content: center; margin-bottom: 0.5rem; }
.so-art img { max-height: 100%; max-width: 82%; object-fit: contain; mix-blend-mode: multiply; }


/* chapter pages carry a faint hand-inked frame — kin to the cover's */
.page-frame {
  position: absolute;
  inset: 5%;
  pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 400 560' preserveAspectRatio='none'%3E%3Cdefs%3E%3Cfilter id='w' x='-4%25' y='-4%25' width='108%25' height='108%25'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.015 0.02' numOctaves='2' seed='23'/%3E%3CfeDisplacementMap in='SourceGraphic' scale='5' xChannelSelector='R' yChannelSelector='G'/%3E%3C/filter%3E%3C/defs%3E%3Cg fill='none' stroke='%23292932' opacity='0.55' filter='url(%23w)'%3E%3Crect x='12' y='12' width='376' height='536' stroke-width='1.1'/%3E%3Crect x='20' y='20' width='360' height='520' stroke-width='0.5'/%3E%3C/g%3E%3C/svg%3E");
  background-size: 100% 100%;
}
.div-list { margin-top: 1.1rem; }

/* ============================================================
   THEIR TABLE (?theme=home) — the full scene: Pat & Mena's real
   oak table, their rose linen runner as a band across the middle
   (the book overlaps onto wood, as things on their table do),
   and cross-stitch chapter frames from their placemats.
   ============================================================ */

html[data-theme="home"], html[data-theme="home"] body {
  background:
    linear-gradient(rgba(240, 229, 215, 0.5), rgba(240, 229, 215, 0.5)),
    url("../images/home/oak.jpg?v=3") center / cover no-repeat,
    #6f4d2e;
}
html[data-theme="home"] #cloth {
  inset: auto -24px;
  top: 50%;
  transform: translateY(-50%);
  height: 60%;
  -webkit-mask-image:
    linear-gradient(to right, transparent, #000 60px, #000 calc(100% - 60px), transparent),
    linear-gradient(to bottom, transparent, #000 34px, #000 calc(100% - 34px), transparent);
  mask-image:
    linear-gradient(to right, transparent, #000 60px, #000 calc(100% - 60px), transparent),
    linear-gradient(to bottom, transparent, #000 34px, #000 calc(100% - 34px), transparent);
  background:
    linear-gradient(rgba(238, 226, 215, 0.26), rgba(238, 226, 215, 0.26)),
    url("../images/home/linen.jpg?v=2") center / cover no-repeat;
}
@media (max-aspect-ratio: 6/5) {
  html[data-theme="home"] #cloth { height: 52%; }
}
/* chapter frames become cross-stitch, like their placemat borders */
html[data-theme="home"] .page-frame {
  background-image: none;
  border: 9px solid transparent;
  border-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 66 66'%3E%3Cg stroke='%235c6c8a' stroke-width='2.4' stroke-linecap='round' opacity='0.75'%3E%3Cpath d='M6 6 L16 16 M16 6 L6 16'/%3E%3Cpath d='M28 6 L38 16 M38 6 L28 16'/%3E%3Cpath d='M50 6 L60 16 M60 6 L50 16'/%3E%3Cpath d='M6 28 L16 38 M16 28 L6 38'/%3E%3Cpath d='M6 50 L16 60 M16 50 L6 60'/%3E%3Cpath d='M28 50 L38 60 M38 50 L28 60'/%3E%3Cpath d='M50 50 L60 60 M60 50 L50 60'/%3E%3Cpath d='M50 28 L60 38 M60 28 L50 38'/%3E%3C/g%3E%3C/svg%3E") 22 round;
}


/* ---- Their Table: the stitched language, everywhere ---- */

/* the cover joins the cross-stitch (same tile as chapter frames) */
html[data-theme="home"] .cover-frame {
  background-image: none;
  border: 9px solid transparent;
  border-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 66 66'%3E%3Cg stroke='%235c6c8a' stroke-width='2.4' stroke-linecap='round' opacity='0.75'%3E%3Cpath d='M6 6 L16 16 M16 6 L6 16'/%3E%3Cpath d='M28 6 L38 16 M38 6 L28 16'/%3E%3Cpath d='M50 6 L60 16 M60 6 L50 16'/%3E%3Cpath d='M6 28 L16 38 M16 28 L6 38'/%3E%3Cpath d='M6 50 L16 60 M16 50 L6 60'/%3E%3Cpath d='M28 50 L38 60 M38 50 L28 60'/%3E%3Cpath d='M50 50 L60 60 M60 50 L50 60'/%3E%3Cpath d='M50 28 L60 38 M60 28 L50 38'/%3E%3C/g%3E%3C/svg%3E") 22 round;
}
/* running-stitch instead of solid rules */
html[data-theme="home"] .r-title::after { border-bottom-style: dashed; }
html[data-theme="home"] .r-memory { border-left-style: dashed; }
html[data-theme="home"] .r-note { border-style: dashed; border-color: rgba(92, 108, 138, 0.5); }
html[data-theme="home"] .r-rule { border-top-style: dashed; }
html[data-theme="home"] .idx-row .dots { border-bottom-style: dashed; }
/* tabs read as embroidered fabric labels: stitched keyline */
html[data-theme="home"] .tab::before { border-style: dashed; border-color: rgba(245, 239, 232, 0.55); }
html[data-theme="home"] .tab.-active { text-decoration-style: dashed; }


/* the dedication reads as a letter: body, signature in her hand, postscript */
.ded-sign {
  font-family: var(--hand);
  font-size: 1.4rem;
  line-height: 1.1;
  color: var(--hand-2);
  margin: 0.5rem 0 0;
  transform: rotate(-1.4deg);
}
.ded-orn { margin: 1rem 0 0.6rem; color: var(--accent-soft); opacity: 0.75; }
.ded-thanks {
  font-size: 0.72rem;
  line-height: 1.55;
  color: var(--ink-faint);
  max-width: 21em;
  text-wrap: balance;
}


/* the recipe box, shown as photographs tipped into the page */
.box-note {
  font-style: italic;
  font-size: 0.8rem;
  color: var(--ink-soft);
  margin-bottom: 1rem;
}
.box-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.85rem 0.8rem;
  width: 100%;
}
.box-plate {
  background: #fbf7f1;
  padding: 4px;
  box-shadow: 0 3px 9px rgba(60, 50, 40, 0.3);
}
.box-plate img {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
}
.box-plate:nth-child(1) { transform: rotate(-1.5deg); }
.box-plate:nth-child(2) { transform: rotate(1.1deg); }
.box-plate:nth-child(3) { transform: rotate(0.8deg); }
.box-plate:nth-child(4) { transform: rotate(-1.2deg); }
.box-caption {
  font-style: italic;
  font-size: 0.74rem;
  line-height: 1.5;
  color: var(--ink-faint);
  max-width: 22em;
  margin-top: 1.1rem;
}


/* the plate page wears album corners, not the cover's double rule */
.plate-frame {
  position: absolute;
  inset: 5.5%;
  pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 400 560' preserveAspectRatio='none'%3E%3Cdefs%3E%3Cfilter id='w' x='-4%25' y='-4%25' width='108%25' height='108%25'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.02 0.025' numOctaves='2' seed='31'/%3E%3CfeDisplacementMap in='SourceGraphic' scale='4' xChannelSelector='R' yChannelSelector='G'/%3E%3C/filter%3E%3C/defs%3E%3Cg fill='none' stroke='%23292932' stroke-width='1.6' opacity='0.6' filter='url(%23w)'%3E%3Cpath d='M6 66 L6 6 L66 6'/%3E%3Cpath d='M334 6 L394 6 L394 66'/%3E%3Cpath d='M394 494 L394 554 L334 554'/%3E%3Cpath d='M66 554 L6 554 L6 494'/%3E%3C/g%3E%3C/svg%3E");
  background-size: 100% 100%;
}
.box-caption { text-wrap: balance; }
