/* ============================================================
   page-vendors.css
   Styles for the Vendors page template (page-vendors.php)
   Enqueue via functions.php:
     wp_enqueue_style( 'sa-vendors', get_template_directory_uri() . '/page-vendors.css' );
   ============================================================ */

/* ── Search bar ─────────────────────────────────────────────── */
.vendors-search-wrapper {
  position: relative;
  width: 100%;
  max-width: 100%;
  margin-bottom: 1rem;
}

.vendors-search-input {
  width: 100%;
  border: none;
  border-bottom: 1px solid var(--black);
  background: transparent;
  padding: 0.6rem 2.5rem 0.6rem 0;
  font-size: 1rem;
  font-family: inherit;
  color: var(--black);
  outline: none;
  transition: border-color 0.2s;
}

.vendors-search-input::placeholder {
  color: rgba(0, 0, 0, 0.4);
}

.vendors-search-input:focus,
.vendors-search-input:focus-visible {
  border-bottom-color: var(--black);
  outline: none;
  box-shadow: none;
}

.vendors-search-icon {
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 1.25rem;
  height: 1.25rem;
  color: rgba(0, 0, 0, 0.4);
  pointer-events: none;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ── Vendor count badge ──────────────────────────────────────── */
.vendors-count {
  font-size: 0.8rem;
  color: rgba(0, 0, 0, 0.45);
  margin-bottom: 2rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.vendors-count strong {
  color: var(--black);
}

/* ── Vendor grid ─────────────────────────────────────────────── */
.vendors-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-column-gap: 0;
  grid-row-gap: 0;
}

@media screen and (max-width: 991px) {
  .vendors-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media screen and (max-width: 767px) {
  .vendors-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media screen and (max-width: 479px) {
  .vendors-grid {
    grid-template-columns: 1fr;
  }
}

/* ── Single vendor card ──────────────────────────────────────── */
.vendor-card {
  border-top: 1px solid var(--border-light);
  border-left: 1px solid var(--border-light);
  padding: 1.75rem 1.5rem 2rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  position: relative;
  background: var(--white);
  transition: background-color 0.2s ease;
}

/* Right edge border via nth-child — avoids double borders */
.vendor-card:nth-child(4n) {
  border-right: 1px solid var(--border-light);
}

/* Bottom border on last row */
.vendors-grid::after {
  content: '';
  display: block;
  grid-column: 1 / -1;
  border-bottom: 1px solid var(--border-light);
}

/* Fallback: always draw bottom border on each card */
.vendor-card {
  border-bottom: 1px solid var(--border-light);
  border-right: 0;
}

/* Re-apply right border on last column per row */
@media screen and (min-width: 992px) {
  .vendor-card:nth-child(4n) {
    border-right: 1px solid var(--border-light);
  }
  .vendor-card:nth-child(4n+1) {
    border-left: 1px solid var(--border-light);
  }
}

@media screen and (max-width: 991px) and (min-width: 768px) {
  .vendor-card:nth-child(3n) {
    border-right: 1px solid var(--border-light);
  }
}

@media screen and (max-width: 767px) and (min-width: 480px) {
  .vendor-card:nth-child(2n) {
    border-right: 1px solid var(--border-light);
  }
}

@media screen and (max-width: 479px) {
  .vendor-card {
    border-right: 1px solid var(--border-light);
  }
}

/* Subtle hover lift */
.vendor-card:hover {
  background-color: #fafaf8;
}

/* ── Vendor number index ─────────────────────────────────────── */
.vendor-index {
  font-size: 0.7rem;
  color: rgba(0, 0, 0, 0.3);
  letter-spacing: 0.06em;
  font-weight: 400;
  line-height: 1;
}

/* ── Vendor name ─────────────────────────────────────────────── */
.vendor-name {
  font-size: 1.25rem;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.01em;
  color: var(--black);
  margin: 0;
}

/* ── Detail rows (phone, email, contact link) ────────────────── */
.vendor-details {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  flex: 1;
}

.vendor-detail-row {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  font-size: 0.875rem;
  line-height: 1.4;
  color: darkblue;
}

.vendor-detail-icon {
  flex-shrink: 0;
  width: 1rem;
  height: 1rem;
  margin-top: 0.1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(0, 0, 0, 0.35);
}

.vendor-detail-icon svg {
  width: 0.875rem;
  height: 0.875rem;
}

.vendor-detail-value {
  word-break: break-word;
}

/* N/A phone */
.vendor-detail-value.is-na {
  color: rgba(0, 0, 0, 0.3);
  font-style: italic;
}

/* ── Action links ────────────────────────────────────────────── */
.vendor-actions {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-top: auto;
  padding-top: 1rem;
  border-top: 1px solid var(--border-light);
}

.vendor-link {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--black);
  position: relative;
  width: fit-content;
  line-height: 1;
  padding-bottom: 1px;
  border-bottom: 1px solid var(--border-light);
  transition: border-color 0.3s ease;
}

.vendor-link:hover {
  border-bottom-color: var(--black);
}

.vendor-link svg {
  width: 0.7rem;
  height: 0.7rem;
  flex-shrink: 0;
}

.vendor-link.is-contact {
  color: rgba(0, 0, 0, 0.55);
}

/* ── "Not listed" card ───────────────────────────────────────── */
.vendor-card.is-unlisted {
  opacity: 0.45;
  pointer-events: none;
}

.vendor-card.is-unlisted .vendor-name::after {
  content: ' — Info not available';
  font-weight: 400;
  font-size: 0.8rem;
  color: rgba(0, 0, 0, 0.4);
  display: block;
  margin-top: 0.25rem;
  letter-spacing: 0;
  text-transform: none;
}

/* ── Hidden state (JS search filter) ────────────────────────── */
.vendor-card[hidden],
.vendor-card.sa-hidden {
  display: none;
}

/* ── No-results message ──────────────────────────────────────── */
.vendors-no-results {
  display: none;
  grid-column: 1 / -1;
  padding: 3rem 0;
  color: rgba(0, 0, 0, 0.4);
  font-size: 1rem;
  border-top: 1px solid var(--border-light);
}

.vendors-no-results.is-visible {
  display: block;
}

/* ── Section intro header ────────────────────────────────────── */
.vendors-intro {
  max-width: 36rem;
  margin-bottom: 3rem;
}

.vendors-intro p {
  color: rgb(0, 0, 0);
  line-height: 1.7;
  margin-top: 0.75rem;
}

/* ── Mobile: stack intro + search full width ─────────────────── */
@media screen and (max-width: 767px) {
  .vendors-header-row {
    display: flex !important;
    flex-direction: column !important;
    grid-template-columns: unset !important;
  }

  .vendors-header-row .featured-story_image-wrapper,
  .vendors-header-row .column-wrapper {
    width: 100% !important;
    max-width: 100% !important;
    padding-left: 0 !important;
  }

  .vendors-header-row .column-wrapper::before {
    display: none !important;
  }

  .vendors-search-wrapper {
    max-width: 100% !important;
    width: 100% !important;
  }

  .vendors-header-row > div > div {
    width: 100% !important;
    align-items: flex-start !important;
  }

  .vendors-intro {
    margin-bottom: 1.5rem;
  }
}