/* Guided onboarding inside the PULSO mockup (PULSO 0.7.1 §6/§8/§9).
 * Loaded by index.html and used only by assets/onboarding.js.
 *
 * Deliberately its own file rather than more rules in styles.css: the tour
 * is an overlay layer that must be removable in one line if it ever gets in
 * the way, and it is the only stylesheet in the mockup that positions
 * anything on top of the interface.
 *
 * The look is operational, not promotional (§6): the same tokens, radius and
 * shadows as the panels underneath, no illustration, no marketing gradient,
 * high contrast, compact. It reads as part of PULSO because it uses PULSO's
 * own variables — a tour that looked like a product tour library would look
 * bolted on, which is exactly what §6 rules out.
 *
 * Class names are PULSO's own (§6): .pulso-tour-*. */

.pulso-tour-overlay {
  position: fixed;
  inset: 0;
  /* Attenuated, not opaque: the person must keep seeing the view the step is
   * talking about. */
  background: rgba(17, 24, 39, 0.52);
  z-index: 900;
  opacity: 0;
  transition: opacity 160ms ease-out;
}

.pulso-tour-overlay.pulso-tour-visible { opacity: 1; }

/* The highlighted element is lifted ABOVE the overlay and outlined, so the
 * step's subject is the one thing not dimmed. */
.pulso-tour-highlight {
  position: relative;
  z-index: 901;
  border-radius: 8px;
  outline: 3px solid var(--pulso-accent);
  outline-offset: 2px;
  /* Not colour alone (§8): the element also gains a ring and a lift, so the
   * "this one" signal survives a monochrome or colour-blind reading. */
  box-shadow: 0 0 0 6px rgb(var(--pulso-accent-rgb) / 0.22), var(--shadow-soft);
  background: var(--surface);
}

.pulso-tour-panel {
  position: fixed;
  z-index: 902;
  /* Default placement: centered. Anchoring is an enhancement applied by
   * onboarding.js only when there is a real element to anchor to and the
   * viewport is wide enough (§9). */
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: min(520px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
  overflow-y: auto;
  padding: 20px 22px;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  opacity: 0;
  transition: opacity 160ms ease-out;
}

.pulso-tour-panel.pulso-tour-visible { opacity: 1; }

.pulso-tour-panel:focus-visible {
  outline: 3px solid rgb(var(--pulso-accent-rgb) / 0.38);
  outline-offset: 2px;
}

/* Anchored next to the highlighted element. `transform: none` cancels the
 * centering translate; top/left are then set inline in pixels. */
.pulso-tour-panel-anchored {
  transform: none;
  width: min(420px, calc(100vw - 32px));
}

.pulso-tour-panel-head {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

/* The single flex child holding eyebrow + title + body. min-width:0 lets it
 * shrink below its content's intrinsic width so a long word wraps instead of
 * pushing the close button off the panel. */
.pulso-tour-heading {
  flex: 1 1 auto;
  min-width: 0;
}

.pulso-tour-eyebrow {
  margin: 0 0 4px;
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--pulso-accent);
}

.pulso-tour-title {
  margin: 0 0 8px;
  font-size: 1.125rem;
  line-height: 1.3;
  color: var(--ink);
}

.pulso-tour-body {
  margin: 0;
  font-size: 0.9375rem;
  color: var(--muted);
}

.pulso-tour-close {
  margin-left: auto;
  flex: none;
  padding: 6px 10px;
  min-height: 32px;
  font-size: 0.8125rem;
  color: var(--muted);
  background: none;
  border: 1px solid var(--line);
  border-radius: 8px;
  cursor: pointer;
}

.pulso-tour-close:hover { background: var(--surface-3); color: var(--ink); }

.pulso-tour-points {
  margin: 14px 0 0;
  padding-left: 20px;
  font-size: 0.875rem;
  color: var(--ink);
}

.pulso-tour-points li { margin-bottom: 4px; }

.pulso-tour-progress {
  margin-top: 18px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.pulso-tour-progress-bar {
  flex: 1;
  height: 6px;
  border-radius: 999px;
  background: var(--surface-3);
  border: 1px solid var(--line);
  overflow: hidden;
}

.pulso-tour-progress-fill {
  display: block;
  height: 100%;
  background: var(--pulso-accent);
}

/* The bar is decoration; this label is the real progress statement, and it
 * is what the screen reader announces (§8). */
.pulso-tour-progress-label {
  margin: 0;
  flex: none;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--ink);
}

.pulso-tour-actions {
  margin-top: 16px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.pulso-tour-btn {
  padding: 9px 16px;
  /* 40 px minimum: comfortably tappable on a phone without turning the panel
   * into a wall of buttons on desktop. */
  min-height: 40px;
  font-size: 0.875rem;
  font-weight: 600;
  border-radius: 8px;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
}

.pulso-tour-btn:hover { background: var(--surface-3); }

.pulso-tour-btn:focus-visible {
  outline: 3px solid rgb(var(--pulso-accent-rgb) / 0.38);
  outline-offset: 2px;
}

.pulso-tour-btn[disabled] {
  opacity: 0.5;
  cursor: not-allowed;
}

.pulso-tour-btn-primary {
  margin-left: auto;
  background: var(--graphite);
  border-color: var(--graphite);
  color: #ffffff;
}

.pulso-tour-btn-primary:hover { background: var(--graphite-2); }

.pulso-tour-btn-secondary {
  border-color: var(--pulso-accent);
  color: var(--pulso-accent);
}

.pulso-tour-btn-secondary:hover { background: rgb(var(--pulso-accent-rgb) / 0.1); }

.pulso-tour-secondary-actions {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
}

.pulso-tour-link {
  padding: 4px 0;
  min-height: 32px;
  font-size: 0.8125rem;
  color: var(--blue);
  background: none;
  border: none;
  text-decoration: underline;
  cursor: pointer;
}

/* "No volver a mostrar" is deliberately the quieter of the two: both are
 * available, but the reversible one reads as the default. */
.pulso-tour-link-quiet { color: var(--muted); }

.pulso-tour-link:hover { color: var(--ink); }

.pulso-tour-link:focus-visible {
  outline: 3px solid var(--blue);
  outline-offset: 2px;
}

/* --- Ayuda control in the sidebar --------------------------------------- */

.onboarding-help {
  margin: 0 16px 8px;
  padding: 9px 12px;
  width: calc(100% - 32px);
  min-height: 40px;
  font-size: 0.8125rem;
  font-weight: 600;
  text-align: left;
  color: var(--ink);
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  cursor: pointer;
}

.onboarding-help:hover { background: var(--surface-3); }

.onboarding-help:focus-visible {
  outline: 3px solid rgb(var(--pulso-accent-rgb) / 0.38);
  outline-offset: 2px;
}

/* --- Responsive (§9) ----------------------------------------------------- */

/* Below this width the panel is a bottom sheet: anchoring a popover to a
 * nav item on a phone would cover the item itself, and onboarding.js stops
 * anchoring at the same breakpoint. */
@media (max-width: 859px) {
  .pulso-tour-panel,
  .pulso-tour-panel-anchored {
    top: auto;
    bottom: 0;
    left: 0;
    right: 0;
    transform: none;
    width: 100%;
    /* Never covers the whole interface: the view being explained stays
     * partly visible above the sheet (§9). */
    max-height: 72vh;
    border-radius: var(--radius) var(--radius) 0 0;
    border-bottom: none;
  }

  .pulso-tour-btn-primary { margin-left: 0; }

  .pulso-tour-actions .pulso-tour-btn { flex: 1 1 auto; }
}

/* --- Reduced motion (§8) ------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
  .pulso-tour-overlay,
  .pulso-tour-panel {
    transition: none;
  }
}

/* Set by onboarding.js as well as by the media query above, because the
 * scroll behaviour it also disables is a JS decision and the two should not
 * be able to disagree. */
.pulso-tour-no-motion { transition: none !important; }

/* --- High contrast / forced colours -------------------------------------- */

@media (forced-colors: active) {
  .pulso-tour-panel { border: 2px solid CanvasText; }
  .pulso-tour-highlight { outline: 3px solid Highlight; }
  .pulso-tour-progress-fill { background: Highlight; }
}
