/* ============================================================
   Waliti — token layer (from the icon package "Design Tokens").
   The package is the source of truth for color, type, spacing,
   radius, elevation and motion.
   ============================================================ */
:root {
  /* Brand */
  --primary: #5b4be0;
  --primary-strong: #4a3bc4;
  --accent: #9b5bf0;
  --gradient-brand: linear-gradient(135deg, #5b4be0, #9b5bf0);

  /* Indigo / violet ramps (selected stops) */
  --indigo-50: #efedfd;
  --indigo-100: #e0dbfb;
  --violet-50: #f4ebfe;

  /* Neutrals / ink */
  --ink: #15121f;
  --ink2: #5b5668;
  --ink3: #928ca3;
  --surface: #fafafc;
  --card: #ffffff;
  --neutral-50: #f4f3f7;
  --line: #e7e4ef;
  --line2: #f0eef6;

  /* Semantic money colors */
  --income: #13966b;
  --income-text: #0b6b4c;
  --income-soft: #e4f6ef;
  --expense: #e04a4a;
  --expense-text: #c0322f;
  --expense-soft: #fdebeb;
  --warning-text: #8a5a12;
  --warning-soft: #fbf0df;

  /* Type */
  --font: "Plus Jakarta Sans", system-ui, -apple-system, sans-serif;
  --mono: "Spline Sans Mono", ui-monospace, monospace;

  /* Radius */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --radius-pill: 999px;

  /* Elevation (indigo-tinted) */
  --elev-1: 0 1px 2px rgba(21, 18, 31, 0.06);
  --elev-2: 0 2px 8px rgba(21, 18, 31, 0.08);
  --elev-3: 0 10px 28px -10px rgba(21, 18, 31, 0.18);
  --elev-4: 0 22px 50px -22px rgba(91, 75, 224, 0.5);

  /* Motion */
  --dur-1: 120ms;
  --dur-2: 180ms;
  --dur-3: 240ms;
  --dur-4: 320ms;
  --ease-standard: cubic-bezier(0.2, 0.7, 0.3, 1);
  --ease-spring: cubic-bezier(0.34, 1.4, 0.5, 1);

  --max: 1120px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background: var(--surface);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0);
  white-space: nowrap; border: 0;
}

/* ---------- Atmosphere (subtle light brand wash) ---------- */
.aurora {
  position: fixed;
  inset: 0 0 auto 0;
  height: 72vh;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(42% 52% at 18% 8%, rgba(91, 75, 224, 0.08), transparent 70%),
    radial-gradient(40% 48% at 88% 0%, rgba(155, 91, 240, 0.07), transparent 70%);
}

/* ---------- Header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(250, 250, 252, 0.82);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}

.header-in {
  max-width: var(--max);
  margin: 0 auto;
  padding: 14px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  color: var(--ink);
  text-decoration: none;
  font-weight: 800;
  font-size: 19px;
  letter-spacing: -0.03em;
}
.brand img { display: block; }
.brand-sm { font-size: 16px; }
/* Brand signature: the possessive "i" in the accent violet. */
.wm-i { color: var(--accent); }

main {
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 32px;
}

/* ---------- Hero ---------- */
.hero {
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  align-items: center;
  gap: clamp(32px, 5vw, 72px);
  padding: clamp(44px, 7vw, 84px) 0 clamp(48px, 7vw, 88px);
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 24px;
  padding: 7px 13px;
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--primary);
  background: var(--indigo-50);
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
}
.badge-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--income);
  box-shadow: 0 0 0 0 rgba(19, 150, 107, 0.5);
  animation: pulse 2.4s ease-out infinite;
}
@keyframes pulse {
  0%   { box-shadow: 0 0 0 0 rgba(19, 150, 107, 0.45); }
  70%  { box-shadow: 0 0 0 7px rgba(19, 150, 107, 0); }
  100% { box-shadow: 0 0 0 0 rgba(19, 150, 107, 0); }
}

.hero h1 {
  margin: 0 0 20px;
  font-size: clamp(2.4rem, 5.4vw, 3.6rem);
  line-height: 1.04;
  font-weight: 800;
  letter-spacing: -0.04em;
  text-wrap: balance;
}
.hero h1 em { font-style: normal; color: var(--primary); }

.subhead {
  max-width: 32rem;
  margin: 0 0 30px;
  color: var(--ink2);
  font-size: 17px;
  line-height: 1.6;
  text-wrap: pretty;
}

/* ---------- Subscribe form ---------- */
.subscribe { max-width: 32rem; }

.field {
  display: flex;
  gap: 8px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 7px;
  box-shadow: var(--elev-1);
  transition: border-color var(--dur-2) var(--ease-standard),
    box-shadow var(--dur-2) var(--ease-standard);
}
.field:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(91, 75, 224, 0.14);
}

.field input[type="email"] {
  flex: 1;
  min-width: 0;
  background: transparent;
  border: 0;
  outline: none;
  color: var(--ink);
  font-family: var(--font);
  font-size: 15px;
  padding: 12px 14px;
}
.field input::placeholder { color: var(--ink2); }

.hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }

button[type="submit"] {
  position: relative;
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 0;
  border-radius: var(--radius-md);
  padding: 12px 22px;
  font-family: var(--font);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.01em;
  color: #fff;
  background: var(--primary);
  cursor: pointer;
  overflow: hidden;
  transition: background var(--dur-2) var(--ease-standard),
    transform var(--dur-2) var(--ease-spring), box-shadow var(--dur-2) var(--ease-standard);
}
button[type="submit"]:hover {
  background: var(--primary-strong);
  transform: translateY(-1px);
  box-shadow: var(--elev-2);
}
button[type="submit"]:focus-visible { outline: 2px solid var(--primary); outline-offset: 3px; }
button[type="submit"]:active { transform: translateY(0); }
button[type="submit"][disabled] { opacity: 0.7; cursor: progress; }

.btn-spinner {
  display: none;
  width: 15px; height: 15px;
  border: 2px solid rgba(255, 255, 255, 0.5);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
/* Spinner shows only during an actual submission, not while waiting on the
   human-check (that state keeps the label and a neutral hint). */
button.is-submitting .btn-spinner { display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }

.cf-turnstile { margin: 16px 0 0; display: flex; }

.status {
  min-height: 1.4em;
  margin: 14px 0 4px;
  font-size: 14px;
  font-weight: 600;
}
.status.ok { color: var(--income-text); }
.status.err { color: var(--expense-text); }
.status.info { color: var(--ink2); }

.reassure { margin: 4px 0 0; color: var(--ink2); font-size: 13px; }

/* ---------- Product peek (the hero balance card) ---------- */
.peek { display: flex; justify-content: center; }

.peek-card {
  width: 100%;
  max-width: 380px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  padding: 24px;
  box-shadow: var(--elev-4); /* brand glow — reserved for the hero card */
  animation: floaty 7s ease-in-out infinite alternate;
}
@keyframes floaty {
  from { transform: translateY(-5px); }
  to   { transform: translateY(5px); }
}

.peek-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 18px;
}
.peek-label { display: block; color: var(--ink2); font-size: 13px; margin-bottom: 5px; }
.peek-balance {
  /* Hero number reads cleaner in the display face; mono is reserved for the
     smaller row amounts. Tabular figures keep it aligned. */
  font-family: var(--font);
  font-variant-numeric: tabular-nums;
  font-weight: 800;
  font-size: 32px;
  letter-spacing: -0.03em;
  color: var(--ink);
}
.peek-chip {
  align-self: center;
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  color: var(--income-text);
  background: var(--income-soft);
  border-radius: var(--radius-pill);
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.spark { width: 100%; height: 84px; display: block; margin-bottom: 14px; }
.spark-line {
  stroke-dasharray: 1;
  stroke-dashoffset: 0;
  filter: drop-shadow(0 6px 12px rgba(91, 75, 224, 0.25));
}
.pre-reveal .spark-line { stroke-dashoffset: 1; }
.pre-reveal .spark-area { opacity: 0; }
.pre-reveal .spark-dot { opacity: 0; }
.peek.in .spark-line { animation: draw 1.4s var(--ease-standard) 0.3s forwards; }
.peek.in .spark-area { animation: fade 0.7s ease-out 1.1s forwards; }
.peek.in .spark-dot  { animation: fade 0.4s ease-out 1.6s forwards; }
@keyframes draw { to { stroke-dashoffset: 0; } }
@keyframes fade { to { opacity: 1; } }

.peek-tx { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.peek-tx li {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 11px 4px;
  border-top: 1px solid var(--line2);
}
.pre-reveal .peek-tx li { opacity: 0; transform: translateY(8px); }
.peek.in .peek-tx li {
  animation: rise var(--dur-4) var(--ease-standard) forwards;
  animation-delay: calc(0.85s + var(--i) * 0.12s);
}
@keyframes rise { to { opacity: 1; transform: none; } }

.tx-ic {
  display: grid; place-items: center;
  width: 32px; height: 32px;
  border-radius: 10px;
  font-size: 0.95rem;
}
.tx-ic.income { color: var(--income-text); background: var(--income-soft); }
.tx-ic.expense { color: var(--expense-text); background: var(--expense-soft); }
.tx-name { color: var(--ink); font-size: 14.5px; font-weight: 500; }
.tx-amt {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  font-size: 14px;
}
.tx-amt.income { color: var(--income-text); }
.tx-amt.expense { color: var(--ink2); }

/* ---------- Features (bento) ---------- */
.features {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  padding: clamp(8px, 3vw, 24px) 0 clamp(56px, 8vw, 88px);
}

.cell {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 26px 24px;
  box-shadow: var(--elev-1);
  transition: transform var(--dur-3) var(--ease-standard),
    border-color var(--dur-3) var(--ease-standard),
    box-shadow var(--dur-3) var(--ease-standard);
}
.cell:hover {
  transform: translateY(-4px);
  border-color: var(--indigo-100);
  box-shadow: var(--elev-3);
}
.cell-lead {
  grid-column: span 2;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  min-height: 196px;
  background:
    radial-gradient(120% 130% at 0% 0%, rgba(91, 75, 224, 0.07), transparent 55%),
    var(--card);
}
.cell-lead h3 { font-size: 24px; letter-spacing: -0.03em; }
.cell-lead p { max-width: 42ch; }

.cell-ic {
  display: inline-grid;
  place-items: center;
  width: 44px; height: 44px;
  margin-bottom: 16px;
  border-radius: var(--radius-md);
  color: var(--primary);
  background: var(--indigo-50);
}
.cell-ic svg { width: 24px; height: 24px; }

.cell h3 {
  margin: 0 0 8px;
  font-weight: 700;
  font-size: 20px;
  letter-spacing: -0.02em;
  line-height: 1.25;
}
.cell p { margin: 0; color: var(--ink2); font-size: 15px; line-height: 1.55; }

/* ---------- AI / intelligence section ---------- */
.ai {
  display: grid;
  grid-template-columns: 0.95fr 1.05fr;
  align-items: center;
  gap: clamp(32px, 5vw, 72px);
  padding: clamp(8px, 3vw, 28px) 0 clamp(64px, 9vw, 100px);
}

.ai-visual { display: flex; justify-content: center; }
.ai-card {
  width: 100%;
  max-width: 400px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  padding: 22px;
  box-shadow: var(--elev-3);
}

/* Insight card — reads like Waliti's own insights surface, not a chatbot. */
.insight-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.insight-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--primary);
}
.insight-eyebrow svg { width: 15px; height: 15px; }
.insight-when { font-size: 12.5px; color: var(--ink2); }

.insight-hero {
  padding: 16px;
  background: var(--neutral-50);
  border-radius: var(--radius-md);
  margin-bottom: 16px;
}
.insight-label { display: block; font-size: 12.5px; color: var(--ink2); margin-bottom: 4px; }
.insight-value {
  display: block;
  font-family: var(--font);
  font-weight: 800;
  font-size: 30px;
  letter-spacing: -0.03em;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.insight-sub { margin: 7px 0 0; font-size: 13px; line-height: 1.45; color: var(--ink2); }

.insight-flags { list-style: none; margin: 0 0 4px; padding: 0; display: grid; gap: 11px; }
.insight-flags li {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 11px;
}
.flag-ic {
  display: grid; place-items: center;
  width: 26px; height: 26px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 700;
}
.flag-ic.expense { color: var(--expense-text); background: var(--expense-soft); }
.flag-ic.warn { color: var(--warning-text); background: var(--warning-soft); }
.flag-text { font-size: 13.5px; color: var(--ink); }
.flag-text strong { font-weight: 700; }
.flag-tag {
  font-size: 12px;
  font-weight: 700;
  color: var(--expense-text);
  font-variant-numeric: tabular-nums;
}

.insight-foot {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 16px 0 0;
  padding-top: 14px;
  border-top: 1px solid var(--line2);
  font-size: 12px;
  color: var(--ink2);
}
.insight-foot svg { width: 14px; height: 14px; flex: none; }

.ai-health { border-top: 1px solid var(--line2); margin-top: 16px; padding-top: 16px; }
.ai-health-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 9px;
}
.ai-health-label { color: var(--ink2); font-size: 13px; }
.ai-health-score {
  font-weight: 700;
  font-size: 14px;
  color: var(--income-text);
  font-variant-numeric: tabular-nums;
}
.ai-meter {
  height: 8px;
  border-radius: var(--radius-pill);
  background: var(--line);
  overflow: hidden;
}
.ai-meter-fill {
  display: block;
  height: 100%;
  border-radius: var(--radius-pill);
  background: var(--income);
  transform: scaleX(var(--v));
  transform-origin: left;
}

.ai-copy h2 {
  margin: 0 0 12px;
  font-size: clamp(1.7rem, 3.4vw, 2.3rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.08;
  text-wrap: balance;
}
.ai-lead { margin: 0 0 26px; color: var(--ink2); font-size: 17px; max-width: 44ch; }
.ai-points { list-style: none; margin: 0; padding: 0; display: grid; gap: 20px; }
.ai-points li {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 16px;
  align-items: start;
}
.ai-ic {
  display: inline-grid;
  place-items: center;
  width: 40px; height: 40px;
  border-radius: var(--radius-md);
  color: var(--primary);
  background: var(--indigo-50);
}
.ai-ic svg { width: 20px; height: 20px; }
.ai-points h3 { margin: 0 0 4px; font-size: 16px; font-weight: 700; letter-spacing: -0.01em; }
.ai-points p { margin: 0; color: var(--ink2); font-size: 14.5px; line-height: 1.55; }

.ai-privacy {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  margin: 26px 0 0;
  padding-top: 22px;
  border-top: 1px solid var(--line);
  color: var(--ink2);
  font-size: 13.5px;
  line-height: 1.5;
  max-width: 46ch;
}
.ai-privacy svg { width: 16px; height: 16px; flex: none; color: var(--primary); margin-top: 1px; }

/* AI visual motion — visible by default, animated only under the JS guard. */
.pre-reveal .insight-flags li { opacity: 0; transform: translateY(8px); }
.ai-visual.in .insight-flags li {
  animation: rise var(--dur-4) var(--ease-standard) both;
  animation-delay: calc(0.35s + var(--i) * 0.12s);
}
.pre-reveal .ai-meter-fill { transform: scaleX(0); }
.ai-visual.in .ai-meter-fill { animation: meter 0.9s var(--ease-standard) 0.55s both; }
@keyframes meter { from { transform: scaleX(0); } to { transform: scaleX(var(--v)); } }

/* ---------- Footer ---------- */
.site-footer {
  max-width: var(--max);
  margin: 0 auto;
  padding: 28px 32px 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  color: var(--ink2);
  font-size: 13.5px;
  border-top: 1px solid var(--line);
}
.foot-desc { margin: 6px 0 0; color: var(--ink2); }
.foot-meta { display: flex; align-items: center; gap: 18px; }
.foot-meta a {
  color: var(--ink2);
  text-decoration: none;
  transition: color var(--dur-2) var(--ease-standard);
}
.foot-meta a:hover { color: var(--primary); }

/* ---------- Reveal choreography ----------
   Default = visible (failsafe). Hidden start state applies only while the
   pre-reveal guard is on the root; JS adds it pre-paint and removes it if it
   never initialises. Content is never gated on JS firing. */
.pre-reveal .reveal {
  opacity: 0;
  transform: translateY(14px);
}
.pre-reveal .reveal.in {
  opacity: 1;
  transform: none;
  transition:
    opacity var(--dur-4) var(--ease-standard),
    transform var(--dur-4) var(--ease-standard);
  transition-delay: calc((var(--reveal, 0) - 1) * 70ms);
}

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .hero {
    grid-template-columns: 1fr;
    gap: 40px;
    text-align: center;
  }
  .hero-copy .badge,
  .subhead,
  .subscribe { margin-left: auto; margin-right: auto; }
  /* Lead with the headline + email form; the balance card follows as the
     reward, so the primary action is reachable on first paint. */
  .hero { gap: 32px; }
  .peek-card { animation: none; }
  .features { grid-template-columns: repeat(2, 1fr); }
  .cell-lead { grid-column: span 2; }
  /* Stack the AI section, copy first then the visual. */
  .ai { grid-template-columns: 1fr; gap: 36px; }
  .ai-visual { order: 2; }
}

@media (max-width: 560px) {
  .header-in { padding: 14px 20px; }
  main { padding: 0 20px; }
  .features { grid-template-columns: 1fr; }
  .cell-lead { grid-column: span 1; min-height: 0; }
  .field { flex-direction: column; }
  button[type="submit"] { width: 100%; justify-content: center; }
  .cf-turnstile { justify-content: center; }
}

@media (prefers-reduced-motion: reduce) {
  .peek-card, .badge-dot { animation: none; }
  html { scroll-behavior: auto; }
  .pre-reveal .reveal { opacity: 1; transform: none; transition: none; }
  .pre-reveal .peek-tx li { opacity: 1; transform: none; }
  .pre-reveal .spark-area,
  .pre-reveal .spark-dot { opacity: 1; }
  .pre-reveal .spark-line { stroke-dashoffset: 0; }
  .peek .spark-line { stroke-dashoffset: 0; }
  .pre-reveal .insight-flags li { opacity: 1; transform: none; }
  .pre-reveal .ai-meter-fill { transform: scaleX(var(--v)); }
  * { transition-duration: 0.01ms !important; }
}
