/* Old way vs Flowella, ported from Concept 4: the "old way" block, then its rules from the shared
   Responsive and Reduced motion blocks. Logical properties throughout, so Arabic pages mirror the chat
   (bubble corners, timestamps), the select chevron and the Ask, Capture, Trigger highlight. */
.problem-head { display: grid; gap: 22px; max-width: 960px; }
.problem-line { font: 800 clamp(1.25rem, 1.05rem + 0.7vw, 1.6rem)/1.3 var(--text); }
.modes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: clamp(18px, 2.4vw, 32px); margin-top: clamp(40px, 5vw, 64px); }
.mode { min-width: 0; display: flex; flex-direction: column; gap: 22px; padding: clamp(22px, 3vw, 40px); border-radius: var(--r-xl); corner-shape: var(--sq-shape, round); }
.mode-bad { background: var(--field-coral); }
.mode-good { background: var(--field-green); }
.mode-top { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 12px 16px; }
.mode-top > div { min-width: 0; flex: 1 1 260px; }
.mode-sub { margin-top: 6px; font-size: 17px; color: var(--ink-soft); }
.mode-name { flex: none; }
.mode-bad .mode-name { background: var(--coral); color: var(--on-bright); }
.mode-good .mode-name { background: var(--green); color: var(--on-bright); }
.mode-shot { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-start; gap: 14px; }
.mode-tally { max-width: 420px; text-align: center; font-weight: 700; font-size: 16px; line-height: 1.4; text-wrap: balance; }
/* Ask. Capture. Trigger. light up as the Flow is answered */
.act { position: relative; isolation: isolate; white-space: nowrap; }
.act::after {
  content: ""; position: absolute; z-index: -1;
  inset-inline: -0.08em; bottom: 0.02em; height: 0.38em;
  border-radius: 0.2em; background: var(--green); opacity: 0.6;
  transform: scaleX(0); transform-origin: 0 50%;
  transition: transform 420ms var(--ease-out);
}
[dir="rtl"] .act::after { transform-origin: 100% 50%; }  /* the highlight sweeps in from the start of the word */
.act.is-on::after { transform: scaleX(1); }

/* Both mocks sit in WhatsApp's own chrome: the shared parts (.wa-h, .wa-ava, .wa-comp, .wa-managed, .wa-wall and the
   --wa-* colours) are in styles/components.css; what follows is how this module places them. */
/* The chat fills its row beside the Flow (the Shared Rows Rule, below) and keeps its messages at the foot of the
   screen, as WhatsApp does with a short conversation */
.chat {
  width: 100%; max-width: 440px; display: flex; flex-direction: column;
  border-radius: calc(26px * var(--sq-scale, 1)); overflow: hidden;
  box-shadow: var(--shadow); corner-shape: var(--sq-shape, round);
}
.chat > .wa-h { z-index: 2; box-shadow: 0 1px 0 var(--wa-edge); }
.msgs { flex: 1 0 auto; display: flex; flex-direction: column; justify-content: flex-end; gap: 10px; padding: 18px 16px 22px; }
.msg {
  max-width: 84%; padding: 8px 12px 6px; border-radius: calc(16px * var(--sq-scale, 1));
  font-size: 15px; line-height: 1.4;
  box-shadow: var(--shadow-xs);
  rotate: var(--tilt, 0deg);
  corner-shape: var(--sq-shape, round);
}
.msg.in { align-self: flex-start; background: var(--bubble-in); border-start-start-radius: 5px; }
.msg.out { align-self: flex-end; background: var(--bubble-out); border-start-end-radius: 5px; }
.msg time { display: block; margin-top: 3px; text-align: end; font: 500 12px/1 var(--mono); color: var(--ink-soft); font-variant-numeric: tabular-nums; }
/* Broadcast replies drop in like bricks: bottom first, accelerating, then a bounce and a settle.
   The opening broadcast never moves, so the phone is never empty; the replies fall behind it. */
.msgs.is-armed { overflow: hidden; }
.msgs.is-armed .msg { translate: 0 var(--drop, -480px); rotate: var(--spin, 0deg); }
.msgs.is-falling .msg { animation: brick 820ms linear var(--d, 0ms) both; }
.msgs.is-armed .msg:first-child, .msgs.is-falling .msg:first-child { position: relative; z-index: 1; translate: none; rotate: var(--tilt, 0deg); animation: none; }
@keyframes brick {
  0% { translate: 0 var(--drop, -480px); rotate: var(--spin, 0deg); animation-timing-function: cubic-bezier(0.4, 0.12, 0.9, 0.55); }
  56% { translate: 0 0; rotate: calc(var(--tilt, 0deg) + var(--kick, 4deg)); animation-timing-function: cubic-bezier(0.22, 1, 0.36, 1); }
  74% { translate: 0 -12px; rotate: calc(var(--tilt, 0deg) - var(--kick, 4deg) * 0.45); animation-timing-function: cubic-bezier(0.55, 0, 1, 0.45); }
  87% { translate: 0 0; rotate: calc(var(--tilt, 0deg) + var(--kick, 4deg) * 0.2); animation-timing-function: cubic-bezier(0.22, 1, 0.36, 1); }
  94% { translate: 0 -3px; }
  100% { translate: 0 0; rotate: var(--tilt, 0deg); }
}
.chat.is-thud { animation: thud 260ms var(--ease-out); }
@keyframes thud { 0%, 100% { translate: 0 0; } 30% { translate: 0 3px; } }

/* The Flow is a sheet over the chat: the chat's header shows above it, dimmed as WhatsApp dims what is behind a sheet,
   and the sheet's bar rounds over it */
.sheet { width: 100%; max-width: 440px; display: flex; flex-direction: column; border-radius: calc(26px * var(--sq-scale, 1)); overflow: hidden; background: var(--wa-head); box-shadow: var(--shadow); corner-shape: var(--sq-shape, round); }
.sheet > .wa-dim { padding-bottom: 26px; }
.sheet-bar {
  position: relative; z-index: 1; margin-top: -16px;
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 8px;
  padding: 13px 16px; border-bottom: 1px solid var(--line); font-size: 15px;
  border-radius: calc(22px * var(--sq-scale, 1)) calc(22px * var(--sq-scale, 1)) 0 0; corner-shape: var(--sq-shape, round);
  background: var(--sheet-bg);
}
.sheet-bar span { color: var(--ink-soft); }
.sheet-bar b { font-weight: 800; }
.sheet-bar .i { justify-self: end; color: var(--ink-soft); }
.sheet-body { flex: 1; display: flex; flex-direction: column; gap: 14px; padding: 18px 18px 16px; background: var(--sheet-bg); }
.sheet-hi { font-size: 16px; line-height: 1.45; }
.sheet-facts { display: grid; gap: 8px; }
.sheet-facts li { display: flex; align-items: center; gap: 10px; font-size: 15px; line-height: 1.35; color: var(--ink-soft); }
.sheet-facts .i { width: 18px; height: 18px; color: var(--ink); }
.sheet-q { font-weight: 800; font-size: 16px; }
.sheet fieldset { min-width: 0; margin: 0; padding: 0; border: 0; }
.sheet legend { padding: 0; margin-bottom: 8px; }
.opts { display: grid; gap: 8px; }
.opt {
  position: relative;
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  min-height: 48px; padding: 0 14px;
  border-radius: calc(14px * var(--sq-scale, 1)); border: 2px solid var(--line);
  background: var(--sheet-bg);
  font-weight: 700; font-size: 16px; cursor: pointer;
  transition: border-color 160ms ease, background-color 160ms ease;
  corner-shape: var(--sq-shape, round);
}
.opt input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.opt:has(input:checked) { border-color: var(--green); background: var(--field-green); }
.opt:has(input:focus-visible) { outline: 3px solid var(--focus); outline-offset: 2px; }
.dot { flex: none; width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--line-strong); transition: background-color 160ms ease, border-color 160ms ease; }
.opt:has(input:checked) .dot { border-color: var(--green); background: var(--green); box-shadow: inset 0 0 0 4px var(--field-green); }
@media not all and (pointer: coarse) {
  .opt:hover { border-color: var(--line-strong); }
  .opt:has(input:checked):hover { border-color: var(--green); }
}
/* The chosen plan's green outline is drawn around it, then it fills: organised and ready to go */
.opt-trace { position: absolute; inset: -2px; width: calc(100% + 4px); height: calc(100% + 4px); overflow: visible; pointer-events: none; }
[dir="rtl"] .opt-trace { transform: scaleX(-1); }  /* drawn from the top corner at the start of the row */
.opt-trace rect { fill: none; stroke: var(--green); stroke-width: 2; stroke-dasharray: 100; stroke-dashoffset: 100; }
/* While the outline draws, only the border waits for it, so a tapped plan shows as chosen at once. On the
   entrance reveal (.is-revealing) the whole row stays neutral until its outline is drawn. */
.opt.is-tracing:has(input:checked) { border-color: var(--line); }
.opt.is-revealing:has(input:checked) { background: var(--sheet-bg); }
.opt.is-revealing:has(input:checked) .dot { border-color: var(--line-strong); background: transparent; box-shadow: none; }
.sheet-sel { display: grid; gap: 8px; }
.select { position: relative; display: block; }
.select select {
  width: 100%; min-height: 48px; padding-block: 0; padding-inline: 14px 42px;
  border-radius: calc(14px * var(--sq-scale, 1)); border: 2px solid var(--line);
  background: var(--sheet-bg); color: var(--ink);
  font: 700 16px/1.2 var(--text);
  appearance: none; -webkit-appearance: none; cursor: pointer;
  transition: border-color 160ms ease;
  corner-shape: var(--sq-shape, round);
}
.select::after {
  content: ""; position: absolute; inset-inline-end: 18px; top: 50%;
  width: 8px; height: 8px;
  border-right: 2.5px solid var(--ink-soft); border-bottom: 2.5px solid var(--ink-soft);
  translate: 0 -70%; rotate: 45deg; pointer-events: none;
}
.select select:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
@media not all and (pointer: coarse) {
  .select select:hover { border-color: var(--line-strong); }
}
.sheet-btn {
  display: flex; align-items: center; justify-content: center; width: 100%;
  min-height: 50px; border: 0; border-radius: 999px;
  background: var(--green); color: var(--wa-ink);
  font: 800 16px/1 var(--text); cursor: pointer;
  transition: transform 160ms var(--ease-out), background-color 200ms ease;
}
.sheet-btn:active { transform: scale(0.97); }
@media not all and (pointer: coarse) {
  .sheet-btn:hover { background: var(--wa-bg-hover); }
}
/* The button and WhatsApp's "Managed by" line (.wa-managed.sheet-foot) keep to the foot of a stretched sheet */
[data-screen="ask"] > .sheet-btn { margin-top: auto; }
.sheet-done { justify-content: center; gap: 16px; }
.done-head { display: flex; align-items: center; gap: 12px; font: 800 19px/1.25 var(--text); }
/* The tick disc is the concept's shared .tick (styled with the journey); scoped here so this module stands alone */
.done-head .tick { flex: none; border-radius: 50%; display: grid; place-items: center; background: var(--green); color: var(--on-bright); }
.done-head .tick .i { width: 18px; height: 18px; }
.done-head .tick { width: 34px; height: 34px; }
.done-label { margin-bottom: 6px; font: 700 13px/1.2 var(--text); color: var(--ink-soft); }
.cap { border: 1px solid var(--line); border-radius: calc(14px * var(--sq-scale, 1)); overflow: hidden; corner-shape: var(--sq-shape, round); }
.cap > div { display: grid; grid-template-columns: 92px minmax(0, 1fr); gap: 10px; align-items: baseline; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.cap > div:last-child { border-bottom: 0; }
.cap dt { font: 500 13px/1.3 var(--mono); color: var(--ink-soft); }
.cap dd { font-weight: 700; font-size: 15px; overflow-wrap: anywhere; }
.trig { display: grid; gap: 9px; }
.trig li { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 15px; line-height: 1.35; }
.trig .i { width: 24px; height: 24px; padding: 4px; border-radius: 50%; background: var(--green); color: var(--on-bright); }
.sheet-again {
  justify-self: center; align-self: center;
  min-height: 44px; padding: 0 14px;
  border: 0; border-radius: 999px; background: transparent;
  color: var(--accent-ink); font: 700 15px/1 var(--text);
  text-decoration: underline; text-underline-offset: 0.25em; cursor: pointer;
}
.sheet-done.is-in .cap > div,
.sheet-done.is-in .trig li { animation: rise 320ms var(--ease-out) both; animation-delay: calc(var(--k, 0) * 90ms + 140ms); }
@keyframes rise { from { opacity: 0; translate: 0 8px; } to { opacity: 1; translate: 0 0; } }
@keyframes ready { 0%, 100% { scale: 1; } 45% { scale: 1.03; } }
/* The concept defines pop-in with the journey; repeated here (identically) so this module stands alone */
@keyframes pop-in { from { opacity: 0; scale: 0.85; } to { opacity: 1; scale: 1; } }
@media (prefers-reduced-motion: no-preference) {
  .sheet.is-armed .ord, .sheet.is-armed + .mode-tally { opacity: 0; translate: 0 10px; }
  .sheet.is-ordering .ord, .sheet.is-ordering + .mode-tally { animation: rise 340ms var(--ease-out) both; animation-delay: calc(var(--k, 0) * 70ms); }
  .sheet.is-ordering .opt:has(input:checked) .dot { animation: pop-in 380ms var(--ease-pop) both; animation-delay: 1120ms; }
  .sheet.is-ordering .sheet-btn { animation: ready 520ms var(--ease-out) 1360ms; }
}

.points { display: grid; gap: 10px; }
.points li { display: flex; align-items: flex-start; gap: 12px; font-weight: 700; font-size: 17px; line-height: 1.4; }
.points .i { width: 26px; height: 26px; padding: 5px; border-radius: 50%; }
.mode-bad .points .i { background: var(--coral); color: var(--on-bright); }
.mode-good .points .i { background: var(--green); color: var(--on-bright); }
.tags { display: flex; flex-wrap: wrap; gap: 8px; }
.mode-bad .tags .tag { background: transparent; border: 2px solid var(--coral); }
.mode-good .tags .tag { background: var(--green); color: var(--on-bright); }

/* The two previews start and end level (DESIGN.md, the Shared Rows Rule). Side by side, the panels share five rows:
   top, preview, caption, points, tags. So both previews start at the same height whatever the subtitles wrap to, and
   each stretches to the taller one. Every part names its row, so a panel without a caption or tags keeps the others
   in place. Stacked (below 960px) each panel has rows of its own, so nothing stretches. */
@supports (grid-template-rows: subgrid) {
  .mode { display: grid; grid-row: span 5; grid-template-rows: subgrid; row-gap: 22px; }
  .mode-top { grid-row: 1; }
  .mode-shot { display: contents; }
  .mode-shot > .chat, .mode-shot > .sheet { grid-row: 2; justify-self: center; }
  .mode-shot > .mode-tally { grid-row: 3; justify-self: center; margin-top: -8px; }  /* stays 14px under its preview */
  .mode > .points { grid-row: 4; }
  .mode > .tags { grid-row: 5; }
}

/* Responsive (this section's rules from the concept's shared block) */
@media (max-width: 959px) {
  .modes { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 479px) {
  .mode { padding: 18px; }
  .msg { max-width: 90%; }
}

/* Reduced motion: no press scale, no sweep, the done screen fades in (fade-in lives in base.css) */
@media (prefers-reduced-motion: reduce) {
  .sheet-btn:active { transform: none; }
  .act::after { transition: none; }
  .sheet-done.is-in .cap > div, .sheet-done.is-in .trig li { animation: fade-in 200ms ease both; }
}

/* Industry versions (personalisation): each version of the two phones is in the page; the one whose key matches
   <html data-ind> (the base layout sets it before first paint from ?ind= or the visitor's pick) replaces the default,
   so the swap never shifts the page. */
.flw-old-way .modes[data-variant] { display: none; }
:root[data-ind="professional-services"] .flw-old-way .modes[data-variant="professional-services"],
:root[data-ind="b2b-saas"] .flw-old-way .modes[data-variant="b2b-saas"],
:root[data-ind="agencies"] .flw-old-way .modes[data-variant="agencies"],
:root[data-ind="charity-non-profit"] .flw-old-way .modes[data-variant="charity-non-profit"],
:root[data-ind="fintech"] .flw-old-way .modes[data-variant="fintech"],
:root[data-ind="healthcare"] .flw-old-way .modes[data-variant="healthcare"],
:root[data-ind="hospitality"] .flw-old-way .modes[data-variant="hospitality"],
:root[data-ind="education"] .flw-old-way .modes[data-variant="education"],
:root[data-ind="property"] .flw-old-way .modes[data-variant="property"],
:root[data-ind="insurance"] .flw-old-way .modes[data-variant="insurance"],
:root[data-ind="ecommerce"] .flw-old-way .modes[data-variant="ecommerce"] { display: grid; }
:root[data-ind="professional-services"] .flw-old-way[data-variants~="professional-services"] .modes:not([data-variant]),
:root[data-ind="b2b-saas"] .flw-old-way[data-variants~="b2b-saas"] .modes:not([data-variant]),
:root[data-ind="agencies"] .flw-old-way[data-variants~="agencies"] .modes:not([data-variant]),
:root[data-ind="charity-non-profit"] .flw-old-way[data-variants~="charity-non-profit"] .modes:not([data-variant]),
:root[data-ind="fintech"] .flw-old-way[data-variants~="fintech"] .modes:not([data-variant]),
:root[data-ind="healthcare"] .flw-old-way[data-variants~="healthcare"] .modes:not([data-variant]),
:root[data-ind="hospitality"] .flw-old-way[data-variants~="hospitality"] .modes:not([data-variant]),
:root[data-ind="education"] .flw-old-way[data-variants~="education"] .modes:not([data-variant]),
:root[data-ind="property"] .flw-old-way[data-variants~="property"] .modes:not([data-variant]),
:root[data-ind="insurance"] .flw-old-way[data-variants~="insurance"] .modes:not([data-variant]),
:root[data-ind="ecommerce"] .flw-old-way[data-variants~="ecommerce"] .modes:not([data-variant]) { display: none; }
/* The picker: the site's filter pills (as compare-table's), quiet until pressed */
.ow-pick { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; }
.ow-pick-label { font-weight: 700; font-size: 16px; color: var(--ink-soft); }
.ow-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.ow-chip {
  min-height: 44px; padding: 0 18px;
  border: 0; border-radius: 999px;
  background: var(--surface); color: var(--ink);
  font: 700 15px/1.2 var(--text); cursor: pointer;
  box-shadow: inset 0 0 0 1px var(--line), var(--shadow-xs);
  transition: background-color 160ms ease, color 160ms ease, transform 160ms var(--ease-out);
  -webkit-tap-highlight-color: transparent;
}
.ow-chip:active { transform: scale(0.97); }
.ow-chip[aria-pressed="true"] { background: var(--ink); color: var(--ground); box-shadow: none; }
@media not all and (pointer: coarse) {
  .ow-chip[aria-pressed="false"]:hover { background: var(--field-sky); }
}
/* On a phone the ten pills run in one line that scrolls sideways, edge to edge, instead of stacking four rows deep;
   the ends fade where more pills wait. The block padding keeps the focus ring inside the scroller. The script gives
   every pill one width (--ow-pill-w) so a pill is always half off the screen; the row snaps to a pill, so it never
   rests anywhere else. A label may take two lines, and the pills in the row share the tallest one's height */
@media (max-width: 719px) {
  .ow-pick { display: grid; gap: 4px; }
  .ow-chips {
    flex-wrap: nowrap; overflow-x: auto; overscroll-behavior-x: contain; scroll-snap-type: x mandatory; scrollbar-width: none;
    margin: 0 calc(-1 * var(--gutter)); padding: 8px var(--gutter); scroll-padding-inline: var(--gutter);
    mask-image: linear-gradient(to right, transparent, #000 var(--gutter), #000 calc(100% - var(--gutter)), transparent);
  }
  .ow-chips::-webkit-scrollbar { display: none; }
  .ow-chip { flex: none; scroll-snap-align: start; width: var(--ow-pill-w, auto); padding: 4px 14px; text-wrap: balance; }
}
/* A version the visitor picks settles in: a short rise and fade, from an already-readable start */
.modes.is-swapped { animation: ow-swap 320ms var(--ease-out) both; }
@keyframes ow-swap { from { opacity: 0.35; transform: translateY(10px); } }
@media (prefers-reduced-motion: reduce) {
  .ow-chip:active { transform: none; }
  .modes.is-swapped { animation: none; }
}
