/* Animaciones del sitio: aparición al bajar, recorrido de capturas y demo del pedido.
   Todo se apaga con prefers-reduced-motion y el contenido se ve completo sin JS. */

/* ── Recorrido (pestañas que avanzan solas) ── */
.tr { --tr-d:6s; }
.tr-head { display:flex; align-items:flex-end; gap:16px; }
.tr-tabs { flex:1; min-width:0; display:flex; gap:8px; }
.tr-tab { position:relative; appearance:none; border:0; background:none; font:inherit; color:var(--dn-mute-a); cursor:pointer; text-align:left; }
.tr-tab:focus-visible, .tr-pausa:focus-visible { outline:2px solid var(--dn-green); outline-offset:3px; border-radius:4px; }
.tr-bar { position:absolute; left:0; right:0; height:2px; background:var(--dn-line); overflow:hidden; }
.tr-bar i { display:block; height:100%; background:var(--dn-green); transform:scaleX(0); transform-origin:left; }
.tr-tab.is-on { color:var(--dn-ink); }
.tr-tab.is-on .tr-bar i { transform:scaleX(1); }
.tr-pausa { flex:none; display:inline-flex; align-items:center; gap:8px; min-height:36px; padding:0 12px; border:1px solid var(--dn-line); border-radius:6px; background:#fff; font:inherit; font-size:14px; color:var(--dn-ink); cursor:pointer; }
.tr-pausa:hover { border-color:var(--dn-ink); }
.tr-pausa-ic { width:10px; height:12px; border-left:3px solid currentColor; border-right:3px solid currentColor; box-sizing:border-box; }
.tr-pausa[aria-pressed="true"] .tr-pausa-ic { width:0; height:0; border:6px solid transparent; border-left:10px solid currentColor; border-right:0; }
.tr-stage { display:grid; }
.tr-slide { grid-area:1/1; min-width:0; opacity:0; visibility:hidden; transition:opacity .45s ease, visibility 0s .45s; }
.tr-slide.is-on { opacity:1; visibility:visible; transition:opacity .45s ease; }

/* Portada: pestañas en píldora sobre la captura */
.tr-hero { margin-top:40px; }
.tr-hero .tr-tabs { flex-wrap:wrap; gap:4px 28px; }
.tr-hero .tr-tab { padding:8px 0 12px; font-size:16px; line-height:22px; }
.tr-hero .tr-bar { bottom:0; }
.tr-hero .tr-pausa { margin-bottom:8px; }
.tr-hero .tr-stage { margin-top:20px; position:relative; height:560px; padding:56px 56px 0; border-radius:12px; background:var(--dn-paper); background-image:radial-gradient(circle at 20% 30%,#9bd3c955,transparent 50%),radial-gradient(circle at 85% 80%,#12645718,transparent 55%); overflow:hidden; }
.tr-cap { position:relative; max-width:1168px; margin:0 auto; }
.tr-punto { position:absolute; z-index:2; width:0; height:0; }
.tr-punto i { position:absolute; left:-9px; top:-9px; width:18px; height:18px; border-radius:50%; background:var(--dn-green); border:3px solid #fff; box-shadow:0 2px 8px #102f3155; }
.tr-punto i::after { content:""; position:absolute; inset:-3px; border-radius:50%; border:2px solid var(--dn-green); opacity:0; }
.tr-punto b { position:absolute; top:-18px; left:22px; white-space:nowrap; padding:7px 12px; border-radius:8px; background:var(--dn-ink); color:#fff; font-size:14px; line-height:22px; font-weight:400; border:1px solid #ffffff4d; box-shadow:0 12px 24px -10px #102f3180; }
.tr-punto-izq b { left:auto; right:22px; }
.tr-match { height:100%; display:flex; align-items:flex-start; justify-content:center; gap:56px; }
.tr-match-tel { flex:none; width:270px; }
.tr-match-ui { flex:1; max-width:440px; margin-top:72px; }

/* Demo del pedido: los pasos son las pestañas */
.cx-sub { margin-top:72px; font-size:28px; line-height:32px; font-weight:400; letter-spacing:-.01em; }
.tr-pedido { margin-top:40px; }
.cx-sub + .tr-pedido { margin-top:24px; }
.tr-pedido .tr-head { display:block; position:relative; }
.tr-pedido .tr-tabs { gap:16px; }
.tr-pedido .tr-tab { flex:1; min-width:0; padding:24px 0 0; display:flex; flex-direction:column; align-items:flex-start; }
.tr-pedido .tr-bar { top:0; }
.tr-pedido .tr-t { display:block; margin-top:16px; font-size:20px; line-height:24px; color:var(--dn-ink); }
.tr-pedido .tr-d { display:block; margin-top:8px; font-size:16px; line-height:22px; color:var(--dn-mute-a); }
.tr-pedido .pg-num { color:var(--dn-ink); transition:background .3s, color .3s; }
.tr-pedido .tr-tab.is-on .pg-num { background:var(--dn-green); color:#fff; }
.tr-pedido .tr-tab:not(.is-on) .tr-t { color:var(--dn-mute-a); }
.tr-pedido .tr-pausa { position:absolute; right:0; top:-52px; }
.tr-pedido .tr-stage { margin-top:40px; height:460px; border-radius:12px; background:var(--dn-paper); background-image:radial-gradient(circle at 15% 20%,#9bd3c944,transparent 50%),radial-gradient(circle at 90% 90%,#12645714,transparent 55%); overflow:hidden; }
.hm-conecta .tr-pedido .tr-stage { background-color:#fff; border:1px solid var(--dn-line); }
.tr-pedido .tr-slide { padding:40px 48px 0; }
.fd-uno { height:100%; display:grid; place-items:center; padding-bottom:40px; }
.fd-uno > * { width:100%; max-width:480px; }
.fd-dos { height:100%; display:grid; grid-template-columns:minmax(0,420px) minmax(0,1fr); gap:48px; align-items:start; }
.fd-dos .fd-ui { align-self:center; padding-bottom:40px; }
.fd-match { grid-template-columns:240px minmax(0,440px); justify-content:center; }
.fd .sh-nota, .tr-pedido + .sh-nota { margin-top:16px; }
.ui-ok { display:inline-grid; place-items:center; width:22px; height:22px; border-radius:50%; background:var(--dn-green); }
.ui-ok::after { content:""; width:9px; height:5px; border-left:2px solid #fff; border-bottom:2px solid #fff; transform:translateY(-1px) rotate(-45deg); }
.ui-card .ui-main small { white-space:normal; }

/* Acciones dentro de la demo: el visitante avanza el pedido presionando */
.cx-sub-nota { margin-top:8px; color:var(--dn-mute-a); }
.cx-sub-nota + .tr-pedido { margin-top:24px; }
.fd-accion { display:none; align-items:center; gap:12px; flex-wrap:wrap; padding:12px 16px; border-top:1px solid var(--dn-line); background:#fbfdfc; }
.an .fd-accion { display:flex; }
.fd-btn { position:relative; cursor:pointer; border:0; font:inherit; font-size:14px; }
.fd-pista { font-size:12.5px; line-height:18px; color:var(--dn-mute-a); }
.ui-card li.fd-oferta { padding:0; }
.fd-oferta label { flex:1; display:flex; align-items:center; justify-content:space-between; gap:12px; padding:10px 16px; cursor:pointer; box-shadow:inset 3px 0 0 transparent; transition:background-color .2s, box-shadow .2s; }
.fd-oferta input { position:absolute; opacity:0; width:1px; height:1px; }
.fd-oferta label:hover { background:#f4f8f6; }
.fd-oferta label:has(:checked) { background:#e9f4f0; box-shadow:inset 3px 0 0 var(--dn-green); }
.fd-oferta label:has(:checked) .ui-score { background:var(--dn-green); color:#fff; }
.fd-oferta label:has(:focus-visible) { outline:2px solid var(--dn-green); outline-offset:-2px; }

/* Chat de ejemplo */
.ch { background:#fff; border:1px solid var(--dn-line); border-radius:10px; box-shadow:0 1px 2px #102f310d,0 18px 40px -18px #102f3140; overflow:hidden; font-size:14px; line-height:20px; }
.ch-cuerpo { display:flex; flex-direction:column; align-items:flex-start; gap:10px; padding:20px 16px; background:#f6f3ee; min-height:190px; }
.ch-cuerpo p { margin:0; }
.ch-in { max-width:86%; padding:9px 12px; border-radius:2px 12px 12px 12px; background:#fff; color:var(--dn-ink); box-shadow:0 1px 1px #102f311f; }
.ch-in small { display:block; margin-top:2px; text-align:right; font-size:11px; color:var(--dn-mute-a); }
.ch-escribe { display:none; }
.ch-aviso { align-self:stretch; display:flex; align-items:center; gap:10px; flex-wrap:wrap; padding:10px 12px; border-radius:8px; background:#fff; border:1px solid var(--dn-line); font-size:13px; color:var(--dn-mute-a); }

@media (max-width:1020px) {
  .tr-hero .tr-stage { height:auto; padding:32px 32px 0; }
  .tr-hero .tr-cap .sh { max-height:440px; }
  .tr-match { gap:32px; padding-bottom:32px; }
  .tr-match-tel { width:200px; }
  .tr-match-ui { margin-top:32px; }
  .tr-pedido .tr-tabs { display:grid; grid-template-columns:repeat(5,minmax(0,1fr)); gap:8px; }
  .tr-pedido .tr-tab { padding-top:16px; align-items:center; }
  .tr-pedido .tr-t, .tr-pedido .tr-d { display:none; }
  .tr-pedido .tr-slide::before { content:attr(data-paso); display:block; margin-bottom:20px; font-size:20px; line-height:24px; color:var(--dn-ink); }
  .tr-pedido .tr-stage { height:auto; }
  .tr-pedido .tr-slide { padding:28px 24px 0; }
  .fd-dos, .fd-match { grid-template-columns:minmax(0,1fr); gap:0; }
  .fd-dos .fd-cap, .fd-dos .fd-tel { display:none; }
  .fd-dos .fd-ui, .fd-uno { padding-bottom:28px; }
  .fd-uno { place-items:start center; }
  .fd-ui, .fd-uno > * { max-width:480px; margin:0 auto; width:100%; }
}
@media (max-width:640px) {
  .tr-hero { margin-top:32px; }
  .tr-hero .tr-tabs { flex-wrap:nowrap; overflow-x:auto; gap:20px; scrollbar-width:none; }
  .tr-hero .tr-tab { flex:none; font-size:15px; }
  .tr-hero .tr-stage { padding:16px 16px 0; }
  .tr-pausa-tx { position:absolute; width:1px; height:1px; overflow:hidden; clip-path:inset(50%); }
  .tr-punto b { display:none; }
  .tr-match { padding-bottom:16px; }
  .tr-match-tel { display:none; }
  .tr-match-ui { margin-top:0; }
  .cx-sub { margin-top:56px; font-size:24px; line-height:28px; }
  .tr-pedido .tr-pausa { top:-48px; }
  .tr-pedido .tr-slide { padding:20px 16px 0; }
}

/* ── Movimiento ── */
@media (prefers-reduced-motion:no-preference) {
  /* Entrada del héroe (sin JS) */
  .hm-hero .pg-in > *, .pg-hero .pg-in > * { animation:an-sube .7s cubic-bezier(.2,.7,.2,1) both; }
  .hm-hero .pg-in > :nth-child(2), .pg-hero .pg-in > :nth-child(2) { animation-delay:.06s; }
  .hm-hero .pg-in > :nth-child(3), .pg-hero .pg-in > :nth-child(3) { animation-delay:.12s; }
  .hm-hero .pg-in > :nth-child(4), .pg-hero .pg-in > :nth-child(4) { animation-delay:.18s; }
  .hm-hero .pg-in > :nth-child(n+5), .pg-hero .pg-in > :nth-child(n+5) { animation-delay:.26s; }

  /* Aparición al bajar: anim.js marca .an-espera solo lo que está bajo la pantalla */
  .an-espera { opacity:0; transform:translateY(20px); }
  .an-entra { animation:an-sube .7s cubic-bezier(.2,.7,.2,1) both; animation-delay:var(--an-i,0s); }
  .an-espera .ui-card li { opacity:0; }
  .an-entra:not(.tr) .ui-card li, .tr-slide.is-on .ui-card li { animation:an-fila .5s ease both; }
  .an-entra:not(.tr) .ui-card li:nth-child(1) { animation-delay:.35s; }
  .an-entra:not(.tr) .ui-card li:nth-child(2) { animation-delay:.6s; }
  .an-entra:not(.tr) .ui-card li:nth-child(3) { animation-delay:.85s; }
  .an-entra:not(.tr) .ui-card li:nth-child(4) { animation-delay:1.1s; }
  .tr-slide.is-on .ui-card li:nth-child(1) { animation-delay:.3s; }
  .tr-slide.is-on .ui-card li:nth-child(2) { animation-delay:.9s; }
  .tr-slide.is-on .ui-card li:nth-child(3) { animation-delay:1.5s; }
  .tr-slide.is-on .ui-card .ui-score, .tr-slide.is-on .ui-card .ui-ok, .tr-slide.is-on .ui-card .ui-pill { animation:an-pop .4s cubic-bezier(.3,1.4,.5,1) both; animation-delay:inherit; }
  .tr-slide.is-on .ui-foot, .tr-slide.is-on .fd-accion { animation:an-fila .5s ease 2s both; }
  .tr-slide.is-on .ch .fd-accion { animation-delay:2.8s; }
  .tr-slide.is-on .fd-btn::after { content:""; position:absolute; inset:0; border-radius:inherit; box-shadow:0 0 0 0 #9bd3c9; animation:fd-llama 1.8s ease-out 3s infinite; }

  /* Barra de progreso: al terminar, anim.js pasa a la lámina siguiente */
  .an .tr-tab.is-on .tr-bar i { animation:tr-avanza var(--tr-d) linear both; }
  .an .tr:has(.tr-tab:focus-visible) .tr-bar i, .an .tr.is-pausa .tr-bar i, .an .tr.is-fuera .tr-bar i { animation-play-state:paused; }
  @media (hover:hover) { .an .tr-stage:hover { --tr-hover:1; } .an .tr:has(.tr-stage:hover) .tr-bar i { animation-play-state:paused; } }

  .tr-slide.is-on .tr-cap .sh, .tr-slide.is-on .fd-cap .sh, .tr-slide.is-on .sh-tel { animation:tr-zoom .9s cubic-bezier(.2,.7,.2,1) both; }
  .tr-slide.is-on .tr-punto { animation:an-pop .45s cubic-bezier(.3,1.4,.5,1) .9s both; }
  .tr-slide.is-on .tr-punto i::after { animation:tr-late 1.8s ease-out 1.3s infinite; }

  /* Chat: llega el mensaje, alguien escribe, se detecta el pedido */
  .tr-slide.is-on .ch-in { animation:an-fila .45s ease .3s both; }
  .ch-escribe { display:flex; gap:4px; padding:12px 14px; border-radius:2px 12px 12px 12px; background:#fff; box-shadow:0 1px 1px #102f311f; position:absolute; visibility:hidden; }
  .ch-cuerpo { position:relative; }
  .ch-escribe i { width:6px; height:6px; border-radius:50%; background:var(--dn-mute-a); animation:ch-punto 1s ease-in-out infinite; }
  .ch-escribe i:nth-child(2) { animation-delay:.15s; }
  .ch-escribe i:nth-child(3) { animation-delay:.3s; }
  .tr-slide.is-on .ch-escribe { animation:ch-escribe 1.4s linear 1s both; bottom:20px; left:16px; }
  .tr-slide.is-on .ch-aviso { animation:an-fila .5s ease 2.5s both; }

  /* Diagrama: el flujo corre por las flechas */
  .cx-flecha::before { background:linear-gradient(90deg,var(--dn-green) 0 35%,var(--dn-mint) 50%,var(--dn-green) 65% 100%); background-size:300% 100%; animation:cx-corre 2.4s linear infinite; }

  .hm-suite-grid a, .hm-puerta a, .hm-caso, .pg-card { transition:transform .25s ease, box-shadow .25s ease, background-color .2s; }
  .hm-puerta a:hover, .hm-suite-grid a:hover { transform:translateY(-2px); box-shadow:0 12px 24px -16px #102f3159; }
}
@media (prefers-reduced-motion:no-preference) and (max-width:1100px) { .cx-flecha::before { background:var(--dn-green); animation:none; } }

@keyframes an-sube { from { opacity:0; transform:translateY(20px); } to { opacity:1; transform:none; } }
@keyframes an-fila { from { opacity:0; transform:translateY(8px); } to { opacity:1; transform:none; } }
@keyframes an-pop { from { opacity:0; transform:scale(.6); } to { opacity:1; transform:none; } }
@keyframes tr-avanza { from { transform:scaleX(0); } to { transform:scaleX(1); } }
@keyframes tr-zoom { from { transform:translateY(14px) scale(.985); } to { transform:none; } }
@keyframes tr-late { from { opacity:.9; transform:scale(1); } to { opacity:0; transform:scale(2.4); } }
@keyframes ch-punto { 0%,100% { opacity:.3; transform:none; } 50% { opacity:1; transform:translateY(-2px); } }
@keyframes ch-escribe { 0% { visibility:visible; opacity:0; } 12%,85% { visibility:visible; opacity:1; } 100% { visibility:hidden; opacity:0; } }
@keyframes fd-llama { from { box-shadow:0 0 0 0 #9bd3c9cc; } to { box-shadow:0 0 0 12px #9bd3c900; } }
@keyframes cx-corre { from { background-position:100% 0; } to { background-position:0 0; } }

/* Recorrido dentro del héroe oscuro de la portada nueva (vitrina.css) */
.cm-hero .tr-hero { max-width:1120px; margin:0 auto; }
.cm-hero .tr-hero .tr-tabs { justify-content:center; }
.cm-hero .tr-tab { color:#ffffffb3; }
.cm-hero .tr-tab.is-on { color:#fff; }
.cm-hero .tr-bar { background:#ffffff33; }
.cm-hero .tr-bar i { background:var(--dn-mint); }
.cm-hero .tr-tab:focus-visible, .cm-hero .tr-pausa:focus-visible { outline-color:var(--dn-mint); }
.cm-hero .tr-pausa { background:transparent; border-color:#ffffff4d; color:#fff; }
.cm-hero .tr-pausa:hover { border-color:#fff; }
.cm-hero .tr-hero .tr-stage { box-shadow:0 50px 100px -40px #000a, 0 0 0 8px #ffffff12; }
@media (min-width:1021px) { .cm-hero .tr-hero .tr-head { position:relative; } .cm-hero .tr-hero .tr-pausa { position:absolute; right:0; bottom:0; } }
