/* ============================================================
   CommentaryQueue — visual identity

   Concept: an old broadcast pulpit / reel-to-reel tape deck.
   Warm walnut cabinet, brass dials and toggle switches, a tape
   counter in mono digits. The signature element is the spinning
   reel indicator on the now-playing panel and the brass flip
   switches used for toggling pastors on/off (not checkboxes).
   ============================================================ */

:root {
  --walnut-950: #1c1512;   /* cabinet background */
  --walnut-900: #241b17;   /* panel */
  --walnut-800: #2f241e;   /* card / row */
  --walnut-700: #3d2f27;   /* hairline / border */
  --ivory: #ede3d0;        /* primary text */
  --ivory-dim: #b7a992;    /* secondary text */
  --brass: #c9a227;        /* accent — switches, active state, dial */
  --brass-dim: #8a6f1f;
  --rust: #b5482f;         /* now-playing / record indicator */
  --sage: #6b8f71;         /* subtle confirmation / connected state */

  --font-display: "Fraunces", Georgia, serif;
  --font-body: "IBM Plex Sans", -apple-system, sans-serif;
  --font-mono: "IBM Plex Mono", monospace;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--walnut-950);
  background-image:
    radial-gradient(circle at 15% 8%, rgba(201,162,39,0.05), transparent 40%),
    radial-gradient(circle at 85% 92%, rgba(181,72,47,0.04), transparent 45%);
  color: var(--ivory);
  font-family: var(--font-body);
  min-height: 100vh;
  padding: 0 0 4rem;
}

.cabinet {
  max-width: 640px;
  margin: 0 auto;
  padding: 2.5rem 1.25rem 0;
}

/* -------- Header / tuner -------- */

.tuner {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.25rem;
}

.wordmark {
  font-family: var(--font-display);
  font-weight: 600;
  font-style: italic;
  font-size: 1.5rem;
  color: var(--brass);
  letter-spacing: 0.01em;
}

.wordmark span { color: var(--ivory); font-style: normal; }

.tuner-readout {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--ivory-dim);
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.picker-panel {
  background: var(--walnut-900);
  border: 1px solid var(--walnut-700);
  border-radius: 4px;
  padding: 1.1rem 1.1rem 1.3rem;
  margin: 1.5rem 0;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.02);
}

.picker-label {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ivory-dim);
  margin-bottom: 0.5rem;
  display: block;
}

.picker-row {
  display: flex;
  gap: 0.6rem;
}

.picker-row select {
  flex: 1;
  background: var(--walnut-950);
  border: 1px solid var(--walnut-700);
  color: var(--ivory);
  font-family: var(--font-mono);
  font-size: 1rem;
  padding: 0.65rem 0.7rem;
  border-radius: 3px;
  appearance: none;
}

.picker-row select:focus {
  outline: 2px solid var(--brass);
  outline-offset: 1px;
}

/* -------- Pastor list / brass toggle switches -------- */

.section-label {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ivory-dim);
  margin: 2rem 0 0.75rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.pastor-row {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.85rem 0.9rem;
  background: var(--walnut-800);
  border: 1px solid var(--walnut-700);
  border-radius: 4px;
  margin-bottom: 0.5rem;
}

.switch {
  position: relative;
  width: 40px;
  height: 22px;
  flex-shrink: 0;
  background: var(--walnut-950);
  border: 1px solid var(--walnut-700);
  border-radius: 11px;
  cursor: pointer;
  transition: background 0.15s ease;
}

.switch[aria-checked="true"] {
  background: linear-gradient(180deg, var(--brass), var(--brass-dim));
  border-color: var(--brass);
}

.switch::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--ivory-dim);
  transition: transform 0.15s ease, background 0.15s ease;
}

.switch[aria-checked="true"]::after {
  transform: translateX(18px);
  background: var(--walnut-950);
}

.pastor-info { flex: 1; min-width: 0; }

.pastor-name {
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--ivory);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pastor-meta {
  font-size: 0.78rem;
  color: var(--ivory-dim);
  margin-top: 0.1rem;
}

.pastor-duration {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: var(--ivory-dim);
  flex-shrink: 0;
}

.source-pill {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 0.15rem 0.4rem;
  border-radius: 2px;
  border: 1px solid var(--walnut-700);
  color: var(--ivory-dim);
  margin-left: 0.4rem;
}

.source-pill.tts { color: var(--sage); border-color: var(--sage); }

/* -------- Play button -------- */

.play-bar {
  margin-top: 1.5rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.play-button {
  flex: 1;
  background: var(--rust);
  color: var(--ivory);
  border: none;
  border-radius: 4px;
  padding: 0.9rem;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  cursor: pointer;
  transition: filter 0.15s ease;
}

.play-button:hover { filter: brightness(1.12); }
.play-button:disabled { background: var(--walnut-700); color: var(--ivory-dim); cursor: not-allowed; }

/* -------- Now playing panel (signature element) -------- */

.now-playing {
  margin-top: 2rem;
  background: var(--walnut-900);
  border: 1px solid var(--walnut-700);
  border-radius: 4px;
  padding: 1.25rem;
  display: none;
  flex-direction: column;
  gap: 0.9rem;
}

.now-playing.active { display: flex; }

.now-playing-top {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.reel {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  border: 3px solid var(--brass-dim);
  position: relative;
  flex-shrink: 0;
  animation: spin 3s linear infinite;
}

.reel.paused { animation-play-state: paused; }

.reel::before, .reel::after {
  content: "";
  position: absolute;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--brass);
  top: 50%; left: 50%;
}

.reel::before { transform: translate(-50%, -50%) translateX(14px); }
.reel::after { transform: translate(-50%, -50%) translateX(-14px); }

@keyframes spin { to { transform: rotate(360deg); } }

@media (prefers-reduced-motion: reduce) {
  .reel { animation: none; }
}

.now-playing-info { flex: 1; min-width: 0; }

.now-playing-track {
  font-weight: 600;
  font-size: 0.95rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.now-playing-meta {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--ivory-dim);
  margin-top: 0.2rem;
}

.now-playing-next {
  font-size: 0.72rem;
  color: var(--ivory-dim);
  margin-top: 0.3rem;
}

/* -------- Seek bar (shared by both players) -------- */

.seek-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.seek-time {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: var(--ivory-dim);
  min-width: 2.6rem;
  flex-shrink: 0;
}

.seek-time.end { text-align: right; }

.seek-bar {
  flex: 1;
  -webkit-appearance: none;
  appearance: none;
  height: 4px;
  border-radius: 2px;
  background: var(--walnut-700);
  cursor: pointer;
  outline: none;
}

.seek-bar::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: var(--brass);
  border: 2px solid var(--walnut-950);
  cursor: pointer;
  margin-top: -1px;
}

.seek-bar::-moz-range-thumb {
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: var(--brass);
  border: 2px solid var(--walnut-950);
  cursor: pointer;
}

.seek-bar::-webkit-slider-runnable-track {
  height: 4px;
  border-radius: 2px;
  background: var(--walnut-700);
}

/* -------- Transport controls (shared by both players) -------- */

.player-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
}

.transport-btn {
  background: var(--walnut-950);
  border: 1px solid var(--walnut-700);
  color: var(--ivory);
  border-radius: 4px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  transition: border-color 0.15s ease, color 0.15s ease;
}

.transport-btn:hover:not(:disabled) { border-color: var(--brass); color: var(--brass); }
.transport-btn:disabled { opacity: 0.35; cursor: not-allowed; }

.transport-btn.skip {
  width: 40px;
  height: 34px;
  font-size: 0.68rem;
}

.transport-btn.track {
  width: 34px;
  height: 34px;
  font-size: 0.85rem;
}

.transport-btn.play-pause {
  width: 52px;
  height: 44px;
  font-size: 1.1rem;
  background: var(--rust);
  border-color: var(--rust);
  color: var(--ivory);
}

.transport-btn.play-pause:hover:not(:disabled) {
  filter: brightness(1.12);
  border-color: var(--rust);
  color: var(--ivory);
}

/* -------- Site footer (cross-link to sibling apps) -------- */

.site-footer {
  margin-top: 3rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--walnut-700);
  font-size: 0.78rem;
  color: var(--ivory-dim);
  text-align: center;
}

.site-footer a {
  color: var(--brass);
  text-decoration: none;
  border-bottom: 1px solid var(--brass-dim);
}

.site-footer a:hover { color: var(--ivory); border-color: var(--ivory); }

.empty-state {
  color: var(--ivory-dim);
  font-size: 0.9rem;
  padding: 2rem 0.5rem;
  text-align: center;
}

.nav-link {
  color: var(--ivory-dim);
  text-decoration: none;
  border-bottom: 1px solid var(--walnut-700);
  padding-bottom: 0.15rem;
}

.nav-link:hover { color: var(--brass); border-color: var(--brass); }

/* -------- Course library -------- */

.course-card {
  display: block;
  background: var(--walnut-800);
  border: 1px solid var(--walnut-700);
  border-radius: 4px;
  padding: 1rem 1.1rem;
  margin-bottom: 0.75rem;
  text-decoration: none;
  color: inherit;
  transition: border-color 0.15s ease;
}

.course-card:hover { border-color: var(--brass-dim); }

.course-title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.1rem;
  color: var(--ivory);
}

.course-preacher {
  font-size: 0.82rem;
  color: var(--ivory-dim);
  margin-top: 0.15rem;
}

.progress-track {
  height: 6px;
  background: var(--walnut-950);
  border-radius: 3px;
  margin-top: 0.7rem;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--brass-dim), var(--brass));
  border-radius: 3px;
}

.progress-label {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--ivory-dim);
  margin-top: 0.35rem;
}

/* -------- Course detail / lesson list -------- */

.resume-banner {
  background: var(--walnut-900);
  border: 1px solid var(--brass-dim);
  border-radius: 4px;
  padding: 0.9rem 1.1rem;
  margin-bottom: 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.resume-banner-text { font-size: 0.85rem; }
.resume-banner-text strong { color: var(--brass); }

.resume-button {
  background: var(--brass);
  color: var(--walnut-950);
  border: none;
  border-radius: 3px;
  padding: 0.5rem 0.85rem;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  cursor: pointer;
  white-space: nowrap;
}

.lesson-row {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  padding: 0.75rem 0.9rem;
  background: var(--walnut-800);
  border: 1px solid var(--walnut-700);
  border-radius: 4px;
  margin-bottom: 0.45rem;
  cursor: pointer;
}

.lesson-row.playing { border-color: var(--rust); }

.lesson-check {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
  border-radius: 50%;
  border: 1px solid var(--walnut-700);
  background: var(--walnut-950);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  color: transparent;
}

.lesson-check.done {
  background: var(--sage);
  border-color: var(--sage);
  color: var(--walnut-950);
}

.lesson-number {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--ivory-dim);
  width: 1.8rem;
  flex-shrink: 0;
}

.lesson-info { flex: 1; min-width: 0; }

.lesson-title {
  font-size: 0.92rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.lesson-sub {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--ivory-dim);
  margin-top: 0.1rem;
}

.mini-player {
  position: sticky;
  bottom: 0;
  margin-top: 1.5rem;
  background: var(--walnut-900);
  border: 1px solid var(--walnut-700);
  border-radius: 4px;
  padding: 1rem 1.1rem;
  display: none;
  flex-direction: column;
  gap: 0.9rem;
}

.mini-player.active { display: flex; }
