/* Historia con el móvil fijo (portada animada). La animación vive en js/story.js;
   sin JavaScript, el móvil se ve quieto con la agenda y los textos se leen igual. */

.story { position: relative; }

/* Escenario fijo: la pista ocupa toda la historia y el escenario queda pegado dentro de ella,
   así se suelta justo cuando termina la historia. Los capítulos pasan por encima. */
.stage-track { position: absolute; inset: 0; z-index: 0; pointer-events: none; }
.stage {
  position: sticky; top: 0; height: 100vh; height: 100svh;
  display: flex; align-items: center; justify-content: center;
  perspective: 1600px; pointer-events: none; overflow: hidden; z-index: 0;
}
.phone-wrap::before { /* halo suave detrás del móvil (se mueve con él) */
  content: ''; position: absolute; left: 50%; top: 50%; width: 640px; height: 640px; translate: -50% -50%; border-radius: 50%;
  background: radial-gradient(circle, rgba(28,63,148,0.16), rgba(198,60,64,0.06) 55%, transparent 70%);
  transform: translateZ(-120px); pointer-events: none;
}
.phone-wrap { position: relative; scale: var(--s, 1); transform: translateX(22vw); transform-style: preserve-3d; will-change: transform; }

.chapter { position: relative; z-index: 1; min-height: 190vh; min-height: 190svh; }
/* El texto queda fijo mientras su capítulo anima el móvil; luego sube y entra el siguiente. */
.chapter .pin { position: sticky; top: 0; height: 100vh; height: 100svh; padding-top: 68px; display: flex; align-items: center; }
.chapter .copy { width: min(44%, 500px); display: grid; gap: 16px; }
.chapter[data-side="left"] .copy { margin-left: max(20px, calc((100vw - var(--max)) / 2 + 20px)); }
.chapter[data-side="right"] .copy { margin-left: auto; margin-right: max(20px, calc((100vw - var(--max)) / 2 + 20px)); }
.chapter h1 { font-size: clamp(36px, min(4.6vw, 7vh), 58px); font-weight: 800; }
.chapter h1 em { font-style: normal; color: var(--blue); }
.chapter-hero { min-height: 130vh; min-height: 130svh; }
.chapter-hero .pin { padding-top: 0; height: calc(100vh - 68px); height: calc(100svh - 68px); }
.chapter .actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 8px; }
.chapter .checks { margin-top: 4px; }
.scroll-hint { display: inline-flex; align-items: center; gap: 8px; margin-top: 18px; font-size: 14px; font-weight: 600; color: var(--muted); }
.scroll-hint::before { content: ''; width: 18px; height: 28px; border: 2px solid currentColor; border-radius: 10px; background: linear-gradient(currentColor, currentColor) center 6px / 2px 6px no-repeat; animation: hint 1.6s ease-in-out infinite; }
@keyframes hint { 50% { background-position: center 13px; } }

/* ---------- El móvil ---------- */
.ion { width: 1em; height: 1em; fill: currentColor; flex: none; vertical-align: -0.12em; }
.phone {
  position: relative; width: 300px; height: 620px; border-radius: 48px; padding: 11px;
  background: linear-gradient(145deg, #2a2f45, #0d1020 60%, #23283b);
  box-shadow: 0 0 0 2px #3b4158 inset, 0 50px 90px -30px rgba(15,25,60,0.55), 0 20px 40px -20px rgba(15,25,60,0.4);
}
.phone::after { /* botones laterales */
  content: ''; position: absolute; right: -3px; top: 150px; width: 3px; height: 70px; border-radius: 2px; background: #2a2f45;
  box-shadow: -303px -20px 0 #2a2f45, -303px 50px 0 #2a2f45;
}
.phone-notch { position: absolute; z-index: 5; top: 20px; left: 50%; translate: -50% 0; width: 86px; height: 24px; border-radius: 14px; background: #05060b; }
.screen {
  position: relative; width: 100%; height: 100%; border-radius: 38px; overflow: hidden; background: #fff;
  font-size: 12px; line-height: 1.35; color: var(--ink);
}
.status { position: absolute; z-index: 4; top: 0; left: 0; right: 0; height: 40px; display: flex; justify-content: space-between; align-items: center; padding: 6px 26px 0; font-weight: 700; font-size: 12px; }
.status-icons { display: flex; gap: 3px; align-items: flex-end; }
.status-icons i { width: 4px; background: currentColor; border-radius: 1px; }
.status-icons i:nth-child(1) { height: 5px; } .status-icons i:nth-child(2) { height: 7px; } .status-icons i:nth-child(3) { height: 9px; }
.scr { position: absolute; inset: 0; padding: 44px 14px 0; background: #fff; display: flex; flex-direction: column; gap: 10px; }
.scr:not([data-screen="agenda"]) { opacity: 0; visibility: hidden; }

.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--blue-soft); color: var(--blue); display: grid; place-items: center; font-weight: 800; font-size: 12px; flex: none; }
.ion.back { font-size: 19px; color: var(--ink); }
.tabbar { margin-top: auto; margin-inline: -14px; display: flex; justify-content: space-around; padding: 8px 4px 16px; border-top: 1px solid var(--line); font-size: 8.5px; font-weight: 600; color: #9AA0B4; background: #fff; }
.tabbar span { display: flex; flex-direction: column; align-items: center; gap: 3px; min-width: 0; }
.tabbar .ion { font-size: 19px; }
.tabbar .on { color: var(--blue); }

/* Agenda */
.a-head { display: flex; justify-content: space-between; align-items: center; }
.a-head small { color: var(--muted); font-size: 11px; display: block; }
.a-head b { font-size: 21px; font-weight: 800; color: var(--blue); letter-spacing: -0.02em; }
.a-chips { display: flex; gap: 6px; }
.a-chips span { display: inline-flex; align-items: center; gap: 5px; background: var(--blue-soft); color: var(--muted); border-radius: 12px; padding: 4px 9px; font-size: 10.5px; }
.a-chips .ion { color: var(--blue); font-size: 12px; }
.a-chips b { color: var(--blue); }
.a-days { display: flex; gap: 6px; }
.a-days span { flex: 1; border: 1px solid var(--line); border-radius: 10px; text-align: center; padding: 5px 0; font-weight: 700; font-size: 14px; }
.a-days small { display: block; font-size: 9.5px; font-weight: 600; color: var(--muted); }
.a-days .on { background: var(--blue); color: #fff; border-color: var(--blue); }
.a-days .on small { color: rgba(255,255,255,0.8); }
.a-time { position: relative; margin-top: 8px; }
.a-row { height: 32px; position: relative; }
.a-row em { position: absolute; top: -7px; left: 0; width: 56px; font-style: normal; font-weight: 700; font-size: 10px; }
.a-row::after { content: ''; position: absolute; top: 0; left: 58px; right: 0; height: 1px; background: var(--line); }
.a-row.half em { font-weight: 500; color: #A3A8BA; }
.a-row.half::after { background: #F1F3F8; }
.appt { position: absolute; left: 62px; right: 0; border-radius: 8px; padding: 4px 9px; background: var(--blue); color: #fff; overflow: hidden; display: flex; flex-direction: column; justify-content: center; }
.appt b { font-size: 11px; }
.appt span { font-size: 9.5px; opacity: 0.85; line-height: 1.3; }
.appt.done { background: var(--blue-soft); color: var(--ink); }
.appt.run { background: var(--red); }
.appt-new { box-shadow: 0 8px 18px -8px rgba(28,63,148,0.7); }

/* Reserva */
.b-head { display: flex; align-items: center; gap: 8px; font-size: 15px; }
.b-service { display: flex; gap: 10px; align-items: center; border: 1.5px solid var(--blue); background: var(--blue-soft); border-radius: 12px; padding: 8px; }
.b-service small { display: block; color: var(--muted); }
.thumb { width: 38px; height: 38px; border-radius: 9px; flex: none; background: url('/img/s1.jpg') center / cover; }
.thumb.t2 { background-image: url('/img/s4.jpg'); }
.thumb.t3 { background-image: url('/img/s7.jpg'); }
.b-month { font-weight: 800; font-size: 14px; }
.b-cal { position: relative; display: grid; grid-template-columns: repeat(7, 1fr); gap: 3px 0; text-align: center; font-weight: 600; font-size: 11px; }
.b-cal em { font-style: normal; color: var(--muted); font-size: 10px; }
.b-cal span { position: relative; z-index: 1; height: 24px; line-height: 24px; }
.b-cal .past, .b-cal .off { color: #C3C7D4; }
.b-pick { position: absolute; z-index: 0; width: 26px; height: 26px; border-radius: 50%; background: var(--blue); left: calc(100% / 7 * 2 + (100% / 7 - 26px) / 2); top: 54px; }
.b-cal .d15 { color: var(--ink); }
.b-label { font-weight: 700; font-size: 12px; }
.b-slots { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.b-slots span { border: 1.5px solid var(--line); border-radius: 9px; text-align: center; padding: 6px 0; font-weight: 600; font-size: 11px; }
.b-slots .taken { color: #C3C7D4; text-decoration: line-through; }
.b-btn { margin-top: 4px; background: var(--blue); color: #fff; border-radius: 10px; text-align: center; padding: 11px; font-weight: 700; font-size: 13px; }
.b-ok { position: absolute; z-index: 3; inset: 0; background: rgba(255,255,255,0.97); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; text-align: center; padding: 30px; opacity: 0; visibility: hidden; }
.b-ok b { font-size: 19px; color: var(--blue); }
.b-ok span { font-weight: 700; font-size: 14px; }
.b-ok small { color: var(--muted); font-size: 11px; max-width: 190px; }
.check { width: 62px; height: 62px; border-radius: 50%; background: #2E8B57; position: relative; margin-bottom: 6px; }
.check::after { content: ''; position: absolute; left: 22px; top: 15px; width: 14px; height: 26px; border-right: 4px solid #fff; border-bottom: 4px solid #fff; rotate: 45deg; }

/* Pantalla bloqueada */
.scr-lock { background: radial-gradient(120% 80% at 30% 10%, #3A5FC0, #1C3F94 45%, #0F2563 100%); color: #fff; padding-top: 60px; }
.scr-lock .status { color: #fff; }
.l-clock { text-align: center; margin-bottom: 16px; }
.l-clock b { display: block; font-size: 62px; font-weight: 700; letter-spacing: -0.03em; line-height: 1; }
.l-clock span { font-size: 13px; opacity: 0.85; }
.push { display: flex; gap: 9px; align-items: flex-start; background: rgba(255,255,255,0.9); color: var(--ink); border-radius: 16px; padding: 10px; backdrop-filter: blur(10px); box-shadow: 0 10px 24px -12px rgba(0,0,0,0.5); }
.push img { width: 30px; height: 30px; border-radius: 8px; flex: none; }
.push small { display: block; color: var(--muted); font-size: 10px; }
.push b { display: block; font-size: 12.5px; }
.push span { font-size: 11px; color: #3F4356; }

/* QR */
.q-card { border: 1px solid var(--line); border-radius: 18px; padding: 14px 16px 0; display: flex; flex-direction: column; align-items: center; text-align: center; gap: 3px; overflow: hidden; }
.q-brand { display: flex; align-items: center; gap: 6px; font-weight: 800; color: var(--blue); font-size: 12px; }
.q-brand img { width: 20px; height: 20px; border-radius: 6px; }
.q-name { font-size: 18px; font-weight: 800; margin-top: 4px; }
.q-card small { color: var(--muted); font-size: 11px; }
.q-box { position: relative; margin: 10px 0 8px; padding: 10px; border: 2px solid var(--blue); border-radius: 14px; overflow: hidden; }
.qr-svg { display: block; width: 150px; height: 150px; fill: var(--ink); }
.q-scan { position: absolute; left: 0; right: 0; top: 0; height: 3px; background: var(--red); box-shadow: 0 0 14px 3px rgba(198,60,64,0.6); opacity: 0; }
.q-code { font-size: 18px; letter-spacing: 2px; color: var(--blue); margin-bottom: 12px; }
.q-stripe { align-self: stretch; margin: 0 -16px; height: 6px; background: linear-gradient(90deg, var(--blue) 0 33.3%, #fff 33.3% 66.6%, var(--red) 66.6%); }
.q-btn { background: var(--blue); color: #fff; border-radius: 10px; text-align: center; padding: 11px; font-weight: 700; font-size: 13px; }

/* Chat */
.c-head { display: flex; align-items: center; gap: 8px; padding-bottom: 8px; border-bottom: 1px solid var(--line); margin-inline: -14px; padding-inline: 14px; }
.c-head small { display: block; color: #2E8B57; font-size: 10.5px; font-weight: 600; }
.c-list { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; gap: 7px; padding-bottom: 8px; }
.msg { max-width: 78%; padding: 8px 11px; border-radius: 15px; font-size: 12px; }
.msg.in { align-self: flex-start; background: #F0F2F7; border-bottom-left-radius: 4px; }
.msg.out { align-self: flex-end; background: var(--blue); color: #fff; border-bottom-right-radius: 4px; }
.msg.photo { padding: 4px 4px 7px; display: grid; gap: 5px; }
.msg.photo img { width: 140px; height: 100px; object-fit: cover; border-radius: 12px; }
.typing { align-self: flex-start; display: flex; gap: 4px; background: #F0F2F7; padding: 10px 12px; border-radius: 15px; }
.typing i { width: 6px; height: 6px; border-radius: 50%; background: #9AA0B4; animation: typing 1.2s infinite; }
.typing i:nth-child(2) { animation-delay: .15s; } .typing i:nth-child(3) { animation-delay: .3s; }
@keyframes typing { 0%, 60%, 100% { transform: none; opacity: .5; } 30% { transform: translateY(-3px); opacity: 1; } }
.c-input { display: flex; align-items: center; gap: 8px; margin: 0 -14px; padding: 10px 14px 20px; border-top: 1px solid var(--line); color: #9AA0B4; }
.c-input span { flex: 1; display: flex; justify-content: space-between; align-items: center; background: #F4F6FA; border-radius: 18px; padding: 8px 12px; }
.c-input span .ion { font-size: 16px; color: #9AA0B4; }
.send { width: 34px; height: 34px; border-radius: 50%; background: var(--blue); flex: none; display: grid; place-items: center; color: #fff; font-size: 15px; }

/* Inicio del cliente (mismo diseño que la app) */
.h-head { display: flex; align-items: center; justify-content: space-between; }
.h-head small { display: flex; align-items: center; gap: 4px; color: var(--muted); font-size: 10.5px; }
.h-head small .ion { color: var(--blue); font-size: 11px; }
.h-head b { display: flex; align-items: center; gap: 3px; font-size: 15px; font-weight: 600; margin-top: 1px; }
.h-head b .ion { font-size: 13px; }
.h-banner { position: relative; height: 112px; border-radius: 14px; overflow: hidden; background: url('/img/banner.jpg') center top / cover; }
.h-logo { position: absolute; left: 10px; top: 10px; width: 30px; height: 30px; border-radius: 7px; }
.h-book { position: absolute; left: 10px; bottom: 10px; background: var(--blue); color: #fff; font-weight: 600; font-size: 11px; padding: 6px 10px; border-radius: 7px; }
.h-title { font-weight: 600; font-size: 14px; margin-top: 2px; }
.h-svc { display: flex; gap: 10px; align-items: center; border: 1px solid var(--line); border-radius: 12px; padding: 7px; }
.h-svc .thumb { width: 56px; height: 56px; border-radius: 9px; }
.h-svc b { display: block; font-size: 12.5px; font-weight: 600; margin-bottom: 2px; }
.h-svc small { display: flex; align-items: center; gap: 5px; color: var(--muted); font-size: 10.5px; }
.h-svc small .ion { color: #8A90A6; font-size: 11px; }
.h-works { display: flex; gap: 6px; overflow: hidden; margin-right: -14px; }
.h-works img { width: 104px; height: 78px; flex: none; object-fit: cover; border-radius: 10px; background: var(--bg-alt); }

/* Elementos flotantes alrededor del móvil */
.fl { position: absolute; display: flex; align-items: center; gap: 10px; background: #fff; border-radius: 16px; padding: 11px 15px; box-shadow: 0 20px 44px -18px rgba(20,30,60,0.45); font-size: 13px; line-height: 1.35; color: var(--muted); white-space: nowrap; opacity: 0; visibility: hidden; transform: translateZ(60px); }
.fl b { display: block; color: var(--ink); font-size: 14px; }
.fl .dot { width: 34px; height: 34px; border-radius: 11px; flex: none; }
.dot.blue { background: var(--blue) radial-gradient(circle at 50% 50%, #fff 0 4px, transparent 5px); }
.dot.red { background: var(--red) radial-gradient(circle at 50% 50%, #fff 0 4px, transparent 5px); }
.fl-new { left: -96px; top: 120px; }
.fl.intro { animation: fl-in .8s cubic-bezier(.34,1.56,.64,1) 1s backwards; }
.fl-remind.intro { animation-delay: 1.2s; }
@keyframes fl-in { from { translate: 0 30px; scale: .85; filter: opacity(0); } }
.fl-remind { right: -70px; bottom: 110px; }
.fl-wa { right: -145px; top: 64px; display: block; background: #DCF8C6; color: #1B1D29; font-size: 14px; padding: 10px 14px 12px; border-radius: 14px 14px 14px 4px; }
.fl-wa small { display: block; font-size: 11px; color: #5B7A4A; font-weight: 600; margin-bottom: 2px; }
.fl-wa .strike { position: absolute; left: 10px; right: 10px; top: 55%; height: 3px; background: var(--red); border-radius: 2px; transform-origin: left; transform: scaleX(0); }
.fl-scan { right: -70px; bottom: 60px; }

/* ---------- Teléfonos y tabletas pequeñas ---------- */
@media (max-width: 899px) {
  .stage { align-items: flex-start; padding-top: 84px; }
  .phone-wrap { transform: none; transform-origin: top center; }
  .fl { display: none; }
  .chapter { min-height: 150svh; }
  .chapter .checks { display: none; }
  .chapter .pin { align-items: flex-end; padding-bottom: 4svh; }
  .chapter-hero { min-height: 120svh; }
  /* Con la animación activa, todas las tarjetas viven en el mismo sitio (abajo) y sólo se funden
     una con otra: nunca suben tapando el móvil ni dejan tramos vacíos. */
  .story-on .chapter .pin { position: fixed; z-index: 2; left: 0; right: 0; top: auto; bottom: 3svh; height: auto; padding: 0; display: block; pointer-events: none; }
  .story-on .chapter .copy { pointer-events: auto; }
  .chapter .copy, .chapter[data-side] .copy {
    width: auto; margin: 0 16px; padding: 22px 20px; border-radius: 22px; gap: 12px;
    background: rgba(255,255,255,0.94); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
    box-shadow: 0 24px 60px -24px rgba(20,30,60,0.35); border: 1px solid rgba(227,230,239,0.8);
  }
  .chapter h1 { font-size: clamp(30px, 8vw, 40px); }
  .chapter h2 { font-size: clamp(24px, 6.4vw, 30px); }
  .chapter .lead { font-size: 15px; line-height: 1.5; }
  .chapter .chips, .chapter-hero .lead { display: none; }
  .chapter-hero h1 { font-size: clamp(28px, 7.6vw, 36px); }
  .chapter .actions { flex-wrap: nowrap; }
  .chapter .actions .btn { flex: 1; min-height: 46px; padding: 0 12px; font-size: 15px; white-space: nowrap; }
  .chapter .actions .btn svg { display: none; }
  .scroll-hint { margin-top: 4px; }
}

@media (prefers-reduced-motion: reduce) {
  .scroll-hint::before, .typing i { animation: none; }
}
