/* tour.css — the tutorial overlay, shared by the planner and the calculator.
 *
 * Both pages declare the same design tokens, so everything here is written in
 * terms of those and nothing else. That is the whole reason one stylesheet can
 * dress two pages that share no other code.
 */

/* The button tour.js injects. Deliberately quiet: the tour opens itself on a
   first visit, so this only has to be findable afterwards, not loud. */
.tour-btn {
  font: inherit;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent-hi);
  background: var(--accent-band);
  border: 1px solid var(--accent-edge);
  border-radius: var(--radius-sm, 6px);
  padding: 6px 11px;
  cursor: pointer;
  white-space: nowrap;
}
.tour-btn:hover { background: var(--accent-soft); }
.tour-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.tour-backdrop {
  position: fixed;
  inset: 0;
  z-index: 200;          /* above the planner's own modal (100) and too-small */
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(0, 0, 0, 0.68);
}
.tour-backdrop[hidden] { display: none; }

/* Height is capped against the viewport and the body scrolls inside, because
   the planner sets body{overflow:hidden} -- the page underneath cannot be
   relied on to scroll a tall step into view. */
.tour-panel {
  display: flex;
  flex-direction: column;
  width: min(680px, 100%);
  max-height: min(760px, 100%);
  background: var(--surface-1, var(--panel, #101318));
  border: 1px solid var(--border, var(--line, #1e242d));
  border-radius: 12px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.55);
  overflow: hidden;
}

.tour-head {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 2px 10px;
  /* Right padding clears the absolutely-positioned close button -- without it a
     long title runs underneath the X on a narrow window. */
  padding: 16px 52px 12px 20px;
  border-bottom: 1px solid var(--border, var(--line, #1e242d));
}
.tour-step-of {
  font-family: var(--mono);
  font-size: var(--label-size, 10px);
  font-weight: 700;
  letter-spacing: var(--label-track, 0.1em);
  text-transform: uppercase;
  color: var(--text-muted, var(--muted, #8a97a8));
}
.tour-title {
  margin: 0;
  /* A flex item will not shrink below its intrinsic width without this, which
     is how a long title escaped the header's padding and slid under the X. */
  min-width: 0;
  font-size: 19px;
  font-weight: 700;
  letter-spacing: -0.015em;
  color: var(--text-primary, var(--text, #e8edf3));
}

.tour-body {
  padding: 18px 20px;
  overflow-y: auto;
  color: var(--text-secondary, var(--text-2, #a3b0bf));
  font-size: 14px;
  line-height: 1.55;
}
.tour-body p { margin: 0 0 11px; }
.tour-body p:last-child { margin-bottom: 0; }
.tour-body strong { color: var(--text-primary, var(--text, #e8edf3)); font-weight: 650; }
.tour-body kbd {
  font-family: var(--mono);
  font-size: 11px;
  background: var(--surface-2, var(--panel2, #171b22));
  border: 1px solid var(--border-strong, var(--line-strong, #2c3440));
  border-radius: 4px;
  padding: 1px 5px;
  color: var(--text-primary, var(--text, #e8edf3));
}
.tour-body ul { margin: 0 0 11px; padding-left: 18px; }
.tour-body li { margin-bottom: 5px; }

/* The diagram sits in its own well so it reads as an illustration rather than
   as more interface. */
.tour-figure {
  margin: 0 0 14px;
  padding: 14px;
  background: var(--surface-0, var(--bg, #0a0c10));
  border: 1px solid var(--border, var(--line, #1e242d));
  border-radius: var(--radius, 8px);
}
.tour-figure svg { display: block; width: 100%; height: auto; }
.tour-figure figcaption {
  margin-top: 9px;
  font-family: var(--mono);
  font-size: var(--label-size, 10px);
  letter-spacing: var(--label-track, 0.1em);
  text-transform: uppercase;
  color: var(--text-muted, var(--muted, #8a97a8));
  text-align: center;
}

/* Labels drawn inside the diagrams. Set here rather than per-SVG so every
   diagram is lettered identically. */
.tour-figure .dlabel {
  font-family: var(--mono);
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  fill: var(--text-muted, var(--muted, #8a97a8));
}
.tour-figure .dnote {
  font-family: var(--mono);
  font-size: 8px;
  font-weight: 700;
  fill: var(--accent);
}

.tour-foot {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 20px 16px;
  border-top: 1px solid var(--border, var(--line, #1e242d));
}

.tour-dots { display: flex; gap: 6px; margin-right: auto; }
.tour-dot {
  width: 7px;
  height: 7px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--border-strong, var(--line-strong, #2c3440));
  cursor: pointer;
}
.tour-dot[aria-current="step"] { background: var(--accent); }
.tour-dot:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.tour-nav {
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  border-radius: var(--radius-sm, 6px);
  padding: 8px 15px;
  cursor: pointer;
  background: var(--surface-2, var(--panel2, #171b22));
  border: 1px solid var(--border-strong, var(--line-strong, #2c3440));
  color: var(--text-primary, var(--text, #e8edf3));
}
.tour-nav:hover:not(:disabled) { background: var(--surface-3, #20252e); }
.tour-nav:disabled { opacity: 0.4; cursor: not-allowed; }
.tour-nav.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink, #04141a);
}
.tour-nav.primary:hover { background: var(--accent-hi); }
.tour-nav:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.tour-close {
  position: absolute;
  top: 14px;
  right: 16px;
  font: inherit;
  font-size: 18px;
  line-height: 1;
  background: none;
  border: 0;
  color: var(--text-muted, var(--muted, #8a97a8));
  cursor: pointer;
  padding: 4px 7px;
  border-radius: var(--radius-sm, 6px);
}
.tour-close:hover { color: var(--text-primary, var(--text, #e8edf3)); }
.tour-close:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.tour-panel { position: relative; }

/* The app has one animation vocabulary and this joins it rather than starting
   a second one. Reduced motion gets the same panel, simply already arrived. */
@media (prefers-reduced-motion: no-preference) {
  .tour-panel { animation: tour-rise 160ms ease-out; }
  @keyframes tour-rise {
    from { opacity: 0; transform: translateY(8px); }
  }
}

@media (max-width: 560px) {
  .tour-backdrop { padding: 0; }
  .tour-panel { max-height: 100%; border-radius: 0; border: 0; }
  .tour-head { padding: 14px 46px 10px 16px; }
  .tour-title { font-size: 17px; }
  .tour-body { padding: 14px 16px; }
  .tour-foot { padding: 10px 16px 14px; gap: 8px; }
  .tour-nav { padding: 9px 13px; }
  /* At this width the dots crowd the buttons out; position is still spoken by
     the "step 3 of 9" line in the header. */
  .tour-dots { display: none; }
  .tour-foot .tour-spacer { margin-right: auto; }
}

@media print {
  .tour-backdrop, .tour-btn { display: none !important; }
}

/* Matches the chart footer's narrow breakpoint in app.css: below 1000px the
   strip cannot hold every word, and the button keeps a word rather than
   becoming a glyph -- a tutorial nobody can find is a tutorial nobody runs. */
@media (max-width: 1000px) {
  .tour-btn { font-size: 0; }
  .tour-btn::after { content: 'Tour'; font-size: 11px; }
}
