/* ==========================================================================
   Adventure print / export ("ship-to-play") — a flowing multi-page document.

   The CHROME isolation + pagination is reused from character-sheet-page.css:
   the print view mounts a `.csp2-page.csp2-native.csp2-multipage`, which that
   file's `@media print` rules turn into an absolutely-positioned, height-auto,
   overflow-visible page that paginates in normal flow (all three classes are
   required or content clamps to one page). This file is ONLY the `.advp-doc`
   typography skin — an adventure is a text document, not a fixed-form sheet, so
   it uses ordinary pt-based print typography (not the `.swd6-sheet` cqw system).
   ========================================================================== */

.advp-doc {
  background: #ffffff;
  color: #211c14;
  font-family: 'Source Serif 4', 'Iowan Old Style', Georgia, serif;
  font-size: 10pt;
  line-height: 1.4;
  padding: 0.6in;
  max-width: 8.5in;
  margin: 0 auto;
  /* Classic two-column module layout: body flows in two columns; full-width
     bands (title, section headers, map figures) break out via column-span. */
  column-count: 2;
  column-gap: 0.35in;
  column-rule: 1px solid #cdc4b1;
  overflow-wrap: break-word;
}

/* On screen the .csp2-page sits on the app's dark background — give the print
   doc an explicit white sheet so it reads like paper before printing. */
.csp2-page:has(.advp-doc) {
  background: #ffffff;
}

/* --- title block (full-width band) --- */
.advp-title {
  column-span: all;
  border-bottom: 2px solid #211c14;
  padding-bottom: 0.5rem;
  margin-bottom: 1rem;
}
.advp-doc-title {
  font-size: 24pt;
  margin: 0 0 0.25rem;
  color: #211c14;
}
.advp-doc-meta {
  font-size: 9pt;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #6f6655;
  margin-bottom: 0.5rem;
}
.advp-cover {
  max-width: 100%;
  max-height: 3.5in;
  display: block;
  margin: 0.5rem 0;
}

/* --- sections --- */
/* Continuous column flow — sections pack together; only map sections force a
   fresh page (via .advp-break), so a keyed dungeon map starts clean. */
.advp-section {
  margin-top: 0.75rem;
}
.advp-section.advp-break {
  break-before: page;
}
/* Full-width section header, then the body flows beneath it in two columns —
   the signature module look. */
.advp-section-heading {
  column-span: all;
  font-size: 14pt;
  color: #211c14;
  border-bottom: 1px solid #a99f88;
  padding-bottom: 0.15rem;
  margin: 0.25rem 0 0.5rem;
  break-after: avoid;
}

/* --- entries --- */
.advp-entry {
  margin-bottom: 0.85rem;
}
.advp-entry-title {
  font-size: 12pt;
  margin: 0 0 0.15rem;
  color: #211c14;
}
.advp-prose {
  margin: 0.25rem 0;
  white-space: pre-wrap;
}
.advp-read-aloud {
  border-left: 3px solid #a99f88;
  background: #f4f1ea;
  padding: 0.35rem 0.6rem;
  margin: 0.35rem 0;
  font-style: italic;
}
.advp-gm-note {
  background: #ece7db;
  padding: 0.3rem 0.5rem;
  margin: 0.35rem 0;
  font-size: 10pt;
}
.advp-gm-label {
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: #6f6655;
}

/* --- [[ ]] cross-refs --- */
.advp-ref {
  font-variant: small-caps;
  font-weight: 600;
}
.advp-ref-area {
  font-variant: normal;
  font-weight: 400;
  color: #6f6655;
}

/* --- keyed map sections --- */
/* The band spans both columns; the figure stays inline-block so it hugs the
   image and the absolutely-positioned markers align to the image (not the
   full-width band). */
.advp-map-band {
  column-span: all;
  text-align: center;
  margin: 0.5rem 0;
}
.advp-map-figure {
  position: relative;
  display: inline-block;
  max-width: 100%;
  text-align: left;
}
.advp-map-img {
  max-width: 100%;
  max-height: 7in;
  display: block;
}
.advp-map-marker {
  position: absolute;
  transform: translate(-50%, -50%);
  min-width: 1.5em;
  height: 1.5em;
  padding: 0 0.25em;
  box-sizing: border-box;
  background: #e63946;
  color: #ffffff;
  border: 1.5px solid #ffffff;
  border-radius: 999px;
  font-size: 9pt;
  font-weight: 700;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  print-color-adjust: exact;
  -webkit-print-color-adjust: exact;
}
.advp-key {
  margin: 0.5rem 0 0.75rem;
}
.advp-key-heading {
  font-size: 12pt;
  margin: 0.5rem 0 0.25rem;
  color: #211c14;
}
.advp-key-list {
  list-style: none;
  padding: 0;
  margin: 0;
}
.advp-key-row {
  display: flex;
  gap: 0.4rem;
  padding: 0.1rem 0;
}
.advp-key-num {
  font-weight: 700;
  min-width: 1.8rem;
  text-align: right;
}

/* --- random tables --- */
.advp-die {
  font-size: 10pt;
  color: #6f6655;
  font-weight: 400;
}
.advp-table {
  border-collapse: collapse;
  width: 100%;
  font-size: 10pt;
  margin: 0.25rem 0;
}
.advp-table td {
  border: 1px solid #cdc4b1;
  padding: 0.2rem 0.4rem;
  vertical-align: top;
}
.advp-table-range {
  white-space: nowrap;
  width: 3.5rem;
  font-weight: 600;
}

/* --- NPC information block (Content Generators Phase 2.7) ---
   Lewis's compact block, printed as a bullet under whatever names the NPC —
   a room description, a keyed map pin. Deliberately tight and unboxed: it is
   ~38 words meant to be read at a glance mid-scene, not a stat block. Kept
   with its parent entry across a page break so a room never prints without
   the people in it. */
.advp-npc-briefs {
  margin: 0.3rem 0 0.2rem;
  padding-left: 1rem;
  list-style: disc;
}
.advp-npc-brief {
  font-size: 10pt;
  line-height: 1.35;
  margin-bottom: 0.15rem;
  break-inside: avoid;
  page-break-inside: avoid;
}

/* --- stat blocks --- */
.advp-statblock-wrap {
  margin: 0.35rem 0;
}
.advp-statblock-system {
  margin: 0.35rem 0;
}
.advp-statblock-sys {
  font-size: 10pt;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: #6f6655;
  margin: 0.25rem 0 0.15rem;
}
.advp-statblock {
  border-collapse: collapse;
  width: 100%;
  font-size: 10pt;
  background: #faf8f2;
}
.advp-statblock td {
  border: 1px solid #cdc4b1;
  padding: 0.15rem 0.4rem;
  vertical-align: top;
}
.advp-statblock-key {
  font-weight: 600;
  width: 40%;
  color: #211c14;
}

/* --- print-only page-break control --- */
@media print {
  .advp-doc {
    padding: 0.5in;
    max-width: none;
  }
  .advp-read-aloud,
  .advp-statblock,
  .advp-table,
  /* the map figure MUST stay whole — its numbered markers are absolutely
     positioned relative to it, so a page break would detach them */
  .advp-map-figure {
    break-inside: avoid;
  }
  /* keep an entry's heading with the start of its body, but let a long entry
     (stat block + prose) still break rather than force a huge gap */
  .advp-entry {
    break-inside: auto;
  }
  .advp-entry-title,
  .advp-key-heading {
    break-after: avoid;
  }
  .advp-table tr,
  .advp-statblock tr {
    break-inside: avoid;
  }
  p {
    orphans: 3;
    widows: 3;
  }
}
