/*
 * requests/requests.css — styles for the "בקשות תמונה" photo-request tile.
 *
 * Self-contained: every selector is prefixed `rq-` (or scoped under
 * .app--requests / html[data-game="requests"]). Reuses the shared design
 * tokens but overrides nothing in shared/style.css.
 */

html[data-game="requests"] {
  --accent:  #2c8f6b;   /* emerald — "go / voice"; distinct from config's blue */
  --bg-deep: #cfe8dd;
}

.app--requests {
  height: auto;
  min-height: 100dvh;
  max-width: 720px;
  margin: 0 auto;
  padding: 8px 14px calc(24px + env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.header--bare { margin-bottom: 2px; }

/* ── Mic + multi-line field + controls ────────────────────────────────────── */
.rq-mic-row {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
  background: var(--card);
  border-radius: 22px;
  padding: 12px;
  box-shadow: 0 6px 18px -8px rgba(43, 33, 24, .5);
  transition: background .2s;
}
/* While recording, the whole field warms slightly — a second "live" cue
   beyond the depleting bar. */
.rq-mic-row[data-recording="1"] {
  background: color-mix(in oklch, #d6515a 8%, var(--card));
}

.rq-input {
  width: 100%;
  min-height: 4.4em;          /* ~3 lines visible at rest (#131 step 2) */
  max-height: 9em;            /* grows to ~4–5 lines, then scrolls */
  resize: none;
  border: 0;
  background: transparent;
  outline: none;
  font-family: var(--ui-font);
  font-size: clamp(16px, 4.4vw, 20px);
  line-height: 1.35;
  color: var(--ink);
}

/* Vanishing-time bar — drains from full to empty over the recording cap. */
.rq-timer {
  height: 6px;
  border-radius: 999px;
  background: color-mix(in oklch, var(--ink) 10%, var(--card));
  overflow: hidden;
  opacity: 0;
  transition: opacity .2s;
}
.rq-timer[data-on="1"] { opacity: 1; }
.rq-timer__fill {
  height: 100%;
  width: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #d6515a, var(--accent));
}
.rq-timer[data-on="1"] .rq-timer__fill {
  animation-name: rq-deplete;
  animation-timing-function: linear;
  animation-fill-mode: forwards;
  /* animation-duration is set inline (= RECORD_LIMIT_MS) so JS owns the cap. */
}
@keyframes rq-deplete { from { width: 100%; } to { width: 0%; } }

.rq-controls {
  display: flex;
  align-items: center;
  justify-content: center;     /* one big mic (idle) or send+cancel (active) */
  gap: 28px;
  min-height: 88px;            /* reserve the mic's height so the row doesn't jump */
}
.rq-mic {
  flex: 0 0 auto;
  width: 88px; height: 88px;          /* big, primary call-to-action */
  border: 0;
  border-radius: 50%;
  cursor: pointer;
  background: var(--accent);
  color: #fff;
  display: grid; place-items: center;
  box-shadow: 0 6px 18px -5px rgba(43, 33, 24, .6);
  touch-action: manipulation;
  transition: transform .1s, background .15s;
}
.rq-mic svg { width: 44px; height: 44px; }
.rq-mic:active { transform: scale(.94); }
.rq-mic[data-on="1"] {
  background: #d6515a;                 /* recording — warm red */
  animation: rq-mic-pulse 1s ease-in-out infinite;
}
/* Stop glyph (white rounded square) shown while recording. */
.rq-mic__stop {
  width: 22px; height: 22px;
  border-radius: 5px;
  background: #fff;
}
@keyframes rq-mic-pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.08); } }

/* Restart (left) + send/release (right) flank the mic. */
.rq-ctl {
  flex: 0 0 auto;
  width: 48px; height: 48px;
  border: 0;
  border-radius: 50%;
  cursor: pointer;
  display: grid; place-items: center;
  box-shadow: 0 2px 8px -3px rgba(43, 33, 24, .4);
  touch-action: manipulation;
  transition: transform .1s, opacity .15s, filter .15s;
}
.rq-ctl svg { width: 24px; height: 24px; }
.rq-ctl:active { transform: scale(.93); }
.rq-ctl--cancel { background: #d6515a; color: #fff; }   /* stop = red X */
.rq-ctl--send   { background: var(--good); color: #fff; } /* commit = green */
/* Send is the primary action → bigger than cancel (continuation convention). */
.rq-ctl--lg { width: 68px; height: 68px; box-shadow: 0 5px 16px -5px rgba(43,33,24,.55); }
.rq-ctl--lg svg { width: 32px; height: 32px; }
.rq-ctl:disabled { opacity: .4; cursor: default; filter: grayscale(.4); }

/* ── Request list + cards ─────────────────────────────────────────────────── */
.rq-list {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: clamp(10px, 3vw, 16px);
}
@media (min-width: 560px) { .rq-list { grid-template-columns: repeat(3, 1fr); } }

.rq-card {
  position: relative;
  background: var(--card);
  border-radius: 18px;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  box-shadow:
    0 1px 0 rgba(255,255,255,.9) inset,
    0 10px 22px -14px rgba(43, 33, 24, .3);
}
.rq-card[data-status="pending"] { opacity: .92; }

.rq-card__main {
  appearance: none;
  border: 0;
  background: transparent;
  cursor: pointer;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  text-align: center;
  touch-action: manipulation;
}

.rq-card__photo {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 13px;
  overflow: hidden;
  background: color-mix(in oklch, var(--accent) 10%, var(--bg));
  display: grid;
  place-items: center;
}
.rq-card__photo img { width: 100%; height: 100%; object-fit: contain; display: block; }

/* Pending placeholder — dimmed hourglass on a hatched feel. */
.rq-card__pending {
  width: 46%;
  color: color-mix(in oklch, var(--accent) 55%, var(--ink));
  opacity: .7;
}
.rq-card__pending svg { width: 100%; height: 100%; }
.rq-card[data-status="pending"] .rq-card__photo {
  background: repeating-linear-gradient(
    45deg,
    color-mix(in oklch, var(--ink) 5%, var(--bg)),
    color-mix(in oklch, var(--ink) 5%, var(--bg)) 8px,
    color-mix(in oklch, var(--ink) 9%, var(--bg)) 8px,
    color-mix(in oklch, var(--ink) 9%, var(--bg)) 16px
  );
}

/* Status badge, top corner of the photo. */
.rq-card__badge {
  position: absolute;
  top: 6px; inset-inline-end: 6px;
  width: 28px; height: 28px;
  border-radius: 50%;
  display: grid; place-items: center;
  box-shadow: 0 2px 6px -2px rgba(43,33,24,.5);
}
.rq-card__badge svg { width: 18px; height: 18px; }
.rq-card__badge--ready   { background: var(--good); }
.rq-card__badge--pending { background: color-mix(in oklch, var(--ink) 45%, #b88a2e); }

/* Transcript — hidden until the card is pressed ("press and see text"). */
.rq-card__text {
  font-family: var(--ui-font);
  font-weight: 700;
  font-size: clamp(14px, 3.6vw, 17px);
  color: var(--ink);
  line-height: 1.25;
  white-space: pre-wrap;     /* multi-line requests render across lines */
  word-break: break-word;
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  transition: max-height .25s ease, opacity .2s ease, padding .2s ease;
}
.rq-card__text[data-show="1"] {
  max-height: 12em;
  overflow-y: auto;
  opacity: 1;
  padding-top: 2px;
}

/* Replay — separate hit target, bottom of the card. */
.rq-card__replay {
  align-self: stretch;
  appearance: none;
  border: 0;
  cursor: pointer;
  display: grid;
  place-items: center;
  height: 40px;
  border-radius: 12px;
  background: color-mix(in oklch, var(--accent) 14%, var(--card));
  color: var(--accent);
  box-shadow: 0 2px 8px -4px rgba(43,33,24,.35);
  touch-action: manipulation;
  transition: transform .1s, background .15s;
}
.rq-card__replay svg { width: 24px; height: 24px; }
.rq-card__replay:active { transform: scale(.96); background: color-mix(in oklch, var(--accent) 22%, var(--card)); }

@media (prefers-reduced-motion: reduce) {
  .rq-mic, .rq-mic-row, .rq-ctl, .rq-card__main, .rq-card__replay, .rq-card__text { transition: none; }
  .rq-mic[data-on="1"] { animation: none; }
  /* The timer still depletes (it conveys remaining time, not decoration) but
     without easing it reads as a plain shrink — acceptable under reduced
     motion since it carries information. */
}
