/* pro-speak-stories-story.css — 042026.1.67 */
/* [g67 Session 63 — Batch 7 Part D] L10-2 Phase 2 token migration —
   Pro-Speak-Stories Story mode. Replaced hard-coded text/bg hex values
   with shared design-token references so HC mode flips automatically
   via the token-swap layer in jhacal-design-tokens.css (no new
   !important rules needed):
     #7d8590 → var(--text-3)   (tertiary text / labels / hints)
     #b9c0c7 → var(--text-2)   (secondary text / hover fg)
     #f6f7f9 → var(--text-1)   (primary text / hover-state highlight)
     #e5e7eb → var(--text-1)   (story-sent body — slightly lighter shade
                                 collapsed onto --text-1 for HC consistency)
     #1f2328 → var(--bg-1)     (story-complete toolbar)
   Curated brand accents (jhacal-gold variants, practice orange, blue
   alt-word, green pw-counter) are intentionally retained as literals —
   those are UX highlights, not theme-responsive surface colours.
   Scope note: pro-speak-stories.css still carries additional literals
   flagged for Phase 3+ (rsvp-stage, card grid, practice panels). */

/* ══════════════════════════════════════════════════
   STORY MODE ADDITIONS — dark theme compatible
   All ps-* classes preserved; story uses same dark vars
   ══════════════════════════════════════════════════ */

/* Mode button active states */
.ps-btn-choose.ws-active   { background: rgba(91,141,87,0.2); border-color: #5B8D57; color: #8bc34a; }
.ps-btn-stories            { border-color: rgba(199,166,74,0.35); color: #f6c177; }
.ps-btn-stories.story-active { background: rgba(199,166,74,0.18); border-color: #f6c177; color: #f6c177; }
.mode-badge                { display: none; font-size: 9px; background: rgba(199,166,74,0.2); color: #f6c177; border: 1px solid rgba(199,166,74,0.4); border-radius: 4px; padding: 1px 5px; letter-spacing: 0.5px; text-transform: uppercase; font-weight: 800; vertical-align: middle; margin-left: 4px; }
.story-mode .mode-badge    { display: inline; }

/* Story stage — hidden until story mode active */
#storyStage                { display: none; flex: 1; flex-direction: column; padding: 10px 4px; min-height: 0; }
.story-mode #storyStage    { display: flex; }
.story-mode .ps-stage      { display: none; }

/* Story status bar */
.story-status-bar {
  display: flex; justify-content: space-between; align-items: center;
  flex-wrap: wrap; gap: 4px;
  margin-bottom: 8px; padding-bottom: 7px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  flex-shrink: 0;
}
.story-chapter-label { font-size: 11px; font-weight: 800; color: #f6c177; text-transform: uppercase; letter-spacing: 0.5px; }
.story-pw-counter    { font-size: 11px; font-weight: 800; color: #8bc34a; }

/* Highlight legend */
.story-legend        { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.story-legend-item   { display: flex; align-items: center; gap: 3px; font-size: 10px; color: var(--text-3); white-space: nowrap; }

/* Exit story → word practice button */
.story-exit-btn {
  margin-left: auto; flex-shrink: 0;
  padding: 3px 10px; border-radius: 6px;
  border: 1px solid rgba(255,255,255,0.18);
  background: rgba(255,255,255,0.06);
  color: var(--text-2); font-size: 11px; font-weight: 700;
  cursor: pointer; white-space: nowrap; line-height: 1.4;
  transition: background 0.15s, color 0.15s;
}
.story-exit-btn:hover { background: rgba(255,255,255,0.14); color: var(--text-1); }
.story-exit-bar      { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.story-exit-btn      { background: rgba(255,255,255,0.06); border: 1px solid rgba(255,255,255,0.15); color: var(--text-2); font-size: 11px; font-weight: 700; padding: 4px 10px; border-radius: 6px; cursor: pointer; transition: all 0.18s; }
.story-exit-btn:hover{ background: rgba(255,255,255,0.12); color: var(--text-1); border-color: rgba(255,255,255,0.3); }
.story-exit-hint     { font-size: 10px; color: #4a5060; font-style: italic; }
.story-sent-pos      { font-size: 11px; color: var(--text-3); }

/* Sentence container */
.story-sentences {
  flex: 1; position: relative; overflow: hidden; min-height: 100px;
  display: flex; flex-direction: column; justify-content: center; gap: 4px;
}

/* Sentence states */
.story-sent {
  font-family: Georgia, serif;
  font-size: calc(clamp(15px, 2.2vw, 22px) * var(--ps-primary-font-scale, 1));
  line-height: 1.8; color: var(--text-1); padding: 2px 0;
  transition: opacity 0.38s ease, transform 0.38s ease;
}
.story-sent.s-active  { opacity: 1; transform: translateY(0); }
.story-sent.s-exit    { opacity: 0; transform: translateY(-10px); pointer-events: none; }
.story-sent.s-enter   { opacity: 0; transform: translateY(10px); pointer-events: none; }
.story-sent.s-bridge  { font-style: italic; opacity: 0.55; }
.story-sent.s-bridge.s-active { opacity: 0.7; }

/* Word spans — every word is wrapped for highlight + click-to-seek */
.ps-word {
  cursor: pointer;
  border-radius: 3px;
  transition: background 0.12s;
}
.ps-word:hover {
  background: rgba(255,255,255,0.06);
}

/* Active narration word — orange highlight */
.ps-word-active {
  color: #fb923c !important;
  background: rgba(251,146,60,0.18) !important;
  border-radius: 3px;
  font-weight: 700;
}

/* Practice word highlight — gold on dark (curated, intentional) */
.ps-pw {
  color: #f6c177; font-weight: 700;
  background: rgba(246,193,119,0.12);
  border-radius: 3px; padding: 0 3px;
}

/* Auto-detected phonetically equivalent word — blue, softer */
.ps-pw-auto {
  color: #7ab8f5; font-weight: 600;
  background: rgba(122,184,245,0.1);
  border-radius: 3px; padding: 0 3px;
  border-bottom: 1px solid rgba(122,184,245,0.35);
}

/* Section header label */
.story-section-hdr {
  font-size: 10px; font-weight: 800; color: var(--text-3);
  text-transform: uppercase; letter-spacing: 0.8px;
  margin: 6px 0 2px; opacity: 0.7;
}

/* Story controls hint */
.controls-hint { display: none; }
.story-mode .controls-hint {
  display: block; width: 100%; text-align: center;
  font-size: 10px; color: var(--text-3); margin-top: -2px;
}

/* Speed caption variants */
.speed-caption-word  { display: inline; }
.speed-caption-sent  { display: none; }
.story-mode .speed-caption-word { display: none; }
.story-mode .speed-caption-sent { display: inline; }

/* Rail meter story variants */
.ps-meter.story-cat > .ps-meter-fill { background: linear-gradient(180deg, #f6c177 0%, #a07d28 100%); }
.ps-meter.story-sub > .ps-meter-fill { background: linear-gradient(180deg, #9b84b8 0%, #5e3d8c 100%); }

/* ── Story Browser Modal ─────────────────────────── */
.ps-story-dialog { width: min(960px, 96vw); }
.story-modal-hdr { margin-bottom: 12px; padding-bottom: 10px; border-bottom: 2px solid rgba(246,193,119,0.3); }
.story-modal-hdr h2 { margin: 0 0 4px; font-size: 17px; font-weight: 800; color: #ff9800; }
.story-modal-sub  { margin: 0; font-size: 12px; color: var(--text-3); }

.story-filter-bar {
  display: flex; gap: 8px; flex-wrap: wrap; align-items: center;
  margin-bottom: 12px; padding: 8px 10px;
  background: rgba(0,0,0,0.15); border-radius: 8px;
  border: 1px solid rgba(255,255,255,0.06);
}
.sflt-lbl { font-size: 11px; font-weight: 700; color: var(--text-3); }
.sflt {
  padding: 6px 9px; border-radius: 6px;
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(0,0,0,0.35); color: var(--text-1);
  font-size: 12px; font-weight: 700;
}
.sflt:focus { outline: none; border-color: #ff9800; }

#storyCardGrid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(270px,1fr));
  gap: 10px; max-height: 48vh; overflow-y: auto; padding: 4px 2px;
}
#storyCardGrid::-webkit-scrollbar { width: 5px; }
#storyCardGrid::-webkit-scrollbar-thumb { background: rgba(255,152,0,0.25); border-radius: 3px; }

.story-card {
  border: 1px solid rgba(255,255,255,0.1); border-radius: 10px; padding: 12px;
  background: rgba(255,255,255,0.02); display: flex; flex-direction: column; gap: 6px;
  transition: all 0.2s;
}
.story-card:hover { border-color: rgba(246,193,119,0.4); background: rgba(246,193,119,0.05); transform: translateY(-1px); }
.story-card-title { font-weight: 900; font-size: 15px; margin: 0; color: var(--text-1); }
.story-card-meta  { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.sb { font-size: 10px; font-weight: 700; padding: 2px 6px; border-radius: 4px; background: rgba(255,255,255,0.06); border: 1px solid rgba(255,255,255,0.1); color: var(--text-2); }
.sb.genre { background: rgba(246,193,119,0.12); border-color: rgba(246,193,119,0.3); color: #f6c177; }
.sb.diff  { background: rgba(91,141,87,0.12); border-color: rgba(91,141,87,0.3); color: #8bc34a; }
.story-syn  { font-size: 12px; color: #9ca3af; line-height: 1.5; margin: 0; }
.story-tags { display: flex; gap: 4px; flex-wrap: wrap; }
.story-tag  { font-size: 10px; padding: 2px 5px; border-radius: 3px; background: rgba(246,193,119,0.08); border: 1px solid rgba(246,193,119,0.2); color: #b9966a; }
.story-actions { display: flex; gap: 6px; margin-top: 2px; }

/* Practitioner panel */
.pract-panel { border: 1px solid rgba(255,255,255,0.08); border-radius: 10px; padding: 14px; margin-top: 12px; background: rgba(255,255,255,0.02); }
.pract-panel h4 { margin: 0 0 8px; font-size: 14px; color: #ff9800; }
.pn-sec { margin-bottom: 10px; padding-bottom: 10px; border-bottom: 1px dashed rgba(255,255,255,0.08); }
.pn-sec:last-child { border-bottom: none; margin-bottom: 0; padding-bottom: 0; }
.pn-lbl { font-size: 10px; font-weight: 800; color: var(--text-3); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 3px; }
.pn-txt { font-size: 12px; color: var(--text-2); line-height: 1.6; }

/* Post-story complete bar */
#storyCompleteBar {
  display: none; position: fixed; bottom: 80px; left: 50%;
  transform: translateX(-50%);
  background: var(--bg-1); color: var(--text-1);
  padding: 12px 18px; border-radius: 12px; font-weight: 800; font-size: 14px;
  z-index: 1200; box-shadow: 0 4px 24px rgba(0,0,0,0.6);
  border: 1px solid rgba(246,193,119,0.3);
  align-items: center; gap: 10px; max-width: 92vw; text-align: center;
}
#storyCompleteBar.show { display: flex; }
#storyCompleteBar .scb-act { padding: 7px 14px; border-radius: 7px; border: none; background: linear-gradient(135deg,#ff9800,#f57c00); color: #000; font-weight: 800; cursor: pointer; white-space: nowrap; }
#storyCompleteBar .scb-act:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(255,152,0,0.4); }
#storyCompleteBar .scb-dis { padding: 5px 10px; border-radius: 7px; border: 1px solid rgba(255,255,255,0.15); background: transparent; color: var(--text-3); cursor: pointer; font-size: 12px; }

/* Practitioner settings section inside settings modal */
.ps-pract-session-card { background: rgba(255,255,255,0.03); border: 1px solid rgba(255,255,255,0.07); border-radius: 9px; padding: 10px 12px; margin: 6px 0; }
.ps-pract-session-title { font-weight: 800; font-size: 13px; color: #f6c177; }
.ps-pract-session-meta  { font-size: 11px; color: var(--text-3); margin-top: 2px; }

@media (max-width: 640px) {
  #storyCardGrid { grid-template-columns: 1fr; }
}
