/* HelpDrawer organism - the Docs drawer content: the SOP card, the Journey timeline with
   its live chips, the Buttons and Rules lists and the Config tab (TLP-1132, TLP-1171). The drawer
   shell is the Drawer organism (non-modal, 440px). SPACING CONTRACT: the drawer content
   owns the vertical rhythm through gap; no component carries an external margin. Every
   value from design-tokens.css; classes are prefixed help-. */

.drawer.help-drawer {
  top: var(--header-height);
  max-width: 100vw;
}

.help-drawer .drawer-content {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  background: var(--bg-panel);
}

.help-docs-body {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

/* ---------- the SOP card ---------- */
.help-sop-card {
  background: var(--bg-surface);
  border: var(--border-width-1) solid var(--border-subtle);
  border-radius: var(--radius-card);
  padding: var(--space-4);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.help-sop-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
}

.help-sop-title {
  font-size: var(--text-sm);
  font-weight: var(--font-weight-semibold);
}

/* ---------- the Journey timeline ---------- */
.help-stages {
  display: flex;
  flex-direction: column;
}

.help-stage {
  display: grid;
  grid-template-columns: var(--space-7) minmax(0, 1fr);
  gap: var(--space-3);
  padding: var(--space-3) 0;
  border-bottom: var(--border-width-1) solid var(--border-subtle);
}

.help-stage:last-child {
  border-bottom: 0;
}

.help-stage.is-highlighted {
  background: var(--color-primary-light);
  border-radius: var(--radius-sm);
  padding-left: var(--space-2);
  padding-right: var(--space-2);
}

.help-stage-disc {
  width: var(--space-6);
  height: var(--space-6);
  border-radius: var(--radius-full);
  background: var(--text-primary);
  color: var(--text-inverse);
  font-family: var(--font-family-mono);
  font-size: var(--text-xs);
  font-weight: var(--font-weight-semibold);
  display: grid;
  place-items: center;
  margin-top: var(--space-px);
}

.help-stage-body {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  min-width: 0;
}

.help-stage-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: var(--space-2);
}

.help-stage-title {
  font-weight: var(--font-weight-semibold);
}

.help-stage-who {
  font-size: var(--text-xs);
  color: var(--text-muted);
  white-space: nowrap;
}

.help-stage-what {
  color: var(--text-secondary);
  line-height: var(--line-height-relaxed);
}

.help-value {
  border-bottom: var(--border-width-2) dotted var(--color-primary);
  cursor: help;
}

/* ---------- chips read live from setup ---------- */
.help-chips {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-1) var(--space-2);
  margin-top: var(--space-1);
}

.help-chips-label {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  font-size: var(--text-2xs);
  color: var(--text-muted);
}

.help-chip {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  border: var(--border-width-1) dashed var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--bg-surface);
  padding: var(--space-px) var(--space-2);
  font-size: var(--text-xs);
}

.help-chip-mono {
  font-family: var(--font-family-mono);
  color: var(--text-secondary);
}

.help-chip-more {
  color: var(--text-muted);
}

.help-showme-link {
  align-self: flex-start;
}

/* ---------- Buttons tab ---------- */
.help-group-title {
  font-size: var(--text-2xs);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: var(--font-weight-semibold);
  color: var(--text-muted);
  padding-top: var(--space-2);
}

.help-controls {
  display: flex;
  flex-direction: column;
}

.help-control {
  display: flex;
  flex-direction: column;
  gap: var(--space-px);
  padding: var(--space-2) 0;
  border-bottom: var(--border-width-1) solid var(--border-subtle);
}

.help-control:last-child {
  border-bottom: 0;
}

.help-control-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-2);
}

.help-control-label {
  font-weight: var(--font-weight-semibold);
}

.help-control-what {
  color: var(--text-secondary);
}

.help-control-when {
  font-size: var(--text-xs);
  color: var(--color-warning-hover);
}

/* the control on screen, when Point to it finds it */
.help-point-flash {
  outline: var(--border-width-2) solid var(--color-primary);
  outline-offset: 3px;
  border-radius: var(--radius-sm);
  transition: outline-color var(--duration-300) var(--easing-out);
}

/* ---------- Rules tab ---------- */
.help-rules {
  background: var(--bg-surface);
  border: var(--border-width-1) solid var(--border-subtle);
  border-radius: var(--radius-card);
  padding: 0 var(--space-4);
}

.help-rule {
  padding: var(--space-2) 0;
  border-bottom: var(--border-width-1) solid var(--border-subtle);
  color: var(--text-secondary);
}

.help-rule:last-child {
  border-bottom: 0;
}

/* ---------- Config tab (TLP-1171): the setup the module relies on, managers only ---------- */
.help-config {
  background: var(--bg-surface);
  border: var(--border-width-1) solid var(--border-subtle);
  border-radius: var(--radius-card);
  padding: 0 var(--space-4);
}

.help-config-item {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  padding: var(--space-3) 0;
  border-bottom: var(--border-width-1) solid var(--border-subtle);
}

.help-config-item:last-child {
  border-bottom: 0;
}

.help-config-foot {
  font-size: var(--text-xs);
  color: var(--text-muted);
}

/* ---------- Phone: the drawer is a bottom sheet under the safe area ---------- */
@media (max-width: 640px) {
  .drawer.help-drawer {
    top: auto;
    bottom: 0;
    left: 0;
    right: 0;
    height: 85vh;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    padding-bottom: env(safe-area-inset-bottom, 0px);
    animation-name: help-drawer-rise;
  }
}

@keyframes help-drawer-rise {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

@media (prefers-reduced-motion: reduce) {
  .drawer.help-drawer {
    animation: none;
  }
}

/* ---------- Learn (TLP-1135) ---------- */
.help-learn-body {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.help-learn-progress {
  background: var(--bg-surface);
  border: var(--border-width-1) solid var(--border-subtle);
  border-radius: var(--radius-card);
  padding: var(--space-4);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.help-learn-progress-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: var(--space-2);
}

.help-learn-area {
  font-weight: var(--font-weight-semibold);
}

.help-learn-count {
  font-size: var(--text-xs);
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.help-learn-due {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  color: var(--color-warning-hover);
  font-size: var(--text-sm);
}

.help-learn-meta {
  font-size: var(--text-xs);
  color: var(--text-muted);
}

.help-learn-badges,
.help-learn-sop-row {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-wrap: wrap;
}

.help-lessons {
  background: var(--bg-surface);
  border: var(--border-width-1) solid var(--border-subtle);
  border-radius: var(--radius-card);
  padding: 0 var(--space-4);
  display: flex;
  flex-direction: column;
}

.help-lesson {
  border-bottom: var(--border-width-1) solid var(--border-subtle);
  padding: var(--space-2) 0;
}

.help-lesson:last-child {
  border-bottom: 0;
}

.help-lesson-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: var(--space-3);
  align-items: center;
}

.help-lesson-text {
  display: flex;
  flex-direction: column;
  gap: var(--space-px);
  min-width: 0;
}

.help-lesson-q {
  font-weight: var(--font-weight-medium);
}

.help-lesson-meta {
  font-size: var(--text-xs);
  color: var(--text-muted);
}

.help-lesson-card {
  margin-top: var(--space-2);
  background: var(--bg-panel);
  border: var(--border-width-1) solid var(--border-subtle);
  border-radius: var(--radius-card);
  padding: var(--space-3);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.help-lesson-card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-xs);
  color: var(--text-muted);
}

.help-steps {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.help-step {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: var(--space-3);
  align-items: center;
  padding: var(--space-2) var(--space-3);
  background: var(--bg-surface);
  border: var(--border-width-1) solid var(--border-subtle);
  border-radius: var(--radius-sm);
}

.help-step-kind {
  font-size: var(--text-2xs);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-weight: var(--font-weight-semibold);
  color: var(--text-muted);
  width: var(--space-11);
}

.help-step.is-ticked .help-step-kind {
  color: var(--color-success-hover);
}

.help-learn-foot {
  font-size: var(--text-xs);
  color: var(--text-muted);
  border-top: var(--border-width-1) solid var(--border-subtle);
  padding-top: var(--space-3);
}

.help-learn-foot-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-2);
}

.help-team-lessons {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
}

.help-team-bar {
  width: var(--space-12);
}

.help-quiz {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

/* The Key tab (PO 2026-10-01): each picture the screen draws, as it draws it, beside what it
   means. The picture column holds a whole tile, or the repair's three icons at their large size. */
.help-key {
  display: flex;
  flex-direction: column;
}

.help-key-row {
  display: grid;
  grid-template-columns: var(--space-24) 1fr;
  align-items: start;
  gap: var(--space-3);
  padding: var(--space-2) 0;
  border-bottom: var(--border-width-1) solid var(--border-subtle);
}

.help-key-row:last-child {
  border-bottom: 0;
}

.help-key-glyph {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: var(--space-1);
  padding-top: var(--space-1);
}

.help-key-text {
  display: flex;
  flex-direction: column;
  gap: var(--space-px);
  min-width: 0;
}

/* Buttons: a control's picture beside its name. */
.help-control-name {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
}

.help-control-glyph {
  display: inline-flex;
  align-items: center;
  gap: var(--space-0_5);
}

/* A lesson's card: its screen's icons and colours, lined up as the screen's key lines them up. */
.help-lesson-key {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1) var(--space-3);
}

.help-lesson-key-item {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  font-size: var(--text-xs);
  color: var(--text-secondary);
}
