/* Colors sampled from the current live.emanuelchurch.com (Church Online Platform, dark mode). */
:root {
  --header-bg: #000000;
  --header-line: #3e3e41;
  --brand: #404041;
  --text: #ffffff;
  --stage-bg: #0f0f0f;
  --panel-bg: #1b1b1d;
  --header-h: 72px;
  --side-w: 380px;
  --side-bg: #0f1014;
  --card-bg: #1f1f23;
  --card-bg-2: #29292e;
  --muted: #9a9aa8;
  --font-ui: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-brand: "Proxima Nova", "Helvetica Neue", Helvetica, "Arial Nova", Arial, sans-serif;
}

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

html, body {
  margin: 0;
  height: 100%;
  background: var(--header-bg);
  color: var(--text);
  font-family: var(--font-ui);
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
ul { list-style: none; margin: 0; padding: 0; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }

/* ---------- Header ---------- */
.topbar {
  position: relative;
  z-index: 10;
  display: flex;
  align-items: center;
  height: var(--header-h);
  padding: 0 16px;
  background: var(--header-bg);
  border-bottom: 1px solid var(--header-line);
}

.brand {
  font-family: var(--font-brand);
  font-size: 17px;
  font-weight: 600;
  color: var(--brand);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.nav { margin-left: auto; }

.nav-links { display: flex; align-items: center; }

.nav-links a {
  display: block;
  padding: 8px 16px;
  font-size: 16px;
  line-height: 16px;
  color: var(--text);
  border-radius: 3px;
  transition: opacity 0.15s ease;
}
.nav-links a:hover { opacity: 0.7; }

.menu-button {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  margin-left: 8px;
  margin-right: -12px;
  border-radius: 3px;
}
.menu-button:hover { background: rgba(255, 255, 255, 0.08); }

a:focus-visible, button:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 2px;
}

/* ---------- Menu panel ---------- */
.menu-panel {
  position: absolute;
  top: calc(var(--header-h) - 16px);
  right: 16px;
  width: min(400px, calc(100vw - 32px));
  padding: 16px;
  background: var(--panel-bg);
  border-radius: 4px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.5);
}
.menu-panel[hidden] { display: none; }

.menu-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 8px 0 20px 16px;
}
.menu-logo {
  display: block;
  width: auto;
  height: 120px;
}
.menu-close {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  color: #8a8a8d;
  border-radius: 3px;
}
.menu-close:hover { color: #fff; background: rgba(255, 255, 255, 0.08); }

.menu-links a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  font-size: 17px;
  font-weight: 600;
  border-radius: 3px;
}
.menu-links a:hover { background: rgba(255, 255, 255, 0.06); }
.menu-links svg { flex: none; }

/* ---------- Video stage ---------- */
.stage {
  display: flex;
  height: calc(100vh - var(--header-h));
  height: calc(100dvh - var(--header-h));
  background: var(--stage-bg);
  overflow: hidden;
}

.player-area {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.player {
  /* Largest 16:9 box that fits the stage. */
  width: min(100%, calc((100dvh - var(--header-h)) * 16 / 9));
  aspect-ratio: 16 / 9;
}
.player iframe {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
  background: var(--stage-bg);
}

/* ---------- Sidebar ----------
   Style rule: no border boxes (fills, not outlines; thin divider lines are fine)
   and small corners only (4px containers, 3px controls, 2px small inner parts). */
.sidebar {
  flex: none;
  display: flex;
  flex-direction: column;
  width: var(--side-w);
  background: var(--side-bg);
  border-left: 1px solid var(--header-line);
}

.panes {
  position: relative;
  flex: 1;
  min-height: 0;
}
.pane {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
}
.pane[hidden], .pane [hidden] { display: none; }
.pane-scroll { overflow-y: auto; overscroll-behavior: contain; }

.pane-head {
  flex: none;
  display: flex;
  align-items: center;
  gap: 8px;
  height: 44px;
  padding: 0 8px 0 16px;
  border-bottom: 1px solid var(--header-line);
  font-size: 14px;
  white-space: nowrap;
}
.pane-title { font-weight: 600; }
.pane-sub { color: var(--muted); overflow: hidden; text-overflow: ellipsis; }
.pane-sub::before { content: "\00b7"; margin-right: 8px; }
.pane-open {
  display: grid;
  place-items: center;
  flex: none;
  width: 32px;
  height: 32px;
  margin-left: auto;
  color: var(--muted);
  border-radius: 3px;
}
.pane-open:hover { color: #fff; background: rgba(255, 255, 255, 0.08); }

.pane-frame {
  flex: 1;
  display: block;
  width: 100%;
  min-height: 0;
  border: 0;
  background: var(--side-bg);
}

.pane-empty {
  margin: auto;
  padding: 24px;
  color: var(--muted);
  font-size: 15px;
  text-align: center;
}

/* Bible version switch */
.versions { display: inline-flex; gap: 2px; padding: 2px; margin-left: 4px; background: rgba(255, 255, 255, 0.06); border-radius: 3px; }
.versions button {
  padding: 4px 10px;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  border-radius: 2px;
}
.versions button[aria-pressed="true"] { color: #000; background: #fff; }

/* Tab bar */
.tabs {
  flex: none;
  display: flex;
  border-top: 1px solid var(--header-line);
  background: var(--side-bg);
  padding-bottom: env(safe-area-inset-bottom);
}
.tab {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  height: 64px;
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
}
.tab[hidden] { display: none; }
.tab:hover { color: #d6d6d9; }
.tab[aria-selected="true"] { color: #fff; font-weight: 700; box-shadow: inset 0 2px 0 #fff; }
.tab span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tab:focus-visible { outline-offset: -4px; }

/* Schedule */
.schedule { padding: 20px 16px 24px; }
.sched-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}
.sched-tz { color: var(--muted); font-weight: 500; text-transform: none; letter-spacing: 0; }
.sched-card {
  padding: 16px;
  background: var(--card-bg);
  border-radius: 4px;
}
.sched-card-title { font-size: 17px; font-weight: 700; }
.sched-card-when { margin-top: 2px; font-size: 14px; color: var(--muted); }
.sched-count {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 14px;
}
.sched-count div {
  padding: 10px 4px;
  text-align: center;
  background: var(--card-bg-2);
  border-radius: 3px;
}
.sched-count b { display: block; font-size: 18px; }
.sched-count span { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }
.sched-live {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  font-size: 13px;
  font-weight: 700;
  color: #ff4e45;
}
.sched-live i { width: 8px; height: 8px; border-radius: 2px; background: currentColor; animation: pulse 1.6s infinite; }
@keyframes pulse { 50% { opacity: 0.35; } }
.sched-day {
  margin: 24px 0 8px;
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}
.sched-list { display: grid; gap: 4px; }
.sched-list li {
  display: flex;
  align-items: baseline;
  gap: 14px;
  padding: 14px 16px;
  background: var(--card-bg);
  border-radius: 4px;
}
.sched-time { flex: none; min-width: 84px; font-weight: 700; }
.sched-name { min-width: 0; color: #d6d6d9; }
.sched-name small { display: block; margin-top: 2px; font-size: 12px; color: var(--muted); }

/* Notes (sermon notes for the service that's on) */
.notes { padding: 16px 16px 32px; }
.notes-top { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 16px; }
.notes-service { margin: 0; font-size: 13px; font-weight: 600; color: var(--muted); }
.notes-lang {
  display: inline-flex;
  padding: 2px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 3px;
}
.notes-lang button {
  padding: 5px 12px;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  border-radius: 2px;
}
.notes-lang button[aria-pressed="true"] { color: #000; background: #fff; }

.sermon + .sermon { margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--header-line); }
.sermon-speaker {
  margin: 0 0 4px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}
.sermon-title { margin: 0 0 12px; font-size: 18px; line-height: 1.3; font-weight: 700; }
.sermon-points .pt { display: flex; gap: 8px; margin: 0 0 8px; font-size: 15px; line-height: 1.45; }
.sermon-points .pt-num { flex: none; min-width: 1.6em; font-weight: 600; color: #c9c9d3; font-variant-numeric: tabular-nums; }
.sermon-points .pt-d1 { font-weight: 600; }
.sermon-points .pt-d2 { padding-left: 20px; }
.sermon-points .pt-d3 { padding-left: 40px; }
.sermon-points .pt-d2 .pt-num, .sermon-points .pt-d3 .pt-num { min-width: 2.2em; font-weight: 500; }

@media (max-width: 1100px) {
  :root { --side-w: 320px; }
}

/* ---------- Small screens ---------- */
@media (max-width: 760px) {
  :root { --header-h: 56px; }
  .menu-button { margin-right: -8px; }
  /* Only the first link stays in the bar, like the current site. */
  .nav-links li:not(:first-child) { display: none; }
  /* Sidebar goes under the video. */
  .stage { flex-direction: column; height: auto; overflow: visible; }
  .player-area { flex: none; }
  .player { width: 100%; }
  .sidebar {
    width: 100%;
    /* Fill the screen under the video, so the tab bar sits at the bottom. */
    height: max(360px, calc(100vh - var(--header-h) - 56.25vw));
    height: max(360px, calc(100dvh - var(--header-h) - 56.25vw));
    border-left: 0;
    border-top: 1px solid var(--header-line);
  }
  /* If the screen is too short for that, keep the tabs reachable while scrolling. */
  .tabs { position: sticky; bottom: 0; }
}
