/*
 * Browse All Services page (/browse-services).
 * Built from Figma node 9066-61317 (Goodfirms-2025).
 *
 * All selectors are `.bsvc-*` prefixed so this file is safe to load only on
 * this route. Colours/spacing lifted from the Figma. Fonts use the global
 * CSS vars set in the root layout (--font-manrope headings, --font-roboto
 * body).
 *
 * Breakpoints: desktop (default, 3 cards/row) → tablet <=1024px (2/row) →
 * mobile <=640px (1/row, stacked chrome).
 */

.bsvc {
  --bsvc-gold: #c5a063;
  --bsvc-cream: #fdf6e9;
  --bsvc-ink: #171923;
  --bsvc-grey: #444b55;
  --bsvc-grey-2: #677593;
  --bsvc-border: #dbdbdb;
  --bsvc-bar: #ececec;

  background: #fff;
  color: var(--bsvc-ink);
  font-family: var(--font-roboto), Arial, sans-serif;
}

.bsvc-container {
  width: 100%;
  max-width: 1340px;
  margin: 0 auto;
  padding-left: 20px;
  padding-right: 20px;
}

/* ── Hero ─────────────────────────────────────────────────────────────── */
.bsvc-hero {
  padding-top: 20px;
  padding-bottom: 20px;
}

.bsvc-breadcrumb {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  margin-bottom: 20px;
}
.bsvc-breadcrumb a {
  color: var(--bsvc-gold);
  font-weight: 500;
  text-decoration: none;
}
.bsvc-breadcrumb a:hover {
  text-decoration: underline;
}
.bsvc-breadcrumb-sep {
  color: var(--bsvc-gold);
}
.bsvc-breadcrumb [aria-current="page"] {
  color: var(--bsvc-ink);
}

.bsvc-hero-head {
  display: flex;
  flex-direction: column;
  gap: 15px;
  margin-bottom: 20px;
}
.bsvc-hero-title {
  font-family: var(--font-manrope), Arial, sans-serif;
  font-weight: 700;
  font-size: 36px;
  line-height: 1.2;
  margin: 0;
  max-width: 1008px;
}
.bsvc-hero-sub {
  font-size: 16px;
  line-height: 1.8;
  margin: 0;
  color: var(--bsvc-ink);
}

/* Stats strip — 4 equal cells joined into one bordered bar. */
.bsvc-stats {
  display: flex;
  margin: 0;
}
.bsvc-stat {
  flex: 1 1 0;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 20px 30px;
  background: var(--bsvc-cream);
  border: 1px solid var(--bsvc-gold);
  border-right-width: 0;
}
.bsvc-stat:first-child {
  border-top-left-radius: 6px;
  border-bottom-left-radius: 6px;
}
.bsvc-stat:last-child {
  border-right-width: 1px;
  border-top-right-radius: 6px;
  border-bottom-right-radius: 6px;
}
.bsvc-stat-value {
  margin: 0;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 24px;
  font-weight: 600;
  color: var(--bsvc-ink);
}
.bsvc-stat-star {
  flex: 0 0 auto;
}
.bsvc-stat-label {
  font-size: 16px;
  color: var(--bsvc-grey);
}

/* ── Controls bar ─────────────────────────────────────────────────────── */
.bsvc-controls {
  margin-top: 20px;
}
.bsvc-controls-top {
  border-top: 1px solid var(--bsvc-border);
  border-bottom: 1px solid var(--bsvc-border);
}
.bsvc-controls-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  min-height: 70px;
  padding-top: 12px;
  padding-bottom: 12px;
}
.bsvc-controls-left {
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
}
.bsvc-search {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 350px;
  max-width: 100%;
  height: 38px;
  padding: 10px 10px 10px 20px;
  border: 1px solid var(--bsvc-border);
  border-radius: 8px;
}
.bsvc-search-input {
  border: 0;
  outline: 0;
  flex: 1 1 auto;
  min-width: 0;
  font-size: 12px;
  font-family: inherit;
  color: var(--bsvc-ink);
  background: transparent;
}
.bsvc-search-input::placeholder {
  color: var(--bsvc-grey-2);
}
.bsvc-sort {
  display: flex;
  align-items: center;
  gap: 10px;
}
.bsvc-sort-label {
  font-size: 12px;
  color: var(--bsvc-ink);
}
.bsvc-sort-select {
  display: flex;
  align-items: center;
  gap: 40px;
  height: 36px;
  padding: 10px 12px;
  border: 1px solid var(--bsvc-border);
  border-radius: 4px;
  background: #fff;
  font: inherit;
  font-size: 14px;
  color: var(--bsvc-ink);
  cursor: pointer;
}
.bsvc-count {
  margin: 0;
  font-size: 14px;
  font-weight: 500;
  color: var(--bsvc-grey);
  white-space: nowrap;
}
.bsvc-count strong {
  color: var(--bsvc-ink);
  font-weight: 500;
}

.bsvc-jump-row {
  background: var(--bsvc-bar);
  border-radius: 6px;
}
.bsvc-jump-inner {
  display: flex;
  align-items: center;
  gap: 20px;
  min-height: 70px;
  padding-top: 10px;
  padding-bottom: 10px;
}
.bsvc-jump-label {
  font-size: 14px;
  font-weight: 500;
  color: var(--bsvc-grey);
  white-space: nowrap;
}
.bsvc-jump-chips {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.bsvc-chip {
  padding: 8px 12px;
  background: #fff;
  border: 1px solid var(--bsvc-border);
  border-radius: 4px;
  font-size: 14px;
  font-weight: 500;
  color: var(--bsvc-ink);
  text-decoration: none;
  white-space: nowrap;
  transition:
    border-color 0.15s ease,
    color 0.15s ease,
    background-color 0.15s ease;
}
.bsvc-chip:hover {
  border-color: var(--bsvc-gold);
  color: var(--bsvc-gold);
  background: var(--bsvc-cream);
}

/* ── Groups + grid ────────────────────────────────────────────────────── */
.bsvc-groups {
  display: flex;
  flex-direction: column;
  gap: 40px;
  padding-top: 50px;
  padding-bottom: 50px;
}
.bsvc-group {
  display: flex;
  flex-direction: column;
  gap: 20px;
  scroll-margin-top: 20px;
}
.bsvc-group-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}
.bsvc-group-title {
  margin: 0;
  font-family: var(--font-manrope), Arial, sans-serif;
  font-weight: 700;
  font-size: 24px;
  color: var(--bsvc-ink);
  white-space: nowrap;
}
/* Hairline that fills the gap between the group title and the count. */
.bsvc-group-rule {
  flex: 1 1 auto;
  height: 1px;
  background: var(--bsvc-border);
}
.bsvc-group-count {
  font-size: 16px;
  font-weight: 500;
  color: var(--bsvc-grey);
  white-space: nowrap;
}

/* CSS grid + per-card subgrid: each card spans the row band's 4 row tracks
   (head / subhead / subs / foot), so those sections align ACROSS a row — but
   only as tall as that row needs. A row of one-line titles stays tight; a row
   containing a two-line title grows just that row's header track. This is why
   the grid is `grid`, not `flex`: flex can't align siblings' internal rows. */
.bsvc-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}

/* ── Load-more footer bar ─────────────────────────────────────────────── */
.bsvc-loadmore-wrap {
  padding-bottom: 50px;
}
.bsvc-loadmore {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 24px 30px;
  border: 1px solid var(--bsvc-ink);
  border-radius: 8px;
  text-align: center;
  /* Navy band (theme --bsvc-ink), same as the site footer. */
  background: var(--bsvc-ink);
}
.bsvc-loadmore-count {
  /* 18px (stakeholder 2026-08-03, was 14px) — kept in step with
     .bsvc-loadmore-link below so the whole line reads at one size. */
  font-size: 18px;
  color: rgba(255, 255, 255, 0.75);
}
.bsvc-loadmore-count strong {
  color: #fff;
  font-weight: 600;
}
.bsvc-loadmore-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--bsvc-gold);
  font-size: 18px;
  font-weight: 500;
  text-decoration: none;
  transition: color 0.15s ease;
}
.bsvc-loadmore-link .bsvc-glyph {
  transition: transform 0.15s ease;
}
.bsvc-loadmore-link:hover {
  text-decoration: underline;
}
.bsvc-loadmore-link:hover .bsvc-glyph {
  transform: translateX(3px);
}

/* ── Card ─────────────────────────────────────────────────────────────── */
.bsvc-card {
  display: grid;
  grid-template-rows: subgrid;
  grid-row: span 4; /* head · subhead · subs · foot — the 4 direct children */
  padding: 28px;
  background: #fff;
  border: 1px solid var(--bsvc-border);
  border-radius: 12px;
  transition:
    box-shadow 0.2s ease,
    transform 0.2s ease,
    border-color 0.2s ease;
}
.bsvc-card:hover {
  border-color: var(--bsvc-gold);
  box-shadow: 0 8px 24px rgba(23, 25, 35, 0.08);
  transform: translateY(-3px);
}
.bsvc-card-head {
  display: flex;
  align-items: center;
  gap: 20px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--bsvc-border);
}
.bsvc-card-icon {
  flex: 0 0 auto;
  width: 57px;
  height: 57px;
  border-radius: 6px;
  background: var(--bsvc-cream);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.2s ease;
}
.bsvc-card-icon-img {
  width: 30px;
  height: 30px;
  object-fit: contain;
  display: block;
  transition: filter 0.2s ease;
}
/* Hover — mirrors the homepage trust cards: the tile fills gold and the
   monochrome (#C5A063) glyph flips to white. `brightness(0) invert(1)` turns
   any solid colour white, so the <img> icon recolours without a hover-variant
   SVG or a CSS mask. */
.bsvc-card:hover .bsvc-card-icon {
  background: var(--bsvc-gold);
}
.bsvc-card:hover .bsvc-card-icon-img {
  filter: brightness(0) invert(1);
}
.bsvc-card-headtext {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.bsvc-card-titlerow {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}
.bsvc-card-title {
  margin: 0;
  font-family: var(--font-manrope), Arial, sans-serif;
  font-weight: 700;
  font-size: 18px;
  line-height: 1.35;
  color: var(--bsvc-ink);
}
.bsvc-trending {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 10px;
  background: var(--bsvc-cream);
  border: 1px solid var(--bsvc-gold);
  border-radius: 100px;
  font-size: 12px;
  font-weight: 500;
  color: var(--bsvc-gold);
  white-space: nowrap;
}
.bsvc-card-meta {
  display: flex;
  align-items: center;
  gap: 10px;
}
.bsvc-card-firms {
  font-size: 16px;
  font-weight: 500;
  color: var(--bsvc-gold);
}
.bsvc-card-rating {
  display: flex;
  align-items: center;
  gap: 5px;
}
.bsvc-card-rating-value,
.bsvc-card-rating-avg {
  font-size: 16px;
  font-weight: 600;
  color: var(--bsvc-grey);
}

.bsvc-card-subhead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}
.bsvc-card-subhead-label {
  font-family: var(--font-manrope), Arial, sans-serif;
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--bsvc-grey);
}

.bsvc-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--bsvc-gold);
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
  transition: color 0.15s ease;
}
.bsvc-link:hover {
  text-decoration: underline;
}
/* Nudge the trailing arrow to the right on hover. */
.bsvc-link .bsvc-glyph {
  transition: transform 0.15s ease;
}
.bsvc-link:hover .bsvc-glyph {
  transform: translateX(3px);
}
.bsvc-link-strong {
  font-weight: 700;
}

.bsvc-subs {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.bsvc-sub {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px;
  border-radius: 6px;
  transition: background-color 0.15s ease;
}
.bsvc-sub:hover {
  background: var(--bsvc-cream);
}
.bsvc-sub-name {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 16px;
  /* Figma weight 500 (medium) — now loaded in the root layout Roboto set. */
  font-weight: 500;
  color: var(--bsvc-ink);
  text-decoration: none;
  transition: color 0.15s ease;
}
/* Name stays ink on row/link hover (Figma) — only the count turns gold.
   The extra selectors beat the site-wide `a:hover` gold rule from common.css. */
.bsvc-sub:hover .bsvc-sub-name,
.bsvc-sub-name:hover,
.bsvc-sub-name:focus {
  color: var(--bsvc-ink);
}
/* Chevron revealed on row hover — width always reserved (no layout shift). */
.bsvc-sub-chevron {
  flex: 0 0 auto;
  opacity: 0;
  transition: opacity 0.15s ease;
}
.bsvc-sub:hover .bsvc-sub-chevron {
  opacity: 1;
}
.bsvc-sub-count {
  font-size: 14px;
  font-weight: 500;
  color: var(--bsvc-ink);
  transition: color 0.15s ease;
}
/* Count turns gold on row hover (Figma). */
.bsvc-sub:hover .bsvc-sub-count {
  color: var(--bsvc-gold);
}

.bsvc-card-foot {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 20px;
  padding-top: 20px;
  border-top: 1px solid var(--bsvc-border);
}
.bsvc-card-updated {
  font-size: 12px;
  color: var(--bsvc-grey);
}

.bsvc-glyph {
  flex: 0 0 auto;
  display: block;
}
.bsvc-star,
.bsvc-flame {
  flex: 0 0 auto;
}

/* ── Tablet: 2 cards per row ───────────────────────────────────────────── */
@media (min-width: 768px) and (max-width: 1024px) {
  .bsvc-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  /* Tablet type scale (stakeholder 2026-07-03): H1 48 / H2 36 / H3 18. */
  .bsvc-hero-title {
    font-size: 48px;
  }
  .bsvc-group-title {
    font-size: 36px;
  }
  .bsvc-card-title {
    font-size: 18px;
  }
}

/* ── Mobile: single column + stacked chrome ────────────────────────────── */
@media (max-width: 767px) {
  /* Mobile type scale (stakeholder 2026-07-03): H1 24 / H2 22 / H3 18. */
  .bsvc-hero-title {
    font-size: 24px;
  }
  .bsvc-group-title {
    font-size: 22px;
  }
  .bsvc-card-title {
    font-size: 18px;
  }
  .bsvc-hero-sub {
    font-size: 15px;
  }

  /* Stats: 2×2 grid instead of a 4-wide bar. Stack value over label and trim
     the padding so the narrow cells read cleanly — the horizontal value+label
     layout wraps the label ("main services", "avg rating") in a narrow cell,
     leaving uneven, cramped cells. */
  .bsvc-stats {
    flex-wrap: wrap;
  }
  .bsvc-stat {
    flex: 1 1 45%;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    padding: 16px 18px;
    /* Full 1px border on every cell; each interior seam + the block's outer
       edges are drawn exactly once by dropping the side a neighbour already
       draws (no doubled 2px lines). This restores the missing bottom edge and
       the divider between the two rows. */
    border: 1px solid var(--bsvc-gold);
  }
  .bsvc-stat-value {
    font-size: 20px;
  }
  .bsvc-stat-label {
    font-size: 13px;
  }
  /* Right column drops its left edge — col1 draws the vertical divider. */
  .bsvc-stat:nth-child(2),
  .bsvc-stat:last-child {
    border-left-width: 0;
  }
  /* Bottom row drops its top edge — top row draws the horizontal divider. */
  .bsvc-stat:nth-child(3),
  .bsvc-stat:last-child {
    border-top-width: 0;
  }
  /* 2×2 outer corners. */
  .bsvc-stat:first-child {
    border-radius: 6px 0 0 0;
  }
  .bsvc-stat:nth-child(2) {
    border-radius: 0 6px 0 0;
  }
  .bsvc-stat:nth-child(3) {
    border-radius: 0 0 0 6px;
  }
  .bsvc-stat:last-child {
    border-radius: 0 0 6px 0;
  }

  .bsvc-controls-inner {
    flex-direction: column;
    align-items: flex-start;
  }
  .bsvc-search {
    width: 100%;
  }
  .bsvc-count {
    white-space: normal;
  }

  /* Jump-to becomes a horizontal scroller. */
  .bsvc-jump-inner {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }
  .bsvc-jump-chips {
    flex-wrap: nowrap;
    overflow-x: auto;
    width: 100%;
    padding-bottom: 4px;
    -webkit-overflow-scrolling: touch;
  }

  .bsvc-grid {
    grid-template-columns: 1fr;
  }
  .bsvc-card {
    padding: 20px;
  }
  .bsvc-groups {
    padding-top: 30px;
    padding-bottom: 30px;
  }
}
