/* =========================================================================
   Visual refresh: animated product preview, stats band, topic strip, motion.
   Loaded after style.css.
   ========================================================================= */
:root { --ease-out: cubic-bezier(.2, .7, .2, 1); --code-bg: #17161c; --code-bar: #201f27; --code-text: #d8d6e0; --code-dim: #6e6b7b; }

/* Hero: quiet grid backdrop that fades out toward the edges */
.hero { position: relative; isolation: isolate; }
.hero::before {
  content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background-image: linear-gradient(var(--border) 1px, transparent 1px), linear-gradient(90deg, var(--border) 1px, transparent 1px);
  background-size: 48px 48px; opacity: .55;
  -webkit-mask-image: radial-gradient(ellipse 70% 60% at 70% 45%, #000 0%, transparent 75%);
          mask-image: radial-gradient(ellipse 70% 60% at 70% 45%, #000 0%, transparent 75%);
  animation: grid-in 1.4s ease both;
}
@keyframes grid-in { from { opacity: 0; } }

/* Preview composition */
.hero-visual { padding: 0; min-width: 0; }
.hero-content { min-width: 0; }
.pv { position: relative; padding: 0 0 72px 36px; min-width: 0; }
.pv-photo {
  position: relative; aspect-ratio: 1 / 1; border-radius: 18px; overflow: hidden;
  background: linear-gradient(165deg, var(--hero-a) 0%, var(--hero-b) 100%);
  box-shadow: 0 30px 60px -28px rgba(24, 24, 27, .3);
  animation: pv-rise .9s var(--ease-out) .1s both;
}
.pv-photo img {
  position: absolute; inset: 0; width: 100%; height: 100%; display: block; object-fit: cover;
  animation: pv-photo-in 1.1s var(--ease-out) .3s both, pv-float 10s ease-in-out 2s infinite;
}
@keyframes pv-photo-in { from { opacity: 0; transform: translateY(30px) scale(1.03); } }
.pv-term {
  position: absolute; right: -12px; top: 28px; width: min(300px, 72%); z-index: 2;
  padding: 12px 16px; border-radius: 10px; background: #0f0e13; color: #c9c6d3;
  font: 12px/1.75 ui-monospace, Consolas, monospace; box-shadow: 0 18px 40px -14px rgba(0, 0, 0, .5);
  animation: pv-rise .7s var(--ease-out) 1s both, pv-float 9s ease-in-out 2s infinite;
}
.pv-term > div { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pv-prompt { color: #f08aa8; }
.pv-ok { color: #8fd9a8; display: flex; align-items: center; gap: 8px; animation: pv-fade-in .3s ease 1.7s both; }
.pv-tick { width: 5px; height: 9px; margin: -3px 2px 0; flex: none; border: solid currentColor; border-width: 0 2px 2px 0; transform: rotate(45deg); }
.pv-card {
  position: absolute; left: 0; bottom: 0; width: 270px; padding: 16px 18px 6px;
  background: var(--bg); border: 1px solid var(--border); border-radius: 12px;
  box-shadow: 0 20px 44px -12px rgba(24, 24, 27, .18), 0 2px 6px rgba(24, 24, 27, .04);
  z-index: 2; animation: pv-rise .8s var(--ease-out) .8s both, pv-float 9s ease-in-out 2.5s infinite reverse;
}
.pv-card .hc-bar span { animation-delay: 1.3s; }
.pv-card .hc-list .is-done i { animation-delay: 1.8s; }

@keyframes pv-rise { from { opacity: 0; transform: translateY(22px); } }
@keyframes pv-float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }
@keyframes pv-fade-in { from { opacity: 0; } }

.auth-visual .pv { padding-left: 20px; }
.auth-visual .pv { max-width: 420px; margin: 0 auto; }
:root[data-theme="dark"] .pv-photo img { filter: brightness(.94); }

/* Stats band */
.stats-band { border-bottom: 1px solid var(--border); background: var(--bg); }
.stats-row { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); }
.stat-cell { padding: 30px 24px; display: flex; flex-direction: column; gap: 2px; }
.stat-cell + .stat-cell { border-left: 1px solid var(--border); }
.stat-cell strong { font-size: 34px; font-weight: 650; letter-spacing: -0.03em; line-height: 1.1; font-variant-numeric: tabular-nums; }
.stat-cell span { font-size: 14px; color: var(--text-3); }

/* Topic strip: one slow, steady loop */
.topic-strip {
  overflow: hidden; border-bottom: 1px solid var(--border); background: var(--bg-subtle); padding: 14px 0;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 10%, #000 90%, transparent);
          mask-image: linear-gradient(90deg, transparent, #000 10%, #000 90%, transparent);
}
.topic-track { display: flex; width: max-content; animation: marquee 48s linear infinite; }
.topic-strip:hover .topic-track { animation-play-state: paused; }
.topic-track span { display: inline-flex; align-items: center; gap: 28px; padding-right: 28px; font-size: 14px; font-weight: 500; color: var(--text-2); white-space: nowrap; }
.topic-track span::after { content: ""; width: 4px; height: 4px; border-radius: 50%; background: var(--accent); opacity: .6; }
@keyframes marquee { to { transform: translateX(-50%); } }

/* Navigation: underline slides in from the left */
.nav-links > a:not(.btn):not(.nav-bell) { position: relative; transition: color .2s ease; }
.nav-links > a:not(.btn):not(.nav-bell)::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -2px; height: 1.5px; border-radius: 1px;
  background: var(--accent); transform: scaleX(0); transform-origin: right; transition: transform .35s var(--ease-out);
}
.nav-links > a:not(.btn):not(.nav-bell):hover::after, .nav-links > a.is-current::after { transform: scaleX(1); transform-origin: left; }

/* Buttons: small lift and a soft shadow on hover */
.btn { transition: background-color .2s ease, border-color .2s ease, box-shadow .25s ease, transform .25s var(--ease-out); }
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 8px 20px -8px rgba(176, 58, 91, .55); }
.btn-secondary:hover { transform: translateY(-1px); box-shadow: 0 6px 16px -8px rgba(24, 24, 27, .2); }
.btn:active { transform: translateY(0) scale(.98); box-shadow: none; }

/* Feature cards: lift plus a faint spotlight that follows the cursor (set by main.js) */
.feature { position: relative; overflow: hidden; transition: border-color .3s ease, box-shadow .3s ease, transform .35s var(--ease-out); }
.feature::before {
  content: ""; position: absolute; inset: 0; pointer-events: none; opacity: 0; transition: opacity .3s ease;
  background: radial-gradient(260px circle at var(--mx, 50%) var(--my, 50%), var(--accent-soft), transparent 70%);
}
.feature > * { position: relative; }
.feature:hover { transform: translateY(-3px); border-color: var(--accent-border); box-shadow: 0 16px 34px -18px rgba(24, 24, 27, .25); }
.feature:hover::before { opacity: 1; }
.feature .st-icon { transition: transform .4s var(--ease-out); }
.feature:hover .st-icon { transform: translateY(-2px) scale(1.06); }

/* Reveal: a touch of blur makes the fade feel smoother */
.js [data-reveal] { filter: blur(4px); transition: opacity .7s ease, transform .7s var(--ease-out), filter .7s ease; transition-delay: var(--reveal-delay, 0ms); }
.js [data-reveal].is-visible { filter: none; }

:root[data-theme="dark"] .hero::before { opacity: .35; }

@media (max-width: 960px) {
  .stats-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat-cell:nth-child(3) { border-left: 0; }
  .stat-cell:nth-child(n+3) { border-top: 1px solid var(--border); }
}
@media (max-width: 760px) {
  .pv { padding: 0 0 64px; }
  .pv-term { display: none; }
  .pv-card { left: 12px; width: 250px; }
  .stat-cell { padding: 22px 16px; }
  .stat-cell strong { font-size: 28px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .js [data-reveal] { opacity: 1; transform: none; filter: none; }
}
