/* First-time tour (tour-ui.js): welcome card, spotlight steps, closing card. Colours come from the portal's tokens, so light and dark
   follow the theme. The spotlight is a transparent box whose huge shadow dims everything else. */

:root {
  --tour-scrim: rgba(24, 12, 17, 0.6);
}

:root[data-theme="dark"] {
  --tour-scrim: rgba(0, 0, 0, 0.68);
}

.tour-root {
  position: fixed;
  inset: 0;
  z-index: 200;
}

.tour-scrim {
  position: absolute;
  inset: 0;
  background: var(--tour-scrim);
}

.tour-scrim[hidden],
.tour-spot[hidden] {
  display: none;
}

.tour-spot {
  position: fixed;
  border-radius: 14px;
  pointer-events: none;
  box-shadow: 0 0 0 3px #ffffff, 0 0 0 9999px var(--tour-scrim);
}

.tour-card {
  position: fixed;
  box-sizing: border-box;
  max-height: calc(100vh - 32px);
  overflow: auto;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.4);
}

.tour-card:focus {
  outline: none;
}

.tour-card-welcome,
.tour-card-done {
  top: 50%;
  left: 50%;
  width: min(560px, calc(100vw - 32px));
  transform: translate(-50%, -50%);
}

.tour-card-done {
  width: min(460px, calc(100vw - 32px));
  padding: 32px 28px 28px;
  text-align: center;
}

.tour-card-step {
  padding: 22px 24px 20px;
  overflow: visible;
}

/* the pointer from a step card to the control it explains */
.tour-card-step::before {
  content: "";
  position: absolute;
  top: -9px;
  left: calc(var(--tour-notch, 48px) - 8px);
  width: 16px;
  height: 16px;
  background: var(--surface);
  border-left: 1px solid var(--border);
  border-top: 1px solid var(--border);
  border-radius: 3px 0 0 0;
  transform: rotate(45deg);
}

.tour-card-step.tour-card-above::before {
  top: auto;
  bottom: -9px;
  transform: rotate(225deg);
}

.tour-title {
  margin: 0;
  color: var(--ink);
  font-family: var(--font-head);
  font-size: 1.25rem;
  line-height: 1.2;
}

.tour-title:focus {
  outline: none;
}

/* welcome */

.tour-band {
  position: relative;
  padding: 30px 32px 26px;
  background: var(--brand);
  color: var(--on-brand);
}

.tour-band .tour-title {
  max-width: 420px;
  color: var(--on-brand);
  font-size: 1.75rem;
}

.tour-eyebrow {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.tour-band .tour-title {
  margin-top: 8px;
}

.tour-intro {
  max-width: 440px;
  margin: 10px 0 0;
  font-size: 0.95rem;
  line-height: 1.45;
}

.tour-close {
  position: absolute;
  top: 10px;
  right: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  border-radius: var(--radius-pill);
  background: transparent;
  color: var(--on-brand);
  cursor: pointer;
}

.tour-close-plain {
  color: var(--muted);
}

.tour-close:hover {
  background: rgba(255, 255, 255, 0.18);
}

.tour-close-plain:hover {
  background: var(--surface-hover);
}

.tour-close:focus-visible,
.tour-btn:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

.tour-list {
  margin: 0;
  padding: 8px 32px 4px;
  list-style: none;
}

.tour-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 0;
}

.tour-row + .tour-row {
  border-top: 1px solid var(--border);
}

.tour-row strong,
.tour-menu-hint strong {
  display: block;
  color: var(--ink);
  font-size: 0.95rem;
}

.tour-row-text {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.85rem;
  line-height: 1.35;
}

.tour-tile {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: var(--radius);
  background: var(--brand-tint);
  color: var(--brand-tint-text);
}

.tour-foot {
  padding: 14px 32px 26px;
}

.tour-hint {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 16px 0 0;
  color: var(--muted);
  font-size: 0.82rem;
}

.tour-hint .icon {
  flex: none;
}

/* steps */

.tour-progress {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.tour-counter {
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.tour-dots {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.tour-dots i {
  width: 8px;
  height: 8px;
  border-radius: var(--radius-pill);
  background: var(--border-strong);
}

.tour-dots i.past {
  background: var(--brand);
}

.tour-dots i.current {
  width: 22px;
  background: var(--brand);
}

.tour-step-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 16px;
}

.tour-body {
  margin: 12px 0 0;
  color: var(--text);
  font-size: 0.92rem;
  line-height: 1.5;
}

.tour-body-center {
  margin-top: 8px;
  color: var(--muted);
}

/* buttons */

.tour-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}

.tour-actions-step {
  margin-top: 18px;
  gap: 8px;
}

.tour-actions-step .tour-btn-text {
  margin-right: auto;
}

.tour-btn {
  min-height: 44px;
  padding: 0 22px;
  border: 2px solid var(--brand);
  border-radius: var(--radius-pill);
  font-family: var(--font-body);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
}

.tour-btn-primary {
  background: var(--brand);
  color: var(--on-brand);
}

.tour-btn-primary:hover {
  background: var(--brand-strong);
  border-color: var(--brand-strong);
}

.tour-btn-secondary {
  border-color: var(--border-strong);
  background: transparent;
  color: var(--ink);
}

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

.tour-btn-text {
  padding: 0 12px;
  border-color: transparent;
  background: transparent;
  color: var(--muted);
}

.tour-btn-text:hover {
  color: var(--ink);
}

/* closing card */

.tour-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  margin-bottom: 14px;
  border-radius: var(--radius-pill);
  background: var(--brand);
  color: var(--on-brand);
}

.tour-card-done .tour-title {
  font-size: 1.6rem;
}

.tour-menu-hint {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 20px 0 18px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--page);
  text-align: left;
}

.tour-card-done .tour-actions {
  justify-content: center;
}

.tour-card-done .tour-btn-primary {
  width: 100%;
}

/* phones: every card is a sheet along the bottom; the top bar it points at stays in view above it */

@media (max-width: 620px) {
  .tour-card {
    top: auto !important;
    right: 0;
    bottom: 0;
    left: 0 !important;
    width: auto !important;
    max-height: 86vh;
    transform: none;
    border-radius: 24px 24px 0 0;
    box-shadow: 0 -12px 40px rgba(0, 0, 0, 0.35);
  }

  .tour-card-step {
    overflow: auto;
    padding-bottom: 24px;
  }

  .tour-card-step::before {
    display: none;
  }

  .tour-card-welcome,
  .tour-card-done {
    top: auto;
    left: 0;
    width: auto;
  }

  .tour-band {
    padding: 22px 20px 20px;
  }

  .tour-list {
    padding: 4px 20px 0;
  }

  .tour-row {
    padding: 8px 0;
  }

  .tour-foot {
    padding: 12px 20px 24px;
  }

  .tour-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .tour-actions-step {
    flex-direction: row;
    flex-wrap: wrap;
  }

  .tour-actions-step .tour-btn-primary {
    flex: 1;
  }

  .tour-actions-step .tour-btn-text {
    order: 3;
    flex-basis: 100%;
    margin-right: 0;
  }

  .tour-hint {
    display: none;
  }
}
