﻿/* ==========================================================================
   Visual enhancements: illustrations, motion, hover micro-interactions.
   Loaded last; additive only. All motion is transform/opacity and is disabled
   by the global prefers-reduced-motion rule in base.css.
   ========================================================================== */

/* ---- Illustration palette (theme aware) ------------------------------------- */
.art { display: block; width: 100%; height: auto; overflow: visible; }
.a-p { fill: var(--primary); }
.a-p-ink { fill: var(--primary-ink); }
.a-ps { fill: var(--primary-soft); }
.a-ps2 { fill: color-mix(in srgb, var(--primary) 38%, var(--surface)); }
.a-s { fill: var(--surface); }
.a-t { fill: var(--text); }
.a-blue { fill: var(--c1); }
.a-g { fill: var(--success); }
.a-gs { fill: var(--success-soft); }
.a-gtext { fill: var(--success); font: 800 13px var(--font); }
.a-coin { fill: var(--c4); }
.a-coin-d { fill: color-mix(in srgb, var(--c4) 70%, #000); }
.a-coin-ring { fill: none; stroke: color-mix(in srgb, var(--c4) 65%, #000); stroke-width: 3; }
.a-line-b { stroke: var(--border); stroke-width: 1.5; }
.a-grid { stroke: var(--border); stroke-width: 1.5; fill: none; }
.a-ink { fill: none; stroke: var(--text); stroke-width: 3.2; stroke-linecap: round; stroke-linejoin: round; }
.a-stem { fill: none; stroke: var(--success); stroke-width: 4; stroke-linecap: round; }
.a-check { fill: none; stroke: var(--surface); stroke-width: 6; stroke-linecap: round; stroke-linejoin: round; }
.a-check.sm { stroke-width: 3.2; }
.a-lock-sh { fill: none; stroke: var(--primary); stroke-width: 9; stroke-linecap: round; }
.art-plan .w { fill: var(--surface); }

/* ---- Illustration animation ---------------------------------------------------- */
@keyframes bar-grow { from { transform: scaleY(0); } to { transform: scaleY(1); } }
@keyframes sway { 0%, 100% { transform: rotate(-3deg); } 50% { transform: rotate(3deg); } }
@keyframes twinkle { 0%, 100% { opacity: .35; transform: scale(.8); } 50% { opacity: 1; transform: scale(1.15); } }
.a-bar {
  transform-box: fill-box;
  transform-origin: 50% 100%;
  animation: bar-grow .9s var(--ease) both;
  animation-delay: calc(var(--i, 0) * 80ms + .25s);
}
.a-draw { stroke-dasharray: 1 1; stroke-dashoffset: 1; animation: draw-line 1.5s var(--ease) .9s forwards; }
.a-float { animation: float 6s ease-in-out infinite; }
.a-float2 { animation: float 7.5s ease-in-out -2s infinite; }
.a-sway { transform-box: fill-box; transform-origin: 50% 100%; animation: sway 5s ease-in-out infinite; }
.a-twinkle { transform-box: fill-box; transform-origin: center; animation: twinkle 3.2s ease-in-out infinite; }
@keyframes draw-line { to { stroke-dashoffset: 0; } }

/* Charts */
.donut-sweep { stroke-dasharray: 1 1; stroke-dashoffset: 1; animation: draw-line 1s var(--ease) both; animation-delay: calc(var(--i, 0) * 110ms + .1s); }
.bar-anim { transform-box: fill-box; animation: bar-grow .8s var(--ease) both; animation-delay: calc(var(--i, 0) * 70ms + .1s); }
.bar-anim.up { transform-origin: 50% 100%; }
.bar-anim.down { transform-origin: 50% 0; }

/* ---- Scroll reveal ------------------------------------------------------------ */
.reveal {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity .7s var(--ease), transform .7s var(--ease);
  transition-delay: calc(var(--i, 0) * 70ms);
}
.reveal.is-in { opacity: 1; transform: none; }

/* ---- Route progress bar ------------------------------------------------------------ */
.route-bar {
  position: fixed; top: 0; left: 0; right: 0;
  height: 3px;
  z-index: 400;
  background: linear-gradient(90deg, var(--primary), var(--primary-ink));
  transform-origin: 0 50%;
  transform: scaleX(0);
  opacity: 0;
  pointer-events: none;
}
.route-bar.loading { opacity: 1; transform: scaleX(.72); transition: transform 1.8s cubic-bezier(.1, .7, .2, 1), opacity .15s; }
.route-bar.done { opacity: 0; transform: scaleX(1); transition: transform .2s ease-out, opacity .4s .2s; }

/* ---- Hover micro-interactions ----------------------------------------------------- */
.btn-primary { overflow: hidden; }
.btn-primary::before {
  content: "";
  position: absolute; inset: 0;
  background: linear-gradient(105deg, transparent 35%, rgba(255, 255, 255, .38) 50%, transparent 65%);
  transform: translateX(-130%);
  transition: transform .75s var(--ease);
  pointer-events: none;
}
.btn-primary:hover::before { transform: translateX(130%); }
.btn .icon { transition: transform var(--dur) var(--ease); }
.btn:hover .icon { transform: translateX(1px) scale(1.08); }

.nav-item .icon { transition: transform var(--dur) var(--ease), color var(--dur); }
.nav-item:hover .icon { transform: scale(1.12) rotate(-4deg); color: var(--primary-ink); }
.bn-item .icon { transition: transform var(--dur) var(--ease); }

.stat-ico { transition: transform .35s var(--ease); }
.stat:hover .stat-ico { transform: scale(1.1) rotate(-6deg); }
.list-item .avatar-icon { transition: transform var(--dur) var(--ease); }
.list-item:hover .avatar-icon { transform: scale(1.08); }
.plan-ico { transition: transform .35s var(--ease); }
.card-hover:hover .plan-ico { transform: scale(1.08) rotate(-5deg); }
.feature { transition: transform var(--dur) var(--ease), box-shadow var(--dur), border-color var(--dur); }
.hero-btn .icon { transition: transform .3s var(--ease); }
.hero-btn:hover .icon { transform: translateY(-2px) scale(1.12); }
.inv-card .inv-spark svg { transition: transform .35s var(--ease); }
.inv-card:hover .inv-spark svg { transform: scale(1.08); }
.chip { transition: all var(--dur) var(--ease), transform .15s; }
.chip:active { transform: scale(.96); }
.seg button:active { transform: scale(.96); }
.theme-swatch-pop { animation: pop .3s var(--ease); }

/* Smoother page transitions (extends the existing fade-up). */
.view.enter > *, .auth-view.enter > * { will-change: transform, opacity; }
.view.enter > * { animation-duration: .55s; }

/* ---- Dashboard ---------------------------------------------------------------------- */
.hero-art {
  position: absolute;
  right: 18px; top: 78px;
  width: min(34%, 150px);
  color: var(--hero-fg);
  opacity: .2;
  z-index: -1;
  pointer-events: none;
}
.hero-art-svg { display: block; width: 100%; height: auto; }
.hero-art-svg path:last-child { stroke-dasharray: 1; }
.stat { position: relative; }
.stat-spark { position: absolute; top: 14px; right: 14px; line-height: 0; opacity: .95; }
.stat-spark svg { display: block; }

/* ---- Landing --------------------------------------------------------------------------- */
.hero { overflow: clip; }
/* Hero: investment-growth photo with a compact balance card overlapping it. */
.hero-visual { position: relative; padding: 0; }
.hero-visual .hero-photo { max-width: 540px; margin-inline: auto; }
.hero-visual .preview-card {
  position: relative;
  z-index: 2;
  width: auto;
  max-width: 430px;
  margin: -52px auto 0;
  padding: 16px 18px;
  animation: none;
}
.hero-visual .pv-amount { font-size: clamp(1.7rem, 1.4rem + 1.2vw, 2.2rem); margin: 4px 0 6px; }
.pv-chart { margin-top: 10px; line-height: 0; }
.pv-chart svg { display: block; width: 100%; height: auto; }
.hero-visual .float-chip { z-index: 3; }
.hero-visual .fc-2 { left: -26px; top: 36px; right: auto; }
@media (max-width: 639px) { .hero-visual .hero-photo { aspect-ratio: 4 / 3 !important; } }
@media (min-width: 640px) and (max-width: 959px) { .hero-visual .hero-photo { aspect-ratio: 16 / 10 !important; max-width: 100%; } }
@media (min-width: 960px) {
  .hero-visual .hero-photo { margin-left: auto; margin-right: 0; }
  .hero-visual .preview-card {
    position: absolute;
    left: -9%;
    bottom: -28px;
    width: min(60%, 310px);
    max-width: none;
    margin: 0;
    animation: float-soft 9s ease-in-out infinite;
  }
}

/* Financial security: bank cut-out on a soft glow. */
.bank-stage { position: relative; width: 100%; max-width: 520px; margin-inline: auto; padding: 22px 12px 30px; display: grid; place-items: center; }
.bank-backdrop {
  position: absolute; inset: 4% 2% 8%;
  border-radius: 50%;
  background: radial-gradient(closest-side, var(--primary-soft) 55%, transparent 100%);
  pointer-events: none;
}
.bank-fig { position: relative; width: min(100%, 440px); }
.bank-chip {
  position: absolute;
  z-index: 2;
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px;
  border-radius: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  font-weight: 700; font-size: .82rem; line-height: 1.3;
}
.bank-chip small { color: var(--text-muted); font-weight: 600; }
.bank-chip .icon { color: var(--success); }
.bc-1 { left: 0; top: 8%; animation: float 7s ease-in-out infinite; }
.bc-2 { right: 0; bottom: 10%; animation: float 8s ease-in-out -3s infinite; }
@media (max-width: 560px) { .bank-chip { display: none; } }

.how-card { position: relative; }
.step-art { position: relative; display: flex; align-items: flex-end; height: 92px; margin-bottom: 14px; color: var(--primary-ink); }
.step-art .art-step { width: auto; height: 100%; }
.step-art .step-big { position: absolute; top: 0; right: 0; margin: 0; width: 38px; height: 38px; border-radius: 12px; font-size: 1rem; }
.how-card:hover .art-step { transform: translateY(-3px); }
.art-step { transition: transform .4s var(--ease); }

.split { display: grid; gap: 36px; align-items: center; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 900px) { .split { grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr); gap: 56px; } }
.benefit-list { display: flex; flex-direction: column; gap: 16px; margin-top: 22px; }
.benefit-list li, .benefit-card { display: flex; gap: 14px; align-items: flex-start; }
.benefit-list .plan-ico, .benefit-card .plan-ico { width: 44px; height: 44px; border-radius: 14px; flex: none; }
.benefit-list strong, .benefit-card strong { display: block; font-size: 1rem; }
.benefit-list span.muted, .benefit-card span.muted { font-size: .92rem; }

/* Text-only split: three benefit cards beside the intro copy (stacked on phones, a row on tablets). */
.benefit-cards { display: grid; gap: 14px; grid-template-columns: minmax(0, 1fr); width: 100%; max-width: 560px; margin-inline: auto; }
.benefit-card strong { margin-bottom: 2px; }
.benefit-card span.muted { text-wrap: pretty; }
.split-copy h2 { text-wrap: balance; }
.split-copy p:not(.eyebrow) { max-width: 62ch; text-wrap: pretty; }
@media (min-width: 600px) and (max-width: 899px) {
  .benefit-cards { grid-template-columns: repeat(3, minmax(0, 1fr)); max-width: none; }
  .benefit-card { flex-direction: column; gap: 12px; }
}
/* Desktop: a narrower copy column (two-line headline) and cards that run to the container edge. */
@media (min-width: 900px) {
  .split-text { grid-template-columns: minmax(0, .8fr) minmax(0, 1.2fr); }
  .split-text .split-copy { max-width: 26rem; }
  .split-text .benefit-cards { max-width: none; }
}

/* ---- Plan header art ---------------------------------------------------------------------- */
.plan-art {
  position: relative;
  margin: -20px -20px 6px;
  height: 116px;
  display: grid; place-items: center;
  color: var(--pc, var(--primary));
  background:
    radial-gradient(120px 80px at 20% 20%, color-mix(in srgb, var(--pc, var(--primary)) 22%, transparent), transparent 70%),
    linear-gradient(135deg, color-mix(in srgb, var(--pc, var(--primary)) 16%, var(--surface)), color-mix(in srgb, var(--pc, var(--primary)) 5%, var(--surface)));
  border-bottom: 1px solid var(--border);
  border-radius: var(--radius) var(--radius) 0 0;
  overflow: hidden;
}
.plan-art .art-plan { width: min(66%, 168px); height: auto; transition: transform .5s var(--ease); }
.plan-card:hover .plan-art .art-plan { transform: scale(1.07) translateY(-2px); }
.plan-art-badge { position: absolute; top: 12px; right: 12px; }
.plan-art-badge:empty { display: none; }

/* ---- Empty states ---------------------------------------------------------------------------- */
.empty .art-empty { width: 148px; max-width: 60%; color: var(--primary-ink); margin-bottom: 2px; }

/* ---- About page ----------------------------------------------------------------------------- */
.doc-wrap.wide { max-width: 1040px; }
.about-head { display: grid; gap: 24px; align-items: center; grid-template-columns: minmax(0, 1fr); }
.about-art { max-width: 440px; width: 100%; margin-inline: auto; }
@media (min-width: 900px) { .about-head { grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 40px; } }
.about-head .lead { max-width: 56ch; }

.about-split { display: grid; gap: 24px; align-items: center; grid-template-columns: minmax(0, 1fr); }
.about-art.sm { max-width: 360px; }
@media (min-width: 768px) { .about-split { grid-template-columns: minmax(0, .9fr) minmax(0, 1fr); gap: 40px; } }

/* ---- Summary-strip & portfolio tile icons -------------------------------------------- */
.summary-item { position: relative; }
.si-ico {
  position: absolute; top: 12px; right: 12px;
  width: 32px; height: 32px;
  display: grid; place-items: center;
  border-radius: 10px;
  background: var(--primary-soft);
  color: var(--primary-ink);
  transition: transform .35s var(--ease);
}
.si-ico .icon { width: 17px; height: 17px; }
.si-ico.ico-pos { background: var(--success-soft); color: var(--success); }
.si-ico.ico-neg { background: var(--danger-soft); color: var(--danger); }
.si-ico.warn { background: var(--warning-soft); color: var(--warning); }
.si-ico.info { background: var(--info-soft); color: var(--info); }
.summary-item:hover .si-ico { transform: scale(1.1) rotate(-6deg); }
.summary-item .stat-label { padding-right: 38px; }
.portfolio-facts dt { display: flex; align-items: center; gap: 6px; }
.portfolio-facts dt .icon { color: var(--primary-ink); }

/* ---- Auth showcase panes ------------------------------------------------------------------ */
.stage-pane { display: none; width: min(100%, 470px); }
.stage-pane.active { display: grid; place-items: center; animation: fade-in .6s ease; }
.stage-pane .art { width: 100%; max-width: 460px; height: auto; }

/* ---- Media: photographic frames, image reveals --------------------------------------------- */
.media {
  position: relative;
  width: 100%;
  margin: 0;
  overflow: hidden;
  border-radius: var(--radius-lg);
  background: var(--ph, var(--surface-2));
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  isolation: isolate;
}
.media picture { display: block; width: 100%; height: 100%; }
.media-img {
  display: block;
  width: 100%; height: 100%;
  object-fit: cover;
  transform: translate3d(0, var(--py, 0px), 0);
}
/* Parallax frames: the picture is a little taller than the frame, so the shift never exposes an edge. */
.media-parallax picture { position: absolute; inset: -6% 0; width: 100%; height: auto; }
.media-bare { border: 0; background: none; box-shadow: none; border-radius: 0; overflow: visible; }
.media-bare .media-img { object-fit: contain; filter: drop-shadow(0 22px 26px rgba(24, 36, 10, .2)); }

/* Reveal (added by motion.js; without it images are simply visible) */
.media-reveal picture {
  clip-path: inset(0 0 100% 0);
  transition: clip-path 1.2s cubic-bezier(.22, .8, .24, 1);
}
.media-reveal.is-in picture { clip-path: inset(0 0 0 0); }
.media-reveal .media-img {
  scale: 1.08;
  opacity: 0;
  transition: scale 1.8s cubic-bezier(.22, .8, .24, 1), opacity .9s ease;
}
.media-reveal.is-in.is-loaded .media-img { scale: 1; opacity: 1; }
.media-bare.media-reveal picture {
  clip-path: none;
  opacity: 0;
  transform: translateY(20px);
  transition: opacity .9s var(--ease), transform 1.2s var(--ease);
}
.media-bare.media-reveal.is-in.is-loaded picture { opacity: 1; transform: none; }
.media-bare.media-reveal .media-img { scale: 1; opacity: 1; }

/* ---- Plans intro, emblem, about, showcase ------------------------------------------------- */
.plans-intro { display: grid; gap: 18px; align-items: center; padding: 20px; margin-bottom: 18px; grid-template-columns: minmax(0, 1fr); }
.plans-intro h2 { font-size: 1.2rem; }
.plans-intro .media { display: none; }
.plans-intro-copy p { margin-top: 6px; max-width: 58ch; }
.intro-points { display: flex; flex-wrap: wrap; gap: 8px 20px; margin-top: 14px; }
.intro-points li { display: flex; align-items: center; gap: 8px; font-weight: 650; font-size: .9rem; color: var(--text-2); }
.intro-points .icon { color: var(--primary-ink); }
@media (min-width: 720px) {
  .plans-intro { grid-template-columns: minmax(0, 1fr) minmax(0, 260px); padding: 22px 26px; gap: 28px; }
  .plans-intro .media { display: block; }
}

.card-emblem { display: flex; align-items: center; gap: 14px; }
.card-emblem h3 { line-height: 1.25; }
.emblem {
  width: 56px; height: 56px; flex: none;
  border-radius: 50%;
  overflow: hidden;
  background: var(--surface-2);
  box-shadow: 0 0 0 3px var(--primary-soft), var(--shadow-sm);
}
.emblem picture, .emblem img { display: block; width: 100%; height: 100%; }
.emblem img { object-fit: cover; transition: transform .6s var(--ease); }
.card:hover .emblem img { transform: rotate(-6deg) scale(1.06); }

.stage-pane .media { max-width: 460px; }

/* ---- Premium motion refinements ------------------------------------------------------------- */
.chart-pulse {
  transform-box: fill-box; transform-origin: center;
  animation: pulse-ring 3s ease-out 1.6s infinite;
}
@keyframes pulse-ring { 0% { transform: scale(1); opacity: .5; } 70% { transform: scale(3.4); opacity: 0; } 100% { transform: scale(3.4); opacity: 0; } }
.chart-tip { transition: opacity .15s, transform .15s, left .18s var(--ease), top .18s var(--ease); }
.spark-draw { stroke-dasharray: 1 1; stroke-dashoffset: 1; animation: draw-line 1.1s var(--ease) .25s forwards; }
.spark-dot { opacity: 0; animation: fade-in .4s ease 1.15s forwards; }

/* Header depth once the page scrolls */
.pub-header, .topbar { transition: box-shadow .3s ease, border-color .3s ease, background-color .3s ease; }
.is-scrolled .pub-header, .is-scrolled .topbar { box-shadow: 0 10px 28px -20px rgba(0, 0, 0, .45); border-bottom-color: var(--border-strong); }

/* New shell fades in (login → dashboard etc.) instead of snapping */
@keyframes shell-in { from { opacity: 0; } to { opacity: 1; } }
.app-shell, .pub-shell, .auth-shell { animation: shell-in .45s var(--ease) backwards; }

/* Smoother in-shell page transitions */
@keyframes view-in { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
.view.enter > *, .auth-view.enter > * { animation: view-in .6s cubic-bezier(.22, .8, .24, 1) both; }
.view.enter > *:nth-child(2) { animation-delay: .05s; }
.view.enter > *:nth-child(3) { animation-delay: .1s; }
.view.enter > *:nth-child(4) { animation-delay: .15s; }
.view.enter > *:nth-child(5) { animation-delay: .2s; }
