/* ============================================================
   Provider Directory
   /providers/directory/
   ============================================================ */

.dir-page { background: linear-gradient(180deg, #edf3ef, #f6f8f7); min-height: 100vh; }

/* ── Page header ── */
.dir-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 18px;
  margin: 6px 0 18px;
}
.dir-head h1 {
  margin: 0;
  font-size: var(--page-title-size);
  font-weight: 800;
  letter-spacing: -0.025em;
  line-height: 1.1;
}
.dir-post-cta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px var(--space-5);
  border-radius: 12px;
  background: linear-gradient(135deg, #0d9b6e, #146644);
  color: white;
  font-weight: 700;
  font-size: 0.94rem;
  text-decoration: none;
  white-space: nowrap;
  box-shadow: 0 4px 14px -4px rgba(13,155,110,0.40);
  transition: transform 180ms;
}
.dir-post-cta:hover { transform: translateY(-1px); color: white; }

/* ── Search / sort bar ── */
.dir-search-bar {
  background: white;
  border: 1px solid rgba(15,23,42,.08);
  border-radius: 16px;
  padding: 10px;
  display: grid;
  /* search | view toggle | filters. The sort used to sit in here as a fourth
     control; it lives in the filter panel now. */
  grid-template-columns: minmax(0,1fr) auto auto;
  gap: 10px;
  align-items: center;
  margin-bottom: 18px;
  box-shadow: 0 1px 4px rgba(15,23,42,.06);
}
/* Search = shared form-kit .fk-search (form-kit.css). The sort is NOT in
   this bar any more -- it is a group inside the filter rail, written the
   way proposals/requests.html writes it. */
.dir-view-toggle { display: flex; gap: 4px; background: rgba(15,23,42,.06); border-radius: 11px; padding: 4px; }
.dir-view-toggle button {
  width: 40px; height: 40px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--fg-2, #64748b);
  cursor: pointer;
  display: grid;
  place-items: center;
  font-size: 1rem;
  transition: background 150ms, color 150ms, box-shadow 150ms;
}
.dir-view-toggle button.is-active {
  background: white;
  color: #146644;
  box-shadow: 0 1px 3px rgba(15,23,42,.10);
}

/* 44px is the accessible minimum for a finger (WCAG 2.5.8). 34.2px before:
   these rows hold no bare text, so their height came from the tallest child. */
.dir-rating-opt {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 7px 0;
  font-size: 0.9rem;
  cursor: pointer;
  color: var(--fg-1, #0f172a);
}
.dir-rating-opt input { accent-color: #0d9b6e; width: 17px; height: 17px; cursor: pointer; flex-shrink: 0; }
.dir-rating-opt .stars { color: #e8a72d; font-size: 0.82rem; letter-spacing: 1px; }
.dir-rating-opt .lbl { font-size: 0.84rem; color: var(--fg-2, #64748b); }
/* "Any rating" has no stars span — indent its label to line up with the starred rows. */
.dir-rating-opt .lbl.dir-rating-any { margin-inline-start: 27px; }

/* ── Results meta ── */
.dir-results-meta { margin-bottom: 14px; }
.dir-results-meta .count-txt { font-size: 0.92rem; color: var(--fg-2, #64748b); font-weight: 600; }
.dir-results-meta .count-txt strong { color: var(--fg-1, #0f172a); font-weight: 800; }

/* ── Provider grid ── */
.dir-provider-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0,1fr));
  gap: 16px;
}

/* ── Provider card ── */
.pcard {
  background: white;
  border: 1px solid rgba(15,23,42,.08);
  border-radius: 20px;
  padding: 20px;
  display: grid;
  gap: 14px;
  text-decoration: none;
  color: inherit;
  transition: transform 180ms, box-shadow 180ms, border-color 180ms;
  position: relative;
}
.pcard:hover {
  transform: translateY(-3px);
  box-shadow: 0 14px 36px -14px rgba(15,23,42,.18);
  border-color: rgba(13,155,110,.28);
}
.pcard.is-gold {
  border-color: rgba(232,167,45,.40);
  background: linear-gradient(180deg, #fffdf7, white);
}
.pcard.is-gold:hover { border-color: rgba(232,167,45,.65); }

.pcard-top { display: grid; grid-template-columns: auto minmax(0,1fr) auto; gap: 14px; align-items: start; }
.pcard-logo {
  width: 56px; height: 56px;
  border-radius: 16px;
  display: grid; place-items: center;
  font-weight: 800;
  font-size: 1.35rem;
  color: white;
  letter-spacing: -0.02em;
  flex-shrink: 0;
  /* One brand gradient for every initial (owner): a colour picked per provider id read as random beside the rest of the app. */
  background: var(--grad-primary);
  text-decoration: none;
}

.pcard-ident { min-width: 0; display: grid; gap: 5px; }
.pcard-name { margin: 0; font-size: 1.08rem; font-weight: 800; letter-spacing: -0.01em; line-height: 1.2; }
.pcard-badges { display: flex; gap: 6px; flex-wrap: wrap; }
/* Badge rendering in cards — now using shared .sl-badge / .sl-badge-sm (app.css).
   .pcard-mini-badge kept as a no-op alias so old HTML doesn't break. */

.pcard-save {
  /* Matches .br-save-btn: one bookmark action, one tap target. */
  width: 44px; height: 44px;
  border: 0;
  background: transparent;
  color: var(--fg-2, #64748b);
  cursor: pointer;
  display: grid; place-items: center;
  font-size: 1.2rem;
  padding: 0;
  margin: -4px -4px 0 0;
  transition: color 150ms;
  flex-shrink: 0;
}
.pcard-save:hover { color: #0d9b6e; }
.pcard-save.is-saved { color: #0d9b6e; }

.pcard-rating {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 0.88rem;
  flex-wrap: wrap;
}
/* star colours from .sl-star-fill / .sl-star-empty in app.css */
.pcard-rating .stars { font-size: 0.84rem; }
.pcard-rating strong { font-weight: 800; color: var(--fg-1, #0f172a); }
.pcard-rating .rev { color: var(--fg-2, #64748b); }
/* "No reviews yet" stands alone where the stars would have been, so it carries
   no leading separator and does not pretend to be a score. */
.pcard-rating .rev.none { color: var(--fg-2, #64748b); } /* was --fg-3: about 2.6:1 on white, under WCAG AA; Lighthouse 2026-09-25 */
.pcard-rating .dot { color: rgba(15,23,42,.25); }
.pcard-rating .loc { color: var(--fg-2, #64748b); display: inline-flex; align-items: center; gap: 4px; }
.pcard-rating .loc i { color: #0d9b6e; font-size: 0.82rem; }

.pcard-desc {
  margin: 0;
  font-size: 0.9rem;
  color: var(--fg-2, #64748b);
  line-height: 1.6;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.pcard-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.pcard-tag {
  display: inline-flex;
  align-items: center;
  padding: 5px 10px;
  border-radius: 8px;
  background: rgba(15,23,42,.04);
  border: 1px solid rgba(15,23,42,.07);
  color: var(--fg-1, #0f172a);
  font-size: 0.78rem;
  font-weight: 700;
}
.pcard-tag.more {
  background: transparent;
  color: var(--fg-2, #64748b);
  border-style: dashed;
}

.pcard-foot {
  display: grid;
  grid-template-columns: minmax(0,1fr) auto;
  align-items: center;
  gap: 12px;
  padding-top: 14px;
  border-top: 1px solid rgba(15,23,42,.07);
}
.pcard-metrics { display: flex; gap: 16px; }
.pcard-metric { display: grid; gap: 1px; }
.pcard-metric .mv { font-size: 0.96rem; font-weight: 800; color: var(--fg-1, #0f172a); line-height: 1; }
.pcard-metric .mv.green { color: #0d9b6e; }
.pcard-metric .mk { font-size: 0.72rem; color: var(--fg-2, #64748b); font-weight: 600; }
.pcard-view {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 15px;
  border-radius: 10px;
  background: white;
  border: 1.5px solid rgba(13,155,110,.30);
  color: #146644;
  font-weight: 700;
  font-size: 0.86rem;
  white-space: nowrap;
  transition: background 180ms, color 180ms, border-color 180ms;
}
.pcard:hover .pcard-view {
  background: linear-gradient(135deg, #0d9b6e, #146644);
  color: white;
  border-color: transparent;
}

/* Pagination: shared widget — .pgr in app.css (components/pager.html). */

/* ── List view overrides ── */
.dir-provider-grid.is-list { grid-template-columns: 1fr; gap: 12px; }
.dir-provider-grid.is-list .pcard {
  grid-template-columns: minmax(0,1fr) 220px;
  grid-template-areas:
    "top  foot"
    "rate foot"
    "desc foot"
    "tags foot";
  column-gap: 26px;
  row-gap: 10px;
  align-items: start;
  padding: var(--space-5) var(--space-6);
}
.dir-provider-grid.is-list .pcard-top    { grid-area: top; }
.dir-provider-grid.is-list .pcard-rating { grid-area: rate; }
.dir-provider-grid.is-list .pcard-desc   { grid-area: desc; -webkit-line-clamp: 1; max-width: 64ch; }
.dir-provider-grid.is-list .pcard-tags   { grid-area: tags; }
.dir-provider-grid.is-list .pcard-foot {
  grid-area: foot;
  border-top: 0;
  border-inline-start: 1px solid rgba(15,23,42,.07);
  padding: 2px 0 2px 26px;
  grid-template-columns: 1fr;
  align-content: center;
  gap: 16px;
}
.dir-provider-grid.is-list .pcard-metrics { flex-direction: column; gap: 12px; }
.dir-provider-grid.is-list .pcard-view   { justify-content: center; padding: 11px 15px; }
.dir-provider-grid.is-list .pcard-logo   { width: 50px; height: 50px; border-radius: 14px; font-size: 1.2rem; }

/* ── Empty state ── */
/* Wrapper spans the full provider grid; icon for the hand-rolled (no-SVG) empty state. */
.dir-grid-full { grid-column: 1 / -1; }

/* ── Responsive ── */
@media (max-width: 1080px) {
  .dir-provider-grid:not(.is-list) { grid-template-columns: 1fr; }
}
@media (max-width: 980px) {
  /* Search and the filter button, side by side, on ONE row. It used to be two:
     the search spanning the top and the sort and the filter button sharing the
     one below, which is three controls and two rows for a screen that has room
     for two controls and one. The sort moved into the panel the filter button
     opens. */
  .dir-search-bar { grid-template-columns: minmax(0,1fr) auto; }
  .dir-view-toggle { display: none; }
}

@media (max-width: 600px) {
  .dir-head { grid-template-columns: 1fr; }
  .dir-post-cta { display: none; }
  .dir-provider-grid.is-list .pcard {
    grid-template-columns: 1fr;
    grid-template-areas: "top" "rate" "desc" "tags" "foot";
  }
  .dir-provider-grid.is-list .pcard-foot {
    border-inline-start: 0;
    border-top: 1px solid rgba(15,23,42,.07);
    padding: 14px 0 0;
    grid-template-columns: 1fr auto;
  }
  .dir-provider-grid.is-list .pcard-metrics { flex-direction: row; }
}
