/* ============================================================
   TrueMetriks - comparison pages (/compare/<slug>) and the hub (/compare)
   Loaded ONLY by those pages, after analytics.css, which supplies the
   an-* layout (hero, sections, cards, FAQ, CTA, close).
   This file holds only what is comparison-specific. The class names
   below are the contract tests/compare_check.py reads; do not rename.
   One breakpoint: 768px. No animations.
   ============================================================ */


/* --- Breadcrumb --- */
.cmp-crumb { margin: 0 0 var(--space-4); }
.cmp-crumb ol {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 4px 8px;
  font-size: 14px;
  color: var(--color-text-subtle);
}
.cmp-crumb li + li::before { content: "/"; margin-right: 8px; color: var(--color-border-strong); }
.cmp-crumb a { color: var(--color-link-bright); font-weight: var(--font-weight-semibold); }
.cmp-crumb a:hover { color: var(--color-link-bright-hover); }

/* Hero trust line under the lead */
.cmp-trust {
  margin: var(--space-4) auto 0;
  max-width: 62ch;
  font-size: 15px;
  font-weight: var(--font-weight-semibold);
  color: var(--color-text-subtle);
}

/* Section heads: centred H2 + optional lead, like the homepage */
.cmp-head { text-align: center; }
.cmp-head .an-lead { margin-bottom: 0; }

/* --- Quick answer: two columns, the competitor second --- */
.cmp-choose {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-5);
  margin-top: var(--space-6);
}
.cmp-choose__tm { border-top: 4px solid var(--color-brand); }
.cmp-choose__them { border-top: 4px solid #9AA1B5; }
.cmp-choose h3 { font-size: 22px; margin-bottom: var(--space-4); }
.cmp-choose ul { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--space-4); }
.cmp-choose li {
  position: relative;
  padding-left: 28px;
  font-size: 17px;
  line-height: 1.6;
  color: var(--color-text-muted);
}
.cmp-choose li::before {
  content: "\2713";
  position: absolute;
  left: 0;
  top: 0;
  font-weight: var(--font-weight-extra);
  color: var(--color-brand);
}
.cmp-choose__them li::before { color: #6B7280; }

/* --- Two things side by side (diagrams, price cards, related links) --- */
.cmp-pair {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-5);
  margin-top: var(--space-6);
}
.cmp-pair > * { min-width: 0; }

/* --- Drawn flow diagrams (HTML boxes and arrows, no images) --- */
.cmp-flow {
  margin: 0;
  padding: var(--space-5);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-md);
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}
.cmp-flow h3 {
  margin: 0;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--color-text-subtle);
}
.cmp-flow__steps { display: flex; align-items: center; gap: 4px; }
.cmp-flow__box {
  flex: 1 1 0;
  min-width: 0;
  padding: 10px 6px;
  border: 1px solid #C9CFDF;
  border-radius: var(--radius-md);
  background: #F4F6FA;
  color: #2E3340;
  font-size: 13px;
  font-weight: var(--font-weight-semibold);
  line-height: 1.35;
  text-align: center;
  overflow-wrap: break-word;
}
.cmp-flow__box--key { background: var(--color-brand); border-color: var(--color-brand); color: #FFFFFF; }
.cmp-flow__box--off { background: transparent; border-style: dashed; color: #6B7280; font-weight: var(--font-weight-regular); }
.cmp-flow__arrow { flex: none; color: #9AA1B5; font-size: 16px; line-height: 1; }
/* A step that fans out into two outputs */
.cmp-flow__split { flex: 1.4 1 0; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.cmp-flow__split .cmp-flow__box { flex: none; }
/* Large variant: our own diagram, full width and easier to read */
.cmp-flow--lg { width: 100%; padding: var(--space-6); }
.cmp-flow--lg .cmp-flow__steps { gap: 8px; }
.cmp-flow--lg .cmp-flow__box { padding: 18px 12px; font-size: 16px; }
.cmp-flow--lg .cmp-flow__arrow { font-size: 22px; }
.cmp-flow figcaption { font-size: 15px; line-height: 1.6; color: var(--color-text-muted); }

/* --- Side-by-side table --- */
.cmp-table-wrap {
  margin-top: var(--space-6);
  overflow: clip; /* not a scroll box, so the header row can stick; the table is built to fit 360px */
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-md);
}
/* caption and the empty first header use base.css .sr-only */
.cmp-table { width: 100%; border-collapse: collapse; table-layout: fixed; font-size: 16px; line-height: 1.5; }
.cmp-table th, .cmp-table td {
  padding: 14px 18px;
  text-align: left;
  vertical-align: top;
  border-top: 1px solid var(--color-border);
  overflow-wrap: break-word;
}
.cmp-table thead th {
  position: sticky;
  top: var(--nav-height);
  z-index: 2;
  box-shadow: inset 0 -1px 0 var(--color-border);
  border-top: 0;
  background: #F4F6FC;
  font-size: 15px;
  font-weight: var(--font-weight-bold);
  color: var(--color-text);
}
.cmp-table thead th:first-child { width: 34%; }
.cmp-table thead th:nth-child(2) { color: var(--color-brand); box-shadow: inset 0 -3px 0 var(--color-brand); }
/* Column rules: keep TrueMetriks and the other tool apart all the way down */
.cmp-table thead th + th,
.cmp-table tbody th[scope="row"] + td,
.cmp-table tbody td + td { border-left: 1px solid var(--color-border); }
.cmp-table th[scope="colgroup"] {
  background: #EEF1FA;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #2E3340;
}
.cmp-table th[scope="row"] { font-weight: var(--font-weight-semibold); color: var(--color-text); }
.cmp-table td { color: var(--color-text-muted); }
.cmp-table td:nth-child(2) { background: rgba(34, 51, 255, 0.06); color: var(--color-text); }

/* --- Footnote markers and the sources list --- */
/* inline-block so a marker can wrap to the next line instead of splitting the word before it */
.cmp-fn { display: inline-block; font-size: 0.7em; line-height: 1; vertical-align: super; margin-left: 1px; }
.cmp-fn a {
  padding: 0 2px;
  color: var(--color-link-bright);
  font-weight: var(--font-weight-bold);
  text-decoration: none;
}
.cmp-fn a:hover { text-decoration: underline; }
.cmp-sources {
  margin: var(--space-6) 0 0;
  padding-left: 1.6em;
  list-style: decimal;
  display: grid;
  gap: var(--space-3);
  font-size: 15px;
  line-height: 1.6;
  color: var(--color-text-muted);
}
.cmp-sources li::marker { font-weight: var(--font-weight-bold); color: var(--color-text); }
.cmp-sources li { padding: 2px 6px; border-radius: var(--radius-sm); scroll-margin-top: 96px; }
.cmp-sources li:target { background: #FFF4D6; }
.cmp-sources a { color: var(--color-link-bright); overflow-wrap: anywhere; }
.cmp-note {
  margin-top: var(--space-6);
  padding: var(--space-4) var(--space-5);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  background: var(--color-surface);
  font-size: 15px;
  line-height: 1.6;
  color: var(--color-text-muted);
}
.cmp-note a { color: var(--color-link-bright); font-weight: var(--font-weight-semibold); }

/* --- Where TrueMetriks is better: text + widget blocks --- */
/* .cmp-widget: marker class (no styling) on the root of every inlined dashboard widget
   (figure.an-mini and each figure.widget replica). The checker skips its demo amounts. */
.cmp-better { margin-top: var(--space-6); }
.cmp-better + .cmp-better { margin-top: var(--space-8); }
/* More room between the "Where TrueMetriks is better" title and its first block */
.cmp-head + .cmp-better { margin-top: var(--space-7); }
.cmp-better h3 { font-size: clamp(24px, 2.4vw, 30px); letter-spacing: -0.02em; margin-bottom: var(--space-3); }
.cmp-better--wide .an-feature__text { max-width: 760px; }
.cmp-better .an-widget-side .an-mini { margin: 0; box-shadow: var(--shadow-md); background: var(--color-surface); }
/* Events-sent card: GA4 as a text chip next to the platform logos */
.cmp-chip {
  display: inline-flex;
  align-items: center;
  height: 16px;
  padding: 0 5px;
  border-radius: 4px;
  background: #E8EAF1;
  color: #2E3340;
  font-size: 10px;
  font-weight: var(--font-weight-extra);
  line-height: 1;
}

/* --- Where the competitor is better --- */
.cmp-wins { list-style: none; margin: var(--space-6) 0 0; padding: 0; display: grid; gap: var(--space-4); }
.cmp-wins li {
  position: relative;
  padding: var(--space-4) var(--space-5) var(--space-4) 52px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  font-size: 17px;
  line-height: 1.6;
  color: var(--color-text-muted);
}
.cmp-wins li::before {
  content: "\2713";
  position: absolute;
  left: var(--space-5);
  top: var(--space-4);
  font-weight: var(--font-weight-extra);
  color: #6B7280;
}

/* --- Price cards --- */
.cmp-price h3 { font-size: 22px; margin-bottom: var(--space-3); }
.cmp-price.an-card p + p { margin-top: var(--space-3); }
.cmp-price--tm { border-top: 4px solid var(--color-brand); }
.cmp-price--them { border-top: 4px solid #9AA1B5; }
.cmp-price .an-more { margin-top: var(--space-4); }
.cmp-price__plans { list-style: none; margin: var(--space-2) 0 0; padding: 0; }
.cmp-price__plans li { padding: var(--space-2) 0; border-top: 1px solid var(--color-border); }
.cmp-price__plans li:first-child { border-top: 0; padding-top: 0; }
.cmp-price.an-card ul + p { margin-top: var(--space-3); }

/* --- Related links --- */
.cmp-links { list-style: none; margin: var(--space-3) 0 0; padding: 0; display: grid; gap: var(--space-2); }
.cmp-links a { font-size: 17px; font-weight: var(--font-weight-semibold); color: var(--color-link-bright); }
.cmp-links a:hover { color: var(--color-link-bright-hover); }

/* --- Hub (/compare): groups of cards and the "not the right fit" list --- */
.cmp-hub-group { margin-top: var(--space-7); }
.cmp-hub-group > h2 { font-size: clamp(24px, 2.6vw, 32px); }
.cmp-hub-group:first-child { margin-top: 0; }
.cmp-hub-group__lead { margin-top: var(--space-2); font-size: 17px; line-height: 1.6; color: var(--color-text-muted); }
.cmp-hub-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--space-4);
  margin-top: var(--space-5);
}
.cmp-hub-card {
  display: block;
  padding: var(--space-5);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  color: var(--color-text);
  text-decoration: none;
}
.cmp-hub-card:hover { border-color: var(--color-brand); }
.cmp-hub-card__logo { display: block; width: 40px; height: 40px; margin-bottom: var(--space-3); border-radius: 10px; object-fit: contain; }
.cmp-hub-card b { display: block; font-size: 18px; margin-bottom: var(--space-2); }
.cmp-hub-card span { display: block; font-size: 15px; line-height: 1.55; color: var(--color-text-muted); }
.cmp-hub-card .cmp-hub-card__vs { margin-top: var(--space-3); font-weight: var(--font-weight-semibold); color: var(--color-link-bright); }
.cmp-notfit { list-style: none; margin: var(--space-5) 0 0; padding: 0; display: grid; gap: var(--space-3); }
.cmp-notfit li {
  padding: var(--space-4) var(--space-5);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  font-size: 16px;
  line-height: 1.6;
  color: var(--color-text-muted);
}

/* --- Mobile --- */
@media (max-width: 768px) {
  .cmp-choose, .cmp-pair, .cmp-hub-grid { grid-template-columns: 1fr; }
  .cmp-choose li, .cmp-wins li { font-size: 16px; }
  .cmp-flow__steps { flex-direction: column; align-items: stretch; }
  .cmp-flow__box, .cmp-flow__split { flex: none; }
  .page-compare .widget--mock.mock-tm-intgrid .mock-tm-intgrid__grid,
  .page-compare .widget--mock.mock-tm-stats .mock-tm-stats__grid { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
  .page-compare .widget--mock.mock-tm-intgrid .mock-tm-intgrid__tile { padding: 12px !important; }
  .page-compare .widget--mock.mock-tm-intgrid .mock-tm-intgrid__typeform,
  .page-compare .widget--mock.mock-tm-intgrid .mock-tm-intgrid__calendly,
  .page-compare .widget--mock.mock-tm-intgrid .mock-tm-intgrid__stripe { font-size: 18px !important; }
  .page-compare .widget--mock.mock-tm-stats .mock-tm-stats__row { flex-wrap: wrap !important; row-gap: 4px !important; }
  .page-compare .widget--mock.mock-tm-stats .mock-tm-stats__num { font-size: 24px !important; }
  .page-compare .widget--mock.mock-tm-stats .mock-tm-stats__delta { margin-left: 0 !important; }
  .cmp-flow__arrow { align-self: center; transform: rotate(90deg); }
  .cmp-table { font-size: 13px; }
  .cmp-table th, .cmp-table td { padding: 10px 6px; }
  .cmp-table thead th { font-size: 13px; }
  .cmp-table th[scope="colgroup"] { font-size: 12px; letter-spacing: 0.04em; }
  .cmp-better + .cmp-better { margin-top: var(--space-7); }
  .cmp-wins li { padding: var(--space-3) var(--space-4) var(--space-3) 40px; }
  .cmp-wins li::before { left: var(--space-4); top: var(--space-3); }
  /* Revenue replica: scroll its wide table inside the card instead of clipping it */
  .page-compare .widget--mock.mock-tm-rev-overview .dd-scroll { overflow-x: auto !important; }
  .page-compare .widget--mock.mock-tm-rev-overview .dd-search { width: auto !important; }
  .page-compare .widget--mock.mock-tm-rev-overview .dd-kpi .dd-v { font-size: 18px !important; }
}

/* ------------------------------------------------------------
   DARK MODE: cards stay white (site rule). Scoped mirror of the
   components.css re-pin literals - keep in sync with that list.
   ------------------------------------------------------------ */
[data-theme="dark"] .cmp-flow,
[data-theme="dark"] .cmp-table-wrap,
[data-theme="dark"] .cmp-wins li,
[data-theme="dark"] .cmp-note,
[data-theme="dark"] .cmp-hub-card,
[data-theme="dark"] .cmp-notfit li {
  --surface-tint-1:      #FFFFFF;
  --surface-tint-2:      #F0F3FF;
  --surface-tint-3:      #E1E6FF;
  --color-bg:            #F0F3FF;
  --color-surface:       #FFFFFF;
  --color-surface-alt:   #E1E6FF;
  --color-border:        #D5DAEB;
  --color-border-strong: #B7BFE0;
  --color-text:          #0F0F0F;
  --color-text-muted:    #2E3340;
  --color-text-subtle:   #4B5160;
  color: var(--color-text);
}
