/* ==========================================================================
   Hero hub diagram, lead flow and example conversation.
   Motion grammar: things assemble once on load (ease-out), leads travel
   along connectors toward the core (linear), the core breathes (live state).
   Text never moves while it is being read.
   ========================================================================== */

/* ---------- Hero ---------- */
.hero { position: relative; padding-top: calc(112px + env(safe-area-inset-top, 0px)); padding-bottom: clamp(56px, 6vw, 96px); }
.hero > .container { max-width: 1320px; }
.hero-grid { display: grid; grid-template-columns: minmax(0, 0.92fr) minmax(0, 1.18fr); gap: clamp(24px, 3.5vw, 48px); align-items: center; min-height: min(calc(100dvh - 140px), 780px); }
.hero-copy { display: grid; gap: 28px; align-content: center; container-type: inline-size; }
.hero-copy .lead { max-width: 44ch; }
/* Three fixed lines, sized to the column: the longest line is about 7.45em wide at this stretch. */
.hero .display { font-size: min(5.8rem, 15.2cqi); line-height: 0.9; }
.hero-copy .lead { color: var(--text-muted); }
.hero .display .line { white-space: nowrap; }

/* ---------- Hub ---------- */
.hub { position: relative; width: 100%; max-width: 800px; aspect-ratio: 100 / 94; justify-self: end; container-type: inline-size; }
@media (min-width: 961px) { .hub { margin-right: calc(var(--gutter) * -0.75); } }
.hub-svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.hub-svg .link { stroke: var(--blue-500); stroke-width: 0.42; fill: none; stroke-linecap: round; }
.hub-svg .guide { stroke: var(--blue-300); stroke-width: 0.3; fill: none; stroke-dasharray: 0.6 1.1; stroke-linecap: round; opacity: 0.9; }
.hub-svg .dot { fill: var(--blue-500); }
.hub-svg .pulse { fill: #FFFFFF; stroke: var(--blue-500); stroke-width: 0.5; }
.hub-svg .pulse-out { fill: var(--blue-500); }

.node {
  position: absolute; left: calc(var(--x) * 1%); top: calc(var(--y) / 94 * 100%);
  width: 13.6%; aspect-ratio: 1; transform: translate(-50%, -50%);
  display: grid; place-items: center;
  background: var(--surface); color: var(--accent);
  border-radius: 24%;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 1),
    inset 0 -2px 0 rgba(214, 224, 242, 0.6),
    0 2px 0 #DCE4F2, 0 4px 0 #E3EAF6, 0 6px 0 #ECF1F9,
    0 22px 36px -14px rgba(30, 64, 160, 0.32),
    0 3px 8px rgba(30, 64, 160, 0.07);
}
.node .ic { width: 54%; height: 54%; }
.node-label { position: absolute; top: 106%; left: 50%; transform: translateX(-50%); font: 600 clamp(9px, 1.55cqi, 12px)/1.1 var(--font-body); color: var(--text-muted); white-space: nowrap; }
.node-label.top { top: auto; bottom: 106%; }

.hub-core {
  position: absolute; left: 50%; top: 50%; width: 21%; aspect-ratio: 1; transform: translate(-50%, -50%);
  display: grid; place-items: center; border-radius: 26%;
  background: var(--core-gradient);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.35),
    inset 0 -6px 14px rgba(13, 35, 120, 0.35),
    0 4px 0 var(--blue-700),
    0 26px 44px -16px rgba(29, 78, 216, 0.65);
}
.hub-core img { width: 60%; height: auto; position: relative; }
.ring { position: absolute; left: 50%; top: 50%; border-radius: 50%; transform: translate(-50%, -50%); pointer-events: none; }
.ring-1 { width: 36%; aspect-ratio: 1; background: radial-gradient(circle, rgba(37, 99, 235, 0.22) 0%, rgba(74, 108, 247, 0.12) 45%, rgba(74, 108, 247, 0) 70%); }
.ring-2 { width: 58%; aspect-ratio: 1; background: radial-gradient(circle, rgba(74, 108, 247, 0.10) 0%, rgba(74, 108, 247, 0.05) 50%, rgba(74, 108, 247, 0) 70%); box-shadow: inset 0 0 0 1px rgba(37, 99, 235, 0.06); }

.fpanel { position: absolute; left: calc(var(--x) * 1%); top: calc(var(--y) / 94 * 100%); width: calc(var(--w) * 1%); padding: 2.2cqi; display: grid; gap: 1.4cqi; }
.fpanel-title { font: 600 clamp(11px, 1.6cqi, 13px)/1 var(--font-body); color: var(--text-muted); letter-spacing: 0.02em; display: flex; align-items: center; gap: 6px; }
.fpanel-title i { width: 6px; height: 6px; border-radius: 50%; background: #D3DCEC; display: inline-block; flex: none; }
.fpanel svg { width: 100%; height: auto; }
.toggle-row { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 8px; font: 500 clamp(10px, 1.5cqi, 12px)/1.1 var(--font-body); color: var(--text-body); }
.toggle { width: 4.6cqi; min-width: 22px; aspect-ratio: 1.8; border-radius: 99px; background: var(--accent); position: relative; }
.toggle::after { content: ""; position: absolute; right: 12%; top: 50%; width: 38%; aspect-ratio: 1; border-radius: 50%; background: #fff; transform: translateY(-50%); }


/* Assemble once on load: purpose is explanation (the system comes together). */
@media (prefers-reduced-motion: no-preference) {
  .hub .node, .hub .fpanel, .hub .hub-core { animation: nodeIn 640ms var(--ease-out) both; animation-delay: calc(var(--i, 0) * 55ms + 120ms); }
  .hub .hub-core { animation-delay: 60ms; }
  .hub .fpanel { animation-name: panelIn; animation-duration: 760ms; }
  .hub-svg .link, .hub-svg .guide { stroke-dashoffset: 0; animation: lineIn 900ms var(--ease-out) both; animation-delay: 380ms; }
  .hub-svg .link { stroke-dasharray: 60; }
  .hub-svg .dot { animation: fadeIn 400ms ease-out both; animation-delay: 700ms; }
  .ring-1 { animation: breathe 3.6s var(--ease-in-out) infinite; }
  .ring-2 { animation: breathe 3.6s var(--ease-in-out) infinite; animation-delay: -1.8s; }
  .hub.is-paused .ring-1, .hub.is-paused .ring-2 { animation-play-state: paused; }
}
@keyframes nodeIn { from { opacity: 0; transform: translate(-50%, -46%) scale(0.94); } to { opacity: 1; transform: translate(-50%, -50%) scale(1); } }
@keyframes panelIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes lineIn { from { stroke-dashoffset: 60; opacity: 0; } to { stroke-dashoffset: 0; opacity: 1; } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes breathe { 0%, 100% { transform: translate(-50%, -50%) scale(1); opacity: 1; } 50% { transform: translate(-50%, -50%) scale(1.08); opacity: 0.7; } }
@media (prefers-reduced-motion: reduce) {
  .hub-svg .pulses { display: none; }
}

/* ---------- Lead flow (How it works) ---------- */
.flow { position: relative; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 22px; }
.flow-track { position: absolute; left: 12.5%; right: 12.5%; top: 78px; height: 3px; border-radius: 3px; background: var(--blue-500); overflow: hidden; }
.flow-runner { position: absolute; inset: 0; transform: translateX(-100%); }
.flow-runner::after { content: ""; position: absolute; right: 0; top: 50%; width: 14px; height: 14px; border-radius: 50%; background: #FFFFFF; border: 3px solid var(--accent); box-shadow: 0 0 0 6px rgba(74, 108, 247, 0.22), 0 0 18px 4px rgba(74, 108, 247, 0.55); transform: translateY(-50%); }
.flow-runner::before { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, transparent 60%, rgba(255, 255, 255, 0.7)); }
.flow { --node: 9px; }
.step::before, .step::after { content: ""; position: absolute; top: calc(78px + 1.5px - var(--node) / 2); width: var(--node); height: var(--node); border-radius: 50%; background: var(--accent); }
.step::before { left: calc(var(--node) / -2); }
.step::after { right: calc(var(--node) / -2); }
.step:first-of-type::before, .step:last-of-type::after { display: none; }
.step-art { width: 108px; height: 108px; object-fit: contain; margin: -6px 0 4px; filter: drop-shadow(0 14px 16px rgba(30, 64, 160, 0.22)); }
.step { position: relative; z-index: 1; padding: 30px 24px 28px; display: grid; gap: 12px; justify-items: center; text-align: center; align-content: start; }
.step .tile-ic { width: 76px; height: 76px; border-radius: 22px; margin: 10px 0 20px; }
.step .tile-ic .ic { width: 36px; height: 36px; }
.step p { color: var(--text-muted); font-size: var(--text-small); max-width: 30ch; }
@media (prefers-reduced-motion: no-preference) {
  .flow .flow-runner { animation: run 8s linear infinite; }
  .flow .step .step-art, .flow .step .tile-ic { animation: stepGlow 8s var(--ease-out) infinite; animation-delay: calc(var(--i, 0) * 2s); }
  .flow.is-paused .flow-runner, .flow.is-paused .step .step-art, .flow.is-paused .step .tile-ic { animation-play-state: paused; }
}
@keyframes run { 0% { transform: translateX(-100%); opacity: 1; } 75% { transform: translateX(0); opacity: 1; } 88%, 100% { transform: translateX(0); opacity: 0; } }
@keyframes stepGlow {
  0% { transform: translateY(-6px) scale(1.04); }
  12% { transform: none; }
  100% { transform: none; }
}

/* ---------- Example conversation ---------- */
.convo-wrap { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 420px); gap: clamp(28px, 4vw, 64px); align-items: center; margin-top: clamp(56px, 7vw, 96px); }
.convo-copy { display: grid; gap: 18px; }
.convo-copy .h3 { font-size: clamp(1.4rem, 1.1rem + 1vw, 2rem); }
.chat { position: relative; padding: 30px 18px 18px; border-radius: 38px; display: grid; gap: 12px; border: 7px solid #FFFFFF; background: #FBFCFF; box-shadow: 0 2px 0 #DCE4F2, 0 5px 0 #E8EEF7, 0 40px 70px -30px rgba(30, 64, 160, 0.45), 0 8px 20px rgba(30, 64, 160, 0.08); }
.chat::before { content: ""; position: absolute; top: 10px; left: 50%; width: 64px; height: 6px; border-radius: 6px; background: #E3E9F4; transform: translateX(-50%); }
@media (min-width: 961px) { .convo-wrap .chat { transform: rotate(3deg); transform-origin: 50% 60%; } }
.chat-head { display: flex; align-items: center; gap: 12px; padding: 4px 6px 12px; border-bottom: 1px solid var(--line); }
.chat-head img { width: 38px; height: 38px; padding: 7px; border-radius: 12px; background: var(--core-gradient); }
.chat-head strong { display: block; color: var(--text); font-size: 0.9375rem; }
.chat-head span { font-size: var(--text-micro); color: var(--text-muted); }
.chat-body { display: grid; gap: 10px; min-height: 330px; align-content: start; padding: 6px 4px; }
.bubble { max-width: 84%; padding: 10px 14px; border-radius: 16px; font-size: 0.9375rem; line-height: 1.4; }
.bubble time { display: block; margin-top: 4px; font: 500 0.6875rem/1 var(--font-mono); opacity: 0.7; }
.bubble.in { justify-self: start; background: #EEF2F8; color: var(--text); border-bottom-left-radius: 6px; }
.bubble.out { justify-self: end; background: var(--accent); color: var(--white); border-bottom-right-radius: 6px; }
.chat .chip-done { justify-self: end; }
.typing { justify-self: end; display: inline-flex; gap: 4px; padding: 12px 14px; border-radius: 16px; background: var(--accent-soft); }
.typing i { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); opacity: 0.4; animation: typing 1s ease-in-out infinite; }
.typing i:nth-child(2) { animation-delay: 0.15s; }
.typing i:nth-child(3) { animation-delay: 0.3s; }
@keyframes typing { 0%, 100% { opacity: 0.35; transform: none; } 50% { opacity: 1; transform: translateY(-2px); } }
.js .chat-body [data-step] { display: none; }
.js .chat-body [data-step].is-on { display: block; animation: bubbleIn 340ms var(--ease-out) both; }
.js .chat-body .chip[data-step].is-on, .js .chat-body .typing.is-on { display: inline-flex; }
@keyframes bubbleIn { from { opacity: 0; transform: translateY(8px) scale(0.98); } to { opacity: 1; transform: none; } }
.chat-foot { padding: 4px 6px 2px; }

/* ---------- Responsive ---------- */
@media (max-width: 960px) {
  .hero-grid { grid-template-columns: minmax(0, 1fr); min-height: 0; gap: 48px; }
  .hub { justify-self: center; }
  .convo-wrap { grid-template-columns: minmax(0, 1fr); }
  .chat { max-width: 440px; width: 100%; }
}
@media (max-width: 860px) {
  .flow { grid-template-columns: minmax(0, 1fr); gap: 16px; }
  .flow-track { left: 60px; right: auto; top: 40px; bottom: 40px; width: 3px; height: auto; background: var(--blue-300); }
  .flow-runner { transform: translateY(-100%); }
  .flow-runner::after { right: auto; left: 50%; top: auto; bottom: 0; transform: translateX(-50%); }
  .flow-runner::before { background: linear-gradient(180deg, transparent, var(--blue-400)); }
  .step { grid-template-columns: 76px 1fr; justify-items: start; text-align: left; column-gap: 20px; padding: 22px; align-items: center; }
  .step .tile-ic, .step .step-art { grid-row: span 2; margin: 0; }
  .step-art { width: 76px; height: 76px; }
  .step::before, .step::after { display: none; }
}
@media (max-width: 860px) and (prefers-reduced-motion: no-preference) { .flow .flow-runner { animation-name: runY; } }
@keyframes runY { 0% { transform: translateY(-100%); opacity: 1; } 75% { transform: translateY(0); opacity: 1; } 88%, 100% { transform: translateY(0); opacity: 0; } }
@media (max-width: 480px) {
  .fpanel-title span, .toggle-row span { display: none; }
  .node-label { display: none; }
}
