/* Red de tiendecitas — la landing pública `/unete-tiendecita.html`.
 *
 * El hero es un video (web/video/, sin datos del servidor); el resto de las
 * ilustraciones son SVG en línea animados con CSS. Todo movimiento se apaga
 * con `prefers-reduced-motion` (el video queda en su póster, lo maneja el JS).
 */

/* ── La barra: vidrio oscuro, legible sobre el video y sobre el blanco ───── */
.tdc-bar {
  background: rgba(15, 23, 41, 0.72);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

/* ── El hero: video a pantalla completa ───────────────────────────────────
 * La sombra oscurece la izquierda y el pie (donde va el texto) y deja ver a
 * la derecha a los dueños entregando el paquete: el texto se lee sobre
 * cualquier cuadro del video. */
.tdc-hero-shade {
  background:
    linear-gradient(90deg, rgba(15, 23, 41, 0.82) 0%, rgba(15, 23, 41, 0.55) 38%, rgba(15, 23, 41, 0.08) 72%),
    linear-gradient(0deg, rgba(15, 23, 41, 0.85) 0%, rgba(15, 23, 41, 0) 48%),
    linear-gradient(180deg, rgba(15, 23, 41, 0.55) 0%, rgba(15, 23, 41, 0) 22%);
}
/* En el teléfono, apilado: el video ocupa el 62 % de arriba de la pantalla y
 * el texto entra debajo, sobre el fondo oscuro, pisando apenas su pie. */
@media (max-width: 639px) {
  .tdc-hero-video { bottom: auto; height: 62svh; object-position: 64% center; }
  .tdc-hero-shade {
    background: linear-gradient(180deg,
      rgba(15, 23, 41, 0.55) 0, rgba(15, 23, 41, 0) 14svh, rgba(15, 23, 41, 0) 30svh,
      rgba(15, 23, 41, 0.88) 50svh, #0f1729 62svh);
  }
}
.tdc-hero-accent {
  background: linear-gradient(90deg, #ff7849 0%, #ff5722 55%, #ffb38a 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.tdc-hero-point { display: inline-flex; align-items: center; gap: 0.5rem; }
.tdc-hero-point::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 9999px;
  background: #ff5722;
}
/* `grid` de Tailwind le ganaría al [hidden] del preflight. */
.tdc-hero-toggle[hidden] { display: none; }

/* ── Aparecer al hacer scroll ─────────────────────────────────────────────
 * La clase `tdc-reveal-on` la pone `js/unete-tiendecita.js` SÓLO si hay
 * IntersectionObserver y el usuario no pidió menos movimiento: sin JS, todo
 * se ve desde el principio (nada queda escondido por un script que no corrió).
 */
.tdc-reveal-on [data-reveal] {
  opacity: 0;
  transform: translateY(28px);
  transition: opacity 0.7s ease, transform 0.7s cubic-bezier(0.2, 0.7, 0.2, 1);
}
.tdc-reveal-on [data-reveal].is-in { opacity: 1; transform: none; }
.tdc-reveal-on [data-reveal-delay="1"] { transition-delay: 0.12s; }
.tdc-reveal-on [data-reveal-delay="2"] { transition-delay: 0.24s; }
.tdc-reveal-on [data-reveal-delay="3"] { transition-delay: 0.36s; }

/* ── Entrada del hero: subir y aparecer, escalonado (estilo keynote) ──────── */
@media (prefers-reduced-motion: no-preference) {
  .tdc-rise { animation: tdc-rise 1s cubic-bezier(0.16, 1, 0.3, 1) both; }
  .tdc-rise-1 { animation-delay: 0.08s; }
  .tdc-rise-2 { animation-delay: 0.18s; }
  .tdc-rise-3 { animation-delay: 0.28s; }
}
@keyframes tdc-rise { from { opacity: 0; transform: translateY(26px); } to { opacity: 1; transform: none; } }

/* ── La red: el mapa ─────────────────────────────────────────────────────── */
.tdc-net-map { width: 100%; height: auto; display: block; }
/* La tierra se apaga cuando la cámara está muy cerca (`--land`, lo pone el
 * JS según el zoom): de cerca el contorno del mapa son rectas sueltas que no
 * se leen como costa. Queda la noche con las luces de las tiendas, y la costa
 * aparece al alejarse. */
.tdc-net-land, .tdc-net-usa { opacity: var(--land, 1); }
.tdc-net-land path {
  fill: #1E293B;
  stroke: #334155;
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
  stroke-linejoin: round;
}
/* Las tiendas: un trazo de largo cero con punta redonda y grosor que NO
 * escala con el zoom → el punto mide lo mismo en pantalla a cualquier escala. */
.tdc-net-dots path {
  fill: none;
  stroke: #FF5722;
  stroke-linecap: round;
  stroke-width: 5;
  vector-effect: non-scaling-stroke;
  transition: stroke-width 0.5s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.4s ease;
}
.tdc-net-dots .tdc-net-first { stroke: #ffffff; stroke-width: 9; }
/* Las tiendas brillan (un halo, no un punto plano). */
.tdc-net-dots { filter: drop-shadow(0 0 3px rgba(255, 87, 34, 0.85)); }
.tdc-net-lines path {
  fill: none;
  stroke: #FF5722;
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
  opacity: 0.3;
  transition: opacity 0.6s ease;
}
.tdc-net-pulse {
  fill: none; stroke: #FF5722; stroke-linecap: round;
  stroke-width: 9; opacity: 0;
  vector-effect: non-scaling-stroke;
}
@media (prefers-reduced-motion: no-preference) {
  .tdc-net-pulse { animation: tdc-pulse 2.2s ease-out infinite; }
}
@keyframes tdc-pulse { 0% { stroke-width: 9; opacity: 0.7; } 100% { stroke-width: 46; opacity: 0; } }

/* ── La red, ESTÁTICA (sin JS o con menos movimiento): pasos en lista y el
 * mapa entero con todo encendido. ────────────────────────────────────────── */
.tdc-story { padding: 5rem 0; }
.tdc-story-grid { display: grid; gap: 2.5rem; align-items: center; }
@media (min-width: 1024px) { .tdc-story-grid { grid-template-columns: 1fr 1fr; } }
.tdc-steps .tdc-step + .tdc-step { margin-top: 2rem; }
.tdc-story-progress { display: none; }

/* ── La red, CONTADA CON EL SCROLL (clase que pone el JS). ─────────────────
 * La sección mide 5 pantallas; el escenario se queda fijo y el JS mueve la
 * cámara (viewBox) y enciende tiendas según el avance. */
.tdc-story-on .tdc-story { padding: 0; height: 520vh; position: relative; }
.tdc-story-on .tdc-story-stage {
  position: sticky; top: 0; height: 100vh; height: 100svh;
  display: flex; align-items: center; overflow: hidden;
}
.tdc-story-on .tdc-story-grid { width: 100%; }
.tdc-story-on .tdc-steps { position: relative; min-height: 13rem; }
.tdc-story-on .tdc-steps .tdc-step {
  position: absolute; inset: 0 0 auto 0; margin: 0;
  opacity: 0; transform: translateY(24px);
  transition: opacity 0.6s cubic-bezier(0.16, 1, 0.3, 1), transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}
.tdc-story-on .tdc-steps .tdc-step.is-active { opacity: 1; transform: none; }
.tdc-story-on .tdc-steps .tdc-step.is-past { opacity: 0; transform: translateY(-24px); }
.tdc-story-on .tdc-net-dots path { stroke-width: 0; opacity: 0; }
.tdc-story-on .tdc-net-dots path.is-lit { stroke-width: 6; opacity: 1; }
.tdc-story-on .tdc-net-dots path.tdc-net-first.is-lit { stroke-width: 9; }
.tdc-story-on .tdc-net-lines path { opacity: 0; }
.tdc-story-on .tdc-net-lines path.is-lit { opacity: 0.3; }
.tdc-story-on .tdc-net-pulse { opacity: 0.7; }
.tdc-story-on .tdc-story-progress { display: flex; gap: 6px; }
.tdc-story-progress span {
  height: 4px; width: 28px; border-radius: 4px; background: rgba(255, 255, 255, 0.2);
  transition: background 0.4s ease, width 0.4s ease;
}
.tdc-story-progress span.is-on { background: #FF5722; width: 44px; }
/* En el teléfono: el mapa arriba y el texto abajo, los dos en la pantalla. */
@media (max-width: 1023px) {
  .tdc-story-on .tdc-story-grid { gap: 1.25rem; }
  .tdc-story-on .tdc-story-map { order: -1; max-height: 52svh; display: flex; justify-content: center; }
  .tdc-story-on .tdc-story-map .tdc-net-map { height: 52svh; width: auto; max-width: 100%; }
  .tdc-story-on .tdc-steps { min-height: 11rem; }
}

/* El mapa se funde con el fondo en los bordes: sin el «recorte» rectangular
 * del SVG cuando la cámara está cerca. */
.tdc-story-map .tdc-net-map {
  -webkit-mask-image: radial-gradient(closest-side, #000 72%, transparent 100%);
  mask-image: radial-gradient(closest-side, #000 72%, transparent 100%);
}
/* Lugar para el paso más largo («Toda Latinoamérica» + su frase) sin pisar
 * la barra de avance. */
@media (min-width: 1024px) {
  .tdc-story-on .tdc-steps { min-height: 17rem; }
}

/* ── Estados Unidos en el mapa: el otro extremo del puente ────────────────── */
.tdc-net-usa {
  fill: #1E293B;
  stroke: #475569;
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
  stroke-linejoin: round;
}
.tdc-net-routes path {
  fill: none;
  stroke: #94A3B8;
  stroke-width: 1.4;
  stroke-dasharray: 3 5;
  vector-effect: non-scaling-stroke;
  opacity: 0.7;
  transition: opacity 0.7s ease;
}
.tdc-net-mia-dot {
  fill: none; stroke: #ffffff; stroke-linecap: round; stroke-width: 10;
  vector-effect: non-scaling-stroke;
}
.tdc-net-mia text {
  font: 700 9px Inter, system-ui, sans-serif;
  fill: #ffffff;
  paint-order: stroke;
  stroke: #0F1729;
  stroke-width: 3px;
}
.tdc-net-mia { transition: opacity 0.6s ease; }
.tdc-story-on .tdc-net-routes path { opacity: 0; }
.tdc-story-on .tdc-net-routes path.is-lit { opacity: 0.7; }
.tdc-story-on .tdc-net-mia { opacity: 0; }
.tdc-story-on .tdc-net-mia.is-lit { opacity: 1; }

/* ── «Una tienda.»: la foto que se vuelve el primer punto del mapa ─────────
 * Sólo con el scroll contado. El JS mueve `--ps` (escala), `--po`
 * (opacidad) y `--pr` (radio de las esquinas). */
.tdc-story-map { position: relative; }
.tdc-net-photo { display: none; }
.tdc-story-on .tdc-net-photo {
  display: block;
  position: absolute; left: 50%; top: 50%; z-index: 2;
  width: min(84%, 460px); aspect-ratio: 16 / 10;
  transform: translate(-50%, -50%) scale(var(--ps, 1));
  opacity: var(--po, 1);
  border-radius: var(--pr, 22px);
  overflow: hidden; pointer-events: none;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.45), 0 0 0 1px rgba(255, 255, 255, 0.14);
  will-change: transform, opacity;
}
.tdc-net-photo img { display: block; width: 100%; height: 100%; object-fit: cover; }

/* ── El camino del paquete ────────────────────────────────────────────────
 * Sin la clase `tdc-route-on` (sin JS o con menos movimiento): el camino
 * entero y todas las paradas encendidas. Con ella, el JS dibuja el camino con
 * el scroll y enciende cada parada (`is-lit`) y su tarjeta (`is-on`). */
.tdc-route-track { fill: none; stroke: rgba(255, 255, 255, 0.14); stroke-width: 2; stroke-dasharray: 2 10; stroke-linecap: round; }
.tdc-route-glow { fill: none; stroke: #FF5722; stroke-width: 12; stroke-linecap: round; opacity: 0.16; filter: blur(6px); }
.tdc-route-line { fill: none; stroke: #FF5722; stroke-width: 3; stroke-linecap: round; }
.tdc-route-halo { fill: #FF5722; opacity: 0.12; transition: opacity 0.5s ease; }
.tdc-route-disc { fill: #FF5722; stroke: #FF5722; stroke-width: 1.5; transition: fill 0.45s ease, stroke 0.45s ease; }
.tdc-route-ico { fill: none; stroke: #0F1729; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; transition: stroke 0.45s ease; }
.tdc-route-box-halo { fill: #FF5722; opacity: 0.22; }
/* El paquete sólo viaja con el scroll; quieto, taparía la última parada. */
.tdc-route-box { opacity: 0; transition: opacity 0.35s ease; }
.tdc-route-on .tdc-route-box { opacity: 1; }
.tdc-route-on .tdc-route-box.is-done { opacity: 0; }
.tdc-route-on .tdc-route-halo { opacity: 0; }
.tdc-route-on .tdc-route-disc { fill: #1E293B; stroke: rgba(255, 255, 255, 0.28); }
.tdc-route-on .tdc-route-ico { stroke: rgba(255, 255, 255, 0.75); }
.tdc-route-on .tdc-route-stop.is-lit .tdc-route-halo { opacity: 0.12; }
.tdc-route-on .tdc-route-stop.is-lit .tdc-route-disc { fill: #FF5722; stroke: #FF5722; }
.tdc-route-on .tdc-route-stop.is-lit .tdc-route-ico { stroke: #0F1729; }

.tdc-flow-card {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  transition: background 0.5s ease, border-color 0.5s ease, box-shadow 0.5s ease;
}
.tdc-route-on .tdc-flow-card:not(.is-on) > div:first-child { background: rgba(255, 255, 255, 0.14); color: #ffffff; transition: background 0.5s ease; }
.tdc-route-on .tdc-flow-card.is-on {
  background: rgba(255, 87, 34, 0.1);
  border-color: rgba(255, 87, 34, 0.55);
  box-shadow: 0 0 0 1px rgba(255, 87, 34, 0.15), 0 20px 50px rgba(0, 0, 0, 0.25);
}

/* ── Para todo tipo de negocio: las fotos con su pie ─────────────────────── */
.tdc-type { position: relative; margin: 0; overflow: hidden; border-radius: 1.5rem; aspect-ratio: 4 / 3; background: #1e293b; }
.tdc-type img { display: block; width: 100%; height: 100%; object-fit: cover; transition: transform 0.8s cubic-bezier(0.16, 1, 0.3, 1); }
.tdc-type figcaption {
  position: absolute; inset: auto 0 0 0; padding: 2.5rem 1rem 0.9rem;
  font-weight: 600; color: #ffffff; line-height: 1.2;
  background: linear-gradient(0deg, rgba(15, 23, 41, 0.85) 0%, rgba(15, 23, 41, 0) 100%);
}
@media (min-width: 640px) { .tdc-type figcaption { padding: 3rem 1.25rem 1.1rem; font-size: 1.05rem; } }
@media (hover: hover) and (prefers-reduced-motion: no-preference) {
  .tdc-type:hover img { transform: scale(1.04); }
}

/* ── Beneficios: la foto grande de «Más visitas» ─────────────────────────── */
.tdc-bento-shade { background: linear-gradient(0deg, rgba(15, 23, 41, 0.9) 0%, rgba(15, 23, 41, 0.35) 45%, rgba(15, 23, 41, 0) 70%); }
