/* Página Tarjeta de lealtad (2026-10-01).
   Reutiliza el iPhone (phone.css), el pase y sus sellos (configurador.css), las tarjetas,
   pasos, KPIs y preguntas del Home (sections.css). Aquí solo va lo propio: aviso del celular,
   momento del premio, pantallas del flujo, cumpleaños y resumen del dueño. */

/* ---------- Aviso (notificación) dentro del iPhone ---------- */
.notif {
  position: absolute;
  top: 40px;
  left: 10px;
  right: 10px;
  z-index: 3;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--notif-radius);
  background: var(--notif-bg);
  box-shadow: var(--notif-shadow);
  color: var(--ink);
  text-align: left;
}

.notif__icon {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: var(--giro-cafeteria);
  color: var(--surface);
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 600;
}

.notif__body { flex: 1; min-width: 0; }

.notif__app {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: var(--notif-app-size);
  font-weight: 600;
  line-height: 1.3;
}

.notif__time { font-weight: 400; color: var(--muted-text); }

.notif__text {
  margin-top: 2px;
  font-size: var(--notif-size);
  line-height: 1.35;
}

/* Hero: el aviso entra con cada sello (js/tarjeta.js) */
@media all {
  .notif { transition: opacity var(--dur-state) var(--ease-out), transform var(--dur-state) var(--ease-out); }
  .js #tw-hero .notif:not(.is-shown) { opacity: 0; transform: translateY(-12px); }
}

/* Hero: QR del pase y momento "¡Felicidades!" con la tarjeta llena */
.tw-qrwrap {
  position: relative;
  align-self: center;
  display: grid;
  place-items: center;
  width: 100%;
  min-height: 108px;
}

#tw-hero .pass__qr { width: 96px; }

/* El aviso vive arriba del pase, sin taparlo */
#tw-hero .pass { margin-top: 64px; }
#tw-hero .notif { top: 44px; }

.tw-win {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  border-radius: var(--radius-card);
  background: var(--pass-fg);
  color: var(--pass-bg);
  text-align: center;
  opacity: 0;
  transform: scale(.85);
  pointer-events: none;
}

.tw-win__icon { width: 30px; height: 30px; margin-bottom: 2px; }
.tw-win__title { font-family: var(--font-display); font-size: 22px; line-height: 1.15; }
.tw-win__text { font-size: var(--notif-size); font-weight: 600; }

.tw-spark {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 7px;
  height: 7px;
  margin: -3.5px;
  border-radius: 50%;
  background: var(--pass-fg);
  opacity: 0;
}
.tw-spark--2, .tw-spark--5 { background: var(--muted); border-radius: 2px; }
.tw-spark--1 { --sx: -110px; --sy: -58px; }
.tw-spark--2 { --sx: -40px;  --sy: -72px; }
.tw-spark--3 { --sx: 70px;   --sy: -66px; }
.tw-spark--4 { --sx: 116px;  --sy: -14px; }
.tw-spark--5 { --sx: -120px; --sy: 22px; }
.tw-spark--6 { --sx: 104px;  --sy: 48px; }

.pass.is-full .tw-win { opacity: 1; transform: none; }
.pass.is-full .tw-qr { opacity: 0; }

/* Modo de alto contraste (Windows): el recuadro del premio es solo relleno y se perdía; recibe borde del color de texto forzado */
@media (forced-colors: active) {
  .tw-win { border: 2px solid currentColor; }
}

@media all {
  .tw-qr { transition: opacity var(--dur-state) var(--ease-out); }
  .tw-win { transition: opacity var(--dur-state) var(--ease-out), transform var(--dur-focal) var(--ease-out); }
  .pass.is-full .tw-win { animation: tw-win var(--dur-focal) var(--ease-out); }
  .pass.is-full .tw-spark { animation: tw-spark var(--dur-card) var(--ease-out) var(--dur-fast) both; }
  .pass.is-full .tw-spark--2, .pass.is-full .tw-spark--4, .pass.is-full .tw-spark--6 { animation-delay: var(--dur-state); }
}

@keyframes tw-win {
  0% { transform: scale(.6); }
  60% { transform: scale(1.06); }
  100% { transform: scale(1); }
}

@keyframes tw-spark {
  0% { opacity: 0; transform: translate(0, 0) scale(.4); }
  25% { opacity: 1; }
  100% { opacity: 0; transform: translate(var(--sx), var(--sy)) scale(1); }
}

/* ---------- Cómo funciona: pasos + iPhone sincronizados ---------- */
.flow {
  display: grid;
  gap: 40px;
}

.flow__media {
  display: flex;
  justify-content: center;
  order: -1;            /* en celular, el teléfono va antes que los pasos */
}

.steps--flow .card {
  transition: border-color var(--dur-state) var(--ease-out);
}

.steps--flow .card.is-active { border-color: var(--ink); }
.steps--flow .card.is-active .card__num { color: var(--accent); }

/* La barra guinda marca solo el paso activo y avanza con él: la del paso que
   termina sale hacia la derecha y la del siguiente entra desde la izquierda.
   Sin retrasos escalonados (los de sections.css, que cuentan 01 a 03 una sola vez),
   para que cambie junto con la pantalla del iPhone (--dur-focal).
   `:nth-child(n)` solo sube la especificidad para ganar a esos retrasos. */
@media all {
  .steps.steps--flow .card:nth-child(n)::before {
    transform-origin: right;
    transition: transform var(--dur-focal) var(--ease-out);
    transition-delay: 0s;
  }
  .steps.steps--flow .card.is-active::before { transform-origin: left; }
  .steps.steps--flow .card:not(.is-active)::before { transform: scaleX(0); }
}

@media (min-width: 768px) {
  .flow {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: var(--stage-gap);
  }
  .flow__media { order: 0; }
  .steps.steps--flow { grid-template-columns: 1fr; }
}

@media (min-width: 1440px) {
  .steps.steps--flow { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* Pantallas del iPhone del flujo: se muestra la del paso activo */
.flow__phone .phone__screen { padding: 0; }

.screen {
  position: absolute;
  inset: 0;
  padding: 52px 14px 14px;
  opacity: 0;
  visibility: hidden;
}

@media all {
  .screen { transition: opacity var(--dur-focal) var(--ease-out), visibility 0s linear var(--dur-focal); }
}

.flow[data-step="1"] .screen--qr,
.flow[data-step="2"] .screen--form,
.flow[data-step="3"] .screen--pass,
.flow[data-step="4"] .screen--pass {
  opacity: 1;
  visibility: visible;
  transition-delay: 0s;
}

/* 1 · Cámara */
.screen--qr {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  background: var(--camera-bg);
  color: var(--surface);
}

.screen__bar {
  position: absolute;
  top: 44px;
  font-size: var(--notif-app-size);
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  opacity: .7;
}

.poster {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  width: 190px;
  padding: 20px 16px;
  border-radius: var(--radius-card);
  background: var(--bg);
  color: var(--ink);
  text-align: center;
  outline: 2px solid var(--surface);
  outline-offset: 10px;
}

.poster__name { font-family: var(--font-display); font-size: 20px; line-height: 1.2; }
.poster__text { font-size: var(--notif-size); line-height: 1.3; }
.poster__hint { font-size: var(--notif-app-size); color: var(--ink); }

.poster__qr {
  position: relative;
  overflow: hidden;
  padding: 6px;
  border-radius: 8px;
  background: var(--surface);
  line-height: 0;
}

.poster__qr img { width: 96px; height: 96px; }

.poster__scan {
  position: absolute;
  top: 0;
  left: 4px;
  right: 4px;
  height: 2px;
  background: var(--accent);
}

@media all {
  .flow[data-step="1"] .poster__scan { animation: tw-scan var(--flow-cycle) var(--ease-scan) infinite; }
}

@keyframes tw-scan {
  0%, 10% { transform: translateY(0); opacity: 0; }
  15% { opacity: 1; }
  60% { transform: translateY(106px); opacity: 1; }
  65%, 100% { transform: translateY(106px); opacity: 0; }
}

/* 2 · Registro */
.reg {
  display: flex;
  flex-direction: column;
  padding: 20px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  background: var(--surface);
}

.reg__name { font-size: var(--notif-app-size); font-weight: 600; color: var(--muted-text); }
.reg__title { margin: 4px 0 16px; font-family: var(--font-display); font-size: 22px; line-height: 1.2; }

.reg__label { margin-top: 10px; font-size: var(--notif-app-size); font-weight: 600; }

.reg__field {
  margin-top: 4px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  font-size: 14px;
}

.reg__check {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 16px;
  font-size: var(--notif-app-size);
}

.reg__box {
  position: relative;
  flex: 0 0 auto;
  width: 16px;
  height: 16px;
  border-radius: 4px;
  background: var(--ink);
}

.reg__box::after {   /* palomita */
  content: "";
  position: absolute;
  left: 5px;
  top: 2px;
  width: 5px;
  height: 9px;
  border: solid var(--surface);
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.reg__wallet {
  margin-top: 18px;
  padding: 12px;
  border-radius: var(--radius-card);
  background: var(--ink);
  color: var(--surface);
  font-size: 14px;
  font-weight: 600;
  text-align: center;
}

@media all {
  .flow[data-step="2"] .reg__wallet { animation: tw-press var(--flow-cycle) var(--ease-out) infinite; }
}

@keyframes tw-press {
  0%, 60% { transform: none; }
  66% { transform: scale(var(--press-scale)); }
  72%, 100% { transform: none; }
}

/* 3 y 4 · Tarjeta: sello y premio */
.screen--pass .pass { margin-top: 74px; }

.flow__s4,
.notif__text--s4 { display: none; }

.flow[data-step="4"] .flow__s3,
.flow[data-step="4"] .notif__text--s3 { display: none; }
.flow[data-step="4"] .flow__s4,
.flow[data-step="4"] .notif__text--s4 { display: inline; }
.flow[data-step="4"] .notif__text--s4 { display: block; }

.flow[data-step="4"] .screen--pass .pass__stamps li {
  border-style: solid;
  background: var(--pass-fg);
  opacity: 1;
}
.flow[data-step="4"] .screen--pass .pass__stamps li svg { display: block; }

.notif--flow { top: 52px; }

@media all {
  .flow[data-step="3"] .notif--flow,
  .flow[data-step="4"] .notif--flow { animation: tw-drop var(--dur-focal) var(--ease-out) both; }
  .flow[data-step="3"] .pass__stamps li:nth-child(3) { animation: tw-pop var(--dur-focal) var(--ease-out) var(--dur-state) both; }
  .flow[data-step="4"] .pass__stamps li:nth-child(n+4) { animation: tw-pop var(--dur-focal) var(--ease-out) both; }
  .flow[data-step="4"] .pass__stamps li:nth-child(5) { animation-delay: var(--stagger-sm); }
  .flow[data-step="4"] .pass__stamps li:nth-child(6) { animation-delay: calc(var(--stagger-sm) * 2); }
  .flow[data-step="4"] .pass__stamps li:nth-child(7) { animation-delay: calc(var(--stagger-sm) * 3); }
  .flow[data-step="4"] .pass__stamps li:nth-child(8) { animation-delay: calc(var(--stagger-sm) * 4); }
}

@keyframes tw-drop {
  from { opacity: 0; transform: translateY(-12px); }
  to { opacity: 1; transform: none; }
}

@keyframes tw-pop {
  0% { transform: scale(.4); }
  60% { transform: scale(1.15); }
  100% { transform: scale(1); }
}

/* ---------- Cumpleaños y dueño: texto + visual ---------- */
.split {
  display: grid;
  gap: 40px;
  align-items: center;
}

.split__lead {
  max-width: 34em;
  font-size: var(--card-desc-size);
  line-height: var(--card-desc-line);
}

.split__list {
  display: grid;
  gap: 8px;
  margin-top: 20px;
  padding-left: 1.2em;
  font-size: var(--card-desc-size);
  line-height: var(--card-desc-line);
}

.split__copy .btn { margin-top: 28px; }

@media (min-width: 768px) {
  .split { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--stage-gap); }
  .split--rev .split__copy { order: 2; }
}

/* Visual de cumpleaños */
.bday {
  display: grid;
  gap: 12px;
  width: 100%;
  max-width: var(--config-w);
  margin-inline: auto;
}

.notif--static { position: static; }

.bday__gift {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px;
  border: 1px solid var(--on-deep-line);
  border-radius: var(--radius-card);
}

.bday__gift svg { flex: 0 0 auto; width: 40px; height: 40px; }

@media all {
  .bday__flame { transform-origin: 12px 6.8px; animation: tw-flame 1.6s ease-in-out infinite; }
}

@keyframes tw-flame {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.15, .9); }
}

/* Resumen del dueño */
.summary { gap: 24px; }

.summary__rows { display: grid; }

.summary__rows > div {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 0;
  border-top: 1px solid var(--border);
  font-size: var(--card-num-size);
}

.summary__rows dt { color: var(--muted-text); }
.summary__rows dd { font-weight: 500; text-align: right; }
