/* ============================================================================
   coloring.css
   Dedicated stylesheet for Coloring & Tracing page (coloring_tracing.html)
   Breakpoints:
     Desktop  : >= 1101px  (5 theme columns)
     Laptop   : 993-1100px (4 columns)
     Tablet   : 641-992px  (3 columns)
     Mobile   : <= 767px   (filter tabs hidden)  |  <= 640px (2 columns)
   ============================================================================ */

/* Global Font Override & Containment Guard */
body,
button,
input,
select,
textarea,
.coloring-tracing-page {
  font-family: var(--smw-font-stack);
  -webkit-font-smoothing: antialiased;
}

.coloring-tracing-page {
  overflow-x: hidden;
}

/* Page Scoped Container Adjustments */
.coloring-tracing-page .main-content {
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
  overflow-x: hidden;
}

/* ============================================================================
   HERO SECTION
   ============================================================================ */
.hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  max-width: 100%;
  text-align: left;
  margin: 0 0 1.5rem 0;
  padding: 1.375rem 1.75rem;
  background: oklch(0.95 0.03 264);
  border: 2px solid oklch(0.75 0.12 264);
  border-radius: 1rem;
  box-shadow: 0 1px 2px oklch(0.2 0.035 274 / .03), 0 6px 18px oklch(0.54 0.22 266 / .05);
  box-sizing: border-box;
  overflow: hidden;
  position: relative;
}

/* Fallback for browsers without oklch() support */
@supports not (background: oklch(0.95 0.03 264)) {
  .hero {
    background: #EEF2FD;
    border-color: #9DB2EE;
    box-shadow: 0 6px 18px rgba(47, 95, 238, 0.06);
  }
}

.hero-text {
  width: 100%;
  max-width: 100%;
  display: flex;
  flex-direction: column;
}

.hero-text h1 {
  text-align: center;
  margin: 0 0 0.5rem 0;
  font-size: 1.875rem;
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -0.02em;
  color: #0e2770;
  overflow-wrap: break-word;
}

.color-highlight-blue {
  color: #0e2770;
}

.hero-text p {
  margin: 0 0 1.25rem 0;
  width: 100%;
  max-width: 100%;
  text-align: left;
  font-size: 0.9375rem; /* 15px */
  line-height: 1.5;
  color: #0b205f;
  font-weight: 500;
}

/* Hero Stats Pills */
.hero-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: center;
  width: 100%;
  box-sizing: border-box;
}

.color-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 16px;
  border-radius: 999px;
  background: #ffffff;
  font-size: 13px;
  font-weight: 700;
  color: #1D2A44;
  box-shadow: 0 2px 6px rgba(20, 40, 80, 0.05);
  max-width: 100%;
  box-sizing: border-box;
  white-space: nowrap;
}

.color-pill-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  font-size: 11px;
  flex-shrink: 0;
}

.color-pill-icon svg {
  width: 14px;
  height: 14px;
}

.color-pill--purple .color-pill-icon { background: #EFEAFE; color: #7C3AED; }
.color-pill--pink .color-pill-icon   { background: #FDE8EF; color: #E11D48; }
.color-pill--green .color-pill-icon  { background: #E2F8E9; color: #16A34A; }

/* ============================================================================
   FILTER TABS (static reference pills - visible on tablet & desktop only)
   ============================================================================ */
.filter-tabs {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin: 28px 0;
  flex-wrap: wrap;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

.tab {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: var(--radius-pill, 999px);
  border: 1px solid var(--color-border, #E4E9F2);
  background: #FFFFFF;
  font-size: 14px;
  font-weight: 700;
  color: var(--color-ink, #1B2237);
  box-shadow: 0 1px 2px rgba(20, 30, 60, 0.04);
  cursor: default;
  user-select: none;
  pointer-events: none;
  max-width: 100%;
  box-sizing: border-box;
  white-space: nowrap;
}

.tab svg {
  flex-shrink: 0;
}

.tab-active {
  background: var(--color-blue, #2F5FEE);
  color: #FFFFFF !important;
  border-color: var(--color-blue, #2F5FEE);
}

.tab-active svg {
  stroke: #FFFFFF;
}

/* ============================================================================
   SECTION TITLES
   ============================================================================ */
.section-title {
  font-size: 22px;
  font-weight: 800;
  color: #0e2770;
  margin: 0 0 20px 0;
}

.section-title.center {
  text-align: center;
  margin-bottom: 24px;
}

/* ============================================================================
   BROWSE BY THEME
   ============================================================================ */
.theme-section {
  margin-bottom: 40px;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

.theme-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 18px;
  width: 100%;
  box-sizing: border-box;
}

/* ---------- Card ---------- */
.theme-card {
  --accent: #2563EB;
  --accent-soft: #E1EDFF;
  --frame: #EAF3FF;

  background: #FFFFFF;
  border: 1.5px solid #EEF1F7;
  border-radius: 22px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  min-width: 0;
  width: 100%;
  box-sizing: border-box;
  overflow: visible;
  box-shadow: 0 6px 20px rgba(12, 26, 64, 0.06);
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

/* Hover lift only for devices that really hover (prevents "sticky" hover on touch) */
@media (hover: hover) {
  .theme-card:hover {
    transform: translateY(-5px);
    border-color: var(--accent-soft);
    box-shadow: 0 16px 32px rgba(12, 26, 64, 0.12);
  }

  .theme-card:hover .theme-img-wrap img {
    transform: scale(1.05);
  }

  .theme-btn:hover {
    filter: brightness(0.96);
  }

  .theme-btn:hover .btn-arrow {
    transform: translateX(4px);
  }

  .more-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 24px rgba(20, 30, 60, 0.08);
  }

  .more-link:hover {
    gap: 7px;
    text-decoration: underline;
  }
}

/* ---------- Illustration frame ---------- */
.theme-img-wrap {
  width: 100%;
  aspect-ratio: 4 / 3;
  height: auto;
  border-radius: 16px;
  background: var(--frame);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  margin-bottom: 14px;
}

.theme-img-wrap img {
  width: 100%;
  height: 100%;
  padding: 0;
  object-fit: cover;
  object-position: center;
  image-rendering: auto;
  border-radius: 16px;
  display: block;
  transition: transform 0.35s ease;
}

/* ---------- Title ---------- */
.theme-card-title {
  font-size: 17px;
  font-weight: 800;
  color: #0e2770;
  margin: 0 0 14px 0;
  line-height: 1.25;
  min-height: 2.5em; /* two lines: keeps 1-line and 2-line titles aligned */
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  text-wrap: balance;
  overflow-wrap: break-word;
}

/* ---------- Coloring / Tracing pills ---------- */
.theme-counts-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 14px;
}

.sub-stat {
  border-radius: 14px;
  padding: 10px 4px 9px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border: 1.5px solid transparent;
  min-width: 0;
}

.sub-stat .stat-num {
  font-size: 19px;
  font-weight: 800;
  line-height: 1;
}

.sub-stat .stat-label {
  font-size: 11.5px;
  font-weight: 600;
  margin-top: 4px;
  line-height: 1;
}

.sub-stat--pink  { background: #FFE9ED; border-color: #FFD3DB; }
.sub-stat--pink .stat-num   { color: #E11D48; }
.sub-stat--pink .stat-label { color: #9F1239; }

.sub-stat--green { background: #E4F9EA; border-color: #C9F0D4; }
.sub-stat--green .stat-num   { color: #16A34A; }
.sub-stat--green .stat-label { color: #166534; }

/* ---------- Explore Theme button ---------- */
.theme-btn {
  margin-top: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 12px;
  border: none;
  border-radius: 13px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 14px;
  font-weight: 700;
  text-align: center;
  text-decoration: none;
  box-sizing: border-box;
  transition: filter 0.2s ease;
}

.theme-btn:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}

.theme-btn .btn-arrow {
  flex-shrink: 0;
  transition: transform 0.2s ease;
}

/* ---------- Color variants ---------- */
.theme-card--blue   { --accent: #2563EB; --accent-soft: #E1EDFF; --frame: #EAF3FF; }
.theme-card--pink   { --accent: #E11D48; --accent-soft: #FFE4E9; --frame: #FFEEF2; }
.theme-card--purple { --accent: #7C3AED; --accent-soft: #EEE5FF; --frame: #F3EBFF; }
.theme-card--orange { --accent: #EA580C; --accent-soft: #FFEFD6; --frame: #FFF4DE; }
.theme-card--green  { --accent: #16A34A; --accent-soft: #DFF7E6; --frame: #E8F9EC; }

/* ============================================================================
   WHY COLORING & TRACING HELPS
   ============================================================================ */
.why-section {
  margin-bottom: 40px;
  width: 100%;
  box-sizing: border-box;
}

.why-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
  width: 100%;
  box-sizing: border-box;
}

.why-card {
  border-radius: var(--radius-md, 16px);
  padding: 20px;
  border: 1px solid transparent;
  min-width: 0;
  box-sizing: border-box;
}

.why-purple { background: #F5F1FE; border-color: #E9E0FA; }
.why-green  { background: #EEFBF4; border-color: #D7F5E5; }
.why-yellow { background: #FEF9E9; border-color: #FDF0C8; }

.why-icon {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: #FFFFFF;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 14px;
  box-shadow: 0 1px 3px rgba(20, 30, 60, 0.05);
}

.why-card h3 {
  font-size: 16px;
  font-weight: 800;
  color: #0e2770;
  margin: 0 0 6px 0;
}

.why-card p {
  font-size: 13.5px;
  color: var(--color-ink-soft, #5B6478);
  line-height: 1.5;
  margin: 0;
}

/* ============================================================================
   EXPLORE MORE ACTIVITIES
   ============================================================================ */
.more-section {
  margin-bottom: 40px;
  width: 100%;
  box-sizing: border-box;
}

.more-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 18px;
  width: 100%;
  box-sizing: border-box;
}

.more-card {
  border-radius: var(--radius-md, 16px);
  padding: 20px;
  display: flex;
  flex-direction: column;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  min-width: 0;
  box-sizing: border-box;
}

.more-yellow { background: #FFF7E0; }
.more-blue   { background: #EAF2FF; }
.more-gray   { background: #F3F4F6; }
.more-pink   { background: #FDEDF6; }

.more-icon {
  height: 54px;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  margin-bottom: 12px;
}

.more-icon img {
  max-height: 54px;
  width: auto;
  object-fit: contain;
  display: block;
}

.more-card h3 {
  font-size: 16px;
  font-weight: 800;
  margin: 0 0 6px 0;
  color: #0e2770;
}

.more-card p {
  font-size: 13px;
  color: var(--color-ink-soft, #5B6478);
  line-height: 1.45;
  margin: 0 0 14px 0;
  flex: 1;
}

.more-link {
  font-size: 13px;
  font-weight: 700;
  color: var(--color-blue, #2F5FEE);
  display: inline-flex;
  align-items: center;
  gap: 4px;
  text-decoration: none;
  transition: gap 0.15s ease;
}

/* ============================================================================
   TRUST BAR
   ============================================================================ */
.trust-bar {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 20px;
  border-top: 1px solid var(--color-border, #E4E9F2);
  padding: 28px 0 12px 0;
  width: 100%;
  box-sizing: border-box;
}

.trust-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  min-width: 0;
}

.trust-item svg {
  flex-shrink: 0;
  margin-top: 2px;
}

.trust-item div {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.trust-item strong {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--color-ink, #1B2237);
  margin-bottom: 2px;
}

.trust-item span {
  font-size: 12px;
  color: var(--color-ink-soft, #5B6478);
  line-height: 1.4;
}

/* ============================================================================
   RESPONSIVE (desktop-first, widest to narrowest)
   ============================================================================ */

/* Large phones / small tablets and up: bigger hero title */
@media (min-width: 640px) {
  .hero-text h1 {
    font-size: 2.125rem;
  }
}

/* ---------- Laptop: 4 columns ---------- */
@media (max-width: 1100px) {
  .theme-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
  }
}

/* ---------- Tablet: 3 columns ---------- */
@media (max-width: 992px) {
  .theme-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .more-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .trust-bar {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
  }

  /* "Why" cards stay 3-up on tablet; they stack only on real mobile (below) */
  .why-grid {
    gap: 14px;
  }

  .why-card {
    padding: 16px;
  }
}

/* ---------- Mobile & small tablet (<= 767px) ---------- */
@media (max-width: 767.98px) {
  .hero {
    margin-bottom: 1rem;
    padding: 1rem;
    border-radius: 0.875rem;
  }

  .hero-text h1 {
    font-size: 1.5rem;
    text-align: left;
  }

  .hero-text p {
    font-size: 0.875rem;
  }

  /* >>> Hide "All Worksheets / Coloring / Tracing" pills on mobile only <<< */
  .filter-tabs {
    display: none !important;
  }

  /* Filter tabs are gone, so give the section title the breathing room */
  .theme-section {
    margin-top: 0.25rem;
  }

  .section-title {
    font-size: 20px;
    margin-bottom: 16px;
  }

  .theme-grid {
    gap: 12px;
  }

  .theme-card {
    padding: 12px;
    border-radius: 18px;
  }

  .theme-img-wrap {
    margin-bottom: 12px;
  }

  .theme-card-title {
    font-size: 15px;
    margin-bottom: 12px;
  }

  .why-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* ---------- Mobile: 2 columns ---------- */
@media (max-width: 640px) {
  .theme-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* ---------- Small phones ---------- */
@media (max-width: 480px) {
  .hero {
    padding: 0.875rem;
  }

  .hero-text h1 {
    font-size: 22px;
  }

  .hero-stats {
    gap: 6px;
  }

  .color-pill {
    font-size: 11.5px;
    padding: 5px 10px;
    gap: 6px;
  }

  .theme-grid {
    gap: 10px;
  }

  .theme-card {
    padding: 10px;
  }

  .theme-img-wrap {
    border-radius: 12px;
  }

  .theme-img-wrap img {
    border-radius: 12px;
  }

  .theme-card-title {
    font-size: 14px;
  }

  .theme-counts-grid {
    gap: 6px;
  }

  .sub-stat .stat-num {
    font-size: 16px;
  }

  .sub-stat .stat-label {
    font-size: 10.5px;
  }

  .theme-btn {
    padding: 10px 6px;
    font-size: 12.5px;
    gap: 5px;
  }

  .more-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .trust-bar {
    grid-template-columns: minmax(0, 1fr);
    gap: 14px;
  }
}

/* ---------- Very small phones (<= 360px) ---------- */
@media (max-width: 360px) {
  .hero-text h1 {
    font-size: 20px;
  }

  .color-pill {
    font-size: 11px;
    padding: 4px 8px;
  }

  .sub-stat .stat-label {
    font-size: 10px;
  }

  .theme-btn {
    font-size: 12px;
  }
}

/* Respect users who prefer reduced motion */
@media (prefers-reduced-motion: reduce) {
  .theme-card,
  .theme-img-wrap img,
  .theme-btn,
  .theme-btn .btn-arrow,
  .more-card,
  .more-link {
    transition: none !important;
  }

  .theme-card:hover,
  .more-card:hover {
    transform: none !important;
  }

  .theme-card:hover .theme-img-wrap img {
    transform: none !important;
  }
}