/* Hero visual (handoff 3a; Figma 553:23217 desktop, 553:27671 mobile): glass widgets + blobs.
   Everything animates only opacity and transform. Timings are from the Figma timeline. */

/* ---------- Placement ----------
   .hv is a point at the centre of the widgets. Desktop: 36px below the middle of the intro (Figma: centre 260px
   below the content top, intro 447px tall). Stacked layouts (below 1100px): the middle of the slot. */
.hero-visual { pointer-events: none; user-select: none; }
.hv { position: absolute; left: 50%; top: calc(50% + 36px); width: 0; height: 0; }
@media (max-width: 1099.98px) { .hv { top: 50%; } }

.hv-blobs, .hv-widgets { position: absolute; left: 0; top: 0; }
.hv-blobs { translate: 0 -2.5px; }     /* Figma: blobs centred 2.5px above the widgets */

/* Mobile (Figma 553:27697): widgets 230px wide (×0.6383), blobs ×0.5907, same centre */
@media (max-width: 767.98px) {
  .hv-widgets { scale: 0.6383; }
  .hv-blobs { scale: 0.5907; translate: 0 0; }
}

/* ---------- Blobs (553:23218): 3 ellipses, gradient #E093FF → #588999 at 20%. No blur in Figma. ----------
   Outer element: slow turn (120s, linear). Middle: "breathing" scale. Inner: the ellipse in its Figma rotation. */
.blob { position: absolute; left: 0; top: 0; will-change: transform; }
.blob__shape {
  position: absolute;
  left: calc(var(--w) / -2);
  top: calc(var(--bh) / -2);
  width: var(--w);
  height: var(--bh);
  border-radius: 50%;
  background: linear-gradient(180deg, #e093ff, #588999);
  opacity: 0.2;
  rotate: var(--r);
}
.blob--1 .blob__shape { --w: 482px;   --bh: 344px;   --r: 0deg; }
.blob--2 .blob__shape { --w: 475.6px; --bh: 348.9px; --r: 105.22deg; }   /* Figma −105.22° */
.blob--3 .blob__shape { --w: 480.5px; --bh: 345.3px; --r: -150.37deg; }  /* Figma 150.37° */

@keyframes blob-ccw { to { rotate: -360deg; } }
@keyframes blob-cw  { to { rotate: 360deg; } }
@keyframes breathe-1 { 25% { scale: 1.42 0.704; } 50% { scale: 1 1; } 75% { scale: 0.704 1.42; } }
@keyframes breathe-2 { 25% { scale: 1.52 0.658; } 50% { scale: 1 1; } 75% { scale: 0.658 1.52; } }
@keyframes breathe-3 { 25% { scale: 1.48 0.676; } 50% { scale: 1 1; } 75% { scale: 0.676 1.48; } }

.motion .blob--1 { animation: blob-ccw 120s linear infinite; }
.motion .blob--2 { animation: blob-cw 120s linear infinite; }
.motion .blob--3 { animation: blob-cw 120s linear infinite; }
.motion .blob--1 .blob__scale { animation: breathe-1 20s ease-in-out infinite; }
.motion .blob--2 .blob__scale { animation: breathe-2 30s ease-in-out infinite; }
.motion .blob--3 .blob__scale { animation: breathe-3 24s ease-in-out infinite; }

/* ---------- Widgets: all in the same spot, centred on .hv ---------- */
.widget {
  position: absolute;
  left: -180px;
  top: calc(var(--h) / -2);
  width: 360px;
  height: var(--h);
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 18px 20px 20px;
  overflow: hidden;
  border-radius: 16px;
  font-family: var(--font-widget);
  color: #141416;
  opacity: 0;
  scale: 0.99;
}

/* Glass (handoff 3a): same recipe for every browser; Firefox without backdrop-filter gets a denser fill */
.glass {
  background: rgb(255 255 255 / 0.28);
  -webkit-backdrop-filter: blur(24px) saturate(160%);
  backdrop-filter: blur(24px) saturate(160%);
  box-shadow:
    inset 0 1px 0 rgb(255 255 255 / 0.7),
    inset 0 0 0 1px rgb(255 255 255 / 0.35),
    0 10px 30px rgb(20 20 22 / 0.06);
}
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .glass { background: rgb(255 255 255 / 0.72); }
}

/* Switch (Figma): 0.4s; opacity ease-in-out, scale cubic-bezier(0.4, 0, 0.3, 1).
   In: 0 → 1, 0.99 → 1. Out: 1 → 0, 1 → 1.00625, at the same time as the next one comes in. */
.widget.is-active, .widget.is-leaving {
  transition: opacity 400ms ease-in-out, scale 400ms cubic-bezier(0.4, 0, 0.3, 1);
}
.widget.is-active { opacity: 1; scale: 1; }
.widget.is-leaving { opacity: 0; scale: 1.00625; }

/* ---------- Widget type: Geist / Geist Mono, line height 130%, ink #141416 at the Figma opacities ---------- */
.widget p { margin: 0; }
.t { font-family: var(--font-widget); font-weight: 400; line-height: 1.3; white-space: nowrap; }
.mono { font-family: var(--font-widget-mono); }
.m { font-weight: 500; }
.f11 { font-size: 11px; } .f12 { font-size: 12px; } .f13 { font-size: 13px; } .f14 { font-size: 14px; }
.f15 { font-size: 15px; } .f20 { font-size: 20px; } .f24 { font-size: 24px; } .f30 { font-size: 30px; } .f36 { font-size: 36px; }
.tight { letter-spacing: -0.02em; }   /* −2% */
.tighter { letter-spacing: -0.02em; } /* 0.71%: −0.72px at 36px */
.c45 { color: rgb(20 20 22 / 0.45); } .c50 { color: rgb(20 20 22 / 0.5); } .c55 { color: rgb(20 20 22 / 0.55); }
.c60 { color: rgb(20 20 22 / 0.6); } .c70 { color: rgb(20 20 22 / 0.7); } .c80 { color: rgb(20 20 22 / 0.8); }
.c87 { color: rgb(20 20 22 / 0.87); } .c90 { color: rgb(20 20 22 / 0.9); } .c100 { color: #141416; }
.cw50 { color: rgb(255 255 255 / 0.5); } .cw55 { color: rgb(255 255 255 / 0.55); } .cw60 { color: rgb(255 255 255 / 0.6); }
.cw95 { color: rgb(255 255 255 / 0.95); } .cw100 { color: #fff; }
.pos { color: #2f8a5c; } .neg { color: #c25440; }

/* ---------- Widget layout ---------- */
.w-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.w-row--end { align-items: flex-end; }
.w-col { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; }
.w-list { display: flex; flex-direction: column; gap: 12px; }
.w-list--10 { gap: 10px; }
.w-list--8 { gap: 8px; }
.w-name { display: flex; align-items: center; gap: 8px; }
.w-name--6 { gap: 6px; }
.w-key { display: block; width: 8px; height: 8px; border-radius: 2px; flex: none; }
.w-divider { width: 100%; height: 1px; margin: 0; border: 0; background: rgb(20 20 22 / 0.08); }
.w-gauge, .w-plot, .w-chart, .w-card { position: relative; flex: none; width: 320px; }
:is(.w-gauge, .w-plot, .w-chart, .w-card) > .t { position: absolute; }
.w-gauge { height: 160px; }
.w-stats { display: flex; }
.w-stats > p { flex: 1; display: flex; flex-direction: column; align-items: flex-start; gap: 2px; }
.w-plot svg { display: block; }
.w-bars--savings { position: absolute; left: 0; top: 20px; }

/* Net volume */
.w-period { display: flex; align-items: center; gap: 4px; height: 26px; padding: 0 10px; border: 1px solid rgb(20 20 22 / 0.12); border-radius: 8px; }
.w-value { display: flex; align-items: baseline; gap: 10px; }
.w-chart { height: 150px; }
.w-chart__svg { position: absolute; left: 0; top: 0; overflow: visible; }
.nv-tip {
  position: absolute;
  left: 51.74px;
  top: 4.09px;
  width: 98px;
  height: 47px;
  border-radius: 8px;
  background: #141416;
}
.nv-tip .t { position: absolute; left: 10px; }
.nv-tip__date { top: 7px; }
.nv-tip__amount { top: 23px; }
.w-legend { display: flex; align-items: center; gap: 16px; }
.w-legend__item { display: flex; align-items: center; gap: 6px; }

/* Team card */
.w-card { height: 172px; overflow: hidden; border-radius: 14px; background: #141416; }
.w-card__glow { position: absolute; left: 170px; top: -90px; width: 220px; height: 220px; border-radius: 50%; background: rgb(142 124 216 / 0.55); filter: blur(60px); }
.w-card__logo { position: absolute; left: 266px; top: 134px; }
.w-limit { display: flex; gap: 2px; }
.w-limit i { display: block; height: 8px; border-radius: 2px; flex: none; }

/* Transfer review */
.w-recipient { display: flex; align-items: center; gap: 12px; }
.w-avatar { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 20px; background: rgb(142 124 216 / 0.25); flex: none; }
.w-amounts { border: 1px solid rgb(20 20 22 / 0.1); border-radius: 12px; }
.w-amounts .w-row { padding: 12px 14px; }
.w-amounts .w-row + .w-row { border-top: 1px solid rgb(20 20 22 / 0.1); }
.w-button { display: flex; justify-content: center; padding: 11px 16px; border-radius: 10px; background: #141416; }

/* Savings */
.w-apy { padding: 3px 8px; border-radius: 6px; background: rgb(212 240 106 / 0.7); }
.w-label { padding: 2px 6px; border-radius: 5px; background: #141416; }
.w-toggle { position: relative; display: block; width: 34px; height: 20px; border-radius: 10px; background: #141416; flex: none; }
.w-toggle::after { content: ""; position: absolute; left: 17px; top: 3px; width: 14px; height: 14px; border-radius: 50%; background: #d4f06a; }

/* ---------- Entrances inside a widget (Figma keyframes) ----------
   --d is the start, counted from the moment the widget starts to fade in. The end state is the element's
   normal state, so with reduced motion (no animations) everything simply shows. */
@keyframes in-fade { from { opacity: 0; } }
@keyframes in-rise { from { translate: 0 2.45px; } }
@keyframes in-rise2 { from { translate: 0 1.592px; } }
@keyframes in-bar { from { scale: 1 0.32; } }
@keyframes in-barx { from { scale: 0.524 1; } }
@keyframes in-card { from { rotate: -0.48deg; } }
@keyframes in-needle { from { rotate: -21.76deg; } }
@keyframes in-grow { from { scale: 1 0.88; } }
@keyframes pulse { 0%, 100% { scale: 1; } 50% { scale: 1.00625; } }
@keyframes pulse2 { 0%, 100% { scale: 1; } 50% { scale: 1.02; } }

:is(.a-bar, .a-needle, .a-grow) { transform-box: view-box; }
.a-bar { transform-box: fill-box; transform-origin: 50% 100%; }
.a-barx { transform-origin: 0 50%; }
.a-needle { transform-origin: 160px 150px; }  /* the gauge centre */
.a-grow { transform-origin: 160px 120px; }    /* the chart's bottom edge */

.is-running :is(.is-active, .is-leaving) {
  --ease: cubic-bezier(0.4, 0, 0.3, 1);
}
.is-running :is(.is-active, .is-leaving) .a-rise {
  animation: in-fade 0.621s var(--ease) var(--d) both, in-rise 0.776s var(--ease) var(--d) both;
}
.is-running :is(.is-active, .is-leaving) .a-rise2 {
  animation: in-fade 0.838s ease-in-out var(--d) both, in-rise2 1.048s ease-in-out var(--d) both;
}
.is-running :is(.is-active, .is-leaving) .a-card {
  animation: in-fade 0.838s ease-in-out 0s both, in-rise2 1.048s ease-in-out 0s both, in-card 1.677s ease-in-out 0s both;
}
.is-running :is(.is-active, .is-leaving) .a-bar { animation: in-bar 1.294s var(--ease) var(--d) both; }
.is-running :is(.is-active, .is-leaving) .a-barx { animation: in-barx 1.746s ease-in-out var(--d) both; }
.is-running :is(.is-active, .is-leaving) .a-needle { animation: in-needle 1.863s var(--ease) 0s both; }
.is-running :is(.is-active, .is-leaving) .a-grow { animation: in-grow 1.15s cubic-bezier(0, 0, 0.58, 1) var(--d) both; }
.is-running :is(.is-active, .is-leaving) .a-pulse { animation: pulse 0.828s var(--ease) 2.795s both; }
.is-running :is(.is-active, .is-leaving) .a-pulse2 { animation: pulse2 1.449s var(--ease) 2.07s both; }

/* Paused (hero off screen or tab hidden): everything stops where it is */
.hero-visual.is-paused, .hero-visual.is-paused * { animation-play-state: paused !important; }

/* Reduced motion: widget 1 only, no blobs motion, no switching (the script does not run the timer) */
@media (prefers-reduced-motion: reduce) {
  .blob, .blob__scale { animation: none !important; }
}
