/* Homepage layout: hero routing visual, provider strip, stats, benefit cards,
   section polish and motion. Loaded after marketing.css; colours come from theme.css. */

/* ---------- hero ---------- */
.home-hero {
  position: relative; overflow: hidden;
  padding: 72px 0 0; text-align: left;
  background: none; border-bottom: 1px solid var(--line);
}
.home-hero::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background:
    radial-gradient(620px 420px at 78% 34%, rgba(var(--violet-rgb), calc(.18 * var(--glow))), transparent 70%),
    linear-gradient(var(--grid-line) 1px, transparent 1px) 0 0 / 48px 48px,
    linear-gradient(90deg, var(--grid-line) 1px, transparent 1px) 0 0 / 48px 48px;
  -webkit-mask-image: linear-gradient(to bottom, #000 30%, transparent 92%);
  mask-image: linear-gradient(to bottom, #000 30%, transparent 92%);
}
.home-hero-grid {
  position: relative;
  display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
  gap: 48px; align-items: center;
}
.home-hero h1 { max-width: 600px; margin: 0 0 22px; font-size: clamp(40px, 4.6vw, 60px); }
.home-intro { max-width: 560px; margin: 0 0 30px; font-size: 18px; text-wrap: pretty; }
.home-hero .home-actions { justify-content: flex-start; }
.home-label {
  display: inline-flex; align-items: center; gap: 8px; margin-bottom: 22px;
  padding: 5px 12px; border: 1px solid var(--violet-line); border-radius: 999px;
  background: var(--violet-soft); color: var(--violet-text); font-size: 12px; letter-spacing: .08em;
}
.home-label::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--green); }

.home-hero-visual { position: relative; margin: 0; min-width: 0; }
.hero-router { width: 100%; height: auto; overflow: visible; }
.hero-route { fill: none; stroke: var(--line-strong); stroke-width: 1.5; }
.hero-route.is-active, .hero-route--in { stroke: var(--violet); stroke-width: 2; stroke-dasharray: 6 6; }
.hero-app rect, .hero-chip rect { fill: var(--surface); stroke: var(--line-strong); stroke-width: 1; }
.hero-hub rect { fill: var(--surface); stroke: var(--violet); stroke-width: 1.5; filter: drop-shadow(0 10px 24px var(--shadow)); }
.hero-chip.is-active rect { fill: var(--violet-soft); stroke: var(--violet); }
.hero-router text { font-family: var(--font); fill: var(--muted); }
.hero-node-title, .hero-hub-title, .hero-chip-name { fill: var(--text); font-weight: 600; }
.hero-node-title { font-size: 15px; }
.hero-hub-title { font-size: 17px; }
.hero-node-sub { font-size: 12px; }
.hero-chip-name { font-size: 13px; }
.hero-chip-kind { font-size: 10.5px; }
.hero-chip.is-active .hero-chip-name { fill: var(--violet-text); }
.hero-caption {
  display: flex; align-items: center; gap: 10px; width: fit-content; max-width: 100%;
  margin: 8px auto 0; padding: 8px 14px; border: 1px solid var(--line); border-radius: 999px;
  background: var(--code-bg); color: var(--code-text); font-size: 13px;
}
.hero-caption code { min-width: 0; overflow-wrap: anywhere; }
.hero-caption-dot { flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--green); }

/* ---------- provider strip ---------- */
.home-providers { position: relative; display: flex; align-items: center; gap: 24px; margin-top: 56px; padding: 22px 0; border-top: 1px solid var(--line); }
.home-providers-label { flex: none; color: var(--muted); font: 500 12px/1.4 var(--mono); letter-spacing: .08em; text-transform: uppercase; }
/* Static by default: every name wraps into view. The clipped, scrolling
   marquee applies only when the visitor allows motion (see the motion block). */
.home-provider-marquee { display: flex; flex: 1; min-width: 0; }
.home-provider-track { display: flex; flex-wrap: wrap; gap: 10px 32px; list-style: none; }
.home-provider-track li { color: var(--text-soft); font-size: 17px; font-weight: 600; letter-spacing: -.01em; white-space: nowrap; }
.home-provider-track[aria-hidden="true"] { display: none; }

/* ---------- stats ---------- */
.home-stats { border-bottom: 1px solid var(--line); background: var(--tint-bg); }
.home-stat-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); }
.home-stat { display: flex; flex-direction: column-reverse; justify-content: flex-end; gap: 6px; padding: 32px 24px; border-left: 1px solid var(--line); }
.home-stat:first-child { border-left: 0; padding-left: 0; }
.home-stat dd { color: var(--text); font: 700 44px/1 var(--display); letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.home-stat dt { color: var(--muted); font-size: 14px; line-height: 1.5; }

/* ---------- benefit cards ---------- */
.home-why-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.home-why-card {
  display: flex; flex-direction: column; min-width: 0; padding: 24px;
  border: 1px solid var(--line); border-radius: 12px; background: var(--surface);
}
.home-why-icon {
  display: grid; place-items: center; width: 44px; height: 44px; margin-bottom: 20px;
  border: 1px solid var(--violet-line); border-radius: 10px; background: var(--violet-soft); color: var(--violet-text);
}
.home-why-icon svg { width: 22px; height: 22px; }
.home-why-card h3 { margin-bottom: 8px; font-size: 18px; }
.home-why-card p { color: var(--muted); font-size: 15px; line-height: 1.6; }
.home-why-card .home-text-link { margin-top: auto; padding-top: 12px; font-size: 14px; }

/* ---------- code ---------- */
.home-code .code-head em.code-changed-tag {
  margin-left: 8px; padding: 2px 8px; border-radius: 999px;
  background: var(--green-soft); color: var(--green); font-style: normal;
}
.home-code .code-changed {
  display: inline-block; width: calc(100% + 48px); margin: 0 -24px; padding: 0 24px;
  border-left: 2px solid var(--green); background: var(--green-soft);
}

/* ---------- model cards: compact so the chooser stays short on every screen ---------- */
.home-model { padding: 18px 20px 16px; border-radius: 12px; }
.home-model-heading { padding-right: 74px; }
.home-model-heading h4 { font-size: 18px; }
.home-model-id { margin-top: 2px; }
.home-model-id code { font-size: 13px; }
.home-model-copy { position: absolute; top: 12px; right: 12px; }
.home-model-price { margin-top: 12px; font-size: 16px; }
.home-model-price span { display: inline; margin: 0 0 0 4px; font-size: 13px; }
.home-model-use { margin-top: 6px; font-size: 14px; }
.home-model-note { margin-top: 4px; }
.home-model-link { min-height: 32px; margin-top: 6px; }

/* ---------- section polish ---------- */
.home-help-grid .card, .home-article-card { border-radius: 12px; }
.home-steps { position: relative; }
.home-step-number {
  display: grid; place-items: center; width: 36px; height: 36px;
  border: 1px solid var(--violet-line); border-radius: 50%; background: var(--surface);
  color: var(--violet-text); font-size: 15px;
}
.home-benefit-list > div { padding-left: 16px; border-left: 2px solid var(--violet-line); }
.home-closing {
  position: relative; overflow: hidden; padding: 88px 0 96px;
  background: var(--tint-bg);
}
.home-closing::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(520px 260px at 50% 0%, rgba(var(--violet-rgb), calc(.2 * var(--glow))), transparent 70%);
}
.home-closing .wrap { position: relative; }
.home-closing h2 { font-size: clamp(30px, 3.6vw, 44px); }

/* ---------- motion: only when the visitor allows it; reveals also need .motion-ok from home-motion.js ---------- */
@media (prefers-reduced-motion: no-preference) {
  .home-provider-marquee { overflow: hidden; -webkit-mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent); mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent); }
  .home-provider-track { flex: none; flex-wrap: nowrap; gap: 40px; padding-right: 40px; animation: home-marquee 36s linear infinite; }
  .home-provider-track[aria-hidden="true"] { display: flex; }
  .home-provider-marquee:hover .home-provider-track { animation-play-state: paused; }
  .hero-route.is-active, .hero-route--in { animation: home-flow 1.1s linear infinite; }
  .hero-chip rect, .hero-route { transition: fill .35s ease, stroke .35s ease; }
  .hero-caption-dot { animation: home-pulse 2.2s ease-in-out infinite; }
  .home-why-card { transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease; }
  .motion-ok [data-reveal] { opacity: 0; transform: translateY(14px); transition: opacity .6s ease var(--reveal-delay, 0ms), transform .6s ease var(--reveal-delay, 0ms); }
  .motion-ok [data-reveal].is-visible { opacity: 1; transform: none; }
}
@media (hover: hover) and (pointer: fine) and (prefers-reduced-motion: no-preference) {
  .home-why-card:hover { transform: translateY(-3px); border-color: var(--line-strong); box-shadow: 0 10px 24px var(--shadow); }
}
@keyframes home-marquee { to { transform: translateX(-100%); } }
@keyframes home-flow { to { stroke-dashoffset: -24; } }
@keyframes home-pulse { 50% { opacity: .35; } }

/* ---------- tablet ---------- */
@media (max-width: 960px) {
  .home-hero-grid { grid-template-columns: minmax(0, 1fr); gap: 40px; }
  .home-hero-copy { max-width: 640px; }
  .home-hero-visual { max-width: 560px; }
  .home-why-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .home-stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .home-stat:nth-child(3) { border-left: 0; padding-left: 0; }
  .home-stat:nth-child(n + 3) { border-top: 1px solid var(--line); }
}

/* ---------- phone ---------- */
@media (min-width: 561px) and (max-width: 720px) {
  .home-model-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 600px) {
  /* The routing diagram's labels get too small to read; keep the live model pill. */
  .hero-router { display: none; }
  .hero-caption { margin: 0; }
}
@media (max-width: 720px) {
  .home-hero { padding-top: 48px; }
  .home-hero h1 { font-size: clamp(34px, 9vw, 44px); }
  .home-intro { font-size: 17px; }
  .home-providers { flex-direction: column; align-items: flex-start; gap: 12px; margin-top: 40px; }
  .home-provider-marquee { width: 100%; }
  .home-provider-track li { font-size: 15px; }
  .home-why-grid { grid-template-columns: minmax(0, 1fr); }
  .home-stat { padding: 22px 16px; }
  .home-stat dd { font-size: 34px; }
  .home-code .code-changed { width: calc(100% + 40px); margin: 0 -20px; padding: 0 20px; }
  .home-closing { padding: 56px 0 64px; }
}
@media (max-width: 380px) {
  .home-hero .home-actions .btn { width: 100%; }
  .home-stat { padding: 18px 12px; }
  .home-stat dd { font-size: 30px; }
}
