/* Printables: the hub and the puzzle pages (see scripts/make-printables.js).
   On screen: a preview of the sheet. When printed: exactly one large-print page for the chosen puzzle, then one answer-key page.
   Layout units are inches in print, so it fits Letter (8.5 x 11) and A4 (8.27 x 11.69) with the 0.5in margin below. */

/* ---------- on screen ---------- */
.printable .pr-step { margin: 1.4rem 0 0.5rem; font-size: 1.35rem; }
.pr-picker { display: grid; gap: 0.7rem; }
.pr-row { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 0.6rem; }
.pr-level { flex: 0 0 100%; font-size: 1.15rem; line-height: 1.3; }
.pr-level span { color: var(--ink-soft); }
@media (min-width: 42rem) { .pr-level { flex: 0 0 17rem; } }
.pr-row .btn { min-width: 3.6rem; min-height: 56px; font-size: 1.35rem; }
.pr-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem; margin: 1.1rem 0; }
.pr-actions .btn { min-height: 64px; font-size: 1.3rem; }
.pr-actions .btn-play { font-size: 1.5rem; }
.printable .pr-hint { margin: 0.4rem 0 0; font-size: 1.05rem; color: var(--ink-soft); }
.printable .pr-showing { margin: 0.5rem 0 0; min-height: 1.6em; font-size: 1.15rem; font-weight: 700; color: var(--heading); }
.pr-stage { margin: 0.5rem 0 1.25rem; }
html.js .pz:not(.is-on) { display: none; }

/* the paper: always white with dark ink, whatever theme the site is in */
.sheet {
  --gw: min(84vw, 30rem);
  box-sizing: border-box; max-width: 38rem; margin: 0 auto 1rem; padding: 1.1rem 0.9rem 0.9rem;
  background: #fff; color: #111; text-align: center;
  border: 3px solid #d8cdb8; border-radius: 14px; box-shadow: 0 4px 0 rgba(0, 0, 0, 0.08);
  font-family: Verdana, "Segoe UI", Arial, sans-serif;
}
.sheet p, .sheet li, .sheet span, .sheet i { color: #111; }
.sheet-key { display: none; }
body.show-key .sheet-key { display: block; }
.sheet .sh-title { margin: 0; font: 700 1.7rem/1.2 Georgia, "Times New Roman", serif; }
.sheet .sh-sub { margin: 0.3rem 0 0.5rem; font-size: 1.05rem; line-height: 1.4; }
.sheet .sh-name { display: flex; justify-content: center; align-items: flex-end; gap: 0.5rem; margin: 0 0 0.7rem; font-size: 0.95rem; line-height: 1.2; }
.sheet .sh-name i { flex: 0 1 8rem; border-bottom: 1.5px solid #111; height: 1.1em; }
.sheet .sh-h { margin: 0.8rem 0 0.2rem; font: 700 1.2rem Georgia, "Times New Roman", serif; }
.sheet .sh-foot { margin: 0.7rem 0 0; font-size: 0.85rem; color: #444; }

/* word search grid. Lines are borders (not backgrounds), so they print even without "background graphics". */
.ws-grid, .sd-grid { --line: #666; margin: 0 auto; box-sizing: content-box; display: grid; width: var(--gw); border-top: 1.5px solid var(--line); border-left: 1.5px solid var(--line); }
.ws-grid { --cell: calc(var(--gw) / var(--n)); grid-template-columns: repeat(var(--n), var(--cell)); }
.ws-grid span {
  box-sizing: border-box; display: flex; align-items: center; justify-content: center; height: var(--cell);
  font: 700 calc(var(--cell) * 0.62) / 1 Verdana, "Segoe UI", Arial, sans-serif; color: #111;
  border-right: 1.5px solid var(--line); border-bottom: 1.5px solid var(--line);
}
.ws-grid.key span { color: #9a9a9a; font-weight: 400; }
.ws-grid.key span.hit { color: #000; font-weight: 800; background: #d9d9d9; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.ws-words { list-style: none; margin: 0.2rem auto 0; padding: 0; max-width: 30rem; text-align: left; columns: 2; column-gap: 1.4rem; }
.ws-words.cols-3 { columns: 3; }
.ws-words li { margin: 0.2rem 0; font-size: 1.1rem; font-weight: 700; letter-spacing: 0.04em; line-height: 1.3; break-inside: avoid; }
.ws-words .box { display: inline-block; width: 0.8em; height: 0.8em; margin-right: 0.45em; border: 2px solid #111; vertical-align: -0.05em; }
.ws-words-key li { font-size: 0.95rem; }
.ws-words li { min-width: 0; overflow-wrap: anywhere; }
@media (max-width: 36rem) {
  .ws-words, .ws-words.cols-3 { columns: 2; column-gap: 0.8rem; }
  .ws-words li { font-size: 1rem; letter-spacing: 0.02em; }
  .ws-words-key li { font-size: 0.9rem; }
  .sheet .sh-title { font-size: 1.45rem; }
}

/* sudoku grid */
.sd-grid { --cell: calc(var(--gw) / 9); grid-template-columns: repeat(9, var(--cell)); border-top: 3px solid #000; border-left: 3px solid #000; }
.sd-grid span {
  box-sizing: border-box; display: flex; align-items: center; justify-content: center; height: var(--cell);
  font: 700 calc(var(--cell) * 0.62) / 1 Verdana, "Segoe UI", Arial, sans-serif; color: #000;
  border-right: 1px solid var(--line); border-bottom: 1px solid var(--line);
}
.sd-grid span.br { border-right: 3px solid #000; }
.sd-grid span.bb { border-bottom: 3px solid #000; }
.sd-grid span:nth-child(9n) { border-right: 3px solid #000; }
.sd-grid span:nth-last-child(-n + 9) { border-bottom: 3px solid #000; }
.sd-grid.key span.ans { font-weight: 400; color: #333; background: #e8e8e8; -webkit-print-color-adjust: exact; print-color-adjust: exact; }

/* the hub's cards */
.pr-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr)); gap: 0.9rem; list-style: none; margin: 1rem 0; padding: 0; }
.pr-card a {
  display: flex; flex-direction: column; gap: 0.3rem; min-height: 6.5rem; box-sizing: border-box; padding: 1rem 1.1rem; text-decoration: none;
  color: var(--heading); background: var(--card); border: 3px solid var(--wood-dark); border-radius: 16px;
}
.pr-card a strong { font-size: 1.3rem; }
.pr-card a span { font-size: 1.05rem; line-height: 1.4; color: var(--ink); }
.pr-card a:hover { border-color: var(--accent-dark); }
.pr-card a:focus-visible { outline: 4px solid var(--focus); outline-offset: 3px; }
.printable .guide-play { display: flex; flex-wrap: wrap; gap: 0.75rem; }

/* themed pages: previews on the hub, Mahjong tables, tags */
.ws-card a, .mj-card a { align-items: center; text-align: center; }
.ws-card .mini { --cell: 12px; display: grid; grid-template-columns: repeat(var(--n), var(--cell)); width: calc(var(--cell) * var(--n)); margin: 0 auto 0.5rem; background: #fff; border-top: 1px solid #8a7a66; border-left: 1px solid #8a7a66; }
.ws-card .mini i { display: flex; align-items: center; justify-content: center; height: var(--cell); font: normal 700 8px/1 Verdana, Arial, sans-serif; color: #2a1a0b; border-right: 1px solid #cdbfa5; border-bottom: 1px solid #cdbfa5; }
.ws-card .mini i.h { background: #1d4f9c; color: #fff; }
.ws-cards { grid-template-columns: repeat(auto-fill, minmax(11.5rem, 1fr)); }
.mj-cards { grid-template-columns: repeat(auto-fill, minmax(13rem, 1fr)); }
.mj-card .mj-svg { width: 100%; max-width: 11rem; height: auto; margin-bottom: 0.4rem; }
.mj-figure { margin: 1.2rem 0; padding: 1rem; text-align: center; background: var(--card); border: 3px solid var(--wood-dark); border-radius: 16px; }
.mj-figure .mj-svg { width: 100%; max-width: 40rem; height: auto; }
.mj-figure-tall .mj-svg { max-width: 18rem; }
.mj-figure figcaption { margin-top: 0.6rem; font-size: 1.05rem; line-height: 1.5; color: var(--ink-soft); }
.mj-tags { display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 0.5rem 0; }
.mj-tag { padding: 0.2rem 0.9rem; border-radius: 999px; background: var(--accent); color: var(--accent-ink); font-size: 1.05rem; font-weight: 700; }
.h2-note { font-size: 1rem; font-weight: 400; color: var(--ink-soft); }
.word-bank { overflow-wrap: anywhere; letter-spacing: 0.02em; }
.printable .pr-card a strong { overflow-wrap: anywhere; }

/* ---------- on paper ---------- */
@page { margin: 0.5in; }
@media print {
  html, body { background: #fff !important; height: auto !important; min-height: 0 !important; overflow: visible !important; }
  body.printables { display: block !important; }
  .cloth, .season, .site-top, .site-foot, .no-print { display: none !important; }
  .wrap, .page.printable { width: auto !important; max-width: none !important; margin: 0 !important; padding: 0 !important; }
  main.pz-page > *:not(.pr-stage) { display: none !important; }
  .pr-stage { margin: 0; }
  html.js .pz:not(.is-on) { display: none !important; }
  .pz .sheet {
    display: block !important; box-sizing: border-box; width: auto; max-width: none; margin: 0; padding: 0;
    border: 0; border-radius: 0; box-shadow: none; background: #fff;
    break-after: page; page-break-after: always; break-inside: avoid;
  }
  .pz .sheet-key { break-after: auto; page-break-after: auto; }
  .pz:not(:last-child) .sheet-key { break-after: page; page-break-after: always; }   /* only matters if scripts are off and every puzzle prints */
  .pz.lvl-easy .sheet { --gw: 5.5in; }
  .pz.lvl-medium .sheet { --gw: 5.5in; }
  .pz.lvl-hard .sheet { --gw: 5.5in; }
  .sheet.sd-sheet { --gw: 6.3in; }
  .sheet .sh-title { font-size: 26pt; }
  .sheet .sh-sub { margin: 0.05in 0 0.1in; font-size: 14pt; line-height: 1.3; }
  .sheet .sh-name { margin: 0 0 0.1in; font-size: 12pt; }
  .sheet .sh-name i { flex: 0 1 2.4in; }
  .sheet .sh-h { margin: 0.12in 0 0.04in; font-size: 17pt; }
  .ws-words { max-width: 6.8in; column-gap: 0.25in; }
  .ws-words li { margin: 0 0 0.04in; font-size: 16pt; }
  .ws-words-key li { font-size: 13pt; }
  .ws-words .box { width: 0.17in; height: 0.17in; margin-right: 0.1in; border-width: 1.5pt; }
  .sheet .sh-foot { margin: 0.15in 0 0; font-size: 10pt; color: #444; }
}
