/* Sovereign Grace directory - shared styles
   Sober, classical, reverent. No flash. */

/* Palette derived under named authorities, not chosen by taste:
   Pastoureau (meaning, rubrication: ink + bone + one sacred red),
   Brewer (map figure-ground), Albers (a garnet that holds on warm and cool
   grounds), Birren (saturation only for attention), WCAG (contrast checked).
   Verified contrast on bone #f3f3f0:
     ink text            ~16:1  (AAA)
     muted text          ~5.7:1 (AA)
     rubric red link     ~8.2:1 (AAA)
     white on rubric btn ~9.2:1 (AAA) */
:root {
  --ink: #161412;        /* the Word: warm Reformation black */
  --ink-soft: #4c4a45;
  --muted: #75736d;
  --line: #dad9d4;       /* neutral, not warm taupe */
  --paper: #f3f3f0;      /* bone page, near-neutral (breaks the cream habit) */
  --paper-card: #fbfbf9;
  --rubric: #8c1b2d;     /* the blood of Christ; rubric red, blue-shifted garnet */
  --rubric-deep: #6f1322;
  --accent: #211f1b;     /* sober ink ground for the featured card */
  --warn-bg: #f3ead2;    /* functional amber for status only, not brand */
  --warn-line: #e2d3a6;
  --warn-ink: #7a5a12;
  --shadow: 0 1px 2px rgba(22, 20, 18, .06), 0 8px 24px rgba(22, 20, 18, .09);
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--rubric); text-decoration: none; }
a:hover { text-decoration: underline; }

.wrap { max-width: 1280px; margin: 0 auto; padding: 0 24px; }

/* Masthead */
.masthead {
  border-bottom: 1px solid var(--line);
  background: var(--paper-card);
}
.masthead .wrap {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 20px;
  padding-top: 22px;
  padding-bottom: 22px;
  flex-wrap: wrap;
}
.brand { display: flex; flex-direction: column; gap: 2px; }
.brand h1 {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 27px;
  letter-spacing: .01em;
  margin: 0;
  color: var(--ink);
}
.brand h1 a { color: inherit; text-decoration: none; }
.brand h1 a:hover { color: var(--rubric); text-decoration: none; }
.brand .sub {
  font-family: var(--serif);
  font-style: italic;
  color: var(--muted);
  font-size: 16px;
}
.nav { display: flex; gap: 26px; align-items: baseline; }
.nav a { font-size: 15px; letter-spacing: .02em; text-transform: uppercase; color: var(--ink-soft); }

/* Hero */
.hero { padding-top: 46px; padding-bottom: 30px; text-align: center; }
.hero h2 {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 33px;
  line-height: 1.25;
  margin: 0 auto 14px;
  max-width: 640px;
}
.hero p.lede {
  color: var(--ink-soft);
  max-width: 60ch;
  margin: 0 auto;
  font-size: 18px;
}

/* Search */
.finder {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin: 26px auto 6px;
  max-width: 560px;
}
.finder input {
  flex: 1;
  font-size: 17px;
  font-family: var(--sans);
  padding: 13px 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper-card);
  color: var(--ink);
}
.finder input:focus { outline: 2px solid var(--rubric); border-color: var(--rubric); }
.btn {
  font-family: var(--sans);
  font-size: 16px;
  font-weight: 600;
  letter-spacing: .01em;
  padding: 13px 22px;
  border: 1px solid var(--rubric);
  border-radius: 8px;
  background: var(--rubric);
  color: #fff;
  cursor: pointer;
  transition: background .15s ease;
}
.btn:hover { background: var(--rubric-deep); border-color: var(--rubric-deep); }
.btn.ghost { background: transparent; color: var(--rubric); }
.btn.ghost:hover { background: rgba(140, 27, 45, .08); }
.finder-note { text-align: center; color: var(--muted); font-size: 17px; margin: 4px 0 0; min-height: 20px; }

/* Map + panel layout */
.stage {
  display: grid;
  grid-template-columns: 1fr 360px;
  gap: 20px;
  margin: 26px 0 40px;
  align-items: start;
}
#map {
  height: 560px;
  border-radius: 12px;
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  z-index: 0;
}

/* Church profile panel */
.panel {
  background: var(--paper-card);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow);
  min-height: 560px;
  padding: 24px;
  position: sticky;
  top: 18px;
}
.panel .empty { color: var(--muted); font-family: var(--serif); font-style: italic; }
.panel h3 { font-family: var(--serif); font-size: 22px; margin: 0 0 4px; }
.panel .where { color: var(--muted); font-size: 15px; margin-bottom: 16px; }
.panel .row { margin: 0 0 14px; }
.panel .label {
  text-transform: uppercase;
  letter-spacing: .06em;
  font-size: 12px;
  color: var(--rubric);
  margin-bottom: 3px;
  font-weight: 600;
}
.panel .pastor-msg {
  font-family: var(--serif);
  font-style: italic;
  font-size: 17px;
  border-left: 3px solid var(--rubric);
  padding-left: 14px;
  color: var(--ink-soft);
}
.panel .waiting { color: var(--muted); font-style: italic; }
.panel .actions { display: flex; flex-direction: column; gap: 9px; margin-top: 18px; }
.sample-flag {
  display: inline-block;
  font-size: 11px;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: var(--warn-ink);
  background: var(--warn-bg);
  border: 1px solid var(--warn-line);
  border-radius: 4px;
  padding: 1px 7px;
  margin-bottom: 10px;
}

/* Church of the week */
.cotw { margin: 8px 0 48px; }
.cotw .card {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 22px;
  align-items: center;
  background: var(--accent);
  color: #ece9e3;
  border-radius: 14px;
  padding: 26px 30px;
}
.cotw .kicker {
  font-family: var(--serif);
  font-style: italic;
  font-size: 15px;
  color: #d39aa2;            /* a light rubric, the sacred mark on dark ground */
  margin: 0 0 4px;
}
.cotw h3 { font-family: var(--serif); font-size: 24px; margin: 0 0 4px; color: #fbfbf9; }
.cotw .where { color: #b9b7b1; margin-bottom: 10px; }
.cotw .seal {
  width: 64px; height: 64px; border-radius: 50%;
  border: 2px solid var(--rubric);
  display: grid; place-items: center;
  font-family: var(--serif); font-size: 13px; text-align: center; color: #ece9e3;
  line-height: 1.1;
}
.cotw a.btn { align-self: start; }
.cotw .btn { background: var(--rubric); border-color: var(--rubric); color: #fbfbf9; margin-top: 4px; }
.cotw .btn:hover { background: var(--rubric-deep); border-color: var(--rubric-deep); }

/* Section heading */
.section-head { text-align: center; max-width: 640px; margin: 14px auto 18px; }
.section-head h2 { font-family: var(--serif); font-size: 26px; margin: 0; }
.section-head p { color: var(--muted); margin: 4px 0 0; }

/* Freely given: kindred free resources at the foot of the directory. */
.resources { text-align: center; max-width: 640px; margin: 10px auto 50px; }
.resources h2 { font-family: var(--serif); font-size: 24px; margin: 0 0 4px; }
.resources-sub { color: var(--muted); margin: 0 0 22px; }
.reslist { list-style: none; padding: 0; margin: 0; display: flex; gap: 44px; justify-content: center; flex-wrap: wrap; }
.reslist li { display: flex; flex-direction: column; gap: 5px; max-width: 280px; }
.reslist .what { color: var(--ink-soft); font-size: 14px; }
.reslist a { font-family: var(--serif); font-size: 19px; color: var(--rubric); text-decoration: none; }
.reslist a:hover { text-decoration: underline; }
.cycler { min-height: 64px; display: flex; align-items: center; justify-content: center; margin-top: 30px; transition: opacity .35s ease; }
.cycler.fading { opacity: 0; }
.cycle-item { display: flex; flex-direction: column; gap: 5px; }
.cycle-item .what { color: var(--ink-soft); font-size: 14px; }
.cycle-item a { font-family: var(--serif); font-size: 19px; color: var(--rubric); text-decoration: none; }
.cycle-item a:hover { text-decoration: underline; }
.cycle-ann { font-family: var(--serif); font-style: italic; color: var(--ink-soft); font-size: 17px; margin: 0; max-width: 480px; }

/* Footer */
.foot {
  border-top: 1px solid var(--line);
  background: var(--paper-card);
  color: var(--muted);
  font-size: 14px;
  padding: 26px 0 34px;
}
.foot .wrap { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.foot .scripture { font-family: var(--serif); font-style: italic; color: var(--ink-soft); }

/* Help Us page */
.plea { max-width: 760px; margin: 0 auto; padding-top: 40px; padding-bottom: 10px; }
.plea .verse {
  font-family: var(--serif);
  font-style: italic;
  font-size: 21px;
  line-height: 1.5;
  color: var(--ink-soft);
  text-align: center;
  margin: 0 auto 8px;
  max-width: 40ch;
}
.plea .ref { text-align: center; color: var(--rubric); letter-spacing: .05em; font-size: 13px; text-transform: uppercase; margin-bottom: 30px; }
.plea h2 { font-family: var(--serif); font-size: 30px; text-align: center; margin: 0 0 16px; }
.plea .intro { color: var(--ink-soft); font-size: 18px; }

form.cry { max-width: 680px; margin: 26px auto 60px; }
form.cry .field { margin-bottom: 20px; }
form.cry label { display: block; font-weight: 600; margin-bottom: 6px; color: var(--ink); }
form.cry .hint { font-weight: 400; color: var(--muted); font-size: 14px; }
form.cry input[type=text],
form.cry input[type=email],
form.cry textarea {
  width: 100%;
  font-family: var(--sans);
  font-size: 16px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper-card);
  color: var(--ink);
}
form.cry textarea { min-height: 140px; resize: vertical; }
form.cry input:focus, form.cry textarea:focus { outline: 2px solid var(--rubric); border-color: var(--rubric); }
form.cry .checks { display: grid; gap: 8px; }
form.cry .checks label { font-weight: 400; display: flex; gap: 10px; align-items: flex-start; }
form.cry .grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.honeypot { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
form.cry .submit-row { text-align: center; margin-top: 28px; }
.form-note { text-align: center; color: var(--muted); font-size: 14px; margin-top: 12px; }

/* Map ground: grave and neutral so the rubric pins carry the eye (Brewer).
   Stamen Toner is the production target (free via Stadia with a no-cost key);
   a grayscale filter on OpenStreetMap gives the same sober ground keylessly. */
.leaflet-tile-pane { filter: grayscale(1) contrast(0.95) brightness(1.05); }

.sg-cluster {
  width: 40px; height: 40px; border-radius: 50%;
  background: var(--accent); color: var(--paper);
  display: grid; place-items: center;
  font-family: var(--sans); font-weight: 600; font-size: 15px;
  border: 2px solid var(--paper);
  box-shadow: 0 1px 5px rgba(22, 20, 18, .45);
}
.sg-pin svg { display: block; filter: drop-shadow(0 1px 1px rgba(22, 20, 18, .5)); }

/* About page */
.about { max-width: 720px; margin: 0 auto; padding-top: 40px; padding-bottom: 10px; }
.about h2 { font-family: var(--serif); font-size: 30px; margin: 0 0 8px; }
.about .operator { color: var(--ink-soft); margin: 0 0 26px; }
.about .portrait {
  width: 230px; max-width: 42%; height: auto;
  border-radius: 12px; border: 1px solid var(--line); box-shadow: var(--shadow);
  float: right; margin: 4px 0 18px 26px;
}
@media (max-width: 620px) {
  .about .portrait { float: none; display: block; width: 100%; max-width: 300px; margin: 0 0 22px; }
}
.about p { font-size: 18px; color: var(--ink-soft); line-height: 1.65; }
.about .site-link { margin: 22px 0 32px; }
.about .label {
  text-transform: uppercase; letter-spacing: .06em; font-size: 12px;
  color: var(--rubric); font-weight: 600; margin: 0 0 4px;
}
.hometowns { list-style: none; margin: 6px 0 44px; padding: 0; border-top: 1px solid var(--line); }
.hometowns li {
  display: flex; justify-content: space-between; gap: 16px;
  padding: 11px 2px; border-bottom: 1px solid var(--line);
}
.hometowns .place { color: var(--ink); }
.hometowns .years { color: var(--muted); white-space: nowrap; }

/* Directory: list + map (Airbnb pattern; NN/g keeps search and results high). */
.locate { display: block; margin: 10px auto 0; }
.directory { display: grid; grid-template-columns: 400px 1fr; gap: 20px; align-items: start; margin: 24px 0 44px; }
.results-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; min-height: 34px; }
.results-count { color: var(--muted); font-size: 13px; letter-spacing: .04em; text-transform: uppercase; }
.list { display: flex; flex-direction: column; gap: 10px; max-height: 560px; overflow: auto; padding-right: 4px; }
.list[hidden] { display: none; }
.church-card {
  font-family: var(--sans); text-align: left; width: 100%;
  background: var(--paper-card); border: 1px solid var(--line);
  border-radius: 10px; padding: 13px 15px; cursor: pointer;
  transition: border-color .12s ease, box-shadow .12s ease;
}
.church-card:hover, .church-card.active { border-color: var(--rubric); box-shadow: var(--shadow); }
.church-card h4 { font-family: var(--serif); font-size: 18px; margin: 0 0 3px; color: var(--ink); }
.church-card .meta { display: flex; justify-content: space-between; gap: 10px; color: var(--muted); font-size: 14px; }
.church-card .dist { color: var(--rubric); font-weight: 600; white-space: nowrap; }
/* Offset the map by the results-head height (34px min + 12px gap) so its top
   lines up with the first church card, not the "N churches" header. */
.map-pane { position: sticky; top: 18px; margin-top: 46px; }
.map-pane .view-toggle { margin-bottom: 10px; }
.view-toggle { display: none; }
.detail.panel { position: static; min-height: 0; }
.detail-back { background: none; border: none; color: var(--rubric); font: inherit; font-weight: 600; cursor: pointer; padding: 0; margin-bottom: 14px; }
.detail-back:hover { text-decoration: underline; }
.detail .church-photo {
  width: 100%; height: 170px; object-fit: cover;
  border-radius: 10px; border: 1px solid var(--line); margin: 0 0 16px; display: block;
}
.pastor-row { display: flex; align-items: center; gap: 14px; margin: 4px 0 18px; }
.pastor-photo {
  width: 64px; height: 64px; border-radius: 50%; object-fit: cover;
  border: 1px solid var(--line); flex-shrink: 0;
}
.pastor-meta .contact { color: var(--muted); font-size: 14px; margin-top: 2px; }
.detail a.get-directions { display: inline-block; color: var(--rubric); font-weight: 600; font-size: 15px; margin: -8px 0 8px; text-decoration: none; }
.detail a.get-directions:hover { text-decoration: underline; }
.detail .address-plain { color: var(--ink-soft); font-size: 15px; line-height: 1.4; margin: 0 0 10px; }
.detail .service-times { margin: 0 0 16px; }
.detail .phone-line { margin: 0 0 16px; }
.detail .phone-line a { color: var(--rubric); text-decoration: none; font-size: 15px; }
.detail .phone-line a:hover { text-decoration: underline; }
.detail .seeking {
  font-family: var(--serif); font-style: italic; color: var(--rubric);
  border-left: 3px solid var(--rubric); padding-left: 14px; margin: 4px 0 18px;
}

@media (max-width: 900px) {
  /* List-first on phone and tablet portrait, with a toggle to the full map. */
  .directory { grid-template-columns: 1fr; }
  .map-pane { position: static; display: none; margin-top: 0; }
  .view-toggle { display: inline-flex; }
  .directory.show-map .results { display: none; }
  .directory.show-map .map-pane { display: block; }
  #map { height: 70vh; min-height: 420px; }
  .list { max-height: none; overflow: visible; }
  .cotw .card { grid-template-columns: 1fr; }
  form.cry .grid2 { grid-template-columns: 1fr; }
}
