/* ==========================================================================
   page.php — public "download this coloring page" view.
   Standalone stylesheet (not the kid app's assets/app.css): this page is
   meant to be linked from anywhere, so it doesn't depend on app.js/app.css.
   Design tokens mirror app.css :root — keep both in sync if the brand palette
   changes.
   ========================================================================== */

:root {
  --paper: #FFF9EE;
  --ink: #333340;
  --soft-ink: #6B6B7A;
  --c-orange: #FF9440;
  --c-green: #2F9E57;
  --action: #2E9BE6;
  --border-w: 4px;
  --card-radius: 22px;
  --font-head: "Fredoka", system-ui, sans-serif;
  --font-body: "Nunito", system-ui, sans-serif;
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  min-height: 100vh;
  min-height: 100dvh;
  font-family: var(--font-body);
  color: var(--ink);
  background-color: var(--paper);
  background-image: radial-gradient(circle, rgba(51, 51, 64, 0.07) 1.6px, transparent 1.6px);
  background-size: 26px 26px;
  -webkit-text-size-adjust: 100%;
}

:focus { outline: none; }
:focus-visible {
  outline: 3px solid var(--action);
  outline-offset: 3px;
  border-radius: 12px;
}

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  max-width: 720px;
  margin: 0 auto;
  padding: 18px clamp(14px, 4vw, 28px) 0;
}

.brand-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--ink);
  text-decoration: none;
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 1.05rem;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--soft-ink);
  text-decoration: none;
  font-family: var(--font-head);
  font-weight: 600;
  font-size: 0.95rem;
}
.back-link:hover { color: var(--ink); }

.page-main {
  max-width: 720px;
  margin: 0 auto;
  padding: 20px clamp(14px, 4vw, 28px) 32px;
  text-align: center;
}

h1 {
  font-family: var(--font-head);
  font-weight: 700;
  font-size: clamp(1.5rem, 4vw, 2.1rem);
  margin: 8px 0 4px;
}

.subtitle {
  margin: 0 0 22px;
  color: var(--soft-ink);
  font-weight: 700;
}

.art-card {
  background: #fff;
  border: var(--border-w) solid var(--ink);
  border-radius: var(--card-radius);
  box-shadow: 0 8px 0 rgba(51, 51, 64, 0.16);
  padding: clamp(10px, 3vw, 20px);
}

/* ---------------------------------------------------------- book.php only */
.book-cover-card {
  max-width: 280px;
  margin: 0 auto;
}
.book-cover-card img {
  width: 100%;
  aspect-ratio: 4 / 5;
  object-fit: cover;
}
.book-pages-h2 {
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 1.2rem;
  margin: 34px 0 16px;
  text-align: left;
}
.book-page-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 14px;
  text-align: left;
}
.book-page-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 8px;
  background: #fff;
  border: 3px solid var(--ink);
  border-radius: 14px;
  text-decoration: none;
  color: var(--ink);
  box-shadow: 0 4px 0 rgba(51, 51, 64, 0.14);
  transition: transform 120ms ease, box-shadow 120ms ease;
}
.book-page-card:hover { transform: translateY(-2px); }
.book-page-thumb {
  width: 100%;
  aspect-ratio: 3 / 4;
  border: 2px solid var(--ink);
  border-radius: 10px;
  overflow: hidden;
  background: var(--paper);
}
.book-page-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.book-page-word {
  font-family: var(--font-head);
  font-weight: 600;
  font-size: 0.92rem;
  text-align: center;
}
.art-card img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 10px;
}

.attribution {
  margin: 20px 0 0;
  color: var(--soft-ink);
  font-size: 0.95rem;
  line-height: 1.5;
}

.ad-slot {
  margin: 34px auto 0;
  max-width: 600px;
  text-align: center;
}
.ad-label {
  margin: 0 0 6px;
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--soft-ink);
  opacity: 0.7;
}

/* ============================================================================
   TEMP AD PLACEMENT PREVIEW — added 2026-08-15, see assets/app.css for the
   full note. Pure CSS, delete this whole block to remove.
   ============================================================================ */
.ad-slot ins.adsbygoogle {
  display: flex !important;
  align-items: center;
  justify-content: center;
  min-height: 100px;
  padding: 18px;
  background: linear-gradient(135deg, #FFE29A, #FFB88C);
  border: 3px dashed var(--ink);
  border-radius: 14px;
  box-sizing: border-box;
}
.ad-slot ins.adsbygoogle::before {
  content: "\1F4E2 Sample ad goes here \2014 real ad once AdSense is live";
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--ink);
  text-align: center;
}
/* ========================================================= /TEMP AD PREVIEW */

.ref-btn {
  display: inline;
  background: none;
  border: none;
  padding: 0;
  margin-left: 4px;
  color: var(--action);
  font: inherit;
  font-weight: 800;
  text-decoration: underline;
  cursor: pointer;
}
.ref-btn:hover { color: var(--ink); }

.source-ref-popup {
  position: relative;
  max-width: 420px;
  margin: 12px auto 0;
  padding: 14px 34px 14px 16px;
  background: #fff;
  border: 3px solid var(--ink);
  border-radius: 14px;
  box-shadow: 0 6px 0 rgba(51, 51, 64, 0.14);
  text-align: left;
}
.source-ref-popup .popup-title {
  margin: 0 0 6px;
  color: var(--c-green);
  font-weight: 800;
  font-size: 0.92rem;
}
.source-ref-popup .popup-text {
  margin: 0;
  font-size: 0.85rem;
  color: var(--ink);
  word-break: break-word;
}
.source-ref-popup .popup-close {
  position: absolute;
  top: 6px;
  right: 8px;
  background: none;
  border: none;
  font-size: 1.1rem;
  line-height: 1;
  color: var(--soft-ink);
  cursor: pointer;
  padding: 4px;
}
.source-ref-popup .popup-close:hover { color: var(--ink); }

.actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 14px;
  margin-top: 24px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 54px;
  min-width: 54px;
  padding: 10px 24px;
  border: var(--border-w) solid var(--ink);
  border-radius: 999px;
  background: #fff;
  color: var(--ink);
  font-family: var(--font-head);
  font-weight: 600;
  font-size: 1.02rem;
  text-decoration: none;
  cursor: pointer;
  box-shadow: 0 5px 0 var(--ink);
  transform: translateY(0);
  transition: transform 90ms ease, box-shadow 90ms ease;
}
.btn:active {
  transform: translateY(4px);
  box-shadow: 0 1px 0 var(--ink);
}
.btn--warm { background: var(--c-orange); color: #fff; }
.btn--go   { background: var(--c-green); color: #fff; }

.page-footer {
  text-align: center;
  padding: 12px 16px 28px;
  color: var(--soft-ink);
  font-size: 0.85rem;
}
.page-footer a { color: var(--soft-ink); }

@media (max-width: 520px) {
  .actions { flex-direction: column; align-items: stretch; }
  .btn { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  .btn { transition: none; }
}

/* -------------------------------------------------------------- printing */
@media print {
  body { background: #fff; }
  .page-header, .subtitle, .attribution, .actions, .page-footer, .source-ref-popup {
    display: none !important;
  }
  .page-main { padding: 0; max-width: none; }
  .art-card { border: none; box-shadow: none; padding: 0; }
  h1 { display: none; }
}
