/* WeGrow's public face.
 *
 * Deliberately its own stylesheet rather than the roster's. This is the one
 * part of the church's software a stranger sees, and it is judged as a
 * website, not as an app: wide, calm, and quick to read on a phone. Sharing
 * app.css would have meant every change to the roster's chrome landing on
 * the church's front door.
 *
 * No inline scripts or event handlers anywhere in WeGrow -- the Worker's CSP
 * is strict enough to refuse them, which is what makes an injected <script>
 * inert rather than merely unlikely.
 */

:root {
  --ink:      #14181d;
  --ink-soft: #55606d;
  --ink-faint:#868f9a;
  --line:     #e4e8ec;
  --bg:       #ffffff;
  --panel:    #f6f8f9;
  --brand:    #0f766e;
  --brand-lift:#12897f;
  --accent:   #2f7ed8;
  --open:     #157a4a;
  --open-bg:  #e7f5ed;
  --radius:   14px;
  --shadow:   0 1px 2px rgba(16,24,32,.06), 0 8px 24px rgba(16,24,32,.05);
  --wrap:     1120px;
  --gutter:   16px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ink: #e8edf2; --ink-soft: #a8b3bf; --ink-faint: #7d8794;
    --line: #262d35; --bg: #0f1317; --panel: #161b21;
    --brand: #2dd4bf; --brand-lift: #5eead4; --accent: #6ba9ea;
    --open: #4ade80; --open-bg: #12291d;
    --shadow: 0 1px 2px rgba(0,0,0,.5), 0 8px 24px rgba(0,0,0,.35);
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
        "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

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

.skip {
  position: absolute; left: -9999px; top: 0; z-index: 10;
  background: var(--brand); color: #fff; padding: 10px 16px;
}
.skip:focus { left: 8px; top: 8px; }

/* ------------------------------------------------------------------ header */
.top { border-bottom: 1px solid var(--line); background: var(--bg); }
.top__in {
  max-width: var(--wrap); margin: 0 auto;
  padding: 14px var(--gutter);
  display: flex; align-items: center; gap: 20px; flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); }
.brand:hover { text-decoration: none; }
.brand__mark {
  width: 28px; height: 28px; border-radius: 8px; flex: none;
  background: linear-gradient(140deg, var(--brand), var(--accent));
}
.brand__name { font-weight: 700; letter-spacing: -0.01em; }
.nav { margin-left: auto; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.nav a {
  color: var(--ink-soft); padding: 8px 12px; border-radius: 999px;
  font-weight: 500;
}
.nav a:hover { background: var(--panel); text-decoration: none; color: var(--ink); }
.nav a[aria-current="page"] { background: var(--panel); color: var(--ink); }
.nav__in { border: 1px solid var(--line); }

/* -------------------------------------------------------------------- page */
.main { max-width: var(--wrap); margin: 0 auto; padding: 28px var(--gutter) 64px; }
.loading, .empty { color: var(--ink-faint); padding: 48px 0; text-align: center; }

.hero { max-width: 640px; margin: 8px 0 30px; }
.hero h1 {
  font-size: clamp(30px, 4.6vw, 44px); line-height: 1.1; margin: 0 0 10px;
  letter-spacing: -0.028em; font-weight: 700;
}
.hero p { color: var(--ink-soft); margin: 0; font-size: 17.5px; line-height: 1.6; }

.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}

/* ------------------------------------------------------------- find a group */
.filters {
  display: flex; gap: 12px; align-items: center; flex-wrap: wrap;
  padding-bottom: 18px; margin-bottom: 4px; border-bottom: 1px solid var(--line);
}
.search { flex: 1 1 260px; max-width: 320px; }
.search input {
  width: 100%; font: inherit; color: var(--ink); background: var(--panel);
  border: 1px solid transparent; border-radius: 999px; padding: 10px 16px;
}
.search input:focus { outline: 2px solid var(--brand); background: var(--bg); }
.chips { display: flex; gap: 7px; flex-wrap: wrap; }
.chip {
  font: inherit; font-size: 14.5px; cursor: pointer;
  border: 1px solid var(--line); background: none; color: var(--ink-soft);
  border-radius: 999px; padding: 7px 15px;
}
.chip:hover { color: var(--ink); border-color: var(--ink-faint); }
.chip.is-on { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.bandnote {
  color: var(--ink-soft); margin: 18px 0 0; max-width: 640px; font-size: 15.5px;
}

/* --------------------------------------------------------------- group rows */
.rows { margin-top: 10px; }
.row {
  display: flex; gap: 18px; align-items: flex-start;
  padding: 20px 4px; border-bottom: 1px solid var(--line);
  color: var(--ink);
}
.row:hover { text-decoration: none; background: var(--panel); border-radius: 12px; }
.row:hover .row__name { color: var(--brand); }
.row__thumb {
  flex: none; width: 96px; height: 96px; border-radius: 14px;
  object-fit: cover; display: block; background-color: var(--panel);
}
.row__body { min-width: 0; display: flex; flex-direction: column; gap: 3px; flex: 1; }
.row__name { font-size: 18.5px; font-weight: 650; letter-spacing: -0.012em; }
.row__sum { color: var(--ink-soft); font-size: 15.5px; }
.row__meta { color: var(--ink-faint); font-size: 14px; }
.row__next {
  color: var(--brand); font-size: 14px; font-weight: 600; margin-top: 3px;
}
.row__side {
  flex: none; display: flex; flex-direction: column; align-items: flex-end; gap: 7px;
}
.row__cat { color: var(--ink-faint); font-size: 13px; }
.tag {
  display: inline-block; font-size: 12.5px; font-weight: 600;
  padding: 3px 11px; border-radius: 999px;
  background: var(--open-bg); color: var(--open);
}
.tag--shut { background: var(--panel); color: var(--ink-faint); }

/* ------------------------------------------------------------ a group's page */
.cover { margin: 0 0 26px; }
.cover__img {
  display: block; width: 100%; height: clamp(150px, 22vw, 240px);
  border-radius: 16px; object-fit: cover; background-color: var(--panel);
}
.masthead {
  display: flex; gap: 24px; align-items: flex-start; flex-wrap: wrap;
  margin-bottom: 26px;
}
.masthead__words { flex: 1 1 320px; min-width: 0; }
.masthead__title {
  font-size: clamp(30px, 4.6vw, 46px); margin: 0; line-height: 1.08;
  letter-spacing: -0.028em;
}
.masthead__sum { color: var(--ink-soft); margin: 10px 0 0; font-size: 17px; max-width: 52ch; }
.masthead__act { display: flex; flex-direction: column; align-items: flex-start; gap: 7px; }
.masthead__note { color: var(--ink-faint); font-size: 13.5px; }

.facts {
  display: flex; flex-wrap: wrap; gap: 14px 40px; margin: 0 0 34px;
  padding: 18px 20px; background: var(--panel); border-radius: 14px;
}
.facts__item { min-width: 0; }
.facts dt {
  font-size: 12px; letter-spacing: .09em; text-transform: uppercase;
  color: var(--ink-faint); font-weight: 600; margin-bottom: 3px;
}
.facts dd { margin: 0; font-weight: 500; }

.btn {
  display: inline-block; border: 0; cursor: pointer; font: inherit;
  font-weight: 650; color: #fff; padding: 13px 26px; border-radius: 12px;
  background: var(--brand);
}
.btn:hover { background: var(--brand-lift); text-decoration: none; }
.btn:disabled { filter: grayscale(1); cursor: default; }
.btn--quiet {
  background: none; color: var(--ink); border: 1px solid var(--line);
  padding: 10px 18px; font-weight: 500;
}
.btn--quiet:hover { background: var(--panel); }

.cols { display: grid; gap: 40px; }
@media (min-width: 860px) { .cols { grid-template-columns: minmax(0,1fr) 250px; } }
.side h3 {
  font-size: 12px; letter-spacing: .09em; text-transform: uppercase;
  color: var(--ink-faint); margin: 0 0 10px; font-weight: 600;
}
.side p { margin: 0 0 12px; }
.side__soft { color: var(--ink-soft); font-size: 15px; }
.prose { max-width: 62ch; white-space: pre-wrap; margin: 0 0 30px; line-height: 1.65; }

/* ------------------------------------------------------------------ events */
.evgroup + .evgroup { margin-top: 36px; }
.evgroup h2 { font-size: 22px; margin: 0 0 14px; letter-spacing: -0.01em; }
.ev { display: flex; gap: 16px; padding: 14px 0; border-top: 1px solid var(--line); }
.ev:first-of-type { border-top: 0; }
.ev__when {
  flex: none; width: 66px; text-align: center; background: var(--panel);
  border-radius: 10px; padding: 8px 4px; align-self: flex-start;
}
.ev__mon { display: block; font-size: 11.5px; font-weight: 700; letter-spacing: .07em; color: var(--ink-soft); text-transform: uppercase; }
.ev__day { display: block; font-size: 22px; font-weight: 650; line-height: 1.15; }
.ev__what { min-width: 0; }
.ev__title { font-weight: 600; color: var(--accent); }
.ev__meta { color: var(--ink-soft); font-size: 14.5px; margin: 2px 0 0; }
.ev--off .ev__title { text-decoration: line-through; color: var(--ink-faint); }

/* ------------------------------------------------------------------- forms */
.sheet { max-width: 520px; }
.field { display: block; margin-bottom: 16px; }
.field > span { display: block; font-weight: 600; margin-bottom: 5px; font-size: 14.5px; }
.field input, .field textarea {
  width: 100%; font: inherit; color: var(--ink); background: var(--bg);
  border: 1px solid var(--line); border-radius: 10px; padding: 11px 13px;
}
.field input:focus, .field textarea:focus { outline: 2px solid var(--brand); border-color: transparent; }
.hint { color: var(--ink-faint); font-size: 13.5px; margin: -8px 0 16px; }
.note { border-radius: var(--radius); padding: 14px 16px; margin: 0 0 20px; }
.note--bad { background: #fdecec; color: #8f2020; }
.note--good { background: var(--open-bg); color: var(--open); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .note--bad { background: #331717; color: #f5a3a3; }
}

.crumb { color: var(--ink-soft); margin: 0 0 18px; font-size: 14.5px; }

/* ------------------------------------------------------------------ footer */
.foot {
  border-top: 1px solid var(--line); margin-top: 40px;
  padding: 24px var(--gutter); text-align: center; color: var(--ink-faint);
  font-size: 14px;
}
.foot p { margin: 2px 0; }
.foot__thin { font-size: 13px; }

/* ------------------------------------------------------------ small screens
 * A church's full legal name is long -- "Hamilton Seventh-day Adventist
 * Church" -- and at 375px it wrapped to two lines and pushed the nav onto a
 * third, so a third of the first screen was header before anybody saw a
 * group. Smaller type and a tighter nav fixes it without abbreviating a name
 * the church chose.
 */
@media (max-width: 560px) {
  .top__in { padding: 11px var(--gutter); gap: 10px; }
  .brand__name {
    font-size: 15px; line-height: 1.25;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
    overflow: hidden;
  }
  .nav { width: 100%; margin-left: 0; justify-content: flex-start; gap: 2px; }
  .nav a { padding: 7px 11px; font-size: 15px; }
  .main { padding-top: 22px; }
  .hero { margin-bottom: 22px; }
  .search { max-width: none; }
  .row { gap: 14px; padding: 16px 2px; }
  .row__thumb { width: 68px; height: 68px; border-radius: 12px; }
  .row__name { font-size: 17px; }
  /* The tag moves under the words on a phone: kept on the right it squeezed
   * long group names into two or three lines. */
  .row__side { flex-direction: row; align-items: center; gap: 8px; }
  .row { flex-wrap: wrap; }
  .row__side { width: 100%; padding-left: 82px; }
  .masthead__act { width: 100%; }
  .masthead__act .btn { width: 100%; text-align: center; }
  .facts { gap: 12px 24px; padding: 14px 16px; }
  .cover__img { height: 150px; border-radius: 13px; }
}

/* The little + beside an event, which hands over a calendar file. Kept out
 * of the text flow so a long event title does not push it onto its own line. */
.ev__cal {
  flex: none; align-self: center; margin-left: auto;
  width: 34px; height: 34px; border-radius: 9px;
  display: grid; place-items: center;
  border: 1px solid var(--line); color: var(--ink-soft);
  font-size: 19px; line-height: 1; text-decoration: none;
}
.ev__cal:hover { background: var(--panel); color: var(--ink); text-decoration: none; }
.ev--off .ev__cal { display: none; }

/* A dropdown has to match the text boxes beside it, or a form of six fields
 * looks like it was assembled from two different pages. */
.field select {
  width: 100%; font: inherit; color: var(--ink); background: var(--bg);
  border: 1px solid var(--line); border-radius: 10px; padding: 11px 13px;
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--ink-soft) 50%),
                    linear-gradient(135deg, var(--ink-soft) 50%, transparent 50%);
  background-position: calc(100% - 19px) calc(50% + 2px), calc(100% - 14px) calc(50% + 2px);
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
}
.field select:focus { outline: 2px solid var(--brand); border-color: transparent; }

/* ------------------------------------------------------- the members' pages */
.sec {
  font-size: 13px; letter-spacing: .09em; text-transform: uppercase;
  color: var(--ink-faint); font-weight: 600; margin: 34px 0 6px;
}
.sec:first-of-type { margin-top: 26px; }

/* The one thing waiting on a leader, said before their own groups. Somebody
 * asked to join a church group; leaving that to be noticed is how a visitor
 * concludes the church never replied. */
.callout {
  display: block; padding: 16px 20px; border-radius: 14px;
  background: var(--open-bg); color: var(--open);
  border: 1px solid transparent;
}
.callout:hover { text-decoration: none; filter: brightness(0.98); }
.callout strong { display: block; font-size: 16.5px; }
.callout span { display: block; font-size: 14.5px; opacity: .85; margin-top: 2px; }

.ask {
  display: flex; gap: 18px; align-items: flex-start; flex-wrap: wrap;
  padding: 20px 4px; border-bottom: 1px solid var(--line);
}
.ask__who { flex: 1 1 280px; min-width: 0; }
.ask__name { font-weight: 650; font-size: 17.5px; }
.ask__grp { color: var(--ink-soft); }
.ask__note {
  margin: 8px 0 6px; color: var(--ink); font-style: italic;
  border-left: 3px solid var(--line); padding-left: 12px;
}
.ask__meta { display: block; color: var(--ink-faint); font-size: 14px; margin-top: 4px; }
.ask__act { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.ask__out { flex-basis: 100%; }
.ask__send { display: flex; gap: 8px; flex-wrap: wrap; margin: 10px 0 0; }
@media (max-width: 560px) {
  .ask__act { width: 100%; }
  .ask__act .btn { flex: 1; text-align: center; }
}

/* --------------------------------------------------------------- documents */
.shelf + .shelf { margin-top: 10px; }
.doc {
  display: flex; gap: 14px; align-items: flex-start;
  padding: 14px 4px; border-bottom: 1px solid var(--line);
}
/* The file's type as a small square rather than an icon font: it says PDF or
 * DOCX in words, which is what somebody about to download it wants to know,
 * and it needs no image to load. */
.doc__kind {
  flex: none; width: 46px; height: 46px; border-radius: 10px;
  background: var(--panel); color: var(--ink-soft);
  display: grid; place-items: center;
  font-size: 10.5px; font-weight: 700; letter-spacing: .04em;
}
.doc__body { min-width: 0; display: flex; flex-direction: column; gap: 2px; flex: 1; }
.doc__title { font-weight: 600; }
.doc__desc { color: var(--ink-soft); font-size: 14.5px; }
.doc__meta { color: var(--ink-faint); font-size: 13.5px; }

.adder {
  border: 1px solid var(--line); border-radius: 14px;
  padding: 0 18px; margin: 0 0 26px;
}
.adder > summary {
  cursor: pointer; padding: 15px 0; font-weight: 600; list-style: none;
}
.adder > summary::-webkit-details-marker { display: none; }
.adder > summary::before { content: "+  "; color: var(--brand); font-weight: 700; }
.adder[open] > summary::before { content: "\2212  "; }
.adder form { padding-bottom: 20px; max-width: 460px; }

/* -------------------------------------------------------------------- chat */
.chat { max-width: 700px; }
.chat__thread {
  border: 1px solid var(--line); border-radius: 14px;
  padding: 14px 16px; max-height: 60vh; overflow-y: auto;
  display: flex; flex-direction: column; gap: 12px;
}
.said { display: flex; flex-direction: column; gap: 1px; }
.said__who { font-size: 13px; font-weight: 650; color: var(--ink-soft); }
.said__body { white-space: pre-wrap; }
.said__when { font-size: 12px; color: var(--ink-faint); }
/* Own messages lean right, which is the one convention every chat app has
 * taught people to read without being told. */
.said--mine { align-items: flex-end; text-align: right; }
.chat__say { display: flex; gap: 10px; align-items: flex-end; margin-top: 14px; }
.chat__say textarea {
  flex: 1; font: inherit; color: var(--ink); background: var(--bg);
  border: 1px solid var(--line); border-radius: 12px; padding: 11px 14px;
  resize: vertical; min-height: 44px;
}
.chat__say textarea:focus { outline: 2px solid var(--brand); border-color: transparent; }
