/* Book Homepage List Styles */

.book-homepage2-list {
  /* The page title is hidden on this page, so top up <main>'s 0.25rem top
     padding to match its 1rem side/bottom padding */
  margin: 0.75rem 0 0;
  padding: 2rem;
  padding-top: 1.2rem;
  /* Colours follow the theme's light/dark variables (fallbacks = light).
     Background is the page colour tinted 4% toward the heading colour, so
     the panel reads as a raised surface in both modes. */
  --bh2-tagline: #4695f6;
  background: #f8f9fa;
  background: color-mix(in srgb, var(--page-bg, #ffffff) 96%, var(--heading-text, #1e293b));
  border-radius: 8px;
  border: 1px solid var(--border-color, #dee2e6);
}

/* Lighter tagline blue for contrast on the dark panel; mirrors the theme's
   dark-mode selectors in bonetailwind/src/css/style.css */
@media (prefers-color-scheme: dark) {
  :root:not(.light) .book-homepage2-list {
    --bh2-tagline: #60a5fa;
  }
}

:root.dark .book-homepage2-list {
  --bh2-tagline: #60a5fa;
}

/* Heading + tagline share the underline */
.book-homepage2-header {
  margin: 0 0 1.5rem 0;
  padding-bottom: 0.75rem;
  border-bottom: 2px solid #60a5fa;
}

.book-homepage2-list h1 {
  margin: 0;
  color: var(--heading-text, #334155);
  font-size: 1.5rem;
  font-weight: 600;
}

.book-homepage2-tagline {
  margin: 0.25rem 0 0 0;
  color: var(--bh2-tagline);
  font-size: 1rem;
  font-style: italic;
  line-height: 1.4;
}

.book-homepage2-grid {
  display: grid;
  /* Columns are at least 280px, but never more than 3 across (3 cols + 2 gaps) */
  grid-template-columns: repeat(auto-fill, minmax(max(280px, calc((100% - 2rem) / 3)), 1fr));
  gap: 1rem;
}

.book-homepage2-item {
  /* Photo fills the tile. --tile-image is set inline per card by the
     template. */
  background-color: #334155;
  background-image: var(--tile-image, none);
  background-size: cover;
  background-position: center;
  overflow: hidden;
  padding: 1.25rem;
  /* 2.5x the original card height (~4rem) */
  min-height: 10rem;
  /* Label sits in the bottom-right corner */
  display: flex;
  align-items: flex-end;
  justify-content: flex-end;
  text-align: right;
  border-radius: 6px;
  border: 1px solid var(--border-color, #e0e0e0);
  transition: all 0.2s ease;
  position: relative;
}

.book-homepage2-item:hover {
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
  border-color: #4695f6;
  transform: translateY(-2px);
  cursor: pointer;
}

/* Label box: theme brand colour, semi-transparent (falls back to the light
   theme blue if the theme variable is missing) */
.book-homepage2-item h3 {
  background: rgba(96, 165, 250, 0.6);
  background: color-mix(in srgb, var(--brand-color, #60a5fa) 60%, transparent);
  padding: 0.35rem 0.85rem;
  border-radius: 6px;
  margin: 0;
  font-size: 1.1rem;
  font-weight: 500;
  line-height: 1.4;
}

.book-homepage2-item h3 a {
  color: #ffffff;
  text-decoration: none;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.6);
  transition: color 0.2s ease;
}

.book-homepage2-item h3 a::after {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
}

.book-homepage2-item h3 a:hover {
  color: #ffffff;
  text-decoration: underline;
}

@media (max-width: 768px) {
  .book-homepage2-grid {
    grid-template-columns: 1fr;
  }
  
  .book-homepage2-list {
    padding: 1.5rem;
  }
}