/* =====================================================================
   PAPER PACK — the shared print-sheet stylesheet for /print/ (the collected
   daily printout). Follows the conventions already refined on the two
   existing printed surfaces so the pack reads as one family:

     • /zip-mate/print  (functions/_render.js chessPrintDoc, the `zp-*` sheet)
       → white sheet, 2px rule under a brand/date head, 2px rule above a
         two-column foot, centered goal line.
     • the Morning Mystery print sheets (games/morning-mystery, `ps-*`)
       → serif body on paper, hard 1px table rules, page-break-after per sheet.

   NAMESPACE: every rule is `.pk-*` (Paper Kit) so nothing here can collide
   with feed.css / post.css, which this page also loads for the site shell.

   PRINT MODEL: on screen the sheets stack as bordered cards inside .pk-page.
   In print, everything except .pk-sheets is display:none and each .pk-sheet
   takes its own page. `?render=` (see functions/_pack.js) stamps
   body.pk-render, which applies the SAME hiding on SCREEN — that's the mode
   headless Chrome captures for the nightly PDF (mirrors MM's body.print-render).
   ===================================================================== */

/* ---- screen chrome: the intro / actions above the sheets ---- */
.pk-intro { max-width: 680px; margin: 1.5rem auto 0; padding: 0 1rem; text-align: center; }
.pk-intro .kicker { display: block; margin-bottom: .35rem; }
.pk-intro h1 { margin: .2rem 0 .5rem; }
.pk-intro p { margin: .6rem 0; }
.pk-actions { display: flex; flex-wrap: wrap; gap: .6rem; justify-content: center; margin: 1rem 0 .4rem; }
.pk-btn {
  font: inherit; font-weight: 600; cursor: pointer; padding: .55em 1.4em;
  border-radius: .5em; border: 1px solid currentColor; background: #8e1d1d; color: #fff;
  text-decoration: none; display: inline-block;
}
.pk-btn:hover { filter: brightness(1.12); }
.pk-btn.secondary { background: transparent; color: inherit; opacity: .9; }
.pk-btn[disabled] { opacity: .5; cursor: default; filter: none; }
.pk-note { font-size: .88em; opacity: .8; margin: .5rem 0 0; }
/* LINKS. This sheet had NO link rule at all, so every anchor on the page fell
   back to the browser's default blue — on the dark theme that is nearly
   unreadable, and the owner flagged it as such. Crimson matches the rest of the
   site and is legible on both themes; the underline is always on (these sit
   inside body copy, where colour alone is not a sufficient affordance). */
.pk-intro a, .pk-note a, .pk-pdf-list a {
  color: var(--crimson, #a31621); text-decoration: underline;
  text-underline-offset: .18em; text-decoration-thickness: 1px;
}
.pk-intro a:hover, .pk-note a:hover, .pk-pdf-list a:hover { text-decoration-thickness: 2px; }
.pk-intro a:focus-visible, .pk-note a:focus-visible, .pk-pdf-list a:focus-visible {
  outline: 2px solid var(--crimson, #a31621); outline-offset: 2px; border-radius: 2px;
}

/* READY-MADE PDF list — the fast path, above the sheets. A panel rather than a
   bare list: it is the thing most people on a page called "on paper" actually
   want, and it must not read as a footnote to the print button. */
.pk-pdfs {
  max-width: 520px; margin: 1rem auto .2rem; padding: .8rem 1rem;
  border: 1px solid color-mix(in srgb, var(--gold, #a9802f) 55%, transparent);
  background: color-mix(in srgb, var(--gold, #a9802f) 8%, transparent);
  border-radius: .6rem; text-align: left;
}
.pk-pdfs-head { margin: 0 0 .45rem; font-size: .92em; font-weight: 600; }
.pk-pdf-list { margin: 0; padding-left: 1.1rem; }
.pk-pdf-list li { margin: .22rem 0; font-size: .95em; }
.pk-pdf-tag {
  font-size: .78em; text-transform: uppercase; letter-spacing: .04em;
  opacity: .75; margin-left: .3em;
}
/* live status line for the in-browser logic-puzzle build (feed/pack-logic.js) */
.pk-status { font-size: .9em; margin: .8rem 0 0; min-height: 1.3em; }
.pk-status.err { color: #b3261e; font-weight: 600; }

/* ---- contents list: what's in today's pack ---- */
.pk-toc { list-style: none; margin: 1rem auto 0; padding: 0; max-width: 460px; text-align: left; font-size: .95em; }
.pk-toc li { display: flex; gap: .6rem; align-items: baseline; padding: .28rem 0; border-bottom: 1px solid rgba(128,110,90,.28); }
.pk-toc li:last-child { border-bottom: 0; }
.pk-toc .n { opacity: .55; font-variant-numeric: tabular-nums; min-width: 1.4em; }
.pk-toc .miss { opacity: .55; font-style: italic; }

/* ---- the sheet itself ---- */
.pk-sheets { margin: 1.6rem auto 3rem; }
.pk-sheet {
  max-width: 680px; margin: 0 auto 1.6rem; padding: 1.4rem 1.6rem;
  border: 1px solid rgba(128,110,90,.45); border-radius: .6rem;
  background: #fff; color: #1c1713;
  font-family: Georgia, "Times New Roman", serif; line-height: 1.5;
}
.pk-head {
  display: flex; justify-content: space-between; align-items: baseline; gap: 1rem;
  border-bottom: 2px solid #1c1713; padding-bottom: .4rem; margin-bottom: .9rem;
}
.pk-brand { font-weight: 700; letter-spacing: .04em; font-size: .95em; }
.pk-date { font-size: .85em; opacity: .75; }
.pk-title { font-size: 1.5em; margin: .1rem 0 .2rem; text-align: center; font-weight: 700; }
.pk-goal { text-align: center; font-size: 1.05em; font-weight: 700; margin: .5rem 0 .2rem; }
.pk-meta { text-align: center; font-size: .85em; opacity: .8; margin: 0 0 .9rem; }
.pk-h2 {
  font-size: 1em; margin: 1.1rem 0 .5rem; border-bottom: 1px solid #bbb;
  padding-bottom: .2rem; letter-spacing: .04em; text-transform: uppercase;
}
.pk-foot {
  margin-top: 1.2rem; display: flex; justify-content: space-between; gap: 1rem;
  font-size: .78em; opacity: .7; border-top: 2px solid #1c1713; padding-top: .4rem;
}
.pk-empty { text-align: center; font-style: italic; opacity: .75; padding: 1.5rem 0; }

/* ---- WORD FINDER: letter grid + blanked quote + word list ---- */
.pk-wf-grid { border-collapse: collapse; margin: .6rem auto .9rem; }
/* sized so a pen fits: these squares get written in, not just read */
.pk-wf-grid td {
  border: 1px solid #ccc; width: 1.8em; height: 1.8em; text-align: center;
  font-family: "Courier New", Courier, monospace; font-size: 1.05em; letter-spacing: .04em;
}
/* answer key: the placed letters ring out of the filler */
.pk-wf-grid td.hit { font-weight: 700; border: 1px solid #1c1713; background: #e9e2d2; }
.pk-quote { font-size: 1.02em; line-height: 1.75; margin: .8rem 0 .4rem; text-align: center; }
.pk-quote .blank { font-family: "Courier New", Courier, monospace; letter-spacing: .06em; }
.pk-attrib { text-align: center; font-size: .88em; opacity: .8; margin: 0 0 .6rem; }
.pk-words { columns: 2; column-gap: 2rem; list-style: none; padding: 0; margin: .4rem 0 0; font-size: .95em; }
.pk-words li { break-inside: avoid; padding: .16rem 0; letter-spacing: .06em; text-transform: uppercase; }

/* ---- MINI CROSSWORD: numbered blocked grid + across/down ---- */
.pk-cw-grid { border-collapse: collapse; margin: .6rem auto 1rem; }
.pk-cw-grid td {
  border: 1px solid #1c1713; width: 2.7em; height: 2.7em; position: relative;
  text-align: center; vertical-align: middle; font-size: 1.15em; font-weight: 700;
  -webkit-print-color-adjust: exact; print-color-adjust: exact;
}
.pk-cw-grid td.blk { background: #1c1713; }
.pk-cw-grid td .num {
  position: absolute; top: .05em; left: .18em; font-size: .5em;
  font-weight: 400; line-height: 1; opacity: .8;
}
.pk-clues { display: flex; gap: 2rem; flex-wrap: wrap; }
.pk-clues > div { flex: 1 1 12rem; min-width: 11rem; }
.pk-clues ol { list-style: none; padding: 0; margin: .3rem 0 0; font-size: .92em; }
.pk-clues li { padding: .18rem 0; display: flex; gap: .45rem; }
.pk-clues li .n { font-weight: 700; min-width: 1.3em; text-align: right; }

/* ---- READING sheets (scripture / poem) ---- */
.pk-reading { font-size: 1.05em; line-height: 1.85; margin: .8rem 0 0; }
.pk-reading p { margin: 0 0 .9rem; }
/* poems keep their line breaks as authored verse */
.pk-verse { white-space: pre-wrap; font-size: 1em; line-height: 1.7; margin: .8rem 0 0; }
.pk-source { margin-top: 1rem; font-size: .9em; opacity: .8; font-style: italic; text-align: right; }

/* ---- LOGIC-PUZZLE slots (adopted from the Morning Mystery print pages) ---- */
/* The adopted sheet lives inside a shadow root (feed/pack-logic.js) so the
   game's own `ps-*` stylesheet applies verbatim without leaking into this
   page. These rules only style the HOST element + its waiting state. */
.pk-logic { padding: 0; border-color: rgba(128,110,90,.45); overflow: hidden; }
.pk-logic .pk-slot { display: block; }
.pk-logic .pk-wait { padding: 2.4rem 1.6rem; text-align: center; }
.pk-logic .pk-wait h3 { margin: .3rem 0 .5rem; font-size: 1.2em; }
.pk-logic .pk-wait p { margin: .4rem 0; font-size: .92em; opacity: .8; }
.pk-spin {
  display: inline-block; width: 1.1em; height: 1.1em; vertical-align: -.15em;
  border: 2px solid rgba(28,23,19,.25); border-top-color: #8e1d1d; border-radius: 50%;
  animation: pk-spin 1s linear infinite;
}
@keyframes pk-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .pk-spin { animation-duration: 3s; } }

/* ---- ANSWER KEY (compact, one page, at the back) ---- */
.pk-answers .pk-ak { margin: 0 0 1.1rem; break-inside: avoid; }
.pk-answers .pk-ak:last-child { margin-bottom: 0; }
.pk-ak-head { font-weight: 700; font-size: .95em; letter-spacing: .03em; margin: 0 0 .3rem; }
.pk-ak-body { font-size: .9em; line-height: 1.6; }
.pk-ak-cols { display: flex; gap: 1.4rem; flex-wrap: wrap; align-items: flex-start; }
.pk-ak-cols > * { flex: 0 1 auto; }
.pk-inline { list-style: none; padding: 0; margin: .2rem 0 0; font-size: .9em; }
.pk-inline li { padding: .1rem 0; }
/* solved logic assignment table */
.pk-sol { border-collapse: collapse; font-size: .82em; margin: .3rem 0 0; }
.pk-sol th, .pk-sol td { border: 1px solid #666; padding: .18rem .45rem; text-align: left; }
.pk-sol th { font-weight: 700; background: #efe9dc; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.pk-culprit { font-weight: 700; margin: .2rem 0 .3rem; }
.pk-spoiler-note { text-align: center; font-size: .85em; opacity: .75; margin: 0 0 .9rem; font-style: italic; }

/* ---- MAILING COVER (functions/_pack.js coverSheet) ----
   Page 1 of a pack that goes in an envelope. PostGrid prints the recipient
   block onto the top of the first page, so .pk-cover-window reserves that
   space DELIBERATELY — the puzzle sheets then start on page 2, unmarked.
   2.75in is PostGrid's ~2in address area plus margin for their placement. */
.pk-cover-window { height: 2.75in; }
.pk-cover-body { text-align: center; }
.pk-cover-brand { font-size: .8em; letter-spacing: .18em; margin: 0; color: #8e1d1d; font-weight: 700; }
.pk-cover-title { font-size: 2.6em; margin: .1em 0 .05em; font-weight: 700; letter-spacing: -.01em; }
.pk-cover-date { font-size: 1em; opacity: .75; margin: 0 0 1.4em; }
.pk-cover-to { font-size: 1.15em; font-style: italic; margin: 0 0 1.2em; }
.pk-cover-lead { font-size: 1em; line-height: 1.7; max-width: 30em; margin: 0 auto 1.8em; }
.pk-cover-toc {
  list-style: none; padding: 0; margin: 0 auto; max-width: 22em;
  text-align: left; border-top: 1px solid #ccc;
}
.pk-cover-toc li { display: flex; gap: .9em; padding: .42em .2em; border-bottom: 1px solid #eee; }
.pk-cover-toc .n { opacity: .5; font-variant-numeric: tabular-nums; min-width: 1.2em; }
.pk-cover-foot { margin-top: 2.2em; font-size: .85em; line-height: 1.7; opacity: .75; }

/* ---- reveal gate: the on-page answer key stays folded until asked ---- */
.pk-gate { text-align: center; padding: 1.4rem 0 .4rem; }
.pk-sheet[data-gated="1"] .pk-gated { display: none; }
.pk-sheet:not([data-gated="1"]) .pk-gate { display: none; }

/* =====================================================================
   PRINT / CAPTURE
   body.pk-render is the SCREEN mirror of @media print — headless Chrome
   captures that mode for the nightly PDF (tools/build-daily-pack.mjs),
   exactly like the game's body.print-render. Keep the two blocks in sync.
   ===================================================================== */
body.pk-render { background: #fff !important; }
body.pk-render > *:not(.pk-sheets) { display: none !important; }
body.pk-render .pk-sheets { display: block !important; margin: 0; }
body.pk-render .pk-sheet { border: none; border-radius: 0; max-width: none; margin: 0; padding: 0; }
body.pk-render .pk-gate { display: none !important; }
body.pk-render .pk-gated { display: block !important; }

@media print {
  html, body { background: #fff !important; }
  body > *:not(.pk-sheets) { display: none !important; }
  .pk-page > *:not(.pk-sheets) { display: none !important; }
  .pk-sheets { display: block !important; margin: 0; }
  .pk-sheet {
    border: none; border-radius: 0; max-width: none; margin: 0; padding: 0;
    page-break-after: always; break-after: page;
  }
  .pk-sheet:last-child { page-break-after: auto; break-after: auto; }
  /* a folded answer key must never print blank — printing IS asking for it */
  .pk-gate { display: none !important; }
  .pk-gated { display: block !important; }
  /* keep a sheet's own internals together where the paper allows */
  .pk-wf-grid, .pk-cw-grid, .pk-sol, .pk-ak { break-inside: avoid; }
  .pk-h2 { break-after: avoid; }
  @page { margin: 16mm; }
}
