/* ==== Base Styles ==== */
:root {
  --bg-color: #f4f6f8;
  --text-color: #222;
  --card-border: #ccc;
  --photo-bg: #eee;
  --toc-bg: #f8f8f8;
  --blockquote-bg: rgba(0,0,0,.03);
  --heading-light: #4393e4;
  --heading-dark: #87CEFA;
  --link-light: #004499;
  --link-light-h: #002266;
  --link-dark: #ADD8E6;
  --link-dark-h: #ffffff;
  --body-font: "Trebuchet MS", "Aptos", "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  --heading-font: "Trebuchet MS", "Aptos Display", "Segoe UI", "Helvetica Neue", Arial, sans-serif;
}
html.dark-mode {
  --bg-color: #111;
  --text-color: #eee;
  --card-border: #555;
  --photo-bg: #444;
  --toc-bg: rgba(255,255,255,.03);
  --blockquote-bg: rgba(255,255,255,.04);
}

body {
  font-family: var(--body-font);
  margin: 0;
  padding: 0;
  background-color: var(--bg-color);
  background-image: linear-gradient(180deg, #f7f8fa 0%, #edf1f4 52%, #f3f5f7 100%);
  background-attachment: fixed;
  color: var(--text-color);
  font-size: clamp(18px, 1rem + 0.3vw, 20px);
  line-height: 1.65;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

html.dark-mode body {
  background-image: none;
}

.form-embed {
  position: relative;
  overflow: hidden;
  margin: 1.5rem 0;
  max-width: 1000px;
  min-height: 600px;
}

.form-embed iframe {
  position: absolute;
  width: 100%;
  height: 100%;
  border-radius: 8px;
  border: 1px solid var(--card-border);
}

.donate-embed {
  min-height: 600px;
}

a {
  color: var(--link-light);
  text-decoration: none;
  font-weight: 500;
}
a:hover,
a:focus {
  color: var(--link-light-h);
  text-decoration: underline;
}

/* Dark-mode links */
html.dark-mode a { color: var(--link-dark); }
html.dark-mode a:hover,
html.dark-mode a:focus { color: var(--link-dark-h); }

/* ==== Header & Nav ==== */
header {
  background: #111317;
  color: #fff;
  padding: 1rem;
}

footer {
  background: #222;
  color: #fff;
  padding: 1rem;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--heading-font);
  line-height: 1.2;
  letter-spacing: -0.01em;
  font-weight: 700;
}

h1 {
  font-size: clamp(2rem, 1.7rem + 1.4vw, 3rem);
  margin-bottom: 0.75rem;
}

h2 {
  font-size: clamp(1.5rem, 1.3rem + 0.8vw, 2.2rem);
}

h3 {
  font-size: clamp(1.2rem, 1.1rem + 0.45vw, 1.55rem);
}

p, li {
  font-size: 1rem;
}

header a,
header nav a,
footer a { color: #fff; }
header a:hover,
header nav a:hover,
footer a:hover { color: #ddd; }

.logo-container { text-align: center; padding-bottom: 0.5rem; }
.logo-container .site-logo {
  max-height: clamp(130px, 16vw, 190px);
  width: auto;
  display: block;
  margin: 0 auto;
}

nav { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; }
nav a { margin: 0.5rem; font-size: 1rem; letter-spacing: 0.01em; }

/* ==== Main Content ==== */
main { padding: 1.25rem; }

/* ==== Social Icons ==== */
.social a { margin-left: 0.5rem; font-size: 1.3rem; display: inline-flex; align-items: center; }
.social svg { width: 20px; height: 20px; fill: currentColor; }

/* ==== People Page ==== */
.people-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1.5rem;
  padding: 2rem 1rem;
  max-width: 1300px;
  margin: 0 auto;
}
@media (max-width: 600px) {
  .people-grid { grid-template-columns: 1fr; gap: 1rem; padding: 1rem; }
}

.person-card {
  background: var(--bg-color);
  border: 1px solid var(--card-border);
  border-radius: 8px;
  padding: 1rem;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.person-photo { width: 165px; height: 165px; background: var(--photo-bg); border-radius: 50%; margin: 0 auto 1rem; overflow: hidden; }
.person-photo img { width: 100%; height: 100%; object-fit: cover; display: block; }

.conference-speakers .person-bio {
  display: block;
  margin: 0.5rem 0 0;
}

/* Inline link button ("Read more / Show less") */
.inline-link-button {
  margin-left: 0.25rem;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  font: inherit;
  color: var(--link-light);
  text-decoration: underline;
}
.inline-link-button:hover,
.inline-link-button:focus { color: var(--link-light-h); }
html.dark-mode .inline-link-button { color: var(--link-dark); }
html.dark-mode .inline-link-button:hover,
html.dark-mode .inline-link-button:focus { color: var(--link-dark-h); }

/* ==== Responsive tweaks ==== */
@media (max-width: 768px) {
  nav { flex-direction: column; align-items: flex-start; }
  .logo-container { padding-bottom: 1rem; }
  .site-logo { max-height: 90px; }
}

/* ==== Dark‑mode via media query (optional fallback) ==== */
@media (prefers-color-scheme: dark) {
  header, footer { background: #000; }
  nav a { color: #eee; }
  .category h2 { color: var(--heading-dark); }
  .columns a { color: var(--link-dark); }
  .columns a:hover,
  .columns a:focus { color: var(--link-dark-h); }
}

/* ==== Overrides for mobile DuckDuckGo ==== */
.bio-section .person-photo { border-radius: 50% !important; overflow: hidden !important; margin-bottom: 1.25rem !important; }
.bio-section .person-photo img { width: 100% !important; height: 100% !important; object-fit: cover !important; display: block !important; }
.bio-section { display: flex; flex-direction: column; align-items: center; text-align: center; }
.bio-section h2 { margin-top: 0; padding-top: 0.5rem; }

/* Always render contra‑card text in black for readability */
.contra-card { color: #000; }
html.dark-mode .contra-card { color: #000; }

/* ==== Resources Page Styles ==== */
.columns {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 2rem;
  align-items: start;
}
.column { min-width: 0; }
@media (max-width: 900px) { .columns { grid-template-columns: 1fr; } }

.category { margin-bottom: 2rem; }
.category h2 { color: var(--heading-light); margin-bottom: 0.5rem; }
.category ul { margin: 0; padding-left: 1.2rem; }

/* ==== Contra Page Styles ==== */
.contra-card.abortive { background-color: #dc143c; }
.contra-card.abortifacient { background-color: #f8d7da; }
.contra-card.contraceptive { background-color: #d4edda; }

.contra-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
  gap: 2rem;
  padding: 2rem 1rem;
  max-width: calc(3 * 350px + 2 * 2rem);
  margin: 0 auto;
}

.contra-card {
  background: var(--bg-color);
  border: 1px solid var(--card-border);
  border-radius: 8px;
  padding: 0.75rem 1rem;
  text-align: left;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  height: 100%;
}

.contra-card h2 { margin-top: 0; margin-bottom: 0.25rem; }
.contra-card p { margin: 0.25rem 0; }

@media (max-width: 600px) {
  .contra-grid {
    grid-template-columns: 1fr;
    gap: 3rem;
    padding: 1rem;
    max-width: 100%;
  }
}
article {max-width: clamp(62ch, 90vw, 110ch); margin: 0 auto; padding: 2.5rem 1.25rem 4rem;}
header h1 {margin-bottom: .25rem;}
.lede {opacity: .8; margin-top: 0;}
.toc {
  border: 1px solid var(--card-border, #ddd);
  border-radius: .75rem;
  padding: 1rem 1.25rem;
  margin: 1.25rem 0 2rem;
  background: var(--toc-bg);
}
.toc ol {margin: 0; padding-left: 1.25rem;}
.toc a {text-decoration: none;}
h2 {margin-top: 2rem;}
blockquote {
  margin: 1rem 0;
  padding: .75rem 1rem;
  border-left: 4px solid currentColor;
  background: var(--blockquote-bg);
}
blockquote footer {font-style: italic; opacity: .8; margin-top: .5rem;}
.schedule-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-template-rows: repeat(3, auto);
  grid-auto-flow: column;
  gap: 0.75rem 1.5rem;
  margin-top: 0.5rem;
}
.schedule-grid h3 { margin: 0 0 0.25rem; color: var(--heading-light); }
.schedule-block ul { margin: 0.35rem 0 0; padding-left: 1.1rem; }
.schedule-block { padding: 0; }
.schedule-block-full { grid-column: 1 / -1; }
@media (max-width: 900px) {
  .schedule-grid { grid-template-columns: 1fr; }
}
/* Accessibility helpers */
.sr-only {position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;}
.theme-toggle-button {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: var(--photo-bg);
  border: none;
  padding: 0.5rem 1rem;
  border-radius: 4px;
  cursor: pointer;
  color: var(--text-color);
  font-size: 0.9rem;
}

/* Floating chat button with label */
#chatBtn {
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  border: none;
  background: var(--heading-light);
  color: white;
  font-size: 1.5rem;
  cursor: pointer;
  box-shadow: 0 4px 6px rgba(0,0,0,0.3);
  transition: background 0.3s ease;
  z-index: 9999;

  display: flex;
  align-items: center;
  justify-content: center;
  overflow: visible;
  position: fixed;
}

#chatBtn:hover {
  background: var(--link-light);
}

#chatBtn .chat-label {
  opacity: 0;
  transform: translateX(0);
  white-space: nowrap;
  background: var(--bg-color);
  color: var(--text-color);
  padding: 6px 12px;
  border-radius: 6px;
  margin-right: 70px; /* space between bubble and label */
  font-size: 0.9rem;
  box-shadow: 0 2px 6px rgba(0,0,0,0.2);
  pointer-events: none;

  position: absolute;
  right: 100%;
  transition: opacity 0.3s ease, transform 0.3s ease;
}

#chatBtn:hover .chat-label {
  opacity: 1;
  transform: translateX(-10px);
}

.qa-item {
  margin-bottom: 2rem;
  padding: 1rem;
  border: 1px solid var(--card-border);
  border-radius: 8px;
  background: var(--photo-bg); /* was #fafafa */
  color: var(--text-color);
}

.qa-question {
  font-weight: bold;
  margin-bottom: 1rem;
}

.qa-grid {
  display: grid;
  grid-template-columns: 1fr; /* one column on small screens */
  gap: 1rem;
}

.qa-answer {
  padding: 1rem;
  border: 1px solid var(--card-border);
  border-radius: 6px;
  background: var(--bg-color);
  color: var(--text-color);
}

/* Subtle differences */
.qa-answer.plm {
  background: linear-gradient(
    to bottom right,
    rgba(67, 147, 228, 0.08),
    var(--bg-color)
  );
}

.qa-answer.abo {
  background: linear-gradient(
    to bottom right,
    rgba(144, 238, 144, 0.08),
    var(--bg-color)
  );
}

/* Side by side on wider screens */
@media (min-width: 768px) {
  .qa-grid {
    grid-template-columns: 1fr 1fr;
  }
}

.bible-tooltip {
  display: none;
  position: absolute;
  background: var(--tooltip-bg, #222);
  color: var(--tooltip-color, #fff);
  padding: 8px 12px;
  border-radius: 6px;
  min-width: 250px;
  max-width: 500px;
  font-size: 0.9rem;
  line-height: 1.4;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  white-space: normal;
  z-index: 1000;
  
  border: 1px solid rgba(255, 255, 255, 0.25); /* subtle in dark mode */
}

/* Default (light mode) */
.bible-ref {
  cursor: pointer;
  color: #0056b3;                 /* link-like blue */
  border-bottom: 1px dotted currentColor;
  transition: color 0.2s ease, border-bottom-color 0.2s ease;
}

.bible-ref:hover {
  color: #d63384;                 /* pink accent on hover */
  border-bottom-style: solid;
}

/* Dark mode */
.dark-mode .bible-ref {
  color: #66b2ff;                 /* lighter blue for dark backgrounds */
  border-bottom: 1px dotted currentColor;
}

.dark-mode .bible-ref:hover {
  color: #ff7ab8;                 /* brighter pink accent */
  border-bottom-style: solid;
}
