/* ==========================================================================
   Analytics & AI · 2 — Ask your data. Get the answer on your phone.
   "Phone conversation": copy and the status list on the left; on the
   right a channel rail hugging a phone, whose thread re-skins per channel;
   the sample questions live inside the phone as quick replies above the
   composer, and the fine print sits below.
       Ask your data. Get the answer …       ◎ Web ──────┌──────────────┐
       sub …                                 ○ WhatsApp  │ ◈ Finflow    │
       [Available now] Dashboards …          ○ Telegram  │      question│ ← me
       [Roadmap]       Credit scoring …      ○ SMS       │ answer ▇▇▇   │ ← bot
                                                         │ (q1)(q2)(q3) │ ← quick replies
                                                         │ [Ask…     ➤] │
                                                         └──────────────┘
   The phone stays light in both site themes (a screen, not the page).
   Skins (data-skin): web = Finflow's own answer panel; wa / tg = chat
   wallpaper and bubble tints; sms = plain text bubbles. No channel logos.
   States (js/ai/ask.js). Prefixed .ad- and scoped to .ad.
   ========================================================================== */

.ad {
  position: relative;
  padding: clamp(72px, 9vw, 120px) var(--page-px);
  background: var(--surface);
  border-top: 1px solid var(--border);
}
.ad-inner {
  max-width: var(--container);
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: clamp(40px, 6vw, 88px);
}

/* ─── Copy ────────────────────────────────────────────────────────────── */
.ad-title { font-size: var(--fs-section-title); font-weight: 600; line-height: 1.12; letter-spacing: -0.03em; text-wrap: balance; }
.ad-title em { font-style: normal; color: var(--accent); }
.ad-sub { margin-top: 16px; max-width: 560px; font-size: var(--fs-section-sub); line-height: 1.6; color: var(--text-secondary); }
.ad-status { display: grid; gap: 12px; margin: 28px 0 0; padding: 22px 0 0; list-style: none; border-top: 1px solid var(--border); }
.ad-status li { display: grid; grid-template-columns: 116px minmax(0, 1fr); align-items: baseline; gap: 14px; font-size: 14.5px; line-height: 1.55; color: var(--text-secondary); }
.ad-badge { justify-self: start; display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; font-size: 12px; font-weight: 600; white-space: nowrap; border-radius: 99px; }
.ad-badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.ad-badge--now  { color: var(--good); background: var(--good-soft); }
.ad-badge--next { color: var(--text-secondary); border: 1px dashed var(--border-strong); }
.ad-badge--next::before { background: transparent; box-shadow: inset 0 0 0 1.5px currentColor; }

/* ─── Demo column: the rail hugs the phone ─────────────────────────────── */
.ad-demo { display: flex; flex-direction: column; align-items: center; gap: 14px; }
.ad-stage { display: flex; align-items: center; gap: 30px; }

/* channel rail: the active channel is wired to the phone */
/* side panel: Channel, then Ask, everything you can change on one side */
.ad-panel { display: flex; flex-direction: column; width: 212px; }
.ad-panel-t { margin: 0 0 8px 6px; font-size: 11.5px; font-weight: 600; color: var(--text-muted); }
.ad-panel-t + .ad-rail { margin-bottom: 22px; }
.ad-rail { display: flex; flex-direction: column; gap: 4px; }
.ad-rail button {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 12px 6px 6px;
  font: inherit;
  font-size: 13.5px;
  font-weight: 500;
  white-space: nowrap;
  color: var(--text-secondary);
  background: none;
  border: 0;
  border-radius: 12px;
  cursor: pointer;
  transition: color 0.2s ease, background-color 0.2s ease;
}
.ad-rail-ic {
  display: grid;
  place-items: center;
  width: 34px; height: 34px;
  color: var(--text-muted);
  background: var(--surface-raised);
  border: 1px solid var(--border);
  border-radius: 10px;
  transition: color 0.2s ease, background-color 0.2s ease, border-color 0.2s ease, transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.ad-rail-ic .ti { font-size: 18px; }
.ad-rail button:hover { color: var(--text-primary); }
.ad-rail button:hover .ad-rail-ic { border-color: var(--border-strong); }
.ad-rail button[aria-checked="true"] { color: var(--text-primary); font-weight: 600; background: var(--surface-raised); }
.ad-rail button[aria-checked="true"] .ad-rail-ic { color: #FFFFFF; background: var(--accent); border-color: transparent; transform: scale(1.04); }
:root[data-theme="dark"] .ad-rail button[aria-checked="true"] .ad-rail-ic { color: #0B1F42; }
/* the wire from the active channel to the phone */
.ad-rail button::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 100%;
  width: 30px;
  height: 1.5px;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.3s cubic-bezier(0.22, 1, 0.36, 1);
}
.ad-rail button[aria-checked="true"]::after { transform: none; transition-delay: 0.05s; }
.ad-rail button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Ask: the three questions; the one being answered is lit, and while
   autoplay holds on it a hairline fills under it */
.ad-qs { display: flex; flex-direction: column; gap: 2px; }
.ad-q {
  position: relative;
  padding: 8px 10px 9px 12px;
  font: inherit;
  font-size: 13px;
  line-height: 1.4;
  text-align: left;
  color: var(--text-secondary);
  background: none;
  border: 0;
  border-radius: 10px;
  cursor: pointer;
  overflow: hidden;
  transition: color 0.2s ease, background-color 0.2s ease;
}
.ad-q::before { content: ''; position: absolute; left: 0; top: 9px; bottom: 9px; width: 2px; background: var(--accent); border-radius: 2px; transform: scaleY(0); transition: transform 0.25s cubic-bezier(0.22, 1, 0.36, 1); }
.ad-q:hover { color: var(--text-primary); }
.ad-q[aria-pressed="true"] { color: var(--text-primary); font-weight: 500; background: var(--surface-raised); }
.ad-q[aria-pressed="true"]::before { transform: none; }
.ad-q::after { content: ''; position: absolute; left: 12px; right: 10px; bottom: 3px; height: 1.5px; background: var(--accent-line); transform: scaleX(0); transform-origin: left; }
.ad-q.is-timing::after { animation: ad-hold var(--hold, 6s) linear both; }
@keyframes ad-hold { to { transform: scaleX(1); } }
.ad-q:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

/* ─── The phone (always a light screen) ───────────────────────────────── */
.ad-phone {
  --text-primary: #0D1B2A; --text-secondary: #4A5568; --text-muted: #8A95A3;
  --border: rgba(0,0,0,0.08); --border-strong: rgba(0,0,0,0.14);
  --surface: #FFFFFF; --surface-raised: #F7F9FC;
  --accent: var(--blue-600); --accent-text: var(--blue-700); --accent-soft: var(--blue-50);
  --good: #12806A; --good-soft: #DDF3EC; --warn: #C2410C; --warn-soft: #FDEBDD;
  --ad-screen: #FFFFFF;
  --ad-wall: #F5F7FA;
  --ad-me: var(--accent); --ad-me-ink: #FFFFFF;
  --ad-bot: #FFFFFF; --ad-bot-ink: var(--text-primary);
  color-scheme: light;

  /* the platform page's device (field.css .fa-device), one phone across the site */
  position: relative;
  flex: none;
  width: 284px;
  height: 584px;
  padding: 7px;
  background: #0C0F14;
  border-radius: 42px;
  box-shadow:
    0 0 0 1.5px #3A414B,
    0 0 0 3px #1A1E24,
    0 40px 80px -30px rgba(0,0,0,0.7),
    0 18px 36px -18px rgba(0,0,0,0.5);
}
:root[data-theme="dark"] .ad-phone { box-shadow: 0 0 0 1.5px #4A5462, 0 0 0 3px #1A1E24, 0 40px 80px -30px rgba(0,0,0,0.8); }
.ad-btn { position: absolute; right: -4.5px; width: 3px; background: #2A2F37; border-radius: 0 2px 2px 0; }
.ad-btn--vol   { top: 110px; height: 64px; }
.ad-btn--power { top: 190px; height: 40px; }
.ad-screen {
  position: relative;
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--ad-screen);
  border-radius: 35px;
  color: var(--text-primary);
}
.ad-screen::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 5;
  border-radius: inherit;
  background: linear-gradient(115deg, rgba(255,255,255,0.10) 0%, rgba(255,255,255,0) 32%);
  pointer-events: none;
}
.ad-camera {
  position: absolute;
  top: 11px; left: 50%;
  z-index: 4;
  width: 10px; height: 10px;
  margin-left: -5px;
  background: #050607;
  border-radius: 50%;
  box-shadow: inset 0 0 0 2px #15191F;
}
.ad-sbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex: none;
  height: 32px;
  padding: 4px 20px 0 22px;
  font-size: 11.5px;
  font-weight: 500;
}
.ad-sbar-icons { display: flex; align-items: center; gap: 5px; }
.ad-sbar-icons .ti { font-size: 15px; }
.ad-bars { display: inline-flex; align-items: flex-end; gap: 2px; height: 10px; }
.ad-bars i { display: block; width: 3px; background: currentColor; border-radius: 1px; }
.ad-bars i:nth-child(1) { height: 3px; }
.ad-bars i:nth-child(2) { height: 5.5px; }
.ad-bars i:nth-child(3) { height: 8px; }
.ad-bars i:nth-child(4) { height: 10px; }

.ad-top {
  display: flex;
  align-items: center;
  gap: 9px;
  flex: none;
  padding: 4px 14px 10px;
  border-bottom: 1px solid var(--border);
  transition: background-color 0.3s ease;
}
/* the icon fills its avatar: the artwork already carries its own margin */
.ad-av { display: grid; place-items: center; width: 40px; height: 40px; background: #FFFFFF; border: 1px solid var(--border); border-radius: 50%; }
.ad-av img { display: block; width: 36px; height: 36px; }
.ad-who { display: flex; flex-direction: column; line-height: 1.2; }
.ad-who b { font-size: 13.5px; font-weight: 600; color: var(--text-primary); }
.ad-who small { font-size: 11px; color: var(--text-muted); }

.ad-thread {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 8px;
  padding: 12px 10px;
  overflow: hidden;
  background: var(--ad-wall) !important;
  transition: background-color 0.3s ease;
}
/* (the sample questions live in the side panel, under the channels) */

.ad-compose {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: none;
  padding: 8px 10px 18px;
  border-top: 1px solid var(--border);
}
.ad-compose-t {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding: 7px 11px;
  font-size: 12px;
  color: var(--text-muted);
  background: var(--surface-raised);
  border-radius: 99px;
}
.ad-compose-t.is-typed { color: var(--text-primary); }
.ad-send { display: grid; place-items: center; flex: none; width: 30px; height: 30px; color: #FFFFFF; background: var(--accent); border-radius: 50%; transition: transform 0.15s ease; }
.ad-send.is-press { transform: scale(0.86); }
.ad-send .ti { font-size: 15px; }

/* messages */
.ad-msg {
  max-width: 86%;
  padding: 8px 11px;
  font-size: 12px;
  line-height: 1.45;
  white-space: pre-line;
  border-radius: 14px;
  animation: ad-in 0.32s cubic-bezier(0.22, 1, 0.36, 1) both;
}
.ad-msg--me  { align-self: flex-end; color: var(--ad-me-ink); background: var(--ad-me); border-bottom-right-radius: 4px; }
.ad-msg--bot { align-self: flex-start; color: var(--ad-bot-ink); background: var(--ad-bot); border-bottom-left-radius: 4px; box-shadow: 0 1px 1px rgba(0,0,0,0.06); }
@keyframes ad-in { from { opacity: 0; transform: translateY(8px) scale(0.98); } }

/* Web: Finflow's own rich answer */
.ad-msg--rich { max-width: 100%; width: 100%; padding: 12px 12px 11px; white-space: normal; border: 1px solid var(--border); box-shadow: none; }
.ad-msg h4 { margin-bottom: 9px; font-family: var(--font-display); font-size: 13px; font-weight: 600; line-height: 1.35; letter-spacing: -0.01em; color: var(--text-primary); }
.ad-bar { display: grid; grid-template-columns: 62px minmax(0, 1fr) 36px; align-items: center; gap: 7px; height: 19px; font-size: 11px; color: var(--text-secondary); }
.ad-bar b { font-family: var(--font-mono); font-size: 10.5px; font-weight: 500; text-align: right; color: var(--text-primary); }
.ad-track { height: 7px; background: var(--border); border-radius: 4px; overflow: hidden; }
.ad-track i { display: block; height: 100%; width: calc(var(--w) * 100%); background: var(--accent); border-radius: 4px; transform-origin: left; animation: ad-grow 0.6s cubic-bezier(0.22, 1, 0.36, 1) both; }
.ad-track i.is-up { background: var(--warn); }
@keyframes ad-grow { from { transform: scaleX(0); } }
.ad-next { margin-top: 9px; padding-top: 8px; font-size: 11px; line-height: 1.45; color: var(--text-secondary); border-top: 1px solid var(--border); }
.ad-next b { color: var(--text-primary); }
.ad-pts { display: grid; gap: 5px; margin: 0; padding: 0; list-style: none; }
.ad-pts li { position: relative; padding-left: 14px; font-size: 11.5px; line-height: 1.4; color: var(--text-secondary); }
.ad-pts li::before { content: ''; position: absolute; left: 2px; top: 6px; width: 5px; height: 5px; background: var(--good); border-radius: 50%; }
.ad-alert { margin-bottom: 8px; padding: 8px 9px; background: var(--warn-soft); border-radius: 8px; }
.ad-alert b { display: block; font-size: 11px; color: var(--warn); }
.ad-alert p { margin-top: 2px; font-size: 11px; line-height: 1.4; color: var(--text-secondary); }

/* chats: a chart image or a table inside the bubble */
.ad-viz { margin-top: 8px; padding: 8px 9px 7px; white-space: normal; background: #FFFFFF; border: 1px solid var(--border); border-radius: 9px; }
.ad-viz > b { display: block; margin-bottom: 6px; font-size: 11px; font-weight: 600; color: var(--text-primary); }
.ad-viz small { display: block; margin-top: 5px; font-size: 10px; color: var(--text-muted); }
.ad-viz .ad-bar { grid-template-columns: 56px minmax(0, 1fr) 32px; height: 16px; font-size: 10px; }
.ad-mini { width: 100%; font-size: 11px; border-collapse: collapse; }
.ad-mini td { padding: 4px 0; border-top: 1px solid var(--border); color: var(--text-secondary); }
.ad-mini td:last-child { text-align: right; font-family: var(--font-mono); color: var(--warn); }

/* typing */
.ad-typing { display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }
.ad-typing i { width: 5px; height: 5px; background: var(--text-muted); border-radius: 50%; animation: ad-dot 1s ease-in-out infinite; }
.ad-typing i:nth-child(2) { animation-delay: 0.15s; }
.ad-typing i:nth-child(3) { animation-delay: 0.3s; }
.ad-typing span { margin-left: 4px; font-size: 11px; color: var(--text-muted); }
@keyframes ad-dot { 0%, 60%, 100% { transform: none; opacity: 0.5; } 30% { transform: translateY(-3px); opacity: 1; } }

/* skins */
.ad-phone[data-skin="wa"]  { --ad-wall: #EFE8DE; --ad-me: #D9FDD3; --ad-me-ink: #0D1B2A; }
.ad-phone[data-skin="tg"]  { --ad-wall: #D5E3EC; --ad-me: #E2FEC7; --ad-me-ink: #0D1B2A; }
.ad-phone[data-skin="sms"] { --ad-wall: #FFFFFF; --ad-me: #34A853; --ad-me-ink: #FFFFFF; --ad-bot: #ECEEF1; }
.ad-phone[data-skin="sms"] .ad-msg--bot { box-shadow: none; }
.ad-phone[data-skin="sms"] .ad-who b { font-family: var(--font-mono); font-weight: 500; letter-spacing: 0.04em; }

.ad-fine { font-size: 12px; color: var(--text-muted); }

@media (max-width: 960px) {
  .ad-inner { grid-template-columns: minmax(0, 1fr); }
}
/* phones: the rail lies down above the phone */
@media (max-width: 560px) {
  .ad-stage { flex-direction: column; gap: 14px; }
  .ad-panel { width: 100%; max-width: 360px; }
  .ad-panel-t { display: none; }
  .ad-panel-t + .ad-rail { margin-bottom: 8px; }
  .ad-rail { flex-direction: row; justify-content: center; gap: 4px; }
  .ad-q { text-align: center; }
  .ad-rail button { flex-direction: column; gap: 4px; padding: 6px 4px; font-size: 11.5px; }
  .ad-rail button::after { display: none; }
}
@media (max-width: 400px) {
  .ad-phone { width: 268px; height: 556px; }
  .ad-status li { grid-template-columns: minmax(0, 1fr); gap: 6px; }
}
@media (prefers-reduced-motion: reduce) {
  .ad-msg, .ad-track i, .ad-typing i { animation: none; }
  .ad-rail button::after, .ad-rail-ic, .ad-q::before { transition: none; }
  .ad-q.is-timing::after { animation: none; }
}
