/* ==========================================================================
   Agency comparison — components/marketing/AgencyCompare.tsx.

   Loaded per page through ServicePageData.extraStyles on the web-design
   pages. The section header uses offer.css (.ofr__eyebrow, .ofr__h2,
   .ofr__lead), which ServicePage always loads; this sheet owns the rows.

   NAMESPACE. `acm-`. The palette is declared here with fallbacks rather than
   inherited from .svcd-section, because /architected-websites/ does not load
   service-devices.css and the section has to look the same everywhere.

   THE TWO COLUMNS follow the site's rule (service-devices.css, .svcd-panel):
   a dashed border means the old way, a lit purple panel means ours.

   MOTION CONTRACT. Everything ships finished. From-states live only behind
   html.has-motion, which motion.js adds solely under
   prefers-reduced-motion: no-preference. .is-in is set on [data-stage] by
   motion.js, with an IntersectionObserver fallback in offer.js.
   ========================================================================== */

.acm {
  --surface: #0a0a0f;
  --surface-2: #101018;
  --card-border: #1a1a24;
  --purple: #6119ac;
  --purple-light: #8b5cf6;
  --purple-glow: #7c3aed;
  --purple-border: rgba(139, 92, 246, 0.22);
  --text-primary: #ffffff;
  --text-body: #e8e8f0;
  --text-secondary: #a1a1b5;
  --text-muted: #8a8a95;
}

/* --- Column headers ---------------------------------------------------------- */

.acm__cols {
  margin-top: clamp(2rem, 4vw, 3rem);
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr);
  gap: clamp(1rem, 2vw, 1.5rem);
  /* Indented past the topic column so the headers sit over the two cells. */
  padding-left: clamp(9rem, 16vw, 12rem);
}

.acm__col {
  font-family: var(--font-display);
  font-stretch: var(--wdth-display, 108%);
  font-weight: 600;
  font-size: var(--step--2);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding-bottom: 0.6rem;
}

.acm__col--agency {
  color: var(--text-muted);
  border-bottom: 1px dashed var(--card-border);
}

.acm__col--arcrel {
  color: var(--purple-light);
  border-bottom: 1px solid var(--purple-border);
}

/* --- Rows -------------------------------------------------------------------- */

.acm__rows {
  margin-top: 0.75rem;
  list-style: none;
  display: grid;
  gap: 0.6rem;
}

.acm__row {
  display: grid;
  grid-template-columns: clamp(8rem, 15vw, 11rem) minmax(0, 1fr) minmax(0, 1.15fr);
  gap: clamp(1rem, 2vw, 1.5rem);
  align-items: stretch;
}

.acm__topic {
  padding-top: 1.1rem;
  font-family: var(--font-display);
  font-stretch: var(--wdth-display, 108%);
  font-weight: 700;
  font-size: var(--step-0);
  line-height: 1.3;
  color: var(--text-primary);
}

/* Body size, not caption size. Anthony flagged the small-type version of
   these cells as hard to read (2026-11-01); the rows are the argument of
   the section, so they get the same size as running copy. */
.acm__agency,
.acm__arcrel {
  position: relative;
  margin: 0;
  padding: 1.1rem 1.25rem;
  font-size: var(--step-0);
  line-height: 1.6;
}

/* The old way: a dashed outline and quieter type. No strikethrough; the dashed
   rule is the marker, and struck text is hard to read. Secondary rather than
   muted so it stays legible against the dark surface. */
.acm__agency {
  border: 1px dashed var(--divider, #2a2a3d);
  border-radius: var(--radius-lg, 10px);
  color: var(--text-secondary);
}

/* Ours: the lit panel. */
.acm__arcrel {
  border: 1px solid var(--purple-border);
  border-radius: var(--radius-lg, 10px);
  background: radial-gradient(120% 120% at 50% 0%, rgba(97, 25, 172, 0.22), transparent 60%),
    var(--surface-2);
  color: var(--text-body);
  overflow: hidden;
}

.acm__arcrel::before {
  content: "";
  position: absolute;
  top: 0;
  left: 20%;
  right: 20%;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--purple), transparent);
}

/* Which stage of the system the row belongs to. */
.acm__stage {
  float: right;
  margin: 0.1rem 0 0.4rem 0.9rem;
  padding: 0.25em 0.6em;
  border: 1px solid var(--purple-border);
  border-radius: 999px;
  font-family: var(--font-display);
  font-stretch: var(--wdth-display, 108%);
  font-weight: 600;
  font-size: var(--step--2);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--purple-light);
}

/* The per-cell "Agency" / "Arcrel" label. Hidden on desktop, where the column
   headers carry it; shown once the rows stack. */
.acm__who {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* --- Kicker ------------------------------------------------------------------
   Same device as .svcd-kicker, declared here so the hub gets it too. */

.acm__kicker {
  position: relative;
  overflow: hidden;
  margin-top: clamp(1.75rem, 3.5vw, 2.5rem);
  padding: 1rem 1.25rem;
  border-radius: var(--radius-lg, 10px);
  background: linear-gradient(180deg, rgba(97, 25, 172, 0.14), transparent 85%);
  font-family: var(--font-display);
  font-stretch: var(--wdth-display, 108%);
  font-weight: 700;
  font-size: var(--step-1);
  line-height: 1.4;
  color: var(--text-primary);
  max-width: 46ch;
}

.acm__kicker::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--purple), transparent);
}

/* --- Motion ------------------------------------------------------------------ */

.has-motion .acm__row {
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 0.7s var(--ease-out, cubic-bezier(0.16, 1, 0.3, 1)) var(--fd, 0s),
    transform 0.7s var(--ease-out, cubic-bezier(0.16, 1, 0.3, 1)) var(--fd, 0s);
}

.has-motion .acm__rows.is-in .acm__row {
  opacity: 1;
  transform: none;
}

/* The panels light after the row has landed. */
.has-motion .acm__arcrel {
  box-shadow: 0 0 0 rgba(97, 25, 172, 0);
  transition: box-shadow 0.9s var(--ease-out, cubic-bezier(0.16, 1, 0.3, 1)) calc(var(--fd, 0s) + 0.35s);
}

.has-motion .acm__rows.is-in .acm__arcrel {
  box-shadow: 0 16px 48px rgba(97, 25, 172, 0.16);
}

/* --- Responsive -------------------------------------------------------------- */

@media (max-width: 980px) {
  .acm__cols {
    display: none;
  }

  .acm__row {
    grid-template-columns: 1fr;
    gap: 0.5rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--card-border);
  }

  .acm__rows {
    gap: 0.75rem;
  }

  .acm__topic {
    padding-top: 0;
  }

  .acm__who {
    position: static;
    width: auto;
    height: auto;
    clip: auto;
    display: block;
    margin-bottom: 0.35rem;
    font-family: var(--font-display);
    font-stretch: var(--wdth-display, 108%);
    font-weight: 600;
    font-size: var(--step--2);
    letter-spacing: 0.12em;
    text-transform: uppercase;
  }

  .acm__agency .acm__who {
    color: var(--text-muted);
  }

  .acm__arcrel .acm__who {
    color: var(--purple-light);
  }
}

@media (max-width: 640px) {
  .acm__agency,
  .acm__arcrel {
    padding: 0.85rem 0.95rem;
  }

  /* On its own line above the text, rather than floated into it. */
  .acm__stage {
    float: none;
    display: block;
    width: fit-content;
    margin: 0 0 0.5rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .acm__row,
  .acm__arcrel {
    transition: none;
  }
}
