/* ==========================================================================
   CWS — "The variable" comparison module
   Everything is scoped to .cws-var. Nothing here can reach the theme,
   and nothing in the theme can reach in.
   ========================================================================== */

.cws-var {
  /* Accent colours are overridden inline by the module's colour fields */
  --cws-var-risk: #FDC300;
  --cws-var-good: #0E5A48;

  --cws-var-ink: #0f1f1a;
  --cws-var-body: #26332e;
  --cws-var-muted: #5a6b65;
  --cws-var-hair: #d7e0dc;
  --cws-var-mist: #f1f5f3;

  /* The module fills whatever container the HubSpot row gives it, so it
     lines up with the heading and body copy around it. Set a value here
     only if you drop it into a full-bleed row that has no width of its own. */
  --cws-var-max: none;
  --cws-var-gutter: 0;

  font-family: 'Montserrat', -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
  color: var(--cws-var-body);
  box-sizing: border-box;
}

.cws-var *,
.cws-var *::before,
.cws-var *::after { box-sizing: border-box; }

.cws-var__wrap {
  width: 100%;
  max-width: var(--cws-var-max);
  margin-left: auto;
  margin-right: auto;
  padding-left: var(--cws-var-gutter);
  padding-right: var(--cws-var-gutter);
}

/* --------------------------------------------------------- stage */

.cws-var__stage {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  border: 1px solid var(--cws-var-hair);
  border-radius: 16px;
  overflow: hidden;
  background: #fff;
}

.cws-var__panel { padding: clamp(1.5rem, 2.5vw, 2.2rem); }

.cws-var__panel--risk { background: #fffdf4; }
.cws-var__panel--good { background: #f2fbf7; }

@supports (background: color-mix(in srgb, red 8%, transparent)) {
  .cws-var__panel--risk {
    background: linear-gradient(180deg, color-mix(in srgb, var(--cws-var-risk) 9%, #fff), #fff);
  }
  .cws-var__panel--good {
    background: linear-gradient(180deg, color-mix(in srgb, var(--cws-var-good) 9%, #fff), #fff);
  }
}

.cws-var__plabel {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 0.3rem;
}

.cws-var__dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex: none;
}

.cws-var__panel--risk .cws-var__dot { background: var(--cws-var-risk); }
.cws-var__panel--good .cws-var__dot { background: var(--cws-var-good); }

.cws-var__plabel span:last-child {
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--cws-var-muted);
}

.cws-var__ptitle {
  font-family: inherit;
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--cws-var-ink);
  letter-spacing: -0.01em;
  margin: 0 0 1.1rem;
}

/* --------------------------------------------------------- scene */

.cws-var__scene {
  position: relative;
  aspect-ratio: 16 / 11;
  border-radius: 12px;
  background: var(--cws-var-mist);
  overflow: hidden;
}

/* aspect-ratio fallback for older browsers */
@supports not (aspect-ratio: 16 / 11) {
  .cws-var__scene { height: 0; padding-bottom: 68.75%; }
}

.cws-var__grid {
  position: absolute;
  inset: 0;
  opacity: 0.5;
  background-image:
    linear-gradient(var(--cws-var-hair) 1px, transparent 1px),
    linear-gradient(90deg, var(--cws-var-hair) 1px, transparent 1px);
  background-size: 28px 28px;
}

.cws-var__floor {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 26%;
  background: linear-gradient(180deg, rgba(15, 31, 26, 0.05), rgba(15, 31, 26, 0.09));
}

.cws-var__figure {
  position: absolute;
  left: 50%;
  bottom: 8%;
  transform: translateX(-50%);
  height: 62%;
  width: auto;
  z-index: 2;
}

.cws-var__figure path,
.cws-var__figure circle { fill: var(--cws-var-ink); }

/* --------------------------------------------------------- particles */

.cws-var__particles {
  position: absolute;
  inset: 0;
  z-index: 1;
}

.cws-var__p {
  position: absolute;
  border-radius: 50%;
  opacity: 0;
  will-change: transform, opacity;
}

.cws-var__panel--risk .cws-var__p { background: var(--cws-var-risk); }
.cws-var__panel--good .cws-var__p { background: var(--cws-var-good); }

/* Particles loop continuously once the module is armed */
.cws-var.is-live .cws-var__p {
  animation-name: cwsVarShed;
  animation-timing-function: ease-out;
  animation-iteration-count: infinite;
}

@keyframes cwsVarShed {
  0%   { opacity: 0;    transform: translate(0, 0) scale(0.5); }
  12%  { opacity: 0.9; }
  70%  { opacity: 0.55; }
  100% { opacity: 0;    transform: translate(var(--dx), var(--dy)) scale(1.15); }
}

/* --------------------------------------------------------- readout */

.cws-var__count {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  margin-top: 1.1rem;
}

.cws-var__num {
  font-family: inherit;
  font-weight: 600;
  font-size: clamp(1.9rem, 3.6vw, 2.6rem);
  line-height: 1;
  letter-spacing: -0.02em;
  color: var(--cws-var-ink);
  font-variant-numeric: tabular-nums;
}

.cws-var__panel--good .cws-var__num { color: var(--cws-var-good); }

.cws-var__unit {
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--cws-var-muted);
  letter-spacing: 0.02em;
}

.cws-var__bar {
  height: 6px;
  border-radius: 99px;
  background: var(--cws-var-hair);
  margin-top: 0.8rem;
  overflow: hidden;
}

.cws-var__fill {
  display: block;
  height: 100%;
  width: 0;
  border-radius: 99px;
  transition: width 1.4s cubic-bezier(0.22, 0.7, 0.24, 1);
}

.cws-var__panel--risk .cws-var__fill { background: var(--cws-var-risk); }
.cws-var__panel--good .cws-var__fill { background: var(--cws-var-good); }

.cws-var__note {
  font-size: 0.9rem;
  line-height: 1.55;
  color: var(--cws-var-muted);
  margin: 0.9rem 0 0;
}

/* --------------------------------------------------------- divider + foot */

.cws-var__divide {
  width: 1px;
  background: var(--cws-var-hair);
}

.cws-var__foot {
  font-size: 0.78rem;
  line-height: 1.6;
  color: var(--cws-var-muted);
  margin: 1.3rem 0 0;
}

/* --------------------------------------------------------- responsive */

@media (max-width: 900px) {
  .cws-var__stage { grid-template-columns: 1fr; border-radius: 14px; }
  .cws-var__divide { width: auto; height: 1px; }
}

/* --------------------------------------------------------- motion */

@media (prefers-reduced-motion: reduce) {
  .cws-var.is-live .cws-var__p { animation: none; opacity: 0.75; }
  .cws-var__fill { transition: none; }
}
