/* ===========================================
   style.css — coloring-4kids.com
   =========================================== */

@import url('https://fonts.googleapis.com/css2?family=Nunito:wght@400;600;700;800;900&display=swap');

/* ---- Custom Properties ---- */
:root {
  --primary:        #F97316;
  --primary-hover:  #EA6B0A;
  --primary-light:  #FFF7ED;
  --primary-muted:  #FDE8D4;
  --bg:             #FFFCF7;
  --surface:        #FFFFFF;
  --text:           #1C1917;
  --text-2:         #57534E;
  --text-3:         #A8A29E;
  --border:         #E7E5E4;
  --shadow:         0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.05);
  --shadow-md:      0 4px 16px rgba(0,0,0,.10);
  --radius:         12px;
  --radius-sm:      7px;
  --font:           'Nunito', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --max-w:          1180px;
  --sidebar-w:      218px;
  --gap:            24px;
}

/* ---- Reset ---- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body { font-family: var(--font); font-size: 16px; line-height: 1.6; color: var(--text); background: var(--bg); }
img { display: block; max-width: 100%; height: auto; }
a { color: inherit; text-decoration: none; }
ul, ol { list-style: none; }
button, input, select { font: inherit; }

/* ---- Accessibility ---- */
:focus-visible { outline: 3px solid var(--primary); outline-offset: 2px; border-radius: 4px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; }

/* ================================================
   LAYOUT
   ================================================ */

.container {
  width: 100%;
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 20px;
}

/* Page wrapper: sidebar + main */
.page-wrapper {
  display: flex;
  gap: var(--gap);
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 28px 20px 48px;
  align-items: flex-start;
}

.main-content { flex: 1; min-width: 0; }

/* ================================================
   HEADER
   ================================================ */

.site-header {
  background: var(--surface);
  border-bottom: 2.5px solid var(--primary);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow);
}

.site-header .container {
  display: flex;
  align-items: center;
  height: 64px;
  gap: 12px;
}

/* Logo */
.site-logo {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 20px;
  font-weight: 900;
  color: var(--primary);
  flex-shrink: 0;
  letter-spacing: -.3px;
}
.site-logo .logo-mark {
  width: 38px; height: 38px;
  border-radius: 10px;
  background: var(--primary);
  display: flex; align-items: center; justify-content: center;
  color: #fff;
  font-size: 19px;
  flex-shrink: 0;
}
.site-logo .logo-text-dark { color: var(--text); }

/* Header nav */
.header-nav {
  display: flex;
  align-items: center;
  gap: 4px;
  flex: 1;
}

.header-nav a {
  padding: 7px 14px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 700;
  color: var(--text-2);
  white-space: nowrap;
  transition: background .15s, color .15s;
}
.header-nav a:hover { background: var(--primary-light); color: var(--primary); }

/* Header search */
.header-search {
  display: flex;
  align-items: center;
  background: #F5F5F4;
  border-radius: var(--radius-sm);
  padding: 7px 12px;
  gap: 8px;
  margin-left: auto;
}
.header-search input {
  border: none; background: transparent; outline: none;
  font-size: 14px; color: var(--text);
  width: 180px;
}
.header-search input::placeholder { color: var(--text-3); }
.header-search button {
  background: none; border: none; cursor: pointer;
  color: var(--text-3); display: flex; align-items: center;
  font-size: 16px;
}

/* Mobile menu toggle */
.menu-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  margin-left: auto;
}
.menu-toggle span {
  display: block; width: 22px; height: 2px;
  background: var(--text); border-radius: 2px;
}

/* ================================================
   SIDEBAR
   ================================================ */

.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  position: sticky;
  top: 80px;
  max-height: calc(100vh - 92px);
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}
.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

.sidebar-section { margin-bottom: 6px; }

.sidebar-label {
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--text-3);
  padding: 12px 10px 6px;
}

.cat-nav { display: flex; flex-direction: column; gap: 1px; }

.cat-nav a {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  font-weight: 700;
  color: var(--text-2);
  transition: background .12s, color .12s;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cat-nav a:hover { background: var(--primary-light); color: var(--primary); }
.cat-nav a.active { background: var(--primary-light); color: var(--primary); }
.cat-nav a .nav-emoji { font-size: 15px; flex-shrink: 0; }

/* ================================================
   BREADCRUMB
   ================================================ */

.breadcrumb {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px 6px;
  font-size: 13px;
  color: var(--text-3);
  margin-bottom: 18px;
}
.breadcrumb a { color: var(--primary); font-weight: 700; }
.breadcrumb a:hover { text-decoration: underline; }
.breadcrumb .bc-sep { color: var(--border); user-select: none; }

/* ================================================
   PAGE HEADINGS
   ================================================ */

.page-heading {
  font-size: 26px;
  font-weight: 900;
  color: #1C1917;
  line-height: 1.2;
  letter-spacing: -.3px;
  margin-bottom: 20px;
}
.section-heading {
  font-size: 19px;
  font-weight: 800;
  color: #1C1917;
  margin-bottom: 16px;
}
.section-divider {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 36px 0 20px;
}
.section-divider h2 {
  font-size: 17px;
  font-weight: 800;
  color: var(--text);
  white-space: nowrap;
}
.section-divider::after {
  content: '';
  flex: 1;
  height: 1.5px;
  background: var(--border);
  border-radius: 2px;
}

/* ================================================
   GALLERY GRID  (category & homepage grids)
   ================================================ */

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 14px;
  margin-bottom: 32px;
}

/* Empty category state — lives as a sibling after .gallery-grid */
.gallery-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 56px 24px 48px;
  text-align: center;
  color: var(--text-3);
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  margin-bottom: 32px;
}
.gallery-empty .ge-icon { font-size: 52px; margin-bottom: 14px; line-height: 1; }
.gallery-empty .ge-title { font-size: 17px; font-weight: 700; color: var(--text-2); margin-bottom: 8px; }
.gallery-empty .ge-sub { font-size: 13.5px; line-height: 1.6; max-width: 340px; }
.gallery-empty .ge-sub a { color: var(--primary); text-decoration: none; }
.gallery-empty .ge-sub a:hover { text-decoration: underline; }

.gallery-card {
  display: flex;
  flex-direction: column;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface);
  box-shadow: var(--shadow);
  transition: transform .15s, box-shadow .15s;
  color: inherit;
}
.gallery-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }

.gc-img {
  aspect-ratio: 3/4;
  background: #F5F5F4;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}
.gc-img img {
  width: 100%; height: 100%;
  object-fit: contain;
  transition: transform .2s;
}
.gallery-card:hover .gc-img img { transform: scale(1.04); }

/* Placeholder when image is missing */
.gc-img .gc-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  color: var(--text-3);
  width: 100%; height: 100%;
  min-height: 80px;
}
.gc-img .gc-placeholder .ph-emoji { font-size: 22px; }
.gc-img .gc-placeholder span { font-size: 9px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; opacity: .6; }

.gc-label {
  padding: 6px 8px 7px;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-2);
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ================================================
   COLORING PAGE DETAIL
   ================================================ */

.detail-layout {
  display: grid;
  grid-template-columns: 1fr 270px;
  gap: var(--gap);
  align-items: flex-start;
  margin-bottom: 40px;
}

/* Main image panel */
.detail-image-panel {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
  position: relative;
}
.detail-image-panel img {
  width: 100%;
  height: auto;
  display: block;
  border-radius: var(--radius-sm);
}
.detail-image-panel .img-placeholder-lg {
  aspect-ratio: 3/4;
  background: #F9F9F8;
  border: 2px dashed var(--border);
  border-radius: var(--radius-sm);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  color: var(--text-3);
}
.detail-image-panel .img-placeholder-lg .ph-lg { font-size: 60px; }
.detail-image-panel .img-placeholder-lg p { font-size: 13px; font-weight: 700; text-align: center; max-width: 180px; line-height: 1.4; }

/* Sidebar of detail page */
.detail-sidebar { display: flex; flex-direction: column; gap: 16px; }

/* Action buttons */
.action-buttons { display: flex; flex-direction: column; gap: 10px; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 13px 20px;
  border-radius: var(--radius);
  font-family: var(--font);
  font-size: 15px;
  font-weight: 800;
  cursor: pointer;
  border: none;
  text-decoration: none;
  transition: background .15s, transform .1s, box-shadow .15s;
  line-height: 1;
}
.btn:active { transform: scale(.98); }
.btn .btn-ico { font-size: 17px; }

.btn-download {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 2px 8px rgba(249,115,22,.35);
}
.btn-download:hover { background: var(--primary-hover); box-shadow: 0 4px 14px rgba(249,115,22,.4); }
.btn-download[aria-disabled="true"] {
  background: var(--border);
  color: var(--text-3);
  box-shadow: none;
  cursor: not-allowed;
  opacity: 1;
  pointer-events: none;
}

.btn-print {
  background: var(--surface);
  color: var(--primary);
  border: 2px solid var(--primary);
}
.btn-print:hover { background: var(--primary-light); }

/* Info card widget */
.info-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow);
}
.info-card-title {
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--text-3);
  margin-bottom: 12px;
}

/* Category badge in detail sidebar */
.cat-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 14px;
  background: var(--primary-light);
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 800;
  color: var(--primary);
  text-decoration: none;
}
.cat-badge:hover { background: var(--primary-muted); }

/* ================================================
   DESCRIPTION
   ================================================ */

.page-description {
  font-size: 15px;
  line-height: 1.75;
  color: var(--text-2);
  background: var(--surface);
  border-radius: var(--radius);
  padding: 22px 24px;
  box-shadow: var(--shadow);
  margin-bottom: 32px;
}
.page-description strong { color: var(--text); }

/* ================================================
   TAGS
   ================================================ */

.tags-list {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}
.tag {
  display: inline-flex;
  align-items: center;
  padding: 5px 11px;
  background: var(--primary-light);
  color: var(--primary);
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 700;
  text-decoration: none;
  transition: background .12s;
  line-height: 1;
}
.tag:hover { background: var(--primary-muted); }

/* ================================================
   RELATED PAGES GRID
   ================================================ */

.related-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(78px, 1fr));
  gap: 8px;
  margin-bottom: 32px;
}

.related-item {
  display: block;
  text-decoration: none;
  border-radius: var(--radius-sm);
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: transform .15s, box-shadow .15s;
}
.related-item:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }

.related-item-img {
  aspect-ratio: 1;
  background: #F5F5F4;
  overflow: hidden;
}
.related-item-img img { width: 100%; height: 100%; object-fit: cover; }

.related-section { margin-top: 36px; }
.related-heading {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-1);
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--primary-muted);
}
.related-item-label {
  font-size: 11px;
  color: var(--text-2);
  padding: 5px 6px;
  line-height: 1.3;
  background: var(--surface);
}

/* Small placeholder for related/card thumbnails */
.ph-sm {
  font-size: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  min-height: 60px;
  color: var(--text-3);
}

/* ================================================
   HOMEPAGE HERO
   ================================================ */

.hero {
  background: linear-gradient(135deg, #FFF7ED 0%, #FFFFFF 60%);
  border: 1.5px solid var(--primary-muted);
  border-radius: var(--radius);
  padding: 40px 36px;
  margin-bottom: 32px;
  display: flex;
  align-items: center;
  gap: 32px;
}
.hero-body { flex: 1; min-width: 0; }
.hero-art { flex: 0 0 240px; }
.hero-art img { width: 100%; height: auto; display: block; }
.hero h1 {
  font-size: 32px;
  font-weight: 900;
  line-height: 1.2;
  color: var(--text);
  margin-bottom: 12px;
  letter-spacing: -.4px;
}
.hero h1 .accent { color: var(--primary); }
.hero p {
  font-size: 16px;
  color: var(--text-2);
  line-height: 1.7;
  margin-bottom: 24px;
}
.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; }
.hero-actions a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 11px 22px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 800;
  text-decoration: none;
  transition: background .15s;
}
.hero-actions .btn-hero-primary { background: var(--primary); color: #fff; }
.hero-actions .btn-hero-primary:hover { background: var(--primary-hover); }
.hero-actions .btn-hero-secondary { background: var(--surface); color: var(--text-2); border: 1.5px solid var(--border); }
.hero-actions .btn-hero-secondary:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-light); }

/* ================================================
   CATEGORY CHIPS (homepage quick nav)
   ================================================ */

.cat-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 28px;
}
.cat-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 7px 14px;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-2);
  text-decoration: none;
  transition: border-color .12s, color .12s, background .12s;
}
.cat-chip:hover, .cat-chip.active {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-light);
}

/* ================================================
   CATEGORY PAGE HEADER
   ================================================ */

.cat-page-header {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 28px;
  margin-bottom: 28px;
  box-shadow: var(--shadow);
  border-left: 4px solid var(--primary);
}
.cat-page-header h1 {
  font-size: 24px;
  font-weight: 900;
  margin-bottom: 10px;
  color: var(--text);
}
.cat-page-header p {
  font-size: 15px;
  color: var(--text-2);
  line-height: 1.7;
  max-width: 640px;
}

/* ================================================
   SIDEBAR LISTS (popular / recent)
   ================================================ */

.sidebar-list { display: flex; flex-direction: column; gap: 10px; }

.sl-item {
  display: flex;
  gap: 10px;
  text-decoration: none;
  color: inherit;
  align-items: flex-start;
  padding: 6px 0;
  border-bottom: 1px solid var(--border);
}
.sl-item:last-child { border-bottom: none; }

.sl-item-text {
  font-size: 13px;
  font-weight: 700;
  line-height: 1.4;
  color: var(--text-2);
}
.sl-item:hover .sl-item-text { color: var(--primary); }

/* ================================================
   PAGINATION
   ================================================ */

.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  margin: 36px 0;
  flex-wrap: wrap;
}
.pagination a, .pagination .pg-current {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  height: 36px;
  padding: 0 10px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 700;
  color: var(--text-2);
  text-decoration: none;
  transition: background .12s;
}
.pagination a:hover { background: var(--primary-light); color: var(--primary); }
.pagination .pg-current { background: var(--primary); color: #fff; }
.pagination .pg-prev, .pagination .pg-next { font-size: 16px; }

/* ================================================
   SEO CONTENT BLOCK
   ================================================ */

.seo-content {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 28px;
  box-shadow: var(--shadow);
  margin-top: 40px;
}
.seo-content h2 {
  font-size: 18px;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 14px;
}
.seo-content p {
  font-size: 15px;
  line-height: 1.75;
  color: var(--text-2);
  margin-bottom: 14px;
}
.seo-content p:last-child { margin-bottom: 0; }

/* ================================================
   FOOTER
   ================================================ */

.site-footer {
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 48px 0 28px;
  margin-top: 64px;
}

.footer-grid {
  display: grid;
  grid-template-columns: 220px 1fr 1fr;
  gap: 40px;
  margin-bottom: 36px;
}

.footer-brand .brand-name {
  font-size: 18px;
  font-weight: 900;
  color: var(--primary);
  margin-bottom: 10px;
}
.footer-brand p { font-size: 13.5px; color: var(--text-2); line-height: 1.6; }

.social-links {
  display: flex;
  gap: 10px;
  margin-top: 14px;
}
.social-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: var(--bg);
  border: 1.5px solid var(--border);
  color: var(--text-2);
  text-decoration: none;
  transition: border-color .12s, color .12s, background .12s;
}
.social-link:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-light); }
.social-link svg { width: 18px; height: 18px; fill: currentColor; }

.footer-col h4 {
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--text-3);
  margin-bottom: 14px;
}
.footer-col ul { display: flex; flex-direction: column; gap: 8px; }
.footer-col ul a {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--text-2);
  transition: color .12s;
}
.footer-col ul a:hover { color: var(--primary); }

.footer-cats {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding-top: 28px;
  border-top: 1px solid var(--border);
  margin-bottom: 28px;
}
.footer-cats a {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text-2);
  padding: 4px 10px;
  background: #F5F5F4;
  border-radius: 999px;
  transition: color .12s, background .12s;
}
.footer-cats a:hover { color: var(--primary); background: var(--primary-light); }

.footer-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13px;
  color: var(--text-3);
  gap: 16px;
  flex-wrap: wrap;
}
.footer-bottom a { color: var(--text-3); transition: color .12s; }
.footer-bottom a:hover { color: var(--primary); }

/* ================================================
   PRINT STYLES
   ================================================ */

@media print {
  .site-header, .sidebar, .action-buttons, .related-grid,
  .section-divider, .seo-content, .site-footer,
  .breadcrumb, .cat-chips, .header-search,
  .detail-sidebar, .tags-list, .page-description { display: none !important; }

  .page-wrapper { padding: 0; }
  .detail-layout { display: block; }

  .detail-image-panel { box-shadow: none; padding: 0; }
  .detail-image-panel img { width: 100%; max-width: 100%; }

  body { background: white; font-size: 12pt; }
  .page-heading { font-size: 18pt; margin-bottom: 6pt; }
}

/* ================================================
   RESPONSIVE
   ================================================ */

@media (max-width: 1024px) {
  :root { --sidebar-w: 196px; }
  .gallery-grid { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); }
  .footer-grid { grid-template-columns: 1fr 1fr; gap: 28px; }
  .footer-brand { grid-column: 1 / -1; }
}

@media (max-width: 768px) {
  .page-wrapper { padding: 16px 16px 40px; gap: 0; }
  .main-content { width: 100%; }

  .sidebar {
    display: none;
    position: fixed;
    top: 64px; left: 0; bottom: 0;
    z-index: 200;
    background: var(--surface);
    box-shadow: var(--shadow-md);
    width: 260px;
    padding: 16px;
    overflow-y: auto;
  }
  .sidebar.open { display: block; }

  .menu-toggle { display: flex; }
  .header-search { display: none; }
  .header-nav { display: none; }

  .hero { padding: 28px 20px; flex-direction: column; gap: 20px; }
  .hero-art { display: none; }
  .hero h1 { font-size: 24px; }
  .hero p { font-size: 14.5px; }

  .detail-layout { grid-template-columns: 1fr; }
  .detail-sidebar { flex-direction: row; flex-wrap: wrap; }
  .action-buttons { flex-direction: row; }

  .gallery-grid { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 10px; }

  .footer-grid { grid-template-columns: 1fr; gap: 24px; }
}

@media (max-width: 480px) {
  .gallery-grid { grid-template-columns: repeat(3, 1fr); gap: 10px; }
  .gc-label { display: none; }
  .page-heading { font-size: 21px; }
  .cat-chips { gap: 6px; }
  .cat-chip { font-size: 12px; padding: 6px 11px; }
}
