/* Contextual hints & onboarding — accessible popovers (WCAG 2.2 focus, ESC dismiss) */

.rechord-hint-trigger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.375rem;
  height: 1.375rem;
  border-radius: 9999px;
  border: 1px solid rgba(139, 92, 246, 0.35);
  background: rgba(139, 92, 246, 0.08);
  color: rgb(192, 132, 252);
  flex-shrink: 0;
  cursor: help;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.rechord-hint-trigger:hover,
.rechord-hint-trigger:focus-visible {
  background: rgba(139, 92, 246, 0.18);
  border-color: rgba(167, 139, 250, 0.55);
  color: rgb(216, 180, 254);
  outline: none;
}

.rechord-hint-trigger:focus-visible {
  box-shadow: 0 0 0 2px rgba(10, 10, 10, 1), 0 0 0 4px rgba(139, 92, 246, 0.45);
}

.rechord-hint-trigger svg {
  width: 0.75rem;
  height: 0.75rem;
}

#rechordHintPopover {
  position: fixed;
  z-index: 200;
  max-width: min(20rem, calc(100vw - 1.5rem));
  padding: 0.75rem 0.875rem;
  border-radius: 0.75rem;
  border: 1px solid rgba(64, 64, 64, 0.9);
  background: rgba(23, 23, 23, 0.98);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.55);
  font-size: 0.8125rem;
  line-height: 1.45;
  color: rgb(212, 212, 212);
  opacity: 0;
  pointer-events: none;
  transform: translateY(4px) scale(0.98);
  transition: opacity 0.16s ease, transform 0.16s ease;
}

#rechordHintPopover.is-open {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0) scale(1);
}

#rechordHintPopover .rechord-hint-popover-title {
  font-weight: 600;
  color: rgb(250, 250, 250);
  margin-bottom: 0.35rem;
}

#rechordWelcomeOverlay {
  position: fixed;
  inset: 0;
  z-index: 240;
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s ease;
}

#rechordWelcomeOverlay.is-open {
  opacity: 1;
  pointer-events: auto;
}

#rechordWelcomeCard {
  width: 100%;
  max-width: 28rem;
  border-radius: 1rem;
  border: 1px solid rgba(64, 64, 64, 0.85);
  background: linear-gradient(165deg, rgba(23, 23, 23, 0.98) 0%, rgba(12, 12, 14, 0.99) 100%);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.55);
  overflow: hidden;
}

#rechordWelcomeCard .rechord-welcome-step-num {
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: rgb(167, 139, 250);
  margin-bottom: 0.5rem;
}

#rechordWelcomeCard h2 {
  font-size: 1.25rem;
  font-weight: 700;
  color: rgb(250, 250, 250);
  letter-spacing: -0.02em;
  margin-bottom: 0.5rem;
}

#rechordWelcomeCard p {
  font-size: 0.9375rem;
  line-height: 1.55;
  color: rgb(163, 163, 163);
}

/* Welcome modal: one step per screen (no carousel) */
.rechord-welcome-body {
  max-height: 10.5rem;
  overflow: auto;
  padding-right: 0.25rem;
}
.rechord-welcome-body::-webkit-scrollbar { width: 8px; }
.rechord-welcome-body::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.12); border-radius: 9999px; }

#rechordWelcomeCard.rechord-welcome-swap [data-welcome-kicker],
#rechordWelcomeCard.rechord-welcome-swap [data-welcome-title],
#rechordWelcomeCard.rechord-welcome-swap [data-welcome-body] {
  animation: rechordSlideInRtl 200ms cubic-bezier(.2,.8,.2,1) both;
}
#rechordWelcomeCard[data-welcome-dir="ltr"].rechord-welcome-swap [data-welcome-kicker],
#rechordWelcomeCard[data-welcome-dir="ltr"].rechord-welcome-swap [data-welcome-title],
#rechordWelcomeCard[data-welcome-dir="ltr"].rechord-welcome-swap [data-welcome-body] {
  animation-name: rechordSlideInLtr;
}
@keyframes rechordSlideInRtl {
  from { opacity: 0; transform: translateX(10px); }
  to { opacity: 1; transform: translateX(0); }
}
@keyframes rechordSlideInLtr {
  from { opacity: 0; transform: translateX(-10px); }
  to { opacity: 1; transform: translateX(0); }
}

/* Tour scrim adds blur/dim behind spotlight */
#rechordTourScrim {
  position: fixed;
  inset: 0;
  z-index: 234;
  background: rgba(0, 0, 0, 0.24);
  backdrop-filter: blur(4px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease;

  /* Mask a rectangular "hole" for the highlighted target */
  --spot-x: 0px;
  --spot-y: 0px;
  --spot-w: 0px;
  --spot-h: 0px;
  -webkit-mask-repeat: no-repeat;
  -webkit-mask-position: 0 0, var(--spot-x) var(--spot-y);
  -webkit-mask-size: 100% 100%, var(--spot-w) var(--spot-h);
  -webkit-mask-image: linear-gradient(#000 0 0), linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;

  mask-repeat: no-repeat;
  mask-position: 0 0, var(--spot-x) var(--spot-y);
  mask-size: 100% 100%, var(--spot-w) var(--spot-h);
  mask-image: linear-gradient(#000 0 0), linear-gradient(#000 0 0);
  mask-composite: exclude;
}
#rechordTourScrim.is-on {
  opacity: 1;
  /* Let clicks reach the page / highlighted control; dismiss is handled in JS (see onboarding-ui.js). */
  pointer-events: none;
}

/* Make “Start tab tour” read as primary onboarding action */
.rechord-tour-cta {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.85rem 0.9rem;
  border-radius: 0.9rem;
  border: 1px solid rgba(167, 139, 250, 0.38);
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.16) 0%, rgba(17, 17, 17, 0.55) 55%, rgba(17, 17, 17, 0.35) 100%);
  color: rgb(237, 233, 254);
  text-align: left;
  box-shadow:
    0 0 0 1px rgba(0,0,0,0.25) inset,
    0 18px 60px -44px rgba(139, 92, 246, 0.85);
  transition: transform 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}
.rechord-tour-cta:hover,
.rechord-tour-cta:focus-visible {
  transform: translateY(-1px);
  border-color: rgba(167, 139, 250, 0.55);
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.22) 0%, rgba(17, 17, 17, 0.62) 55%, rgba(17, 17, 17, 0.45) 100%);
  outline: none;
}
.rechord-tour-cta__icon {
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 0.85rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  background: rgba(139, 92, 246, 0.18);
  border: 1px solid rgba(167, 139, 250, 0.25);
  color: rgb(216, 180, 254);
}
.rechord-tour-cta__icon svg { width: 1.25rem; height: 1.25rem; }
.rechord-tour-cta__text { display: grid; gap: 0.15rem; min-width: 0; }
.rechord-tour-cta__title {
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: rgb(250, 250, 250);
}
.rechord-tour-cta__sub {
  font-size: 0.75rem;
  line-height: 1.3;
  color: rgba(216, 180, 254, 0.85);
}

#rechordTourSpotlight {
  position: fixed;
  z-index: 235;
  border-radius: 0.75rem;
  /* Dim the rest of the page only — no purple ring on the highlighted control */
  box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.62);
  pointer-events: none;
  transition: top 0.25s ease, left 0.25s ease, width 0.25s ease, height 0.25s ease, opacity 0.2s ease;
  opacity: 0;
}

#rechordTourSpotlight.is-on {
  opacity: 1;
}

#rechordTourCoach {
  position: fixed;
  z-index: 238;
  max-width: min(22rem, calc(100vw - 2rem));
  padding: 1rem 1.125rem;
  border-radius: 0.875rem;
  border: 1px solid rgba(64, 64, 64, 0.9);
  background: rgba(17, 17, 17, 0.97);
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.5);
  opacity: 0;
  pointer-events: none;
  transform: translateY(10px);
  transition: opacity 0.2s ease, transform 0.22s ease;
}

#rechordTourCoach.is-on {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.rechord-tour-coach-inner {
  position: relative;
  padding-top: 0.15rem;
}

.rechord-tour-dismiss-x {
  position: absolute;
  top: 0;
  right: 0;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  margin: -0.25rem -0.15rem 0 0;
  padding: 0;
  border: none !important;
  border-radius: 0.55rem;
  background: transparent;
  font-size: 1.35rem;
  line-height: 1;
  color: rgba(163, 163, 163, 0.95);
  cursor: pointer;
}

.rechord-tour-dismiss-x:hover,
.rechord-tour-dismiss-x:focus-visible {
  color: rgb(245, 245, 245);
  background: rgba(255, 255, 255, 0.06);
  outline: none;
}

.rechord-community-flow-banner {
  border-radius: 0.75rem;
  border: 1px solid rgba(139, 92, 246, 0.22);
  background: linear-gradient(135deg, rgba(88, 28, 135, 0.12) 0%, rgba(23, 23, 23, 0.6) 100%);
}

html[data-theme='light'] #rechordWelcomeOverlay {
  background: rgba(248, 250, 252, 0.55);
  backdrop-filter: blur(6px);
}

html[data-theme='light'] #rechordWelcomeCard,
html[data-theme='light'] #rechordTourCoach,
html[data-theme='light'] #rechordHintPopover {
  background: #ffffff !important;
  border-color: rgba(148, 163, 184, 0.58) !important;
  color: rgba(15, 23, 42, 0.9) !important;
  box-shadow: 0 14px 38px rgba(15, 23, 42, 0.16) !important;
}

html[data-theme='light'] #rechordWelcomeCard h2,
html[data-theme='light'] #rechordTourCoach h3,
html[data-theme='light'] #rechordHintPopover .rechord-hint-popover-title,
html[data-theme='light'] #rechordWelcomeCard .rechord-tour-cta__title {
  color: rgba(15, 23, 42, 0.9) !important;
}

html[data-theme='light'] #rechordWelcomeCard p,
html[data-theme='light'] #rechordTourCoach p,
html[data-theme='light'] #rechordWelcomeCard .rechord-tour-cta__sub {
  color: rgba(15, 23, 42, 0.62) !important;
}

html[data-theme='light'] #rechordWelcomeCard .rechord-tour-cta {
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.12) 0%, rgba(248, 250, 252, 0.96) 100%) !important;
  color: rgba(15, 23, 42, 0.9) !important;
  border-color: rgba(167, 139, 250, 0.45) !important;
  box-shadow: 0 0 0 1px rgba(139, 92, 246, 0.14) inset !important;
}

html[data-theme='light'] #rechordWelcomeCard > .px-6,
html[data-theme='light'] #rechordWelcomeCard .border-t.border-neutral-800\/80 {
  background: #f8fafc !important;
  border-top-color: rgba(148, 163, 184, 0.6) !important;
}

html[data-theme='light'] #rechordWelcomeCard [data-welcome-dot] {
  background: rgba(148, 163, 184, 0.6) !important;
}

html[data-theme='light'] #rechordWelcomeCard [data-welcome-dot].bg-purple-500 {
  background: rgba(139, 92, 246, 0.95) !important;
}

html[data-theme='light'] #rechordWelcomeCard .btn-secondary,
html[data-theme='light'] #rechordWelcomeCard .btn-primary,
html[data-theme='light'] #rechordTourCoach .btn-secondary,
html[data-theme='light'] #rechordTourCoach .btn-primary {
  background: #ffffff !important;
  border: 1px solid rgba(148, 163, 184, 0.68) !important;
  color: rgba(15, 23, 42, 0.9) !important;
  box-shadow: none !important;
}

html[data-theme='light'] .rechord-tour-dismiss-x {
  color: rgba(71, 85, 105, 0.92);
}
html[data-theme='light'] .rechord-tour-dismiss-x:hover,
html[data-theme='light'] .rechord-tour-dismiss-x:focus-visible {
  color: rgba(15, 23, 42, 0.92);
  background: rgba(15, 23, 42, 0.06);
}

html[data-theme='light'] #rechordWelcomeCard .btn-secondary:hover,
html[data-theme='light'] #rechordWelcomeCard .btn-primary:hover,
html[data-theme='light'] #rechordTourCoach .btn-secondary:hover,
html[data-theme='light'] #rechordTourCoach .btn-primary:hover {
  background: #f8fafc !important;
  color: rgba(15, 23, 42, 0.72) !important;
}
