/* AI Flow home — immersive product stage. Scoped to #af-home. */
#af-home {
  --af-mx: 50%;
  --af-my: 28%;
  --af-accent: #3b82f6;
  --af-violet: #8b5cf6;
  --af-cyan: #22d3ee;
  --af-ink: color-mix(in srgb, currentColor 92%, transparent);
  --af-muted: color-mix(in srgb, currentColor 55%, transparent);
  --af-faint: color-mix(in srgb, currentColor 12%, transparent);
  --af-card: color-mix(in srgb, currentColor 4.5%, transparent);
  --af-card-hover: color-mix(in srgb, currentColor 7%, transparent);
  --af-border: color-mix(in srgb, currentColor 14%, transparent);
  position: relative;
  isolation: isolate;
  overflow: clip;
  max-width: 80rem; /* New API max-w-7xl / 1280px — full-viewport breathe */
  margin: 0 auto;
  padding: 3.25rem 1.25rem 4rem;
  color: inherit;
  font: inherit;
  line-height: 1.55;
  min-height: min(78vh, 820px);
}
@media (min-width: 768px) {
  #af-home { padding: 4.25rem 1.75rem 5rem; }
}
#af-home *, #af-home *::before, #af-home *::after { box-sizing: border-box; }
#af-home a { color: var(--af-accent); text-decoration: none; }
#af-home a:hover { text-decoration: none; }

/* --- Stage layers --- */
#af-home .af-stage {
  position: absolute;
  inset: -8% -12% auto -12%;
  height: 72%;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}
#af-home .af-mesh {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 55% 45% at var(--af-mx) var(--af-my),
      color-mix(in srgb, var(--af-violet) 28%, transparent),
      transparent 62%),
    radial-gradient(ellipse 42% 38% at calc(var(--af-mx) + 18%) calc(var(--af-my) + 12%),
      color-mix(in srgb, var(--af-accent) 22%, transparent),
      transparent 58%),
    radial-gradient(ellipse 36% 32% at 18% 78%,
      color-mix(in srgb, var(--af-cyan) 16%, transparent),
      transparent 55%);
  filter: blur(2px);
  animation: af-aurora 18s ease-in-out infinite alternate;
}
#af-home .af-grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(to right, var(--af-faint) 1px, transparent 1px),
    linear-gradient(to bottom, var(--af-faint) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(ellipse 70% 60% at 50% 35%, #000 20%, transparent 75%);
  opacity: 0.55;
}
#af-home .af-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(40px);
  opacity: 0.45;
  animation: af-drift 14s ease-in-out infinite;
}
#af-home .af-orb.a {
  width: 220px; height: 220px; left: 8%; top: 12%;
  background: color-mix(in srgb, var(--af-accent) 55%, transparent);
}
#af-home .af-orb.b {
  width: 180px; height: 180px; right: 10%; top: 22%;
  background: color-mix(in srgb, var(--af-violet) 50%, transparent);
  animation-delay: -5s; animation-duration: 17s;
}
#af-home .af-spotlight {
  position: absolute;
  left: 0;
  top: 0;
  width: 480px;
  height: 480px;
  margin: -240px 0 0 -240px;
  z-index: 1;
  pointer-events: none;
  border-radius: 50%;
  background: radial-gradient(
    circle closest-side,
    color-mix(in srgb, #fff 32%, transparent) 0%,
    color-mix(in srgb, var(--af-accent) 22%, transparent) 38%,
    color-mix(in srgb, var(--af-violet) 14%, transparent) 58%,
    transparent 72%
  );
  mix-blend-mode: soft-light;
  opacity: 0.95;
  transform: translate3d(var(--af-sx, 50%), var(--af-sy, 28%), 0);
  will-change: transform;
  transition: opacity 0.3s ease;
}
#af-home.is-reduced .af-mesh,
#af-home.is-reduced .af-orb { animation: none; }
#af-home.is-reduced .af-spotlight { opacity: 0.55; }

@keyframes af-aurora {
  0%   { transform: translate3d(0, 0, 0) scale(1); opacity: 0.85; }
  50%  { transform: translate3d(1.5%, -1%, 0) scale(1.04); opacity: 1; }
  100% { transform: translate3d(-1%, 1.5%, 0) scale(1.02); opacity: 0.9; }
}
@keyframes af-drift {
  0%, 100% { transform: translate3d(0, 0, 0); }
  50% { transform: translate3d(18px, -22px, 0); }
}
@keyframes af-blink {
  0%, 45% { opacity: 1; }
  50%, 100% { opacity: 0; }
}
@keyframes af-type-caret {
  0%, 100% { border-color: var(--af-cyan); }
  50% { border-color: transparent; }
}

/* --- Content --- */
#af-home .af-content {
  position: relative;
  z-index: 2;
}
#af-home .af-hero {
  max-width: 36rem;
  margin-bottom: 2.75rem;
}
#af-home .af-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  margin: 0 0 1rem;
  padding: 0.28rem 0.7rem;
  border-radius: 999px;
  border: 1px solid var(--af-border);
  background: color-mix(in srgb, currentColor 3%, transparent);
  font-size: 0.72rem;
  font-weight: 650;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--af-muted);
}
#af-home .af-eyebrow::before {
  content: "";
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--af-cyan);
  box-shadow: 0 0 10px var(--af-cyan);
}
#af-home h1 {
  margin: 0 0 0.85rem;
  font-size: clamp(2.6rem, 7vw, 4.25rem);
  font-weight: 750;
  letter-spacing: -0.045em;
  line-height: 1.02;
  position: relative;
  z-index: 2;
  color: inherit;
  background-image: linear-gradient(
    120deg,
    currentColor 0%,
    currentColor 38%,
    color-mix(in srgb, var(--af-accent) 78%, currentColor) 68%,
    color-mix(in srgb, var(--af-violet) 72%, currentColor) 100%
  );
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
@supports not ((-webkit-background-clip: text) or (background-clip: text)) {
  #af-home h1 {
    color: inherit;
    -webkit-text-fill-color: currentColor;
    background-image: none;
  }
}
#af-home .af-lead {
  margin: 0 0 1.6rem;
  max-width: 28rem;
  font-size: 1.05rem;
  color: var(--af-muted);
  line-height: 1.55;
}
#af-home .af-cta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 0.9rem;
  align-items: center;
}
#af-home .af-cta a.primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.68rem 1.35rem;
  border-radius: 0.65rem;
  font-size: 0.925rem;
  font-weight: 650;
  color: #fff !important;
  background: linear-gradient(135deg, #2563eb, #7c3aed);
  border: none;
  box-shadow:
    0 1px 2px color-mix(in srgb, #2563eb 30%, transparent),
    0 0 0 1px color-mix(in srgb, #fff 8%, transparent) inset;
  transition: transform 0.2s ease, filter 0.2s ease, box-shadow 0.2s ease;
}
#af-home .af-cta a.primary:hover {
  filter: brightness(1.08);
  transform: translateY(-1px);
  box-shadow:
    0 8px 24px color-mix(in srgb, #7c3aed 28%, transparent),
    0 0 0 1px color-mix(in srgb, #fff 10%, transparent) inset;
}
#af-home .af-cta a.ghost {
  display: inline-flex;
  align-items: center;
  padding: 0.68rem 1.1rem;
  border-radius: 0.65rem;
  font-size: 0.925rem;
  font-weight: 600;
  color: inherit !important;
  border: 1px solid var(--af-border);
  background: color-mix(in srgb, currentColor 3%, transparent);
  transition: background 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}
#af-home .af-cta a.ghost:hover {
  background: color-mix(in srgb, currentColor 7%, transparent);
  transform: translateY(-1px);
}

/* --- Product cards --- */
#af-home .af-products {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.85rem;
  margin: 0 0 2rem;
  perspective: 1200px;
}
@media (min-width: 720px) {
  #af-home .af-products { grid-template-columns: repeat(3, 1fr); gap: 1rem; }
}
#af-home .af-card {
  position: relative;
  display: block;
  padding: 1.15rem 1.2rem 1.25rem;
  border-radius: 1rem;
  border: 1px solid var(--af-border);
  background:
    linear-gradient(160deg,
      color-mix(in srgb, var(--af-accent) 6%, transparent),
      transparent 42%),
    var(--af-card);
  transform: perspective(900px) rotateX(var(--af-rx, 0deg)) rotateY(var(--af-ry, 0deg)) translateZ(0);
  transform-style: preserve-3d;
  will-change: transform;
  transition:
    transform 0.12s ease-out,
    border-color 0.25s ease,
    background 0.25s ease,
    box-shadow 0.25s ease;
  cursor: pointer;
  outline: none;
  color: inherit;
  text-align: left;
  width: 100%;
  font: inherit;
}
#af-home .af-card::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  opacity: 0;
  background: radial-gradient(
    180px 120px at var(--af-cx, 50%) var(--af-cy, 30%),
    color-mix(in srgb, var(--af-violet) 22%, transparent),
    transparent 70%
  );
  transition: opacity 0.25s ease;
}
#af-home .af-card:hover,
#af-home .af-card:focus-visible,
#af-home .af-card.is-open {
  border-color: color-mix(in srgb, var(--af-violet) 35%, var(--af-border));
  background:
    linear-gradient(160deg,
      color-mix(in srgb, var(--af-violet) 10%, transparent),
      transparent 48%),
    var(--af-card-hover);
  box-shadow:
    0 12px 40px color-mix(in srgb, #000 12%, transparent),
    0 0 0 1px color-mix(in srgb, var(--af-violet) 18%, transparent);
}
#af-home .af-card:hover::after,
#af-home .af-card:focus-visible::after { opacity: 1; }
#af-home .af-card .kicker {
  margin: 0 0 0.45rem;
  font-size: 0.7rem;
  font-weight: 650;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--af-muted);
}
#af-home .af-card .title {
  margin: 0 0 0.4rem;
  font-size: 1.12rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.25;
}
#af-home .af-card .one {
  margin: 0;
  font-size: 0.9rem;
  color: var(--af-muted);
  line-height: 1.45;
}
#af-home .af-card .more {
  margin: 0;
  font-size: 0.82rem;
  color: var(--af-muted);
  line-height: 1.45;
  max-height: 0;
  opacity: 0;
  overflow: hidden;
  transition: max-height 0.28s ease, opacity 0.22s ease, margin 0.22s ease;
}
#af-home .af-card:hover .more,
#af-home .af-card.is-open .more,
#af-home .af-card:focus-visible .more,
#af-home .af-card[aria-expanded="true"] .more {
  max-height: 6rem;
  opacity: 1;
  margin: 0.65rem 0 0;
}

/* --- Snippet accent --- */
#af-home .af-snippet {
  display: flex;
  align-items: stretch;
  max-width: 28rem;
  margin: 0;
  border-radius: 0.85rem;
  border: 1px solid var(--af-border);
  background: color-mix(in srgb, #020617 78%, transparent);
  color: #e2e8f0;
  overflow: hidden;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.78rem;
  line-height: 1.55;
  box-shadow: 0 10px 36px color-mix(in srgb, #000 18%, transparent);
}
#af-home .af-snippet .bar {
  display: flex;
  gap: 0.35rem;
  padding: 0.55rem 0.85rem;
  border-bottom: 1px solid color-mix(in srgb, #fff 8%, transparent);
  background: color-mix(in srgb, #fff 3%, transparent);
}
#af-home .af-snippet .dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: color-mix(in srgb, #fff 22%, transparent);
}
#af-home .af-snippet .body {
  padding: 0.85rem 1rem 1rem;
  margin: 0;
  white-space: pre;
  overflow-x: auto;
}
#af-home .af-snippet .kw { color: #c4b5fd; }
#af-home .af-snippet .str { color: #67e8f9; }
#af-home .af-snippet .dim { color: #64748b; }
#af-home .af-snippet .caret {
  display: inline-block;
  width: 0.55ch;
  height: 1.05em;
  margin-left: 1px;
  vertical-align: text-bottom;
  background: var(--af-cyan);
  animation: af-blink 1.05s steps(1) infinite;
}
#af-home .af-snippet-wrap {
  display: grid;
  gap: 0.55rem;
}
#af-home .af-snippet-label {
  margin: 0;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--af-muted);
  font-weight: 600;
}


/* --- In-page trust / ICP (Home skips shell Footer) — single centered line --- */
#af-home .af-trust {
  margin: 2.25rem 0 0;
  padding-top: 1.15rem;
  border-top: 1px solid var(--af-border);
  display: flex;
  justify-content: center;
  align-items: center;
  text-align: center;
}
#af-home .af-trust .af-line {
  margin: 0;
  font-size: 0.78rem;
  line-height: 1.45;
  color: var(--af-muted);
  letter-spacing: 0.01em;
  white-space: nowrap;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  max-width: 100%;
}
#af-home .af-trust .af-icp {
  color: inherit;
  text-decoration: none;
  border-bottom: 1px solid color-mix(in srgb, currentColor 25%, transparent);
}
#af-home .af-trust .af-icp:hover {
  color: var(--af-accent);
  border-bottom-color: color-mix(in srgb, var(--af-accent) 45%, transparent);
}

@media (prefers-reduced-motion: reduce) {
  #af-home .af-mesh,
  #af-home .af-orb,
  #af-home .af-snippet .caret { animation: none !important; }
  #af-home .af-card { transition: border-color 0.2s ease, background 0.2s ease; }
  #af-home .af-card { transform: none !important; }
}
