/* SermonSearch — web UI */

:root {
  --bg: #f7f5f0;
  --card: #ffffff;
  --ink: #1c1917;
  --muted: #6b6459;
  --line: #e5e0d5;
  --accent: #2563eb;
  --accent-soft: #dbeafe;
  --player-bg: #1c1917;
  --player-ink: #fafaf9;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  /* keep the player bar from covering content */
  padding-bottom: 92px;
}

.wrap {
  max-width: 860px;
  margin: 0 auto;
  padding: 0 20px;
}

/* ---------- header ---------- */

.site-header {
  background: var(--card);
  border-bottom: 1px solid var(--line);
  padding: 22px 0 18px;
  margin-bottom: 28px;
}

.site-header h1 {
  margin: 0;
  font-size: 26px;
  letter-spacing: -0.02em;
}

.site-header h1 a { color: inherit; text-decoration: none; }

.tagline {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 14px;
}

/* ---------- search form ---------- */

.search-form { margin-bottom: 26px; }

.search-row { display: flex; gap: 10px; }

.search-row input[type="text"] {
  flex: 1;
  padding: 12px 14px;
  font-size: 16px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--card);
}

.search-row input[type="text"]:focus {
  outline: 2px solid var(--accent);
  outline-offset: -1px;
  border-color: var(--accent);
}

.search-row button {
  padding: 12px 22px;
  font-size: 16px;
  font-weight: 600;
  color: #fff;
  background: var(--accent);
  border: none;
  border-radius: 10px;
  cursor: pointer;
}

.search-row button:hover { background: #1d4ed8; }

.sermon-filter {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  font-size: 13px;
}

.sermon-filter input {
  margin-left: 6px;
  padding: 4px 8px;
  font-size: 13px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--card);
}

/* ---------- notices ---------- */

.notice {
  padding: 12px 16px;
  border-radius: 10px;
  background: var(--card);
  border: 1px solid var(--line);
  color: var(--muted);
}

.notice.error {
  border-color: #fecaca;
  background: #fef2f2;
  color: #991b1b;
}

.result-count { color: var(--muted); font-size: 14px; margin: 0 0 12px; }

/* ---------- results ---------- */

.results {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 14px;
}

.result {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px 18px 14px;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s;
}

.result:hover {
  border-color: var(--accent);
  box-shadow: 0 2px 10px rgba(37, 99, 235, 0.08);
  transform: translateY(-1px);
}

.result:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.result.active {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.result.no-audio { cursor: default; }
.result.no-audio:hover { transform: none; box-shadow: none; }

.result-head {
  display: flex;
  align-items: baseline;
  gap: 12px;
  flex-wrap: wrap;
}

.result-head h3 {
  margin: 0;
  font-size: 17px;
  letter-spacing: -0.01em;
}

.result-head .date { color: var(--muted); font-weight: 400; }

.ts-badge {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 13px;
  font-weight: 600;
  color: var(--accent);
  background: var(--accent-soft);
  padding: 2px 8px;
  border-radius: 6px;
  white-space: nowrap;
}

.meta { margin: 6px 0 0; color: var(--muted); font-size: 13.5px; }

.excerpt {
  margin: 10px 0 0;
  font-size: 14.5px;
  color: #44403c;
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.play-hint {
  margin: 10px 0 0;
  font-size: 13px;
  font-weight: 600;
  color: var(--accent);
}

.result.no-audio .play-hint { color: var(--muted); font-weight: 400; }

.yt-line { margin: 2px 0 0; }

.yt-link {
  font-size: 13px;
  color: var(--muted);
  text-decoration: none;
}

.yt-link:hover { color: var(--accent); text-decoration: underline; }

/* ---------- player bar ---------- */

.player {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  background: var(--player-bg);
  color: var(--player-ink);
  box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.25);
}

.player-inner {
  display: flex;
  align-items: center;
  gap: 14px;
  padding-top: 12px;
  padding-bottom: 12px;
}

#play-pause {
  width: 40px; height: 40px;
  flex: none;
  border: none;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-size: 13px;
  cursor: pointer;
}

#play-pause:hover { background: #1d4ed8; }

.now-playing {
  flex: none;
  width: 260px;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

#np-title {
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#np-range { font-size: 12px; }

/* The bar itself is a tall, easy-to-hit target; the slim visible track is
   drawn centered inside it (via ::before) so the touch area is big but the
   look stays thin. Scrub math only reads clientX, so height is free to grow. */
.seekbar {
  --track-h: 8px;
  position: relative;
  flex: 1;
  height: 28px;
  cursor: pointer;
  touch-action: none; /* allow drag-to-scrub on touch devices */
}

.seekbar::before {
  content: "";
  position: absolute;
  left: 0; right: 0; top: 50%;
  height: var(--track-h);
  transform: translateY(-50%);
  border-radius: calc(var(--track-h) / 2);
  background: #44403c;
}

.section-marker {
  position: absolute;
  top: 50%;
  height: var(--track-h);
  transform: translateY(-50%);
  background: rgba(251, 191, 36, 0.35);
  border-radius: calc(var(--track-h) / 2);
}

.seek-fill {
  position: absolute;
  top: 50%; left: 0;
  height: var(--track-h);
  transform: translateY(-50%);
  width: 0;
  background: var(--accent);
  border-radius: calc(var(--track-h) / 2);
}

.time { flex: none; font-size: 12.5px; font-variant-numeric: tabular-nums; }

#stop-btn {
  flex: none;
  width: 30px; height: 30px;
  border: 1px solid #57534e;
  border-radius: 50%;
  background: transparent;
  color: var(--player-ink);
  font-size: 12px;
  cursor: pointer;
}

#stop-btn:hover { border-color: var(--player-ink); }

.muted { opacity: 0.65; }

@media (max-width: 640px) {
  .now-playing { width: auto; flex: 1; }
  .time { display: none; }

  /* Bigger scrubber target, and lift the player off the screen edge into a
     floating bar so there's room to grab it with a thumb. */
  body { padding-bottom: 104px; }
  .seekbar { height: 44px; --track-h: 10px; }
  .player {
    left: 12px; right: 12px; bottom: 12px;
    border-radius: 14px;
    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.35);
  }
}
