/* togo-page-category.css
   ─────────────────────────────────────────────────────────────────
   Polish-laag specifiek voor category.html (15 issues).
   Scope: body[data-page="category"]
   Load order: NA category-glowup.css + togo-final-polish.css. */

/* 1+5. Hero stats: 4-col vanaf 641, cap 3-col vanaf 1024 voor top-picks */
@media (min-width: 641px) {
  body[data-page="category"] .cat-hero__stats {
    grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
  }
}
@media (min-width: 1024px) {
  body[data-page="category"] .category-top-picks {
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
  }
}

/* Desktop rhythm: keep the hero premium, but remove the oversized blank field
   between quick filters and top picks caused by global section padding. */
@media (min-width: 768px) {
  body[data-page="category"] main > .section:first-of-type {
    padding-top: clamp(48px, 4vw, 64px) !important;
    padding-bottom: clamp(20px, 2vw, 28px) !important;
  }

  body[data-page="category"] main > .section:nth-of-type(2) {
    padding-top: clamp(22px, 2.2vw, 30px) !important;
  }

  body[data-page="category"] main > .section:nth-of-type(2) .cat-section-head {
    margin-top: 0 !important;
  }
}

/* 2. Hero stats mobile compactere padding */
@media (max-width: 480px) {
  body[data-page="category"] .cat-stat {
    padding: 12px 12px;
    gap: 8px;
  }
  body[data-page="category"] .cat-hero__stats {
    gap: 8px;
  }
}

/* 2b. Mobile category hero density: keep the premium hero, but let products
   enter the first viewport instead of spending the whole screen on filters. */
@media (max-width: 640px) {
  body[data-page="category"] main > .section:first-of-type {
    padding-top: 20px !important;
    padding-bottom: 18px !important;
  }

  body[data-page="category"] .cat-hero {
    margin-bottom: 12px !important;
    padding: 18px 16px 16px !important;
    border-radius: 16px !important;
  }

  body[data-page="category"] .cat-hero__breadcrumb {
    display: none !important;
  }

  body[data-page="category"] .cat-hero__eyebrow {
    margin-bottom: 6px !important;
    font-size: 10.5px !important;
    letter-spacing: .14em !important;
  }

  body[data-page="category"] .cat-hero__title {
    margin-bottom: 8px !important;
    font-size: clamp(27px, 7.4vw, 31px) !important;
    line-height: 1.05 !important;
    letter-spacing: 0 !important;
  }

  body[data-page="category"] .cat-hero__lead {
    margin-bottom: 14px !important;
    font-size: 14px !important;
    line-height: 1.42 !important;
  }

  body[data-page="category"] .cat-hero__stats {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 6px !important;
  }

  body[data-page="category"] .cat-stat {
    min-height: 58px;
    padding: 8px 9px !important;
    border-radius: 10px;
  }

  body[data-page="category"] .cat-stat__label {
    margin-bottom: 4px !important;
    font-size: 9px !important;
    line-height: 1.1 !important;
    letter-spacing: .08em !important;
  }

  body[data-page="category"] .cat-stat__value {
    font-size: 19px !important;
    line-height: 1 !important;
  }

  body[data-page="category"] .cat-stat__sub {
    display: none !important;
  }

  body[data-page="category"] .cat-quick-filters {
    display: grid !important;
    grid-template-columns: .72fr 1.28fr 1.1fr .78fr .97fr;
    align-items: center;
    gap: 6px !important;
    margin-bottom: 0 !important;
    padding: 0 0 4px !important;
    overflow-x: visible !important;
    overflow-y: hidden !important;
    scrollbar-width: none;
  }

  body[data-page="category"] .cat-quick-filters::-webkit-scrollbar {
    display: none;
  }

  body[data-page="category"] .cat-quick-filters__label,
  body[data-page="category"] .cat-quick-filter {
    min-width: 0 !important;
    white-space: nowrap !important;
  }

  body[data-page="category"] .cat-quick-filters__label {
    margin-right: 2px !important;
    font-size: 10px !important;
    letter-spacing: .07em !important;
  }

  body[data-page="category"] .cat-quick-filter {
    justify-content: center;
    width: 100%;
    min-height: 42px;
    padding: 7px 4px !important;
    font-size: 11px !important;
    letter-spacing: 0;
    border-radius: 10px !important;
  }

  body[data-page="category"] .cat-quick-filter.is-active::before {
    display: none !important;
  }

  body[data-page="category"] main > .section:nth-of-type(2) {
    padding-top: 24px !important;
  }

  body[data-page="category"] .cat-section-head {
    margin-top: 0 !important;
  }
}

/* 3. Light theme: stat-value moet text-color (was hardcoded #fff = invisible op wit) */
html[data-theme="light"] body[data-page="category"] .cat-stat__value {
  color: var(--color-text) !important;
}

/* 4. Light theme: hero gradient soft warm tint ipv dark rood */
html[data-theme="light"] body[data-page="category"] .cat-hero {
  background:
    radial-gradient(ellipse 80% 60% at 75% 0%, rgba(184, 37, 47, 0.06), transparent 70%),
    radial-gradient(ellipse 60% 50% at 25% -10%, rgba(184, 37, 47, 0.04), transparent 60%),
    var(--color-bg) !important;
}

/* 6. Top-picks rail mobile: stable compact grid, not an oversized product rail. */
@media (max-width: 640px) {
  body[data-page="category"] .section > .container:has(.category-top-picks),
  body[data-page="category"] .section > .container:has(#category-grid) {
    padding-inline: 16px;
  }

  body[data-page="category"] .category-top-picks {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 11px !important;
    overflow: visible !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    margin-inline: 0 !important;
    padding-inline: 0 !important;
    mask-image: none !important;
    -webkit-mask-image: none !important;
    scroll-snap-type: none !important;
  }

  body[data-page="category"] .category-top-picks > .card {
    flex: initial !important;
    min-width: 0 !important;
    max-width: 100% !important;
    overflow: hidden !important;
    scroll-snap-align: unset !important;
  }
}

@media (max-width: 380px) {
  body[data-page="category"] #category-grid.grid,
  body[data-page="category"] #category-grid.grid-3 {
    grid-template-columns: minmax(0, 1fr) !important;
    gap: 14px !important;
  }

  body[data-page="category"] #category-grid .card__body {
    padding: 16px 18px !important;
  }
}

@media (max-width: 340px) {
  body[data-page="category"] .category-top-picks {
    grid-template-columns: minmax(0, 1fr) !important;
    gap: 12px !important;
  }
}

/* 375px should stay dense and conversion-friendly. The measured content width
   is 311px, so two 150.5px cards + 10px gap fit without clipping. */
@media (min-width: 341px) and (max-width: 380px) {
  body[data-page="category"] #category-grid.grid,
  body[data-page="category"] #category-grid.grid-3 {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 11px !important;
  }

  body[data-page="category"] #category-grid .card__body {
    padding: 12px 13px 13px !important;
  }
}

/* 6b. Related-category cards are injected by category.js and must not inherit
   wider card rails on mobile. Keep them stacked because copy is text-heavy. */
@media (max-width: 640px) {
  body[data-page="category"] .togo-cat-related .container,
  body[data-page="category"] .togo-cat-related__grid,
  body[data-page="category"] .togo-cat-related__card {
    box-sizing: border-box;
    min-width: 0;
    max-width: 100%;
  }

  body[data-page="category"] .togo-cat-related__grid {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) !important;
    gap: 10px !important;
    overflow: visible !important;
    width: 100% !important;
  }

  body[data-page="category"] .togo-cat-related__card {
    width: 100% !important;
    padding: 14px 16px !important;
    border-radius: 14px !important;
    overflow: hidden !important;
  }

  body[data-page="category"] .togo-cat-related__title,
  body[data-page="category"] .togo-cat-related__desc,
  body[data-page="category"] .togo-cat-related__cta {
    overflow-wrap: anywhere;
  }
}

/* 6c. Category research cards were a horizontal rail on mobile, which made
   cards appear clipped at viewport edges. Stack them for readable titles. */
@media (max-width: 640px) {
  body[data-page="category"] #category-research-grid.grid-3 {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) !important;
    gap: 10px !important;
    overflow: visible !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    margin-inline: 0 !important;
    padding-inline: 0 !important;
    box-sizing: border-box;
    mask-image: none !important;
    -webkit-mask-image: none !important;
    scroll-snap-type: none !important;
  }

  body[data-page="category"] #category-research-grid.grid-3 > .card {
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    flex: initial !important;
    overflow: hidden !important;
    scroll-snap-align: unset !important;
  }
}

/* 7. Quick-filter chips focus-visible ring (WCAG 2.4.7) */
body[data-page="category"] .cat-quick-filter:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}

/* 8. All-compounds grid: equal-height cards */
body[data-page="category"] #category-grid .card {
  display: flex;
  flex-direction: column;
  height: 100%;
}
body[data-page="category"] #category-grid .card__body {
  display: flex;
  flex-direction: column;
  flex: 1;
}
body[data-page="category"] #category-grid .card__body-text {
  margin-top: auto;
}

@media (min-width: 641px) and (max-width: 1023px) {
  body[data-page="category"] #category-grid .card__body {
    min-height: 164px;
    box-sizing: border-box;
  }

  body[data-page="category"] .category-top-picks {
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    gap: 12px !important;
  }
}

@media (min-width: 1024px) {
  body[data-page="category"] #category-grid .card__body {
    min-height: 184px;
    box-sizing: border-box;
  }

  body[data-page="category"] .category-top-picks .card__body {
    min-height: 0;
    box-sizing: border-box;
  }
}

/* Product thumbs are square packshots. Keep product detail fully visible in
   All compounds and top-picks instead of letting the global cover rule crop. */
body[data-page="category"] #category-grid a.card.card--media .card__media{
  aspect-ratio: 1 / 1 !important;
}

body[data-page="category"] .category-top-picks a.card.card--media .card__media{
  aspect-ratio: 1 / 1 !important;
}

body[data-page="category"] #category-grid a.card.card--media .card__media,
body[data-page="category"] .category-top-picks a.card.card--media .card__media{
  background:
    radial-gradient(circle at 50% 38%, rgba(255, 255, 255, 0.10), transparent 58%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.035), rgba(0, 0, 0, 0.10)) !important;
}

body[data-page="category"] #category-grid a.card.card--media .card__media img,
body[data-page="category"] .category-top-picks a.card.card--media .card__media img{
  object-fit: contain !important;
  object-position: center center !important;
  padding: 28px 24px 24px !important;
  box-sizing: border-box !important;
}

body[data-page="category"] #category-grid a.card.card--media .card__media::before,
body[data-page="category"] .category-top-picks a.card.card--media .card__media::before{
  height: 24% !important;
  opacity: 0.72;
}

body[data-page="category"] .category-top-picks .card__body {
  min-height: 0 !important;
  box-sizing: border-box;
}

@media (max-width: 899px) {
  body[data-page="category"] .category-top-picks .card__body {
    padding: 10px 11px 12px !important;
    text-align: center;
  }

  body[data-page="category"] .category-top-picks .card__eyebrow,
  body[data-page="category"] .category-top-picks .card__body-text {
    display: none !important;
  }

  body[data-page="category"] .category-top-picks .card__title {
    font-size: 13.75px !important;
    line-height: 1.2 !important;
    letter-spacing: 0 !important;
    overflow-wrap: anywhere;
  }
}

@media (max-width: 640px) {
  body[data-page="category"] .category-top-picks a.card.card--media .card__media {
    aspect-ratio: 1 / 1 !important;
  }

  body[data-page="category"] #category-grid a.card.card--media .card__media img,
  body[data-page="category"] .category-top-picks a.card.card--media .card__media img {
    padding: 26px 18px 18px !important;
  }

  body[data-page="category"] :is(#category-grid, .category-top-picks) a.card.card--media .card__media > .togo-wishlist-heart {
    top: 7px !important;
    right: 7px !important;
    width: 32px !important;
    height: 32px !important;
    min-width: 32px !important;
    min-height: 32px !important;
    border-color: rgba(255, 255, 255, .18) !important;
    background: linear-gradient(180deg, rgba(17,17,20,.48), rgba(8,8,10,.34)) !important;
    box-shadow: 0 5px 14px rgba(0,0,0,.13), inset 0 1px 0 rgba(255,255,255,.13) !important;
  }

  body[data-page="category"] :is(#category-grid, .category-top-picks) a.card.card--media .card__media > .togo-wishlist-heart svg {
    width: 14px !important;
    height: 14px !important;
  }

  body[data-page="category"] .category-top-picks a.card.card--media .card-badge-stack .togo-stock {
    top: 7px !important;
    left: 7px !important;
  }

  body[data-page="category"] .category-top-picks a.card.card--media :is(.card-badge-stack .togo-stock, .card-badge-stack .card__badge, .card__media > .card__badge) {
    min-height: 16px !important;
    max-width: calc(100% - 50px) !important;
    padding: 3px 6px !important;
    font-size: 8px !important;
    letter-spacing: .01em !important;
  }

  body[data-page="category"] .category-top-picks .card:first-child .card__media::after {
    bottom: 7px !important;
    left: 7px !important;
    padding: 4px 7px !important;
    font-size: 8px !important;
    letter-spacing: .04em !important;
  }
}

@media (min-width: 641px) and (max-width: 899px) {
  body[data-page="category"] .category-top-picks .card__body {
    padding: 11px 12px 13px !important;
  }

  body[data-page="category"] .category-top-picks .card__title {
    font-size: 14px !important;
  }
}

/* 9. Mobile 2-col cards minimum hoogte voor consistent price+CTA */
@media (max-width: 640px) {
  body[data-page="category"] #category-grid .card {
    min-height: 168px;
  }

  body[data-page="category"] #category-grid .card__body-text {
    display: none !important;
  }
}

/* 10. Section-head divider richting omkeren (count is rechts, gradient lijdt erheen) */
body[data-page="category"] .cat-section-head__bar {
  background: linear-gradient(90deg, transparent, var(--color-border-strong)) !important;
}

@media (max-width: 480px) {
  body[data-page="category"] .section--surface .cat-section-head {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    column-gap: 12px;
    row-gap: 8px;
  }

  body[data-page="category"] .section--surface .cat-section-head__title {
    grid-column: 1 / -1;
    max-width: 100%;
    line-height: 1.24;
    text-wrap: balance;
  }

  body[data-page="category"] .section--surface .cat-section-head__bar {
    grid-column: 1;
    margin-left: 0;
  }

  body[data-page="category"] .section--surface .cat-section-head__count {
    grid-column: 2;
    white-space: nowrap;
  }
}

/* 11. Top-pick badge mobile: align met badge-stack (8/8 ipv 12/12) */
@media (max-width: 640px) {
  body[data-page="category"] .card[data-is-top-pick] .card__media::after {
    left: 7px !important;
  }
}

/* 12. Stack-CTA light theme overrides op category page */
html[data-theme="light"] body[data-page="category"] .stack-cta {
  background: linear-gradient(135deg, rgba(184, 37, 47, 0.04), rgba(184, 37, 47, 0.02)) !important;
  border-color: rgba(10, 10, 12, 0.16) !important;
  color: var(--color-text) !important;
}
html[data-theme="light"] body[data-page="category"] .stack-cta__title,
html[data-theme="light"] body[data-page="category"] .stack-cta__lead {
  color: var(--color-text) !important;
}

/* 13. Breadcrumb separator volle contrast (was 0.4 opacity = niet AA) */
body[data-page="category"] .cat-hero__breadcrumb__sep {
  color: var(--color-text-muted) !important;
  opacity: 1 !important;
}

/* 14. Quick-filter active checkmark: vivid accent voor leesbaarheid */
body[data-page="category"] .cat-quick-filter.is-active::before {
  color: var(--color-accent-vivid, var(--color-accent)) !important;
  font-weight: 800;
}

body[data-page="category"] .cat-quick-filter.is-active,
body[data-page="category"] .cat-quick-filter[aria-pressed="true"] {
  background: color-mix(in srgb, var(--color-accent) 9%, var(--color-bg-elevated)) !important;
  border-color: color-mix(in srgb, var(--color-accent) 36%, var(--color-border)) !important;
  color: var(--color-text) !important;
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--color-accent) 10%, transparent) !important;
}

/* 15. Scroll-snap padding voor stable active-chip op rotate */
body[data-page="category"] .cat-quick-filters {
  scroll-padding-inline: 20px;
}

/* Dense mobile product grids use the full safe content width; fixed right-side
   FABs would cover the second card column, so catalog pages keep chrome quiet. */
@media (max-width: 899px) {
  body[data-page="category"] #togo-feedback-fab,
  body[data-page="category"] .tgp-back-to-top {
    display: none !important;
  }
}

/* Print: hide CTAs + filters die niet relevant zijn */
@media print {
  body[data-page="category"] .cat-quick-filters,
  body[data-page="category"] .stack-cta { display: none !important; }
}
