@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700&family=Lora:wght@500;600&display=swap');

:root {
  --ink: #243432;
  --muted: #667572;
  --brand: #315f5b;
  --brand-dark: #244b48;
  --brand-soft: #e8f0ee;
  --cream: #f8f5ef;
  --paper: #fffdfa;
  --line: #e4e3dd;
  --shadow: 0 12px 35px rgba(43, 63, 59, .09);
  --shadow-hover: 0 18px 42px rgba(43, 63, 59, .15);
  --radius: 20px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-width: 0;
  overflow-x: hidden;
  color: var(--ink);
  background: var(--cream);
  font-family: "DM Sans", system-ui, sans-serif;
  line-height: 1.5;
}
button, input { font: inherit; }
button { color: inherit; }
img { display: block; max-width: 100%; }
a { color: var(--brand); }

.skip-link { position: fixed; z-index: 200; top: .75rem; left: .75rem; padding: .7rem 1rem; border-radius: 8px; background: white; transform: translateY(-160%); }
.skip-link:focus { transform: none; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

.site-header {
  position: relative;
  overflow: hidden;
  padding: clamp(3.5rem, 9vw, 6.5rem) 1.25rem clamp(5rem, 11vw, 8rem);
  color: white;
  text-align: center;
  background: linear-gradient(145deg, #244b48, #3d716c);
}
.site-header::before, .site-header::after { content: ""; position: absolute; border-radius: 50%; background: rgba(255,255,255,.06); }
.site-header::before { width: 32rem; height: 32rem; top: -24rem; left: -8rem; }
.site-header::after { width: 25rem; height: 25rem; right: -12rem; bottom: -17rem; }
.header-inner { position: relative; z-index: 1; max-width: 760px; margin: auto; }
.eyebrow { margin: 0 0 .8rem; font-size: .78rem; font-weight: 700; letter-spacing: .18em; text-transform: uppercase; opacity: .78; }
h1 { margin: 0; font: 600 clamp(2.5rem, 7vw, 4.7rem)/1.08 Lora, Georgia, serif; letter-spacing: -.025em; }
.welcome { max-width: 600px; margin: 1rem auto 0; font-size: clamp(1rem, 2vw, 1.15rem); opacity: .84; }

.page-shell { width: min(1180px, calc(100% - 2rem)); min-height: 55vh; margin: clamp(-3rem, -5vw, -2.2rem) auto 0; position: relative; z-index: 2; }
.directory-tools { padding: 1.25rem; border: 1px solid rgba(255,255,255,.7); border-radius: var(--radius); background: rgba(255,253,250,.96); box-shadow: var(--shadow); backdrop-filter: blur(12px); }
.search-wrap { position: relative; max-width: 590px; margin: 0 auto; }
.search-icon { position: absolute; top: 50%; left: 1.1rem; width: 16px; height: 16px; border: 2px solid var(--muted); border-radius: 50%; transform: translateY(-58%); pointer-events: none; }
.search-icon::after { content: ""; position: absolute; width: 7px; height: 2px; right: -5px; bottom: -3px; background: var(--muted); transform: rotate(45deg); border-radius: 2px; }
#searchInput { width: 100%; padding: .95rem 1rem .95rem 3rem; border: 1px solid var(--line); border-radius: 999px; outline: none; color: var(--ink); background: #fff; }
#searchInput:focus { border-color: var(--brand); box-shadow: 0 0 0 4px rgba(49,95,91,.12); }
.alphabet-nav { display: flex; gap: .25rem; margin-top: 1rem; overflow-x: auto; padding: .2rem .1rem .35rem; scrollbar-width: thin; }
.letter-button { min-width: 2rem; height: 2rem; padding: 0 .55rem; border: 0; border-radius: 999px; background: transparent; font-size: .82rem; font-weight: 600; cursor: pointer; }
.letter-button:hover:not(:disabled) { background: var(--brand-soft); }
.letter-button[aria-pressed="true"] { color: white; background: var(--brand); }
.letter-button:disabled { opacity: .3; cursor: default; }

.status { display: flex; align-items: center; justify-content: center; gap: .7rem; min-height: 9rem; color: var(--muted); }
.status[hidden] { display: none; }
.status.is-error { color: #8b3f37; }
.spinner { width: 1.1rem; height: 1.1rem; border: 2px solid var(--line); border-top-color: var(--brand); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.directory-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 1.15rem; padding: 2rem 0 4rem; }
.member-card { width: 100%; min-width: 0; padding: 1.2rem; border: 1px solid var(--line); border-radius: var(--radius); color: var(--ink); background: var(--paper); box-shadow: 0 4px 18px rgba(43,63,59,.055); text-align: left; cursor: pointer; transition: transform .22s ease, box-shadow .22s ease, border-color .22s ease; }
.member-card:hover { transform: translateY(-4px); border-color: #c8d7d4; box-shadow: var(--shadow-hover); }
.member-card:focus-visible, button:focus-visible { outline: 3px solid #8bb1ab; outline-offset: 3px; }
.card-photo { width: 100%; aspect-ratio: 4 / 4.15; object-fit: cover; border-radius: 14px; background: var(--brand-soft); }
.card-copy { padding: 1rem .15rem .15rem; }
.member-card h2 { margin: 0; font: 600 1.16rem/1.25 Lora, Georgia, serif; }
.card-meta, .card-since { margin: .35rem 0 0; color: var(--muted); font-size: .82rem; }
.card-since { font-size: .75rem; }
.empty-state { grid-column: 1/-1; margin: 2rem 0; padding: 3rem 1.5rem; border: 1px dashed #cbd2cf; border-radius: var(--radius); text-align: center; color: var(--muted); }

.modal-overlay { position: fixed; z-index: 100; inset: 0; display: grid; place-items: center; padding: 1rem; background: rgba(22,37,35,.64); backdrop-filter: blur(9px); }
.modal-overlay[hidden] { display: none; }
.modal { position: relative; width: min(780px, 100%); max-height: min(88vh, 760px); overflow-y: auto; padding: clamp(1.25rem, 4vw, 2rem); border-radius: 24px; background: var(--paper); box-shadow: 0 28px 80px rgba(17,34,31,.3); animation: modal-in .2s ease-out; }
@keyframes modal-in { from { opacity: 0; transform: translateY(12px) scale(.98); } }
.close-button { position: absolute; z-index: 2; top: .8rem; right: .8rem; width: 2.6rem; height: 2.6rem; border: 1px solid var(--line); border-radius: 50%; background: rgba(255,255,255,.92); font-size: 1.7rem; line-height: 1; cursor: pointer; }
.profile { display: grid; grid-template-columns: minmax(220px, 280px) 1fr; gap: clamp(1.5rem, 4vw, 2.4rem); align-items: start; }
.profile-photo { width: 100%; aspect-ratio: 4/5; border-radius: 18px; object-fit: cover; background: var(--brand-soft); }
.profile-name { margin: .2rem 3rem .2rem 0; font: 600 clamp(1.75rem, 4vw, 2.35rem)/1.15 Lora, Georgia, serif; color: var(--brand-dark); }
.profile-role { margin: 0 0 1.2rem; color: var(--muted); }
.contact-actions { display: flex; flex-wrap: wrap; gap: .55rem; margin: 1rem 0; }
.contact-button { display: inline-flex; align-items: center; padding: .65rem .9rem; border: 1px solid #ccdad7; border-radius: 999px; background: var(--brand-soft); font-size: .85rem; font-weight: 600; text-decoration: none; overflow-wrap: anywhere; }
.since-detail { color: var(--muted); font-size: .88rem; }
.household { margin-top: 1.5rem; padding-top: 1.25rem; border-top: 1px solid var(--line); }
.household h3 { margin: 0 0 .55rem; font-size: .76rem; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.family-member { display: flex; align-items: center; gap: .8rem; width: 100%; padding: .65rem; border: 0; border-radius: 12px; background: transparent; text-align: left; cursor: pointer; }
.family-member:hover { background: var(--brand-soft); }
.family-thumb { width: 48px; height: 48px; flex: 0 0 auto; border-radius: 50%; object-fit: cover; background: var(--brand-soft); }
.family-name { display: block; font-weight: 600; }
.family-role { display: block; color: var(--muted); font-size: .78rem; }
.site-footer { padding: 2rem 1rem 3rem; text-align: center; color: var(--muted); font-size: .82rem; }
body.modal-open { overflow: hidden; }

@media (max-width: 600px) {
  .site-header { padding-top: 3rem; }
  .page-shell { width: min(100% - 1rem, 1180px); }
  .directory-tools { padding: .85rem; }
  .directory-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .65rem; padding-top: 1rem; }
  .member-card { padding: .65rem; border-radius: 15px; }
  .card-photo { border-radius: 11px; }
  .card-copy { padding: .7rem .1rem .1rem; }
  .member-card h2 { font-size: .98rem; }
  .card-meta { font-size: .72rem; }
  .card-since { font-size: .68rem; }
  .modal-overlay { padding: .5rem; align-items: end; }
  .modal { width: 100%; max-height: 92vh; border-radius: 22px 22px 12px 12px; }
  .profile { grid-template-columns: 1fr; }
  .profile-photo { max-height: 48vh; object-position: center 25%; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

