church-module {
  display: block;
  width: 100%;
  min-width: 0;
  container: church-module / inline-size;
}
church-module[hidden] { display: none !important; }

church-module,
church-module * { box-sizing: border-box; }

.cm-root {
  --cm-canvas: #f3ebdc;
  --cm-surface: #fffdf7;
  --cm-surface-2: #e7dac5;
  --cm-ink: #211b17;
  --cm-muted: #66594c;
  --cm-brand: #542338;
  --cm-deep: #17383a;
  --cm-accent: #c79c55;
  --cm-line: #b8a78d;
  --cm-focus: #2a78bd;
  --cm-display: Georgia, "Times New Roman", serif;
  --cm-body: "Segoe UI Variable Text", "Segoe UI", Arial, sans-serif;
  --cm-control-radius: 2px;
  --cm-card-radius: 2px;
  --cm-shadow: none;
  --cm-gutter: clamp(20px, 4vw, 48px);
  color: var(--cm-ink);
  background: var(--cm-canvas);
  font-family: var(--cm-body);
  font-size: 18px;
  line-height: 1.6;
  overflow-wrap: anywhere;
}

.cm-root[data-cm-theme="warm-fellowship"] {
  --cm-canvas: #fbf6ed;
  --cm-surface: #fffdf9;
  --cm-surface-2: #f0e2d5;
  --cm-ink: #302824;
  --cm-muted: #6c5950;
  --cm-brand: #165d62;
  --cm-deep: #0d4549;
  --cm-accent: #bd4a38;
  --cm-line: #d8c8ba;
  --cm-focus: #175fbd;
  --cm-display: "Aptos Display", "Segoe UI Variable Display", "Trebuchet MS", sans-serif;
  --cm-control-radius: 18px;
  --cm-card-radius: 26px;
  --cm-shadow: 0 18px 50px rgba(78, 51, 38, .11);
}

.cm-root[data-cm-theme="bold-mission"] {
  --cm-canvas: #eef0ea;
  --cm-surface: #fbfcf7;
  --cm-surface-2: #dfe3da;
  --cm-ink: #10140e;
  --cm-muted: #52604e;
  --cm-brand: #11150f;
  --cm-deep: #090c08;
  --cm-accent: #f1d62e;
  --cm-line: #10140e;
  --cm-focus: #3469ff;
  --cm-display: Bahnschrift, "Arial Narrow", Impact, sans-serif;
  --cm-control-radius: 0;
  --cm-card-radius: 0;
  --cm-shadow: 8px 8px 0 #10140e;
}

.cm-root a { color: var(--cm-brand); text-decoration-thickness: .1em; text-underline-offset: .18em; }
.cm-root img { display: block; max-width: 100%; }
.cm-root button,
.cm-root input,
.cm-root select { font: inherit; }
.cm-root button,
.cm-root a { touch-action: manipulation; }
.cm-root [hidden] { display: none !important; }

.cm-stage { padding: clamp(54px, 8vw, 100px) var(--cm-gutter); }
.cm-shell { width: min(1240px, 100%); margin-inline: auto; }

.cm-heading {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 500px);
  align-items: end;
  gap: clamp(20px, 5vw, 72px);
  margin-bottom: clamp(32px, 5vw, 58px);
}

.cm-eyebrow {
  margin: 0 0 10px;
  color: var(--cm-brand);
  font-size: 12px;
  font-weight: 850;
  letter-spacing: .18em;
  text-transform: uppercase;
}

church-module .cm-root .cm-title {
  max-width: 850px;
  margin: 0;
  font-family: var(--cm-display) !important;
  font-size: clamp(38px, 5vw, 64px);
  font-size: clamp(38px, 5cqi, 64px) !important;
  font-weight: 750 !important;
  line-height: 1.02 !important;
  letter-spacing: -.025em !important;
}

.cm-intro { max-width: 620px; margin: 0; color: var(--cm-muted); font-size: clamp(17px, 1.5vw, 21px); line-height: 1.55; }

.cm-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 14px;
  margin-bottom: 24px;
  padding: 18px;
  border: 1px solid var(--cm-line);
  border-radius: var(--cm-control-radius);
  background: var(--cm-surface);
}

.cm-field { display: grid; flex: 1 1 220px; gap: 6px; min-width: 0; color: var(--cm-muted); font-size: 13px; font-weight: 780; }
.cm-field--compact { flex: 0 1 240px; }
.cm-toggle {
  display: flex;
  min-height: 48px;
  flex: 0 1 210px;
  align-items: center;
  gap: 11px;
  padding: 8px 12px;
  border: 1px solid var(--cm-line);
  border-radius: calc(var(--cm-control-radius) * .72);
  background: var(--cm-canvas);
  color: var(--cm-ink);
  cursor: pointer;
}
.cm-toggle input { width: 21px; height: 21px; flex: 0 0 auto; accent-color: var(--cm-brand); }
.cm-toggle span { display: grid; line-height: 1.2; }
.cm-toggle strong { font-size: 13px; }
.cm-toggle small { margin-top: 3px; color: var(--cm-muted); font-size: 11px; font-weight: 650; }
.cm-input,
.cm-select {
  width: 100%;
  min-height: 48px;
  padding: 10px 13px;
  border: 1px solid var(--cm-line);
  border-radius: calc(var(--cm-control-radius) * .72);
  background: var(--cm-canvas);
  color: var(--cm-ink);
}

.cm-input:focus-visible,
.cm-select:focus-visible,
.cm-toggle input:focus-visible,
.cm-action:focus-visible,
.cm-icon-button:focus-visible,
.cm-card a:focus-visible,
.cm-root summary:focus-visible {
  outline: 3px solid var(--cm-focus);
  outline-offset: 4px;
}

.cm-results-summary { margin: 0 0 18px; color: var(--cm-muted); font-size: 15px; font-weight: 750; }
.cm-queue-summary { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px 20px; margin-bottom: 18px; }
.cm-queue-summary .cm-results-summary { margin: 0; }
.cm-queue-note { max-width: 680px; margin: 0; color: var(--cm-muted); font-size: 13px; }
.cm-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: clamp(18px, 2.5vw, 30px); }
.cm-grid--two { grid-template-columns: repeat(2, minmax(0, 1fr)); }

.cm-card {
  position: relative;
  display: flex;
  min-width: 0;
  min-height: 100%;
  flex-direction: column;
  border: 1px solid var(--cm-line);
  border-radius: var(--cm-card-radius);
  background: var(--cm-surface);
  box-shadow: var(--cm-shadow);
  overflow: hidden;
}

.cm-card-media { aspect-ratio: 16 / 9; background: var(--cm-surface-2); overflow: hidden; }
.cm-card-media img { width: 100%; height: 100%; object-fit: cover; }
.cm-card-body { display: flex; flex: 1; min-width: 0; flex-direction: column; padding: clamp(20px, 2.4vw, 30px); }
.cm-card-kicker { margin: 0 0 8px; color: var(--cm-brand); font-size: 12px; font-weight: 850; letter-spacing: .12em; text-transform: uppercase; }
church-module .cm-root .cm-card-title { margin: 0 0 10px; font-family: var(--cm-display) !important; font-size: clamp(24px, 2.2vw, 31px); font-size: clamp(24px, 2.2cqi, 31px) !important; font-weight: 750 !important; line-height: 1.13 !important; letter-spacing: normal !important; }
.cm-card-copy { margin: 0 0 18px; color: var(--cm-muted); }
.cm-meta { display: flex; flex-wrap: wrap; gap: 7px 14px; margin: 0 0 18px; padding: 0; color: var(--cm-muted); font-size: 14px; list-style: none; }
.cm-meta li { display: inline-flex; align-items: center; gap: 6px; }
.cm-tags { display: flex; flex-wrap: wrap; gap: 7px; margin: 0 0 18px; padding: 0; list-style: none; }
.cm-tag,
.cm-status {
  display: inline-flex;
  min-height: 28px;
  align-items: center;
  padding: 3px 9px;
  border: 1px solid var(--cm-line);
  border-radius: 999px;
  background: var(--cm-surface-2);
  color: var(--cm-ink);
  font-size: 12px;
  font-weight: 800;
  line-height: 1.25;
}

.cm-status[data-status="open"], .cm-status[data-status="live"] { border-color: #167449; background: #e5f6ec; color: #0c5c38; }
.cm-status[data-status="limited"], .cm-status[data-status="external"] { border-color: #9a6612; background: #fff3d5; color: #684300; }
.cm-status[data-status="closed"], .cm-status[data-status="full"], .cm-status[data-status="unavailable"] { border-color: #a22d39; background: #fde9eb; color: #7c1722; }
.cm-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: auto; }

.cm-action {
  display: inline-flex;
  min-height: 48px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 17px;
  border: 2px solid var(--cm-brand);
  border-radius: var(--cm-control-radius);
  background: var(--cm-brand);
  color: #fff !important;
  font-size: 14px;
  font-weight: 820;
  line-height: 1.2;
  text-decoration: none !important;
  cursor: pointer;
}

.cm-action--secondary { background: transparent; color: var(--cm-brand) !important; }
.cm-action--quiet { min-height: 44px; padding-inline: 5px; border-color: transparent; background: transparent; color: var(--cm-brand) !important; text-decoration: underline !important; }
.cm-action[disabled] { opacity: .58; cursor: not-allowed; }
.cm-external-mark { font-size: .9em; }

.cm-audio { width: 100%; min-height: 46px; margin: 4px 0 20px; color-scheme: light; }
.cm-video-slot { width: 100%; margin: 2px 0 20px; aspect-ratio: 16 / 9; background: #000; overflow: hidden; }
.cm-video-frame,
.cm-video-player { display: block; width: 100%; height: 100%; border: 0; background: #000; }
.cm-details { margin-top: 16px; border-top: 1px solid var(--cm-line); padding-top: 14px; }
.cm-details summary { min-height: 44px; cursor: pointer; font-weight: 800; }
.cm-details p { margin: 10px 0 0; color: var(--cm-muted); }

.cm-event-date {
  display: grid;
  width: 76px;
  height: 76px;
  flex: 0 0 auto;
  place-content: center;
  border: 1px solid var(--cm-line);
  border-radius: calc(var(--cm-card-radius) * .58);
  background: var(--cm-surface-2);
  text-align: center;
}
.cm-event-date span { display: block; font-size: 12px; font-weight: 850; letter-spacing: .1em; text-transform: uppercase; }
.cm-event-date strong { display: block; font-family: var(--cm-display); font-size: 31px; line-height: 1; }
.cm-event-head { display: flex; align-items: start; gap: 18px; margin-bottom: 18px; }
.cm-event-head > div:last-child { min-width: 0; }

.cm-live {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(250px, .65fr);
  gap: clamp(24px, 5vw, 70px);
  align-items: center;
  min-height: 420px;
  padding: clamp(28px, 6vw, 72px);
  border-radius: var(--cm-card-radius);
  background: var(--cm-deep);
  color: #fff;
  overflow: hidden;
}
.cm-live::after { position: absolute; right: -80px; bottom: -160px; width: 360px; height: 360px; border: 1px solid rgba(255,255,255,.24); border-radius: 50%; content: ""; }
.cm-live-content { position: relative; z-index: 1; }
.cm-live .cm-card-kicker { color: var(--cm-accent); }
church-module .cm-root .cm-live h3 { margin: 0 0 16px; font-family: var(--cm-display) !important; font-size: clamp(36px, 5vw, 67px); font-size: clamp(36px, 5cqi, 67px) !important; font-weight: 750 !important; line-height: 1 !important; letter-spacing: normal !important; }
.cm-live p { max-width: 700px; color: rgba(255,255,255,.78); }
.cm-live .cm-action { border-color: var(--cm-accent); background: var(--cm-accent); color: #111 !important; }
.cm-live .cm-action--secondary { background: transparent; color: #fff !important; }
.cm-live-status { position: relative; z-index: 1; padding: 22px; border: 1px solid rgba(255,255,255,.28); background: rgba(255,255,255,.08); }
.cm-live-status strong { display: block; margin-bottom: 4px; font-family: var(--cm-display); font-size: 28px; }
.cm-live-status span { color: rgba(255,255,255,.72); }
.cm-live[data-state="live"] { background: #6e1726; }
.cm-live[data-state="unavailable"] { background: #343933; }

.cm-provider { display: grid; grid-template-columns: 1fr auto; align-items: start; gap: 22px; padding: 25px; }
.cm-provider .cm-card-body { padding: 0; }
.cm-provider-badge { padding: 7px 10px; border: 1px solid var(--cm-line); background: var(--cm-surface-2); font-size: 12px; font-weight: 820; text-transform: uppercase; }
.cm-privacy { margin: 16px 0 0; padding-top: 14px; border-top: 1px solid var(--cm-line); color: var(--cm-muted); font-size: 13px; }

.cm-search-results { display: grid; gap: 12px; }
.cm-search-result { display: grid; grid-template-columns: 120px minmax(0, 1fr) auto; align-items: center; gap: 18px; padding: 18px 20px; border: 1px solid var(--cm-line); background: var(--cm-surface); }
.cm-search-result-type { color: var(--cm-brand); font-size: 12px; font-weight: 850; letter-spacing: .1em; text-transform: uppercase; }
church-module .cm-root .cm-search-result h3 { margin: 0 0 2px; font-family: var(--cm-display) !important; font-size: 22px !important; font-weight: 750 !important; line-height: 1.2 !important; letter-spacing: normal !important; }
.cm-search-result p { margin: 0; color: var(--cm-muted); font-size: 15px; }

.cm-empty,
.cm-error,
.cm-loading {
  min-height: 220px;
  padding: clamp(28px, 5vw, 58px);
  border: 1px solid var(--cm-line);
  border-radius: var(--cm-card-radius);
  background: var(--cm-surface);
}
church-module .cm-root .cm-empty h3,
church-module .cm-root .cm-error h3 { margin: 0 0 8px; font-family: var(--cm-display) !important; font-size: 28px !important; font-weight: 750 !important; line-height: 1.2 !important; letter-spacing: normal !important; }
.cm-empty p, .cm-error p { max-width: 700px; margin: 0; color: var(--cm-muted); }
.cm-loading { display: grid; align-content: center; gap: 14px; }
.cm-loading-bar { height: 15px; border-radius: 99px; background: linear-gradient(90deg, var(--cm-surface-2), var(--cm-canvas), var(--cm-surface-2)); background-size: 200% 100%; animation: cm-shimmer 1.5s infinite linear; }
.cm-loading-bar:nth-child(1) { width: 36%; height: 26px; }
.cm-loading-bar:nth-child(2) { width: 72%; }
.cm-loading-bar:nth-child(3) { width: 58%; }

.cm-root[data-cm-theme="heritage-editorial"] .cm-card { border-top: 4px solid var(--cm-brand); }
.cm-root[data-cm-theme="heritage-editorial"] .cm-heading { border-bottom: 1px solid var(--cm-line); padding-bottom: 26px; }
.cm-root[data-cm-theme="warm-fellowship"] .cm-card-media { margin: 12px 12px 0; border-radius: 18px; }
.cm-root[data-cm-theme="warm-fellowship"] .cm-action { border-radius: 999px; }
.cm-root[data-cm-theme="bold-mission"] .cm-title,
.cm-root[data-cm-theme="bold-mission"] .cm-card-title,
.cm-root[data-cm-theme="bold-mission"] .cm-live h3 { text-transform: uppercase; }
.cm-root[data-cm-theme="bold-mission"] .cm-card { border-width: 2px; }
.cm-root[data-cm-theme="bold-mission"] .cm-eyebrow,
.cm-root[data-cm-theme="bold-mission"] .cm-card-kicker { display: inline-block; width: fit-content; padding: 4px 7px; background: var(--cm-accent); color: #10140e; }
.cm-root[data-cm-theme="bold-mission"] .cm-action { border-color: var(--cm-ink); background: var(--cm-ink); }
.cm-root[data-cm-theme="bold-mission"] .cm-action--secondary { background: var(--cm-accent); color: #10140e !important; }
.cm-root[data-cm-theme="bold-mission"] .cm-action--quiet { border-color: transparent; background: transparent; color: var(--cm-ink) !important; }

/* Livestream actions sit on each theme's darkest surface. Keep their small label
   and primary action at AA contrast even when the general action token changes. */
.cm-root[data-cm-theme="warm-fellowship"] .cm-live .cm-card-kicker { color: #fff; }
.cm-root[data-cm-theme="warm-fellowship"] .cm-live .cm-action:not(.cm-action--secondary) {
  border-color: var(--cm-surface);
  background: var(--cm-surface);
  color: var(--cm-deep) !important;
}
.cm-root[data-cm-theme="bold-mission"] .cm-live .cm-action:not(.cm-action--secondary) {
  border-color: var(--cm-accent);
  background: var(--cm-accent);
  color: var(--cm-deep) !important;
}

.cm-visually-hidden { position: absolute !important; width: 1px !important; height: 1px !important; padding: 0 !important; margin: -1px !important; overflow: hidden !important; clip: rect(0, 0, 0, 0) !important; white-space: nowrap !important; border: 0 !important; }

@keyframes cm-shimmer { to { background-position: -200% 0; } }

@media (max-width: 900px) {
  .cm-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cm-heading { grid-template-columns: 1fr; align-items: start; }
  .cm-live { grid-template-columns: 1fr; min-height: 0; }
  .cm-search-result { grid-template-columns: 100px minmax(0, 1fr); }
  .cm-search-result .cm-action { grid-column: 2; justify-self: start; }
}

@media (max-width: 620px) {
  .cm-root { font-size: 16px; }
  .cm-stage { padding-block: 46px; }
  .cm-grid, .cm-grid--two { grid-template-columns: 1fr; }
  .cm-tools { padding: 14px; }
  .cm-field, .cm-field--compact, .cm-toggle { flex-basis: 100%; }
  .cm-card-body { padding: 20px; }
  .cm-actions { align-items: stretch; flex-direction: column; }
  .cm-action { width: 100%; }
  .cm-action--quiet { width: fit-content; }
  .cm-event-head { align-items: center; }
  .cm-live { padding: 26px 20px; }
  .cm-provider { grid-template-columns: 1fr; }
  .cm-provider-badge { justify-self: start; }
  .cm-search-result { grid-template-columns: 1fr; }
  .cm-search-result .cm-action { grid-column: auto; }
}

/* Duda and other builders can place the module in a narrow column on an otherwise
   wide page. Container queries make the component respond to its actual slot,
   while the media queries above remain as a fallback for older browsers. */
@container church-module (max-width: 900px) {
  .cm-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cm-heading { grid-template-columns: 1fr; align-items: start; }
  .cm-live { grid-template-columns: 1fr; min-height: 0; }
  .cm-search-result { grid-template-columns: 100px minmax(0, 1fr); }
  .cm-search-result .cm-action { grid-column: 2; justify-self: start; }
}

@container church-module (max-width: 620px) {
  .cm-root { font-size: 16px; }
  .cm-stage { padding-block: 46px; }
  church-module .cm-root .cm-title { font-size: clamp(34px, 10cqi, 48px) !important; }
  .cm-grid, .cm-grid--two { grid-template-columns: 1fr; }
  .cm-tools { padding: 14px; }
  .cm-field, .cm-field--compact, .cm-toggle { flex-basis: 100%; }
  .cm-card-body { padding: 20px; }
  .cm-actions { align-items: stretch; flex-direction: column; }
  .cm-action { width: 100%; }
  .cm-action--quiet { width: fit-content; }
  .cm-event-head { align-items: center; }
  .cm-live { padding: 26px 20px; }
  .cm-provider { grid-template-columns: 1fr; }
  .cm-provider-badge { justify-self: start; }
  .cm-search-result { grid-template-columns: 1fr; }
  .cm-search-result .cm-action { grid-column: auto; }
}

@media (prefers-reduced-motion: reduce) {
  .cm-root *, .cm-root *::before, .cm-root *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

@media (forced-colors: active) {
  .cm-card, .cm-tools, .cm-live, .cm-search-result, .cm-action { border: 2px solid CanvasText; }
}

/* Church master preview bridge: the shared staging stylesheet loads after the
   Duda Head HTML. Keep the homepage visit strip aligned while older saved
   previews are reconciled to the current template package. The installed-root
   and page/layout attributes prevent these rules from affecting standalone
   modules or non-home pages. */
html.church-master-installed body[data-page-type="home"][data-layout="layered"] .visit-bar__grid,
html.church-master-installed body[data-page-type="home"][data-layout="chaptered"] .visit-bar__grid {
  width: 100%;
}

html.church-master-installed body[data-page-type="home"][data-layout="layered"] .visit-fact:is(:first-child, :last-child),
html.church-master-installed body[data-page-type="home"][data-layout="chaptered"] .visit-fact:is(:first-child, :last-child) {
  padding-inline: clamp(17px, 2vw, 29px);
}

html.church-master-installed body[data-page-type="home"][data-layout] .visit-fact--action .text-link {
  max-width: 100%;
  align-items: center;
  line-height: 1.4;
}

html.church-master-installed body[data-page-type="home"][data-layout] .visit-fact--action .text-link > span {
  flex: 0 0 auto;
}

@media (min-width: 1081px) {
  html.church-master-installed body[data-page-type="home"][data-layout] .visit-bar__grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (max-width: 820px) {
  html.church-master-installed body[data-page-type="home"][data-layout="chaptered"] .visit-bar {
    width: calc(100% - (var(--gutter) * 2));
    margin-inline: auto;
  }
}
