/* Blog Dynamic Data Section - Blog Posts Grid */

/* Fade-in animation for cards */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
/* Uses site-grid-rails.css for layout and style.css for typography/colors */
/* Updated: Removed all emoji references, using SVG icons instead */

.blog-dynamic-data {
  background-color: var(--ica-mint, #DCF4EF);
  padding: var(--global-padding-desktop) 0;
}

.blog-dynamic-data__content {
  color: var(--ica-green-deep);
}

/* Ensure no emoji content is displayed */
.blog-post__date::before,
.blog-post__date::after {
  content: none !important;
}

/* Main Grid Container - unified */
.posts-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
  margin-bottom: 3rem;
  grid-auto-flow: row dense;
}

/* Prevent duplicate rendering: desktop vs mobile containers */
.blog-posts-mobile-grid { display: none; }

/* First row layout rules */
.posts-grid > .post-card:nth-child(1) { grid-column: 1 / span 2; grid-row: 1 / span 2; }
.posts-grid > .post-card:nth-child(2),
.posts-grid > .post-card:nth-child(3) { grid-column: 3; }

/* Legacy desktop/row/sidebar styles removed: unified grid in use */

/* Remove legacy rows: unified grid handles rows */

/* Removed mobile-only grid: unified responsive grid is used */

.blog-post--grid {
  display: flex;
  flex-direction: column;
  border-radius: 8px;
  overflow: hidden;
  background-color: white;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  transition: transform 0.3s ease, box-shadow 0.3s ease, border 0.3s ease, opacity 0.6s ease;
  min-height: 350px;
  box-sizing: border-box;
  border: 2px solid transparent;
  opacity: 0;
  animation: fadeInUp 0.6s ease forwards;
  cursor: pointer;
}

/* Staggered animation delays for initial cards */
.blog-post--grid:nth-child(1) { animation-delay: 0.1s; }
.blog-post--grid:nth-child(2) { animation-delay: 0.2s; }
.blog-post--grid:nth-child(3) { animation-delay: 0.3s; }
.blog-post--grid:nth-child(4) { animation-delay: 0.4s; }
.blog-post--grid:nth-child(5) { animation-delay: 0.5s; }
.blog-post--grid:nth-child(6) { animation-delay: 0.6s; }
.blog-post--grid:nth-child(7) { animation-delay: 0.7s; }
.blog-post--grid:nth-child(8) { animation-delay: 0.8s; }
.blog-post--grid:nth-child(9) { animation-delay: 0.9s; }

.blog-post--grid:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 15px rgba(0, 0, 0, 0.15);
  border: 2px solid var(--ica-green-deep,#1E312F);
}

/* Accessible focus states (keyboard) */
.blog-post--grid:focus-within {
  transform: translateY(-4px);
  box-shadow: 0 8px 15px rgba(0, 0, 0, 0.15);
  border: 2px solid var(--ica-green-deep,#1E312F);
  outline: 3px solid var(--ica-lime);
  outline-offset: 2px;
}

.blog-post--grid:hover .blog-post__main::after {
  background: linear-gradient(to bottom, rgba(0, 0, 0, 0) 0%, rgba(0, 0, 0, 0.9) 100%);
}

.blog-post--grid:focus-within .blog-post__main::after {
  background: linear-gradient(to bottom, rgba(0, 0, 0, 0) 0%, rgba(0, 0, 0, 0.9) 100%);
}

/* Main Section with Background Image */
.blog-post--grid .blog-post__main {
  position: relative;
  flex: 1;
  min-height: 200px;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 1.5rem;
}

.blog-post--grid .blog-post__main::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(to bottom, rgba(0, 0, 0, 0) 0%, rgba(0, 0, 0, 0.9) 100%);
  z-index: 1;
  transition: background var(--ease);
}

.blog-post--grid .blog-post__main > * {
  position: relative;
  z-index: 2;
}

.blog-post--grid .blog-post__tag {
  margin-bottom: 0.75rem;
  background-color: var(--ica-lavender);
  color: var(--ica-green-deep);
  padding: 6px 12px;
  font-size: 0.7rem;
  font-weight: 500;
  text-transform: uppercase;
  border-radius: 4px;
  display: inline-block;
  align-self: flex-start;
  transition: background-color var(--ease);
}

.blog-post--grid:hover .blog-post__tag {
  background-color: var(--ica-lime);
}

.blog-post--grid .blog-post__title {
  font-family: var(--font-heading);
  font-size: 2.0rem;
  font-weight: 600;
  color: white;
  margin: 0;
  line-height: 1.3;
  text-transform: uppercase;
}


.blog-post--grid .blog-post__title a {
  color: white;
  text-decoration: none;
  transition: color var(--ease);
}

.blog-post--grid:hover .blog-post__title a {
  color: var(--ica-lime);
}

/* CTA Section */
.blog-post--grid .blog-post__cta {
  background-color: #f8f8f8;
  padding: 1.0rem 1.5rem;
  border-top: 1px solid #e0e0e0;
}

.blog-post--grid .blog-post__read-more {
  display: flex;
  align-items: center;
  justify-content: space-between;
  text-decoration: none;
  color: var(--ica-green-deep);
  transition: color var(--ease);
}

.blog-post--grid:hover .blog-post__read-more {
  color: var(--ica-teal);
}

.blog-post--grid .blog-post__title a:focus-visible,
.blog-post--grid .blog-post__read-more:focus-visible {
  outline: 2px solid var(--ica-teal);
  outline-offset: 3px;
  color: var(--ica-teal);
}

.blog-post--grid .blog-post__read-more-text {
  font-family: var(--font-ui);
  font-size: 1.0rem;
  font-weight: 500;
  text-transform: uppercase;
}

.blog-post--grid .blog-post__read-more-icon {
  width: 20px;
  height: 20px;
  transition: transform var(--ease);
  filter: brightness(0) saturate(100%) invert(20%) sepia(15%) saturate(2000%) hue-rotate(180deg) brightness(90%) contrast(90%);
}

.blog-post--grid:hover .blog-post__read-more-icon {
  transform: translate(2px, -2px);
  filter: brightness(0) saturate(100%) invert(40%) sepia(80%) saturate(2000%) hue-rotate(160deg) brightness(90%) contrast(90%);
}

.blog-post--grid:focus-within .blog-post__read-more-icon {
  transform: translate(2px, -2px);
  filter: brightness(0) saturate(100%) invert(40%) sepia(80%) saturate(2000%) hue-rotate(160deg) brightness(90%) contrast(90%);
}

/* Tags */
.blog-post__tag {
  padding: 4px 8px;
  font-family: var(--font-ui);
  font-size: 0.7rem;
  font-weight: 500;
  text-transform: uppercase;
  border-radius: 4px;
  display: inline-block;
  margin-bottom: 0.5rem;
}

.blog-post__tag--featured {
  background-color: var(--ica-teal);
  color: white;
}

.blog-post__tag--business {
  background-color: #28a745;
  color: white;
}

/* Placeholder for missing images */
.blog-post__placeholder {
  width: 100%;
  height: 200px;
  background-color: #333;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-body);
  color: white;
  border-radius: 6px;
}

/* No posts message */
.no-posts {
  text-align: center;
  padding: 3rem 0;
}

.no-posts h2 {
  font-family: var(--font-heading);
  color: white;
  margin-bottom: 1rem;
}

.no-posts p {
  font-family: var(--font-body);
  color: #ccc;
  font-size: 1.1rem;
}

/* Responsive adjustments */
/* Up to 599px: single column via mobile grid */
@media (max-width: 599px) {
  .posts-grid { display: none; }
  .blog-posts-mobile-grid { display: grid; gap: 1.5rem; }
}

/* 600px to 880px: two-column magazine grid */
@media (min-width: 600px) and (max-width: 880px) {
  .posts-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
  }
  /* Adjust first row spanning rules for two columns */
  .posts-grid > .post-card:nth-child(1) { grid-column: 1 / span 2; grid-row: auto; }
  .posts-grid > .post-card:nth-child(2),
  .posts-grid > .post-card:nth-child(3) { grid-column: 2; grid-row: auto; }
}

/* Removed legacy desktop first-row title sizing */

@media (max-width: 768px) {
  .blog-dynamic-data {
    padding: var(--global-padding-mobile) ;
  }
  
  .blog-post--grid .blog-post__main {
    min-height: 220px;
  }
  
  /* Increase title font size on mobile */
  .blog-post--grid .blog-post__title {
    font-size: 2.0rem;
  }
}

/* Desktop tweaks: reduce first card height while keeping magazine layout */
@media (min-width: 881px) {
  /* Lower the overall card min-height for the first item */
  .posts-grid > .post-card:nth-child(1) { min-height: 240px; }
  /* Reduce inner hero area min-height for the first item */
  .posts-grid > .post-card:nth-child(1) .blog-post__main { min-height: 180px; }
}

/* Load More Button */
.blog-load-more-container {
  display: flex;
  justify-content: center;
  margin-top: 3rem;
  padding: 0 1rem;
}

.blog-load-more-btn {
  background-color: var(--ica-teal);
  color: white;
  border: none;
  padding: 1rem 2rem;
  font-family: var(--font-ui);
  font-size: 1rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 150px;
  justify-content: center;
}

.blog-load-more-btn:hover {
  background-color: var(--ica-green-deep);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.blog-load-more-btn:disabled {
  opacity: 0.7;
  cursor: not-allowed;
  transform: none;
}

.load-more-spinner {
  font-size: 0.9rem;
}

/* Mobile Load More Button */
@media (max-width: 768px) {
  .blog-load-more-container {
    margin-top: 2rem;
    padding: 0 1rem;
  }
  
  .blog-load-more-btn {
    padding: 0.8rem 1.5rem;
    font-size: 0.9rem;
    min-width: 120px;
  }

  .blog-post--grid .blog-post__read-more-text{
    font-size: 1.1rem;
  }
}


