/* rcd-video-ask.css -- "Zeptat se rava" on any rabbi video lesson.
 *
 * Elderly-friendly: a BIG always-reachable "?" control, a BIG "> Pokracovat",
 * generous hit targets (>=56px), large type, no hover-only affordances.
 * Theme-aware: the platform default is the cosmic NIGHT look (base tokens);
 * [data-theme="dawn"] is the light variant (rlp-theme.js stamps the root).
 * RTL-safe: the panel sets dir, and we use logical inset properties with a
 * physical fallback for older mobile Safari.
 */

:root {
  --rcd-va-bg: #10131f;
  --rcd-va-card: #171b2b;
  --rcd-va-ink: #f2f0ea;
  --rcd-va-muted: #a5adc4;
  --rcd-va-line: rgba(255, 255, 255, 0.14);
  --rcd-va-gold: #d9b45b;
  --rcd-va-gold-ink: #1a1608;
  --rcd-va-go: #2e8b57;
}

:root[data-theme="dawn"] {
  --rcd-va-bg: #f6f2e9;
  --rcd-va-card: #fffdf7;
  --rcd-va-ink: #23201a;
  --rcd-va-muted: #6b6558;
  --rcd-va-line: rgba(0, 0, 0, 0.14);
  --rcd-va-gold: #a8791f;
  --rcd-va-gold-ink: #fffdf7;
  --rcd-va-go: #1f6b41;
}

/* ------------------------------------------------------------- the "?" FAB */
/* NB: an explicit `display` beats the UA [hidden] rule, so [hidden] must be
   re-asserted here -- otherwise the FAB stays visible behind the open panel. */
.rcd-va-fab[hidden] { display: none !important; }
.rcd-va-fab {
  position: fixed;
  bottom: calc(18px + env(safe-area-inset-bottom, 0px));
  inset-inline-end: 18px;
  right: 18px;                       /* fallback for no-logical-props */
  z-index: 2147482000;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 60px;
  padding: 0 22px 0 16px;
  border: 2px solid var(--rcd-va-gold);
  border-radius: 999px;
  background: var(--rcd-va-gold);
  color: var(--rcd-va-gold-ink);
  font: 700 18px/1.1 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  cursor: pointer;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.38);
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
.rcd-va-fab:active { transform: translateY(1px); }
.rcd-va-fab:focus-visible { outline: 3px solid var(--rcd-va-ink); outline-offset: 3px; }
.rcd-va-fab__q {
  display: inline-grid;
  place-items: center;
  width: 34px; height: 34px;
  border-radius: 50%;
  background: var(--rcd-va-gold-ink);
  color: var(--rcd-va-gold);
  font-size: 22px; font-weight: 800;
}
[dir="rtl"] .rcd-va-fab { padding: 0 16px 0 22px; }
@media (max-width: 420px) {
  .rcd-va-fab__txt { display: none; }        /* just the big "?" on small phones */
  .rcd-va-fab { padding: 0 14px; min-width: 60px; justify-content: center; }
}

/* ------------------------------------------------------------- the panel */
.rcd-va[hidden] { display: none; }
.rcd-va {
  position: fixed;
  inset: 0;
  z-index: 2147483000;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
@media (min-width: 700px) { .rcd-va { align-items: center; } }

.rcd-va__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.66);
  backdrop-filter: blur(2px);
}

.rcd-va__card {
  position: relative;
  width: min(680px, 100%);
  max-height: 88vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 18px 18px calc(18px + env(safe-area-inset-bottom, 0px));
  background: var(--rcd-va-card);
  color: var(--rcd-va-ink);
  border: 1px solid var(--rcd-va-line);
  border-radius: 20px 20px 0 0;
  box-shadow: 0 -12px 40px rgba(0, 0, 0, 0.45);
  font: 400 17px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
@media (min-width: 700px) {
  .rcd-va__card { border-radius: 20px; box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5); }
}

/* --- head: the small picture of the rabbi, listening --- */
.rcd-va__head { display: flex; align-items: center; gap: 14px; }
.rcd-va__avatar {
  width: 68px; height: 68px;
  flex: 0 0 68px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--rcd-va-gold);
  background: var(--rcd-va-bg);
}
.rcd-va__avatar--ph {
  display: grid; place-items: center;
  color: var(--rcd-va-gold);
  font-size: 15px; font-weight: 700;
}
.rcd-va__who { flex: 1 1 auto; min-width: 0; }
.rcd-va__name { font-size: 19px; font-weight: 700; }
.rcd-va__at { font-size: 15px; color: var(--rcd-va-muted); }
.rcd-va__x {
  flex: 0 0 auto;
  width: 44px; height: 44px;
  border: 0; border-radius: 50%;
  background: transparent;
  color: var(--rcd-va-muted);
  font-size: 30px; line-height: 1;
  cursor: pointer;
}

/* --- body --- */
.rcd-va__body { display: flex; flex-direction: column; gap: 12px; }

.rcd-va__state {
  padding: 12px 14px;
  border-radius: 12px;
  background: color-mix(in srgb, var(--rcd-va-gold) 14%, transparent);
  border: 1px solid var(--rcd-va-line);
  font-size: 17px;
  font-weight: 600;
}
.rcd-va__state.is-busy::after {
  content: "";
  display: inline-block;
  width: 1.1em;
  text-align: start;
  animation: rcd-va-dots 1.2s steps(4, end) infinite;
}
@keyframes rcd-va-dots {
  0%   { content: ""; }
  25%  { content: "."; }
  50%  { content: ".."; }
  75%  { content: "..."; }
}
@media (prefers-reduced-motion: reduce) {
  .rcd-va__state.is-busy::after { animation: none; content: "..."; }
}

.rcd-va__answer {
  padding: 14px 16px;
  border-radius: 12px;
  border: 1px solid var(--rcd-va-line);
  background: color-mix(in srgb, var(--rcd-va-ink) 5%, transparent);
  font-size: 18px;
  line-height: 1.65;
  white-space: pre-wrap;
}

.rcd-va__audio { width: 100%; }

.rcd-va__cites { font-size: 14px; color: var(--rcd-va-muted); }
.rcd-va__cites-h { font-weight: 700; margin-bottom: 4px; }
.rcd-va__cites ul { margin: 0; padding-inline-start: 18px; padding-left: 18px; }
.rcd-va__cites li { margin: 2px 0; }
.rcd-va__kind { opacity: 0.75; }

.rcd-va__input {
  width: 100%;
  box-sizing: border-box;
  padding: 14px;
  border-radius: 12px;
  border: 1px solid var(--rcd-va-line);
  background: var(--rcd-va-bg);
  color: var(--rcd-va-ink);
  font: inherit;
  font-size: 18px;
  resize: vertical;
}
.rcd-va__input::placeholder { color: var(--rcd-va-muted); }

/* --- actions: big, thumb-reachable --- */
.rcd-va__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.rcd-va__btn {
  flex: 1 1 auto;
  min-height: 56px;
  padding: 0 18px;
  border-radius: 14px;
  border: 2px solid var(--rcd-va-line);
  background: transparent;
  color: var(--rcd-va-ink);
  font: 700 18px/1.2 inherit;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
.rcd-va__btn:disabled { opacity: 0.5; cursor: default; }
.rcd-va__btn--send {
  background: var(--rcd-va-gold);
  border-color: var(--rcd-va-gold);
  color: var(--rcd-va-gold-ink);
}
.rcd-va__btn--resume {
  flex: 1 1 100%;
  background: var(--rcd-va-go);
  border-color: var(--rcd-va-go);
  color: #fff;
  min-height: 60px;
  font-size: 20px;
}
.rcd-va__btn--mic.is-rec {
  background: #b03a3a;
  border-color: #b03a3a;
  color: #fff;
  animation: rcd-va-pulse 1.1s ease-in-out infinite;
}
@keyframes rcd-va-pulse { 50% { opacity: 0.72; } }
@media (prefers-reduced-motion: reduce) {
  .rcd-va__btn--mic.is-rec { animation: none; }
}

/* while the rav is being asked, the page behind must not scroll away */
body.rcd-va-open { overflow: hidden; }
