/* css/use-aphasia.css
 * --------------------------------------------------------------------
 * Aphasia helper modal — high-frequency word picker for stroke
 * patients with word-finding deficit (anomic aphasia).
 *
 * Design principles:
 *   - Big targets (≥56×56 minimum, ≥72×72 preferred). Hemiparesis hits
 *     fine motor; thumbs and trembling pointers need wide hit areas.
 *   - High contrast on every tile. Black text on saturated backgrounds
 *     is the AAC industry standard (Fitzgerald Key); we'll need to
 *     re-test these specific bg→fg pairs against WCAG AA when Task #81
 *     lands the global tile palette decision. For now we use white text
 *     ONLY on darkened category bands (≥4.5:1).
 *   - Visual cluster grouping with the cluster's color as a band so a
 *     patient with visual neglect can find the same cluster again.
 *   - prefers-reduced-motion stops every transition; vestibular damage
 *     is common post-stroke.
 *
 * LABEL: PILOT-READY. Public-launch contrast pass blocked on Task #81.
 * -------------------------------------------------------------------- */

/* ── Trigger pill (mounted in topbar by use-aphasia-helper.js) ─────── */
.use-aphasia-pill {
  background: rgba(255,255,255,0.18);
  color: #fff;
  border: none;
  padding: 0.5rem 0.75rem;
  border-radius: 999px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  flex: 0 0 auto;
}
.use-aphasia-pill:active   { background: rgba(255,255,255,0.32); }
.use-aphasia-pill:focus    { outline: 3px solid #FFD54F; outline-offset: 2px; }

/* ── Modal scrim + dialog ─────────────────────────────────────────── */
.use-aphasia-scrim {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.55);
  z-index: 50;
  display: none;
  align-items: stretch;
  justify-content: center;
}
.use-aphasia-scrim.show { display: flex; }

.use-aphasia-modal {
  background: #fff;
  width: 100%;
  max-width: 720px;
  margin: auto;
  border-radius: 14px;
  box-shadow: 0 12px 40px rgba(0,0,0,0.35);
  display: flex;
  flex-direction: column;
  max-height: 90vh;
  overflow: hidden;
}

/* Header — title + close. Close is large and high-contrast because
 * a patient may lose track and want out fast. */
.use-aphasia-head {
  display: flex; align-items: center;
  padding: 0.75rem 1rem;
  background: #2E5090;
  color: #fff;
  border-bottom: 2px solid rgba(0,0,0,0.1);
}
.use-aphasia-title { flex: 1; font-size: 1.05rem; font-weight: 700; }
.use-aphasia-close {
  background: rgba(255,255,255,0.22);
  color: #fff;
  border: none;
  width: 44px; height: 44px;
  border-radius: 50%;
  font-size: 1.4rem; font-weight: 700;
  cursor: pointer;
}
.use-aphasia-close:active { background: rgba(255,255,255,0.4); }
.use-aphasia-close:focus  { outline: 3px solid #FFD54F; outline-offset: 2px; }

/* Cluster chips — horizontal scroll on narrow viewports. Each chip is
 * tinted with the cluster color; .selected gets a thicker border. */
.use-aphasia-chips {
  display: flex;
  flex-wrap: nowrap;
  overflow-x: auto;
  gap: 0.5rem;
  padding: 0.6rem 0.75rem;
  background: #f4f4f6;
  border-bottom: 1px solid rgba(0,0,0,0.08);
  -webkit-overflow-scrolling: touch;
}
.use-aphasia-chip {
  flex: 0 0 auto;
  background: #fff;
  border: 2px solid rgba(0,0,0,0.12);
  color: #1a1a2e;
  padding: 0.55rem 0.9rem;
  border-radius: 999px;
  font-size: 0.95rem; font-weight: 600;
  cursor: pointer;
  display: inline-flex; align-items: center; gap: 0.35rem;
  white-space: nowrap;
  min-height: 44px;
}
.use-aphasia-chip[aria-pressed="true"] {
  /* Use the cluster's DARK shade (set via --c-dark) so white text hits
   * WCAG AA (4.5:1+). The bright --c color alone fails on the lighter
   * Material shades (e.g. #4CAF50 green = 2.77:1 with white text).
   * Tracked: this kept regressing without an axe gate. */
  background: var(--c-dark, var(--c, #1A2E50));
  color: #fff;
  border-color: var(--c-dark, var(--c, #1A2E50));
}
.use-aphasia-chip:focus { outline: 3px solid #FFD54F; outline-offset: 2px; }

/* Word grid — auto-fit big tiles. Cluster color shows as a 4px top
 * stripe so the visual category-binding is preserved without making
 * the whole tile a low-contrast pastel. */
.use-aphasia-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(132px, 1fr));
  gap: 0.65rem;
  padding: 0.85rem;
  overflow-y: auto;
  flex: 1;
  -webkit-overflow-scrolling: touch;
}
.use-aphasia-word {
  background: #fff;
  border: 2px solid rgba(0,0,0,0.1);
  border-top: 6px solid var(--c, #2E5090);
  border-radius: 12px;
  padding: 0.85rem 0.5rem;
  text-align: center;
  cursor: pointer;
  font-size: 1rem;
  font-weight: 600;
  color: #1a1a2e;
  min-height: 96px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 0.35rem;
  transition: transform 80ms ease, box-shadow 120ms ease;
}
.use-aphasia-word:active {
  transform: scale(0.97);
  box-shadow: inset 0 0 0 3px var(--c, #2E5090);
}
.use-aphasia-word:focus { outline: 3px solid #FFD54F; outline-offset: 2px; }
.use-aphasia-word .emoji { font-size: 2rem; line-height: 1; }
.use-aphasia-word .label { font-size: 0.95rem; line-height: 1.2; }

/* Loading + error states. */
.use-aphasia-empty {
  padding: 2rem 1rem;
  text-align: center;
  color: #555;
  font-size: 0.95rem;
}

/* Reduced motion — kill transforms + transitions for vestibular safety. */
@media (prefers-reduced-motion: reduce) {
  .use-aphasia-word { transition: none; }
  .use-aphasia-word:active { transform: none; }
}

/* Small viewports — stretch full-screen on phones for thumb reach. */
@media (max-width: 480px) {
  .use-aphasia-modal { border-radius: 0; max-height: 100vh; }
  .use-aphasia-grid { grid-template-columns: repeat(2, 1fr); }
  .use-aphasia-word { min-height: 110px; }
}
