/*
Theme Name: Coloringjoy
Theme URI: https://coloringjoy.org
Author: Nouman
Author URI: https://coloringjoy.org
Description: A super fast, modern, and responsive coloring pages theme inspired by Creative Kids Color.
Version: 1.0
License: GNU General Public License v2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
*/

/* Sticky Header */
.site-header {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  z-index: 1000;
  background: rgba(255, 255, 255, 0.98);
  transition: all 0.3s ease-in-out;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  transform: translateY(0);
}

/* Hide header when scrolling down, show when scrolling up */
.site-header.hide {
  transform: translateY(-100%);
}

/* Add padding to body to prevent content from being hidden behind fixed header */
body {
  padding-top: 80px; /* Adjust this value based on your header height */
}

/* Account for WordPress admin bar */
body.admin-bar .site-header {
  top: 32px;
}

/* Add a more prominent shadow when scrolled */
.header.scrolled {
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

/* Dropdown Menu Styles */
.nav-menu .main-menu {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  align-items: center;
  gap: 2rem;
}

.nav-menu .menu-item {
  position: relative;
  margin: 0;
  padding: 0;
}

.nav-menu .menu-item > a {
  color: #3a4555;
  text-decoration: none;
  font-weight: 500;
  font-size: 1rem;
  padding: 0.5rem 0;
  position: relative;
  transition: color 0.2s ease;
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.nav-menu .menu-item > a:hover {
  color: #4a90e2;
}

/* Dropdown indicator */
.nav-menu .menu-item-has-children > a::after {
  content: '▼';
  font-size: 0.5rem;
  margin-left: 0.25rem;
  transition: transform 0.2s ease;
  display: inline-block;
}

/* Dropdown menu */
.nav-menu .sub-menu {
  position: absolute;
  top: 100%;
  left: -1rem;
  background: #ffffff;
  min-width: 220px;
  border-radius: 8px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px);
  transition: all 0.3s ease;
  z-index: 1000;
  padding: 0.5rem 0;
  border: 1px solid #f0f0f0;
}

.nav-menu .menu-item:hover > .sub-menu,
.nav-menu .menu-item:focus-within > .sub-menu,
.nav-menu .menu-item.dropdown-open > .sub-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.nav-menu .sub-menu .menu-item {
  margin: 0;
  padding: 0;
}

.nav-menu .sub-menu a {
  color: #3a4555;
  padding: 0.6rem 1.5rem;
  display: block;
  text-decoration: none;
  transition: all 0.2s ease;
  font-size: 0.95rem;
  white-space: nowrap;
}

.nav-menu .sub-menu a:hover {
  background: #f8f9fa;
  color: #4a90e2;
  padding-left: 1.75rem;
}

/* Mobile menu styles */
@media (max-width: 1023px) {
  .nav-menu {
    position: fixed;
    top: 80px;
    left: 0;
    right: 0;
    bottom: 0;
    background: #ffffff;
    padding: 1.5rem 1rem;
    transform: translateX(100%);
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    overflow-y: auto;
    z-index: 999;
    height: calc(100vh - 80px);
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    box-shadow: -4px 0 20px rgba(0, 0, 0, 0.1);
    border-left: 1px solid rgba(0, 0, 0, 0.05);
    /* Hide scrollbar for WebKit browsers */
    -ms-overflow-style: none;  /* IE and Edge */
    scrollbar-width: none;  /* Firefox */
  }
  
  /* Hide scrollbar for Chrome, Safari and Opera */
  .nav-menu::-webkit-scrollbar {
    width: 6px;
  }
  
  /* Show scrollbar track */
  .nav-menu::-webkit-scrollbar-track {
    background: #f8f9fa;
    border-radius: 10px;
    margin: 1rem 0;
  }
  
  /* Style scrollbar thumb */
  .nav-menu::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 10px;
    background-clip: padding-box;
    border: 2px solid transparent;
  }
  
  /* Hover effect for scrollbar thumb */
  .nav-menu::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
  }
  
  /* Active state for scrollbar thumb */
  .nav-menu::-webkit-scrollbar-thumb:active {
    background: #888;
  }
  
  /* Adjust for larger tablets */
  @media (min-width: 768px) and (max-width: 1023px) {
    .nav-menu {
      width: 100%;
      max-width: 100%;
      padding: 2rem 10%;
    }
    
    .nav-menu .main-menu {
      max-width: 600px;
      margin: 0 auto;
    }
  }

  .nav-menu.open {
    transform: translateX(0);
  }

  .nav-menu .main-menu {
    flex-direction: column;
    align-items: stretch;
    gap: 0.25rem;
    padding: 0;
    margin: 0;
  }

  .nav-menu .menu-item {
    width: 100%;
    margin: 0;
    transition: background-color 0.2s ease;
    border-radius: 8px;
  }
  
  .nav-menu .menu-item:not(:last-child) {
    margin-bottom: 0.25rem;
  }

  .nav-menu .menu-item > a {
    display: flex;
    align-items: center;
    padding: 0.875rem 1rem;
    width: 100%;
    color: #2d3748;
    text-decoration: none;
    font-weight: 500;
    font-size: 1rem;
    transition: all 0.2s ease;
    border-radius: 8px;
  }
  
  .nav-menu .menu-item > a:hover {
    background-color: #f7fafc;
    color: #4a5568;
  }

  .nav-menu .sub-menu {
    position: static;
    display: none;
    box-shadow: none;
    border: none;
    opacity: 1;
    visibility: visible;
    transform: none;
    padding: 0.5rem 0 0.5rem 1rem;
    margin: 0.25rem 0 0.5rem 0.5rem;
    border-left: 2px solid #e2e8f0;
    background: rgba(247, 250, 252, 0.5);
    border-radius: 0 8px 8px 0;
  }

  .nav-menu .menu-item.dropdown-open > .sub-menu {
    display: block;
    animation: fadeIn 0.2s ease-out;
  }
  
  @keyframes fadeIn {
    from { opacity: 0; transform: translateY(-5px); }
    to { opacity: 1; transform: translateY(0); }
  }

  .nav-menu .sub-menu a {
    padding: 0.5rem 0.75rem;
    font-size: 0.925rem;
    color: #4a5568;
    display: block;
    border-radius: 6px;
    margin: 0.125rem 0;
    transition: all 0.2s ease;
  }

  .nav-menu .sub-menu a:hover {
    background: #edf2f7;
    color: #2b6cb0;
    padding-left: 1rem;
  }
}

/* Reset and base styles */
html, body {
  margin: 0;
  padding: 0;
  font-family: 'Inter', Arial, sans-serif;
  background: #fff;
  color: #3a4555;
  font-size: 16px;
  line-height: 1.6;
  overflow-x: hidden;
}

.header-inner img {
  width: 210px	
  }
img {
  max-width: 100%;
  height: auto;
  display: block;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding-left: 26px;
  padding-right: 26px;
  box-sizing: border-box;
}

.category-rich-content,
.entry-content,
.page-content,
.entry-summary,
.entry-content p,
.page-content p,
.entry-summary p {
  font-size: 1rem;
  line-height: 1.6;
  color: #3a4555;
}

/* Single post title color */
.entry-title,
.page-title {
  color: #3a4555;
}

/* Category page title */
.archive-title,
.page-header h1 {
  color: #3a4555;
}
/* Featured Categories */
.featured-categories {
  padding: 2rem 0 4rem;
  background: #ffffff;
}

.category-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 2rem;
  margin-top: 2rem;
  padding-left: 26px;
  padding-right: 26px;
}

.category-card {
  background: white;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
  transition: all 0.3s ease;
  text-decoration: none;
  color: inherit;
}

.category-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
}

.category-image {
  position: relative;
  padding-top: 75%; /* 4:3 aspect ratio */
  overflow: hidden;
}

.category-image img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s ease;
}

.category-card:hover .category-image img {
  transform: scale(1.05);
}

.category-content {
  padding: 14px;
  text-align: center;
}

.category-title {
  font-size: 1.1rem;
  font-weight: 600;
  margin: 0;
  color: #2d3748;
}

/* --- Post Grid Layout --- */
.post-front-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
  margin: 2rem 0;
  max-width: 1200px;
  margin-left: auto;
  margin-right: auto;
}

/* Post Card Styles */
.post-card {
  display: flex;
  flex-direction: column;
  background: #fff;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
  transition: all 0.3s ease;
  text-decoration: none;
  color: inherit;
  height: 100%;
}

.post-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
}

.post-card__image {
  position: relative;
  padding-top: 50%; /* 4:3 aspect ratio */
  overflow: hidden;
}

.post-card__image img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: auto;
  object-fit: cover;
  transition: transform 0.5s ease;
}

.post-card:hover .post-card__image img {
  transform: scale(1.05);
}

.post-card__content {
  padding: 14px;
  text-align: center;
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.post-card__title {
  font-size: 1.1rem;
  font-weight: 600;
  margin: 0;
  color: #2d3748;
  line-height: 1.3;
}

/* For tablet and mobile (below 1200px) - 2 columns */
@media (max-width: 1200px) {
  .post-front-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 15px;
    padding: 0 10px;
    max-width: 100%;
  }
  
  .post-card {
    width: 100%;
    height: 0;
    padding-bottom: 80%;
    position: relative;
  }
  
  .post-card__image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    padding-top: 0;
  }
  
  .post-card__content {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(255, 255, 255, 0.9);
  }
}

/* Ensure 2 columns on all mobile devices */
@media (max-width: 768px) {
  .post-front-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 12px;
    padding: 0 8px;
  }
}

/* For very small devices */
@media (max-width: 480px) {
  .post-front-grid {
    gap: 8px;
    padding: 0 4px;
  }
}

/* Latest Added Coloring Pages */
.latest-pages {
  background: #ffffff;
  width: 100%;
  overflow: hidden;
}

.latest-pages h2 {
  text-align: center;
  font-size: 1.75rem;
  margin-bottom: 1.5rem;
  color: #1a202c;
  font-weight: 700;
}

.popular-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 2rem;
  margin-top: 2rem;
  width: 100%;
  padding-left: 0;
  padding-right: 0;
}

.popular-card, .latest-card {
  background: white;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
  transition: all 0.3s ease;
  text-decoration: none;
  color: inherit;
  position: relative;
  width: 280px;
  height: 185px;
  display: flex;
  flex-direction: column;
}

.popular-card:hover, .latest-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
}

.popular-image, .latest-image {
  width: 100%;
  height: 140px; /* 185px total height - 45px for title */
  overflow: hidden;
  flex-shrink: 0;
}

.popular-image img, .latest-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.popular-card:hover .popular-image img,
.latest-card:hover .latest-image img {
  transform: scale(1.05);
}

.popular-title, .latest-title {
  margin: 0;
  text-align: center;
  background: white;
  font-size: 1.1rem;
  font-weight: 600;
  color: #2d3748;
  border-top: 1px solid #f1f5f9;
  height: 45px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 90%; /* Reduce width so ellipsis appears sooner */
  margin: 0 auto;
}

/* Responsive adjustments */
@media (max-width: 900px) {
  .popular-grid {
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(2, 1fr);
    gap: 1.5rem;
    padding: 0 1rem;
    min-height: 300px; /* Adjusted for responsive */
  }
  
  .latest-grid {
    grid-template-columns: repeat(3, 1fr);
    grid-auto-rows: minmax(185px, auto);
    gap: 1.5rem;
    padding: 0 1rem;
  }
  
  .popular-card, .latest-card {
    width: 100%;
    height: 100%;
    min-height: 185px;
  }
}

@media (max-width: 768px) {
  .popular-grid {
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(2, 1fr);
    gap: 1rem;
  }
  
  .latest-grid {
    grid-template-columns: repeat(3, 1fr);
    grid-auto-rows: minmax(160px, auto);
    gap: 1rem;
  }
}

@media (max-width: 600px) {
  .popular-grid {
    grid-template-columns: repeat(2, 1fr);
    grid-template-rows: repeat(3, 1fr); /* 2x3 layout on mobile */
    gap: 1rem;
  }
  
  .latest-grid {
    grid-template-columns: repeat(2, 1fr);
    grid-auto-rows: minmax(160px, auto);
    gap: 1rem;
  }
}

@media (max-width: 1024px) {
  .category-grid {
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 1.5rem;
  }
}



@media (max-width: 768px) {
  .featured-categories {
    padding: 1.5rem 0 3rem;
  }
  
  .category-grid {
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 1.25rem;
  }
  
  .popular-grid {
    grid-template-columns: repeat(3, 1fr);
    max-width: 100%;
  }
  
  .latest-pages h2 {
    font-size: 1.5rem;
    margin-bottom: 1.25rem;
  }
}

@media (max-width: 600px) {
  .popular-grid {
    grid-template-columns: repeat(2, 1fr);
    max-width: 100%;
    gap: 15px;
    padding: 0 10px;
  }
  
  .popular-card {
    padding-bottom: 150%; /* Adjust aspect ratio for mobile */
  }
}

@media (max-width: 480px) {
  .category-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
  }
  
  .latest-pages h2 {
    font-size: 1.35rem;
    margin-bottom: 1rem;
  }
  
  .popular-title {
    font-size: 0.9rem;
    padding: 10px 6px;
  }
}

/* --- Modern Responsive Dropdown Header --- */
.header {
  width: 100%;
  background: #fff;
  position: relative;
  z-index: 100;
  box-shadow: 0 2px 10px rgba(0,0,0,0.04);
}
/* --- Responsive Dropdown Header Fix --- */
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0.5rem 1.5rem 0.5rem 0.5rem;
  min-height: 64px;
  position: relative;
  gap: 1.5rem;
}
.logo {
  width: auto;
  max-width: none;
  height: auto;
  margin-right: 0;
  display: flex;
  align-items: center;
}
.logo img, .logo-svg svg {
  width: 210px;
  height: auto;
}
.logo-text {
  font-size: 1.35rem;
  margin-left: 0.5rem;
}
.logo-sub {
  font-size: 0.85rem;
  font-weight: 400;
  color: #4d7edc;
  letter-spacing: 0.1em;
  text-transform: lowercase;
}
.hamburger {
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  width: 44px;
  height: 44px;
  background: none;
  border: none;
  cursor: pointer;
  z-index: 201;
  margin-left: 10px;
}
.hamburger-bar {
  width: 28px;
  height: 4px;
  background: #222;
  border-radius: 2px;
  margin: 3px 0;
  transition: all 0.3s;
}
.nav-menu {
  display: flex;
  align-items: center;
  gap: 2rem;
  position: static;
  background: none;
  box-shadow: none;
  padding: 0;
  transition: none;
  vertical-align: middle;
}
.main-menu {
  display: flex;
  flex-direction: row;
  gap: 2rem;
  list-style: none;
  padding: 0;
  margin: 0;
  align-items: center;
  vertical-align: middle;
}
.main-menu li {
  position: relative;
}
.main-menu a {
  color: #222;
  text-decoration: none;
  font-size: 1.08rem;
  font-weight: 500;
  padding: 0.5rem 0.25rem;
  border-radius: 4px;
  transition: background 0.2s, color 0.2s;
  display: block;
}
.main-menu a:focus, .main-menu a:hover {
  background: #e0edff;
  color: #2563eb;
  outline: none;
}
.header-btn {
  background: #2563eb;
  color: #fff;
  font-weight: 700;
  font-size: 1rem;
  border-radius: 6px;
  padding: 0.6rem 1.4rem;
  margin-left: 1.5rem;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  box-shadow: 0 2px 8px rgba(37,99,235,0.08);
  transition: background 0.2s, box-shadow 0.2s;
  border: none;
  cursor: pointer;
  white-space: nowrap;
}
.header-btn:hover, .header-btn:focus {
  background: #174bbd;
  color: #fff;
  box-shadow: 0 4px 16px rgba(37,99,235,0.12);
}
.desktop-only { display: flex !important; }
.mobile-only { display: none !important; }
.menu-item-has-children > a {
  display: flex;
  align-items: center;
  gap: 0.3em;
}
.menu-item-has-children > a .dropdown-arrow {
  font-size: 0.8em;
  margin-left: 0.2em;
}
.sub-menu {
  display: none;
  position: absolute;
  left: 0;
  top: 100%;
  min-width: 180px;
  background: #fff;
  box-shadow: 0 8px 32px rgba(37,99,235,0.10);
  border-radius: 8px;
  padding: 0.5rem 0;
  z-index: 1002;
  flex-direction: column;
  gap: 0;
}
.menu-item-has-children:hover > .sub-menu,
.menu-item-has-children:focus-within > .sub-menu {
  display: block;
}
.sub-menu li {
  width: 100%;
}
.sub-menu a {
  padding: 0.5rem 1.2rem;
  font-size: 1rem;
  color: #222;
  border-radius: 0;
}
.sub-menu a:hover, .sub-menu a:focus {
  background: #e0edff;
  color: #2563eb;
}
.nav-overlay {
  display: none;
}
@media (max-width: 1200px) {
  .header-inner {
    padding: 0.5rem 0.5rem;
  }
}
@media (max-width: 1023px) {
  .header-inner {
    gap: 0.5rem;
  }
  .nav-menu {
    position: absolute;
    left: 0;
    right: 0;
    top: 100%;
    width: 100vw;
    background: #fff;
    box-shadow: 0 8px 32px rgba(37,99,235,0.10);
    z-index: 1102;
    display: none;
    flex-direction: column;
    align-items: flex-start;
    padding: 1rem 0 1.5rem 0;
    transition: none;
    gap: 0;
  }
  .nav-menu.open {
    display: flex;
  }
  .main-menu {
    flex-direction: column;
    gap: 0.5rem;
    width: 100%;
    align-items: flex-start;
    padding: 0 1.5rem;
  }
  .main-menu li {
    width: 100%;
  }
  .sub-menu {
    position: static;
    min-width: 0;
    box-shadow: none;
    border-radius: 0;
    padding: 0.2rem 0 0.2rem 1.2rem;
    background: #f8fbff;
    display: none;
  }
  .menu-item-has-children.dropdown-open > .sub-menu {
    display: flex;
  }
  .menu-item-has-children > a .dropdown-arrow {
    transform: rotate(90deg);
    transition: transform 0.2s;
  }
  .menu-item-has-children.dropdown-open > a .dropdown-arrow {
    transform: rotate(-90deg);
  }
  .hamburger {
    display: flex;
  }
  .header-btn.desktop-only { display: none !important; }
  .header-btn.mobile-only { display: flex !important; margin: 1rem 0 0 0; width: 100%; justify-content: center; }
  .nav-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; width: 100vw; height: 100vh;
    background: rgba(18,23,55,0.18);
    z-index: 1100;
    transition: opacity 0.3s;
    opacity: 1;
    pointer-events: auto;
  }
  body.menu-open .nav-overlay {
    display: block;
  }
}
@media (max-width: 600px) {
  .header-inner {
    padding: 0.3rem 0.2rem;
    min-height: 48px;
  }
  .logo {
    width: auto;
    max-width: none;
    height: auto;
    margin-right: 0;
  }
  .logo img, .logo-svg svg {
    width: 210px;
    height: auto;
  }
  .logo-text {
    font-size: 1.35rem;
    margin-left: 0.5rem;
  }
  .header-btn {
    font-size: 0.95rem;
    padding: 0.5rem 1rem;
  }
}

/* Hero Section */
.hero-section {
  background: linear-gradient(135deg, #e0edff 0%, #f8fbff 100%);
  padding: 32px 0 24px 0;
  text-align: center;
}
.hero-section h1 {
  font-size: 2.6rem;
  font-weight: 800;
  color: #2563eb;
  margin-bottom: 18px;
  line-height: 1.1;
}
.hero-section .highlight {
  color: #ff7a59;
}
.hero-section p {
  font-size: 1.15rem;
  color: #555;
  margin-bottom: 32px;
}

/* Responsive Hero Section */
@media (max-width: 900px) {
  .hero-section {
    padding: 24px 0 18px 0;
  }
  .hero-section h1 {
    font-size: 2.1rem;
  }
  .hero-section p {
    font-size: 1rem;
    margin-bottom: 24px;
  }
  .search-form input[type="search"] {
    padding: 14px 18px;
    font-size: 1rem;
  }
}

@media (max-width: 600px) {
  .hero-section {
    padding: 16px 0 10px 0;
  }
  .hero-section h1 {
    font-size: 1.35rem;
    margin-bottom: 10px;
  }
  .hero-section p {
    font-size: 0.98rem;
    margin-bottom: 16px;
    padding: 0 8px;
  }
  .search-form {
    max-width: 100%;
    padding: 0 6px;
  }
  .search-form input[type="search"] {
    padding: 10px 12px;
    font-size: 0.96rem;
  }
}

.search-form {
  max-width: 600px;
  margin: 0 auto;
}
.search-form input[type="search"] {
  width: 100%;
  padding: 18px 28px;
  border: 1.5px solid #bcd0ee;
  border-radius: 32px;
  font-size: 1.1rem;
  outline: none;
  background: #fff;
  transition: border-color 0.2s;
}
.search-form input[type="search"]:focus {
  border-color: #2563eb;
}

/* Featured Categories Grid */
.featured-categories {
  margin-top: 0;
  margin-bottom: 0;
  padding-top: 2rem;
  padding-bottom: 2rem;
}
.category-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 28px;
}
.category-card {
  background: #fff;
  border-radius: 18px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.07);
  overflow: hidden;
  text-align: center;
  transition: transform 0.2s, box-shadow 0.2s;
  cursor: pointer;
}
.category-card:hover {
  transform: translateY(-6px) scale(1.03);
  box-shadow: 0 8px 32px rgba(37,99,235,0.10);
}
.category-card img {
  width: 100%;
  height: 140px;
  object-fit: cover;
  border-bottom: 1px solid #f1f5f9;
}
.category-title {
  font-weight: 600;
  color: #121737;
  font-size: 1.08rem;
}

/* Popular & Latest Coloring Pages */

.popular-pages h2, .latest-pages h2 {
  font-size: 1.6rem;
  font-weight: 700;
  margin: 40px 0 18px 0;
  color: #222;
  text-align: left;
}
.popular-grid, .latest-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 24px;
}
.popular-card, .latest-card {
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
  overflow: hidden;
  text-align: center;
  transition: transform 0.2s, box-shadow 0.2s;
}
.popular-card:hover, .latest-card:hover {
  transform: translateY(-4px) scale(1.02);
  box-shadow: 0 6px 20px rgba(37,99,235,0.10);
}
.popular-card img, .latest-card img {
  width: 100%;
  height: 140px;
  object-fit: cover;
  border-bottom: 1px solid #f1f5f9;
}
.popular-title, .latest-title {
  font-weight: 600;
  color: #121737;
  font-size: 1.08rem;
}
.popular-title, .latest-title {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: block;
  max-width: 90%; /* Reduce width so ellipsis appears sooner */
  margin: 0 auto;
  padding: 8px;
}

/* ColorJoy Section - Improved */
.colorjoy {
  display: flex;
  flex-wrap: wrap;
  gap: 48px;
  align-items: center;
  margin: 32px 0 28px 0;
  background: #fff;
  border-radius: 18px;
  box-shadow: 0 2px 12px rgba(37,99,235,0.06);
  padding: 36px 32px;
  max-width: 1200px;
  margin-left: auto;
  margin-right: auto;
}
.colorjoy-content {
  flex: 1 1 340px;
  min-width: 260px;
  padding: 0 12px;
}
.colorjoy-content h2 {
  font-size: 1.7rem;
  font-weight: 700;
  margin-bottom: 18px;
  color: #222;
}
.colorjoy-content p {
  font-size: 1.08rem;
  color: #444;
  line-height: 1.7;
}
.colorjoy-content strong {
  color: #2563eb;
}
.colorjoy-image {
  flex: 1 1 320px;
  min-width: 220px;
  text-align: right;
  padding: 0 12px;
}
.colorjoy-image img {
  max-width: 340px;
  width: 100%;
  border-radius: 16px;
  box-shadow: 0 8px 32px rgba(37,99,235,0.10);
}
@media (max-width: 900px) {
  .colorjoy {
    gap: 24px;
    padding: 24px 8px;
  }
}
@media (max-width: 600px) {
  .colorjoy {
    flex-direction: column;
    gap: 18px;
    text-align: center;
    padding: 18px 4px;
    margin: 18px 0 18px 0;
  }
  .colorjoy-content,
  .colorjoy-image {
    min-width: 0;
    width: 100%;
    padding: 0;
    text-align: center;
  }
  .colorjoy-image img {
    max-width: 100%;
    margin: 0 auto;
  }
}

/* Footer Redesign */
.site-footer {
  background: #ebf3ff;
  color: #121737;
  border-top: 1px solid #dbe7ff;
  font-size: 1rem;
  margin-top: 40px;
}
.footer-content {
  display: flex;
  flex-wrap: wrap;
  gap: 2.5rem;
  justify-content: space-between;
  padding: 2.5rem 0 1.5rem 0;
}
.footer-section {
  flex: 1 1 180px;
  min-width: 180px;
}
.footer-brand {
  flex: 1 1 220px;
  min-width: 220px;
  max-width: 260px;
}
.footer-logo-row {
  display: flex;
  align-items: center;
  margin-bottom: 1rem;
}
.footer-logo-icon {
  width: 2rem;
  height: 2rem;
  margin-right: 0.75rem;
  background: #121737;
  border-radius: 0.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
}
.footer-logo-text {
  font-size: 1.25rem;
  font-weight: 700;
  color: #121737;
}
.footer-about {
  color: #121737;
  margin-bottom: 1rem;
  line-height: 1.6;
  font-size: 1rem;
}
.footer-social {
  display: flex;
  gap: 0.75rem;
}
.footer-social-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  background: #fff;
  color: #121737;
  border-radius: 0.5rem;
  border: 1px solid #dbe7ff;
  transition: background 0.2s, color 0.2s, box-shadow 0.2s;
  font-size: 1.2rem;
}
.footer-social-icon:hover {
  background: #dbe7ff;
  color: #2563eb;
  box-shadow: 0 2px 8px rgba(37,99,235,0.10);
}
.footer-section .footer-heading strong {
  font-size: 1.08rem;
  margin-bottom: 12px;
  color: #121737;
  display: block;
  font-weight: 700;
}
.footer-links {
  list-style: none;
  padding: 0;
  margin: 0;
}
.footer-links li {
  margin-bottom: 8px;
}
.footer-links a {
  color: #121737;
  text-decoration: none;
  transition: color 0.2s;
  font-weight: 500;
}
.footer-links a:hover {
  color: #2563eb;
}
.footer-newsletter-desc {
  color: #121737;
  margin-bottom: 1rem;
  font-size: 0.95rem;
}
.newsletter-form {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
}
.newsletter-form input[type="email"] {
  flex: 1;
  padding: 0.5rem 0.75rem;
  border: 1px solid #dbe7ff;
  border-radius: 0.5rem;
  background: #fff;
  color: #121737;
  font-size: 0.95rem;
  outline: none;
}
.newsletter-form button {
  background: #121737;
  color: #fff;
  padding: 0.5rem 1rem;
  border-radius: 0.5rem;
  border: none;
  font-weight: 500;
  font-size: 0.95rem;
  cursor: pointer;
  transition: background 0.2s;
}
.newsletter-form button:hover {
  background: #2563eb;
}
.footer-bottom {
  text-align: center;
  padding: 1.5rem 0 0.5rem 0;
  color: #121737;
  font-size: 0.98rem;
  background: none;
  border: none;
}
.footer-bottom p {
  margin: 0;
}
@media (max-width: 900px) {
  .footer-content {
    flex-direction: column;
    gap: 2rem;
    padding: 2rem 0 1rem 0;
  }
  .footer-section {
    min-width: 0;
    max-width: 100%;
  }
  .footer-brand {
    max-width: 100%;
  }
}

/* Grid Spacing Fixes */
.category-grid, .popular-grid, .latest-grid {
  gap: 1.2rem;
  margin-top: 1.2rem;
}


/* Section Alignment Fixes */
.featured-categories, .popular-pages, .latest-pages, .colorjoy {
  width: 100%;
  box-sizing: border-box;
}

/* --- Responsive Enhancements --- */
@media (mini-width: 900px) {
  .container {
    padding-left: 26px;
    padding-right: 26px;
  }
  .category-grid, .popular-grid, .latest-grid {
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
  }
  /* --- Post Front Grid Responsive Fix --- */
.post-front-grid {
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 28px !important;
    margin-top: 2rem !important;
  }
  .colorjoy {
    flex-direction: column;
    gap: 24px;
    text-align: center;
    padding: 28px 8px;
  }
  .colorjoy-image {
    text-align: center;
  }
  .footer-content {
    flex-direction: column;
    gap: 2rem;
    padding: 2rem 0 1rem 0;
  }
  .footer-section {
    min-width: 0;
    max-width: 100%;
  }
  .footer-brand {
    max-width: 100%;
  }
}
@media (max-width: 600px) {
  .container {
    padding-left: 26px;
    padding-right: 26px;
  }
  .category-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(4, 1fr);
    gap: 0.75rem;
    margin-top: 0.5rem;
  }
  .popular-grid, .latest-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    grid-template-rows: repeat(3, 1fr);
    gap: 1.25rem;
    margin-top: 0.5rem;
  }
  /* --- Post Front Grid Responsive Fix --- */
.post-front-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(2, 1fr);
  gap: 32px;
  margin-top: 2rem;
}

@media (max-width: 600px) {
  .post-front-grid {
    grid-template-columns: 1fr !important;
    grid-template-rows: auto;
    gap: 14px;
    margin-top: 1rem;
  }
}
@media (max-width: 600px) {
  /* --- Post Front Grid Responsive Fix --- */
.post-front-grid {
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(2, 1fr);
    gap: 0.75rem;
    margin-top: 0.5rem;
  }
}
.post-front-card {
  background: #fff;
  border-radius: 18px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.07);
  overflow: hidden;
  text-align: center;
  transition: transform 0.2s, box-shadow 0.2s;
  cursor: pointer;
  width: auto;
  min-width: 0;
  max-width: 100%;
}
.post-front-card:hover {
  transform: translateY(-6px) scale(1.03);
  box-shadow: 0 8px 32px rgba(37,99,235,0.10);
}
.post-front-card img {
  width: 100%;
  height: 140px;
  object-fit: cover;
  border-bottom: 1px solid #f1f5f9;
}
.post-front-title {
  font-weight: 600;
  color: #121737;
  font-size: 1.08rem;
  margin: 0;
  padding: 14px;
  text-align: center;
}

  .popular-card img, .latest-card img, .post-front-card img {
    height: 90px;
  }
  .colorjoy-image img {
    max-width: 100%;
  }
  .footer-content {
    gap: 1.2rem;
    padding: 1.2rem 0 0.5rem 0;
  }
  .footer-section {
    min-width: 0;
    max-width: 100%;
  }
  .footer-brand {
    max-width: 100%;
  }
  .newsletter-form {
    flex-direction: column;
    gap: 6px;
  }
  .newsletter-form input[type="email"],
  .newsletter-form button {
    width: 100%;
    box-sizing: border-box;
  }
} 

#mobile-menu-toggle {
  display: none;
  background: none;
  border: none;
  outline: none;
  cursor: pointer;
  flex-shrink: 0;
  padding: 0.5rem;
  margin: 0 0 0 0.5rem;
  align-self: center;
  height: 48px;
  width: 48px;
  justify-content: center;
  align-items: center;
  z-index: 1001;
  position: relative;
  border-radius: 8px;
  transition: background-color 0.2s ease;
}

#mobile-menu-toggle:hover {
  background-color: rgba(0, 0, 0, 0.05);
}
#mobile-menu-toggle .bar {
  display: block;
  width: 24px;
  height: 2.5px;
  margin: 5px 0;
  background: #2d3748;
  border-radius: 2px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  transform-origin: center;
}

/* Animate hamburger to X when menu is open */
body.mobile-nav-open #mobile-menu-toggle .bar:nth-child(1) {
  transform: translateY(7.5px) rotate(45deg);
}

body.mobile-nav-open #mobile-menu-toggle .bar:nth-child(2) {
  opacity: 0;
  transform: scale(0);
}

body.mobile-nav-open #mobile-menu-toggle .bar:nth-child(3) {
  transform: translateY(-7.5px) rotate(-45deg);
}
#mobile-menu-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 998;
  opacity: 0;
  transition: opacity 0.3s ease;
}

body.mobile-nav-open #mobile-menu-overlay {
  display: block;
  opacity: 1;
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
}

/* Menu close button */
.menu-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: none;
  border: none;
  width: 40px;
  height: 40px;
  display: none; /* Hidden by default */
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: #4a5568;
  border-radius: 50%;
  transition: all 0.2s ease;
  z-index: 1002;
}

/* Show menu close button only on mobile/tablet */
@media (max-width: 1023px) {
  .menu-close {
    display: flex;
  }
}

.menu-close:hover,
.menu-close:focus {
  background-color: #f7fafc;
  color: #2d3748;
  outline: none;
}

.menu-close svg {
  width: 20px;
  height: 20px;
}

/* Menu open state */
body.mobile-nav-open .nav-menu {
  transform: translateX(0);
  box-shadow: -4px 0 30px rgba(0, 0, 0, 0.15);
}

/* Menu item with dropdown indicator */
.menu-item-has-children > a::after {
  content: '\f107';
  font-family: 'Font Awesome 5 Free';
  font-weight: 900;
  margin-left: 0.5rem;
  display: inline-block;
  transition: transform 0.2s ease;
}

.menu-item-has-children.dropdown-open > a::after {
  transform: rotate(180deg);
}

/* Search form in mobile menu */
.mobile-search-form {
  padding: 1rem;
  margin-bottom: 1rem;
  border-bottom: 1px solid #edf2f7;
}

.mobile-search-form input[type="search"] {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  font-size: 1rem;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.mobile-search-form input[type="search"]:focus {
  outline: none;
  border-color: #4a90e2;
  box-shadow: 0 0 0 2px rgba(74, 144, 226, 0.2);
}

/* --- Mobile Enhancements: Category Grid & Cards --- */
@media (max-width: 600px) {
  .category-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
    margin-top: 1rem;
    padding: 0 4px;
  }
  .category-card {
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(37,99,235,0.06);
    margin-bottom: 0.5rem;
    min-width: 0;
    max-width: 100%;
    overflow: hidden;
    background: #fff;
    transition: box-shadow 0.2s;
  }
  .category-image {
    padding-top: 70%; /* more square for mobile */
    min-height: 25px;
    max-height: 120px;
    overflow: hidden;
    border-radius: 12px 12px 0 0;
    position: relative;
  }
  .category-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 12px 12px 0 0;
    position: absolute;
    top: 0;
    left: 0;
  }
  .category-content {
    padding: 10px 6px 12px 6px;
    text-align: center;
  }
  .category-title {
    font-size: 1.02rem;
    font-weight: 700;
    margin: 0;
    color: #121737;
    line-height: 1.2;
    letter-spacing: 0.01em;
    word-break: break-word;
  }
}

}
@media (max-width: 900px) {
  #mobile-menu-toggle {
    display: flex;
    position: static;
    z-index: 1101;
  }
  .main-navigation {
    position: fixed;
    top: 0;
    right: -320px;
    width: 280px;
    height: 100vh;
    background: #fff;
    box-shadow: -4px 0 24px rgba(0,0,0,0.08);
    z-index: 1102;
    display: block;
    padding: 48px 0 16px 0;
    border-radius: 0;
    text-align: left;
    transition: right 0.35s cubic-bezier(.4,0,.2,1);
    animation: none;
  }
  body.mobile-nav-open .main-navigation {
    right: 0;
  }
  .main-navigation ul {
    flex-direction: column;
    gap: 18px;
    align-items: flex-start;
    width: 100%;
    margin: 0;
    padding: 0 24px;
  }
  .main-navigation li {
    width: 100%;
  }
  .main-navigation a {
    font-size: 1.2rem;
    padding: 8px 0;
    display: block;
    width: 100%;
  }
  #mobile-menu-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(18,23,55,0.18);
    z-index: 1100;
    transition: opacity 0.3s;
    opacity: 0;
    pointer-events: none;
  }
  body.mobile-nav-open #mobile-menu-overlay {
    display: block;
    opacity: 1;
    pointer-events: auto;
  }
  .main-navigation {
    max-width: 90vw;
  }
}
@media (max-width: 600px) {
  #mobile-menu-toggle .bar {
    width: 26px;
    height: 3px;
    margin: 5px 0;
  }
  .main-navigation {
    width: 90vw;
    max-width: 340px;
    padding: 32px 0 10px 0;
  }
  .main-navigation ul {
    padding: 0 12px;
  }
}
@keyframes fadeInMenu {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: translateY(0); }
} 

.skip-link {
  position: absolute;
  left: -999px;
  top: auto;
  width: 1px;
  height: 1px;
  overflow: hidden;
  z-index: 200;
}
.skip-link:focus {
  left: 1rem;
  top: 1rem;
  width: auto;
  height: auto;
  background: #2563eb;
  color: #fff;
  padding: 0.5rem 1rem;
  border-radius: 4px;
  outline: none;
  display: inline-block;
} 

.popular-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr); /* 4 columns */
  grid-auto-rows: 1fr;
  gap: 2rem;
  margin-top: 2rem;
}
.popular-item {
  flex: 1;
  background: #f8f8f8;
  padding: 16px;
  border-radius: 8px;
  text-align: center;
  box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}
.popular-item img {
  max-width: 100%;
  height: auto;
  border-radius: 4px;
} 

.latest-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 2rem;
  margin-top: 2rem;
  width: 100%;
  padding-left: 0;
  padding-right: 0;
}

.latest-card {
  background: #fff;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
  transition: all 0.3s ease;
  text-decoration: none;
  color: inherit;
  position: relative;
  width: 280px;
  height: 185px;
  display: flex;
  flex-direction: column;
}

.latest-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
}

.latest-image {
  width: 100%;
  height: 140px;
  overflow: hidden;
  flex-shrink: 0;
}

.latest-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-bottom: 1px solid #f1f5f9;
  transition: transform 0.3s ease;
}

.latest-card:hover .latest-image img {
  transform: scale(1.05);
}

.latest-title {
  margin: 0;
  text-align: center;
  background: white;
  font-size: 1.08rem;
  font-weight: 600;
  color: #121737;
  border-top: 1px solid #f1f5f9;
  height: 45px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 90%;
  margin: 0 auto;
  padding: 8px;
}