:root {
  --bg: #faf8f5;
  --surface: #ffffff;
  --text: #141413;
  --muted: #52514e;
  --accent: #1b6b4a;
  --accent-hover: #145239;
  --accent-soft: rgba(27, 107, 74, 0.1);
  --time-bg: #fff8e6;
  --time-border: #d99b26;
  --time-text: #8a5a00;
  --border: #e8e4dc;
  --arabic: "Amiri", "Traditional Arabic", "Scheherazade New", serif;
  --body: "Source Serif 4", "Georgia", "Times New Roman", serif;
  --sans: "Source Sans 3", system-ui, sans-serif;
  --max-width: 44rem;
  --nav-width: 52rem;
  --content-scale: 1;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121210;
    --surface: #1c1c19;
    --text: #f2f0ec;
    --muted: #b0aea8;
    --accent: #4db88a;
    --accent-hover: #6dd4a8;
    --accent-soft: rgba(77, 184, 138, 0.14);
    --time-bg: #2b2312;
    --time-border: #d99b26;
    --time-text: #ffd166;
    --border: #2e2e2a;
  }
}

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

html {
  font-size: 19px;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: var(--body);
  line-height: 1.85;
  color: var(--text);
  background: var(--bg);
}

body.podium-mode {
  --max-width: 50rem;
}

body.podium-mode main {
  font-size: calc(1.18rem * var(--content-scale));
  line-height: 2;
}

body.podium-mode .site-header,
body.podium-mode #TOC {
  display: none;
}

.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 1.25rem 1.5rem;
}

.site-header-inner {
  max-width: var(--nav-width);
  margin: 0 auto;
}

.site-header h1 {
  font-family: var(--sans);
  font-size: 1.35rem;
  font-weight: 600;
  margin: 0 0 0.25rem;
  letter-spacing: -0.02em;
}

.site-header p {
  margin: 0;
  font-family: var(--sans);
  font-size: 0.9rem;
  color: var(--muted);
}

.site-nav {
  max-width: var(--nav-width);
  margin: 0 auto;
  padding: 0.75rem 1.5rem;
  font-family: var(--sans);
  font-size: 0.875rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}

.site-nav a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
}

.site-nav a:hover {
  color: var(--accent-hover);
  text-decoration: underline;
}

.podium-controls {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  font-family: var(--sans);
}

.podium-btn {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.3rem 0.65rem;
  font-family: var(--sans);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, color 0.15s;
}

.podium-btn:hover {
  border-color: var(--accent);
}

.podium-btn.active {
  background: var(--accent);
  color: #ffffff;
  border-color: var(--accent);
}

.podium-btn.mic-btn.listening {
  background: #c93b2b;
  color: #ffffff;
  border-color: #a82315;
  animation: pulse-mic 1.8s infinite;
}

@keyframes pulse-mic {
  0% { box-shadow: 0 0 0 0 rgba(201, 59, 43, 0.45); }
  70% { box-shadow: 0 0 0 8px rgba(201, 59, 43, 0); }
  100% { box-shadow: 0 0 0 0 rgba(201, 59, 43, 0); }
}

.speech-active {
  background: var(--accent-soft) !important;
  border-left: 5px solid var(--accent) !important;
  padding-left: 0.85rem !important;
  border-radius: 4px;
  box-shadow: 0 0 0 1px rgba(27, 107, 74, 0.18);
  transition: background 0.25s ease, border-color 0.25s ease;
}

/* Clickable blocks to lock reading focus */
main p,
main li,
main blockquote,
main h3,
main h4 {
  cursor: pointer;
  border-radius: 4px;
  transition: background 0.15s ease;
}

main p:hover,
main li:hover,
main blockquote:hover {
  background: rgba(27, 107, 74, 0.05);
}

.live-clock {
  font-family: var(--sans);
  font-size: 0.85rem;
  font-weight: 600;
  padding: 0.3rem 0.65rem;
  border-radius: 6px;
  background: var(--time-bg);
  color: var(--time-text);
  border: 1px solid var(--time-border);
  font-variant-numeric: tabular-nums;
}

main {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 2rem 1.5rem 5rem;
  font-size: calc(1rem * var(--content-scale));
}

main.wide {
  max-width: var(--nav-width);
}

/* Index page */
.index-intro {
  margin-bottom: 2.5rem;
}

.index-intro p {
  color: var(--muted);
  font-family: var(--sans);
  font-size: 1rem;
  line-height: 1.6;
}

.section-title {
  font-family: var(--sans);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin: 2rem 0 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
}

.card-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 0.75rem;
}

@media (min-width: 640px) {
  .card-list.two-col {
    grid-template-columns: 1fr 1fr;
  }
}

.card-list li a {
  display: block;
  padding: 1rem 1.25rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  text-decoration: none;
  color: inherit;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.card-list li a.featured-card {
  border: 2px solid var(--accent);
  background: var(--accent-soft);
}

.card-list li a:hover {
  border-color: var(--accent);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
}

.card-list .card-badge {
  display: inline-block;
  font-family: var(--sans);
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  background: var(--accent);
  color: #ffffff;
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  margin-bottom: 0.4rem;
}

.card-list .card-title {
  font-family: var(--sans);
  font-weight: 600;
  font-size: 1rem;
  margin-bottom: 0.35rem;
  color: var(--text);
}

.card-list .card-meta {
  font-family: var(--sans);
  font-size: 0.8rem;
  color: var(--muted);
}

/* Hide pandoc duplicate title when page already has an h1 */
#title-block-header {
  display: none;
}

/* Section wrappers for bounded sticky headings */
.sermon-section {
  position: relative;
  margin-top: 2.75rem;
  padding-top: 0.25rem;
}

.sermon-subsection {
  position: relative;
  margin-top: 1.75rem;
}

/* Page content from pandoc / marked */
main h1 {
  font-family: var(--sans);
  font-size: 1.75rem;
  font-weight: 600;
  line-height: 1.3;
  margin-top: 0;
  letter-spacing: -0.02em;
}

main h2 {
  font-family: var(--sans);
  font-size: 1.25rem;
  font-weight: 600;
  margin: 0 0 0.85rem;
  padding: 0.55rem 0.75rem;
  color: var(--accent);
  position: -webkit-sticky;
  position: sticky;
  top: var(--nav-height, 52px);
  z-index: 25;
  background: var(--bg);
  border-bottom: 2px solid var(--accent);
  border-radius: 6px 6px 0 0;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
  transition: background 0.2s ease, color 0.2s ease;
}

main h3 {
  font-family: var(--sans);
  font-size: 1.05rem;
  font-weight: 600;
  margin: 0 0 0.85rem;
  padding: 0.45rem 0.75rem;
  color: var(--text);
  position: -webkit-sticky;
  position: sticky;
  top: calc(var(--nav-height, 52px) + var(--h2-height, 44px));
  z-index: 20;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  border-radius: 0 0 6px 6px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.04);
  transition: background 0.2s ease, color 0.2s ease;
}

body.podium-mode main h2 {
  background: #000000;
  color: #ffd166;
  border-bottom-color: #ffd166;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.9);
}

body.podium-mode main h3 {
  background: #000000;
  color: #ffffff;
  border-bottom-color: #444440;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.8);
}

main h4 {
  font-family: var(--sans);
  font-size: 1.05rem;
  font-weight: 600;
  margin-top: 1.75rem;
  color: var(--accent);
}

main em {
  color: var(--text);
  font-style: italic;
}

main hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 2.25rem 0;
}

/* Blockquotes: clear separation of transliteration, Arabic, and translation */
main blockquote {
  margin: 1.5rem 0;
  padding: 1rem 1.35rem;
  border-left: 4px solid var(--accent);
  background: var(--surface);
  border-radius: 0 8px 8px 0;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.03);
}

main blockquote p {
  margin: 0.6rem 0;
  direction: ltr;
  text-align: left;
}

main blockquote p.arabic-only,
.arabic-line {
  display: block;
  font-family: var(--arabic);
  font-size: 1.4rem;
  line-height: 2;
  direction: rtl;
  text-align: right;
  margin: 0.65rem 0;
  color: var(--text);
}

/* High-visibility Time Markers for live delivery */
.time-marker {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  margin: 3.25rem 0 2rem;
  user-select: none;
}

.time-marker::before,
.time-marker::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--time-border);
  opacity: 0.45;
}

.time-marker span {
  font-family: var(--sans);
  font-size: 0.9rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  padding: 0.3rem 0.9rem;
  border-radius: 999px;
  background: var(--time-bg);
  color: var(--time-text);
  border: 1.5px solid var(--time-border);
  font-variant-numeric: tabular-nums;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

/* Stage directions like [Adhaan] or (Sit down for a brief pause) */
.stage-direction {
  display: inline-block;
  font-family: var(--sans);
  font-size: 0.85rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 0.35rem 0.85rem;
  margin: 1rem 0;
  border-radius: 6px;
  background: var(--accent-soft);
  color: var(--accent);
  border: 1px dashed var(--accent);
}

main ul,
main ol {
  padding-left: 1.5rem;
}

main li {
  margin-bottom: 0.75rem;
}

main p {
  margin: 1.15rem 0;
}

main strong {
  font-weight: 600;
}

.transcript-note {
  font-family: var(--sans);
  font-size: 0.85rem;
  color: var(--muted);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.75rem 1rem;
  margin-bottom: 2rem;
}

.site-footer {
  max-width: var(--nav-width);
  margin: 0 auto;
  padding: 2rem 1.5rem;
  font-family: var(--sans);
  font-size: 0.8rem;
  color: var(--muted);
  border-top: 1px solid var(--border);
  text-align: center;
}
