/* ============================================
   BLOG PAGE CSS IMPROVEMENTS - FIXED FOR ACTUAL STRUCTURE
   Clarence Water Filters Australia
   ============================================ */

/* CONTAINER FOR BLOG POSTS */
.latest-posts {
  display: grid !important;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)) !important;
  gap: 30px !important;
  padding: 30px 20px !important;
  max-width: 1200px;
  margin: 0 auto;
}

/* INDIVIDUAL POST ITEMS */
.latest-posts > div {
  background: white;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  transition: all 0.3s ease;
  display: flex !important;
  flex-direction: column !important;
}

.latest-posts > div:hover {
  transform: translateY(-8px);
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.15);
}

/* POST IMAGES - MAKE THEM LARGER AND OVERRIDE INLINE STYLES */
.latest-posts a[href*="wp-content"] {
  display: block !important;
  width: 100% !important;
  height: 350px !important;
  overflow: hidden !important;
  background-color: #f0f0f0 !important;
  padding: 0 !important;
  margin: 0 !important;
}

.latest-posts a[href*="wp-content"] img {
  width: 100% !important;
  height: 100% !important;
  object-fit: cover !important;
  object-position: center !important;
  transition: transform 0.3s ease !important;
  display: block !important;
  max-width: 100% !important;
  max-height: 100% !important;
}

.latest-posts > div > a[href*="wp-content"] {
  display: block !important;
}

/* FALLBACK - TARGET IMG TAGS DIRECTLY */
.latest-posts img {
  width: 100% !important;
  height: auto !important;
  display: block !important;
}

/* REMOVE ANY WIDTH/HEIGHT ATTRIBUTES */
.latest-posts a img {
  width: 100% !important;
  height: 100% !important;
  max-width: 100% !important;
}

.latest-posts > div:hover a[href*="wp-content"] img {
  transform: scale(1.05);
}

/* POST TITLES AND CONTENT */
.latest-posts h2 {
  font-size: 18px !important;
  font-weight: 600 !important;
  line-height: 1.4 !important;
  margin: 16px 20px 12px 20px !important;
  color: #1a3d3a !important;
  padding: 0 !important;
}

.latest-posts h2 a {
  color: #1a3d3a !important;
  text-decoration: none !important;
  transition: color 0.3s ease;
}

.latest-posts h2 a:hover {
  color: #0066cc !important;
}

/* POST EXCERPTS */
.latest-posts > div > a[href*="clarencewaterfilters"] {
  display: block;
  padding: 0 20px;
  font-size: 14px;
  color: #555;
  line-height: 1.6;
  margin-bottom: 12px;
  flex-grow: 1;
  text-decoration: none !important;
}

.latest-posts > div > a:last-child {
  color: #555 !important;
}

/* VIEW ARTICLE LINKS */
.latest-posts a {
  transition: color 0.3s ease;
}

.latest-posts > div > a:not([href*="wp-content"]):last-of-type {
  display: inline-block;
  background-color: #0066cc;
  color: white !important;
  padding: 10px 20px !important;
  margin: 0 20px 20px 20px !important;
  border-radius: 6px;
  text-decoration: none !important;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.latest-posts > div > a:not([href*="wp-content"]):last-of-type:hover {
  background-color: #0052a3;
  color: white;
}

/* RESPONSIVE DESIGN */
@media (max-width: 1024px) {
  .latest-posts {
    grid-template-columns: repeat(2, 1fr) !important;
  }
}

@media (max-width: 640px) {
  .latest-posts {
    grid-template-columns: 1fr !important;
    gap: 20px !important;
  }
  
  .latest-posts h2 {
    font-size: 16px !important;
  }
  
  .latest-posts a {
    font-size: 13px !important;
  }
}

/* ENSURE PROPER FLEX DIRECTION */
.latest-posts > div {
  display: flex !important;
  flex-direction: column !important;
  align-items: stretch !important;
  height: 100%;
}

/* SPACING FIX */
body.blog .latest-posts h2,
body.archive .latest-posts h2 {
  margin-top: 16px !important;
}
