/* Homepage motion + polish layer.
 *
 * Additive on top of the compiled home.css (which cannot be rebuilt on this
 * host — no Node toolchain), and built entirely from the --ba-* tokens so it
 * follows the existing light/dark themes without any @media duplication.
 *
 * Safety rules:
 *  - Nothing is hidden unless `js-motion` is on <html>, which the page only
 *    sets when IntersectionObserver exists AND the visitor has not asked for
 *    reduced motion. No JS, old browser, or reduced-motion => static page.
 *  - Only transform/opacity are animated (compositor-friendly).
 */

/* ---------- scroll reveal ---------- */

.js-motion [data-reveal] {
  opacity: 0;
  transform: translateY(18px);
}

.js-motion [data-reveal].is-in {
  opacity: 1;
  transform: none;
  transition:
    opacity 0.55s cubic-bezier(0.22, 0.65, 0.3, 1),
    transform 0.55s cubic-bezier(0.22, 0.65, 0.3, 1);
}

/* Children of a group reveal with a stagger. */
.js-motion [data-reveal-group] > * {
  opacity: 0;
  transform: translateY(22px);
}

.js-motion [data-reveal-group].is-in > * {
  opacity: 1;
  transform: none;
  transition:
    opacity 0.6s cubic-bezier(0.22, 0.65, 0.3, 1),
    transform 0.6s cubic-bezier(0.22, 0.65, 0.3, 1);
}

.js-motion [data-reveal-group].is-in > *:nth-child(1) { transition-delay: 0.05s; }
.js-motion [data-reveal-group].is-in > *:nth-child(2) { transition-delay: 0.14s; }
.js-motion [data-reveal-group].is-in > *:nth-child(3) { transition-delay: 0.23s; }
.js-motion [data-reveal-group].is-in > *:nth-child(4) { transition-delay: 0.32s; }
.js-motion [data-reveal-group].is-in > *:nth-child(5) { transition-delay: 0.41s; }
.js-motion [data-reveal-group].is-in > *:nth-child(6) { transition-delay: 0.5s; }

/* ---------- value cards ("Understand every match", "Measure real progress") ---------- */

.home-value-card {
  position: relative;
  overflow: hidden;
  transition:
    transform 0.35s cubic-bezier(0.22, 0.65, 0.3, 1),
    border-color 0.35s ease,
    box-shadow 0.35s ease;
}

/* Accent hairline that slides in along the top edge on hover. */
.home-value-card::before {
  content: "";
  position: absolute;
  inset: 0 auto auto 0;
  width: 100%;
  height: 3px;
  background: linear-gradient(90deg, var(--ba-accent), transparent 70%);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.45s cubic-bezier(0.22, 0.65, 0.3, 1);
}

.home-value-card:hover {
  transform: translateY(-4px);
  border-color: var(--ba-line-strong);
  box-shadow: var(--ba-shadow);
}

.home-value-card:hover::before {
  transform: scaleX(1);
}

.home-value-icon {
  transition:
    transform 0.35s cubic-bezier(0.22, 0.65, 0.3, 1),
    background-color 0.35s ease,
    color 0.35s ease,
    border-color 0.35s ease;
}

.home-value-card:hover .home-value-icon {
  transform: translateY(-2px) scale(1.06) rotate(-3deg);
  background-color: var(--ba-accent-soft);
  border-color: transparent;
}

/* The dark feature card keeps its own contrast on hover. */
.home-value-card:nth-child(1):hover .home-value-icon {
  background-color: rgb(255 255 255 / 0.08);
}

/* ---------- proof bar (the strip of capability stats) ---------- */

.home-proof-item {
  transition:
    transform 0.3s cubic-bezier(0.22, 0.65, 0.3, 1),
    border-color 0.3s ease;
}

.home-proof-item:hover {
  transform: translateY(-3px);
}

.home-proof-value {
  background: linear-gradient(120deg, var(--ba-ink) 55%, var(--ba-accent));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* ---------- workflow steps ---------- */

.home-workflow [data-reveal-group] > * {
  position: relative;
}

/* ---------- buttons: a restrained sheen on the primary CTA ---------- */

.home-button {
  transition:
    transform 0.25s cubic-bezier(0.22, 0.65, 0.3, 1),
    box-shadow 0.25s ease,
    background-color 0.25s ease;
}

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

.home-button:active {
  transform: translateY(0);
}

.home-button-primary {
  position: relative;
  overflow: hidden;
}

.home-button-primary::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    105deg,
    transparent 40%,
    rgb(255 255 255 / 0.22) 50%,
    transparent 60%
  );
  transform: translateX(-120%);
}

.js-motion .home-button-primary:hover::after {
  transition: transform 0.7s ease;
  transform: translateX(120%);
}

/* ---------- hero ---------- */

/* A slow ambient drift on the backdrop, imperceptible but alive.  Gated on
 * js-motion, so reduced-motion visitors get a perfectly still page. */
.js-motion .home-backdrop {
  animation: ba-backdrop-drift 26s ease-in-out infinite alternate;
}

@keyframes ba-backdrop-drift {
  from { transform: translate3d(0, 0, 0); }
  to   { transform: translate3d(0, -14px, 0); }
}

/* Keyboard users get the same affordance hover users do. */
.home-value-card:focus-within {
  border-color: var(--ba-line-strong);
  box-shadow: var(--ba-shadow);
}

/* Belt and braces: if the OS preference flips after load, stop everything. */
@media (prefers-reduced-motion: reduce) {
  .js-motion [data-reveal],
  .js-motion [data-reveal-group] > * {
    opacity: 1 !important;
    transform: none !important;
    transition: none !important;
  }

  .js-motion .home-backdrop {
    animation: none;
  }
}
