/* ==========================================================================
   CrysMed — "Find the right care, your way." category explorer
   Rebuilt to match the client-approved reference — see
   new-designs/Find the right care, your way..png. Replaces the dark
   teal cat-carousel band with a light search + filter + full grid layout.
   Category icon art (assets/icons/categories/*.png) is cropped directly
   from the reference image — no fabricated/generated imagery.
   ========================================================================== */

.cat-search {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  background: var(--white);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-md);
  padding: var(--sp-2);
  margin-bottom: var(--sp-5);
  max-width: 720px;
}
.cat-search__icon { display: inline-flex; padding-left: var(--sp-2); color: var(--ink-500); flex-shrink: 0; }
.cat-search__icon svg { width: 18px; height: 18px; }
.cat-search__input {
  flex: 1;
  min-width: 0;
  border: none;
  outline: none;
  font-family: inherit;
  font-size: var(--fs-sm);
  color: var(--ink-900);
  background: transparent;
}
.cat-search__input::placeholder { color: var(--ink-500); }
.cat-search__btn {
  background: #077994;
  color: var(--white);
  border: none;
  flex-shrink: 0;
}
.cat-search__btn:hover { background: var(--brand-900); }
.cat-search__btn svg { width: 16px; height: 16px; display: none; }

.cat-filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-3);
  margin-bottom: var(--sp-6);
}
.cat-filter {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-full);
  padding: .5rem var(--sp-4);
  font-size: var(--fs-xs);
  font-weight: var(--fw-semibold);
  color: var(--ink-700);
  background: var(--white);
  transition: border-color .15s var(--ease), background-color .15s var(--ease), color .15s var(--ease);
}
.cat-filter svg { width: 16px; height: 16px; flex-shrink: 0; }
.cat-filter:hover { border-color: var(--brand-700); }
.cat-filter.is-active { background: #077994; border-color: var(--brand-700); color: var(--white); }

.cat-grid__heading {
  font-size: var(--fs-md);
  font-weight: var(--fw-bold);
  color: var(--ink-900);
  margin: 0 0 var(--sp-4);
}

.cat-card {
  display: flex;
  flex-direction: column;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: var(--sp-3);
  text-align: center;
  transition: box-shadow .15s var(--ease), border-color .15s var(--ease), transform .15s var(--ease);
}
.cat-card:hover { box-shadow: var(--shadow-hover); border-color: var(--line-strong); transform: translateY(-2px); }
.cat-card--popular { border-color: var(--brand-tint-strong); background: var(--brand-tint); position: relative; }
.cat-card__popular-tag {
  position: absolute;
  top: var(--sp-2);
  right: var(--sp-2);
  background: var(--brand-tint-strong);
  color: var(--brand-900);
  font-size: .625rem;
  font-weight: var(--fw-bold);
  padding: 3px 9px;
  border-radius: var(--r-full);
}
.cat-card__media {
  display: block;
  aspect-ratio: 1 / 1;
  border-radius: 50% 50% 8% 8% / 50% 50% 12% 12%;
  overflow: hidden;
  background: var(--surface);
  margin-bottom: var(--sp-2);
}
.cat-card__media img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cat-card__name {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: calc(var(--fs-xs) * var(--lh-snug) * 2);
  font-size: var(--fs-xs);
  font-weight: var(--fw-bold);
  color: var(--brand-900);
  line-height: var(--lh-snug);
  margin-bottom: 4px;
}
.cat-card__count {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  font-size: .6875rem;
  color: var(--ink-500);
  margin-bottom: 2px;
}
.cat-card__count svg { width: 11px; height: 11px; flex-shrink: 0; }
.cat-card__price { font-size: .6875rem; color: var(--ink-700); margin-bottom: var(--sp-2); }
.cat-card__price b { color: var(--danger); font-weight: var(--fw-bold); }
.cat-card__explore {
  margin-top: auto;
  font-size: .6875rem;
  font-weight: var(--fw-bold);
  color: var(--brand-700);
}

/* Single-row carousel for ALL categories — same mechanism as the site's
   original dark-teal cat-carousel (backups/Backup 2, cat-carousel.js: arrow
   buttons page the track via scrollBy), just re-skinned with the current
   .cat-card design instead of the old icon-only .cat-tile. Arrow buttons
   are the scroll affordance here (not a partial-card peek), so cards can
   size to a clean per-breakpoint column count without looking "stuck". */
.cat-carousel { position: relative; }
.cat-carousel__viewport { overflow: hidden; }
.cat-track {
  display: flex;
  gap: var(--sp-4);
  overflow-x: auto;
  scroll-snap-type: x proximity;
  scroll-behavior: smooth;
  scrollbar-width: none;
  padding-bottom: 2px;
}
.cat-track::-webkit-scrollbar { display: none; }
.cat-track .cat-card {
  flex: 0 0 calc((100% - 6 * var(--sp-4)) / 7);
  min-width: 150px;
  scroll-snap-align: start;
}

.cat-carousel__arrow {
  position: absolute;
  top: 50%;
  z-index: 2;
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: 50%;
  border: 1px solid var(--line-strong);
  background: var(--white);
  color: var(--ink-900);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-hover);
  transform: translateY(-50%);
  transition: background-color .15s var(--ease), border-color .15s var(--ease), color .15s var(--ease);
}
.cat-carousel__arrow svg { width: 16px; height: 16px; }
.cat-carousel__arrow:hover { background: var(--brand-700); border-color: var(--brand-700); color: var(--white); }
.cat-carousel__arrow--prev { left: -18px; }
.cat-carousel__arrow--next { right: -18px; }

@media (max-width: 1180px) {
  .cat-track .cat-card { flex-basis: calc((100% - 3 * var(--sp-4)) / 4); }
}
@media (max-width: 720px) {
  .cat-track .cat-card { flex-basis: calc((100% - 2 * var(--sp-4)) / 3); }
  .cat-search { max-width: none; }
  .cat-search__btn span { display: none; }
  .cat-search__btn svg { display: block; }
}

/* Phone widths: arrows are hard to hit precisely and the viewport is
   narrow, so drop them and let the track scroll natively with a partial-
   card peek, same pattern as .deal-grid/.showcase-cards sitewide. */
@media (max-width: 640px) {
  .cat-carousel__arrow { display: none; }
  .cat-track { gap: var(--sp-3); }
  .cat-track .cat-card { flex: 0 0 34%; min-width: 120px; }
  .cat-filter-row { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin-inline: calc(var(--sp-4) * -1); padding-inline: var(--sp-4); }
  .cat-filter-row::-webkit-scrollbar { display: none; }
  .cat-filter { flex-shrink: 0; }
}

/* Subtle tinted background behind the whole section, per the reference's
   soft overlay treatment (plain tint, no decorative graphic). */
#categories {
  background: linear-gradient(2deg, #0779943d, transparent);
  padding-block: var(--sp-6);
}
