/* ═══════════════════════════════════════════════════════════════════════
   compare.css — the component matrix on /compare/*.

   Loaded by Components/Compare/ComparisonPage.razor and nowhere else.

   The tooltips are CSS, not BbTooltip, on purpose. The matrix is ~120 rows
   with two cells each; rendering ~180 interactive Blazor components on one
   page costs real start-up time and memory in WebAssembly for a hover label.
   Every tick also carries an aria-label, so assistive technology gets the
   component name without the tooltip. Please do not "upgrade" this.
   ═══════════════════════════════════════════════════════════════════════ */

.cmp-wrap {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--background);
  /* the sticky header needs the scroll container to be the page, not this box */
  overflow: visible;
}

.cmp {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

/* ── header, sticky under the 56px site nav ─────────────────────────── */
.cmp-h {
  position: sticky;
  top: 56px;
  z-index: 20;
  padding: 0.75rem 1rem;
  text-align: center;
  font-weight: 600;
  color: var(--foreground);
  background: var(--background);
  border-bottom: 1px solid var(--border);
}
.cmp-h--cap { text-align: start; font-weight: 500; color: var(--muted-foreground); width: 46%; }
.cmp-h:first-child { border-top-left-radius: 12px; }
.cmp-h:last-child  { border-top-right-radius: 12px; }

/* our column keeps the eye — a warm glow behind the header and a tinted column */
.cmp-h--ours {
  background:
    linear-gradient(to bottom, rgba(224, 155, 55, 0.18), rgba(224, 155, 55, 0.04)),
    var(--background);
  box-shadow: inset 0 -2px 0 #E09B37;
}
.cmp-col--ours { background: rgba(224, 155, 55, 0.05); }

/* ── group rows ─────────────────────────────────────────────────────── */
.cmp-group {
  position: sticky;
  top: 99px;               /* 56 nav + 43 header */
  z-index: 10;
  padding: 0.45rem 1rem;
  text-align: start;
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted-foreground);
  background: var(--muted);
  border-bottom: 1px solid var(--border);
}

/* ── body ───────────────────────────────────────────────────────────── */
.cmp-cap {
  padding: 0.55rem 1rem;
  text-align: start;
  font-weight: 400;
  color: var(--foreground);
  border-bottom: 1px solid var(--border);
}
.cmp-col {
  padding: 0.45rem 1rem;
  text-align: center;
  border-bottom: 1px solid var(--border);
}
.cmp tbody:last-child tr:last-child .cmp-cap,
.cmp tbody:last-child tr:last-child .cmp-col { border-bottom: 0; }

.cmp tbody tr:hover .cmp-cap,
.cmp tbody tr:hover .cmp-col { background: color-mix(in srgb, var(--muted) 60%, transparent); }
.cmp tbody tr:hover .cmp-col--ours { background: rgba(224, 155, 55, 0.1); }

/* ── the legend ─────────────────────────────────────────────────────── */
.cmp-key {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.5rem;
  margin: 0 0 1rem;
  padding: 0;
  list-style: none;
  font-size: 0.8125rem;
  color: var(--muted-foreground);
}
.cmp-key li { display: flex; align-items: center; gap: 0.5rem; }

/* ── the four marks ─────────────────────────────────────────────────── */
.cmp-yes, .cmp-no, .cmp-soon, .cmp-na {
  display: inline-grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 999px;
}
.cmp-yes svg, .cmp-no svg, .cmp-soon svg, .cmp-na svg { width: 13px; height: 13px; }

.cmp-yes {
  color: #17835A;
  background: rgba(23, 131, 90, 0.12);
}
.dark .cmp-yes { color: #4ADE9B; background: rgba(74, 222, 155, 0.14); }

.cmp-no {
  color: var(--muted-foreground);
  opacity: 0.4;
}

/* being built — the one amber mark in the table, so it reads as news */
.cmp-soon {
  color: #A9690C;
  background: rgba(224, 155, 55, 0.16);
  cursor: help;
}
.dark .cmp-soon { color: #E09B37; background: rgba(224, 155, 55, 0.18); }

/* not needed — deliberately quiet. Not a win, not a loss. */
.cmp-na {
  color: var(--muted-foreground);
  background: color-mix(in srgb, var(--muted) 70%, transparent);
  cursor: help;
}

.cmp-yes--link { cursor: pointer; transition: transform 0.12s ease, background 0.12s linear; }
.cmp-yes--link:hover { transform: scale(1.12); background: rgba(23, 131, 90, 0.22); }

/* ── tooltip ────────────────────────────────────────────────────────── */
.cmp-tip { position: relative; }
.cmp-tip--help {
  text-decoration: underline dotted var(--muted-foreground);
  text-underline-offset: 3px;
  cursor: help;
}

.cmp-tip::after {
  content: attr(data-tip);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%) translateY(2px);
  z-index: 40;
  width: max-content;
  max-width: 17rem;
  padding: 0.4rem 0.6rem;
  border-radius: 6px;
  background: var(--foreground);
  color: var(--background);
  font-size: 0.75rem;
  font-weight: 400;
  line-height: 1.45;
  text-align: center;
  text-transform: none;
  letter-spacing: normal;
  white-space: normal;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.12s linear, transform 0.12s ease;
}
/* the little arrow */
.cmp-tip::before {
  content: '';
  position: absolute;
  bottom: calc(100% + 3px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 41;
  border: 5px solid transparent;
  border-top-color: var(--foreground);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.12s linear;
}
.cmp-tip:hover::after, .cmp-tip:focus-visible::after {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
.cmp-tip:hover::before, .cmp-tip:focus-visible::before { opacity: 1; }

/* the capability column sits at the left edge, so keep its tooltip on-screen */
.cmp-cap .cmp-tip::after { left: 0; transform: translateX(0) translateY(2px); text-align: start; }
.cmp-cap .cmp-tip:hover::after,
.cmp-cap .cmp-tip:focus-visible::after { transform: translateX(0) translateY(0); }
.cmp-cap .cmp-tip::before { left: 1rem; }

.cmp-tip:focus-visible { outline: 2px solid #E09B37; outline-offset: 3px; border-radius: 4px; }

/* ── narrow screens ─────────────────────────────────────────────────── */
@media (max-width: 640px) {
  .cmp { font-size: 0.8125rem; }
  .cmp-h, .cmp-cap { padding-inline: 0.65rem; }
  .cmp-col { padding-inline: 0.4rem; }
  .cmp-h--cap { width: 52%; }
  .cmp-tip::after { max-width: 13rem; }
}

@media (prefers-reduced-motion: reduce) {
  .cmp-tip::after, .cmp-tip::before, .cmp-yes--link { transition: none; }
  .cmp-yes--link:hover { transform: none; }
}

/* ── summary strip above the matrix ───────────────────────────────────── */
.cmp-sum {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin: 0 0 1.25rem;
}
.cmp-sum > div {
  flex: 1 1 8rem;
  padding: 0.7rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--background);
}
.cmp-sum > div.is-ours {
  border-color: rgba(224, 155, 55, 0.45);
  background: rgba(224, 155, 55, 0.06);
}
.cmp-sum dt {
  font-size: 0.75rem;
  color: var(--muted-foreground);
  margin: 0 0 0.2rem;
}
.cmp-sum dd {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1;
  color: var(--foreground);
  font-variant-numeric: tabular-nums;
}

/* ── the headless-primitive badge ─────────────────────────────────────── */
.cmp-prim {
  display: inline-block;
  margin-left: 0.5rem;
  padding: 0.05rem 0.35rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 0.625rem;
  letter-spacing: 0.04em;
  color: var(--muted-foreground);
  cursor: help;
  vertical-align: 1px;
}
