/* crux-live.css — three live pieces for /crux/, each an upgrade of a section already on the page.
   Load after site.css and crux.css. Every piece works without motion: with
   prefers-reduced-motion it shows its finished state and never plays on its own. */

/* ---------- 01 · The answer, written live ---------- */

.crux-answer-engines {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 14px 28px 0;
  color: var(--muted);
  font-size: 12.5px;
}

.crux-answer-engines > span {
  margin-right: 2px;
  white-space: nowrap;
}

.crux-answer-engines button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 11px 4px 6px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--body);
  font: 500 12.5px/1.2 var(--font);
  cursor: pointer;
}

.crux-answer-engines button img {
  width: 15px;
  height: 15px;
}

.crux-answer-engines button[aria-selected='true'] {
  border-color: var(--ink);
  background: var(--ink);
  color: #fff;
}

.crux-answer-engines button:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}

[data-crux-live='answer'] .crux-answer-body {
  min-height: 196px;
}

[data-crux-live='answer'].is-live .cx-w,
[data-crux-live='answer'].is-live .crux-hit,
[data-crux-live='answer'].is-live .crux-cites span {
  opacity: 0;
  transition: opacity 0.22s var(--ease);
}

[data-crux-live='answer'].is-live .cx-on {
  opacity: 1 !important;
}

[data-crux-live='answer'] .crux-hit {
  display: inline-block;
  line-height: 1.5;
  transition:
    opacity 0.22s var(--ease),
    transform 0.4s cubic-bezier(0.3, 1.6, 0.5, 1);
}

[data-crux-live='answer'].is-live .crux-hit:not(.cx-on) {
  transform: scale(0.86);
}

.crux-hit:not([data-rank])::after {
  display: none;
}

[data-crux-live='answer'].is-live .crux-hit::after {
  transform: scale(0);
  transition: transform 0.36s cubic-bezier(0.3, 1.8, 0.5, 1) 0.12s;
}

[data-crux-live='answer'].is-live .crux-hit.cx-on::after {
  transform: scale(1);
}

[data-crux-live='answer'] .crux-readout dd {
  transition: color 0.3s var(--ease);
}

[data-crux-live='answer'] .crux-readout dd.is-pending {
  color: var(--faint);
}

[data-crux-live='answer'] .crux-readout .is-no {
  color: var(--faint);
}

/* ---------- 09 · Four numbers, worked ---------- */

.crux-lab {
  margin-top: 28px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: #fff;
}

.crux-lab[hidden] {
  display: none;
}

.crux-lab-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 14px 24px;
  padding: 22px 26px;
  border-bottom: 1px solid var(--line);
}

.crux-lab-head p {
  color: var(--body);
  font-size: 15px;
}

.crux-lab-head p b {
  color: var(--ink);
  font-weight: 500;
}

.crux-lab-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 4px;
  border-radius: 999px;
  background: var(--sheet);
}

.crux-lab-tabs button {
  padding: 8px 16px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--body);
  font: 500 14px/1 var(--font);
  cursor: pointer;
}

.crux-lab-tabs button[aria-selected='true'] {
  background: var(--ink);
  color: #fff;
}

.crux-lab-tabs button:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}

.crux-lab-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
}

.crux-lab-answers {
  margin: 0;
  padding: 8px 0;
  list-style: none;
}

.crux-lab-answers li {
  display: grid;
  grid-template-columns: 180px minmax(0, 1fr) 140px;
  align-items: center;
  gap: 16px;
  padding: 12px 26px;
  transition: opacity 0.3s var(--ease);
}

.crux-lab-answers li + li {
  border-top: 1px solid var(--sheet-2);
}

.crux-lab-answers li.is-dim {
  opacity: 0.36;
}

.crux-lab-meta {
  display: flex;
  align-items: center;
  white-space: nowrap;
  gap: 8px;
  color: var(--muted);
  font: 12.5px var(--mono);
}

.crux-lab-meta img {
  width: 16px;
  height: 16px;
}

.crux-lab-brands {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.crux-lab-brand {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 8px;
  background: var(--sheet-2);
  color: var(--ink-2);
  font-size: 14px;
  transition:
    background 0.3s var(--ease),
    color 0.3s var(--ease);
}

.crux-lab-brand.is-you {
  background: var(--wash);
  box-shadow: inset 0 0 0 1px #b9d3f3;
  color: var(--brand-deep);
}

.crux-lab-brand em,
.crux-lab-brand s {
  display: none;
  font: 500 11px/1 var(--mono);
  font-style: normal;
  text-decoration: none;
}

.crux-lab-brand s {
  display: none;
  place-items: center;
  width: 17px;
  height: 17px;
  border-radius: 50%;
  background: var(--brand);
  color: #fff;
}

[data-metric='sov'] .crux-lab-brand em {
  display: inline;
  color: var(--muted);
}

[data-metric='sov'] .crux-lab-brand.is-you em {
  color: var(--brand-deep);
}

[data-metric='sov'] .crux-lab-brand:not(.is-you) {
  background: #fff;
  box-shadow: inset 0 0 0 1px var(--line);
}

[data-metric='position'] .crux-lab-brand.is-you s,
[data-metric='first'] .crux-lab-brand.is-you s {
  display: inline-grid;
}

.crux-lab-status {
  color: var(--muted);
  font-size: 14px;
  text-align: right;
}

.crux-lab-status.is-yes {
  color: #15803d;
}

.crux-lab-result {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 12px;
  padding: 28px;
  border-left: 1px solid var(--line);
  background: var(--sheet);
}

.crux-lab-kicker {
  color: var(--muted);
  font: 12.5px/1.4 var(--mono);
}

.crux-lab-value {
  color: var(--ink);
  font-size: 64px;
  font-weight: 400;
  letter-spacing: -0.03em;
  line-height: 1;
}

.crux-lab-sum {
  color: var(--body);
  font-size: 14.5px;
  line-height: 1.5;
}

.crux-lab-sum b {
  color: var(--ink);
  font: 500 14px var(--mono);
}

/* ---------- 10 · Never a zero, shown ---------- */

.crux-strip li {
  transition:
    opacity 0.3s var(--ease),
    transform 0.4s cubic-bezier(0.3, 1.6, 0.5, 1);
}

.crux-strip.is-live li:not(.cx-on) {
  opacity: 0.08;
  transform: scaleY(0.4);
}

.crux-trend {
  position: relative;
  margin-top: 22px;
  padding-top: 20px;
  border-top: 1px solid var(--dark-line);
}

.crux-trend-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 20px;
}

.crux-trend-title {
  color: #d6dbe1;
  font-size: 14px;
}

.crux-trend-title span {
  color: #8a93a0;
}

.crux-trend-toggle {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 7px 14px 7px 8px;
  border: 1px solid var(--dark-line);
  border-radius: 999px;
  background: transparent;
  color: #d6dbe1;
  font: 500 13px/1 var(--font);
  cursor: pointer;
}

.crux-trend-toggle i {
  position: relative;
  width: 28px;
  height: 16px;
  border-radius: 999px;
  background: #2a313b;
  transition: background 0.2s var(--ease);
}

.crux-trend-toggle i::after {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #d6dbe1;
  transition: transform 0.2s var(--ease);
  content: '';
}

.crux-trend-toggle[aria-pressed='true'] i {
  background: #ef5b5b;
}

.crux-trend-toggle[aria-pressed='true'] i::after {
  transform: translateX(12px);
}

.crux-trend-toggle:focus-visible {
  outline: 2px solid var(--brand-hi);
  outline-offset: 2px;
}

.crux-trend-plot {
  position: relative;
  margin-top: 14px;
}

.crux-trend svg {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
}

/* site.css draws every svg as a stroked icon; this one is a chart. */
.crux-trend svg text,
.crux-trend svg rect,
.crux-trend svg pattern * {
  stroke: none;
}

.crux-trend svg text {
  stroke-width: 0;
}

.crux-trend .grid line {
  stroke: #1f252d;
  stroke-width: 1;
}

.crux-trend .axis text {
  fill: #6f7885;
  font: 11px var(--mono);
}

.crux-trend .line {
  fill: none;
  stroke: var(--brand-hi);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.crux-trend .dot {
  fill: var(--brand-hi);
  stroke: var(--dark);
  stroke-width: 2;
}

.crux-trend .gap-band {
  fill: url(#crux-hatch);
}

.crux-trend .gap-label {
  fill: #f3a1a1;
  font: 11px var(--mono);
}

.crux-trend .zero {
  fill: none;
  stroke: #ef5b5b;
  stroke-width: 2;
  stroke-dasharray: 5 5;
  stroke-linecap: round;
  opacity: 0;
  transition: opacity 0.35s var(--ease);
}

.crux-trend.show-zero .zero,
.crux-trend.show-zero .zero-label {
  opacity: 1;
}

.crux-trend .zero-label {
  fill: #f3a1a1;
  font: 11px var(--mono);
  opacity: 0;
  transition: opacity 0.35s var(--ease);
}

.crux-trend .series-label {
  fill: #d6dbe1;
  font: 11px var(--mono);
}

.crux-trend .cross {
  stroke: #4a5361;
  stroke-width: 1;
  opacity: 0;
}

.crux-trend-tip {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 2;
  padding: 7px 10px;
  border: 1px solid var(--dark-line);
  border-radius: 8px;
  background: #171c22;
  color: #d6dbe1;
  font: 12px/1.4 var(--mono);
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transform: translate(-50%, -110%);
}

.crux-trend-tip b {
  color: #fff;
  font-weight: 500;
}

.crux-trend-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 20px;
  margin-top: 12px;
  color: #aab1bb;
  font-size: 12.5px;
}

.crux-trend-legend span {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.crux-trend-legend i {
  width: 18px;
  height: 2px;
  background: var(--brand-hi);
}

.crux-trend-legend .is-zero i {
  background: repeating-linear-gradient(90deg, #ef5b5b 0 5px, transparent 5px 10px);
}

.crux-trend-legend .is-zero {
  opacity: 0.4;
  transition: opacity 0.35s var(--ease);
}

.crux-trend.show-zero .crux-trend-legend .is-zero {
  opacity: 1;
}

/* Read by screen readers, never drawn. A table sizes to its content whatever its width says,
   so it is made a block first, or it pushes the page sideways on a phone. */
.cx-sr {
  position: absolute;
  display: block;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

@media (max-width: 760px) {
  .crux-lab-body {
    grid-template-columns: 1fr;
  }

  .crux-lab-result {
    border-top: 1px solid var(--line);
    border-left: 0;
  }

  .crux-lab-answers li {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .crux-lab-status {
    text-align: left;
  }
}

/* ---------- 12 · Reviews, drifting ----------
   Two rows on the site's own marquee ([data-marquee], cloned by site.js), running in opposite
   directions and pausing under the pointer. Every card carries the site's "Sample review" chip
   until real, permitted quotes replace it. */

.crux-reviews .marquees {
  margin-top: 40px;
}

.crux-reviews .marquee-track {
  animation-duration: 90s;
}

.crux-reviews .marquee.reverse .marquee-track {
  animation-duration: 104s;
}

.crux-review {
  display: flex;
  flex-direction: column;
  width: min(440px, 82vw);
  min-height: 250px;
  transition:
    transform 0.35s var(--ease),
    border-color 0.35s var(--ease);
}

.crux-review:hover {
  border-color: #c9d2dd;
  transform: translateY(-3px);
}

.crux-review blockquote {
  font-size: 17px;
}

.crux-review figcaption {
  margin-top: auto;
}

.crux-review figcaption i {
  width: 36px;
  height: 36px;
  background: var(--wash);
  color: var(--brand-deep);
}

.crux-review figcaption span {
  display: grid;
  gap: 2px;
}

.crux-review figcaption b {
  color: var(--ink);
  font-weight: 500;
}

.crux-review-tag {
  align-self: flex-start;
  margin-bottom: 18px;
  padding: 3px 9px;
  border-radius: 6px;
  background: var(--sheet);
  color: var(--body);
  font: 12px/1.4 var(--mono);
}

@media (prefers-reduced-motion: reduce) {
  .crux-reviews .marquee-track {
    flex-wrap: wrap;
    width: auto;
    animation: none;
  }
}

/* Brand and source logos inside the live pieces (logo.dev's, fetched once into /logos). */
.crux-hit img,
.crux-lab-brand img {
  display: inline-block;
  width: 15px;
  height: 15px;
  margin-right: 5px;
  border-radius: 4px;
  vertical-align: -2px;
}

.crux-lab-brand img {
  margin-right: 0;
}

.crux-cites i:has(img) {
  overflow: hidden;
  background: none;
}

.crux-cites i img {
  display: block;
  width: 100%;
  height: 100%;
}

.crux-lab-meta img,
.crux-answer-engines button img,
.scope-list .stack img {
  border-radius: 4px;
}
