/*
 * /compare/build-vs-buy — Act 1 only (scaffold).
 *
 * Closes the Compare set.  Different shape from the 5
 * competitor spokes:
 *   - Hero is CENTRED (not asymmetric split)
 *   - The visual wedge is a single oversized $-counter,
 *     ticking $0 → $42,000 on IO entry
 *
 * Universal chrome lives in ../../_shared/chrome.css.
 */

@import url("../../_ds/fonts.css");
@import url("../../_ds/theme.css");
@import url("../../_shared/chrome.css");
@import url("../../_shared/components.css");
@import url("../../_shared/audience-switcher.css");

main { width: 100%; max-width: 100vw; position: relative; }

/* ───────────────────────────────────────────────────────────
   Act 1 — Free, until it isn't.
─────────────────────────────────────────────────────────── */

/* Section is a sticky stage on dark: 220vh tall, .frame
   pins for the duration.  Scroll progress 0→1 (computed in
   JS) writes --progress on the frame; the cost ramp + item
   reveals + rail fill all read off it. */
.bvb-act-1 {
  --progress: 0;
  position: relative;
  background: var(--background);
  color: var(--text-primary);
  height: 220vh;
  isolation: isolate;
}

.bvb-act-1-frame {
  position: sticky;
  top: 0;
  height: 100vh;
  width: 100%;
  max-width: 1080px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  /* Smaller gap default so the whole stack (hero + cost +
     items + rail) fits inside a 13-14" laptop viewport. */
  gap: clamp(18px, 2.4vw, 40px);
  padding: clamp(64px, 8vh, 120px) clamp(20px, 4vw, 56px);
}

.bvb-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: clamp(14px, 1.6vw, 24px);
}

.bvb-hero-kicker { margin: 0; }

.bvb-hero-h1 {
  margin: 0;
  font-family: var(--font-display, var(--font-base));
  /* Cap at 80px on default desktop so it fits the laptop
     viewport alongside the oversized cost figure below. */
  font-size: var(--mkt-hero-xl);
  line-height: 1;
  letter-spacing: -0.03em;
  font-weight: 500;
  color: var(--text-primary);
  max-width: 18ch;
  text-wrap: balance;
}

.bvb-hero-em {
  font-style: normal;
  font-weight: 500;
  color: var(--text-primary);
}

.bvb-hero-sub {
  margin: 0;
  font-family: var(--font-base);
  font-size: var(--mkt-body);
  line-height: 1.55;
  color: var(--text-secondary);
  max-width: 56ch;
}

/* ── Big cost figure (focal element on dark) ──────────── */
.bvb-scale {
  display: inline-flex;
  align-items: flex-start;
  justify-content: center;
  gap: 0 clamp(4px, 0.5vw, 8px);
  font-family: var(--font-display, var(--font-base));
  line-height: 0.92;
  letter-spacing: -0.04em;
  font-weight: 600;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
  flex-wrap: wrap;
}

.bvb-scale-currency {
  /* Tighter so the figure plus the rest of the stack fits
     inside the sticky 100vh frame on a laptop. */
  font-size: var(--mkt-hero);
  color: var(--text-tertiary);
  font-weight: 500;
  transform: translateY(0.05em);
}

.bvb-scale-num {
  font-size: clamp(72px, 10vw, 160px);
}

.bvb-scale-caption {
  flex-basis: 100%;
  text-align: center;
  margin-top: clamp(8px, 1.2vw, 14px);
  font-family: var(--font-base);
  font-size: var(--mkt-body-xs);
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-tertiary);
}

/* ── Line items ──────────────────────────────────────────
   Each item has a data-from threshold; JS toggles .is-in on
   each when progress crosses.  Hidden by default, fade up
   when triggered. */
.bvb-scale-items {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px 14px;
  max-width: 760px;
}

.bvb-scale-item {
  font-family: var(--font-code, "IBM Plex Mono"), monospace;
  font-size: var(--mkt-body-xs);
  font-weight: 500;
  letter-spacing: -0.005em;
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  opacity: 0;
  transform: translateY(8px);
  transition:
    opacity 520ms cubic-bezier(0.22, 1, 0.36, 1),
    transform 520ms cubic-bezier(0.22, 1, 0.36, 1);
}

.bvb-scale-item.is-in {
  opacity: 1;
  transform: none;
}

/* ── Rail (bottom) ───────────────────────────────────────
   Horizontal track + fill mirroring --progress.  4 clickable
   tick labels below.  All white-on-dark per the dark BG. */
.bvb-rail {
  width: 100%;
  max-width: 640px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.bvb-rail-track {
  position: relative;
  height: 3px;
  background: var(--border-subtle);
  border-radius: 999px;
  overflow: hidden;
}

.bvb-rail-fill {
  position: absolute;
  inset: 0 auto 0 0;
  width: calc(var(--progress) * 100%);
  background: var(--text-primary);
  border-radius: inherit;
}

.bvb-rail-ticks {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
}

.bvb-rail-tick {
  appearance: none;
  -webkit-appearance: none;
  background: none;
  border: none;
  font-family: var(--font-base);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-tertiary);
  cursor: pointer;
  padding: 4px 6px;
  transition: color 200ms ease;
}

.bvb-rail-tick:first-child { text-align: left; }
.bvb-rail-tick:last-child  { text-align: right; }
.bvb-rail-tick:nth-child(2),
.bvb-rail-tick:nth-child(3) { text-align: center; }

.bvb-rail-tick:hover { color: var(--text-primary); }

/* ── Wide-desktop tiers ────────────────────────────────── */

/* Cursor portal scope on this page — interactive widgets
   only.  Donut segments + rail ticks carry the spinning O
   on hover (they drive state on the page).  Other links use
   the native hand. */
.bvb-donut-seg,
.bvb-rail-tick,
.back-to-top { cursor: pointer; }

/* ───────────────────────────────────────────────────────────
   Act 2 — Where the hours go.

   Editorial 2-col layout: donut LEFT, copy RIGHT (alignment
   break vs Act 1's centred hero).  Donut is an 8-segment
   ring; stroke-dasharray draws each segment, --rot positions
   each one.  Hover a segment → centre label swaps.  Segments
   stagger-fade in on IO entry.
─────────────────────────────────────────────────────────── */

.bvb-act-2 {
  position: relative;
  background: var(--background);
  color: var(--text-primary);
  padding: clamp(96px, 12vh, 160px) clamp(20px, 4vw, 56px);
  display: flex;
  align-items: center;
  justify-content: center;
}

.bvb-act-2-frame {
  width: 100%;
  max-width: 1180px;
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
  gap: clamp(40px, 6vw, 96px);
  align-items: center;
}

.bvb-donut-wrap {
  --bloom-angle: 0deg;
  position: relative;
  width: 100%;
  max-width: 380px;
  margin: 0 auto;
  aspect-ratio: 1;
  isolation: isolate;
}

/* Purple bloom behind the donut.  At z: -1 so segments
   render above.  Two modes:
     - Idle (.is-idle): bloom is visible at lower opacity and
       slowly orbits the donut continuously (CSS animation).
       The orbit IS the hover affordance — no centre text
       needed.  On first segment hover, JS removes .is-idle.
     - Active (.is-bloomed): bloom rotates to the hovered
       segment's centre angle (--bloom-angle, set by JS) at
       full opacity. */
.bvb-donut-bloom {
  position: absolute;
  inset: -22%;
  z-index: -1;
  pointer-events: none;
  opacity: 0;
  transform: rotate(var(--bloom-angle, 0deg));
  transform-origin: 50% 50%;
  transition:
    opacity 320ms cubic-bezier(0.22, 1, 0.36, 1),
    transform 520ms cubic-bezier(0.22, 1, 0.36, 1);
}

.bvb-donut-bloom::before {
  content: "";
  position: absolute;
  top: -2%;
  left: 50%;
  width: 64%;
  height: 64%;
  transform: translateZ(0) translateX(-50%);
  backface-visibility: hidden;
  background: radial-gradient(
    circle,
    rgba(124, 79, 232, 0.7) 0%,
    rgba(124, 79, 232, 0.25) 30%,
    transparent 65%
  );
  filter: blur(28px);
}

@keyframes bvb-bloom-orbit {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

/* Idle: visible at lower opacity, continuously orbiting.
   Animation overrides the transform: rotate(var(--bloom-angle))
   on the base rule, so the manual angle is dormant while
   idle. */
.bvb-donut-wrap.is-idle .bvb-donut-bloom {
  opacity: 0.58;
  animation: bvb-bloom-orbit 9s linear infinite;
  /* No transition on transform during orbit — we let CSS
     animate freely.  Opacity transition still applies. */
  transition: opacity 320ms cubic-bezier(0.22, 1, 0.36, 1);
}

.bvb-donut-wrap.is-bloomed .bvb-donut-bloom { opacity: 1; }

.bvb-donut {
  width: 100%;
  height: 100%;
  display: block;
}

.bvb-donut-ring {
  fill: none;
  stroke: var(--border-subtle);
  stroke-width: 36;
}

.bvb-donut-seg {
  fill: none;
  /* DS muted grey by default — desaturated so the donut at
     rest doesn't compete with the rest of the page.  Hover
     bumps the colour to brand purple. */
  stroke: var(--text-tertiary);
  stroke-width: 36;
  /* Dash is the arc length minus 3 (the gap between slices
     reads as a thin black sliver between solid segments).
     Gap is huge so only one arc renders per circle. */
  stroke-dasharray: var(--dash, 0) 9999;
  transform: rotate(var(--rot, 0deg));
  transform-origin: 140px 140px;
  pointer-events: stroke;
  opacity: 0;
  transition:
    opacity 520ms cubic-bezier(0.22, 1, 0.36, 1),
    stroke 280ms ease,
    stroke-width 280ms cubic-bezier(0.22, 1, 0.36, 1);
}

/* Sequential reveal on IO entry — segments fade to full
   opacity, but the DS-tertiary stroke keeps them quiet. */
.bvb-act-2.is-in .bvb-donut-seg { opacity: 0.85; }

/* Per-index delay applies ONLY to the opacity transition
   (the IO arrival stagger).  Stroke + stroke-width keep
   their 0ms delay so hover swaps in immediately without
   per-slice lag. */
.bvb-act-2.is-in .bvb-donut-seg[data-i="0"] { transition-delay: 120ms, 0ms, 0ms; }
.bvb-act-2.is-in .bvb-donut-seg[data-i="1"] { transition-delay: 220ms, 0ms, 0ms; }
.bvb-act-2.is-in .bvb-donut-seg[data-i="2"] { transition-delay: 320ms, 0ms, 0ms; }
.bvb-act-2.is-in .bvb-donut-seg[data-i="3"] { transition-delay: 420ms, 0ms, 0ms; }
.bvb-act-2.is-in .bvb-donut-seg[data-i="4"] { transition-delay: 520ms, 0ms, 0ms; }
.bvb-act-2.is-in .bvb-donut-seg[data-i="5"] { transition-delay: 620ms, 0ms, 0ms; }
.bvb-act-2.is-in .bvb-donut-seg[data-i="6"] { transition-delay: 720ms, 0ms, 0ms; }
.bvb-act-2.is-in .bvb-donut-seg[data-i="7"] { transition-delay: 820ms, 0ms, 0ms; }

/* Hover any segment → brand purple + thicker stroke.  Others
   dim so the focus is unambiguous (but stay visible since
   the base is already a quiet DS grey). */
.bvb-donut:hover .bvb-donut-seg { opacity: 0.4; }

.bvb-donut-seg:hover {
  opacity: 1 !important;
  stroke: #7C4FE8;
  stroke-width: 44;
}

/* ── Centre label ─────────────────────────────────────── */
.bvb-donut-label {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 4px;
  pointer-events: none;
}

.bvb-donut-label-name {
  font-family: var(--font-base);
  font-size: var(--mkt-body-sm);
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--text-primary);
  max-width: 12ch;
  line-height: 1.25;
  text-wrap: balance;
}

.bvb-donut-label-pct {
  font-family: var(--font-display, var(--font-base));
  font-size: var(--mkt-h3);
  line-height: 1;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
  min-height: 1em;
}

/* Centre label is empty until first hover.  No text, no
   pulse — the orbiting purple bloom behind the donut is the
   sole affordance.  JS populates name + pct on segment hover. */
.bvb-donut-label-pct:empty { display: none; }
.bvb-donut-label-name:empty { display: none; }

/* ── Editorial side (right column) ────────────────────── */
.bvb-act-2-head {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  text-align: left;
  gap: clamp(14px, 1.6vw, 22px);
  max-width: 48ch;
}

.bvb-act-2-h2 {
  margin: 0;
  font-family: var(--font-display, var(--font-base));
  font-size: var(--mkt-hero);
  line-height: 1.02;
  letter-spacing: -0.03em;
  font-weight: 500;
  color: var(--text-primary);
  text-wrap: balance;
}

.bvb-act-2-em {
  font-style: normal;
  font-weight: 500;
}

.bvb-act-2-sub {
  margin: 0;
  font-family: var(--font-base);
  font-size: var(--mkt-body);
  line-height: 1.55;
  color: var(--text-secondary);
}

/* ───────────────────────────────────────────────────────────
   Act 3 — Closer.

   Centred brand-return on dark.  Two-line H2 with the second
   phrase in italic em.  Canonical CTA stack + secondary.
─────────────────────────────────────────────────────────── */

.bvb-act-3 {
  position: relative;
  background: var(--background);
  color: var(--text-primary);
  padding: clamp(120px, 18vh, 220px) clamp(20px, 4vw, 56px);
  display: flex;
  align-items: center;
  justify-content: center;
}

.bvb-act-3-frame {
  width: 100%;
  max-width: 920px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: clamp(24px, 2.6vw, 36px);
}

.bvb-act-3-kicker { margin: 0; }

.bvb-act-3-h2 {
  margin: 0;
  font-family: var(--font-display, var(--font-base));
  font-size: var(--mkt-hero);
  line-height: 1.02;
  letter-spacing: -0.03em;
  font-weight: 500;
  color: var(--text-primary);
  max-width: 18ch;
  text-wrap: balance;
}

.bvb-act-3-em {
  font-style: normal;
  font-weight: 500;
  color: var(--text-primary);
}

.bvb-act-3-cta {
  margin-top: clamp(8px, 1vw, 16px);
  gap: 14px;
}

.bvb-act-3-secondary {
  font-family: var(--font-base);
  font-size: var(--text-small, 13px);
  font-weight: 600;
  color: var(--text-primary);
  text-decoration: underline;
  text-underline-offset: 4px;
  text-decoration-thickness: 1.5px;
  text-decoration-color: rgba(255, 255, 255, 0.3);
  transition: text-decoration-color 180ms;
}

.bvb-act-3-secondary:hover { text-decoration-color: rgba(255, 255, 255, 0.8); }

/* Wide-desktop tiers — bigger displays have more vertical
   room so the type can scale up.  Caps tuned so the full
   stack still fits inside a single viewport at every tier. */
@media (min-width: 1600px) {
  .bvb-act-1-frame { max-width: 1280px; gap: clamp(24px, 2.8vw, 48px); }
  
  .bvb-hero-sub { font-size: 20px; }
  
  .bvb-scale-num { font-size: clamp(120px, 10vw, 200px); }
  .bvb-rail { max-width: 720px; }
  /* Act 2 grows aggressively on big screens — donut becomes
     the dominant visual, H2 + sub scale up alongside. */
  .bvb-act-2-frame { max-width: 1440px; gap: clamp(64px, 7vw, 128px); }
  .bvb-donut-wrap { max-width: 520px; }
  
  .bvb-act-2-sub { font-size: 20px; }
  .bvb-donut-label-name { font-size: 18px; }
  .bvb-donut-label-pct { font-size: clamp(40px, 3.4vw, 56px); }
}

@media (min-width: 1920px) {
  .bvb-act-1-frame { max-width: 1440px; }
  
  .bvb-hero-sub { font-size: 22px; }
  
  .bvb-scale-num { font-size: clamp(160px, 10vw, 240px); }
  .bvb-act-2-frame { max-width: 1680px; }
  .bvb-donut-wrap { max-width: 620px; }
  
  .bvb-act-2-sub { font-size: 24px; }
  .bvb-donut-label-name { font-size: 22px; }
  .bvb-donut-label-pct { font-size: clamp(52px, 3.4vw, 72px); }
}

@media (min-width: 2400px) {
  .bvb-act-1-frame { max-width: 1680px; }
  
  
  .bvb-scale-num { font-size: 280px; }
  .bvb-act-2-frame { max-width: 2000px; }
  .bvb-donut-wrap { max-width: 760px; }
  
  .bvb-act-2-sub { font-size: 26px; }
  .bvb-donut-label-name { font-size: 26px; }
  .bvb-donut-label-pct { font-size: 88px; }
}

/* Short laptops (13" MBP, 14" base) — compress everything
   further so the stack fits without overflowing the viewport. */
@media (max-height: 820px) and (min-width: 600px) {
  .bvb-act-1-frame { gap: 16px; padding-top: 56px; padding-bottom: 56px; }
  
  .bvb-hero-sub { font-size: 14px; }
  
  .bvb-scale-num { font-size: clamp(64px, 9vw, 132px); }
  .bvb-scale-caption { font-size: 10px; letter-spacing: 0.14em; margin-top: 6px; }
  .bvb-scale-item { padding: 5px 10px; font-size: 11px; }
  .bvb-rail-tick { font-size: 10px; }
}

/* Mobile + narrow: Act 2 stacks (donut on top, copy below). */
@media (max-width: 880px) {
  .bvb-act-2-frame { grid-template-columns: 1fr; gap: 40px; }
  .bvb-donut-wrap { max-width: 320px; }
  .bvb-act-2-head { align-items: center; text-align: center; }
}

/* ── Mobile ──────────────────────────────────────────────
   Sticky scroll-stage drops on phones; section collapses to
   a static stack with all items visible at once.  Touch
   users don't pay the scroll-fight tax. */
@media (max-width: 600px) {
  .bvb-act-1 { height: auto; }
  .bvb-act-1-frame {
    position: static;
    height: auto;
    padding: clamp(80px, 14vh, 140px) clamp(20px, 4vw, 32px);
    gap: 28px;
  }
  .bvb-hero-h1 { font-size: var(--mkt-h2); max-width: 16ch; }
  .bvb-hero-sub { font-size: 15px; }
  
  .bvb-scale-num { font-size: clamp(72px, 22vw, 120px); }
  .bvb-scale-caption { font-size: 10px; letter-spacing: 0.16em; }
  /* All items visible on mobile (no scroll progress drive). */
  .bvb-scale-item { opacity: 1; transform: none; }
  .bvb-rail-tick { font-size: 10px; padding: 4px 4px; }

  /* Act 2 mobile — smaller donut + tighter section padding.
     Hover doesn't fire on touch, so the centre label stays
     in "Hover a slice" idle state — fine on phones, the
     donut shows the breakdown visually via segment widths. */
  .bvb-act-2 { padding: clamp(80px, 14vh, 140px) clamp(20px, 4vw, 32px); }
  .bvb-donut-wrap { max-width: 260px; }
  
  .bvb-donut-label-name { font-size: 12px; }
  .bvb-donut-label-pct { font-size: 24px; }

  /* Act 3 closer mobile — tighter padding + scale. */
  .bvb-act-3 { padding: clamp(80px, 14vh, 140px) clamp(20px, 4vw, 32px); }
  
}

/* ══════════════════════════════════════════════════════════
   BU light overrides.  --font-display auto-flips to Mq12 via
   DS-level override.
═══════════════════════════════════════════════════════════ */
html:not(.dark) body {
  background: var(--zen-gray-3);
  color: var(--text-primary);
}

html:not(.dark) .bvb-scale-item { background: rgba(29, 22, 18, 0.04); }
html:not(.dark) .bvb-act-3-secondary { text-decoration-color: rgba(29, 22, 18, 0.3); }
html:not(.dark) .bvb-act-3-secondary:hover { text-decoration-color: rgba(29, 22, 18, 0.8); }

@media (max-width: 600px) {
  .bvb-donut-bloom { inset: 0; }
  .bvb-donut-wrap { overflow: hidden; }
}
