/* HomeGroup — mobile-first, accessible base styles.
   Clean blue + grey palette, strong contrast, large type and tap targets.
   System fonts only (no network fetch, offline-safe).
   Retune the brand by editing the --color-* variables below. */

:root {
  /* Brand palette (single source of truth — change these to retheme). */
  --color-accent:        #2563EB;   /* primary blue — buttons, links, logo */
  --color-accent-hover:  #1D4ED8;
  --color-text:          #1E293B;   /* slate, primary text */
  --color-text-muted:    #64748B;
  --color-surface:       #FFFFFF;
  --color-bg:            #F8FAFC;   /* page background */
  --color-border:        #E2E8F0;

  /* Soft accent wash for hovers/focus rings (blue at low alpha). */
  --color-accent-soft:   rgba(37, 99, 235, 0.10);
  --color-focus-ring:    rgba(37, 99, 235, 0.45);

  /* Semantic aliases used throughout the stylesheet. */
  --bg: var(--color-bg);
  --surface: var(--color-surface);
  --ink: var(--color-text);
  --ink-soft: var(--color-text-muted);
  --accent: var(--color-accent);
  --accent-ink: var(--color-surface);   /* white text/foreground on accent */
  --line: var(--color-border);
  --danger: #b42318;
  --ok: #15803d;

  --radius: 12px;
  --tap: 48px;            /* minimum tap target */
  --space: 1rem;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica,
    Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji";
  font-size: 1.0625rem;   /* ~17px, comfortable for a wide age range */
  line-height: 1.55;
  min-height: 100vh;
}

/* ---- Sticky top bar (white with a thin grey underline, not a heavy bar) ---- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--surface);
  color: var(--ink);
  border-bottom: 1px solid var(--line);
  padding: env(safe-area-inset-top) 0 0 0;
}
.topbar__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;            /* lets the nav drop to its own full-width row */
  gap: 0.5rem var(--space);
  padding: 0.75rem var(--space);
  max-width: 720px;
  margin: 0 auto;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--accent);
  font-weight: 700;
  font-size: 1.2rem;
  letter-spacing: -0.01em;
  text-decoration: none;
}
.brandmark { width: 1.6rem; height: 1.6rem; display: block; flex: none; }
.nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 0.5rem;
  align-items: center;
}
.nav a, .nav button {
  color: var(--ink);
  text-decoration: none;
  font-size: 1rem;
  padding: 0.4rem 0.6rem;
  border-radius: 8px;
  background: none;
  border: none;
  cursor: pointer;
  min-height: auto;
  margin-top: 0;
  font-weight: 500;
}
.nav a:hover, .nav a:focus,
.nav button:hover, .nav button:focus { background: var(--color-accent-soft); color: var(--accent); }
.nav form { display: inline; margin: 0; }

/* Hamburger toggle — large tap target, accent on interaction. */
.nav-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  min-height: 44px;
  margin-top: 0;
  padding: 0;
  background: none;
  border: 1px solid var(--color-border);
  border-radius: 10px;
  color: var(--color-text);
  cursor: pointer;
}
.nav-toggle:hover, .nav-toggle:focus { background: var(--color-accent-soft); color: var(--accent); }

/* Small screens: the menu collapses behind the toggle (only when JS is on, so
   no-JS visitors keep a usable inline nav). When open it becomes a full-width
   stacked panel with generous tap targets. */
@media (max-width: 639px) {
  .js #primary-nav { display: none; flex-basis: 100%; }
  .js #primary-nav.is-open {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0.15rem;
    padding-top: 0.5rem;
    border-top: 1px solid var(--color-border);
  }
  #primary-nav.is-open a,
  #primary-nav.is-open button { padding: 0.85rem 0.6rem; font-size: 1.05rem; }
  #primary-nav.is-open form, #primary-nav.is-open form button { width: 100%; }
}

/* Wide screens: nav is always inline; no hamburger. */
@media (min-width: 640px) {
  .nav-toggle { display: none; }
}

/* ---- Layout ---- */
main {
  max-width: 720px;
  margin: 0 auto;
  padding: var(--space);
  padding-bottom: 3rem;
}

h1 { font-size: 1.6rem; line-height: 1.2; margin: 0.4rem 0 1rem; letter-spacing: -0.01em; }
h2 { font-size: 1.25rem; margin: 1.5rem 0 0.5rem; }

a { color: var(--accent); }
a:hover { color: var(--color-accent-hover); }

hr { border: none; border-top: 1px solid var(--line); margin: 1.25rem 0; }

/* ---- Cards / list items ---- */
article, .occurrence, .member, .anniversary, section {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: var(--space);
  margin-bottom: var(--space);
}
section > h2:first-child { margin-top: 0; }

/* ---- Forms: thumb-sized fields ---- */
label { display: block; font-weight: 600; margin-top: 0.75rem; }
input[type="text"], input[type="email"], input[type="tel"], input[type="date"],
input[type="number"], input:not([type]), textarea, select {
  width: 100%;
  min-height: var(--tap);
  font-size: 1.0625rem;   /* >=16px avoids iOS auto-zoom on focus */
  padding: 0.7rem 0.8rem;
  margin-top: 0.35rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
}
textarea { line-height: 1.5; }
input:focus, textarea:focus, select:focus {
  outline: 3px solid var(--color-focus-ring);
  border-color: var(--accent);
}
.helptext, small { color: var(--ink-soft); font-size: 0.9rem; }

/* ---- Buttons ---- */
button, .btn, input[type="submit"] {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: var(--tap);
  padding: 0.7rem 1.1rem;
  margin-top: 0.75rem;
  font-size: 1.0625rem;
  font-weight: 600;
  color: var(--accent-ink);
  background: var(--accent);
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  text-decoration: none;
}
button:hover, .btn:hover, input[type="submit"]:hover { background: var(--color-accent-hover); }
button:focus, .btn:focus { outline: 3px solid var(--color-focus-ring); outline-offset: 1px; }

/* Call / Text / Email actions rendered as obvious tappable buttons. */
.contact-actions, .chair-contact { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; margin-top: 0.5rem; }
.action-btn {
  display: inline-flex;
  align-items: center;
  min-height: var(--tap);
  padding: 0.55rem 0.9rem;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--accent);
  color: var(--accent);
  font-weight: 600;
  text-decoration: none;
}
.action-btn:hover { background: var(--color-accent-soft); }
.contact-actions .phone, .chair-contact .phone { color: var(--ink-soft); font-size: 0.95rem; }

/* ---- Messages ---- */
.messages { list-style: none; padding: 0; margin: 0 0 var(--space); }
.messages li {
  padding: 0.8rem 1rem;
  border-radius: var(--radius);
  margin-bottom: 0.5rem;
  border: 1px solid var(--line);
  background: var(--surface);
}
.messages li.success { border-color: var(--ok); color: var(--ok); }
.messages li.error { border-color: var(--danger); color: var(--danger); }

/* ---- Login hero (logo + tagline) ---- */
.login-hero { text-align: center; margin: 1.5rem 0 2rem; }
.login-hero .brandmark { width: 64px; height: 64px; margin: 0 auto; color: var(--accent); }
.login-hero .wordmark {
  margin: 0.6rem 0 0;
  font-size: 1.9rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--accent);
}
.login-hero .tagline { margin: 0.35rem 0 0; color: var(--ink-soft); }

/* ---- Home dashboard: white cards, accent used as accent (not full fill) ---- */
.dashboard {
  display: grid;
  grid-template-columns: repeat(2, 1fr);   /* 2 columns on phones */
  gap: 0.75rem;
  margin-top: 1.25rem;
}
@media (min-width: 640px) {
  .dashboard { grid-template-columns: repeat(3, 1fr); gap: 1rem; }
}
.card {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  min-height: 92px;                 /* comfortable tap target */
  padding: 1rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--ink);
  text-decoration: none;
}
.card:hover, .card:focus {
  border-color: var(--accent);
  background: var(--color-accent-soft);
}
.card:focus-visible { outline: 3px solid var(--color-focus-ring); outline-offset: 1px; }
.card__icon { width: 28px; height: 28px; color: var(--accent); }
.card__label { color: var(--accent); font-weight: 700; font-size: 1.1rem; line-height: 1.2; }

.muted { color: var(--ink-soft); }

/* ---- Callout (e.g. the iOS "open in Safari" gotcha) ---- */
.callout {
  background: var(--color-accent-soft);
  border-left: 4px solid var(--color-accent);
  border-radius: var(--radius);
  padding: 0.8rem 1rem;
  margin: 0 0 1rem;
}
.steps { margin: 0; padding-left: 1.25rem; }
.steps li { margin: 0.4rem 0; }

/* ---- Service position labels ---- */
.position-label {
  display: inline-block;
  background: var(--accent);
  color: var(--accent-ink);
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  margin-left: 0.35rem;
  white-space: nowrap;
}
.open { color: var(--ink-soft); font-style: italic; }

/* ---- Misc ---- */
.pinned { border-left: 4px solid var(--accent); }
.meta, .when, .location { color: var(--ink-soft); }
pre {
  background: var(--color-text);
  color: var(--color-bg);
  padding: var(--space);
  border-radius: var(--radius);
  overflow-x: auto;
}
footer {
  max-width: 720px;
  margin: 0 auto;
  padding: var(--space);
  color: var(--ink-soft);
  font-size: 0.95rem;
  text-align: center;
}
