/* ============================================================
   coloring-library.css — free-coloring-pages hub / cluster /
   leaf pages (generated by scripts/pseo/build_pages.py).
   Loads AFTER design-system.css + pages-content.css and reuses
   their tokens (--cream, --ink, --coral, ws-hero, ws-cta,
   mmw-preview-frame, res-faq, breadcrumb).
   ============================================================ */

.cl-page { padding-bottom: var(--s7); }
.cl-page .breadcrumb { padding: var(--s4) 0 0; }
.cl-page .ws-hero { padding-top: var(--s6); }
.cl-page .ws-hero p { text-align: left; }
.cl-page .ws-hero p a { color: var(--coral); font-weight: 700; }

/* ---------- gallery grid (clusters + hub + leaf siblings) ---------- */
.cl-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--s6) var(--s5);
  margin: var(--s6) auto;
  max-width: 1080px;
}
.cl-grid-4 { grid-template-columns: repeat(4, 1fr); gap: var(--s5) var(--s4); }

.cl-card { margin: 0; text-align: left; min-width: 0; }
.cl-frame {
  display: block;
  background: var(--surface);
  border-radius: 14px;
  padding: var(--s4);
  margin-bottom: var(--s3);
  transition: background .2s ease;
}
.cl-frame:hover { background: #E7E0D2; }
.cl-frame img {
  display: block;
  width: 100%;
  height: auto;
  background: var(--card);
  border-radius: 3px;
  box-shadow: var(--shadow-page);
}
.cl-card h3 {
  font-family: var(--font-display);
  font-weight: 480;
  font-size: 18px;
  margin-bottom: 2px;
}
.cl-card h3 a { color: var(--ink); }
.cl-card h3 a:hover { color: var(--coral); }
.cl-card figcaption {
  font-size: 13.5px;
  color: var(--ink-soft);
  line-height: 1.55;
}

/* ---------- hub topic cards ---------- */
.cl-hub-heading {
  font-size: clamp(22px, 2.6vw, 28px);
  margin: var(--s7) 0 0;
  max-width: 1080px;
  margin-left: auto;
  margin-right: auto;
}
.cl-topic-grid { margin-top: var(--s5); }
.cl-topic-card { display: block; text-decoration: none; min-width: 0; }
.cl-topic-card h3 {
  font-family: var(--font-display);
  font-weight: 480;
  font-size: 19px;
  color: var(--ink);
  margin-bottom: 2px;
}
.cl-topic-card:hover h3 { color: var(--coral); }
.cl-count { font-size: 13.5px; font-weight: 700; color: var(--coral); }

/* ---------- CTA band ---------- */
.cl-cta { margin: var(--s7) auto; }
.cl-cta strong {
  display: block;
  font-family: var(--font-display);
  font-weight: 480;
  font-size: clamp(22px, 2.8vw, 30px);
  color: var(--ink);
  margin-bottom: var(--s3);
}

/* ---------- email gate ---------- */
.cl-gate {
  max-width: 640px;
  margin: var(--s7) auto;
  text-align: center;
  padding: var(--s7) var(--s6);
}
.cl-gate h2 { font-size: clamp(22px, 2.8vw, 30px); margin-bottom: var(--s3); }
.cl-gate p { color: var(--ink-soft); font-size: 15px; margin-bottom: var(--s5); }
.cl-gate-form {
  display: flex;
  gap: var(--s2);
  justify-content: center;
  flex-wrap: wrap;
}
.cl-gate-form input[type="email"] {
  flex: 1 1 240px;
  max-width: 340px;
  padding: 12px 16px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-family: var(--font-body);
  font-size: 15px;
  color: var(--ink);
  background: var(--cream);
}
.cl-gate-form input[type="email"]:focus {
  outline: none;
  border-color: var(--coral);
}
.cl-gate-link {
  margin-top: var(--s2);
  white-space: normal;
  max-width: 100%;
  text-align: center;
  line-height: 1.35;
}
.cl-gate-note {
  min-height: 1em;
  font-size: 13.5px;
  font-weight: 600;
  margin: var(--s3) 0 0 !important;
}
.cl-gate-note.ok { color: var(--success); }
.cl-gate-note.err { color: var(--danger); }

/* ---------- FAQ + related ---------- */
.cl-faq { margin-top: var(--s7); }
.cl-related { max-width: 1080px; margin: var(--s7) auto 0; }
.cl-related h2 { font-size: clamp(22px, 2.8vw, 30px); margin-bottom: var(--s5); }
.cl-rel-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--s5);
}
.cl-rel-card {
  display: block;
  text-decoration: none;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: var(--s4);
  transition: transform .2s ease, box-shadow .2s ease;
}
.cl-rel-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-soft); }
.cl-rel-card img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 8px;
  margin-bottom: var(--s3);
}
.cl-rel-card span { font-size: 14.5px; font-weight: 700; color: var(--coral); }

/* ---------- leaf pages ---------- */
.cl-leaf article { max-width: 760px; margin: 0 auto; }
.cl-leaf h1 {
  font-size: clamp(28px, 3.8vw, 40px);
  margin: var(--s5) 0 var(--s3);
}
.cl-leaf-caption { color: var(--ink-soft); font-size: 16.5px; max-width: 62ch; }
.cl-leaf .mmw-preview-frame img { max-width: 620px; }
.cl-actions {
  display: flex;
  gap: var(--s3);
  flex-wrap: wrap;
  margin: var(--s5) 0;
}
.cl-siblings { margin-top: var(--s7); }
.cl-siblings h2 { font-size: clamp(22px, 2.8vw, 28px); margin-bottom: var(--s4); }
.cl-siblings .cl-grid { margin-top: var(--s4); }
.cl-backlink { margin-top: var(--s4); }
.cl-backlink a { color: var(--coral); font-weight: 700; }

/* ---------- responsive ---------- */
@media (max-width: 980px) {
  .cl-grid, .cl-grid-4 { grid-template-columns: repeat(2, 1fr); }
  .cl-rel-grid { grid-template-columns: 1fr; max-width: 420px; }
}
@media (max-width: 560px) {
  .cl-grid, .cl-grid-4 { grid-template-columns: 1fr; max-width: 380px; }
  .cl-gate { padding: var(--s6) var(--s5); }
  .cl-gate-form input[type="email"] { max-width: none; }
  .cl-gate-form .btn { width: 100%; }
  .cl-actions .btn { flex: 1 1 100%; }
}

/* ---------- print: leaf pages print just the art ---------- */
@media print {
  .cl-leaf .breadcrumb, .cl-leaf h1, .cl-leaf-caption, .cl-actions,
  .cl-leaf .mmw-makeown, .cl-siblings {
    display: none !important;
  }
  .cl-leaf .mmw-preview-frame {
    background: #fff !important;
    padding: 0 !important;
    margin: 0 !important;
  }
  .cl-leaf .mmw-preview-frame img {
    max-width: 100% !important;
    width: 100% !important;
    box-shadow: none !important;
    padding: 0 !important;
    transform: none !important;
  }
  .cl-leaf .mmw-preview-caption { display: none !important; }
}
