/* ── RESET ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* ── DESIGN TOKENS ── */
:root {
  --black:  #0a0a0a;
  --white:  #fafafa;
  --mid:    #888;
  --rule:   #d0d0d0;
  --footer: #4f9179;
  --accent: #b0126a;
}

/* ── BASE ── */
html, body {
  background: var(--white);
  color: var(--black);
  font-family: 'DM Sans', sans-serif;
  min-height: 100vh;
}

/* ── PAGE CONTAINER ── */
/* All pages use .page for consistent max-width, centering, and padding.
   Override max-width or padding per-page via inline <style> when needed. */
.page {
  max-width: 900px;
  margin: 0 auto;
  padding: 16px 32px 32px;
}

.page.narrow { padding: 80px 32px 60px; }
.page.gallery { padding: 16px 32px 32px; }

/* ── RULES (horizontal dividers) ── */
.rule { width: 100%; height: 1px; background: var(--black); margin-bottom: 10px; }
.rule-thin { width: 100%; height: 1px; background: var(--rule); margin: 16px 0; }

/* ── TYPOGRAPHY ── */

/* Page headings */
h1 {
  font-family: 'Titillium Web', sans-serif;
  font-weight: 800;
  font-size: clamp(28px, 5vw, 44px);
  letter-spacing: 0.01em;
  line-height: 1.1;
  margin-bottom: 6px;
}

/* Subtitle / label beneath h1 */
.subtitle {
  font-family: 'Josefin Sans', sans-serif;
  font-weight: 300;
  font-size: 13px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--mid);
}

/* Body-intro paragraphs */
.intro {
  font-family: 'DM Sans', sans-serif;
  font-weight: 300;
  font-size: 15px;
  line-height: 1.7;
  color: #333;
  margin-top: 10px;
}
.intro a { color: var(--black); }

/* ── TOP NAVIGATION ── */
.dd-help {
  text-align: center;
  padding: 3px 16px;
  font-family: 'DM Sans', sans-serif;
  font-weight: 300;
  font-size: 11px;
  color: var(--mid);
  background: #f5f5f5;
  border-bottom: 1px solid var(--rule);
}
.dd-help a {
  font-family: 'Josefin Sans', sans-serif;
  font-weight: 600;
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
  text-decoration: none;
  margin-left: 4px;
}
.dd-help a:hover { text-decoration: underline; }

.sermon-banner {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  padding: 4px 16px;
  font-family: 'DM Sans', sans-serif;
  font-weight: 300;
  font-size: 12px;
  color: var(--black);
  background: #fdf1f6;
  border-bottom: 1px solid var(--rule);
}
.sermon-banner-tag {
  font-family: 'Josefin Sans', sans-serif;
  font-weight: 700;
  font-size: 9px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--white);
  background: var(--accent);
  border-radius: 3px;
  padding: 2px 6px;
}
.sermon-banner a { color: var(--black); text-decoration: none; border-bottom: 1px solid var(--accent); }
.sermon-banner a:hover { color: var(--accent); }
.sermon-banner-close {
  background: none; border: none; cursor: pointer;
  color: var(--mid); font-size: 15px; line-height: 1; padding: 0 2px;
}
.sermon-banner-close:hover { color: var(--black); }

.dd-tagline {
  width: 100%;
  max-width: 900px;
  margin: 0 auto;
  text-align: left;
  padding: 2px 32px 4px;
  font-family: 'DM Sans', sans-serif;
  font-style: italic;
  font-weight: 300;
  font-size: 11px;
  color: var(--mid);
}
.dd-nav {
  position: sticky; top: 0; z-index: 1000;
  background: var(--white); border-bottom: 1px solid var(--rule);
}
.dd-strapline { display: none; }
.dd-inner {
  max-width: 900px; margin: 0 auto;
  padding: 6px 32px 6px;
  display: flex; align-items: flex-start;
}
.dd-brand {
  flex-shrink: 0; margin-right: 28px;
  display: flex; flex-direction: column; align-items: center;
}
.dd-logo {
  font-family: 'Titillium Web', sans-serif; font-weight: 800;
  font-size: 42px; letter-spacing: 0.02em; color: #d5d5d5;
  text-decoration: none;
  line-height: 0.85;
  text-transform: none;
  display: block;
}
.dd-logo:hover { opacity: 0.7; }
.dd-role {
  font-family: 'Josefin Sans', sans-serif; font-weight: 400;
  font-size: 10px; letter-spacing: 0.15em; text-transform: uppercase;
  color: var(--mid); white-space: nowrap;
}
.dd-role.role-shake { animation: ddShake 0.4s cubic-bezier(0.36, 0, 0.66, -0.56); }
@keyframes ddShake {
  0%, 100% { transform: translateX(0); }
  10% { transform: translateX(-3px); }
  20% { transform: translateX(3px); }
  30% { transform: translateX(-3px); }
  40% { transform: translateX(3px); }
  50% { transform: translateX(-2px); }
  60% { transform: translateX(2px); }
  70% { transform: translateX(-1px); }
  80% { transform: translateX(1px); }
}
.dd-cols {
  display: flex; flex: 1 1 auto; min-width: 0;
}
.dd-col { flex: 1; min-width: 90px; }
.dd-hdr {
  font-family: 'Josefin Sans', sans-serif; font-weight: 600;
  font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase;
  margin-bottom: 2px; line-height: 1.3;
}
.dd-hdr a { color: var(--black); text-decoration: none; }
.dd-hdr a:hover { color: var(--accent); }
.dd-l2 {
  display: block;
  font-family: 'DM Sans', sans-serif; font-weight: 400;
  font-size: 11px; line-height: 1.5; color: #555;
  text-decoration: none;
}
.dd-l2:hover { color: var(--accent); }
.dd-right {
  display: flex; align-items: center; gap: 6px;
  flex-shrink: 0; margin-left: 14px;
}
.dd-soc-row {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  margin-bottom: 0;
}
.dd-soc {
  display: flex; align-items: center; justify-content: center;
  color: #d5d5d5; transition: color 0.2s;
}
.dd-soc svg { width: 18px; height: 18px; fill: currentColor; }
.dd-soc:hover { color: var(--accent); }
.dd-chips { display: none; }
.dd-l2-panel { display: none; }

@media (max-width: 800px) {
  .dd-inner { padding: 8px 16px 4px 16px; flex-wrap: wrap; }
  .dd-brand { margin-right: auto; flex-shrink: 0; width: 90px; }
  .dd-logo { font-size: 28px; }
  .dd-cols { display: none; }
  .dd-chips {
    display: flex; flex-direction: column; gap: 0;
    flex: 1; min-width: 0; padding: 0 0 0 12px;
  }
  .dd-chip {
    font-family: 'Josefin Sans', sans-serif; font-weight: 500;
    font-size: 9px; letter-spacing: 0.06em; text-transform: uppercase;
    color: var(--mid); background: none; border: none;
    padding: 1px 6px; cursor: pointer; white-space: nowrap;
    flex-shrink: 0; line-height: 1.2; text-align: left;
  }
  .dd-chip::after {
    content: '\203A'; margin-left: 4px; font-size: 11px;
    color: var(--rule); font-weight: 400;
  }
  .dd-chip.active { color: var(--accent); font-weight: 600; }
  .dd-chip.active::after { color: var(--accent); }
  .dd-chip:hover { color: var(--accent); }
  .dd-l2-panel {
    display: block; padding: 0 0 4px; width: 100%; text-align: center;
  }
  .dd-l2-panel .dd-l2 {
    display: inline-block;
    font-family: 'DM Sans', sans-serif; font-weight: 400;
    font-size: 11px; color: #555;
    padding: 5px 12px 5px 0; text-decoration: none;
  }
  .dd-l2-panel .dd-l2:hover { color: var(--accent); }
  .dd-l2-panel .dd-sep { color: var(--rule); font-size: 10px; }

  .dd-right { flex-direction: column; gap: 4px; margin-left: 0; padding-left: 6px; padding-top: 2px; }
}

/* ── FOOTER ── */
footer {
  position: fixed; bottom: 26px; left: 0; right: 0;
  z-index: 999;
  padding: 4px 16px;
  background: var(--white);
  border-top: 1px solid var(--rule);
  font-family: 'DM Sans', sans-serif;
  font-style: italic;
  font-weight: 300;
  font-size: 12px;
  line-height: 1.4;
  text-align: center;
  color: var(--footer);
}
.verse-ref {
  font-family: 'Josefin Sans', sans-serif;
  font-style: normal;
  font-weight: 400;
  font-size: 9px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--footer);
}
.footer-feedback-link {
  color: var(--footer);
  text-decoration: underline;
}
.footer-feedback-link:hover { opacity: 0.75; }

/* ── RESPONSIVE ── */
@media (max-width: 480px) {
  .page { padding: 24px 24px 32px; }
  h1 { font-size: 28px; }
}

/* ── SCRIPTURE TOOLTIP ── */
.st-ref {
  color: #1a6fc4;
  text-decoration: underline;
  text-decoration-style: dotted;
  text-underline-offset: 2px;
  cursor: pointer;
}
.st-ref:hover { text-decoration-style: solid; }

#st-tip {
  position: fixed;
  z-index: 9999;
  background: #0a0a0a;
  color: #fafafa;
  padding: 12px 16px;
  max-width: 420px;
  border-radius: 2px;
  pointer-events: auto;
  font-family: 'DM Sans', sans-serif;
}
.st-text {
  font-weight: 300;
  font-size: 14px;
  line-height: 1.6;
  margin-bottom: 8px;
}
.st-link {
  display: inline-block;
  font-family: 'Josefin Sans', sans-serif;
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #8ab4f8;
  text-decoration: none;
}
.st-link:hover { text-decoration: underline; }

/* ── BOTTOM TABS (Ask David + Favorites) ── */
#md-bar {
  position: fixed; bottom: 0; left: 0; right: 0;
  z-index: 1001;
  display: flex;
}
#md-bar > div {
  flex: 1;
  background: #0a0a0a; color: #fafafa;
  padding: 8px 12px; cursor: pointer;
  font-family: 'Josefin Sans', sans-serif;
  font-size: 10px; letter-spacing: 0.15em; text-transform: uppercase;
  text-align: center;
  transition: background 0.2s;
  border-right: 1px solid rgba(255,255,255,0.15);
  /* Always a single line — a wrapped label would stretch every tab (flex
     default align-items:stretch) and push the fixed bar's height up over
     whatever sits below it on the page (e.g. the footer's intro-replay link). */
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
#md-bar > div:last-child { border-right: none; }
#md-bar > div:hover { opacity: 0.9; }
#md-bar > div.md-active { background: #b0126a; }

@media (max-width: 600px) {
  #md-bar > div { font-size: 8.5px; letter-spacing: 0.06em; padding: 8px 5px; }
}

@keyframes md-peek {
  0% { background: #0a0a0a; }
  30% { background: #b0126a; }
  70% { background: #b0126a; }
  100% { background: #0a0a0a; }
}
#md-bar.md-jiggle { animation: md-peek 1.8s ease-in-out; }

/* Who Is David tab — "who is" holds while DAVID assembles beside it, then
   fades out and repeats. The letters live in the DOM for the whole cycle and
   are moved with per-letter inline transforms in widget.js, not a CSS
   keyframe, so each pass gets a fresh random scatter and the label's width
   never changes. */
#md-who-cycle { display: inline-block; }
@media (prefers-reduced-motion: reduce) {
  #md-who-cycle.role-shake { animation: none; }
  #md-who-cycle * { transition: none !important; }
}

/* Pink scanner sweeping across the tab: left-to-right ahead of DAVID
   arriving, then right-to-left wiping him away again. Swept via transform,
   clipped by the tab's own overflow:hidden so it never bleeds into
   neighboring tabs. */
#md-tab-who { position: relative; }
#md-tab-who::after {
  content: '';
  position: absolute;
  top: 0; left: 0; height: 100%; width: 85%;
  transform: translateX(-140%);
  pointer-events: none;
}
/* Three bands rather than one, brightest at the leading edge and fading back
   behind it, so the pass reads as a scanner with a trail. The stop order is
   mirrored per direction, otherwise the trail would run ahead of the head on
   the return trip. */
#md-tab-who.md-who-wave-right::after {
  background: linear-gradient(100deg,
    transparent 0%,
    rgba(176,18,106,0.12) 8%,
    transparent 18%,
    rgba(176,18,106,0.35) 28%,
    transparent 42%,
    rgba(176,18,106,0.9) 56%,
    transparent 80%);
  animation: mdWhoWaveRight 0.35s ease-in-out;
}
#md-tab-who.md-who-wave-left::after {
  background: linear-gradient(100deg,
    transparent 10%,
    rgba(176,18,106,0.9) 28%,
    transparent 48%,
    rgba(176,18,106,0.42) 60%,
    transparent 74%,
    rgba(176,18,106,0.16) 86%,
    transparent 100%);
  animation: mdWhoWaveLeft 0.35s ease-in-out;
}
@keyframes mdWhoWaveLeft {
  0%   { transform: translateX(240%); }
  100% { transform: translateX(-140%); }
}
@keyframes mdWhoWaveRight {
  0%   { transform: translateX(-140%); }
  100% { transform: translateX(240%); }
}
@media (prefers-reduced-motion: reduce) {
  #md-tab-who.md-who-wave-left::after,
  #md-tab-who.md-who-wave-right::after { animation: none; }
}

/* Reserve space so footer isn't hidden behind the bar */
body { padding-bottom: 50px; }

.md-panel {
  position: fixed; bottom: 0; left: 0; right: 0;
  z-index: 1001;
  background: #fafafa; color: #0a0a0a;
  border-top: 1px solid #d0d0d0;
  padding: 24px 24px 36px;
  max-height: 70vh; overflow-y: auto;
  transform: translateY(100%);
  transition: transform 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  box-shadow: 0 -4px 20px rgba(0,0,0,0.08);
}
.md-panel-open { transform: translateY(0); }
.md-p-close {
  position: absolute; top: 12px; right: 16px;
  font-size: 22px; cursor: pointer; color: #888; line-height: 1;
}
.md-p-close:hover { color: #0a0a0a; }
.md-p-label {
  font-family: 'Josefin Sans', sans-serif;
  font-size: 11px; letter-spacing: 0.18em;
  text-transform: uppercase; color: #888;
  margin-bottom: 16px; padding-right: 30px;
}

/* Ask David */
.md-p-desc {
  font-family: 'DM Sans', sans-serif; font-weight: 300;
  font-size: 14px; line-height: 1.6; color: #333; margin-bottom: 10px;
}
.md-p-link {
  margin-top: 16px; text-align: right;
}
.md-p-link a {
  font-family: 'Josefin Sans', sans-serif; font-weight: 400;
  font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--accent); text-decoration: none;
}
.md-p-link a:hover { text-decoration: underline; }
#md-ask-form { display: flex; flex-direction: column; gap: 10px; }
#md-ask-input {
  width: 100%; font-family: 'DM Sans', sans-serif; font-size: 15px;
  padding: 12px 14px; border: 1px solid var(--black);
  background: var(--white); color: var(--black); resize: vertical;
}
#md-ask-input:focus { outline: none; border-width: 2px; }
#md-ask-input::placeholder { color: var(--mid); }
.md-ask-btn {
  align-self: flex-start;
  font-family: 'Josefin Sans', sans-serif; font-weight: 300;
  font-size: 10px; letter-spacing: 0.28em; text-transform: uppercase;
  color: var(--white); background: var(--black);
  border: 1px solid var(--black); padding: 10px 22px;
  cursor: pointer; transition: background 0.25s, color 0.25s;
}
.md-ask-btn:hover { background: var(--white); color: var(--black); }
.md-ask-btn:disabled { opacity: 0.5; cursor: default; }
.md-p-status {
  font-family: 'DM Sans', sans-serif; font-style: italic;
  font-size: 13px; color: var(--mid); margin-top: 10px;
}
.md-ask-reply {
  font-family: 'DM Sans', sans-serif; font-weight: 300;
  font-size: 14px; line-height: 1.7; color: #333;
}
.md-ask-verse {
  margin-top: 10px; padding: 10px 14px;
  background: #f3f7f5; border-left: 3px solid #4f9179;
}
.md-ask-verse-text {
  font-family: 'DM Sans', sans-serif; font-weight: 300;
  font-style: italic; font-size: 14px; line-height: 1.65; color: #22423a;
}
.md-ask-verse-ref {
  margin-top: 6px;
  font-family: 'Josefin Sans', sans-serif; font-weight: 400;
  font-size: 10px; letter-spacing: 0.14em; text-transform: uppercase; color: #4f9179;
}
#md-ask-results { margin-top: 10px; display: flex; flex-direction: column; gap: 4px; }
.md-ask-chip {
  padding: 8px 12px; border: 1px solid var(--rule);
  font-family: 'DM Sans', sans-serif; font-weight: 400; font-size: 13px;
  cursor: pointer; transition: border-color 0.15s;
  position: relative;
}
.md-ask-chip:hover { border-color: var(--black); }
.md-ask-chip .md-ask-arrow {
  font-family: monospace; font-size: 10px;
  transition: transform 0.2s; display: inline-block;
  margin-left: 8px; opacity: 0.4;
}
.md-ask-open .md-ask-arrow { transform: rotate(90deg); }
.md-ask-detail {
  margin-top: 8px; font-size: 12px; line-height: 1.55; color: #333;
  font-weight: 300; display: none;
}
.md-ask-open .md-ask-detail { display: block; }
.md-ask-why {
  margin-top: 6px; font-size: 12px; line-height: 1.55; color: #16a34a;
  font-weight: 400; display: none;
}
.md-ask-open .md-ask-why { display: block; }
.md-ask-goto {
  display: none; margin-top: 8px;
  font-family: 'Josefin Sans', sans-serif; font-size: 9px;
  letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--black); text-decoration: underline;
}
.md-ask-open .md-ask-goto { display: inline-block; }
.md-ask-type {
  font-family: 'Josefin Sans', sans-serif; font-size: 8px;
  letter-spacing: 0.1em; text-transform: uppercase; color: var(--mid); flex-shrink: 0;
}

/* Topic wrapper */
.md-topic { margin-bottom: 8px; }
.md-topic:last-child { margin-bottom: 0; }
.md-topic-trigger {
  padding: 8px 10px; border: 1px solid var(--black);
  font-family: 'Josefin Sans', sans-serif; font-size: 11px;
  letter-spacing: 0.1em; text-transform: uppercase;
  cursor: pointer; transition: background 0.15s;
  display: flex; align-items: center; gap: 8px;
}
.md-topic-trigger:hover { background: #f5f5f5; }
.md-topic-body { display: none; padding: 8px 0 0 12px; }
.md-topic-body.md-open { display: block; }
.md-topic-trigger .md-chip-arrow { font-size: 9px; }
.md-topic-trigger.md-open .md-chip-arrow { transform: rotate(90deg); }

/* Inline entry inside topic */
.md-bit { margin-bottom: 12px; }
.md-bit:last-child { margin-bottom: 0; }
.md-bit .md-chip-badge {
  font-family: 'Josefin Sans', sans-serif; font-size: 8px;
  letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--accent);
}

/* Shared */
.md-chip-title { font-family: 'Titillium Web', sans-serif; font-weight: 700; font-size: 14px; }
.md-chip-author { font-family: 'Josefin Sans', sans-serif; font-size: 10px; letter-spacing: 0.06em; color: var(--mid); }
.md-chip-note { font-weight: 300; font-size: 13px; line-height: 1.5; color: #333; margin: 4px 0; }
.md-chip-link {
  display: inline-block; font-family: 'Josefin Sans', sans-serif;
  font-size: 9px; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--black); text-decoration: underline;
}
.md-empty {
  font-weight: 300; font-size: 14px; color: #888;
  font-style: italic;
}

