/* ──────────────────────────────────────────────────────────
   catholicparish.net — shared stylesheet
   Marian Blue + Gold, mobile-native, dark-mode aware
   ────────────────────────────────────────────────────────── */

:root {
  --bg: #f4f6fa;
  --surface: #ffffff;
  --surface-alt: #edf0f7;
  --text: #1a2133;
  --text-secondary: #5a6278;
  --text-muted: #8a90a0;
  --line: #dde1ea;
  --brand: #1a4b8c;
  --brand-dark: #0e3366;
  --brand-light: #e8f0fa;
  --brand-glow: rgba(26,75,140,0.12);
  --accent: #c89a3b;
  --accent-light: #fdf6e8;
  --accent-dark: #a87e26;
  --danger: #c0392b;
  --info: #2980b9;
  --radius-sm: 10px;
  --radius: 16px;
  --radius-lg: 22px;
  --shadow-sm: 0 2px 8px rgba(20,33,51,0.06);
  --shadow: 0 4px 20px rgba(20,33,51,0.08);
  --shadow-lg: 0 12px 40px rgba(20,33,51,0.10);
  --bottom-bar-h: 64px;
  --topbar-h: 60px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; }

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

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  padding-bottom: calc(var(--bottom-bar-h) + 8px);
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
button { cursor: pointer; font: inherit; color: inherit; }
input, select, textarea { font: inherit; }
h1, h2, h3, h4 { line-height: 1.25; }

/* ── Skip link ── */
.skip-link {
  position: absolute; top: -48px; left: 0;
  background: var(--brand); color: #fff;
  padding: 10px 18px; z-index: 999;
  font-weight: 700; font-size: 13px;
  transition: top 0.2s; text-decoration: none;
  border-bottom-right-radius: var(--radius-sm);
}
.skip-link:focus { top: 0; }

/* ── Topbar ── */
.topbar {
  position: sticky; top: 0; z-index: 100;
  background: rgba(255,255,255,0.92);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--line);
  padding: 0 16px;
  height: var(--topbar-h);
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px;
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand-mark {
  width: 34px; height: 34px;
  border-radius: 9px;
  background: linear-gradient(135deg, var(--brand) 0%, var(--brand-dark) 100%);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.brand-mark svg { width: 22px; height: 22px; }
.brand-text { font-weight: 800; font-size: 17px; color: var(--text); letter-spacing: -0.01em; }

.topbar-right { display: flex; align-items: center; gap: 6px; }

.nav-desktop { display: none; gap: 4px; }
.nav-desktop a {
  padding: 8px 13px; border-radius: var(--radius-sm);
  font-size: 14px; font-weight: 600; color: var(--text-secondary);
  transition: background 0.15s, color 0.15s;
}
.nav-desktop a:hover, .nav-desktop a.active {
  background: var(--brand-light); color: var(--brand);
}

/* ── Language toggle ── */
.lang-toggle {
  display: inline-flex; align-items: center;
  border: 1px solid var(--line); border-radius: 999px;
  overflow: hidden; background: var(--surface);
}
.lang-toggle button {
  padding: 6px 12px; font-size: 12px; font-weight: 700;
  background: transparent; color: var(--text-muted);
  border: none; transition: background 0.15s, color 0.15s;
}
.lang-toggle button.active { background: var(--brand); color: #fff; }

.hamburger {
  display: flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; border: none;
  background: transparent; border-radius: var(--radius-sm);
}
.hamburger:hover { background: var(--surface-alt); }
.hamburger svg { width: 22px; height: 22px; color: var(--text); }

/* ── Mobile slide-out menu ── */
.mobile-menu-overlay {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(20,33,51,0.45);
  opacity: 0; pointer-events: none;
  transition: opacity 0.25s;
}
.mobile-menu-overlay.open { opacity: 1; pointer-events: auto; }
.mobile-menu {
  position: absolute; top: 0; right: 0; bottom: 0;
  width: min(82vw, 320px);
  background: var(--surface);
  padding: 16px; display: flex; flex-direction: column; gap: 4px;
  transform: translateX(100%);
  transition: transform 0.28s cubic-bezier(.4,0,.2,1);
  box-shadow: var(--shadow-lg);
}
.mobile-menu-overlay.open .mobile-menu { transform: translateX(0); }
.mobile-menu-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 12px;
}
.mobile-menu-close {
  width: 38px; height: 38px; border: none; background: transparent;
  border-radius: var(--radius-sm); display: flex;
  align-items: center; justify-content: center;
}
.mobile-menu-close svg { width: 22px; height: 22px; }
.mobile-menu a {
  display: flex; align-items: center; gap: 12px;
  padding: 13px 14px; border-radius: var(--radius-sm);
  font-weight: 600; color: var(--text-secondary);
}
.mobile-menu a:hover, .mobile-menu a.active {
  background: var(--brand-light); color: var(--brand);
}
.mobile-menu a svg { width: 20px; height: 20px; flex-shrink: 0; }

/* ── Bottom bar (mobile) ── */
.bottom-bar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 90;
  height: var(--bottom-bar-h);
  background: rgba(255,255,255,0.94);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid var(--line);
  display: flex; align-items: stretch;
  padding-bottom: env(safe-area-inset-bottom);
}
.bottom-bar a {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 3px;
  font-size: 11px; font-weight: 600; color: var(--text-muted);
}
.bottom-bar a.active { color: var(--brand); }
.bottom-bar a.active svg { color: var(--brand); }
.bottom-bar svg { width: 22px; height: 22px; }

/* ── Page shell ── */
.page-shell { max-width: 960px; margin: 0 auto; padding: 12px 14px; }

/* ── Utilities ── */
.text-muted { color: var(--text-secondary); }
.text-sm { font-size: 14px; }
.text-xs { font-size: 12px; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ── Hero ── */
.hero { padding: 18px 0 6px; }
.hero--image {
  position: relative; padding: 40px 24px 30px; margin: 4px 0 8px;
  border-radius: 18px; overflow: hidden; isolation: isolate;
  background-image:
    linear-gradient(180deg, rgba(13,33,62,0.34) 0%, rgba(13,33,62,0.66) 100%),
    var(--hero-img, url('/hero/home.webp'));
  background-size: cover; background-position: center 38%;
  box-shadow: 0 12px 32px rgba(13,33,62,0.18);
}
.hero--image .hero-eyebrow { background: rgba(255,255,255,0.92); color: var(--accent-dark); }
.hero--image h1 { color: #fff; text-shadow: 0 2px 18px rgba(0,0,0,0.35); }
.hero--image .lead { color: rgba(255,255,255,0.94); text-shadow: 0 1px 10px rgba(0,0,0,0.32); }
.hero--image .search-box { box-shadow: 0 8px 24px rgba(0,0,0,0.22); }
@media (min-width: 760px) { .hero--image { padding: 64px 40px 44px; background-position: center 42%; } }
.hero-eyebrow {
  display: inline-block; padding: 5px 12px; border-radius: 999px;
  background: var(--accent-light); color: var(--accent-dark);
  font-size: 12px; font-weight: 700; letter-spacing: 0.02em;
  margin-bottom: 12px;
}
.hero h1 {
  font-size: clamp(22px, 5vw, 32px); font-weight: 900;
  letter-spacing: -0.02em; margin-bottom: 10px; color: var(--text);
}
.hero .lead {
  color: var(--text-secondary); font-size: 15px;
  line-height: 1.6; margin-bottom: 16px; max-width: 640px;
}

/* ── Buttons ── */
.btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 11px 18px; border-radius: 999px;
  font-size: 14px; font-weight: 700; border: 1px solid transparent;
  transition: background 0.15s, box-shadow 0.15s, transform 0.05s;
}
.btn:active { transform: scale(0.98); }
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-dark); }
.btn-secondary { background: var(--surface); border-color: var(--line); color: var(--text); }
.btn-secondary:hover { background: var(--surface-alt); }
.btn-accent { background: var(--accent); color: #fff; }
.btn-accent:hover { background: var(--accent-dark); }
.btn-sm { padding: 8px 14px; font-size: 13px; }
.btn-block { display: flex; width: 100%; justify-content: center; }

/* ── Search box ── */
.search-box {
  display: flex; align-items: center; gap: 10px;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 999px; padding: 0 16px; height: 50px;
  box-shadow: var(--shadow-sm);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.search-box:focus-within { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-glow); }
.search-box svg { color: var(--text-muted); flex-shrink: 0; }
.search-box input {
  flex: 1; border: none; outline: none; background: transparent;
  font-size: 16px; color: var(--text); min-width: 0;
}

/* ── Sections ── */
.section { margin-top: 22px; }
.section-head {
  display: flex; align-items: flex-start; gap: 12px; margin-bottom: 14px;
}
.section-icon {
  width: 38px; height: 38px; border-radius: 10px;
  background: var(--brand-light); color: var(--brand);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.section-icon svg { width: 20px; height: 20px; }
.section-title { font-size: 18px; font-weight: 800; margin-bottom: 4px; letter-spacing: -0.01em; }
.section-desc { color: var(--text-secondary); font-size: 14px; }

/* ── Stat strip ── */
.stat-grid {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px;
}
@media (min-width: 640px) { .stat-grid { grid-template-columns: repeat(4, 1fr); } }
.stat {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 16px 14px; text-align: center;
}
.stat .stat-value { font-size: 24px; font-weight: 900; color: var(--brand); line-height: 1.1; }
.stat .stat-label {
  font-size: 12px; color: var(--text-secondary); margin-top: 4px;
  text-transform: uppercase; letter-spacing: 0.03em; font-weight: 600;
}
.stat.emphasis {
  background: linear-gradient(135deg, var(--brand) 0%, var(--brand-dark) 100%);
  border-color: var(--brand-dark);
}
.stat.emphasis .stat-value { color: #fff; }
.stat.emphasis .stat-label { color: rgba(255,255,255,0.78); }
.stat.accent { background: linear-gradient(135deg, var(--accent) 0%, var(--accent-dark) 100%); border-color: var(--accent-dark); }
.stat.accent .stat-value { color: #fff; }
.stat.accent .stat-label { color: rgba(255,255,255,0.85); }

/* ── Category cards ── */
.cat-grid {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px;
}
@media (min-width: 720px) { .cat-grid { grid-template-columns: repeat(4, 1fr); } }
.cat-card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 18px 16px;
  display: flex; flex-direction: column; gap: 8px;
  transition: box-shadow 0.15s, border-color 0.15s, transform 0.1s;
}
.cat-card:hover { box-shadow: var(--shadow); border-color: var(--brand); transform: translateY(-2px); }
.cat-card .cat-icon {
  width: 42px; height: 42px; border-radius: 11px;
  background: var(--brand-light); color: var(--brand);
  display: flex; align-items: center; justify-content: center;
}
.cat-card .cat-icon svg { width: 22px; height: 22px; }
.cat-card h3 { font-size: 15px; font-weight: 800; }
.cat-card p { font-size: 12.5px; color: var(--text-secondary); }
.cat-card .cat-count { font-size: 13px; font-weight: 700; color: var(--accent-dark); margin-top: auto; }

/* ── Map ── */
#home-map {
  width: 100%; height: 340px; border-radius: var(--radius);
  position: relative; z-index: 1; border: 1px solid var(--line);
  background: var(--surface-alt);
}
@media (min-width: 960px) { #home-map { height: 440px; } }
.leaflet-pane { z-index: 2 !important; }
.leaflet-top, .leaflet-bottom { z-index: 5 !important; }
.parish-marker {
  background: var(--brand); border: 2px solid #fff; border-radius: 50%;
  width: 10px; height: 10px; box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}
.user-marker {
  background: var(--info); border: 3px solid #fff; border-radius: 50%;
  width: 14px; height: 14px; box-shadow: 0 0 8px rgba(41,128,185,0.5);
}
.leaflet-popup-content { font-family: 'Inter', system-ui, sans-serif; }
.leaflet-popup-content h3 { font-size: 14px; margin: 0 0 4px; }
.leaflet-popup-content p { font-size: 12px; color: var(--text-secondary); margin: 2px 0; }
.leaflet-popup-content a { color: var(--brand); font-weight: 600; font-size: 12px; }

.map-foot {
  display: flex; justify-content: space-between; align-items: center;
  margin-top: 8px; gap: 8px; flex-wrap: wrap;
}

/* ── Nearest list ── */
.nearest-list { display: flex; flex-direction: column; gap: 10px; margin-top: 12px; }
.nearest-empty { color: var(--text-secondary); font-size: 14px; padding: 8px 0; }

/* ── Browse cards (also used by pre-rendered fragments) ── */
.browse-results, .card-grid {
  display: grid; grid-template-columns: 1fr; gap: 12px;
}
@media (min-width: 560px) { .browse-results, .card-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 900px) { .browse-results, .card-grid { grid-template-columns: repeat(3, 1fr); } }

.browse-card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); overflow: hidden;
  transition: box-shadow 0.15s, border-color 0.15s;
  display: flex; flex-direction: column;
}
.browse-card:hover { box-shadow: var(--shadow); border-color: #c6d0e0; }
.card-content { padding: 14px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.card-header h3 { font-size: 15px; font-weight: 800; margin-bottom: 6px; letter-spacing: -0.01em; }
.card-meta { display: flex; flex-wrap: wrap; gap: 5px; align-items: center; }
.card-body { font-size: 12.5px; color: var(--text-secondary); line-height: 1.5; }

/* ── Pills ── */
.pill {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 4px 10px; border-radius: 999px;
  font-size: 11.5px; font-weight: 600;
  background: var(--surface-alt); color: var(--text-secondary);
  border: 1px solid transparent; white-space: nowrap;
}
.pill-brand { background: var(--brand-light); color: var(--brand); }
.pill-accent { background: var(--accent-light); color: var(--accent-dark); }
a.pill:hover { filter: brightness(0.96); }
.pill-dist { background: var(--accent); color: #fff; font-weight: 700; }

/* ── City rows (browse fragment) ── */
.city-row { margin-bottom: 26px; }
.city-row-header {
  display: flex; align-items: baseline; gap: 8px; margin-bottom: 12px;
  border-bottom: 2px solid var(--line); padding-bottom: 6px;
}
.city-row-header h3 { font-size: 17px; font-weight: 800; }
.city-row-scroll {
  display: grid; grid-template-columns: 1fr; gap: 12px;
}
@media (min-width: 560px) { .city-row-scroll { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 900px) { .city-row-scroll { grid-template-columns: repeat(3, 1fr); } }

/* ── Generic list card (congregations/schools/orgs) ── */
.list-card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 14px 16px;
  display: flex; flex-direction: column; gap: 6px;
  transition: box-shadow 0.15s, border-color 0.15s;
}
.list-card:hover { box-shadow: var(--shadow-sm); border-color: #c6d0e0; }
.list-card h3 { font-size: 14.5px; font-weight: 700; }

.count-line { font-size: 13px; color: var(--text-secondary); margin: 8px 0 16px; }

.empty-state {
  text-align: center; padding: 40px 16px; color: var(--text-secondary);
}

/* ── Prose (about page) ── */
.prose { max-width: 720px; }
.prose h2 { font-size: 19px; font-weight: 800; margin: 28px 0 10px; }
.prose h3 { font-size: 16px; font-weight: 700; margin: 20px 0 8px; }
.prose p { color: var(--text-secondary); margin-bottom: 12px; font-size: 15px; }
.prose ul { margin: 0 0 14px 20px; color: var(--text-secondary); font-size: 15px; }
.prose li { margin-bottom: 6px; }
.prose a { color: var(--brand); font-weight: 600; }
.prose a:hover { text-decoration: underline; }
.card-panel {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 20px; margin-top: 16px;
}

/* ── Footer ── */
.site-footer {
  background: var(--brand-dark); color: rgba(255,255,255,0.78);
  margin-top: 40px; padding: 32px 14px calc(var(--bottom-bar-h) + 24px);
}
.footer-inner { max-width: 960px; margin: 0 auto; }
.footer-grid {
  display: grid; grid-template-columns: 1fr; gap: 24px;
}
@media (min-width: 640px) { .footer-grid { grid-template-columns: 1.6fr 1fr 1fr; } }
.footer-brand p { font-size: 13px; margin-top: 8px; line-height: 1.6; max-width: 320px; }
.footer-col h4 { color: #fff; font-size: 13px; font-weight: 700; margin-bottom: 12px; text-transform: uppercase; letter-spacing: 0.04em; }
.footer-col a { display: block; font-size: 14px; padding: 4px 0; color: rgba(255,255,255,0.78); }
.footer-col a:hover { color: #fff; }
.footer-bottom {
  margin-top: 24px; padding-top: 16px;
  border-top: 1px solid rgba(255,255,255,0.15);
  font-size: 12.5px;
}
.footer-bottom a { color: var(--accent); }

/* ── Desktop layout switches ── */
@media (min-width: 840px) {
  .nav-desktop { display: flex; }
  .hamburger { display: none; }
  .bottom-bar { display: none; }
  body { padding-bottom: 0; }
  .site-footer { padding-bottom: 32px; }
}

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

/* ── Dark mode ── */
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1420;
    --surface: #171e2e;
    --surface-alt: #1f2738;
    --text: #e8ecf4;
    --text-secondary: #a0a8bc;
    --text-muted: #6f7892;
    --line: #2a3245;
    --brand: #5b8fd6;
    --brand-dark: #3a6db0;
    --brand-light: #1c2c44;
    --brand-glow: rgba(91,143,214,0.18);
    --accent: #d9b65c;
    --accent-light: #2b2415;
    --accent-dark: #e0c06a;
    --shadow-sm: 0 2px 8px rgba(0,0,0,0.3);
    --shadow: 0 4px 20px rgba(0,0,0,0.4);
    --shadow-lg: 0 12px 40px rgba(0,0,0,0.5);
  }
  .topbar { background: rgba(23,30,46,0.92); }
  .bottom-bar { background: rgba(23,30,46,0.94); }
  .lang-toggle button.active { color: #0f1420; }
  .site-footer { background: #0a0e18; }
  #home-map { background: var(--surface-alt); }
}

/* ── Pagination ── */
.pagination { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin: 28px 0 8px; }
.pg {
  min-width: 38px; padding: 8px 12px; border-radius: 9px; text-align: center;
  font-size: 14px; font-weight: 700; border: 1px solid var(--border, #e2e6ea);
  color: var(--brand, #1a4b8c); background: var(--surface, #fff);
}
.pg:hover { background: var(--accent-light, #f3ede0); }
.pg-cur { background: var(--brand, #1a4b8c); color: #fff; border-color: var(--brand, #1a4b8c); }
.pg-gap { border: none; background: none; color: var(--text-secondary, #6b7280); pointer-events: none; }
@media (prefers-color-scheme: dark) {
  .pg { background: #1b2430; border-color: #2c3a4a; color: #cfe0f5; }
  .pg-cur { background: #2f6bbf; color: #fff; }
}
