/* ========================================
   HOMEPAGE STYLES - GRID FIXES AND ENHANCEMENTS
   ======================================== */

/* Horizontal Categories Section - Refined */
.categories-horizontal-section {
  padding: 4rem 0 4.5rem;
  background: linear-gradient(180deg, #f8fafc 0%, #ffffff 100%);
  position: relative;
}

/* Homepage uses a compact polished variant of .genres-card */
.categories-genres-section .genres-cards-row {
  margin-top: 0.25rem;
  row-gap: 0.875rem;
}

.categories-genres-section .genres-card--home {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.05);
  overflow: hidden;
  transition: border-color 0.25s ease, box-shadow 0.25s ease;
}

.categories-genres-section .genres-card--home::before {
  content: '';
  display: block;
  height: 3px;
  background: linear-gradient(90deg, var(--genre-from, #e0f2fe), var(--genre-to, #bae6fd));
}

.categories-genres-section .genres-card--home:hover {
  border-color: #17a2b8;
  box-shadow: 0 14px 28px rgba(15, 23, 42, 0.09);
}

.categories-genres-section .genres-card--home .genres-card-main {
  flex-direction: column;
  align-items: stretch;
  gap: 0.7rem;
  padding: 0.95rem 1rem 1rem;
  min-height: 0;
}

.categories-genres-section .genres-card--home .genres-card-head {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
}

.categories-genres-section .genres-card--home .genres-card-icon-wrap {
  display: flex;
  flex-shrink: 0;
}

.categories-genres-section .genres-card--home .genres-card-icon,
.categories-genres-section .genres-card--home .genres-card-image {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 11px;
  background: linear-gradient(145deg, var(--genre-from, #f0f9ff), var(--genre-to, #e0f2fe));
  color: #0f6674;
  font-size: 1rem;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.65);
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.categories-genres-section .genres-card--home:hover .genres-card-icon,
.categories-genres-section .genres-card--home:hover .genres-card-image {
  transform: scale(1.05);
  box-shadow: 0 6px 14px rgba(15, 23, 42, 0.08), inset 0 0 0 1px rgba(255, 255, 255, 0.7);
}

.categories-genres-section .genres-card--home .genres-card-title {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 750;
  letter-spacing: -0.015em;
  line-height: 1.3;
  color: #0f172a;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 0;
  flex: 1;
  min-width: 0;
  transition: color 0.2s ease;
}

.categories-genres-section .genres-card--home:hover .genres-card-title {
  color: #138496;
}

.categories-genres-section .genres-card--home .genres-card-desc {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin: 0;
  font-size: 0.8rem;
  line-height: 1.45;
  color: #64748b;
  min-height: 2.3em;
}

.categories-genres-section .genres-card--home .genres-card-cta {
  margin-top: 0.15rem;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.75rem;
  font-weight: 700;
  color: #17a2b8;
  letter-spacing: 0.01em;
}

.categories-genres-section .genres-card--home .genres-card-cta i {
  font-size: 0.65rem;
  transition: transform 0.2s ease;
}

.categories-genres-section .genres-card--home:hover .genres-card-cta i {
  transform: translateX(3px);
}

.categories-genres-section .genres-cards-row > .genres-grid-col:nth-child(1) .genres-card--home,
.categories-genres-section .genres-cards-row > .genres-grid-col:nth-child(n) .genres-card--home {
  animation: none;
}

@media (min-width: 1200px) {
  .categories-genres-section .genres-card--home .genres-card-main {
    padding: 0.95rem 1rem 1rem;
    gap: 0.75rem;
  }
}

@media (max-width: 767.98px) {
  .categories-genres-section .genres-card--home:hover {
    transform: none;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.05);
  }

  .categories-genres-section .genres-card--home .genres-card-main {
    min-height: 0;
    padding: 0.85rem;
    gap: 0.6rem;
  }

  .categories-genres-section .genres-card--home .genres-card-head {
    gap: 0.65rem;
  }

  .categories-genres-section .genres-card--home .genres-card-title {
    font-size: 0.875rem;
  }

  .categories-genres-section .genres-card--home .genres-card-desc {
    font-size: 0.75rem;
    min-height: 2.2em;
  }

  .categories-genres-section .genres-card--home .genres-card-icon,
  .categories-genres-section .genres-card--home .genres-card-image {
    width: 2.25rem;
    height: 2.25rem;
    font-size: 0.9rem;
  }
}

/* Section header */
.categories-section-header {
  margin-bottom: 2.5rem;
}

.categories-section-header .section-eyebrow {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #17a2b8;
  background: rgba(23, 162, 184, 0.1);
  padding: 0.25rem 0.75rem;
  border-radius: 999px;
  margin-bottom: 0.875rem;
}

.categories-section-header h2 {
  font-size: 2rem;
  font-weight: 800;
  color: #0f172a;
  letter-spacing: -0.02em;
  margin: 0 0 0.5rem;
  line-height: 1.2;
}

.categories-section-header p {
  color: #64748b;
  font-size: 1rem;
  margin: 0;
  max-width: 560px;
  margin-left: auto;
  margin-right: auto;
}

/* Card — premium tile */
.categories-horizontal-section .category-horizontal-card {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  text-align: left;
  text-decoration: none;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06);
  transition: border-color 0.25s ease, box-shadow 0.25s ease, transform 0.25s ease;
  position: relative;
  overflow: hidden;
  height: 100%;
  padding: 0;
}

.categories-horizontal-section .category-horizontal-card::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.6);
  pointer-events: none;
}

.categories-horizontal-section .category-horizontal-card:hover {
  border-color: var(--cat-accent, #17a2b8);
  box-shadow: 0 14px 32px rgba(15, 23, 42, 0.1);
  text-decoration: none;
}

/* Visual — icon slot (category images are 64×64) */
.categories-horizontal-section .category-horizontal-visual {
  width: 100%;
  height: 88px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
  overflow: hidden;
  position: relative;
  background: var(--cat-bg, #f1f5f9);
  transition: background 0.25s ease;
}

.categories-horizontal-section .category-horizontal-card--image .category-horizontal-visual {
  height: 88px;
}

.categories-horizontal-section .category-horizontal-card:hover .category-horizontal-visual {
  background: var(--cat-bg, #f1f5f9);
}

.categories-horizontal-section .category-horizontal-icon-wrap {
  width: 64px;
  height: 64px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.85);
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.08);
  transition: transform 0.25s ease, background 0.25s ease, color 0.25s ease;
}

.categories-horizontal-section .category-horizontal-card:hover .category-horizontal-icon-wrap {
  transform: scale(1.06);
  background: var(--cat-accent, #17a2b8);
}

.categories-horizontal-section .category-horizontal-icon {
  font-size: 1.625rem;
  color: var(--cat-icon, #17a2b8);
  transition: color 0.25s ease;
}

.categories-horizontal-section .category-horizontal-card:hover .category-horizontal-icon {
  color: #ffffff;
}

.categories-horizontal-section .category-horizontal-image {
  width: 64px;
  height: 64px;
  max-width: 64px;
  max-height: 64px;
  object-fit: contain;
  object-position: center;
  flex-shrink: 0;
}

/* Body */
.categories-horizontal-section .category-horizontal-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 0.875rem 1rem 1rem;
  gap: 0.625rem;
}

.categories-horizontal-section .category-horizontal-name {
  font-size: 0.875rem;
  font-weight: 700;
  color: #0f172a;
  margin: 0;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  transition: color 0.2s ease;
}

.categories-horizontal-section .category-horizontal-card:hover .category-horizontal-name {
  color: var(--cat-accent, #138496);
}

.categories-horizontal-section .category-horizontal-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-top: auto;
}

.categories-horizontal-section .category-horizontal-count {
  font-size: 0.6875rem;
  color: #64748b;
  font-weight: 600;
  background: #f8fafc;
  padding: 0.25rem 0.625rem;
  border-radius: 999px;
  border: 1px solid #e2e8f0;
  transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
  letter-spacing: 0.01em;
  white-space: nowrap;
}

.categories-horizontal-section .category-horizontal-card:hover .category-horizontal-count {
  background: color-mix(in srgb, var(--cat-accent, #17a2b8) 10%, white);
  border-color: color-mix(in srgb, var(--cat-accent, #17a2b8) 25%, white);
  color: var(--cat-icon, #138496);
}

.categories-horizontal-section .category-horizontal-arrow {
  width: 28px;
  height: 28px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #f1f5f9;
  color: #94a3b8;
  font-size: 0.6875rem;
  flex-shrink: 0;
  transition: background 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.categories-horizontal-section .category-horizontal-card:hover .category-horizontal-arrow {
  background: var(--cat-accent, #17a2b8);
  color: #ffffff;
  transform: translateX(2px);
}

/* "View All Categories" CTA */
.categories-horizontal-section .btn.btn-outline-primary {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.625rem 1.5rem;
  border: 1.5px solid #17a2b8;
  border-radius: 999px;
  background: transparent;
  color: #17a2b8;
  font-weight: 600;
  font-size: 0.9375rem;
  box-shadow: 0 1px 2px rgba(23, 162, 184, 0.06);
  transition: background 0.2s ease, color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

.categories-horizontal-section .btn.btn-outline-primary:hover {
  background: linear-gradient(135deg, #17a2b8 0%, #138496 100%);
  color: #ffffff;
  border-color: transparent;
  transform: translateY(-1px);
  box-shadow: 0 6px 14px rgba(23, 162, 184, 0.3);
}

.categories-horizontal-section .btn.btn-outline-primary i {
  transition: transform 0.2s ease;
}

.categories-horizontal-section .btn.btn-outline-primary:hover i {
  transform: translateX(3px);
}

/* Opacity-only entrance — avoid translateY (CLS / non-composited) */
@keyframes fadeInSoft {
  from { opacity: 0; }
  to { opacity: 1; }
}
@media (prefers-reduced-motion: reduce) {
  .categories-genres-section .genres-card--home,
  .home-product-card,
  .brand-card {
    animation: none !important;
  }
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .categories-horizontal-section .category-horizontal-body {
    padding: 0.625rem 0.625rem 0.75rem;
    gap: 0.375rem;
  }

  .categories-horizontal-section .category-horizontal-name {
    font-size: 0.75rem;
    min-height: 2.6em;
  }

  .categories-horizontal-section .category-horizontal-visual {
    height: 76px;
    padding: 6px;
  }

  .categories-horizontal-section .category-horizontal-card--image .category-horizontal-visual {
    height: 76px;
  }
}

@media (max-width: 768px) {
  .categories-horizontal-section .category-horizontal-card:hover {
    transform: none;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06);
  }
}

@media (max-width: 576px) {
  .categories-horizontal-section {
    padding: 2rem 0;
  }

  .categories-horizontal-section .category-horizontal-footer {
    flex-wrap: nowrap;
    gap: 0.375rem;
  }

  .categories-horizontal-section .category-horizontal-count {
    font-size: 0.625rem;
    padding: 0.2rem 0.45rem;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .categories-horizontal-section .category-horizontal-arrow {
    width: 24px;
    height: 24px;
    font-size: 0.625rem;
  }
}

/* Homepage card grids — 2 per row on mobile (padding gutters, no flex gap overflow) */
.categories-horizontal-section .categories-home-grid {
  display: flex !important;
  flex-wrap: wrap !important;
  margin-left: -6px !important;
  margin-right: -6px !important;
  row-gap: 0.625rem;
  gap: 0 !important;
}

.categories-horizontal-section .categories-home-grid > [class*="col-"] {
  padding-left: 6px !important;
  padding-right: 6px !important;
}

.categories-home-grid,
.brands-home-grid,
.featured-home-grid,
.products-home-grid {
  display: flex !important;
  flex-wrap: wrap !important;
  margin-left: -8px !important;
  margin-right: -8px !important;
  row-gap: 0.75rem;
  gap: 0 !important;
}

.categories-home-grid > [class*="col-"],
.brands-home-grid > [class*="col-"],
.featured-home-grid > [class*="col-"],
.products-home-grid > [class*="col-"] {
  padding-left: 8px !important;
  padding-right: 8px !important;
}

@media (max-width: 575.98px) {
  .categories-home-grid > .col-6,
  .brands-home-grid > .col-6,
  .featured-home-grid > .col-6,
  .products-home-grid > .col-6 {
    flex: 0 0 50% !important;
    max-width: 50% !important;
    width: 50% !important;
  }
}

@media (min-width: 576px) and (max-width: 767.98px) {
  .categories-home-grid > .col-sm-4,
  .brands-home-grid > .col-sm-4,
  .products-home-grid > .col-sm-4 {
    flex: 0 0 33.333333% !important;
    max-width: 33.333333% !important;
  }
}

@media (min-width: 768px) and (max-width: 991.98px) {
  .categories-home-grid > .col-md-3,
  .brands-home-grid > .col-md-3,
  .products-home-grid > .col-md-3,
  .featured-home-grid > .col-md-4 {
    flex: 0 0 25% !important;
    max-width: 25% !important;
  }
}

@media (min-width: 992px) {
  .categories-home-grid > .col-lg-2,
  .brands-home-grid > .col-lg-2,
  .featured-home-grid > .col-lg-2,
  .products-home-grid > .col-lg-2 {
    flex: 0 0 16.666667% !important;
    max-width: 16.666667% !important;
  }
}

/* ===========================================================
   Homepage product sections — shared header + card tiles
   =========================================================== */
.featured-products-section {
  padding: 4rem 0;
  background: linear-gradient(180deg, #f8fafc 0%, #ffffff 100%);
}

.latest-products-section {
  padding: 4rem 0;
  background: #ffffff;
}

.home-products-section-header {
  margin-bottom: 2.5rem;
}

.home-products-section-header .section-eyebrow {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #17a2b8;
  background: rgba(23, 162, 184, 0.1);
  padding: 0.25rem 0.75rem;
  border-radius: 999px;
  margin-bottom: 0.875rem;
}

.home-products-section-header h2 {
  font-size: 2rem;
  font-weight: 800;
  color: #0f172a;
  letter-spacing: -0.02em;
  margin: 0 0 0.5rem;
  line-height: 1.2;
}

.home-products-section-header p {
  color: #64748b;
  font-size: 1rem;
  margin: 0 auto;
  max-width: 560px;
}

/* Product card — premium tile (matches category cards) */
.featured-products-section .home-product-card,
.latest-products-section .home-product-card {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  width: 100%;
  text-decoration: none;
  color: inherit;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06);
  overflow: hidden;
  transition: border-color 0.25s ease, box-shadow 0.25s ease, transform 0.25s ease;
}

.featured-products-section .home-product-card:hover,
.latest-products-section .home-product-card:hover {
  border-color: var(--color-primary, #17a2b8);
  box-shadow: 0 14px 32px rgba(15, 23, 42, 0.1);
  text-decoration: none;
  color: inherit;
}

/* Demote twin product rail so featured leads — keep hierarchy without looking unfinished */
.latest-products-section.section--secondary {
  padding-top: 3.25rem;
  padding-bottom: 3.25rem;
  background: #f8fafc;
}

.latest-products-section.section--secondary .home-products-section-header {
  margin-bottom: 2rem;
}

.latest-products-section.section--secondary .home-products-section-header h2 {
  font-size: 1.75rem;
}

.latest-products-section.section--secondary .home-product-card {
  border-radius: 14px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.home-product-visual {
  position: relative;
  width: 100%;
  aspect-ratio: 2 / 3;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
  overflow: hidden;
}

.home-product-image {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 0.75rem;
  transition: transform 0.35s ease;
}

.home-product-card:hover .home-product-image {
  transform: scale(1.04);
}

.home-product-badge {
  position: absolute;
  z-index: 2;
  font-size: 0.625rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  padding: 0.25rem 0.5rem;
  border-radius: 999px;
  line-height: 1.2;
  white-space: nowrap;
}

.home-product-badge--new {
  top: 8px;
  left: 8px;
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(16, 185, 129, 0.35);
}

.home-product-badge--offers {
  top: 8px;
  right: 8px;
  background: rgba(15, 23, 42, 0.82);
  color: #ffffff;
  backdrop-filter: blur(4px);
}

.home-product-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f1f5f9;
  color: #94a3b8;
  font-size: 1.75rem;
  min-height: 100%;
  padding: 0;
}

.home-section-empty {
  padding: 2.5rem 1.25rem;
  text-align: center;
  border: 1px dashed #cbd5e1;
  border-radius: 16px;
  background: #f8fafc;
}

.home-section-empty p {
  margin: 0;
  color: #64748b;
  font-size: 0.9375rem;
}

/* Shared homepage “view all” CTA (genres / authors / publishers / blog) */
.home-section-cta,
.categories-horizontal-section .btn.btn-outline-primary,
.view-all-link.home-section-cta {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.625rem 1.5rem;
  border: 1.5px solid var(--color-primary, #17a2b8);
  border-radius: 999px;
  background: transparent;
  color: var(--color-primary, #17a2b8);
  font-weight: 600;
  font-size: 0.9375rem;
  text-decoration: none;
  box-shadow: 0 1px 2px rgba(23, 162, 184, 0.06);
  transition: background 0.2s ease, color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease, gap 0.2s ease;
}

.home-section-cta:hover,
.categories-horizontal-section .btn.btn-outline-primary:hover {
  background: linear-gradient(135deg, #17a2b8 0%, #138496 100%);
  color: #ffffff;
  border-color: transparent;
  transform: translateY(-1px);
  box-shadow: 0 6px 14px rgba(23, 162, 184, 0.3);
  text-decoration: none;
  gap: 0.7rem;
}

.home-section-cta i,
.categories-horizontal-section .btn.btn-outline-primary i {
  transition: transform 0.2s ease;
}

.home-section-cta:hover i,
.categories-horizontal-section .btn.btn-outline-primary:hover i {
  transform: translateX(3px);
}

/* Align legacy .section-header with homepage product headers */
.authors-home-section .section-header,
.brands-section .section-header,
.how-it-works .section-header {
  margin-bottom: 2.5rem;
}

.authors-home-section .section-header h2,
.brands-section .section-header h2,
.how-it-works .section-header h2 {
  font-size: 2rem;
  font-weight: 800;
  color: #0f172a;
  letter-spacing: -0.02em;
  margin: 0 0 0.5rem;
  line-height: 1.2;
}

.authors-home-section .section-header p,
.brands-section .section-header p,
.how-it-works .section-header p {
  color: #64748b;
  font-size: 1rem;
  margin: 0 auto;
  max-width: 560px;
}

.authors-home-section,
.brands-section,
.how-it-works {
  padding-top: 3.5rem;
  padding-bottom: 3.5rem;
}

.home-product-body {
  display: flex;
  flex-direction: column;
  flex: 1;
  padding: 0.875rem 1rem 1rem;
  gap: 0.375rem;
}

.home-product-brand {
  font-size: 0.625rem;
  font-weight: 700;
  color: #17a2b8;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.home-product-name {
  font-size: 0.8125rem;
  font-weight: 500;
  color: #0f172a;
  line-height: 1.35;
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 2.6em;
  transition: color 0.2s ease;
}

.home-product-card:hover .home-product-name {
  color: #138496;
}

.home-product-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-top: auto;
  padding-top: 0.375rem;
}

.home-product-pricing {
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
  min-width: 0;
}

.home-product-price {
  font-size: 0.9375rem;
  font-weight: 800;
  color: #0f172a;
  line-height: 1.1;
}

.home-product-price sup.curreny {
  font-size: 0.625rem;
  font-weight: 700;
}

.home-product-time {
  font-size: 0.625rem;
  color: #94a3b8;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  white-space: nowrap;
}

.home-product-time i {
  font-size: 0.5625rem;
}

.home-product-rating {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.625rem;
  color: #64748b;
}

.home-product-rating-count {
  color: #94a3b8;
}

.home-product-arrow {
  width: 28px;
  height: 28px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #f1f5f9;
  color: #94a3b8;
  font-size: 0.6875rem;
  flex-shrink: 0;
  transition: background 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.home-product-card:hover .home-product-arrow {
  background: #17a2b8;
  color: #ffffff;
  transform: translateX(2px);
}

.stagger-children > [class*="col-"]:nth-child(1) .home-product-card { animation-delay: 0.04s; }
.stagger-children > [class*="col-"]:nth-child(2) .home-product-card { animation-delay: 0.08s; }
.stagger-children > [class*="col-"]:nth-child(3) .home-product-card { animation-delay: 0.12s; }
.stagger-children > [class*="col-"]:nth-child(4) .home-product-card { animation-delay: 0.16s; }
.stagger-children > [class*="col-"]:nth-child(5) .home-product-card { animation-delay: 0.2s; }
.stagger-children > [class*="col-"]:nth-child(6) .home-product-card { animation-delay: 0.24s; }

@media (max-width: 768px) {
  .featured-products-section,
  .latest-products-section {
    padding: 2.5rem 0;
  }

  .home-products-section-header h2 {
    font-size: 1.5rem;
  }

  .home-product-body {
    padding: 0.625rem 0.75rem 0.75rem;
  }

  .home-product-name {
    font-size: 0.75rem;
    min-height: 2.5em;
  }

  .home-product-price {
    font-size: 0.875rem;
  }

  .home-product-image {
    padding: 0.625rem;
  }

  .home-product-badge {
    font-size: 0.5625rem;
    padding: 0.2rem 0.45rem;
  }

  .home-product-arrow {
    width: 24px;
    height: 24px;
    font-size: 0.625rem;
  }

  .featured-products-section .home-product-card:hover,
  .latest-products-section .home-product-card:hover {
    transform: none;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06);
  }
}

@media (max-width: 575px) {
  .home-products-section-header p {
    font-size: 0.9375rem;
  }

  .home-product-time {
    font-size: 0.5625rem;
  }
}

/* Enhanced Bootstrap Grid Fixes — brands rows only */
.brands-section .row {
  display: flex !important;
  flex-wrap: wrap;
  margin-right: -12px;
  margin-left: -12px;
}

/* Responsive column widths (legacy section grid) */
@media (min-width: 1200px) {
  .categories-horizontal-section .col-lg-2 {
    flex: 0 0 15%;
    max-width: 16.666667%;
  }
}

@media (min-width: 992px) and (max-width: 1199px) {
  .categories-horizontal-section .col-md-3 {
    flex: 0 0 25%;
    max-width: 25%;
  }
}

@media (min-width: 768px) and (max-width: 991px) {
  .categories-horizontal-section .col-sm-4 {
    flex: 0 0 33.333333%;
    max-width: 33.333333%;
  }
}

@media (min-width: 576px) and (max-width: 767px) {
  .categories-horizontal-section .col-6 {
    flex: 0 0 50%;
    max-width: 50%;
  }
}

@media (max-width: 575px) {
  .categories-horizontal-section .col-6 {
    flex: 0 0 50%;
    max-width: 50%;
  }
}

/* Brands Section — 6 per row (matches categories grid) */
.brands-grid-container {
  overflow: hidden;
}

.brands-section .row {
  display: flex !important;
  flex-wrap: wrap;
  margin-right: -12px;
  margin-left: -12px;
  row-gap: 1rem;
}

.brands-section .col-6,
.brands-section .col-sm-4,
.brands-section .col-md-3,
.brands-section .col-lg-2,
.brands-section .col-xl-2 {
  padding-right: 12px;
  padding-left: 12px;
  flex: 0 0 auto;
}

.brands-section .col-6 {
  flex: 0 0 50%;
  max-width: 50%;
}

@media (min-width: 576px) {
  .brands-section .col-sm-4 {
    flex: 0 0 33.333333%;
    max-width: 33.333333%;
  }
}

@media (min-width: 768px) {
  .brands-section .col-md-3 {
    flex: 0 0 25%;
    max-width: 25%;
  }
}

@media (min-width: 992px) {
  .brands-section .col-lg-2 {
    flex: 0 0 16.666667%;
    max-width: 16.666667%;
  }
}

@media (min-width: 1200px) {
  .brands-section .col-xl-2 {
    flex: 0 0 16.666667%;
    max-width: 16.666667%;
  }
}

.brands-section .brand-card {
  height: 100%;
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 0.75rem;
  padding: 0.875rem 1rem;
  background: var(--color-white, #fff);
  border: 1px solid var(--color-gray-200, #e2e8f0);
  border-radius: 8px;
  text-decoration: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.brands-section .brand-card:hover {
  border-color: #17a2b8;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(23, 162, 184, 0.1);
}

.brands-section .brand-card-icon {
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #17a2b8 0%, #138496 100%);
  border-radius: 6px;
}

.brands-section .brand-initial {
  font-size: 1.125rem;
  font-weight: 700;
  color: #fff;
}

.brands-section .brand-card-content {
  flex: 1;
  min-width: 0;
}

.brands-section .brand-name {
  display: block;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--color-gray-900, #0f172a);
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.brands-section .brand-cta {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.75rem;
  color: #17a2b8;
  font-weight: 500;
}

@media (max-width: 575px) {
  .brands-section .brand-card {
    padding: 0.75rem;
    gap: 0.625rem;
  }

  .brands-section .brand-card-icon {
    width: 40px;
    height: 40px;
  }

  .brands-section .brand-name {
    font-size: 0.8125rem;
  }
}

/* How It Works — 3 cards per row (CSS grid handles gap correctly) */
.how-it-works-grid-container {
  overflow: hidden;
}

.how-it-works .how-it-works-grid {
  display: grid !important;
  grid-template-columns: 1fr;
  gap: 1rem;
  margin: 0 !important;
}

@media (min-width: 768px) {
  .how-it-works .how-it-works-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1.5rem;
  }
}

.how-it-works .how-it-works-grid > [class*="col-"] {
  padding: 0 !important;
  flex: unset !important;
  max-width: none !important;
  width: auto !important;
  min-width: 0;
}

.how-it-works .step-card {
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

/* Section Headers */
.section-header {
  text-align: center;
  margin-bottom: 3rem;
}

.section-header h2 {
  font-size: 2rem;
  font-weight: 700;
  color: #212529;
  margin-bottom: 1rem;
}

.section-header p {
  font-size: 1.125rem;
  color: #6c757d;
  margin-bottom: 0;
}

/* Spacing Utilities */
.mt-2 { margin-top: 0.5rem; }
.mt-3 { margin-top: 1rem; }
.mt-4 { margin-top: 1.5rem; }
.mt-5 { margin-top: 3rem; }
.mt-6 { margin-top: 4rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-3 { margin-bottom: 1rem; }
.mb-4 { margin-bottom: 1.5rem; }
.mb-5 { margin-bottom: 3rem; }
.mb-6 { margin-bottom: 4rem; }
.mt-auto { margin-top: auto; }

/* Gap Utilities */
.g-3 { gap: 1rem; }
.g-4 { gap: 1.5rem; }
.g-md-4 { gap: 1.5rem; }

/* Flexbox Utilities */
.d-flex { display: flex !important; }
.flex-column { flex-direction: column !important; }
.align-items-center { align-items: center !important; }
.justify-content-center { justify-content: center !important; }
.justify-content-between { justify-content: space-between !important; }
.text-center { text-align: center !important; }

/* Text Utilities */
.fw-bold { font-weight: 700 !important; }
.text-muted { color: #6c757d !important; }

/* Button Styles */
.btn {
  display: inline-block;
  font-weight: 400;
  line-height: 1.5;
  color: #212529;
  text-align: center;
  text-decoration: none;
  vertical-align: middle;
  cursor: pointer;
  -webkit-user-select: none;
  -moz-user-select: none;
  user-select: none;
  background-color: transparent;
  border: 1px solid transparent;
  padding: 0.375rem 0.75rem;
  font-size: 1rem;
  border-radius: 0.25rem;
  transition: color 0.15s ease-in-out, background-color 0.15s ease-in-out, border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

.btn-outline-primary {
  color: var(--color-primary, #17a2b8);
  border-color: var(--color-primary, #17a2b8);
}

.btn-outline-primary:hover {
  color: #fff;
  background-color: var(--color-primary, #17a2b8);
  border-color: var(--color-primary, #17a2b8);
}

/* Match site-wide container (modern-frontend) — not Bootstrap's narrower breakpoints */
.container {
  width: 100%;
  max-width: 1680px;
  margin-right: auto;
  margin-left: auto;
  padding-right: 1.5rem;
  padding-left: 1.5rem;
}

/* =====================================================
   HOMEPAGE RESPONSIVE IMPROVEMENTS
   ===================================================== */

/* Hero search box - fluid width instead of fixed % */
.search-box {
  width: min(90%, 600px);
  margin: 0 auto;
}

@media (min-width: 992px) {
  .search-box {
    width: min(60%, 600px);
  }
}

@media (min-width: 1200px) {
  .search-box {
    width: min(50%, 600px);
  }
}

/* Fluid category grid */
.categories-grid-container {
  overflow: visible;
}

.categories-grid-container .categories-home-grid {
  row-gap: 0.625rem;
}

/* Category section — small screens */
@media (max-width: 575px) {
  .categories-section-header h2 {
    font-size: 1.5rem;
  }

  .categories-section-header p {
    font-size: 0.9375rem;
  }
}

@media (max-width: 400px) {
  .categories-horizontal-section {
    padding: 2.5rem 0 3rem;
  }
}

/* Section headers responsive fix */
@media (max-width: 575px) {
  .section-header h2 {
    font-size: 1.375rem;
  }

  .section-header p {
    font-size: 0.875rem;
  }
}

/* =====================================================
   HERO SEARCH BOX — REFINED UI
   ===================================================== */
.hero .search-box {
  position: relative;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  padding: 6px 6px 6px 14px;
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.06), 0 1px 2px rgba(15, 23, 42, 0.04);
  display: flex;
  align-items: center;
  gap: 6px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  transform: none;
}

.hero .search-box:hover {
  border-color: #cbd5e1;
  box-shadow: 0 6px 20px rgba(15, 23, 42, 0.08), 0 1px 2px rgba(15, 23, 42, 0.04);
  transform: none;
}

.hero .search-box:focus-within {
  border-color: #17a2b8;
  box-shadow: 0 0 0 4px rgba(23, 162, 184, 0.15), 0 8px 24px rgba(23, 162, 184, 0.12);
  transform: none;
}

.hero .search-box .search-box-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #94a3b8;
  font-size: 16px;
  width: 22px;
  flex-shrink: 0;
  pointer-events: none;
  transition: color 0.2s ease;
}

.hero .search-box:focus-within .search-box-icon {
  color: #17a2b8;
}

.hero .search-box input {
  flex: 1;
  border: none;
  padding: 14px 8px;
  font-size: 16px;
  line-height: 1.4;
  background: transparent;
  color: #0f172a;
  border-radius: 0;
  min-width: 0;
  text-align: left;
  width: auto;
}

.hero .search-box input:focus { outline: none; }

.hero .search-box input::placeholder {
  color: #94a3b8;
  font-weight: 400;
  opacity: 1;
}

.hero .search-box .search-box-clear {
  display: none;
  background: transparent;
  border: none;
  padding: 0;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  color: #94a3b8;
  font-size: 13px;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.15s ease, color 0.15s ease;
  box-shadow: none;
}

.hero .search-box .search-box-clear:hover {
  background: #f1f5f9;
  color: #475569;
  transform: none;
  box-shadow: none;
}

.hero .search-box.has-value .search-box-clear {
  display: inline-flex;
}

.hero .search-box .search-box-submit {
  background: linear-gradient(135deg, #17a2b8 0%, #138496 100%);
  border: none;
  padding: 12px 22px;
  border-radius: 10px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  font-size: 15px;
  color: #ffffff;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.2s ease;
  flex-shrink: 0;
  width: auto;
  box-shadow: 0 2px 8px rgba(23, 162, 184, 0.25);
}

.hero .search-box .search-box-submit:hover {
  background: linear-gradient(135deg, #138496 0%, #0f6674 100%);
  box-shadow: 0 6px 16px rgba(23, 162, 184, 0.35);
  transform: translateY(-1px);
}

.hero .search-box .search-box-submit:active {
  transform: translateY(0);
  box-shadow: 0 2px 6px rgba(23, 162, 184, 0.25);
}

/* Refined popular searches under hero */
.hero .popular-searches {
  margin-top: 1.25rem;
  gap: 8px;
  align-items: center;
}

.hero .popular-searches span {
  color: rgba(255, 255, 255, 0.85);
  font-weight: 500;
  font-size: 0.875rem;
}

.hero .popular-searches a {
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.22);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  padding: 0.375rem 0.875rem;
  font-weight: 500;
  font-size: 0.8125rem;
  transition: background 0.18s ease, border-color 0.18s ease, transform 0.18s ease;
}

.hero .popular-searches a:hover {
  background: rgba(255, 255, 255, 0.24);
  border-color: rgba(255, 255, 255, 0.4);
  transform: translateY(-1px);
  text-decoration: none;
}

/* Mobile: keep horizontal layout, just tighten paddings (override modern-frontend.css stack) */
@media (max-width: 768px) {
  .hero .search-box {
    flex-direction: row;
    align-items: center;
    padding: 5px 5px 5px 12px;
    border-radius: 12px;
  }

  .hero .search-box input {
    text-align: left;
    padding: 12px 6px;
    font-size: 15px;
    width: auto;
    border-radius: 0;
  }

  .hero .search-box .search-box-submit {
    width: auto;
    padding: 10px 14px;
    border-radius: 9px;
    font-size: 14px;
  }

  .hero .search-box .search-box-icon {
    width: 18px;
    font-size: 15px;
  }
}

/* Product card touch target */
@media (max-width: 767px) {
  .product-card {
    min-height: 0;
  }

  .product-card a {
    padding: 2px;
    display: block;
  }
}

/* Homepage genre card structure (lean extract; full rules live in book-search.css for /kateg/) */
.genres-cards-row > .genres-grid-col,
.genres-cards-row > .col-6 {
  display: flex;
}
.genres-card {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
}
.genres-card-main {
  display: flex;
  flex-direction: column;
  flex: 1;
  text-decoration: none;
  color: inherit;
  min-height: 0;
}
.genres-card-icon-wrap {
  flex-shrink: 0;
}
.genres-card-icon,
.genres-card-image {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Homepage latest blog (lean extract from blog.css) */
.home-blog-latest {
  padding: 3.5rem 0;
  background: var(--color-gray-50, #f8fafc);
}
.home-blog-latest .home-blog-header {
  text-align: center;
  margin-bottom: 2.5rem;
}
.home-blog-latest .home-blog-header .section-eyebrow {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--color-primary, #17a2b8);
  background: rgba(23, 162, 184, 0.1);
  padding: 0.25rem 0.75rem;
  border-radius: 999px;
  margin-bottom: 0.875rem;
}
.home-blog-latest .home-blog-header h2 {
  margin: 0 0 0.5rem;
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--color-gray-900, #0f172a);
  line-height: 1.2;
}
.home-blog-latest .home-blog-header p {
  margin: 0 auto;
  max-width: 560px;
  color: var(--color-gray-500, #64748b);
  font-size: 1rem;
}
.home-blog-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.25rem;
}
.home-blog-card {
  background: #fff;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid var(--color-gray-200, #e2e8f0);
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.05);
  text-decoration: none;
  color: inherit;
  display: flex;
  flex-direction: column;
  transition: box-shadow 0.2s ease;
}
.home-blog-card:hover {
  box-shadow: 0 12px 24px rgba(15, 23, 42, 0.08);
}
.home-blog-card-image {
  aspect-ratio: 16 / 10;
  background: var(--color-gray-100, #f1f5f9);
  overflow: hidden;
}
.home-blog-card-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.home-blog-card-body {
  padding: 1rem 1.1rem 1.15rem;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  flex: 1;
}
.home-blog-card-body h3 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1.35;
  color: var(--color-gray-900, #0f172a);
}
.home-blog-card-body p {
  margin: 0;
  font-size: 0.9rem;
  color: var(--color-gray-500, #64748b);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.home-blog-card-meta {
  margin-top: auto;
  font-size: 0.8rem;
  color: var(--color-gray-400, #94a3b8);
}
.home-blog-more,
.home-blog-latest .home-section-cta {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 1.5rem;
  padding: 0.625rem 1.5rem;
  border: 1.5px solid var(--color-primary, #17a2b8);
  border-radius: 999px;
  background: transparent;
  font-weight: 600;
  font-size: 0.9375rem;
  color: var(--color-primary, #17a2b8);
  text-decoration: none;
}
@media (max-width: 900px) {
  .home-blog-grid {
    grid-template-columns: 1fr;
  }
}
