:root {
  color-scheme: light;
  font: 16px/1.55 "Segoe UI", system-ui, -apple-system, sans-serif;
  color: #18362e;
  background: #f7f6f1;
  --green: #195340;
  --muted: #4b5e56;
  --border: #d7e0da;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; }
button, input, select { font: inherit; }

button, select {
  min-height: 40px;
  padding: 6px 12px;
  border: 1px solid #b8c9bf;
  border-radius: 7px;
  background: white;
  color: inherit;
}

button, select { cursor: pointer; }

:focus-visible {
  outline: 3px solid #a87420;
  outline-offset: 3px;
}

.wrap {
  width: min(1440px, calc(100% - clamp(32px, 11vw, 176px)));
  margin-inline: auto;
}

.hero {
  color: #fff;
  background: linear-gradient(110deg, #153e34, #235645);
}

.hero-content {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 540px);
  align-items: center;
  gap: 24px;
  padding-block: 22px 15px;
}

.eyebrow {
  margin: 0 0 4px;
  color: #e0e8d8;
  font-size: .75rem;
  font-weight: 700;
  letter-spacing: .1em;
}

h1 {
  margin: 0;
  font: 500 clamp(1.75rem, 3vw, 2.3rem)/1.15 Georgia, serif;
}

h1 em { color: #e7e3a4; }

#search-form {
  display: flex;
  gap: 6px;
  padding: 4px;
  background: #fff;
  border-radius: 9px;
}

#keywords {
  flex: 1;
  min-width: 0;
  padding: 6px 8px;
  border: 0;
  border-radius: 5px;
  color: #18362e;
}

#search-form button { min-height: 36px; }

.primary {
  border-color: var(--green);
  background: var(--green);
  color: #fff;
  font-weight: 600;
}

.primary:hover { background: #24644f; }

.suggestions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 8px;
  font-size: .875rem;
}

.suggestions button {
  min-height: 28px;
  padding: 1px 10px;
  border-color: #829f91;
  border-radius: 14px;
  background: transparent;
  color: #fff;
}

.suggestions button:hover { background: #326753; }

.directory { padding-block: 24px 32px; }

.results-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 20px;
  margin-bottom: 16px;
}

h2 {
  margin: 0;
  font-size: clamp(1.4rem, 3vw, 1.9rem);
  line-height: 1.25;
  font-weight: 650;
}

#status {
  margin: 4px 0 0;
  color: var(--muted);
  overflow-wrap: anywhere;
}

.filters {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.filters label { font-size: .875rem; font-weight: 600; }
.filters select { max-width: 100%; }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 240px), 1fr));
  gap: 16px;
}

.card {
  display: flex;
  flex-direction: column;
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fff;
}

.card-photo {
  aspect-ratio: 2 / 1;
  overflow: hidden;
  border-radius: 11px 11px 0 0;
  background: #f0f1ee;
}

.card-photo img, .contact-photo {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.card-body {
  display: flex;
  flex: 1;
  flex-direction: column;
  padding: 16px;
}

.card h3 {
  margin: 0 0 4px;
  font-size: 18px;
  font-weight: 650;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.metadata {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  overflow-wrap: anywhere;
}

.description {
  margin: 10px 0 16px;
  color: #354b42;
  overflow-wrap: anywhere;
}

.card-actions {
  display: flex;
  gap: 8px;
  margin-top: auto;
}

.card-actions .contact {
  flex: 1;
  min-height: 44px;
  font-size: 14px;
}

.heart {
  position: relative;
  flex: 0 0 44px;
  min-height: 44px;
  padding: 0;
  border-color: var(--border);
  background: #fff;
  color: #4b5e56;
  font-size: 23px;
  line-height: 1;
}

.heart span { display: inline-block; }
.heart:hover { background: #f3f6f3; }

.heart[aria-pressed="true"] {
  color: #a82753;
  background: #fdf2f6;
  border-color: #e5b8c8;
}

.heart:is(:hover, :focus-visible)::after {
  content: attr(data-tooltip);
  position: absolute;
  z-index: 2;
  right: 0;
  bottom: calc(100% + 6px);
  width: max-content;
  padding: 6px 8px;
  border-radius: 5px;
  background: #18362e;
  color: #fff;
  font-size: .75rem;
  line-height: 1.3;
  pointer-events: none;
}

.empty {
  grid-column: 1 / -1;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
}

#pagination {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 20px;
}

#pagination [aria-current="page"] {
  background: var(--green);
  color: #fff;
  border-color: var(--green);
}

footer {
  padding-block: 16px 24px;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: .875rem;
}

dialog {
  width: min(460px, calc(100% - 32px));
  max-height: calc(100dvh - 32px);
  overflow: auto;
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: 12px;
  color: inherit;
}

dialog::backdrop { background: #102b2399; }

.contact-photo {
  aspect-ratio: 2 / 1;
  height: auto;
  max-height: 200px;
  margin-bottom: 12px;
  border-radius: 8px;
}

dialog form { display: flex; justify-content: flex-end; }
#contact-details { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 8px 12px; }
#contact-details dt { font-weight: 600; }
#contact-details dd { margin: 0; overflow-wrap: anywhere; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

@media (min-width: 1100px) {
  .grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

@media (min-width: 1200px) and (max-width: 1499px) {
  .wrap { width: calc(100% - clamp(160px, 14vw, 210px)); }
}

@media (max-width: 850px) {
  .hero-content { grid-template-columns: 1fr; gap: 12px; }
}

@media (max-width: 600px) {
  .hero-content {
    grid-template-columns: minmax(0, 1fr);
    gap: 14px;
    padding-block: 18px 14px;
  }

  .hero .eyebrow {
    margin-bottom: 6px;
    font-size: .7rem;
    letter-spacing: .08em;
  }

  .hero h1 {
    font-size: clamp(1.4rem, 6vw, 1.75rem);
    line-height: 1.15;
  }

  .hero h1 em {
    display: block;
  }

  #search-form {
    width: 100%;
  }

  #keywords {
    font-size: 16px;
  }

  .suggestions {
    gap: 6px;
    margin-top: 8px;
  }

  .suggestions > span {
    display: none;
  }

  .suggestions button {
    min-height: 32px;
  }
}

.results-header > div:first-child {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 2px 12px;
  min-width: 0;
  max-width: 100%;
}

.results-header #status {
  margin: 0;
  font-size: 0.875rem;
  color: #4b5e56;
}