/* =====================================================================
   lp-followup.css: scroll-driven follow-up scene (reusable, r2 2026-11-04)
   ---------------------------------------------------------------------
   Markup (one per page, see lp/README.md "Follow-up scene"):
     <div class="fu" data-fu="property">
       <div class="fu__sticky"><div class="fu__inner wrap">
         <ol class="fu__rail">            one <li class="fu__day"> per step: .fu__when + .fu__what
         <div class="fu__phone ui">       .fu__bar + .fu__msgs > one .fu__msg per step (same order)
       </div></div>
     </div>
   Without JS, or with prefers-reduced-motion, nothing is sticky and every bubble is visible (stacked).
   lp-followup.js adds .is-live: the outer box becomes ~(100 + 50 x steps)vh tall, the inner one sticks
   for 100vh, and the scroll progress picks the active step. Earlier bubbles stay; the new one slides in.
   Text colours: every text >= 4.5:1 on its background (future steps use --muted, never opacity).
   ===================================================================== */

.fu { --fu-n: 5; --fu-i: 0; position: relative; margin-top: 48px; }
.fu__inner { display: grid; grid-template-columns: minmax(0, 480px) minmax(0, 400px); justify-content: center; gap: 32px clamp(48px, 9vw, 140px); align-items: start; }

/* ---------- Day rail ---------- */
.fu__rail { position: relative; list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
/* connector from each dot to the next one; segments of finished steps turn cyan to blue */
.fu__day:not(:last-child)::after { content: ""; position: absolute; left: 11px; top: 40px; bottom: -10px; width: 2px; border-radius: 2px; background: linear-gradient(180deg, var(--cyan), var(--blue)); }
.fu.is-live .fu__day:not(:last-child)::after { background: var(--line-2); transition: background-color .3s; }
.fu.is-live .fu__day.is-done:not(:last-child)::after { background: linear-gradient(180deg, var(--cyan), var(--blue)); }
.fu__day { position: relative; display: grid; grid-template-columns: 24px minmax(0, 1fr); column-gap: 18px; padding: 12px 0; }
.fu__day::before { content: ""; grid-row: 1 / span 2; width: 24px; height: 24px; border-radius: 50%; background: #fff; border: 2px solid var(--blue); box-shadow: 0 0 0 5px var(--fu-bg, #fff); position: relative; z-index: 1; box-sizing: border-box; transition: background-color .3s, border-color .3s, transform .3s var(--ease-out); }
.fu__when { font-weight: 600; font-size: .9375rem; line-height: 24px; color: var(--navy); font-variant-numeric: tabular-nums; }
.fu__what { margin-top: 2px; font-size: 1rem; line-height: 1.55; color: var(--text); max-width: 34ch; }
.sec--alt .fu { --fu-bg: var(--bg-2); }
.sec--tint .fu { --fu-bg: var(--blue-50); }

/* live states (JS) */
.fu.is-live .fu__day::before { border-color: var(--line-2); }
.fu.is-live .fu__day.is-done::before { background: var(--cyan-700); border-color: var(--cyan-700); }
.fu.is-live .fu__day.is-on::before { background: var(--blue); border-color: var(--blue); transform: scale(1.12); box-shadow: 0 0 0 5px var(--fu-bg, #fff), 0 0 0 9px var(--blue-100); }
.fu.is-live .fu__day .fu__when { color: var(--muted); transition: color .3s; }
.fu.is-live .fu__day .fu__what { color: var(--muted); transition: color .3s; }
.fu.is-live .fu__day.is-done .fu__when { color: var(--cyan-700); }
.fu.is-live .fu__day.is-on .fu__when { color: var(--blue); }
.fu.is-live .fu__day.is-on .fu__what { color: var(--navy); }

/* ---------- Phone / WhatsApp frame ---------- */
.fu__phone { position: relative; display: flex; flex-direction: column; border-radius: 28px; background: #EFEAE2; border: 8px solid var(--navy); box-shadow: var(--shot); overflow: hidden; min-width: 0; }
.fu__bar { display: flex; align-items: center; gap: 10px; padding: 10px 14px; background: #fff; border-bottom: 1px solid var(--line); flex: none; }
.fu__bar .av { width: 34px; height: 34px; }
.fu__name { font-weight: 600; font-size: .875rem; line-height: 1.25; color: var(--ink); }
.fu__sub { font-size: .75rem; line-height: 1.3; color: var(--muted); }
.fu__msgs { display: flex; flex-direction: column; gap: 6px; padding: 12px 12px 16px; min-height: 0; }
.fu__msg { display: flex; flex-direction: column; gap: 6px; }

.fu__tag { align-self: center; margin: 6px 0 2px; padding: 3px 10px; border-radius: 8px; background: #fff; color: var(--muted); font-size: .6875rem; font-weight: 600; letter-spacing: .2px; box-shadow: 0 1px 1px rgba(0, 0, 0, .06); }
.fu__b { position: relative; max-width: 86%; padding: 7px 10px 8px; border-radius: 10px; font-size: .8125rem; line-height: 1.45; color: #111B21; box-shadow: 0 1px 1px rgba(0, 0, 0, .08); overflow-wrap: anywhere; }
.fu__b--in { align-self: flex-start; background: #fff; border-top-left-radius: 3px; }
.fu__b--out { align-self: flex-end; background: #D9FDD3; border-top-right-radius: 3px; }
.fu__who { display: flex; align-items: center; gap: 5px; margin-bottom: 2px; font-size: .6875rem; font-weight: 600; color: var(--cyan-700); }
.fu__t { float: right; margin: 6px 0 -3px 10px; font-size: .625rem; line-height: 1; color: #54636C; }
.fu__sys { align-self: center; max-width: 92%; display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 8px; background: var(--blue-100); color: var(--blue-800); font-size: .6875rem; font-weight: 600; text-align: center; }
.fu__sys--hot { background: var(--red-50); color: var(--red-700); }
.fu__sys--ok { background: var(--green-50); color: var(--green-700); }

/* attachment (image) card inside an outgoing bubble */
.fu__att { display: block; margin: -3px -6px 6px; border-radius: 8px; overflow: hidden; background: #fff; }
.fu__att img { display: block; width: 100%; aspect-ratio: 16 / 10; object-fit: cover; }
.fu__att span { display: flex; align-items: center; gap: 6px; padding: 6px 8px; font-size: .6875rem; font-weight: 600; color: var(--ink); }
.fu__att span::before { content: ""; width: 14px; height: 16px; border-radius: 2px; background: var(--red-700); flex: none; }
.fu__att--photo span::before { width: 14px; height: 12px; background: var(--blue); }

/* payment link card */
.fu__pay { display: block; margin: -3px -6px 6px; border-radius: 8px; overflow: hidden; background: #F5F6F6; }
.fu__pay b { display: block; padding: 8px 10px 0; font-size: .75rem; color: var(--ink); }
.fu__pay small { display: block; padding: 0 10px 8px; font-size: .6875rem; color: #54636C; }
.fu__pay i { display: block; padding: 7px; border-top: 1px solid #E3E6E8; text-align: center; font-style: normal; font-weight: 600; font-size: .75rem; color: #016A9A; }

/* quick-reply buttons under a bubble */
.fu__qr { align-self: flex-end; display: flex; gap: 6px; max-width: 86%; }
.fu__qr span { flex: 1 1 0; padding: 6px 12px; border-radius: 10px; background: #fff; color: #016A9A; font-size: .75rem; font-weight: 600; text-align: center; box-shadow: 0 1px 1px rgba(0, 0, 0, .08); white-space: nowrap; }

/* ---------- Live (sticky) mode: set by lp-followup.js ---------- */
.fu.is-live { height: calc(100vh + var(--fu-n) * 50vh); margin-top: 8px; }
.fu.is-live .fu__sticky { position: sticky; top: 0; height: 100vh; height: 100svh; display: flex; align-items: center; }
.fu.is-live .fu__inner { align-items: center; padding-top: calc(var(--header-h) + 12px); }
.fu.is-live .fu__phone { height: min(640px, calc(100svh - var(--header-h) - 72px)); }
.fu.is-live .fu__msgs { flex: 1; justify-content: flex-end; overflow: hidden; }
.fu.is-live .fu__msg:not(.is-shown) { display: none; }
.fu.is-live .fu__msg.is-new > * { animation: fu-in .5s var(--ease-out) both; }
.fu.is-live .fu__msg.is-new > :nth-child(2) { animation-delay: .12s; }
.fu.is-live .fu__msg.is-new > :nth-child(3) { animation-delay: .24s; }
.fu.is-live .fu__msg.is-new > :nth-child(4) { animation-delay: .36s; }
@keyframes fu-in { from { opacity: 0; transform: translateY(14px) scale(.98); } to { opacity: 1; transform: none; } }

/* ---------- Tablet / phone ---------- */
@media (max-width: 900px) {
  .fu__inner { grid-template-columns: minmax(0, 1fr); gap: 28px; }
  .fu__phone { width: 100%; max-width: 420px; margin-inline: auto; }
}
@media (max-width: 900px) {
  /* compact horizontal day rail on top; only the active step's line shows under it */
  .fu.is-live .fu__inner { display: flex; flex-direction: column; align-items: stretch; gap: 12px; height: 100%; padding-top: calc(var(--header-h) + 20px); padding-bottom: 20px; }
  .fu.is-live .fu__rail { display: flex; gap: 6px; padding-bottom: calc(1.45em * 2 + 10px); flex: none; }
  .fu.is-live .fu__day::after { display: none; }
  .fu.is-live .fu__day { display: block; position: static; flex: 1 1 0; min-width: 0; padding: 0; }
  .fu.is-live .fu__day::before { display: none; }
  .fu.is-live .fu__when { display: block; padding: 6px 2px; border-radius: 10px; background: var(--grey-50); text-align: center; font-size: .75rem; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; transition: background-color .3s, color .3s; }
  .fu.is-live .fu__day.is-done .fu__when { background: var(--cyan-50); color: var(--cyan-700); }
  .fu.is-live .fu__day.is-on .fu__when { background: var(--blue); color: #fff; }
  .fu.is-live .fu__what { display: none; }
  .fu.is-live .fu__day.is-on .fu__what { display: block; position: absolute; left: 0; right: 0; bottom: 0; max-width: none; margin: 0; font-size: .9375rem; line-height: 1.45; min-height: calc(1.45em * 2); color: var(--navy); }
  .fu.is-live .fu__phone { flex: 1 1 auto; height: auto; min-height: 0; max-height: 600px; border-width: 6px; border-radius: 24px; }
}
@media (max-width: 767px) {
  /* leave room for the sticky WhatsApp bar */
  body.has-sticky .fu.is-live .fu__inner { padding-bottom: calc(92px + env(safe-area-inset-bottom, 0px)); }
}
@media (max-width: 480px) {
  .fu { margin-top: 32px; }
  .fu__b { max-width: 90%; }
}

/* Reduced motion: no sticky scene, everything stacked and visible (JS also skips .is-live) */
@media (prefers-reduced-motion: reduce) {
  .fu.is-live { height: auto; }
  .fu.is-live .fu__sticky { position: static; height: auto; }
  .fu.is-live .fu__msg:not(.is-shown) { display: flex; }
  .fu.is-live .fu__msg.is-new > * { animation: none; }
}

/* short chip labels (mobile rail only) */
.fu__ws { display: none; }
@media (max-width: 900px) {
  .fu.is-live .fu__day { flex: 1 1 auto; }
  .fu.is-live .fu__rail { gap: 4px; }
  .fu.is-live .fu__when { padding-inline: 5px; }
  .fu.is-live .fu__wl:has(+ .fu__ws) { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .fu.is-live .fu__ws { display: inline; }
}
