/* ==========================================================================
   MEDLA · Asesoría Fiscal · sub-páginas del embudo
   /reservar/ (calendario), /whatsapp/ (gracias + salto a WhatsApp) y /gracias/
   (reserva hecha). Se cargan después de landing.css y reutilizan sus tokens y
   componentes (nav, botones, bloque de reserva, acordeón, pie).
   ========================================================================== */

/* ---------- entrada escalonada (solo CSS: estas páginas tienen que cargar al instante) ---------- */
[data-in] { animation: rise .9s var(--ease-out) both; animation-delay: calc(var(--d, 0) * 90ms + 80ms); }
@keyframes rise { from { opacity: 0; transform: translateY(22px); } }

.sub { padding-top: calc(var(--frame) + var(--nav-h) + clamp(2.5rem, 6vw, 4.5rem)); }
.back {
  display: inline-flex; align-items: center; gap: var(--s-2);
  font-size: 14.5px; font-weight: 600; color: var(--muted); text-decoration: none;
  border-radius: var(--r-pill);
  transition: color .25s var(--ease);
}
.back .ic { font-size: 17px; transition: transform .35s var(--spring); }
.back:hover { color: var(--ink); }
.back:hover .ic { transform: translateX(-3px); }
.nav__dl--safe .ic { color: var(--gold-ink); }

/* ==========================================================================
   /reservar/
   ========================================================================== */
.rs__head { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); column-gap: var(--s-6); row-gap: var(--s-8); align-items: end; padding-bottom: clamp(2rem, 4vw, 3.5rem); }
.rs__copy { grid-column: 1 / 8; display: grid; gap: var(--s-5); justify-items: start; }
.rs__title { font-family: var(--f-display); font-weight: 400; font-size: clamp(3rem, 6.6vw, 6rem); line-height: .98; letter-spacing: -0.025em; max-width: 13ch; }
.rs__title em { color: var(--gold-display); padding-right: .04em; }
.rs__steps { grid-column: 8 / 13; display: grid; gap: var(--s-2); counter-reset: rs; }
.rs__step {
  display: grid; grid-template-columns: 40px 1fr; align-items: center; gap: var(--s-4);
  padding: 10px var(--s-5) 10px 10px; border-radius: var(--r-pill);
  background: var(--paper); box-shadow: var(--shadow-sm);
  font-size: 15px; font-weight: 600; line-height: 1.3;
}
.rs__step span { color: var(--muted); font-weight: 500; }
.rs__step::before {
  counter-increment: rs; content: counter(rs);
  display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%;
  background: var(--ivory); color: var(--ink); font-family: var(--f-display); font-size: 19px; font-weight: 400;
}
.rs__step:first-child::before { background: var(--gold); color: #0B1D24; }

.book--page { padding-bottom: clamp(3rem, 6vw, 5rem); }

.trust { display: flex; flex-wrap: wrap; justify-content: center; gap: var(--s-3) var(--s-8); padding: 0 var(--gutter) var(--section); }
.trust li { display: inline-flex; align-items: center; gap: var(--s-2); font-size: 14.5px; font-weight: 500; color: var(--muted); }
.trust .ic { font-size: 19px; color: var(--gold-ink); }

/* ==========================================================================
   /whatsapp/ y /gracias/
   ========================================================================== */
.ty { padding: var(--frame) var(--frame) 0; }
.ty__panel {
  position: relative; isolation: isolate; overflow: hidden;
  min-height: calc(100svh - 2 * var(--frame)); display: grid; align-items: center;
  border-radius: var(--r-xl);
  background: var(--navy-deep); color: var(--on-dark);
}
.ty__panel::before {
  content: ""; position: absolute; z-index: -1; right: -12%; top: -30%;
  width: 70vmax; height: 70vmax; border-radius: 50%;
  background: radial-gradient(closest-side, rgba(201, 168, 76, .16), rgba(201, 168, 76, 0));
}
.ty__grid {
  display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); column-gap: var(--s-6); row-gap: var(--s-12); align-items: center;
  padding-block: calc(var(--nav-h) + clamp(3rem, 7vw, 6rem)) clamp(3rem, 7vw, 6rem);
}
.ty__copy { grid-column: 1 / 7; display: grid; gap: var(--s-6); justify-items: start; }
.ty__title { font-family: var(--f-display); font-weight: 400; font-size: clamp(3rem, 7vw, 6.4rem); line-height: .96; letter-spacing: -0.025em; max-width: 11ch; }
.ty__title em { color: var(--gold); padding-right: .04em; }
.ty__title--ok { font-size: clamp(2.8rem, 5.6vw, 5.2rem); max-width: 13ch; }
.btn__i--down .ic { transform: rotate(90deg); }
.btn:hover .btn__i--down, .btn:focus-visible .btn__i--down { transform: translateY(3px); }
.ty__lead { max-width: 44ch; font-size: clamp(1.06rem, 1.4vw, 1.25rem); line-height: 1.55; color: var(--on-dark-muted); }
.ty__ctas { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-4) var(--s-8); }
.ty__side { grid-column: 8 / 13; }

/* barra de "abriendo WhatsApp" */
.go { display: grid; gap: var(--s-2); width: min(340px, 100%); }
.go__bar { position: relative; height: 4px; border-radius: 4px; overflow: hidden; background: rgba(255, 255, 255, .12); }
.go__bar span { position: absolute; inset: 0; background: var(--gold); transform: scaleX(0); transform-origin: 0 50%; }
.go.is-going .go__bar span { transition: transform var(--go, 2.4s) cubic-bezier(.45, 0, .2, 1); transform: scaleX(1); }
.go.is-done .go__bar span { transform: scaleX(1); }
.go__txt { font-size: 14px; color: var(--on-dark-muted); }

/* vista previa del mensaje */
.chat {
  width: min(400px, 100%); margin-left: auto;
  border-radius: var(--r-lg); overflow: hidden;
  background: #F9F8F6; color: #142D37;
  box-shadow: 0 50px 100px -40px rgba(0, 0, 0, .7);
  transform: rotate(1.5deg);
}
.chat__top { display: flex; align-items: center; gap: var(--s-3); padding: var(--s-4) var(--s-5); background: #142D37; color: #F9F8F6; }
.chat__av { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 50%; background: #F9F8F6; }
.chat__av img { width: 28px; }
.chat__who { display: grid; line-height: 1.25; font-size: 15px; font-weight: 600; }
.chat__who span { font-size: 12.5px; font-weight: 400; color: #B9C6CA; }
.chat__body { display: grid; gap: var(--s-3); padding: var(--s-8) var(--s-5) var(--s-6); min-height: 230px; align-content: end;
  background: radial-gradient(circle at 1px 1px, rgba(20, 45, 55, .07) 1px, transparent 0) 0 0 / 16px 16px, #EFEBE2; }
.chat__day { justify-self: center; padding: 4px 12px; border-radius: var(--r-pill); background: rgba(255, 255, 255, .8); font-size: 12px; font-weight: 600; color: #586A70; }
.bubble {
  justify-self: end; max-width: 88%;
  padding: 10px 14px 8px; border-radius: 16px 16px 4px 16px;
  background: #D9F2D0; font-size: 15px; line-height: 1.45;
  box-shadow: 0 1px 1px rgba(11, 29, 36, .08);
  transform-origin: 100% 100%;
  animation: pop .7s var(--spring) both; animation-delay: .55s;
}
.bubble small { display: flex; justify-content: flex-end; align-items: center; gap: 4px; margin-top: 4px; font-size: 11.5px; color: #586A70; }
.bubble small .ic { font-size: 14px; color: #586A70; }
@keyframes pop { from { opacity: 0; transform: scale(.6) translateY(10px); } }
.chat__bar { display: flex; align-items: center; gap: var(--s-3); padding: var(--s-3) var(--s-4); background: #F9F8F6; border-top: 1px solid rgba(20, 45, 55, .08); }
.chat__field { flex: 1; height: 40px; border-radius: var(--r-pill); background: #fff; border: 1px solid rgba(20, 45, 55, .1); }
.chat__send { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; background: #142D37; color: var(--gold); font-size: 18px; animation: nudge-send 2.2s var(--ease) 1.4s infinite; }
@keyframes nudge-send { 0%, 70%, 100% { transform: scale(1); } 80% { transform: scale(1.12); } 90% { transform: scale(.96); } }

/* tarjeta para quien quiere cerrar la reserva ya */
.after { padding-block: clamp(3rem, 7vw, 6rem) var(--section); }
.after__card {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: var(--s-8);
  padding: clamp(1.75rem, 3.4vw, 3rem);
  border-radius: var(--r-xl); background: var(--paper); box-shadow: var(--shadow-lg);
}
.after__k { font-size: 13px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--gold-ink); }
.after__t { margin-top: var(--s-3); font-family: var(--f-display); font-size: clamp(1.9rem, 3.4vw, 3rem); line-height: 1.05; letter-spacing: -0.02em; max-width: 20ch; }
.after__t em { color: var(--gold-display); }
.after__p { margin-top: var(--s-3); color: var(--muted); max-width: 52ch; }

/* ---------- /gracias/ ---------- */
.ok-mark { width: 84px; height: 84px; }
.ok-mark circle { fill: none; stroke: var(--gold); stroke-width: 3; stroke-dasharray: 260; stroke-dashoffset: 260; animation: draw 1s var(--ease-out) .25s forwards; }
.ok-mark path { fill: none; stroke: var(--gold); stroke-width: 4; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 60; stroke-dashoffset: 60; animation: draw .6s var(--ease-out) 1s forwards; }
@keyframes draw { to { stroke-dashoffset: 0; } }

.next { display: grid; gap: var(--s-2); padding: clamp(1.25rem, 2.4vw, 2rem); border-radius: var(--r-lg); background: rgba(255, 255, 255, .05); border: 1px solid rgba(255, 255, 255, .1); }
.next ol { display: grid; }
.next__k { font-size: 13px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--gold); margin-bottom: var(--s-2); }
.next__i { position: relative; display: grid; grid-template-columns: 44px 1fr; gap: var(--s-4); align-items: start; padding-bottom: var(--s-5); }
.next__i:last-child { padding-bottom: 0; }
.next__i:not(:last-child)::after { content: ""; position: absolute; left: 21px; top: 48px; bottom: 4px; width: 2px; border-radius: 2px; background: rgba(255, 255, 255, .12); }
.next__ic { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; background: rgba(255, 255, 255, .07); color: var(--gold); font-size: 20px; }
.next__i.is-done .next__ic { background: var(--gold); color: #0B1D24; }
.next__i h2 { font-size: 16.5px; font-weight: 600; line-height: 1.35; padding-top: 2px; }
.next__i p { font-size: 14.5px; line-height: 1.5; color: var(--on-dark-muted); }

.prep { padding-block: clamp(4rem, 9vw, 8rem) var(--section); }
.prep__head { display: grid; gap: var(--s-5); justify-items: start; margin-bottom: clamp(2.5rem, 5vw, 4rem); }
.prep__grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: var(--s-4); }
.kit { display: grid; gap: var(--s-4); align-content: start; padding: clamp(1.5rem, 2.6vw, 2.25rem); border-radius: var(--r-lg); background: var(--paper); box-shadow: var(--shadow-sm); }
.kit:nth-child(1) { grid-column: 1 / 8; }
.kit:nth-child(2) { grid-column: 8 / 13; background: var(--navy); color: var(--on-dark); box-shadow: none; }
.kit:nth-child(3) { grid-column: 1 / 6; background: var(--sand); box-shadow: none; }
.kit:nth-child(4) { grid-column: 6 / 13; }
.kit__top { display: flex; align-items: center; gap: var(--s-3); }
.kit__ic { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; background: var(--ivory); color: var(--gold-ink); font-size: 21px; }
.kit:nth-child(2) .kit__ic { background: rgba(255, 255, 255, .08); color: var(--gold); }
.kit:nth-child(3) .kit__ic { background: color-mix(in srgb, var(--paper) 60%, transparent); }
.kit h3 { font-family: var(--f-display); font-weight: 400; font-size: clamp(1.45rem, 2vw, 1.75rem); line-height: 1.1; }
.kit ul { display: grid; gap: var(--s-2); }
.kit li { display: flex; gap: var(--s-3); align-items: flex-start; font-size: 15.5px; line-height: 1.45; }
.kit li .ic { margin-top: 2px; font-size: 18px; color: var(--gold-ink); }
.kit:nth-child(2) li .ic { color: var(--gold); }
.kit:nth-child(2) li { color: var(--on-dark-muted); }
.kit:nth-child(3) li .ic { color: color-mix(in srgb, var(--gold-ink) 82%, #000); }
.prep .nudge { margin-top: var(--s-4); }

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 1023px) {
  .rs__copy, .rs__steps { grid-column: 1 / -1; }
  .rs__steps { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .rs__step { border-radius: var(--r-md); grid-template-columns: 1fr; padding: var(--s-4); gap: var(--s-2); }

  .ty__copy, .ty__side { grid-column: 1 / -1; }

  /* /reservar/: en una columna, el calendario va primero y la información después */
  .book--page .book__main { order: -1; }
  .chat { margin-left: 0; }
  .after__card { grid-template-columns: 1fr; }

  .kit:nth-child(n) { grid-column: 1 / -1; }
}

@media (max-width: 767px) {
  .rs__steps { grid-template-columns: 1fr; }
  .rs__step { grid-template-columns: 36px 1fr; border-radius: var(--r-pill); padding: 8px var(--s-4) 8px 8px; }
  .rs__step::before { width: 36px; height: 36px; font-size: 17px; }

  .ty__panel { border-radius: var(--r-lg); min-height: 0; }
  .ty__grid { padding-block: calc(var(--nav-h) + var(--s-12)) var(--s-10); }
  .ty__title { font-size: clamp(2.8rem, 13vw, 4rem); }
  .ty__ctas .btn, .after__card .btn { width: 100%; justify-content: space-between; }
  .ty__ctas { gap: var(--s-3); }
  .ty__ctas .link {
    justify-content: center; width: 100%; min-height: 52px; padding: 0 var(--s-5);
    border-radius: var(--r-pill); border: 1px solid rgba(255, 255, 255, .3); background: rgba(255, 255, 255, .07);
    text-decoration: none;
  }
  .back { min-height: 44px; }
  .bubble small { font-size: 12px; }
  .chat { transform: none; }
  .chat__body { min-height: 180px; padding-top: var(--s-6); }

  .ftr { padding-bottom: var(--s-12); }
}

@media (prefers-reduced-motion: reduce) {
  [data-in], .bubble, .chat__send { animation: none; }
  .ok-mark circle, .ok-mark path { animation: none; stroke-dashoffset: 0; }
  .go.is-going .go__bar span { transition: none; }
}
