/* query-loop.css */
/* Cards style for WordPress Query Loop (core/post-template) */

/* Query block container - ensure proper flow order */
.wp-block-query {
  display: flex;
  flex-direction: column;
}

/* Grid container for cards layout */
.wp-block-post-template.is-style-cards {
  display: grid;
  grid-template-columns: 1fr;
  gap: 24px;
  padding: 0;
  margin: 0;
  list-style: none;
  order: 1;
}

/* Individual card - flexbox for equal height */
.wp-block-post-template.is-style-cards .wp-block-post {
  display: flex;
  flex-direction: column;
  background: white;
  border-radius: 0;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  overflow: hidden;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  height: 100%;
}

/* Card hover effect */
.wp-block-post-template.is-style-cards .wp-block-post:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
}

/* Placeholder for posts without featured image block */
.wp-block-post-template.is-style-cards .wp-block-post:not(:has(.wp-block-post-featured-image))::before {
  content: "";
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  background-color: var(--light-color, rgb(228, 208, 191));
  flex-shrink: 0;
}

/* Featured image container - fixed aspect ratio */
.wp-block-post-template.is-style-cards .wp-block-post-featured-image {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  margin: 0;
  background-color: var(--light-color, rgb(228, 208, 191));
}

/* Placeholder for posts without featured image */
.wp-block-post-template.is-style-cards .wp-block-post-featured-image:empty::before {
  content: "";
  display: block;
  width: 100%;
  height: 100%;
  background-color: var(--light-color, rgb(228, 208, 191));
}

/* Featured image - cover and center */
.wp-block-post-template.is-style-cards .wp-block-post-featured-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
  transition: transform 0.3s ease;
}

/* Image zoom on card hover */
.wp-block-post-template.is-style-cards .wp-block-post:hover .wp-block-post-featured-image img {
  transform: scale(1.05);
}

/* Card body - contains title and excerpt */
.wp-block-post-template.is-style-cards .wp-block-post-featured-image ~ * {
  padding-left: 20px;
  padding-right: 20px;
}

.wp-block-post-template.is-style-cards .wp-block-post-featured-image + * {
  padding-top: 20px;
}

/* Handle cards without featured image - add padding to elements */
.wp-block-post-template.is-style-cards .wp-block-post:not(:has(.wp-block-post-featured-image)) > * {
  padding-left: 20px;
  padding-right: 20px;
}

.wp-block-post-template.is-style-cards .wp-block-post:not(:has(.wp-block-post-featured-image)) > *:first-child {
  padding-top: 20px;
}

/* Last element in card gets bottom padding */
.wp-block-post-template.is-style-cards .wp-block-post > *:last-child {
  padding-bottom: 20px;
  margin-bottom: 0;
}

/* Post title styling */
.wp-block-post-template.is-style-cards .wp-block-post-title {
  font-size: 1.5rem;
  line-height: 1.3;
  margin: 0 0 12px 0;
  color: rgb(92, 60, 27);
}

.wp-block-post-template.is-style-cards .wp-block-post-title a {
  color: inherit;
  text-decoration: none;
  transition: color 0.3s ease;
}

.wp-block-post-template.is-style-cards .wp-block-post-title a:hover {
  color: var(--accent-color, rgb(148, 117, 85));
}

/* Post title focus state for accessibility */
.wp-block-post-template.is-style-cards .wp-block-post-title a:focus {
  outline: 2px solid var(--accent-color, rgb(148, 117, 85));
  outline-offset: 2px;
}

/* Post excerpt styling */
.wp-block-post-template.is-style-cards .wp-block-post-excerpt {
  font-size: 1rem;
  line-height: 1.6;
  color: rgb(92, 60, 27);
  margin: 0;
  flex-grow: 1;
}

.wp-block-post-template.is-style-cards .wp-block-post-excerpt__excerpt {
  margin: 0;
}

/* Excerpt more link */
.wp-block-post-template.is-style-cards .wp-block-post-excerpt__more-link {
  color: var(--primary-color, rgb(196, 164, 132));
  text-decoration: none;
  font-weight: bold;
  transition: color 0.3s ease;
}

.wp-block-post-template.is-style-cards .wp-block-post-excerpt__more-link:hover {
  color: var(--accent-color, rgb(148, 117, 85));
}

/* Responsive grid - 2 columns on tablet, 3 on desktop */
@media (min-width: 768px) {
  .wp-block-post-template.is-style-cards {
    grid-template-columns: repeat(2, 1fr);
    gap: 32px;
  }

  .wp-block-post-template.is-style-cards .wp-block-post-title {
    font-size: 1.75rem;
  }

  /* Adjust padding for larger screens */
  .wp-block-post-template.is-style-cards .wp-block-post-featured-image ~ * {
    padding-left: 24px;
    padding-right: 24px;
  }

  .wp-block-post-template.is-style-cards .wp-block-post-featured-image + * {
    padding-top: 24px;
  }

  /* Handle cards without featured image on desktop */
  .wp-block-post-template.is-style-cards .wp-block-post:not(:has(.wp-block-post-featured-image)) > * {
    padding-left: 24px;
    padding-right: 24px;
  }

  .wp-block-post-template.is-style-cards .wp-block-post:not(:has(.wp-block-post-featured-image)) > *:first-child {
    padding-top: 24px;
  }

  .wp-block-post-template.is-style-cards .wp-block-post > *:last-child {
    padding-bottom: 24px;
  }
}

@media (min-width: 1024px) {
  .wp-block-post-template.is-style-cards {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* Alternative: 4 columns on very wide screens (optional, can remove if not needed) */
@media (min-width: 1400px) {
  .wp-block-post-template.is-style-cards {
    grid-template-columns: repeat(4, 1fr);
  }
}

/* Pagination Styles */
.wp-block-query-pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
  margin-top: 48px;
  padding: 20px 0;
  font-family: Calibri, sans-serif;
  order: 2;
  position: static !important;
  top: auto !important;
  transform: none !important;
}

/* No results message */
.wp-block-query-no-results {
  order: 3;
}

/* Pagination links and buttons */
.wp-block-query-pagination a,
.wp-block-query-pagination .wp-block-query-pagination-numbers {
  color: var(--primary-color, rgb(196, 164, 132));
  text-decoration: none;
  font-size: 18px;
  font-weight: bold;
  transition: color 0.3s ease, background-color 0.3s ease;
}

/* Previous and Next buttons */
.wp-block-query-pagination-previous a,
.wp-block-query-pagination-next a {
  padding: 10px 20px;
  background-color: var(--primary-color, rgb(196, 164, 132));
  color: white;
  border-radius: 0;
  display: inline-block;
}

.wp-block-query-pagination-previous a:hover,
.wp-block-query-pagination-next a:hover {
  background-color: var(--accent-color, rgb(148, 117, 85));
  color: white;
}

/* Page numbers container */
.wp-block-query-pagination-numbers {
  display: flex;
  gap: 8px;
  align-items: center;
  list-style: none;
  margin: 0;
  padding: 0;
}

/* Individual page number links */
.wp-block-query-pagination-numbers a,
.wp-block-query-pagination-numbers .page-numbers {
  padding: 8px 12px;
  min-width: 40px;
  text-align: center;
  display: inline-block;
  color: var(--primary-color, rgb(196, 164, 132));
  background-color: transparent;
  border: 2px solid var(--primary-color, rgb(196, 164, 132));
  transition: all 0.3s ease;
}

.wp-block-query-pagination-numbers a:hover {
  background-color: var(--accent-color, rgb(148, 117, 85));
  border-color: var(--accent-color, rgb(148, 117, 85));
  color: white;
}

/* Current page number */
.wp-block-query-pagination-numbers .current,
.wp-block-query-pagination-numbers span.page-numbers.current {
  background-color: var(--primary-color, rgb(196, 164, 132));
  border-color: var(--primary-color, rgb(196, 164, 132));
  color: white;
  font-weight: bold;
}

/* Dots separator */
.wp-block-query-pagination-numbers .dots {
  border: none;
  background: none;
  color: rgb(92, 60, 27);
}

/* Focus states for accessibility */
.wp-block-query-pagination a:focus {
  outline: 2px solid var(--accent-color, rgb(148, 117, 85));
  outline-offset: 2px;
}

/* Responsive pagination */
@media (max-width: 768px) {
  .wp-block-query-pagination {
    margin-top: 32px;
    gap: 8px;
  }

  .wp-block-query-pagination-previous a,
  .wp-block-query-pagination-next a {
    padding: 8px 16px;
    font-size: 16px;
  }

  .wp-block-query-pagination-numbers a,
  .wp-block-query-pagination-numbers .page-numbers {
    padding: 6px 10px;
    min-width: 36px;
    font-size: 16px;
  }
}
