:root {
  --nav-h: 68px;
  --container: 1200px;
  --radius-panel: 20px;
  --radius-pill: 999px;
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --font-mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;
}

:root[data-brand="baopay"] {
  color-scheme: dark;
  --bg: #0b0e11;
  --surface: #13171c;
  --surface-2: #181d23;
  --line: rgb(255 255 255 / 0.08);
  --line-strong: rgb(255 255 255 / 0.16);
  --text: #f1f2f4;
  --muted: #9aa2ad;
  --accent: #fcd535;
  --accent-ink: #0b0e11;
  --accent-soft: rgb(252 213 53 / 0.12);
  --accent-rgb: 252 213 53;
  --pill-a-bg: #fcd535;
  --pill-a-ink: #0b0e11;
  --pill-b-bg: #f0b90b;
  --pill-b-ink: #0b0e11;
  --accent-2: #f0b90b;
  --font-display: "Outfit", system-ui, sans-serif;
  --font-body: "Plus Jakarta Sans", system-ui, sans-serif;
  --display-tracking: -0.035em;
}

:root[data-brand="wepay"] {
  color-scheme: light;
  --bg: #f5f3f1;
  --surface: #fcfbfa;
  --surface-2: #ffffff;
  --line: rgb(18 18 18 / 0.08);
  --line-strong: rgb(18 18 18 / 0.16);
  --text: #121212;
  --muted: #5f5c58;
  --accent: #016ae2;
  --accent-ink: #fcfbfa;
  --accent-soft: rgb(1 106 226 / 0.1);
  --accent-rgb: 1 106 226;
  --pill-a-bg: #016ae2;
  --pill-a-ink: #fcfbfa;
  --pill-b-bg: #64aaff;
  --pill-b-ink: #0b1f3a;
  --accent-2: #64aaff;
  --font-display: "Plus Jakarta Sans", system-ui, sans-serif;
  --font-body: "Plus Jakarta Sans", system-ui, sans-serif;
  --display-tracking: -0.04em;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img {
  display: block;
  max-width: 100%;
}

a {
  color: inherit;
}

h1,
h2 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: var(--display-tracking);
  text-wrap: balance;
}

p {
  margin: 0;
}

ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

.container {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: clamp(16px, 4vw, 40px);
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 6px;
}

/* Buttons: every interactive control is a pill; panels use --radius-panel. */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  height: 52px;
  padding-inline: 26px;
  border-radius: var(--radius-pill);
  border: 1px solid transparent;
  font: 600 16px/1 var(--font-body);
  text-decoration: none;
  white-space: nowrap;
  transition: transform 0.35s var(--ease-out), background-color 0.25s, border-color 0.25s, box-shadow 0.35s var(--ease-out);
}

.btn:hover {
  transform: translateY(-2px);
}

.btn:active {
  transform: translateY(0) scale(0.98);
}

.btn i {
  transition: transform 0.35s var(--ease-out);
}

.btn:hover i {
  transform: translateX(3px);
}

.btn-primary {
  background: var(--accent);
  color: var(--accent-ink);
  box-shadow: 0 10px 30px -12px rgb(var(--accent-rgb) / 0.55);
}

.btn-primary:hover {
  box-shadow: 0 16px 36px -14px rgb(var(--accent-rgb) / 0.7);
}

.btn-ghost {
  border-color: var(--line-strong);
  color: var(--text);
  background: color-mix(in srgb, var(--bg) 60%, transparent);
  backdrop-filter: blur(8px);
}

.btn-ghost:hover {
  border-color: var(--text);
}

.btn-sm {
  height: 40px;
  padding-inline: 18px;
  font-size: 14px;
}

/* Nav */
.top-sentinel {
  position: absolute;
  top: 0;
  height: 8px;
  width: 1px;
}

.nav {
  position: sticky;
  top: 0;
  z-index: 10;
  height: var(--nav-h);
  border-bottom: 1px solid transparent;
  transition: background-color 0.3s, border-color 0.3s;
}

.nav.is-scrolled {
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  border-bottom-color: var(--line);
  backdrop-filter: blur(14px) saturate(140%);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
}

.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: clamp(16px, 4vw, 40px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}

.brand-mark {
  width: 40px;
  height: auto;
}

.brand-name {
  font: 700 20px/1 var(--font-display);
  letter-spacing: -0.02em;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 28px;
  font-size: 15px;
  font-weight: 500;
}

.nav-links a:not(.btn) {
  color: var(--muted);
  text-decoration: none;
  transition: color 0.2s;
}

.nav-links a:not(.btn):hover {
  color: var(--text);
}

/* Hero */
.hero {
  position: relative;
  min-height: min(880px, calc(100dvh - var(--nav-h)));
  margin-top: calc(var(--nav-h) * -1);
  padding-top: var(--nav-h);
  display: grid;
  align-items: center;
  overflow: hidden;
  isolation: isolate;
}

.scene {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
}

.hero::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background: linear-gradient(90deg, var(--bg) 18%, color-mix(in srgb, var(--bg) 70%, transparent) 42%, transparent 62%);
}

.hero-inner {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding: 48px clamp(16px, 4vw, 40px) 72px;
}

.hero-copy {
  max-width: 680px;
}

.hero h1 {
  font-size: clamp(2.75rem, 5vw, 4.5rem);
  line-height: 1.02;
}

.hero-sub {
  margin-top: 24px;
  max-width: 34ch;
  font-size: clamp(1.05rem, 1.4vw, 1.25rem);
  color: var(--muted);
  text-wrap: pretty;
}

.hero-cta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 36px;
}

/* Sections */
.section {
  padding-block: clamp(88px, 12vw, 160px);
}

.section-head {
  max-width: 640px;
  margin-inline: auto;
  text-align: center;
}

.section h2,
.cta h2 {
  font-size: clamp(2.1rem, 4.2vw, 3.5rem);
  line-height: 1.04;
}

.section-head p {
  margin-top: 18px;
  text-wrap: balance;
  font-size: 1.1rem;
  color: var(--muted);
  max-width: 52ch;
  margin-inline: auto;
}

/* Statement */
.statement-section {
  padding-bottom: 0;
}

.statement {
  display: grid;
  justify-items: center;
  max-width: 880px;
  text-align: center;
}

.statement-eyebrow {
  font-weight: 600;
  font-size: 1.05rem;
  color: var(--accent);
}

.statement h2 {
  margin-top: 16px;
  font-size: clamp(2.1rem, 4.2vw, 3.5rem);
  line-height: 1.06;
}

.statement-body {
  margin-top: 22px;
  max-width: 58ch;
  font-size: 1.15rem;
  color: var(--muted);
  text-wrap: balance;
}

/* Flow */
.flow {
  position: relative;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: clamp(56px, 11vw, 170px);
  max-width: 1040px;
  margin: clamp(56px, 7vw, 88px) auto 0;
}

.flow-lines {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  pointer-events: none;
}

.flow-path {
  fill: none;
  stroke: var(--line-strong);
  stroke-width: 1.5;
  stroke-linecap: round;
  transition: stroke-dashoffset 1.6s var(--ease-out);
}

.flow-dot {
  fill: var(--accent);
}

.flow-col {
  position: relative;
  display: grid;
  gap: 18px;
}

.flow-in {
  justify-items: end;
}

.flow-out {
  justify-items: start;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 10px 20px 10px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  background: var(--surface);
  font-weight: 600;
  font-size: 16px;
  white-space: nowrap;
  transition: border-color 0.3s, transform 0.4s var(--ease-out);
}

.chip:hover {
  border-color: var(--line-strong);
  transform: translateY(-2px);
}

.chip-icon {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: var(--radius-pill);
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 20px;
}

.flow-hub {
  position: relative;
  display: grid;
  place-items: center;
  width: clamp(128px, 14vw, 168px);
  aspect-ratio: 1;
  border-radius: var(--radius-pill);
  border: 1px solid var(--line-strong);
  background: radial-gradient(circle at 50% 40%, var(--surface-2), var(--surface));
  box-shadow: 0 30px 80px -30px rgb(var(--accent-rgb) / 0.45);
}

.flow-hub img {
  width: 62%;
  height: auto;
}

.hub-ring {
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  border: 1.5px solid var(--accent);
  opacity: 0;
}

.flow-hub.is-ping .hub-ring {
  animation: ping 0.9s var(--ease-out);
}

@keyframes ping {
  from {
    opacity: 0.7;
    transform: scale(1);
  }
  to {
    opacity: 0;
    transform: scale(1.35);
  }
}

/* Why */
.why-title {
  max-width: 12ch;
  font-size: clamp(2.4rem, 5vw, 4rem);
  line-height: 1.02;
}

.why {
  --px: 0;
  --py: 0;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: clamp(28px, 5vw, 72px);
  margin-top: clamp(24px, 4vw, 48px);
}

.why-col {
  display: grid;
  gap: clamp(44px, 6vw, 84px);
}

.why-left {
  justify-items: end;
}

.why-right {
  justify-items: start;
}

/* Outer pills sit further out than the middle one, so each column curves around the disc. */
.why-left .pill:not(:nth-child(2)) {
  --x: -44px;
}

.why-right .pill:not(:nth-child(2)) {
  --x: 44px;
}

.pill {
  --x: 0px;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  height: 50px;
  padding-inline: 18px 22px;
  border-radius: var(--radius-pill);
  font: 600 15px/1 var(--font-body);
  white-space: nowrap;
  transform: translateX(var(--x));
  transition: transform 0.45s var(--ease-out), box-shadow 0.45s var(--ease-out);
}

.pill i {
  font-size: 19px;
}

.pill-solid {
  background: var(--pill-a-bg);
  color: var(--pill-a-ink);
  box-shadow: 0 14px 30px -16px rgb(var(--accent-rgb) / 0.7);
}

.pill-soft {
  background: var(--pill-b-bg);
  color: var(--pill-b-ink);
  box-shadow: 0 14px 30px -16px rgb(var(--accent-rgb) / 0.55);
}

.pill:hover {
  transform: translateX(var(--x)) translateY(-3px);
}

.why-visual {
  position: relative;
  display: grid;
  place-items: center;
  width: clamp(260px, 30vw, 400px);
  aspect-ratio: 1;
}

.orbit {
  position: absolute;
  border-radius: var(--radius-pill);
  border: 1.5px dashed var(--line-strong);
}

.orbit-outer {
  inset: -14%;
}

.orbit-inner {
  inset: 4%;
  border-style: solid;
  border-color: var(--line);
}

.why-disc {
  position: relative;
  display: grid;
  place-items: center;
  width: 72%;
  aspect-ratio: 1;
  border-radius: var(--radius-pill);
  background: radial-gradient(circle at 50% 35%, var(--surface-2), var(--surface) 70%);
  box-shadow: 0 40px 90px -40px rgb(var(--accent-rgb) / 0.6);
  transform: translate(calc(var(--px) * 10px), calc(var(--py) * 10px));
  transition: transform 0.6s var(--ease-out);
}

.why-disc::before {
  content: "";
  position: absolute;
  inset: -10px;
  border-radius: inherit;
  background: conic-gradient(from 210deg, var(--accent), var(--accent-2) 45%, transparent 72%);
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 16px), #000 calc(100% - 15px));
  mask: radial-gradient(farthest-side, transparent calc(100% - 16px), #000 calc(100% - 15px));
}

.why-disc img {
  width: 54%;
  height: auto;
}

.bubble {
  position: absolute;
  display: grid;
  place-items: center;
  width: clamp(48px, 5vw, 64px);
  aspect-ratio: 1;
  border-radius: var(--radius-pill);
  background: linear-gradient(140deg, var(--accent), var(--accent-2));
  color: var(--pill-a-ink);
  font-size: clamp(22px, 2.2vw, 28px);
  box-shadow: 0 16px 34px -14px rgb(var(--accent-rgb) / 0.75);
  translate: calc(var(--px) * var(--d) * 36px) calc(var(--py) * var(--d) * 36px);
  transition: translate 0.6s var(--ease-out);
}

.bubble-a {
  top: -6%;
  right: 4%;
}

.bubble-b {
  top: 4%;
  left: 2%;
}

.bubble-c {
  bottom: -4%;
  right: 10%;
}

/* Closing CTA */
.cta-section {
  position: relative;
  overflow: hidden;
  isolation: isolate;
  padding-block: clamp(120px, 16vw, 200px);
  border-top: 1px solid var(--line);
}

.cta-section::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background: radial-gradient(ellipse 42% 38% at 50% 50%, color-mix(in srgb, var(--bg) 72%, transparent), transparent);
}

.cta {
  display: grid;
  justify-items: center;
  gap: 32px;
  text-align: center;
}

/* Footer */
.footer {
  border-top: 1px solid var(--line);
  padding-block: 28px;
  font-size: 14px;
  color: var(--muted);
}

.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.footer-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.footer-brand img {
  width: 28px;
  height: auto;
}

.footer-links {
  display: flex;
  gap: 24px;
}

.footer-links a {
  text-decoration: none;
  transition: color 0.2s;
}

.footer-links a:hover {
  color: var(--text);
}

/* Reveal motion */
@media (prefers-reduced-motion: no-preference) {
  .reveal-up {
    opacity: 0;
    transform: translateY(18px);
    animation: rise 0.9s var(--ease-out) forwards;
    animation-delay: calc(0.15s + var(--i, 0) * 0.12s);
  }

  .reveal {
    opacity: 0;
    transform: translateY(28px);
    transition: opacity 0.9s var(--ease-out), transform 0.9s var(--ease-out);
  }

  .reveal.is-in {
    opacity: 1;
    transform: none;
  }

  .flow .chip {
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.6s var(--ease-out), transform 0.6s var(--ease-out), border-color 0.3s;
    transition-delay: calc(0.35s + var(--i, 0) * 0.09s);
  }

  .flow.is-in .chip {
    opacity: 1;
    transform: none;
  }

  .orbit-outer {
    animation: spin 60s linear infinite;
  }

  .why-disc::before {
    animation: spin 14s linear infinite;
  }

  .bubble {
    animation: float 6s ease-in-out infinite;
    animation-delay: calc(var(--d) * -3s);
  }

  .why .pill {
    opacity: 0;
    transition: opacity 0.7s var(--ease-out), transform 0.9s var(--ease-out), box-shadow 0.45s var(--ease-out);
    transition-delay: calc(0.2s + var(--i) * 0.12s);
  }

  .why-left .pill {
    transform: translateX(calc(var(--x) + 80px)) scale(0.9);
  }

  .why-right .pill {
    transform: translateX(calc(var(--x) - 80px)) scale(0.9);
  }

  .why.is-in .pill {
    opacity: 1;
    transform: translateX(var(--x));
  }

  .why.is-in .pill:hover {
    transform: translateX(var(--x)) translateY(-3px);
    transition-delay: 0s;
  }

  .why-visual {
    opacity: 0;
    transform: scale(0.88);
    transition: opacity 1s var(--ease-out), transform 1.2s var(--ease-out);
  }

  .why.is-in .why-visual {
    opacity: 1;
    transform: none;
  }

  html {
    scroll-behavior: smooth;
  }
}

@keyframes spin {
  to {
    transform: rotate(1turn);
  }
}

@keyframes float {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-10px);
  }
}

@keyframes rise {
  to {
    opacity: 1;
    transform: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .btn,
  .chip,
  .btn i,
  .flow-path {
    transition: none;
  }
}

/* Mobile */
@media (max-width: 767px) {
  .nav-links a:not(.btn) {
    display: none;
  }

  .hero {
    min-height: auto;
    align-items: end;
  }

  .hero .scene {
    height: 62%;
  }

  .hero::after {
    background: linear-gradient(180deg, transparent 30%, var(--bg) 62%);
  }

  .hero-inner {
    padding-top: 48vh;
    padding-bottom: 56px;
  }

  .flow {
    grid-template-columns: 1fr;
    justify-items: center;
    gap: 56px;
  }

  .flow-in,
  .flow-out {
    justify-items: center;
  }

  .flow-in {
    grid-auto-flow: row;
  }

  .footer-inner {
    justify-content: center;
  }

  .why {
    grid-template-columns: 1fr;
    justify-items: center;
    gap: 40px;
  }

  .why-visual {
    order: -1;
    width: min(64vw, 260px);
  }

  .why-col {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 12px;
  }

  .why-col .pill,
  .why-left .pill:not(:nth-child(2)),
  .why-right .pill:not(:nth-child(2)) {
    --x: 0px;
  }

  .why-col .pill {
    height: 44px;
    font-size: 14px;
  }

  .why-title {
    max-width: none;
    text-align: center;
  }
}
