/* Web_ver/frontend/css/help.css
   Per-page help drawer + trigger button. Co-exists with existing
   style.css; uses the same navy/gold palette tokens where exposed. */

/* Ghost icon button — the secondary bar already carries gold (title,
   active-tab underline, syncing/degraded chip states). A solid gold
   disc piled on. We borrow the sync-chip's translucent vocabulary
   instead: subtle white border at rest, gold border + 3px gold halo
   on hover (same 18%-opacity ring the .sync-chip-dot uses).
   Square-with-soft-radius reads as a UI control, not an avatar. */
.help-trigger {
  appearance: none;
  -webkit-appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  /* Parent .secondary-bar uses align-items: stretch; our fixed
     height resolves to "stretch from top", leaving the button pinned
     to the bar's upper edge. align-self: center re-centers it. */
  align-self: center;
  width: 26px;
  height: 26px;
  margin: 0 2px 0 14px;
  padding: 0;
  background: transparent;
  color: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.20);
  border-radius: 7px;
  cursor: pointer;
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  font-size: 13px;
  font-weight: 700;
  line-height: 1;
  flex-shrink: 0;
  /* Subtle 1px inset top-highlight — reads as a recessed plate
     catching light from above. Compound with state ring shadows. */
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
  transition: color 140ms ease, border-color 140ms ease,
              background 140ms ease, box-shadow 140ms ease,
              transform 90ms cubic-bezier(0.2, 0.8, 0.4, 1);
}
.help-trigger:hover {
  color: var(--gold);
  border-color: var(--gold);
  background: rgba(241, 196, 15, 0.08);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06),
              0 0 0 3px rgba(241, 196, 15, 0.18);
}
.help-trigger:focus-visible {
  outline: none;
  color: var(--gold);
  border-color: var(--gold);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06),
              0 0 0 3px rgba(241, 196, 15, 0.40);
}
.help-trigger:active {
  transform: translateY(0.5px) scale(0.96);
  background: rgba(241, 196, 15, 0.18);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.25);
}
.help-trigger--unavailable { visibility: hidden; }

@media (max-width: 600px) {
  .help-trigger {
    width: 24px; height: 24px;
    margin-left: 10px;
    font-size: 12px;
  }
}

/* === Scrim ===
   Tinted navy with blur — feels like an aside lifting off the page
   rather than a generic black wash. */
.help-root {}
.help-scrim {
  position: fixed; inset: 0;
  background: rgba(10, 14, 28, 0.48);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  opacity: 0; transition: opacity 240ms ease;
  z-index: 1200;   /* above .ss-list typeahead + mobile bottom-sheet (both 1100) */
}
.help-scrim--open { opacity: 1; }

/* === Panel ===
   Wider than v1 (440px vs 420px) so two-line truncation breathes.
   Slide easing tuned for a slightly more emphatic in-motion (the
   drawer should land with intent, not drift). */
.help-panel {
  position: fixed; right: 0; top: 0; bottom: 0;
  width: 440px; max-width: 95vw;
  background: #fff;
  box-shadow: -8px 0 32px rgba(10, 14, 28, 0.28);
  transform: translateX(100%);
  transition: transform 280ms cubic-bezier(0.2, 0.8, 0.2, 1);
  z-index: 1201;
  display: flex; flex-direction: column;
  overflow: hidden;
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  color: #1f2937;
}
.help-panel--open { transform: translateX(0); }
.help-panel--closing { transform: translateX(100%); }

/* === Header ===
   The drawer continues the secondary bar's navy/gold identity — the
   user opens the drawer FROM the bar, so the drawer should feel like
   an extension of that bar, not a foreign white sheet stapled on.
   Eyebrow "HELP" + page title stacked. Gold rule at the bottom edge
   mirrors the secondary bar's active-tab marker. */
.help-panel-header {
  position: relative;
  display: flex; align-items: flex-end;
  gap: 10px;
  padding: 26px 20px 16px;
  background: var(--primary-dk, #19233f);
  color: #fff;
  box-shadow: inset 0 -2px 0 0 var(--gold, #f1c40f);
}
.help-panel-header::before {
  content: "HELP";
  position: absolute;
  top: 9px; left: 20px;
  font-size: 10px; font-weight: 700;
  letter-spacing: 0.22em;
  color: var(--gold, #f1c40f);
}
.help-panel-title {
  font-size: 19px;
  font-weight: 700;
  letter-spacing: 0.005em;
  margin: 0;
  flex: 1;
  color: #fff;
  line-height: 1.2;
}
.help-lang-badge {
  align-self: flex-end;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  padding: 3px 7px;
  border: 1px solid rgba(255,255,255,0.32);
  border-radius: 3px;
  background: transparent;
  color: rgba(255,255,255,0.78);
}
.help-close {
  align-self: flex-end;
  background: transparent;
  border: none;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  padding: 4px 6px;
  color: rgba(255,255,255,0.65);
  transition: color 140ms ease, transform 90ms ease;
}
.help-close:hover { color: var(--gold, #f1c40f); }
.help-close:active { transform: scale(0.92); }

/* === Body — scrollable feature list ===
   Counter-reset feeds the gold "01.", "02." index rendered on each
   card via the ::before pseudo. */
.help-panel-body {
  flex: 1; overflow-y: auto;
  padding: 4px 0 12px;
  background: #fff;
  counter-reset: featidx;
}
.help-panel-body::-webkit-scrollbar { width: 10px; }
.help-panel-body::-webkit-scrollbar-track { background: #f8f9fb; }
.help-panel-body::-webkit-scrollbar-thumb {
  background: #d8dce4;
  border-radius: 5px;
  border: 2px solid #f8f9fb;
}
.help-panel-body::-webkit-scrollbar-thumb:hover { background: var(--gold, #f1c40f); }

.help-empty-state {
  text-align: center;
  color: #6b7280;
  padding: 48px 24px;
  font-size: 13px;
  letter-spacing: 0.02em;
}

/* === Feature card — editorial list item, not a boxed card ===
   Cards live in a continuous list separated only by a hairline.
   A gold tabular index (counter-style 01.) anchors the rhythm. Hover
   + expanded state paint an inset 3px gold stripe down the left
   edge + a soft gold gradient that fades to the right — mimics a
   highlighter sweep across the row. */
.help-feature-card {
  counter-increment: featidx;
  position: relative;
  display: block;
  width: 100%;
  text-align: left;
  background: #fff;
  color: #1f2937;
  border: none;
  border-bottom: 1px solid #eef0f4;
  padding: 14px 20px 14px 56px;
  margin: 0;
  cursor: pointer;
  font: inherit;
  /* Override the global `button` rule (style.css:543) that pins
     `white-space: nowrap` on every button. Without this the expanded
     description renders on a single overflowing line and forces a
     vertical scroll instead of wrapping inside the card. */
  white-space: normal;
  transition: background 160ms ease, box-shadow 160ms ease;
}
.help-feature-card::before {
  content: counter(featidx, decimal-leading-zero);
  position: absolute;
  left: 20px;
  top: 18px;
  font-family: 'Consolas', 'Cascadia Mono', ui-monospace, monospace;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--gold, #f1c40f);
  font-variant-numeric: tabular-nums;
}
.help-feature-card:hover,
.help-feature-card[aria-expanded="true"] {
  background: linear-gradient(90deg, rgba(241,196,15,0.07) 0%, rgba(241,196,15,0) 65%);
  box-shadow: inset 3px 0 0 0 var(--gold, #f1c40f);
}
.help-feature-card:focus-visible {
  outline: none;
  box-shadow: inset 3px 0 0 0 var(--gold, #f1c40f),
              0 0 0 2px rgba(241, 196, 15, 0.32);
}

/* === Collapsed body — stacked vertical layout === */
.help-feature-collapsed {
  display: flex; flex-direction: column; gap: 4px;
}
.help-feature-title {
  font-weight: 600;
  font-size: 14px;
  letter-spacing: 0.005em;
  color: #19233f;
  line-height: 1.35;
}
.help-feature-desc-short {
  /* Hidden in collapsed state — list stays scannable, descriptions
     only show when a row is expanded (via .help-feature-desc-full).
     Kept in the DOM so screen readers can still announce the
     short blurb via the button's aria-label. */
  display: none;
}
.help-feature-chip {
  align-self: flex-start;
  margin-top: 4px;
  font-size: 10px;
  font-family: 'Consolas', 'Cascadia Mono', ui-monospace, monospace;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.10em;
  padding: 0;
  background: transparent;
  color: var(--gold, #f1c40f);
  border: none;
  border-radius: 0;
  text-transform: uppercase;
}

/* === Expanded body === */
.help-feature-expanded {
  display: flex; flex-direction: column; gap: 12px;
  padding-top: 6px;
}
.help-feature-expanded .help-feature-title {
  font-size: 15px;
  padding-bottom: 8px;
  margin-bottom: 4px;
  border-bottom: 1px solid #eef0f4;
}
.help-feature-desc-full {
  color: #1f2937;
  font-size: 13.5px;
  line-height: 1.6;
}
.help-feature-video {
  width: 100%;
  max-height: 280px;
  background: #0a0e1c;
  border-radius: 4px;
}

.help-feature-lang-badge,
.help-feature-recording-badge {
  align-self: flex-start;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  padding: 3px 7px;
  border: 1px solid #d4d8e0;
  border-radius: 3px;
  background: transparent;
  color: #6b7280;
}

.help-feature-video-fail {
  display: flex; align-items: center;
  gap: 10px;
  padding: 14px 16px;
  background: #fffaed;
  border: 1px solid #f3d68b;
  border-radius: 4px;
  font-size: 13px;
  color: #5f4a14;
}
.help-feature-retry {
  margin-left: auto;
  border: none;
  background: var(--primary-dk, #19233f);
  color: #fff;
  border-radius: 4px;
  padding: 5px 10px;
  font-size: 13px;
  cursor: pointer;
  transition: background 140ms ease;
}
.help-feature-retry:hover { background: #2a3656; }

body.help-body-locked { overflow: hidden; }

/* === Mobile bottom sheet — under 768px ===
   Previously 1023px, which swallowed compact-desktop windows + tablets
   in a full-viewport sheet. Now reserved for actual phones; tablets
   and small laptops get the desktop drawer. */
@media (max-width: 768px) {
  .help-panel {
    width: 100%; max-width: 100%;
    top: auto; height: 88vh;
    transform: translateY(100%);
    border-top-left-radius: 16px; border-top-right-radius: 16px;
    box-shadow: 0 -8px 32px rgba(10, 14, 28, 0.32);
  }
  .help-panel--open { transform: translateY(0); }
  .help-panel--closing { transform: translateY(100%); }
  /* Drag handle — pure visual affordance hinting "swipe to close"
     (we don't actually wire the swipe; the cue alone improves the
     "this is a phone sheet" mental model). */
  .help-panel::before {
    content: "";
    position: absolute;
    top: 8px; left: 50%; transform: translateX(-50%);
    width: 40px; height: 4px;
    border-radius: 2px;
    background: rgba(255, 255, 255, 0.32);
    z-index: 1;
  }
  .help-panel-header { padding-top: 30px; }
  .help-feature-card { padding: 16px 20px 16px 56px; }
}

/* === Reduced motion === */
@media (prefers-reduced-motion: reduce) {
  .help-scrim, .help-panel, .help-feature-card,
  .help-close, .help-feature-retry, .help-trigger {
    transition: none !important;
  }
}
