/* ══════════════════════════════════════════════════════
   TUTORIAL — Visite guidée : spotlight + cartes illustrées
══════════════════════════════════════════════════════ */

#tuto-overlay {
  position: fixed;
  inset: 0;
  z-index: 9100;
  display: none;
}

#tuto-overlay.active {
  display: block;
  animation: tutoOverlayIn .3s ease;
}

@keyframes tutoOverlayIn {
  from { opacity: 0; }
}

/* ── Spotlight : le box-shadow géant crée l'overlay sombre,
      l'élément lui-même est le "trou" autour de la cible ── */
#tuto-spot {
  position: fixed;
  pointer-events: none;
  border-radius: 16px;
  box-shadow:
    0 0 0 3px var(--primary-ring),
    0 0 0 200vmax rgba(8, 10, 17, .64);
  transition:
    top .5s var(--ease-spring),
    left .5s var(--ease-spring),
    width .5s var(--ease-spring),
    height .5s var(--ease-spring),
    border-radius .5s var(--ease-spring),
    box-shadow .4s var(--ease);
}

#tuto-spot.no-hole {
  box-shadow:
    0 0 0 0 transparent,
    0 0 0 200vmax rgba(8, 10, 17, .64);
}

#tuto-spot::after {
  content: '';
  position: absolute;
  inset: -3px;
  border-radius: inherit;
  border: 2px solid var(--primary);
  animation: tutoPulse 1.8s ease-out infinite;
}

#tuto-spot.no-hole::after {
  display: none;
}

@keyframes tutoPulse {
  0%   { opacity: .9; transform: scale(1); }
  70%  { opacity: 0;  transform: scale(1.12); }
  100% { opacity: 0;  transform: scale(1.12); }
}

/* ══════════════ CARTE ══════════════ */
.tuto-card {
  position: fixed;
  width: min(380px, calc(100vw - 28px));
  background: var(--bg-card);
  border: 1.5px solid var(--border);
  border-radius: var(--r-l);
  box-shadow: var(--shadow-l);
  padding: 18px 20px 18px;
  font-family: var(--font);
  transition: opacity .16s ease;
}

#tuto-overlay.active .tuto-card {
  animation: tutoCardIn .4s ease;
}

@keyframes tutoCardIn {
  from { opacity: 0; }
}

.tuto-card.swap {
  opacity: 0;
}

.tuto-card.hero {
  width: min(432px, calc(100vw - 28px));
  text-align: center;
  padding: 26px 24px 20px;
}

/* Fermer / passer */
.tuto-x {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 30px;
  height: 30px;
  border-radius: 10px;
  border: none;
  background: transparent;
  color: var(--ink-3);
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .15s, color .15s;
  z-index: 1;
}

.tuto-x:hover {
  background: var(--bg-hover);
  color: var(--ink);
}

/* Barre de progression */
.tuto-prog {
  height: 4px;
  background: var(--bg-hover);
  border-radius: var(--r-full);
  overflow: hidden;
  margin: 2px 34px 14px 0;
}

.tuto-prog i {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--primary-dark));
  border-radius: inherit;
  transition: width .4s var(--ease-spring);
}

/* En-tête d'étape */
.tuto-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 11px;
  padding-right: 22px;
}

.tuto-ico {
  width: 42px;
  height: 42px;
  border-radius: 13px;
  background: linear-gradient(135deg, #ffdb4d, var(--primary));
  color: #171204;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: none;
  box-shadow: inset 0 -2px 0 rgba(0, 0, 0, .08), var(--shadow-xs);
}

.tuto-ico svg {
  width: 22px;
  height: 22px;
}

.tuto-kicker {
  font-family: var(--mono);
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--ink-3);
}

.tuto-title {
  font-size: 17.5px;
  font-weight: 800;
  color: var(--ink);
  line-height: 1.25;
  margin-top: 2px;
}

.tuto-body {
  font-size: 13.5px;
  color: var(--ink-2);
  line-height: 1.62;
}

.tuto-body strong {
  color: var(--ink);
  font-weight: 700;
}

/* Exemples de recherche */
.tuto-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 12px;
}

.tuto-chip {
  font-family: var(--mono);
  font-size: 11.5px;
  font-weight: 500;
  padding: 4px 11px;
  border-radius: var(--r-full);
  background: var(--primary-soft);
  border: 1px solid rgba(255, 204, 0, .4);
  color: var(--ink);
}

/* ══════════════ MINI-MAQUETTES ══════════════ */
.tuto-viz {
  margin-top: 14px;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--r-m);
  padding: 12px;
}

/* Rangée façon horaire / résultat de recherche */
.tviz-row {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 9px 12px;
  box-shadow: var(--shadow-xs);
}

.tviz-row + .tviz-row {
  margin-top: 8px;
}

.tviz-row.dim {
  opacity: .55;
}

.tviz-badge {
  min-width: 34px;
  height: 26px;
  padding: 0 7px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  background: var(--primary);
  color: #171204;
  font-family: var(--mono);
  font-size: 12.5px;
  font-weight: 700;
  flex: none;
}

.tviz-badge.stoppin {
  background: var(--blue);
  color: #fff;
}

.tviz-badge.stoppin svg {
  width: 14px;
  height: 14px;
}

.tviz-badge.fav {
  background: #171204;
  color: var(--primary);
}

.tviz-info {
  flex: 1;
  min-width: 0;
}

.tviz-info b {
  display: block;
  font-size: 13px;
  font-weight: 700;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tviz-info span {
  font-size: 11px;
  color: var(--ink-3);
}

.tviz-info .live {
  color: var(--green);
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.tviz-info .live i,
.tviz-status i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  display: inline-block;
  animation: tutoBlink 1.4s infinite;
}

@keyframes tutoBlink {
  50% { opacity: .25; }
}

.tviz-time {
  text-align: right;
  flex: none;
}

.tviz-time b {
  display: block;
  font-family: var(--mono);
  font-size: 14px;
  color: var(--ink);
}

.tviz-time b.ok {
  color: var(--green);
}

.tviz-time span {
  font-size: 10.5px;
  color: var(--ink-3);
}

.tviz-star {
  font-size: 20px;
  color: var(--ink-4);
  flex: none;
}

.tviz-star.on {
  color: var(--primary-dark);
  animation: tutoStarPop .55s var(--ease-spring);
}

@keyframes tutoStarPop {
  0%   { transform: scale(.4); }
  70%  { transform: scale(1.2); }
  100% { transform: scale(1); }
}

/* Maquette bus temps réel */
.tviz-busbox {
  display: flex;
  align-items: center;
  gap: 16px;
}

.tviz-busmark {
  position: relative;
  width: 66px;
  height: 66px;
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
}

.tviz-busmark img {
  width: 46px;
  height: 46px;
  position: relative;
  z-index: 1;
  animation: tutoFloat 2.6s ease-in-out infinite;
}

.tviz-ring {
  position: absolute;
  inset: 8px;
  border-radius: 50%;
  background: rgba(255, 204, 0, .3);
  animation: tutoRing 2s ease-out infinite;
}

.tviz-num {
  position: absolute;
  top: -3px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 2;
  background: #171204;
  color: #fff;
  font-family: var(--mono);
  font-size: 10.5px;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: var(--r-full);
}

@keyframes tutoRing {
  0%   { transform: scale(.7);  opacity: .9; }
  100% { transform: scale(1.55); opacity: 0; }
}

@keyframes tutoFloat {
  50% { transform: translateY(-3px); }
}

.tviz-badges {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.tviz-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: var(--r-full);
  width: max-content;
}

.tviz-status.ok    { background: var(--green-soft); color: var(--green); }
.tviz-status.late  { background: var(--red-soft);   color: var(--red); }
.tviz-status.early { background: #dbeafe;           color: var(--blue); }

/* Maquette itinéraire */
.tviz-routebox {
  position: relative;
  padding: 12px 4px 2px;
}

.tviz-routebox svg {
  width: 100%;
  height: auto;
  display: block;
}

.tr-glow {
  fill: none;
  stroke: rgba(255, 204, 0, .3);
  stroke-width: 11;
  stroke-linecap: round;
}

.tr-base {
  fill: none;
  stroke: var(--primary);
  stroke-width: 5.5;
  stroke-linecap: round;
}

.tr-dash {
  fill: none;
  stroke: #fff;
  stroke-width: 2;
  stroke-dasharray: 4 8;
  stroke-linecap: round;
  animation: tutoDash 1.2s linear infinite;
}

@keyframes tutoDash {
  to { stroke-dashoffset: -12; }
}

.tr-stop {
  fill: #fff;
  stroke: var(--ink);
  stroke-width: 2.5;
}

.tr-stop.end {
  stroke: var(--green);
}

.tr-bus {
  fill: var(--ink);
  stroke: #fff;
  stroke-width: 2.5;
}

.tviz-follow {
  position: absolute;
  top: 0;
  right: 4px;
  font-size: 10.5px;
  font-weight: 700;
  color: var(--green);
  background: var(--green-soft);
  padding: 3px 9px;
  border-radius: var(--r-full);
}

/* ══════════════ PIED DE CARTE ══════════════ */
.tuto-foot {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 16px;
}

.tuto-foot-gap {
  flex: 1;
}

.tuto-back {
  width: 36px;
  height: 36px;
  border-radius: 11px;
  border: 1.5px solid var(--border);
  background: var(--bg-card);
  color: var(--ink-2);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .15s, border-color .15s;
}

.tuto-back:hover {
  border-color: var(--border-dark);
  background: var(--bg-hover);
}

.tuto-next {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: var(--primary);
  border: none;
  color: #171204;
  font-family: var(--font);
  font-size: 13.5px;
  font-weight: 800;
  padding: 9px 18px;
  border-radius: 12px;
  cursor: pointer;
  box-shadow: var(--shadow-xs);
  transition: background .15s, transform .12s;
}

.tuto-next:hover {
  background: var(--primary-dark);
  transform: translateY(-1px);
}

.tuto-next:active {
  transform: translateY(0);
}

.tuto-next:focus-visible,
.tuto-back:focus-visible,
.tuto-x:focus-visible,
.tuto-hero-skip:focus-visible {
  outline: 2px solid var(--primary-dark);
  outline-offset: 2px;
}

/* ══════════════ HERO (accueil + fin) ══════════════ */
.tuto-hero-logo {
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .16em;
  color: var(--ink-3);
}

.tuto-hero-logo em {
  font-style: normal;
  color: var(--primary-dark);
}

.tuto-hero-title {
  font-size: 22px;
  font-weight: 800;
  color: var(--ink);
  margin: 10px 0 6px;
}

.tuto-hero-sub {
  font-size: 13.5px;
  color: var(--ink-2);
  line-height: 1.6;
  max-width: 38ch;
  margin: 0 auto;
}

.tuto-feats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 18px 0 2px;
  text-align: left;
}

.tuto-feat {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 11px;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: 13px;
}

.tuto-feat-ico {
  width: 32px;
  height: 32px;
  flex: none;
  border-radius: 10px;
  background: linear-gradient(135deg, #ffdb4d, var(--primary));
  color: #171204;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: inset 0 -1.5px 0 rgba(0, 0, 0, .07);
}

.tuto-feat-ico svg {
  width: 17px;
  height: 17px;
}

.tuto-feat b {
  display: block;
  font-size: 12px;
  font-weight: 700;
  color: var(--ink);
}

/* uniquement le span de description (pas .tuto-feat-ico, qui est aussi un span) */
.tuto-feat div span {
  display: block;
  font-size: 10.5px;
  line-height: 1.35;
  color: var(--ink-3);
}

.tuto-hero-cta {
  width: 100%;
  justify-content: center;
  padding: 12px 18px;
  font-size: 14.5px;
  border-radius: 14px;
  margin-top: 16px;
}

.tuto-hero-skip {
  background: none;
  border: none;
  font-family: var(--font);
  font-size: 12.5px;
  color: var(--ink-3);
  margin-top: 8px;
  padding: 6px 10px;
  cursor: pointer;
}

.tuto-hero-skip:hover {
  color: var(--ink);
  text-decoration: underline;
}

.tuto-hero-note {
  font-size: 11px;
  color: var(--ink-4);
  margin-top: 6px;
}

.tuto-hero-note b {
  color: var(--ink-3);
}

.tuto-hero-check {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  margin: 4px auto 0;
  background: var(--green-soft);
  color: var(--green);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: tutoStarPop .6s var(--ease-spring);
}

.tuto-hero-check svg {
  width: 26px;
  height: 26px;
}

/* ══════════════ TOUR "NOUVEAUTÉS" ══════════════ */
.tuto-update-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: .12em;
  text-transform: uppercase;
  background: var(--primary-soft);
  border: 1px solid rgba(255, 204, 0, .45);
  color: #8a6d00;
  padding: 4px 12px;
  border-radius: var(--r-full);
}

.tuto-update-badge svg {
  width: 12px;
  height: 12px;
}

.tuto-upds {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 16px 0 2px;
  text-align: left;
}

/* Maquette recherche d'arrêt */
.tviz-search {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-card);
  border: 1.5px solid var(--primary);
  border-radius: var(--r-full);
  padding: 8px 14px;
  box-shadow: 0 0 0 3px var(--primary-soft);
  margin-bottom: 10px;
}

.tviz-search svg {
  width: 15px;
  height: 15px;
  color: var(--ink-3);
  flex: none;
}

.tviz-search-txt {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  display: inline-flex;
  align-items: center;
}

.tviz-caret {
  width: 1.5px;
  height: 14px;
  background: var(--ink);
  margin-left: 2px;
  animation: tutoCaret 1.05s steps(1) infinite;
}

@keyframes tutoCaret {
  50% { opacity: 0; }
}

.tviz-go {
  color: var(--ink-3);
  font-size: 15px;
  flex: none;
}

/* Bandeau info (liste complète des passages) */
.tviz-note {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 11px;
  font-weight: 600;
  color: var(--green);
  background: var(--green-soft);
  border-radius: 9px;
  padding: 6px 10px;
  margin-bottom: 8px;
}

.tviz-note i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
  animation: tutoBlink 1.4s infinite;
  flex: none;
}

/* Démo couleurs officielles */
.tviz-cchips {
  display: flex;
  gap: 7px;
  flex-wrap: wrap;
  justify-content: center;
  padding: 4px 0 2px;
}

.tviz-cchip {
  min-width: 38px;
  height: 28px;
  padding: 0 9px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 9px;
  background: var(--c);
  color: var(--i);
  font-family: var(--mono);
  font-weight: 700;
  font-size: 12.5px;
  box-shadow: var(--shadow-xs);
  animation: tutoChipPop .5s var(--ease-spring) backwards;
}

.tviz-cchip:nth-child(2) { animation-delay: .08s; }
.tviz-cchip:nth-child(3) { animation-delay: .16s; }
.tviz-cchip:nth-child(4) { animation-delay: .24s; }
.tviz-cchip:nth-child(5) { animation-delay: .32s; }

@keyframes tutoChipPop {
  from { transform: scale(.3); opacity: 0; }
}

.tuto-color-btn {
  width: 100%;
  margin-top: 12px;
  border: none;
  border-radius: 11px;
  padding: 10px 14px;
  font-family: var(--font);
  font-size: 13px;
  font-weight: 800;
  background: #171204;
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  transition: transform .12s, background .2s, color .2s;
}

.tuto-color-btn svg {
  width: 16px;
  height: 16px;
}

.tuto-color-btn:hover:not(:disabled) {
  transform: translateY(-1px);
}

.tuto-color-btn.on {
  background: var(--green-soft);
  color: var(--green);
  cursor: default;
}

/* Démo trafic : route colorée par niveau */
.tviz-traffic {
  padding: 6px 2px 0;
}

.tviz-traffic svg {
  width: 100%;
  height: auto;
  display: block;
}

.tviz-traffic svg path {
  fill: none;
  stroke-width: 7;
  stroke-linecap: round;
}

.tviz-traffic svg .tvt-casing {
  stroke: var(--ink);
  stroke-width: 10.5;
  opacity: .14;
}

.tviz-tl {
  display: flex;
  justify-content: space-between;
  margin-top: 6px;
  padding: 0 4px;
}

.tviz-tl-lbl {
  font-size: 10.5px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .05em;
}

/* Démo avant / après (redesign) */
.tviz-redesign {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 4px 0 2px;
}

.tviz-shotwrap {
  flex: none;
}

.tviz-shot {
  width: 96px;
  border-radius: 12px;
  padding: 9px;
}

.tviz-shot.old {
  background: #e9eaee;
  border: 1px solid #d9dbe0;
  opacity: .8;
}

.tviz-shot.new {
  background: var(--bg-card);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-m);
}

.tviz-shot-top {
  display: block;
  height: 9px;
  border-radius: 5px;
  background: #c9ccd4;
  margin-bottom: 7px;
}

.tviz-shot.new .tviz-shot-top {
  background: var(--primary);
}

.tviz-shot-row {
  display: block;
  height: 6px;
  border-radius: 4px;
  background: #d8dade;
  margin-top: 5px;
}

.tviz-shot.new .tviz-shot-row {
  background: var(--border);
}

.tviz-shot-row.w60 {
  width: 60%;
}

.tviz-shot-dots {
  display: flex;
  gap: 4px;
  margin-top: 7px;
}

.tviz-shot-dots i {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #c9ccd4;
}

.tviz-shot-label {
  display: block;
  text-align: center;
  margin-top: 7px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--ink-3);
}

.tviz-arrow {
  color: var(--ink-3);
  flex: none;
}

/* ══════════════ MOBILE : bottom sheet ══════════════ */
@media (max-width: 640px) {
  .tuto-card,
  .tuto-card.hero {
    top: auto !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100%;
    max-height: min(78vh, 640px);
    overflow-y: auto;
    border-radius: var(--r-l) var(--r-l) 0 0;
    border-left: none;
    border-right: none;
    border-bottom: none;
    padding-bottom: calc(16px + env(safe-area-inset-bottom));
    transform: none !important;
  }

  .tuto-card::before {
    content: '';
    display: block;
    width: 44px;
    height: 4px;
    border-radius: var(--r-full);
    background: var(--border-dark);
    margin: 0 auto 12px;
  }
}

/* ══════════════ ACCESSIBILITÉ ══════════════ */
@media (prefers-reduced-motion: reduce) {
  #tuto-spot,
  .tuto-prog i {
    transition: none;
  }

  #tuto-spot::after,
  .tviz-ring,
  .tr-dash,
  .tviz-busmark img,
  .tviz-info .live i,
  .tviz-status i,
  .tviz-star.on,
  .tviz-caret,
  .tviz-cchip,
  .tviz-note i,
  .tuto-hero-check {
    animation: none;
  }
}
