/* ============================================
   God's Grace Church — Design System
   Clean · Modern · Accessible
   ============================================ */

:root {
  /* Brand — matched to godsgracesf.com logo (teal + charcoal) */
  --navy: #2c3338;
  --navy-soft: #3d464d;
  --gold: #007a8f;
  --gold-hover: #006272;
  --gold-bright: #00a8c4;
  --cream: #f4f7f8;
  --warm-white: #fafcfc;
  --slate: #5a6570;
  --slate-light: #8a959e;
  --border: #e0e6e9;
  --card: #ffffff;
  --shadow: 0 4px 24px rgba(44, 51, 56, 0.08);
  --shadow-lg: 0 12px 40px rgba(44, 51, 56, 0.12);

  /* Semantic */
  --bg: var(--warm-white);
  --bg-elevated: var(--cream);
  --text: var(--navy);
  --text-muted: var(--slate);
  --accent: var(--gold);
  --sidebar-bg: #1e2529;
  --sidebar-text: rgba(255, 255, 255, 0.85);
  --sidebar-text-active: #ffffff;
  --sidebar-hover: rgba(255, 255, 255, 0.08);
  --sidebar-active: rgba(0, 168, 196, 0.22);
  --input-bg: #ffffff;
  --input-border: var(--border);
  --overlay: rgba(30, 37, 41, 0.5);

  /* Layout */
  --sidebar-width: 280px;
  --sidebar-collapsed: 72px;
  --header-height: 64px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --tabbar-height: 0px;
  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 20px;
  --transition: 0.22s ease;
  --font-display: "Cormorant Garamond", Georgia, serif;
  --font-body: "DM Sans", system-ui, sans-serif;
  --max-content: 1100px;
}

[data-theme="dark"] {
  --navy: #e8eef0;
  --navy-soft: #c5d0d4;
  --gold: #3ec9dc;
  --gold-hover: #5dd4e5;
  --gold-bright: #2ec4dc;
  --cream: #1a2226;
  --warm-white: #12171a;
  --slate: #9aa8b0;
  --slate-light: #6b7880;
  --border: #2a343a;
  --card: #1a2226;
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.45);

  --bg: var(--warm-white);
  --bg-elevated: var(--cream);
  --text: var(--navy);
  --text-muted: var(--slate);
  --accent: var(--gold);
  --sidebar-bg: #0d1114;
  --sidebar-text: rgba(232, 238, 240, 0.75);
  --sidebar-text-active: #ffffff;
  --sidebar-hover: rgba(255, 255, 255, 0.06);
  --sidebar-active: rgba(46, 196, 220, 0.18);
  --input-bg: #1a2226;
  --input-border: #2a343a;
  --overlay: rgba(0, 0, 0, 0.65);
}

/* Reset & base */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  height: 100%;
}

body {
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  min-height: 100%;
  min-height: 100dvh;
  overflow-x: hidden;
  -webkit-tap-highlight-color: color-mix(in srgb, var(--gold) 22%, transparent);
}

body.nav-open {
  overflow: hidden;
  position: fixed;
  width: 100%;
  left: 0;
  right: 0;
}

img {
  max-width: 100%;
  display: block;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
textarea,
select {
  font: inherit;
  color: inherit;
}

ul {
  list-style: none;
}

/* ========== App shell ========== */
.app {
  display: flex;
  min-height: 100%;
  min-height: 100dvh;
}

/* ========== Sidebar ========== */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 1000;
  width: var(--sidebar-width);
  height: auto;
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  display: flex;
  flex-direction: column;
  transition: transform var(--transition), width var(--transition);
  overflow: hidden;
  padding-left: var(--safe-left);
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: calc(24px + var(--safe-top)) 12px 20px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  flex-shrink: 0;
}

.brand-mark {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
  padding: 4px;
}

.brand-mark img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.brand-logo-full {
  max-width: 280px;
  width: 100%;
  height: auto;
  margin: 0 auto 24px;
  display: block;
}

.brand-logo-inline {
  height: 56px;
  width: auto;
  object-fit: contain;
}

.brand-text {
  min-width: 0;
}

.brand-text h1,
.brand-text .brand-name {
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 600;
  color: #fff;
  line-height: 1.2;
  letter-spacing: 0.01em;
  margin: 0;
}

.brand-text span {
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.55);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 16px 12px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.15) transparent;
}

.nav-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(255, 255, 255, 0.4);
  padding: 12px 12px 8px;
  font-weight: 600;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  color: var(--sidebar-text);
  font-size: 0.95rem;
  font-weight: 600;
  transition: background var(--transition), color var(--transition);
  margin-bottom: 2px;
  min-height: 44px;
  touch-action: manipulation;
}

.nav-link:hover {
  background: var(--sidebar-hover);
  color: var(--sidebar-text-active);
}

.nav-link.active {
  background: var(--sidebar-active);
  color: var(--gold-bright);
}

.nav-link svg {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  opacity: 0.9;
}

.sidebar-footer {
  padding: 16px 16px calc(16px + var(--safe-bottom));
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  flex-shrink: 0;
}

.sidebar-close {
  display: none;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  margin-left: auto;
  flex-shrink: 0;
  border: none;
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  border-radius: var(--radius-sm);
  cursor: pointer;
  touch-action: manipulation;
}

.sidebar-close:hover,
.sidebar-close:focus-visible {
  background: rgba(255, 255, 255, 0.16);
  outline: none;
}

.sidebar-close svg {
  width: 20px;
  height: 20px;
}

.sidebar-cta {
  display: block;
  text-align: center;
  background: var(--gold);
  color: #ffffff;
  font-weight: 600;
  font-size: 0.9rem;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  transition: background var(--transition), transform 0.15s ease;
}

.sidebar-cta:hover {
  background: var(--gold-hover);
  transform: translateY(-1px);
}

/* ========== Main area ========== */
.main {
  flex: 1;
  margin-left: var(--sidebar-width);
  min-width: 0;
  display: flex;
  flex-direction: column;
  min-height: 100%;
  min-height: 100dvh;
  padding-bottom: var(--tabbar-height);
  transition: margin-left var(--transition);
}

/* Top bar — extra height is the iOS status bar / Dynamic Island */
.topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  height: calc(var(--header-height) + var(--safe-top));
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: var(--safe-top) max(24px, var(--safe-right)) 0 max(24px, var(--safe-left));
}

.menu-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border: none;
  background: transparent;
  border-radius: var(--radius-sm);
  cursor: pointer;
  color: var(--text);
  flex-shrink: 0;
  touch-action: manipulation;
}

.menu-toggle:hover {
  background: var(--bg-elevated);
}

.menu-toggle svg {
  width: 22px;
  height: 22px;
}

/* Search */
.search-wrap {
  flex: 0 0 44px;
  width: 44px;
  max-width: 44px;
  position: relative;
  z-index: 2;
  transition: flex-basis 0.22s ease, width 0.22s ease, max-width 0.22s ease;
}

.search-wrap:focus-within,
.search-wrap.is-open {
  flex: 1 1 220px;
  width: auto;
  max-width: 320px;
}

.search-wrap svg {
  position: absolute;
  left: 13px;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  color: var(--text-muted);
  pointer-events: none;
}

.search-input {
  width: 100%;
  height: 44px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: var(--card);
  color: var(--text);
  outline: none;
  cursor: pointer;
  transition: border-color var(--transition), box-shadow var(--transition),
    border-radius var(--transition), padding var(--transition),
    background var(--transition);
}

.search-wrap:focus-within .search-input,
.search-wrap.is-open .search-input {
  padding: 0 16px 0 42px;
  border-radius: 999px;
  background: var(--input-bg);
  border-color: var(--input-border);
  cursor: text;
}

.search-input::placeholder {
  color: transparent;
}

.search-wrap:focus-within .search-input::placeholder,
.search-wrap.is-open .search-input::placeholder {
  color: var(--slate-light);
}

.search-wrap:not(:focus-within):not(.is-open) .search-input:hover {
  background: var(--bg-elevated);
  border-color: var(--gold);
}

.search-input:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(0, 168, 196, 0.2);
}

.search-results {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  left: auto;
  width: min(360px, 80vw);
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  max-height: 320px;
  overflow-y: auto;
  z-index: 200;
}

.search-wrap:focus-within .search-results,
.search-wrap.is-open .search-results {
  left: 0;
  width: auto;
}

.search-results.open {
  display: block;
}

.search-result-item {
  display: block;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  transition: background var(--transition);
}

.search-result-item:last-child {
  border-bottom: none;
}

.search-result-item:hover,
.search-result-item:focus {
  background: var(--bg-elevated);
  outline: none;
}

.search-result-item strong {
  display: block;
  font-size: 0.9rem;
  margin-bottom: 2px;
}

.search-result-item span {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.search-empty {
  padding: 20px 16px;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.search-result-item mark {
  background: color-mix(in srgb, var(--gold) 35%, transparent);
  color: inherit;
  border-radius: 2px;
  padding: 0 2px;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.icon-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border: 1px solid var(--border);
  background: var(--card);
  border-radius: 50%;
  cursor: pointer;
  color: var(--text);
  transition: background var(--transition), border-color var(--transition);
  touch-action: manipulation;
}

.icon-btn:hover {
  background: var(--bg-elevated);
  border-color: var(--gold);
}

.icon-btn svg {
  width: 18px;
  height: 18px;
}

.theme-toggle .icon-sun {
  display: none;
}

[data-theme="dark"] .theme-toggle .icon-moon {
  display: none;
}

[data-theme="dark"] .theme-toggle .icon-sun {
  display: block;
}

/* Sunday times / address / phone — lives in the sticky header */
.visit-strip {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: flex-start;
  gap: 0 8px;
  margin: 0;
  padding: 0 8px 0 4px;
  background: transparent;
  border: none;
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--text);
  line-height: 1.3;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  mask-image: linear-gradient(to right, #000 88%, transparent);
}

.visit-strip::-webkit-scrollbar {
  display: none;
}

.topbar:has(.search-wrap:focus-within) .visit-strip,
.topbar:has(.search-wrap.is-open) .visit-strip {
  flex: 0 1 0;
  min-width: 0;
  max-width: 0;
  opacity: 0;
  overflow: hidden;
  padding: 0;
  pointer-events: none;
}

.topbar:has(.search-wrap:focus-within) .search-wrap,
.topbar:has(.search-wrap.is-open) .search-wrap {
  flex: 1 1 auto;
  max-width: 420px;
}

.visit-strip-item {
  white-space: nowrap;
  flex-shrink: 0;
}

.visit-strip a {
  color: var(--gold);
}

.visit-strip a:hover {
  text-decoration: underline;
}

.visit-strip-sep {
  color: var(--slate-light);
  font-weight: 400;
  user-select: none;
  flex-shrink: 0;
}

.first-sunday {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: clamp(24px, 4vw, 36px);
  box-shadow: var(--shadow);
}

.first-sunday h2 {
  font-family: var(--font-display);
  font-size: clamp(1.6rem, 3vw, 2rem);
  font-weight: 600;
  margin-bottom: 12px;
}

.first-sunday p {
  color: var(--text-muted);
  margin-bottom: 12px;
  max-width: 640px;
}

.first-sunday a:not(.btn) {
  color: var(--gold);
  font-weight: 600;
}

.first-sunday a:not(.btn):hover {
  text-decoration: underline;
}

.first-sunday .map-links {
  margin-top: 8px;
}

/* ========== Content ========== */
.content {
  flex: 1;
  padding: 32px 40px 64px;
  max-width: calc(var(--max-content) + 80px);
  width: 100%;
}

/* Page header */
.page-header {
  margin-bottom: 36px;
}

.page-header .eyebrow {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 8px;
}

.page-header h1 {
  font-family: var(--font-display);
  font-size: clamp(2rem, 4vw, 2.75rem);
  font-weight: 600;
  line-height: 1.15;
  color: var(--text);
  margin-bottom: 12px;
}

.page-header p {
  font-size: 1.1rem;
  color: var(--text-muted);
  max-width: 560px;
}

/* Hero */
.hero {
  position: relative;
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: #1e2529;
  color: #fff;
  padding: clamp(40px, 6vw, 72px);
  margin-bottom: 40px;
  box-shadow: var(--shadow-lg);
  min-height: 380px;
  display: flex;
  align-items: center;
}

[data-theme="dark"] .hero {
  border: 1px solid var(--border);
}

.hero-bg {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  opacity: 0.45;
}

/* Responsive hero: WebP preferred, JPEG fallback */
.hero-bg--worship {
  background-image: url("../images/worship-1280w.jpg");
  background-image: -webkit-image-set(
    url("../images/worship-640w.webp") 1x,
    url("../images/worship-1280w.webp") 2x
  );
  background-image: image-set(
    url("../images/worship-640w.webp") type("image/webp") 1x,
    url("../images/worship-1280w.webp") type("image/webp") 2x,
    url("../images/worship-640w.jpg") type("image/jpeg") 1x,
    url("../images/worship-1280w.jpg") type("image/jpeg") 2x
  );
}

.card-media--m01 {
  background-image: url("../images/ministries/ministry-01-480w.jpg");
  background-image: image-set(
    url("../images/ministries/ministry-01-480w.webp") type("image/webp"),
    url("../images/ministries/ministry-01-480w.jpg") type("image/jpeg")
  );
  background-size: cover;
  background-position: center;
}

.card-media--m03 {
  background-image: url("../images/ministries/ministry-03-480w.jpg");
  background-image: image-set(
    url("../images/ministries/ministry-03-480w.webp") type("image/webp"),
    url("../images/ministries/ministry-03-480w.jpg") type("image/jpeg")
  );
  background-size: cover;
  background-position: center;
}

.card-media--m04 {
  background-image: url("../images/ministries/ministry-04-480w.jpg");
  background-image: image-set(
    url("../images/ministries/ministry-04-480w.webp") type("image/webp"),
    url("../images/ministries/ministry-04-480w.jpg") type("image/jpeg")
  );
  background-size: cover;
  background-position: center;
}

.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(105deg, rgba(30, 37, 41, 0.92) 0%, rgba(30, 37, 41, 0.75) 48%, rgba(0, 168, 196, 0.35) 100%);
  pointer-events: none;
  z-index: 0;
}

.hero-inner {
  position: relative;
  z-index: 1;
  max-width: 560px;
}

.hero .eyebrow {
  color: var(--gold);
}

.hero h1 {
  font-family: var(--font-display);
  font-size: clamp(2.25rem, 5vw, 3.25rem);
  font-weight: 600;
  line-height: 1.15;
  margin-bottom: 16px;
  color: #fff;
}

.hero p {
  font-size: 1.1rem;
  color: rgba(255, 255, 255, 0.78);
  margin-bottom: 28px;
  line-height: 1.65;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 22px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.95rem;
  border: 2px solid transparent;
  cursor: pointer;
  transition: background var(--transition), color var(--transition),
    border-color var(--transition), transform 0.15s ease;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn-primary {
  background: var(--gold);
  color: #ffffff;
}

.btn-primary:hover {
  background: var(--gold-hover);
}

.btn-secondary {
  background: transparent;
  color: #fff;
  border-color: rgba(255, 255, 255, 0.35);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.55);
}

.btn-outline {
  background: transparent;
  color: var(--text);
  border-color: var(--border);
}

.btn-outline:hover {
  border-color: var(--gold);
  color: var(--gold);
}

.btn-gold-outline {
  background: transparent;
  color: var(--gold);
  border-color: var(--gold);
}

.btn-gold-outline:hover {
  background: var(--gold);
  color: #ffffff;
}

/* Service times bar */
.service-bar {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 48px;
}

.service-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
  transition: transform var(--transition), box-shadow var(--transition);
}

.service-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.service-card .icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: color-mix(in srgb, var(--gold) 18%, transparent);
  color: var(--gold);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 14px;
}

.service-card .icon svg {
  width: 20px;
  height: 20px;
}

.service-card h3 {
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 600;
  margin-bottom: 4px;
}

.service-card .time {
  font-weight: 600;
  color: var(--gold);
  font-size: 0.95rem;
  margin-bottom: 6px;
}

.service-card p {
  font-size: 0.9rem;
  color: var(--text-muted);
}

/* Sections */
.section {
  margin-bottom: 48px;
}

.section-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.section-header h2 {
  font-family: var(--font-display);
  font-size: clamp(1.6rem, 3vw, 2rem);
  font-weight: 600;
}

.section-header a {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--gold);
}

.section-header a:hover {
  text-decoration: underline;
}

/* Cards grid */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: transform var(--transition), box-shadow var(--transition);
}

.card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
}

.card-media {
  height: 180px;
  background: linear-gradient(135deg, var(--navy-soft), #00a8c4);
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(255, 255, 255, 0.4);
  font-family: var(--font-display);
  font-size: 2.5rem;
  background-size: cover;
  background-position: center;
}

.card-media.photo {
  background-color: #2c3338;
}

[data-theme="dark"] .card-media {
  background-color: #1a2226;
}

.card-body {
  padding: 20px;
}

.card-meta {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--gold);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 6px;
}

.card-body h3 {
  font-family: var(--font-display);
  font-size: 1.3rem;
  font-weight: 600;
  margin-bottom: 8px;
  line-height: 1.3;
}

.card-body p {
  font-size: 0.95rem;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.card-link {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--gold);
}

.card-link:hover {
  text-decoration: underline;
}

/* Welcome / about blurb */
.split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 40px;
  align-items: center;
}

.split-visual {
  aspect-ratio: 4/3;
  border-radius: var(--radius-lg);
  background:
    linear-gradient(160deg, rgba(0, 168, 196, 0.2), transparent),
    linear-gradient(135deg, #1e2529, #00a8c4);
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(255, 255, 255, 0.85);
  font-family: var(--font-display);
  font-size: 1.5rem;
  text-align: center;
  padding: 24px;
  box-shadow: var(--shadow-lg);
  background-size: cover;
  background-position: center;
  overflow: hidden;
  position: relative;
}

.split-visual.photo {
  padding: 0;
  color: transparent;
}

.split-visual.photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.split-visual.logo-panel {
  background: #fff;
  padding: 40px;
}

.split-visual.logo-panel img {
  max-width: 85%;
  max-height: 85%;
  object-fit: contain;
}

[data-theme="dark"] .split-visual {
  border: 1px solid var(--border);
}

[data-theme="dark"] .split-visual.logo-panel {
  background: #1a2226;
}

.split-content h2 {
  font-family: var(--font-display);
  font-size: clamp(1.6rem, 3vw, 2rem);
  font-weight: 600;
  margin-bottom: 14px;
}

.split-content p {
  color: var(--text-muted);
  margin-bottom: 14px;
}

.split-content .btn {
  margin-top: 8px;
}

/* Stats */
.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin: 40px 0;
}

.stat {
  text-align: center;
  padding: 24px 16px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.stat-value {
  font-family: var(--font-display);
  font-size: 2.25rem;
  font-weight: 600;
  color: var(--gold);
  line-height: 1.1;
}

.stat-label {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 4px;
}

/* CTA banner */
.cta-banner {
  background: linear-gradient(135deg, #1e2529, #006d80);
  color: #fff;
  border-radius: var(--radius-lg);
  padding: clamp(32px, 5vw, 48px);
  text-align: center;
  box-shadow: var(--shadow-lg);
}

[data-theme="dark"] .cta-banner {
  background: linear-gradient(135deg, #0d1114, #004d5c);
  border: 1px solid var(--border);
}

.scripture {
  font-family: var(--font-display);
  font-size: clamp(1.15rem, 2.2vw, 1.45rem);
  font-style: italic;
  line-height: 1.55;
  color: var(--text);
  max-width: 720px;
  margin: 0 auto 12px;
  text-align: center;
}

.scripture-ref {
  text-align: center;
  font-weight: 600;
  color: var(--gold);
  font-size: 0.95rem;
  margin-bottom: 0;
}

.social-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: center;
  margin-top: 8px;
}

.map-links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 4px;
}

.map-links .btn {
  flex: 1 1 auto;
  min-width: min(100%, 180px);
  text-align: center;
}

.map-embed {
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  aspect-ratio: 21/9;
  min-height: 220px;
}

/* YouTube live / stream player */
.stream-player {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-lg);
}

.stream-frame {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #0d1114;
}

.stream-frame iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
  background: #0d1114;
  color-scheme: dark;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.stream-frame iframe.is-ready {
  opacity: 1;
  pointer-events: auto;
}

/* YouTube click-to-load facade — no iframe JS/CSS until the user plays */
.yt-facade {
  color: #fff;
}

.yt-facade-btn {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  cursor: pointer;
  background: #0d1114;
  color: inherit;
  font: inherit;
  text-align: center;
}

.yt-facade-btn:focus-visible {
  outline: 3px solid var(--gold, #c9a227);
  outline-offset: -3px;
}

.yt-facade-poster {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
}

.yt-facade-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  background: linear-gradient(
    180deg,
    rgba(13, 17, 20, 0.15) 0%,
    rgba(13, 17, 20, 0.55) 100%
  );
  transition: background 0.2s ease;
}

.yt-facade-btn:hover .yt-facade-overlay,
.yt-facade-btn:focus-visible .yt-facade-overlay {
  background: linear-gradient(
    180deg,
    rgba(13, 17, 20, 0.25) 0%,
    rgba(13, 17, 20, 0.65) 100%
  );
}

.yt-facade-play {
  display: grid;
  place-items: center;
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: rgba(255, 0, 0, 0.92);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.45);
  transition: transform 0.2s ease, background 0.2s ease;
}

.yt-facade-btn:hover .yt-facade-play,
.yt-facade-btn:focus-visible .yt-facade-play {
  transform: scale(1.06);
  background: #ff0000;
}

.yt-facade-label {
  font-size: 0.92rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.65);
  padding: 0 16px;
}

.yt-facade.is-active:has(iframe.is-ready) .yt-facade-btn {
  display: none;
}

@media (prefers-reduced-motion: reduce) {
  .yt-facade-overlay,
  .yt-facade-play,
  .stream-frame iframe,
  .sermon-thumb img {
    transition: none;
  }

  .stream-frame iframe,
  .sermon-thumb img {
    opacity: 1;
  }

  .stream-frame iframe {
    pointer-events: auto;
  }

  .sermon-card.is-skeleton {
    animation: none;
  }
}

.stream-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px 24px;
  padding: 20px 22px 22px;
}

.stream-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  flex-shrink: 0;
}

@media (max-width: 640px) {
  .stream-actions {
    width: 100%;
  }

  .stream-actions .btn {
    flex: 1 1 auto;
    text-align: center;
  }
}

/* Past sermons grid (YouTube) */
.past-sermons-status {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin: -8px 0 18px;
}

.past-sermons-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 18px;
  min-height: 280px;
}

.sermon-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  transition: transform var(--transition), box-shadow var(--transition),
    border-color var(--transition);
}

.sermon-card.is-skeleton {
  min-height: 248px;
  pointer-events: none;
  box-shadow: none;
  background: linear-gradient(
    90deg,
    var(--card) 0%,
    var(--bg-elevated) 50%,
    var(--card) 100%
  );
  background-size: 200% 100%;
  animation: sermon-shimmer 1.4s ease-in-out infinite;
}

@keyframes sermon-shimmer {
  0% {
    background-position: 100% 0;
  }
  100% {
    background-position: -100% 0;
  }
}

.sermon-card:hover,
.sermon-card.is-active {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
  border-color: color-mix(in srgb, var(--gold) 55%, var(--border));
}

.sermon-card-btn {
  display: block;
  width: 100%;
  border: none;
  background: transparent;
  padding: 0;
  text-align: left;
  cursor: pointer;
  color: inherit;
  font: inherit;
}

.sermon-thumb {
  position: relative;
  display: block;
  aspect-ratio: 16 / 9;
  background: #1e2529;
  overflow: hidden;
}

.sermon-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.sermon-thumb img.is-loaded {
  opacity: 1;
}

.sermon-play-icon {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(13, 17, 20, 0.28);
  color: #fff;
  opacity: 0.92;
  transition: background var(--transition), opacity var(--transition);
}

.sermon-play-icon svg {
  filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.45));
}

.sermon-card-btn:hover .sermon-play-icon,
.sermon-card.is-active .sermon-play-icon {
  background: rgba(0, 168, 196, 0.45);
  opacity: 1;
}

.sermon-card-body {
  display: block;
  padding: 14px 14px 8px;
}

.sermon-date {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 6px;
}

.sermon-title {
  display: block;
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 600;
  line-height: 1.3;
  color: var(--text);
}

.sermon-yt-link {
  margin: 0 14px 14px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--gold);
}

.sermon-yt-link:hover {
  text-decoration: underline;
}

.past-sermon-player {
  margin-bottom: 28px;
}

.past-sermon-player[hidden] {
  display: none !important;
}

.playlist-embed {
  margin-top: 28px;
}

.playlist-embed .stream-frame {
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
}

.map-embed iframe {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
  min-height: 220px;
}

.cta-banner h2 {
  font-family: var(--font-display);
  font-size: clamp(1.6rem, 3vw, 2.1rem);
  font-weight: 600;
  margin-bottom: 10px;
  color: #fff;
}

.cta-banner p {
  color: rgba(255, 255, 255, 0.75);
  margin-bottom: 24px;
  max-width: 480px;
  margin-left: auto;
  margin-right: auto;
}

/* Forms */
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.form-group {
  margin-bottom: 16px;
}

.form-group.full {
  grid-column: 1 / -1;
}

.form-group label {
  display: block;
  font-size: 0.875rem;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--text);
}

.form-group input,
.form-group textarea,
.form-group select {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--input-border);
  border-radius: var(--radius-sm);
  background: var(--input-bg);
  color: var(--text);
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.form-group textarea {
  min-height: 120px;
  resize: vertical;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(0, 168, 196, 0.2);
}

.form-group input.is-invalid,
.form-group textarea.is-invalid {
  border-color: #c44;
  box-shadow: 0 0 0 3px rgba(204, 68, 68, 0.15);
}

/* Hidden honeypot for bots */
.hp-field {
  position: absolute !important;
  left: -10000px !important;
  width: 1px !important;
  height: 1px !important;
  overflow: hidden !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

.human-check {
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
}

.human-check > label {
  display: block;
  margin-bottom: 10px;
}

.human-check-question {
  display: block;
  margin-top: 4px;
  margin-left: 0;
  font-weight: 700;
  color: var(--gold);
  font-size: 1rem;
}

.human-check-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: stretch;
  width: 100%;
}

/* Keep the answer field from stretching over the New problem button */
.human-check-row input[data-human-answer],
.form-group.human-check .human-check-row input {
  width: 100%;
  min-width: 0;
  max-width: none;
  position: relative;
  z-index: 0;
}

.human-check-refresh {
  width: auto;
  min-width: max-content;
  padding: 10px 14px;
  font-size: 0.875rem;
  white-space: nowrap;
  position: relative;
  z-index: 2;
  pointer-events: auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.human-check-error {
  margin-top: 8px;
  margin-bottom: 0;
  font-size: 0.875rem;
  color: #c44;
  font-weight: 600;
}

[data-theme="dark"] .human-check-error {
  color: #f08080;
}

@media (max-width: 420px) {
  .human-check-row {
    grid-template-columns: 1fr;
  }

  .human-check-refresh {
    width: 100%;
  }
}

.form-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  box-shadow: var(--shadow);
}

/* Contact layout */
.contact-grid {
  display: grid;
  grid-template-columns: 1fr 1.2fr;
  gap: 32px;
  align-items: start;
}

.info-list {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.info-item {
  display: flex;
  gap: 14px;
}

.info-item .icon {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  background: color-mix(in srgb, var(--gold) 18%, transparent);
  color: var(--gold);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.info-item .icon svg {
  width: 20px;
  height: 20px;
}

.info-item h3 {
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 2px;
}

.info-item p {
  font-size: 0.9rem;
  color: var(--text-muted);
}

.info-item a {
  color: var(--gold);
  font-weight: 600;
}

.info-item a:hover {
  text-decoration: underline;
}

/* Sermon list */
.sermon-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.sermon-item {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 18px 20px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  transition: transform var(--transition), box-shadow var(--transition);
}

.sermon-item:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.sermon-date {
  text-align: center;
  min-width: 56px;
  flex-shrink: 0;
}

.sermon-date .day {
  font-family: var(--font-display);
  font-size: 1.75rem;
  font-weight: 600;
  line-height: 1;
  color: var(--gold);
}

.sermon-date .month {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  font-weight: 600;
}

.sermon-info {
  flex: 1;
  min-width: 0;
}

.sermon-info h3 {
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 600;
  margin-bottom: 4px;
}

.sermon-info p {
  font-size: 0.875rem;
  color: var(--text-muted);
}

.sermon-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

/* Give page */
.give-options {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  margin-bottom: 40px;
}

.give-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px 24px;
  text-align: center;
  box-shadow: var(--shadow);
  transition: transform var(--transition), border-color var(--transition);
}

.give-card:hover {
  transform: translateY(-3px);
  border-color: var(--gold);
}

.give-card .amount {
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 600;
  color: var(--gold);
  margin: 8px 0;
}

.give-card h3 {
  font-size: 1.1rem;
  margin-bottom: 8px;
}

.give-card p {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-bottom: 16px;
}

/* Team / values */
.values-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}

.value-card {
  padding: 28px 24px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.value-card .num {
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 600;
  color: var(--gold);
  opacity: 0.7;
  margin-bottom: 8px;
}

.value-card h3 {
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 600;
  margin-bottom: 8px;
}

.value-card p {
  font-size: 0.95rem;
  color: var(--text-muted);
}

/* Event detail row */
.coming-soon-card {
  text-align: center;
  background: var(--card);
  border: 1px dashed color-mix(in srgb, var(--gold) 45%, var(--border));
  border-radius: var(--radius-lg);
  padding: clamp(32px, 5vw, 48px) 28px;
  box-shadow: var(--shadow);
}

.coming-soon-badge {
  display: inline-block;
  margin-bottom: 16px;
  padding: 5px 12px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--gold) 16%, transparent);
  color: var(--gold);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.coming-soon-icon {
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  margin: 0 auto 16px;
  border-radius: 16px;
  background: var(--bg-elevated);
  color: var(--gold);
}

.coming-soon-icon svg {
  width: 30px;
  height: 30px;
}

.coming-soon-card h2 {
  font-family: var(--font-display);
  font-size: clamp(1.5rem, 3vw, 1.9rem);
  font-weight: 600;
  margin: 0 0 10px;
}

.coming-soon-card p {
  margin: 0 auto;
  max-width: 420px;
  color: var(--text-muted);
}

.event-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.event-row {
  display: grid;
  grid-template-columns: 100px 1fr auto;
  gap: 24px;
  align-items: center;
  padding: 20px 24px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.event-date-block {
  text-align: center;
  padding: 10px;
  background: var(--bg-elevated);
  border-radius: var(--radius-sm);
}

.event-date-block .day {
  font-family: var(--font-display);
  font-size: 1.75rem;
  font-weight: 600;
  color: var(--gold);
  line-height: 1;
}

.event-date-block .month {
  font-size: 0.75rem;
  text-transform: uppercase;
  font-weight: 600;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.event-row h3 {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 4px;
}

.event-row p {
  font-size: 0.9rem;
  color: var(--text-muted);
}

/* Footer in content */
.site-footer {
  margin-top: auto;
  padding: 24px 40px 32px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 12px;
  font-size: 0.875rem;
  color: var(--text-muted);
}

/* Toast */
.toast {
  position: fixed;
  bottom: max(24px, var(--safe-bottom));
  right: max(24px, var(--safe-right));
  z-index: 2000;
  background: var(--navy);
  color: #fff;
  padding: 14px 20px;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  font-size: 0.9rem;
  font-weight: 600;
  transform: translateY(100px);
  opacity: 0;
  transition: transform 0.3s ease, opacity 0.3s ease;
  max-width: 360px;
}

[data-theme="dark"] .toast {
  background: var(--gold);
  color: #0d1114;
}

.toast.show {
  transform: translateY(0);
  opacity: 1;
}

/* Overlay for mobile sidebar */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: var(--overlay);
  z-index: 999;
  opacity: 0;
  transition: opacity var(--transition);
}

.sidebar-overlay.visible {
  display: block;
  opacity: 1;
}

/* ========== Responsive ========== */
@media (max-width: 1024px) {
  .service-bar {
    grid-template-columns: 1fr;
  }

  .stats {
    grid-template-columns: repeat(2, 1fr);
  }

  .give-options,
  .values-grid {
    grid-template-columns: 1fr !important;
  }

  .split {
    grid-template-columns: 1fr;
  }

  .contact-grid {
    grid-template-columns: 1fr;
  }

  .event-row {
    grid-template-columns: 80px 1fr;
  }

  .event-row .btn {
    grid-column: 2;
    justify-self: start;
  }
}

@media (max-width: 900px) {
  .sidebar {
    transform: translateX(-100%);
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .main {
    margin-left: 0;
  }

  .menu-toggle {
    display: flex;
  }

  .sidebar-close {
    display: flex;
  }

  .content {
    padding: 24px max(20px, var(--safe-right)) max(48px, var(--safe-bottom))
      max(20px, var(--safe-left));
  }

  .site-footer {
    padding: 20px max(20px, var(--safe-right)) 20px max(20px, var(--safe-left));
  }

  .sermon-item {
    flex-wrap: wrap;
  }

  .sermon-actions {
    width: 100%;
    padding-left: 76px;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 480px) {
  .hero-actions {
    flex-direction: column;
  }

  .hero-actions .btn {
    width: 100%;
  }

  .topbar {
    padding: var(--safe-top) max(12px, var(--safe-right)) 0
      max(12px, var(--safe-left));
    gap: 8px;
  }

  .stats {
    grid-template-columns: 1fr 1fr;
  }
}

/* Utility */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.text-muted {
  color: var(--text-muted);
}

.mt-2 {
  margin-top: 8px;
}

.mb-0 {
  margin-bottom: 0;
}

/* ========== PWA install UI ========== */
.pwa-install-btn {
  display: none;
}

.pwa-install-btn.visible {
  display: flex;
  border-color: var(--gold);
  color: var(--gold);
}

.pwa-install-banner {
  position: fixed;
  left: 16px;
  right: 16px;
  bottom: 16px;
  z-index: 2100;
  max-width: 560px;
  margin: 0 auto;
  transform: translateY(120%);
  opacity: 0;
  transition: transform 0.35s ease, opacity 0.35s ease;
  pointer-events: none;
}

.pwa-install-banner.visible {
  transform: translateY(0);
  opacity: 1;
  pointer-events: auto;
}

.pwa-install-banner-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px;
  padding: 16px 18px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
}

.pwa-install-icon {
  border-radius: 12px;
  flex-shrink: 0;
}

.pwa-install-copy {
  flex: 1;
  min-width: 180px;
}

.pwa-install-copy strong {
  display: block;
  font-size: 1rem;
  margin-bottom: 2px;
}

.pwa-install-copy span {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.4;
}

.pwa-install-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

.pwa-install-actions .btn {
  padding: 10px 16px;
  font-size: 0.875rem;
}

.pwa-install-modal {
  position: fixed;
  inset: 0;
  z-index: 2200;
  display: none;
  align-items: center;
  justify-content: center;
  padding: max(20px, var(--safe-top)) max(20px, var(--safe-right))
    max(20px, var(--safe-bottom)) max(20px, var(--safe-left));
}

.pwa-install-modal.visible {
  display: flex;
}

.pwa-install-modal-backdrop {
  position: absolute;
  inset: 0;
  background: var(--overlay);
}

.pwa-install-modal-card {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 400px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px 24px 24px;
  box-shadow: var(--shadow-lg);
  text-align: center;
}

.pwa-install-modal-card img {
  border-radius: 16px;
  margin: 0 auto 14px;
}

.pwa-install-modal-card h2 {
  font-family: var(--font-display);
  font-size: 1.45rem;
  margin-bottom: 10px;
}

.pwa-install-modal-card > p {
  font-size: 0.95rem;
  color: var(--text-muted);
  margin-bottom: 16px;
}

.pwa-ios-steps {
  text-align: left;
  margin: 0 0 16px;
  padding-left: 1.25rem;
  color: var(--text);
  font-size: 0.95rem;
  line-height: 1.55;
}

.pwa-ios-steps li {
  margin-bottom: 10px;
}

.pwa-ios-share {
  display: inline-flex;
  vertical-align: middle;
  color: var(--gold);
  margin: 0 2px;
}

.pwa-modal-note {
  font-size: 0.85rem !important;
  margin-bottom: 18px !important;
}

.pwa-modal-close {
  position: absolute;
  top: 10px;
  right: 12px;
  border: none;
  background: transparent;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  color: var(--text-muted);
  padding: 4px 8px;
}

.pwa-modal-close:hover {
  color: var(--text);
}

/* Standalone (installed) tweaks */
.pwa-standalone .pwa-install-banner,
.pwa-standalone .pwa-install-btn,
.pwa-standalone .pwa-install-modal {
  display: none !important;
}

@media (max-width: 540px) {
  .pwa-install-banner-inner {
    flex-direction: column;
    text-align: center;
  }

  .pwa-install-actions {
    width: 100%;
  }

  .pwa-install-actions .btn {
    flex: 1;
  }

  .main {
    /* leave room for install banner on mobile */
    padding-bottom: 0;
  }
}

/* Safe area for notched phones when installed */
@supports (padding: env(safe-area-inset-bottom)) {
  .pwa-standalone .site-footer {
    padding-bottom: calc(24px + var(--safe-bottom));
  }

  .pwa-install-banner {
    bottom: calc(16px + var(--safe-bottom));
  }
}

/* ========== iPhone / standalone web app ========== */
/* ?app=1 on a desktop browser previews iPhone insets */
html.pwa-preview {
  --safe-top: 59px;
  --safe-bottom: 34px;
}

.pwa-standalone,
.pwa-standalone body {
  overscroll-behavior: none;
}

.pwa-standalone .topbar {
  /* Opaque so scrolling content does not show through the status bar */
  background: var(--bg);
}

.ios-tabbar {
  display: none;
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 900;
  height: var(--tabbar-height);
  padding: 4px var(--safe-right) var(--safe-bottom) var(--safe-left);
  background: var(--sidebar-bg);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  justify-content: space-around;
  align-items: stretch;
  -webkit-user-select: none;
  user-select: none;
}

.ios-tabbar-link {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  min-width: 0;
  min-height: 44px;
  padding: 4px 2px 2px;
  color: rgba(255, 255, 255, 0.58);
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  background: none;
  border: none;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.ios-tabbar-link svg {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
}

.ios-tabbar-link span {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ios-tabbar-link.active {
  color: var(--gold);
}

.ios-tabbar-link:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: -4px;
  border-radius: 8px;
}

@media (max-width: 900px) {
  .pwa-standalone {
    --tabbar-height: calc(52px + var(--safe-bottom));
  }

  .pwa-standalone .ios-tabbar {
    display: flex;
  }

  /* Pin chrome so iOS bounce cannot hide the menu under the status bar */
  .pwa-standalone .topbar {
    position: fixed;
    left: 0;
    right: 0;
    width: 100%;
    background: var(--sidebar-bg);
    border-bottom-color: rgba(255, 255, 255, 0.08);
    color: #fff;
  }

  .pwa-standalone .main {
    padding-top: calc(var(--header-height) + var(--safe-top));
  }

  .pwa-standalone .menu-toggle {
    color: #fff;
  }

  .pwa-standalone .menu-toggle:hover {
    background: rgba(255, 255, 255, 0.08);
  }

  .pwa-standalone .icon-btn {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.12);
    color: #fff;
  }

  .pwa-standalone .icon-btn:hover {
    background: rgba(255, 255, 255, 0.14);
    border-color: rgba(255, 255, 255, 0.22);
  }

  .pwa-standalone .search-input {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.12);
    color: #fff;
  }

  .pwa-standalone .search-wrap:focus-within .search-input,
  .pwa-standalone .search-wrap.is-open .search-input {
    background: rgba(255, 255, 255, 0.1);
    border-color: transparent;
  }

  .pwa-standalone .search-input::placeholder {
    color: transparent;
  }

  .pwa-standalone .search-wrap:focus-within .search-input::placeholder,
  .pwa-standalone .search-wrap.is-open .search-input::placeholder {
    color: rgba(255, 255, 255, 0.45);
  }

  .pwa-standalone .search-wrap > svg {
    color: rgba(255, 255, 255, 0.5);
  }

  .pwa-standalone .visit-strip {
    color: rgba(255, 255, 255, 0.88);
  }

  .pwa-standalone .visit-strip a {
    color: var(--gold);
  }

  .pwa-standalone .visit-strip-sep {
    color: rgba(255, 255, 255, 0.35);
  }

  .pwa-standalone .toast {
    bottom: calc(16px + var(--tabbar-height));
  }

  .pwa-standalone .site-footer {
    padding-bottom: 24px;
  }
}

/* ========== Photo gallery carousel ========== */
.gallery {
  position: relative;
  margin-bottom: 40px;
  outline: none;
}

.gallery-top {
  margin-top: 0;
  margin-bottom: 32px;
}

.gallery-stage {
  position: relative;
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: #1e2529;
  box-shadow: var(--shadow-lg);
  aspect-ratio: 16 / 9;
  min-height: 280px;
  perspective: 1200px;
  touch-action: pan-y;
  user-select: none;
}

.gallery-top .gallery-stage {
  aspect-ratio: 21 / 9;
  min-height: 320px;
  max-height: 520px;
}

[data-theme="dark"] .gallery-stage {
  border: 1px solid var(--border);
}

.gallery-track {
  position: absolute;
  inset: 0;
  transform-style: preserve-3d;
}

.gallery-slide {
  position: absolute;
  inset: 0;
  opacity: 0;
  transform: scale(0.92) rotateY(18deg) translateZ(-40px);
  transition:
    opacity 0.55s ease,
    transform 0.65s cubic-bezier(0.22, 1, 0.36, 1);
  pointer-events: none;
  z-index: 0;
}

.gallery-slide.is-active {
  opacity: 1;
  transform: scale(1) rotateY(0deg) translateZ(0);
  pointer-events: auto;
  z-index: 2;
}

.gallery-slide.is-prev {
  opacity: 0;
  transform: scale(0.92) rotateY(-18deg) translateZ(-40px);
  z-index: 1;
}

.gallery-slide.is-next {
  opacity: 0;
  transform: scale(0.92) rotateY(18deg) translateZ(-40px);
  z-index: 1;
}

.gallery-slide picture {
  display: block;
  width: 100%;
  height: 100%;
}

.gallery-slide img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
}

/* Show the full photo (less crop) — used for the BBQ / outdoor shots */
.gallery-slide--contain {
  background: #1e2529;
}

.gallery-slide--contain img {
  object-fit: contain;
}

.gallery-nav {
  position: absolute;
  top: 50%;
  z-index: 5;
  transform: translateY(-50%);
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.35);
  background: rgba(30, 37, 41, 0.55);
  backdrop-filter: blur(8px);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition), border-color var(--transition),
    transform 0.15s ease;
}

.gallery-nav:hover {
  background: rgba(0, 168, 196, 0.85);
  border-color: transparent;
  transform: translateY(-50%) scale(1.05);
}

.gallery-nav:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}

.gallery-nav svg {
  width: 20px;
  height: 20px;
}

.gallery-nav.prev {
  left: 12px;
}

.gallery-nav.next {
  right: 12px;
}

.gallery-dots {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-top: 14px;
  flex-wrap: wrap;
}

.gallery-dot {
  width: 9px;
  height: 9px;
  border-radius: 999px;
  border: none;
  padding: 0;
  background: var(--border);
  cursor: pointer;
  transition: width 0.25s ease, background 0.25s ease;
}

.gallery-dot:hover {
  background: var(--slate-light);
}

.gallery-dot.is-active {
  width: 26px;
  background: var(--gold);
}

.gallery-dot:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}

@media (max-width: 640px) {
  .visit-strip {
    font-size: 0.75rem;
    gap: 0 6px;
    padding-right: 4px;
  }

  .gallery-stage,
  .gallery-top .gallery-stage {
    aspect-ratio: 4 / 3;
    min-height: 220px;
    max-height: none;
  }

  .gallery-nav {
    width: 38px;
    height: 38px;
  }

  .gallery-nav.prev {
    left: 8px;
  }

  .gallery-nav.next {
    right: 8px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .gallery-slide {
    transition: opacity 0.2s ease;
    transform: none !important;
  }

  .search-wrap,
  .search-input,
  .visit-strip {
    transition: none;
  }
}

/* ========== Staff / who you'll meet ========== */
.staff-lead {
  color: var(--text-muted);
  margin: -8px 0 24px;
  max-width: 640px;
}

.staff-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 20px;
}

.staff-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.staff-card[hidden] {
  display: none !important;
}

.staff-card-photo {
  aspect-ratio: 3 / 4;
  background: #2c3338;
  overflow: hidden;
}

[data-theme="dark"] .staff-card-photo {
  background: #1a2226;
}

.staff-card-photo picture {
  display: block;
  width: 100%;
  height: 100%;
}

.staff-card-photo img {
  width: 100%;
  height: 100%;
}

.staff-card-photo img {
  object-fit: cover;
  object-position: center 18%;
}

.staff-card-body {
  padding: 20px;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.staff-card-body h3 {
  font-family: var(--font-display);
  font-size: 1.3rem;
  font-weight: 600;
  margin-bottom: 8px;
  line-height: 1.3;
}

.staff-role {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin: -4px 0 8px;
}

.staff-bio {
  color: var(--text-muted);
  font-size: 0.95rem;
  line-height: 1.6;
  min-height: 6.5em;
  margin: 0;
}

.staff-bio:empty {
  visibility: hidden;
}

.staff-coming-soon {
  margin-top: 28px;
}

@media (max-width: 1024px) {
  .staff-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 560px) {
  .staff-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}


/* ========== Demo homepage (demo.html only) ========== */
.demo-banner {
  margin: 0;
  padding: 8px 20px;
  font-size: 0.8rem;
  line-height: 1.45;
  text-align: center;
  color: var(--text-muted);
  background: color-mix(in srgb, var(--gold) 10%, var(--bg-elevated));
  border-bottom: 1px solid var(--border);
}

.demo-banner a {
  color: var(--gold);
  font-weight: 600;
  margin-left: 0.35em;
}

.demo-banner a:hover {
  text-decoration: underline;
}

.demo-home .content {
  padding-top: 16px;
}

.demo-home #plan-visit,
.demo-home #latest-message {
  scroll-margin-top: calc(var(--header-height) + var(--safe-top) + 16px);
}

.landing-hero {
  min-height: clamp(420px, 78vh, 820px);
  min-height: calc(100dvh - var(--header-height) - var(--safe-top) - 72px);
  align-items: flex-end;
  padding: clamp(36px, 6vw, 72px);
  margin-bottom: 48px;
}

.landing-hero .hero-bg {
  opacity: 0.78;
}

.landing-hero::before {
  background:
    linear-gradient(
      105deg,
      rgba(18, 23, 26, 0.88) 0%,
      rgba(18, 23, 26, 0.58) 46%,
      rgba(0, 122, 143, 0.28) 100%
    );
}

.landing-hero .hero-inner {
  max-width: 640px;
}

.landing-hero .eyebrow {
  color: #7ad7e6;
}

.landing-hero h1 {
  font-size: clamp(2.4rem, 6vw, 3.6rem);
  text-shadow: 0 2px 18px rgba(0, 0, 0, 0.35);
}

.landing-hero .landing-hero-lead {
  margin-bottom: 14px;
  max-width: 34em;
}

.landing-hero .landing-hero-times {
  font-size: clamp(0.95rem, 2.2vw, 1.08rem);
  font-weight: 600;
  color: #fff;
  letter-spacing: 0.01em;
  margin-bottom: 28px;
  text-shadow: 0 1px 10px rgba(0, 0, 0, 0.5);
}

.demo-welcome .eyebrow {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 8px;
}

.demo-welcome h2 {
  font-family: var(--font-display);
  font-size: clamp(1.8rem, 3.4vw, 2.4rem);
  font-weight: 600;
  margin-bottom: 14px;
}

.demo-welcome p {
  color: var(--text-muted);
  max-width: 640px;
  margin-bottom: 12px;
  font-size: 1.05rem;
}

.demo-inline-link {
  display: inline-block;
  margin-top: 8px;
  font-weight: 600;
  color: var(--gold);
}

.demo-inline-link:hover {
  text-decoration: underline;
}

.demo-sermon-feature {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
  gap: 0;
  align-items: stretch;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow);
}

.demo-sermon-thumb {
  display: block;
  background: #1e2529;
  min-height: 100%;
}

.demo-sermon-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  aspect-ratio: 16 / 9;
}

.demo-sermon-body {
  padding: clamp(20px, 3vw, 32px);
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.demo-sermon-body h3 {
  font-family: var(--font-display);
  font-size: clamp(1.35rem, 2.4vw, 1.75rem);
  font-weight: 600;
  line-height: 1.3;
  margin-bottom: 8px;
}

.demo-sermon-date {
  color: var(--text-muted);
  margin-bottom: 20px;
}

@media (max-width: 800px) {
  .demo-sermon-feature {
    grid-template-columns: 1fr;
  }

  .landing-hero {
    min-height: clamp(380px, 72vh, 640px);
    align-items: flex-end;
  }
}

@media (max-width: 480px) {
  .landing-hero-times {
    font-size: 0.92rem;
  }

  .landing-hero .hero-actions .btn {
    width: 100%;
  }
}
