/**
 * Church Locator Page Styles
 * Enqueued only on the Find a Church page.
 *
 * @package KCM Theme
 */

:root {
  --kcm-gold: var(--neutral-700);
  --kcm-dark: var(--black-700);
  --kcm-blue: var(--black-700);
}

.church-locator-page {
  padding-block-start: var(--spacing-main-block-start);
}

/* ── Search header ─────────────────────────────────────────────────── */

.church-search-container {
  margin: 0 auto;
  padding: 0;
}

.search-title,
.church-results-main-title {
  font-family: var(--font-family-display, "IvyOra Display", serif);
  font-size: 39px;
  font-weight: 400;
  font-style: normal;
  line-height: 110%;
  color: var(--black-700, #151515);
  margin-bottom: 1rem;
}

@media (min-width: 992px) {
  .search-title,
  .church-results-main-title {
    font-size: 61px;
  }
}

.search-description {
  margin-bottom: 2rem;
  color: #555;
  max-width: 600px;
  font-size: 1.1rem;
}

/* ── Search form ───────────────────────────────────────────────────── */

.church-search-form {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: center;
  border-bottom: 1px solid #ddd;
  padding-bottom: 1rem;
  margin-bottom: 2rem;
  max-width: 900px;
}

.search-field {
  position: relative;
  display: flex;
  align-items: center;
}

.search-field input,
.search-field select {
  padding: 0.8rem 1rem;
  font-size: 1rem;
  border: none;
  background: transparent;
  outline: none;
  width: 100%;
}

.radius-field select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  padding-inline-end: 2rem;
}

.radius-field .dashicons {
  cursor: pointer;
}

.js-field-trigger {
  cursor: pointer;
  pointer-events: auto;
}

.radius-field {
  flex: 0 0 140px;
  border-right: 1px solid #ddd;
}

.zip-field,
.name-field {
  flex: 1;
  min-width: 200px;
  display: flex;
  align-items: center;
}

.zip-field {
  border-right: 1px solid #ddd;
}

.search-icon {
  color: #888;
  margin-left: 0.5rem;
}

.clear-input {
  background: none;
  border: none;
  font-size: 1.2rem;
  cursor: pointer;
  color: #888;
  padding: 0 0.5rem;
}

.name-field {
  position: relative;
}

/* ── Church name typeahead ─────────────────────────────────────────── */

.church-name-typeahead {
  position: absolute;
  inset-block-start: calc(100% + 0.4rem);
  inset-inline: 0;
  z-index: 15;
  max-block-size: 16rem;
  overflow-y: auto;
  border: 1px solid var(--gray-200);
  border-radius: 0.5rem;
  background: var(--white);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.08);
}

.church-name-option {
  display: block;
  inline-size: 100%;
  border: 0;
  border-block-end: 1px solid var(--gray-100);
  background: transparent;
  color: var(--black-700);
  cursor: pointer;
  font-size: 0.95rem;
  text-align: left;
  padding-block: 0.65rem;
  padding-inline: 0.9rem;
}

.church-name-option:last-child {
  border-block-end: 0;
}

.church-name-option:hover,
.church-name-option.is-active {
  background: var(--neutral-200);
}

.church-name-option mark {
  background: var(--neutral-500);
  color: inherit;
  font-weight: 700;
  padding-inline: 0.05rem;
}

/* ── Utility ───────────────────────────────────────────────────────── */

.hidden {
  display: none !important;
}

/* ── Map ───────────────────────────────────────────────────────────── */

.church-map-section {
  height: 50vh;
  width: 100%;
  position: relative;
  /* margin-bottom: 3rem; */
}

#church-locator-map {
  width: 100%;
  height: 100%;
  opacity: 0;
  transition: opacity 0.5s ease;
}

#church-locator-map.is-ready {
  opacity: 1;
}

/* ── Results section ───────────────────────────────────────────────── */

.church-results-section {
  font-family: var(--font-family-sans);
  margin: 0 auto 4rem;
  padding-block: clamp(3.5rem, 5.556vw + 1.222rem, 5rem); /* 56px → 80px @ 768–1200px */
  padding-inline: 0;
}

.church-results-live-region {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.church-results-heading {
  margin-bottom: clamp(3.5rem, 4.514vw + 1.542rem, 4.6875rem); /* 56px → 75px @ 768–1200px */
}

.church-results-main-title {
  margin: 0 0 clamp(1rem, 1.667vw + 0.319rem, 1.4375rem); /* 16px → 23px @ 768–1200px */
}

.church-results-disclaimer {
  font-size: clamp(0.8125rem, 0.232vw + 0.753rem, 0.875rem); /* 13px → 14px @ 768–1200px */
  font-weight: 400;
  line-height: 150%;
  color: var(--black-700, #151515);
  margin: 0;
  max-width: 502px;
}

/* ── Results grid ──────────────────────────────────────────────────── */

.church-results-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: 1fr;
  gap: clamp(2rem, 4vw, 3rem);
}

@media (min-width: 768px) {
  .church-results-list {
    grid-template-columns: repeat(2, 1fr);
    column-gap: 2.5rem;
    row-gap: 3rem;
  }
}

@media (min-width: 1024px) {
  .church-results-list {
    grid-template-columns: repeat(3, 1fr);
  }
}

.church-result-item {
  margin: 0;
  padding: 0;
}

.church-result-card {
  border: none;
  padding: 0;
  background: transparent;
  border-radius: 0;
}

/* ── Church card ───────────────────────────────────────────────────── */

h3.church-card-title,
h3.church-card-title a,
.church-card-title,
.church-card-title a {
  font-family: var(--font-family-sans);
  font-weight: 700;
}

h3.church-card-title,
.church-card-title {
  font-size: clamp(1rem, 0.926vw + 0.556rem, 1.25rem); /* 16px → 20px @ 768–1200px */
  line-height: 1.3;
  color: var(--black-800, #111);
  margin: 0 0 0.5rem;
}

.church-card-title a {
  text-decoration: none;
  color: inherit;
}

.church-card-title a:hover,
.church-card-title a:focus-visible {
  text-decoration: underline;
}

.church-card-pastor,
.church-card-phone {
  margin: 0;
}

.church-card-pastor,
.church-card-address-line,
.church-card-phone {
  font-size: clamp(0.875rem, 0.802vw + 0.556rem, 1rem); /* 14px → 16px @ 768–1200px */
  line-height: 1.5;
  color: var(--black-700, #151515);
}

.church-card-address-block {
  margin-bottom: 0.65rem;
}

.church-card-address-line {
  margin: 0;
}

.church-card-phone .church-card-phone-num {
  font-weight: 700;
  color: inherit;
  text-decoration: none;
}

.church-card-phone .church-card-phone-num:hover,
.church-card-phone .church-card-phone-num:focus-visible {
  text-decoration: underline;
}

/* ── Pagination ────────────────────────────────────────────────────── */

.church-results-pagination {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  margin-top: 3rem;
}

.church-pagination__btn {
  min-width: 2.5rem;
  min-height: 2.5rem;
  padding: 0.35rem 0.55rem;
  border: none;
  background: transparent;
  font-size: 1rem;
  color: var(--black-700, #151515);
  cursor: pointer;
  border-radius: 999px;
  line-height: 1;
}

.church-pagination__btn:hover:not(:disabled) {
  background: var(--neutral-200, #e8e8e8);
}

.church-pagination__btn:focus-visible {
  outline: 2px solid var(--black-700, #151515);
  outline-offset: 2px;
}

.church-pagination__btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.church-pagination__btn.is-current {
  background: var(--neutral-300, #d4d4d4);
  font-weight: 600;
  color: var(--black-700, #151515);
}

.church-pagination__ellipsis {
  padding: 0 0.25rem;
  user-select: none;
  color: var(--neutral-600, #666);
  line-height: 2.5rem;
}

/* ── No results / Geo prompt ───────────────────────────────────────── */

.no-results-message {
  border: 1px solid var(--neutral-700);
  padding: 2rem;
  background: #fffafa;
  max-width: 800px;
}

.no-results-title {
  font-size: 3rem;
  margin: 0 0 1rem;
  font-weight: 400;
}

.no-results-text {
  font-size: 1.1rem;
  margin-bottom: 2rem;
}

.no-results-disclaimer {
  font-size: 0.85rem;
  color: #666;
  line-height: 1.4;
}

.church-geo-prompt {
  padding: 2.5rem 0 1rem;
  color: var(--neutral-700, #444);
  font-size: 1rem;
}

.church-geo-prompt.hidden {
  display: none !important;
}

/* ── Mobile overrides ──────────────────────────────────────────────── */

@media (max-width: 768px) {
  .church-search-form {
    flex-direction: column;
    align-items: stretch;
  }

  .radius-field,
  .zip-field {
    border-right: none;
    border-bottom: 1px solid #ddd;
  }
}
