/* Provider search — desktop handoff + phone layout (max-width 900px).
   Page chrome (header) stays outside this section. */

body.pmg-directory,
body.pmg-directory *,
body.pmg-directory *::before,
body.pmg-directory *::after {
  box-sizing: border-box;
}

body.pmg-directory {
  overflow-x: clip;
  margin: 0;
  background: #fbfafc;
  color: #221c2b;
  font-family: "Assistant", "Heebo", system-ui, sans-serif;
}

.page { min-height: 100vh; }

.wrap {
  max-width: 1160px;
  margin: 0 auto;
  padding: 0 28px;
}

.site-header {
  background: #fff;
  border-bottom: 1px solid #eae7ee;
  position: sticky;
  top: 0;
  z-index: 40;
}

.site-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 72px;
  padding: 12px 0;
  gap: 12px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  direction: ltr;
  text-decoration: none;
  line-height: 0;
}

.brand img { display: block; width: auto; height: auto; }
.brand .brand-mark { height: 36px; }
.brand .brand-word { height: 21px; }

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  text-decoration: none;
  color: #5f3b76;
  font-weight: 600;
  font-size: 14px;
  padding: 8px 14px;
  border-radius: 4px;
  border: 1px solid #ddd0e8;
  background: #fff;
}

.back-link:hover { background: #f3eef7; text-decoration: none; }

.directory {
  padding: 20px 0 56px;
}

.search-panel {
  background: #fff;
  border: 1px solid #e8e5ec;
  box-shadow: 0 1px 2px rgba(30, 25, 38, 0.05);
  padding: 36px 32px;
  margin-bottom: 16px;
  text-align: center;
}

body.pmg-directory .search-panel h1 {
  margin: 0 0 10px;
  font-family: "Assistant", "Heebo", system-ui, sans-serif;
  font-weight: 700;
  font-size: 30px;
  line-height: 1.25;
  color: #221c2b;
  text-align: center;
}

.search-panel__sub {
  margin: 0 0 26px;
  font: 400 16px/1.6 "Assistant", sans-serif;
  color: #6c6579;
}

.search-hero__form {
  display: flex;
  gap: 10px;
  max-width: 620px;
  margin: 0 auto;
  align-items: stretch;
}

.search-hero__form input {
  flex: 1;
  min-width: 0;
  border: 1px solid #ddd6e6;
  border-radius: 4px;
  padding: 14px 16px;
  font: 400 15px/1.4 "Assistant", sans-serif;
  background: #fff;
  color: #221c2b;
}

.search-hero__form input:focus {
  border-color: #3d3450;
  box-shadow: 0 0 0 3px rgba(124, 79, 153, 0.12);
  outline: none;
}

body.pmg-directory .search-hero__btn {
  background: #7c4f99;
  color: #fff;
  border: 1px solid #7c4f99;
  border-radius: 4px;
  padding: 14px 26px;
  font: 700 15px/1 "Assistant", sans-serif;
  cursor: pointer;
  white-space: nowrap;
  box-shadow: none;
}

body.pmg-directory .search-hero__btn:hover { background: #6d4389; }

.quick-cats { margin-bottom: 16px; }

.quick-cats__grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
}

.quick-cat {
  background: #fff;
  border: 1px solid #e8e5ec;
  border-radius: 4px;
  padding: 20px 12px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 11px;
  text-align: center;
  min-width: 0;
  font-family: inherit;
  color: inherit;
  transition: box-shadow 0.3s ease, border-color 0.3s ease, background-color 0.3s ease;
}

.quick-cat:hover {
  border-color: #c9a6de;
  box-shadow:
    0 0 0 1px rgba(124, 79, 153, 0.3),
    0 0 30px rgba(124, 79, 153, 0.2),
    0 16px 34px -24px rgba(124, 79, 153, 0.5);
}

.quick-cat.is-active {
  background: #f8f5fa;
  border-color: #7c4f99;
}

.quick-cat__icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 46px;
  height: 46px;
  background: #f3eef7;
  border: 1px solid #ddd0e8;
  color: #5f3b76;
  flex: none;
}

.quick-cat__icon svg { display: block; }

.quick-cat.is-active .quick-cat__icon {
  background: #7c4f99;
  border-color: #7c4f99;
  color: #fff;
}

.quick-cat__name {
  font: 700 14.5px/1.3 "Assistant", sans-serif;
  color: #221c2b;
}

.quick-cat__count {
  font: 400 12.5px/1 "Assistant", sans-serif;
  color: #7c7488;
}

.marketplace__layout {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.filters-mobile-btn { display: none; }

.filters-sidebar { position: sticky; top: 88px; }

.filters-card {
  background: #fff;
  border: 1px solid #e8e5ec;
  box-shadow: 0 1px 2px rgba(30, 25, 38, 0.05);
  padding: 22px;
}

.filters-card__head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 18px;
}

.filters-card h2 {
  margin: 0;
  font: 700 18px/1 "Assistant", sans-serif;
  color: #221c2b;
}

.filters-close {
  display: none;
  border: none;
  background: transparent;
  font-size: 1.2rem;
  cursor: pointer;
  color: #221c2b;
}

.filter-group { margin-bottom: 16px; }

.filter-group label,
.filter-group > span {
  display: block;
  font: 700 13px/1 "Assistant", sans-serif;
  color: #5f3b76;
  margin-bottom: 7px;
}

.filter-group select,
.sort-wrap select {
  width: 100%;
  border: 1px solid #dcd7e3;
  border-radius: 3px;
  padding: 9px 11px;
  background: #fff;
  font: 400 14px/1.3 "Assistant", sans-serif;
  color: #221c2b;
}

.filter-group select:focus,
.sort-wrap select:focus,
.filter-checks input:focus-visible {
  border-color: #3d3450;
  box-shadow: 0 0 0 3px rgba(124, 79, 153, 0.12);
  outline: none;
}

.filter-checks {
  display: flex;
  flex-direction: column;
  gap: 11px;
  margin: 6px 0 16px;
  padding-top: 16px;
  border-top: 1px solid #f1eff3;
}

.check-row {
  display: flex;
  align-items: center;
  gap: 10px;
  font: 400 14px/1.3 "Assistant", sans-serif;
  color: #221c2b;
  cursor: pointer;
}

.check-row input {
  width: 16px;
  height: 16px;
  accent-color: #7c4f99;
  margin: 0;
}

.btn-clear-filters {
  width: 100%;
  background: #fff;
  color: #5f3b76;
  border: 1px dashed #ddd0e8;
  border-radius: 4px;
  padding: 12px;
  font: 600 13.5px/1 "Assistant", sans-serif;
  cursor: pointer;
}

.btn-clear-filters:hover { background: #f8f5fa; }

.results-header {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.results-count {
  margin: 0;
  font: 700 19px/1 "Assistant", sans-serif;
  color: #221c2b;
}

.sort-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-inline-start: auto;
  font: 500 13.5px/1 "Assistant", sans-serif;
  color: #4c4956;
}

.sort-wrap select { width: auto; font-size: 13.5px; }

.providers-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
}

.provider-card {
  background: #fff;
  border: 1px solid #e8e5ec;
  box-shadow:
    0 1px 2px rgba(30, 25, 38, 0.05),
    0 14px 34px -24px rgba(30, 25, 38, 0.3);
  display: flex;
  flex-direction: column;
  min-width: 0;
  cursor: pointer;
  transition: box-shadow 0.3s ease, border-color 0.3s ease;
}

.provider-card.is-highlighted {
  border-color: #7c4f99;
  box-shadow:
    0 0 0 2px rgba(124, 79, 153, 0.45),
    0 14px 34px -24px rgba(30, 25, 38, 0.3);
}

.provider-card:hover {
  border-color: #c9a6de;
  box-shadow:
    0 0 0 1px rgba(124, 79, 153, 0.3),
    0 0 30px rgba(124, 79, 153, 0.2),
    0 16px 34px -24px rgba(124, 79, 153, 0.5);
}

.provider-card:focus-visible {
  outline: 2px solid #7c4f99;
  outline-offset: 3px;
}

.provider-card__cover {
  position: relative;
  aspect-ratio: 16 / 10;
  background: #f3eef7;
  overflow: hidden;
  border-bottom: 1px solid #eeecf1;
}

.provider-card__cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.provider-card__cover-badge {
  position: absolute;
  top: 10px;
  inset-inline-end: 10px;
  z-index: 2;
  background: #8a6a1f;
  color: #fff;
  border: 1px solid #8a6a1f;
  padding: 5px 10px;
  font: 700 11.5px/1 "Assistant", sans-serif;
}

.provider-card__gallery-pill,
.provider-card__photo-pill {
  position: absolute;
  bottom: 10px;
  inset-inline-start: 10px;
  z-index: 2;
  background: #fff;
  border: 1px solid #ddd6e6;
  padding: 5px 10px;
  font: 600 11.5px/1 "Assistant", sans-serif;
  color: #5f3b76;
  text-decoration: none;
}

.provider-card__gallery-pill:hover { background: #f8f5fa; }

.provider-card__body {
  padding: 18px;
  display: flex;
  flex-direction: column;
  flex: 1;
  text-align: center;
  gap: 0;
}

.provider-card h3 {
  margin: 0 0 5px;
  font: 700 18px/1.25 "Assistant", sans-serif;
  color: #221c2b;
}

.provider-card__meta {
  margin: 0 0 12px;
  font: 400 13.5px/1.4 "Assistant", sans-serif;
  color: #7c7488;
}

.provider-card__blurb {
  margin: -4px 0 12px;
  font: 400 14px/1.45 "Assistant", sans-serif;
  color: #4e4658;
}

.provider-card__badges {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
  margin-bottom: 12px;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 11px;
  font: 600 12px/1 "Assistant", sans-serif;
}

.pill--verified {
  background: #eef5f0;
  border: 1px solid #cfe3d6;
  color: #2f6b46;
}

.pill--verified::before {
  content: "";
  width: 6px;
  height: 6px;
  background: #2f6b46;
  flex: none;
}

.pill--fast {
  background: #f3eef7;
  border: 1px solid #ddd0e8;
  color: #5f3b76;
}

.provider-card__rating {
  margin: 0 0 4px;
  font: 600 14px/1.3 "Assistant", sans-serif;
  color: #221c2b;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  flex-wrap: wrap;
}

.provider-card__rating-stars { color: #221c2b; letter-spacing: 1px; }

.provider-card__stats {
  margin: 0 0 16px;
  font: 400 12.5px/1.45 "Assistant", sans-serif;
  color: #7c7488;
}

.provider-card__tags {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
  margin: -8px 0 16px;
}

.provider-card__tag {
  font: 600 12px/1 "Assistant", sans-serif;
  padding: 4px 8px;
  background: #f3eef7;
  color: #5f3b76;
  border: 1px solid #ddd0e8;
}

.provider-card__actions {
  display: flex;
  gap: 8px;
  margin-top: auto;
}

.btn-card {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 44px;
  border-radius: 4px;
  padding: 12px;
  font: 700 13.5px/1 "Assistant", sans-serif;
  cursor: pointer;
  text-decoration: none;
  transition: background-color 0.18s ease, border-color 0.18s ease;
}

.btn-card--primary {
  background: #7c4f99;
  color: #fff;
  border: 1px solid #7c4f99;
}

.btn-card--primary:hover { background: #6d4389; color: #fff; }

.btn-card--secondary {
  background: #fff;
  color: #3d3947;
  border: 1px solid #ddd6e6;
  font-weight: 600;
}

.btn-card--secondary:hover { border-color: #3d3450; background: #faf8fc; }

.empty-state {
  background: #fff;
  border: 1px solid #e8e5ec;
  padding: 40px 24px;
  text-align: center;
  font: 400 15px/1.6 "Assistant", sans-serif;
  color: #64616b;
}

.empty-state h2 {
  margin: 0 0 8px;
  font: 700 18px/1.3 "Assistant", sans-serif;
  color: #221c2b;
}

.empty-state p { margin: 0 0 18px; }

.empty-state__actions {
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
}

.empty-state__actions .btn-card { flex: 0 1 180px; }

.providers-grid.is-loading { opacity: 0.7; pointer-events: none; }

.provider-card--skeleton { min-height: 320px; pointer-events: none; cursor: default; }

.provider-card--skeleton .provider-card__cover {
  background: linear-gradient(90deg, #f1eff3 0%, #e8e5ec 50%, #f1eff3 100%);
  background-size: 200% 100%;
  animation: pmg-shimmer 1.2s ease-in-out infinite;
}

.provider-card--skeleton .provider-card__body > * {
  background: #e8e5ec;
  min-height: 14px;
  animation: pmg-shimmer 1.2s ease-in-out infinite;
}

@keyframes pmg-shimmer {
  0% { background-position: 100% 0; }
  100% { background-position: -100% 0; }
}

.filters-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(30, 25, 38, 0.45);
  z-index: 45;
}

.filters-backdrop[hidden] { display: none; }

.gallery-modal {
  position: fixed;
  inset: 0;
  background: rgba(30, 25, 38, 0.68);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 9999;
}

.gallery-modal.is-open { display: flex; }

.gallery-modal__card {
  width: min(920px, 100%);
  max-height: min(88vh, 760px);
  background: #fff;
  color: #221c2b;
  border: 1px solid #e8e5ec;
  border-radius: 4px;
  box-shadow: 0 34px 76px rgba(30, 25, 38, 0.45);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.gallery-modal__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 14px;
  border-bottom: 1px solid #eae7ee;
  background: #fff;
}

.gallery-modal__title {
  font-weight: 700;
  color: #221c2b;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.gallery-modal__counter {
  color: #655e70;
  font-size: 13px;
  font-weight: 600;
  margin-top: 4px;
}

.gallery-modal__close {
  border: 1px solid #d6d2dc;
  background: #fff;
  color: #221c2b;
  width: 36px;
  height: 36px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 1.2rem;
  line-height: 1;
}

.gallery-modal__body {
  position: relative;
  min-height: 280px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 14px;
  background: #fbfafc;
}

.gallery-modal__img {
  width: 100%;
  max-width: 860px;
  max-height: min(70vh, 620px);
  object-fit: contain;
  border-radius: 4px;
  border: 1px solid #e8e5ec;
  background: #fff;
  display: block;
}

.gallery-modal__empty {
  display: none;
  color: #655e70;
  font-weight: 600;
  text-align: center;
  padding: 26px;
  border: 1px dashed #ddd0e8;
  width: 100%;
  max-width: 560px;
}

.gallery-modal__nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 44px;
  height: 44px;
  border-radius: 4px;
  border: 1px solid #d6d2dc;
  background: #fff;
  color: #3d3450;
  cursor: pointer;
}

.gallery-modal__nav:disabled { opacity: 0.35; cursor: default; }
.gallery-modal__nav--prev { inset-inline-start: 18px; }
.gallery-modal__nav--next { inset-inline-end: 18px; }

.tippy-box[data-theme~="social-preview"] {
  border-radius: 4px;
  border: 1px solid #e8e5ec;
  background: #fff;
  color: #221c2b;
  box-shadow: 0 18px 38px rgba(30, 25, 38, 0.16);
}

.tippy-box[data-theme~="social-preview"] > .tippy-content { padding: 0; }
.tippy-box[data-theme~="social-preview"] > .tippy-arrow::before { color: #fff; }

.link-preview-card {
  width: 280px;
  max-width: 280px;
  overflow: hidden;
  background: #fff;
}

.link-preview-card__image {
  width: 100%;
  height: 146px;
  object-fit: cover;
  display: block;
  background: #f3eef7;
}

.link-preview-card__body { padding: 10px 12px 12px; }

.link-preview-card__title {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  color: #221c2b;
  line-height: 1.35;
}

.link-preview-card__desc {
  margin: 6px 0 0;
  color: #4c4956;
  font-size: 13.5px;
  line-height: 1.45;
  display: -webkit-box;
  line-clamp: 2;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.link-preview-card__host {
  margin: 8px 0 0;
  color: #655e70;
  font-size: 12px;
  font-weight: 700;
  direction: ltr;
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.link-preview-loading {
  width: 280px;
  min-height: 98px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 14px;
  color: #4c4956;
  font-weight: 700;
  background: #fff;
}

.link-preview-loading__spinner {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid #e8e5ec;
  border-top-color: #7c4f99;
  animation: link-preview-spin 0.8s linear infinite;
}

@keyframes link-preview-spin { to { transform: rotate(360deg); } }

@media (max-width: 900px) {
  .brand, .back-link, .btn-clear-filters { min-height: 44px; }
  .wrap { padding: 0 16px; }
  .directory { padding-top: 12px; }
  .search-panel { padding: 24px 16px; }
  body.pmg-directory .search-panel h1 {
    font-size: clamp(22px, 6.2vw, 26px);
  }
  .search-panel__sub { font-size: 15px; margin-bottom: 16px; }
  .search-hero__form { flex-direction: column; }
  .search-hero__form input,
  body.pmg-directory .search-hero__btn {
    width: 100%;
    min-height: 48px;
  }
  .quick-cats__grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .quick-cat { padding: 16px 10px; min-height: 44px; }
  .marketplace__layout { grid-template-columns: minmax(0, 1fr); }
  .filters-sidebar {
    position: static;
    top: auto;
    width: auto;
    transform: none;
    padding: 0;
    background: transparent;
  }
  .filters-mobile-btn,
  .filters-close,
  .filters-backdrop { display: none !important; }
  .results-header { align-items: stretch; }
  .sort-wrap { margin-inline-start: 0; width: 100%; }
  .filter-group select,
  .sort-wrap select { min-height: 44px; }
  .sort-wrap select { flex: 1; }
  .check-row { min-height: 44px; }
  .check-row input { width: 44px; height: 44px; }
  .provider-card__actions { flex-direction: column; }
  .gallery-modal__nav--prev { inset-inline-start: 8px; }
  .gallery-modal__nav--next { inset-inline-end: 8px; }
  .gallery-modal__body { padding: 8px; min-height: 220px; }
}

@media (prefers-reduced-motion: reduce) {
  .provider-card,
  .quick-cat,
  .provider-card--skeleton .provider-card__cover,
  .link-preview-loading__spinner {
    animation: none;
    transition: none;
  }
}
