/* ============================================================
   VISITE GUIDÉE — spotlight onboarding
   Design éditorial joy (tokens, zéro hex en dur), icônes au trait,
   animations modernes (glissement inter-étapes, halo, révélations).
   ============================================================ */

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

/* Voile qui assombrit l'app + léger vignettage radial pour concentrer
   le regard. Ne se ferme PAS au clic (cohérent anti-perte-de-saisie). */
.tour-veil {
  position: fixed;
  inset: 0;
  background:
    radial-gradient(120% 120% at 50% 40%, rgba(20, 16, 14, 0.36) 0%, rgba(20, 16, 14, 0.62) 100%);
  backdrop-filter: blur(2px) saturate(1.05);
  -webkit-backdrop-filter: blur(2px) saturate(1.05);
  pointer-events: auto;
  animation: tourVeilIn 0.32s ease both;
}

/* ---- Anneau lumineux + halo autour de la cible -------------------------- */
.tour-ring {
  position: fixed;
  z-index: 100001;
  border-radius: var(--radius-md, 12px);
  pointer-events: none;
  /* anneau net accent + douceur autour */
  box-shadow:
    0 0 0 2px var(--accent, #b98a5e),
    0 0 0 6px color-mix(in srgb, var(--accent, #b98a5e) 26%, transparent),
    0 10px 34px rgba(20, 16, 14, 0.34);
  /* glissement fluide d'une étape à l'autre */
  transition:
    top 0.42s cubic-bezier(.22, 1, .36, 1),
    left 0.42s cubic-bezier(.22, 1, .36, 1),
    width 0.42s cubic-bezier(.22, 1, .36, 1),
    height 0.42s cubic-bezier(.22, 1, .36, 1);
}
.tour-ring.hidden { display: none; }

/* Halo qui respire (pulse doux, expansion continue). */
.tour-ring::after {
  content: '';
  position: absolute;
  inset: -2px;
  border-radius: inherit;
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent, #b98a5e) 55%, transparent);
  animation: tourHalo 2.2s ease-out infinite;
}

/* ---- La bulle d'information -------------------------------------------- */
.tour-tip {
  position: fixed;
  z-index: 100003;
  width: 340px;
  max-width: calc(100vw - 24px);
  overflow: hidden;
  color: var(--text-primary, var(--ink, #1a1614));
  background:
    linear-gradient(180deg,
      color-mix(in srgb, var(--accent, #b98a5e) 7%, var(--surface, #fff)) 0%,
      var(--surface, #fff) 34%);
  border: 1px solid color-mix(in srgb, var(--accent, #b98a5e) 22%, var(--line, rgba(0, 0, 0, 0.08)));
  border-radius: var(--radius-lg, 18px);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.5) inset,
    0 18px 50px rgba(20, 16, 14, 0.26),
    0 4px 14px rgba(20, 16, 14, 0.12);
  padding: 22px 22px 16px;
  /* glissement fluide entre cibles + entrée */
  transition:
    top 0.42s cubic-bezier(.22, 1, .36, 1),
    left 0.42s cubic-bezier(.22, 1, .36, 1);
  animation: tourCardIn 0.4s cubic-bezier(.34, 1.4, .5, 1) both;
}

/* Fine barre de progression globale, en haut de la carte. */
.tour-tip-progress {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: color-mix(in srgb, var(--accent, #b98a5e) 16%, transparent);
}
.tour-tip-progress > span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg,
    color-mix(in srgb, var(--accent, #b98a5e) 70%, #fff),
    var(--accent, #b98a5e));
  border-radius: 0 3px 3px 0;
  transition: width 0.45s cubic-bezier(.22, 1, .36, 1);
}

.tour-tip-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
  padding-right: 26px; /* place pour la croix */
  animation: tourItemIn 0.4s ease both;
  animation-delay: 0.04s;
}

/* Badge circulaire de l'icône au trait. */
.tour-tip-icon {
  flex: 0 0 auto;
  width: 42px;
  height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-full, 999px);
  color: var(--accent, #b98a5e);
  background:
    radial-gradient(120% 120% at 30% 25%,
      color-mix(in srgb, var(--accent, #b98a5e) 20%, var(--surface, #fff)) 0%,
      color-mix(in srgb, var(--accent, #b98a5e) 11%, var(--surface, #fff)) 100%);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent, #b98a5e) 24%, transparent);
  animation: tourIconIn 0.5s cubic-bezier(.34, 1.56, .5, 1) both;
  animation-delay: 0.06s;
}
.tour-tip-icon .ui-ico { display: block; }

.tour-tip-title {
  font-family: var(--serif, Georgia, serif);
  font-size: 19px;
  line-height: 1.18;
  margin: 0;
  letter-spacing: -0.01em;
  color: var(--text-primary, var(--ink, #1a1614));
}
.tour-tip-text {
  font-family: var(--sans, system-ui, sans-serif);
  font-size: 14px;
  line-height: 1.6;
  color: var(--text-secondary, var(--muted, #6b625b));
  margin: 0 0 16px;
  animation: tourItemIn 0.4s ease both;
  animation-delay: 0.1s;
}
.tour-tip-text strong { color: var(--text-primary, var(--ink, #1a1614)); font-weight: 600; }

.tour-guide-cta {
  margin: 0 0 16px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  animation: tourItemIn 0.4s ease both;
  animation-delay: 0.14s;
}
.tour-guide-cta .ui-ico { flex: 0 0 auto; }

.tour-tip-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  animation: tourItemIn 0.4s ease both;
  animation-delay: 0.16s;
}
.tour-dots {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-wrap: wrap;
}
.tour-dot {
  width: 6px;
  height: 6px;
  border-radius: var(--radius-full, 999px);
  background: color-mix(in srgb, var(--accent, #b98a5e) 22%, var(--line, rgba(0, 0, 0, 0.18)));
  transition: width 0.3s ease, background 0.3s ease;
}
.tour-dot.is-active {
  width: 18px;
  background: var(--accent, #b98a5e);
}
.tour-nav {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
}

.tour-choice {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  animation: tourItemIn 0.4s ease both;
  animation-delay: 0.1s;
}

/* Croix de fermeture. */
.tour-close {
  position: absolute;
  top: 13px;
  right: 13px;
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: transparent;
  color: var(--text-secondary, var(--muted, #6b625b));
  border-radius: var(--radius-full, 999px);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, transform 0.15s ease;
}
.tour-close:hover {
  background: color-mix(in srgb, var(--accent, #b98a5e) 12%, transparent);
  color: var(--text-primary, var(--ink, #1a1614));
  transform: rotate(90deg);
}

/* Lien discret « passer ». */
.tour-skip-link {
  display: block;
  margin: 13px auto 0;
  padding: 4px 8px;
  border: none;
  background: transparent;
  font-family: var(--sans, system-ui, sans-serif);
  font-size: 12px;
  color: var(--text-muted, var(--muted, #8a817a));
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
  transition: color 0.15s ease;
}
.tour-skip-link:hover { color: var(--text-secondary, var(--ink, #1a1614)); }

/* Empêche le scroll de l'app pendant la visite. */
body.tour-active { overflow: hidden; }

/* ---- Keyframes ---------------------------------------------------------- */
@keyframes tourVeilIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes tourCardIn {
  from { opacity: 0; transform: translateY(10px) scale(0.965); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes tourItemIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes tourIconIn {
  0% { opacity: 0; transform: scale(0.4) rotate(-14deg); }
  100% { opacity: 1; transform: scale(1) rotate(0); }
}
@keyframes tourHalo {
  0% { opacity: 0.7; transform: scale(1); }
  70% { opacity: 0; transform: scale(1.14); }
  100% { opacity: 0; transform: scale(1.14); }
}

/* Réglages fins mobile : la bulle prend toute la largeur utile. */
@media (max-width: 560px) {
  .tour-tip { width: calc(100vw - 24px); }
}

/* Respecte prefers-reduced-motion : coupe les mouvements, garde l'opacité. */
@media (prefers-reduced-motion: reduce) {
  .tour-veil, .tour-tip, .tour-tip-head, .tour-tip-text, .tour-tip-foot,
  .tour-tip-icon, .tour-guide-cta, .tour-choice {
    animation: none;
  }
  .tour-tip { transition: none; }
  .tour-ring { animation: none; transition: none; }
  .tour-ring::after { animation: none; content: none; }
  .tour-close:hover { transform: none; }
}
