/* driver-app/css/help.css — P1: driver-app help plumbing (2026-10-10, g16).
 * Spec: ~/emr-review-evidence/driver-simon-20261010/P1-help-plumbing-spec-g16.md
 *
 * Rules:
 *   - '?' button in <h1> row: 44×44 px tap target, aria-label, visible '?' glyph.
 *   - drv-help-btn--word (Ed 2026-11-13): the same button showing words ("Help me" on
 *     Current Load) on one line, still 44 px tall. Reusable on any screen.
 *   - Bottom sheet pattern with accessible tap targets and contrast compliance in light + dark.
 *   - Sheet tiles keep their own height and the list scrolls; text wraps inside each tile
 *     (Ed 2026-11-13: "all the tiles are wrapped not usable" — see .drv-help-entry).
 *   - Outline pulse animation for 'Show me'.
 */

.drv-help-h1,
.drv-more-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.drv-help-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  min-width: 44px;
  min-height: 44px;
  padding: 0;
  border: 1px solid var(--border, rgba(255, 255, 255, 0.15));
  border-radius: 50%;
  background: var(--bg-card, rgba(255, 255, 255, 0.05));
  color: var(--fg-dim, #888888);
  font-size: 17px;
  font-weight: 600;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  line-height: 1;
  transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
  margin-left: 8px;
}

/* Word button (Ed 2026-11-13: "instead show word help me"). Add
   drv-help-btn--word beside drv-help-btn and the round '?' becomes a button
   that fits its words on one line: same 44 px tap height, never wraps or
   shrinks (the title beside it takes the width that is left), the app's
   standard button surface and full-strength text. Its corners follow the
   skin's --radius (square under Skin B, like every other button). It sits
   right after .drv-help-btn so it wins the properties they share; the
   :hover, :focus-visible and [hidden] rules below still apply to it. */
.drv-help-btn--word {
  flex: 0 0 auto;
  width: auto;
  height: 44px;
  min-height: 44px;
  padding: 0 14px;
  border-radius: var(--radius, 8px);
  background: var(--emr-btn-bg, var(--bg-card, rgba(255, 255, 255, 0.05)));
  color: var(--fg, #ffffff);
  font-family: inherit;
  font-size: 15px;
  letter-spacing: normal;
  white-space: nowrap;
}

.drv-help-btn:hover,
.drv-help-btn:focus-visible {
  color: var(--fg, #ffffff);
  border-color: var(--border-focus, var(--accent, #3b82f6));
  background: var(--bg-hover, rgba(255, 255, 255, 0.1));
}

.drv-help-btn[hidden] {
  display: none !important;
}

/* ── Bottom Sheet Overlay ── */
.drv-help-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  animation: drvHelpFadeIn 0.2s ease-out;
}

@keyframes drvHelpFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.drv-help-sheet {
  background: var(--bg, #1a1a1a);
  color: var(--fg, #ffffff);
  border-top-left-radius: 16px;
  border-top-right-radius: 16px;
  border-top: 1px solid var(--border, rgba(255, 255, 255, 0.15));
  max-height: 85vh;
  max-height: 85dvh; /* the visible screen (browser bar / keyboard aware) where supported */
  display: flex;
  flex-direction: column;
  box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.4);
  animation: drvHelpSlideUp 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes drvHelpSlideUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

.drv-help-sheet__header {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border, rgba(255, 255, 255, 0.1));
}

.drv-help-sheet__title {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  color: var(--fg, #ffffff);
}

.drv-help-sheet__close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  min-width: 44px;
  min-height: 44px;
  background: transparent;
  border: none;
  color: var(--fg-dim, #888888);
  font-size: 20px;
  cursor: pointer;
  border-radius: 50%;
}

.drv-help-sheet__close:hover,
.drv-help-sheet__close:focus-visible {
  color: var(--fg, #ffffff);
  background: var(--bg-hover, rgba(255, 255, 255, 0.1));
}

/* The body is the part of the sheet that scrolls: it takes the height the
   header leaves (min-height 0 lets it shrink to that) and never scrolls
   sideways. */
.drv-help-sheet__body {
  flex: 1 1 auto;
  min-height: 0;
  padding: 16px 20px 32px;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* ── Individual Entry ── */
/* TILE HEIGHT (Ed 2026-11-13: "all the tiles are wrapped not usable"). The
   tiles are flex items of the scrolling column above, and overflow:hidden
   (kept for the rounded corners) drops a flex item's automatic minimum
   height to 0 — so with the default flex-shrink:1 every tile was squeezed
   to fit the 85vh sheet instead of the list scrolling. Current Load lists
   about 20 entries, so each tile was crushed to a ~15 px sliver with its
   title clipped. flex: 0 0 auto keeps each tile at its own height, so the
   body scrolls.
   overflow-wrap lets long words break inside the tile (inherited by its
   title, steps and answers). */
.drv-help-entry {
  flex: 0 0 auto;
  border: 1px solid var(--border, rgba(255, 255, 255, 0.1));
  border-radius: 10px;
  background: var(--bg-card, rgba(255, 255, 255, 0.03));
  overflow: hidden;
  overflow-wrap: anywhere;
}

.drv-help-entry__title-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  background: transparent;
  border: none;
  color: var(--fg, #ffffff);
  font-size: 16px;
  font-weight: 500;
  line-height: 1.3;
  white-space: normal;
  text-align: left;
  cursor: pointer;
  min-height: 44px;
}

.drv-help-entry__title-btn::after {
  content: '›';
  flex: 0 0 auto;
  font-size: 20px;
  color: var(--fg-dim, #888888);
  transition: transform 0.2s ease;
  margin-left: 8px;
}

.drv-help-entry.is-expanded .drv-help-entry__title-btn::after {
  transform: rotate(90deg);
}

.drv-help-entry__content {
  padding: 0 16px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  border-top: 1px solid var(--border, rgba(255, 255, 255, 0.05));
}

.drv-help-entry__content[hidden],
.drv-help-entry__content.hidden {
  display: none !important;
}

.drv-help-entry__what {
  margin: 12px 0 0;
  font-size: 14px;
  line-height: 1.5;
  color: var(--fg-dim, #cccccc);
}

.drv-help-entry__steps {
  margin: 0;
  padding-left: 20px;
  font-size: 14px;
  line-height: 1.5;
  color: var(--fg, #eeeeee);
}

.drv-help-entry__steps li {
  margin-bottom: 6px;
}

.drv-help-entry__common-problems {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 4px;
}

.drv-help-problem {
  background: var(--bg-input, rgba(0, 0, 0, 0.2));
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 13px;
}

.drv-help-problem summary {
  font-weight: 500;
  cursor: pointer;
  color: var(--fg, #ffffff);
  min-height: 44px;
  padding: 8px 0;
  display: flex;
  align-items: center;
}

.drv-help-problem p {
  margin: 8px 0 0;
  line-height: 1.4;
  color: var(--fg-dim, #aaaaaa);
}

.drv-help-entry__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 8px;
}

.drv-help-btn-showme,
.drv-help-btn-simon {
  min-height: 44px;
  min-width: 44px;
  padding: 10px 16px;
  font-size: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  white-space: normal;
}

/* ── Phone widths (≤420 px; Ed 2026-11-13) ──
   One full-width column of tiles with a little more room for the words:
   tighter side padding, one 10 px rhythm, the last tile clear of the home
   indicator, and Show me / Ask SIMON sharing a row two-up (each wraps to
   its own full-width row when the words do not fit). Tap targets stay
   44 px or more. */
@media (max-width: 420px) {
  .drv-help-sheet__header {
    padding: 12px 12px 12px 16px;
  }
  .drv-help-sheet__body {
    padding: 12px 12px calc(20px + env(safe-area-inset-bottom, 0px));
    gap: 10px;
  }
  .drv-help-entry__title-btn {
    padding: 12px 14px;
  }
  .drv-help-entry__content {
    padding: 0 14px 14px;
  }
  .drv-help-btn-showme,
  .drv-help-btn-simon {
    flex: 1 1 120px;
  }
}

/* ── Outline pulse animation for 'Show me' ── */
@keyframes drvHelpPulse {
  0% { outline: 3px solid var(--accent, #3b82f6); outline-offset: 2px; }
  50% { outline: 3px solid transparent; outline-offset: 4px; }
  100% { outline: 3px solid var(--accent, #3b82f6); outline-offset: 2px; }
}

.drv-help-pulse {
  animation: drvHelpPulse 1s ease-in-out 2;
}
