/* ============================================================
   RAISED TO RESIST · Activity Books — PAGE CHROME
   ------------------------------------------------------------
   The shared composition engine and standard furniture every
   interior page wears, top to bottom:
     eyebrow + age-badge → title (pillar underline) →
     instruction → body (THE ART) → ribbon → for-grownups → foot
   Matches the established first-three look: cream paper, a
   warm-gray diagonal watermark, soft rounded panels, gentle
   pillar tints. Do not restyle per book.
   ============================================================ */

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: #6E6A63;                 /* gallery wall (screen only) */
  background-image: radial-gradient(circle at 50% 0%, #807B73 0%, #565249 72%);
  font-family: var(--font-sans);
  color: var(--ink);
  padding: 48px 0 96px;
}

.book { display: flex; flex-direction: column; align-items: center; gap: 40px; }

/* ---------- THE PAGE SHEET ---------------------------------- */
.page {
  position: relative;
  width: var(--page-w);
  min-height: var(--page-h);
  padding: var(--page-margin);
  background: var(--cream);
  color: var(--ink);
  overflow: hidden;
  box-shadow: var(--shadow-page);
  display: flex;
  flex-direction: column;
}

/* ---------- DIAGONAL WATERMARK ------------------------------ */
/* "RAISED TO RESIST" tiled on the diagonal, warm-gray, ~6%.
   Interior pages only (.has-watermark) — never covers/certs. */
.has-watermark::before {
  content: "";
  position: absolute;
  left: -30%; top: -30%;
  width: 160%; height: 160%;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='560' height='150'%3E%3Ctext x='0' y='95' font-family='Poppins, Arial, sans-serif' font-size='38' font-weight='700' letter-spacing='6' fill='%238C8279'%3ERAISED TO RESIST%3C/text%3E%3C/svg%3E");
  background-repeat: repeat;
  transform: rotate(-27deg);
  transform-origin: center;
  opacity: var(--wm-opacity, 0.07);
  pointer-events: none;
  z-index: 0;
}
.page > * { position: relative; z-index: 1; }

/* paper tone (tweakable; 0 by default to match clean cream) */
.page::after {
  content: "";
  position: absolute; inset: 0;
  background: var(--ink);
  opacity: var(--paper-tone, 0);
  mix-blend-mode: multiply;
  pointer-events: none;
}

/* ---------- FURNITURE: HEAD --------------------------------- */
.page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--s-4);
  margin-bottom: var(--s-3);
}
.eyebrow {
  font-family: var(--font-sans);
  font-weight: 700;
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--pillar-ink);
  padding-top: 3px;
}
.age-badge {
  flex: none;
  font-family: var(--font-sans);
  font-weight: 700;
  font-size: 10.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--cream);
  background: var(--pillar);
  border-radius: var(--r-pill);
  padding: 6px 15px;
  white-space: nowrap;
}

/* ---------- FURNITURE: TITLE -------------------------------- */
.page-title {
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: 30px;
  line-height: 1.12;
  letter-spacing: -0.01em;
  margin: 0;
  color: var(--ink);
  text-wrap: balance;
}
.page-title::after {
  content: "";
  display: block;
  width: 64px; height: 4px;
  margin-top: 10px;
  border-radius: 2px;
  background: var(--pillar);
}

/* ---------- FURNITURE: INSTRUCTION -------------------------- */
.page-instruction {
  font-family: var(--font-sans);
  font-weight: 400;
  font-size: 16px;
  line-height: 1.5;
  color: var(--ink);
  margin: var(--s-4) 0 0;
  max-width: 64ch;
  text-wrap: pretty;
}
.page-instruction strong { font-weight: 600; }
.page-instruction .say {
  font-family: var(--font-serif);
  font-style: italic;
  font-weight: 600;
  color: var(--pillar-ink);
}

/* ---------- FURNITURE: BODY (THE ART) ----------------------- */
.page-body {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 0;
  padding: var(--s-5) 0;
}

/* grounding — no figure floats in white space */
.grounded { position: relative; }
.grounded::after {
  content: "";
  position: absolute;
  left: 50%; bottom: -10px;
  transform: translateX(-50%);
  width: 64%; height: 18px;
  background: radial-gradient(ellipse at center, rgba(45,45,45,0.16), rgba(45,45,45,0) 70%);
  z-index: -1;
}

/* ART IMAGES
   Line-art pieces are PNGs on white → multiply drops the white
   onto cream. Color scenes sit in a soft framed panel. */
.art-line {
  display: block;
  width: 100%; height: 100%;
  object-fit: contain;
  mix-blend-mode: multiply;
}
.art-color {
  display: block;
  width: 100%; height: 100%;
  object-fit: contain;
  border-radius: var(--r-md);
}
.art-frame {
  background: #fff;
  border: 1.5px solid var(--pillar-bd);
  border-radius: var(--r-md);
  padding: var(--s-2);
  box-shadow: var(--shadow-soft);
}

/* ---------- ART PLACEHOLDER --------------------------------- */
.art-needed {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  text-align: center;
  background:
    repeating-linear-gradient(45deg, var(--pillar-8) 0 13px, transparent 13px 26px),
    var(--cream);
  border: 2px dashed var(--pillar-bd);
  border-radius: var(--r-md);
  color: var(--ink-mute);
  padding: var(--s-4);
}
.art-needed > * { width: 100%; text-align: center; }
.art-needed .an-tag {
  font-family: var(--font-serif);
  font-style: italic;
  font-weight: 600;
  font-size: 14px;
  line-height: 1.3;
  color: var(--pillar-ink);
}
.art-needed .an-sub {
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: 10px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-mute);
}
.art-needed .an-dim {
  font-family: var(--font-sans);
  font-size: 10px;
  color: var(--ink-faint);
  max-width: 90%;
}
.art-needed .an-icon { font-size: 22px; opacity: 0.45; }
body.art-clean .art-needed { background: var(--cream); border-color: var(--ink-faint); }

/* ---------- FURNITURE: RIBBON (takeaway) -------------------- */
.ribbon {
  margin: var(--s-5) 0 0;
  padding: 11px 22px;
  background: var(--pillar-8);
  border-radius: var(--r-sm);
  text-align: center;
  font-family: var(--font-serif);
  font-style: italic;
  font-weight: 600;
  font-size: 16px;
  line-height: 1.35;
  color: var(--pillar-ink);
}

/* ---------- FURNITURE: FOR GROWN-UPS ------------------------ */
.for-grownups {
  margin-top: var(--s-5);
  background: var(--pillar-8);
  border: 1.5px solid var(--pillar-bd);
  border-radius: var(--r-md);
  padding: 13px 18px;
}
.for-grownups .fg-label {
  display: block;
  font-family: var(--font-sans);
  font-weight: 700;
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--pillar-ink);
  margin-bottom: 6px;
}
.for-grownups p {
  margin: 0;
  font-family: var(--font-sans);
  font-weight: 400;
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--ink-soft);
}
.for-grownups p + p { margin-top: 6px; }
.for-grownups .fg-script {
  font-family: var(--font-serif);
  font-style: italic;
  font-weight: 600;
  color: var(--pillar-ink);
}

/* secondary tip box (e.g. "PICK A GOOD ONE", "HOW TO USE…") */
.tip-box {
  margin-top: var(--s-4);
  background: var(--pillar-8);
  border: 1.5px solid var(--pillar-bd);
  border-radius: var(--r-md);
  padding: 13px 18px;
}
.tip-box .tip-label {
  display: block;
  font-family: var(--font-sans);
  font-weight: 700;
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--pillar-ink);
  margin-bottom: 6px;
}
.tip-box p {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--ink-soft);
}

/* ---------- FURNITURE: FOOT --------------------------------- */
.page-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-4);
  margin-top: var(--s-4);
  padding-top: 9px;
  border-top: 1px solid var(--pillar-bd);
  font-family: var(--font-sans);
  font-weight: 500;
  font-size: 10px;
  letter-spacing: 0.02em;
  color: var(--ink-mute);
}
.page-foot .pf-right { font-variant-numeric: tabular-nums; }

/* ---------- SOFT CALLOUT PANELS (shared) ------------------- */
.panel {
  background: var(--pillar-8);
  border: 1.5px solid var(--pillar-bd);
  border-radius: var(--r-md);
  padding: 14px 18px;
}
.panel-title {
  font-family: var(--font-sans);
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--pillar-ink);
  margin: 0 0 8px;
}

/* speech bubble (rounded, pillar-bordered, serif-italic title) */
.bubble {
  position: relative;
  background: var(--pillar-8);
  border: 2px solid var(--pillar-bd);
  border-radius: var(--r-md);
  padding: 12px 16px;
}
.bubble .bub-title {
  font-family: var(--font-serif);
  font-style: italic;
  font-weight: 700;
  font-size: 18px;
  color: var(--pillar-ink);
  margin: 0 0 3px;
}
.bubble .bub-body {
  font-family: var(--font-sans);
  font-size: 13px;
  line-height: 1.4;
  color: var(--ink-soft);
}
.bubble.tail-bl::after {
  content: "";
  position: absolute;
  left: 26px; bottom: -14px;
  border: 8px solid transparent;
  border-top-color: var(--pillar-bd);
  border-bottom: 0;
}

/* ---------- SCREEN / PRINT --------------------------------- */
@media print {
  body { background: #fff; padding: 0; }
  .book { gap: 0; }
  .page { box-shadow: none; margin: 0; page-break-after: always; break-after: page; }
  .page:last-child { page-break-after: auto; }
}
@page { size: Letter portrait; margin: 0; }

/* ===================================================================
   On-screen fit for small viewports (added).
   Shrinks each fixed-size print sheet so it fits phones/tablets instead
   of overflowing sideways. Uses `zoom`, which shrinks the layout box
   (unlike transform, which would leave the box full-width and still clip).
   This block is screen-only and does NOT affect @media print: printing
   is byte-for-byte identical.
   =================================================================== */
@media screen and (max-width: 820px) { .page { zoom: 0.80; } }
@media screen and (max-width: 680px) { .page { zoom: 0.62; } }
@media screen and (max-width: 520px) { .page { zoom: 0.52; } }
@media screen and (max-width: 430px) { .page { zoom: 0.47; } }
@media screen and (max-width: 390px) { .page { zoom: 0.44; } }
@media screen and (max-width: 360px) { .page { zoom: 0.39; } }
