/* Businessily — /compare/ hub + spoke styles.
   Loaded AFTER styles.css. Only additive classes live here; we reuse
   .compare, .compare-wrap, .reveal, .faq, .cta-band, .grid-2/3 from styles.css.
   Motion is gated behind prefers-reduced-motion (see bottom). */

/* ---- Answer-first verdict callout (the AI/reader takeaway) ---- */
.verdict {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 16px;
  align-items: start;
  max-width: 760px;
  margin: 0 auto;
  padding: clamp(18px, 3vw, 26px) clamp(20px, 3.5vw, 30px);
  background: linear-gradient(150deg, color-mix(in srgb, var(--accent) 9%, var(--card)), var(--card));
  border: 1px solid color-mix(in srgb, var(--accent) 24%, var(--hairline));
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-sm);
}
.verdict .v-ic {
  flex: 0 0 auto;
  width: 40px; height: 40px;
  display: grid; place-items: center;
  border-radius: 11px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff;
}
.verdict .v-ic svg { width: 22px; height: 22px; }
.verdict p { margin: 0; font-size: 1.08rem; line-height: 1.5; color: var(--text); }
.verdict p strong, .verdict p b { color: var(--text); }
.verdict .v-note { margin-top: 8px; font-size: .9rem; color: var(--text-2); }
@media (max-width: 540px) {
  .verdict { grid-template-columns: 1fr; }
  .verdict p { font-size: 1.02rem; }
}

/* ---- Contextual note under a cell value (in the compare table) ---- */
.cnote { display: block; margin-top: 2px; font-size: .76rem; font-weight: 600; color: var(--text-2); line-height: 1.3; }
table.compare td.us .cnote { color: color-mix(in srgb, var(--accent) 70%, var(--text)); }

/* ---- ✓ / ✗ / ~ glyph sizing (reuses .ck/.cx/.cmid colors) ---- */
.compare .ck, .compare .cx, .compare .cmid { font-weight: 800; font-size: 1.02rem; }

/* ==========================================================================
   MASTER COMPARISON TABLE (the big 9-column hub table)
   Scoped entirely to .compare-wrap.hub so the security.html .compare matrix
   (styled by the base rules in styles.css) is never touched.

   Desktop (>=721px): horizontal scroll with two STICKY columns (the feature
   labels + the Businessily "us" column), a soft right-edge fade affordance,
   a one-time "scroll to compare" hint, branded scrollbar, and competitor
   columns wide enough that values + .cnote sub-text wrap instead of clipping.

   Phone (<=720px): the table is reflowed into stacked per-row cards by the
   base @media(max-width:640px) rules; we extend that reflow up to 720px for
   the hub only, so the 641-720px band never shows a clipped 9-col table.
   ========================================================================== */

@media (min-width: 721px) {
  /* the scroll container — relative so the fade overlay can pin to its edge */
  .compare-wrap.hub {
    position: relative;
    overflow-x: auto;
    overflow-y: visible;
    scrollbar-color: color-mix(in srgb, var(--accent) 55%, var(--hairline)) transparent;
    scrollbar-width: thin;
    /* a CSS-only "more →" fade on the right edge via a mask that retreats as
       you scroll: we approximate it with a gradient overlay (::after) below.
       The mask here keeps the very right edge soft even mid-cell. */
  }
  /* branded, visible scrollbar (WebKit/Blink) */
  .compare-wrap.hub::-webkit-scrollbar { height: 10px; }
  .compare-wrap.hub::-webkit-scrollbar-track {
    background: color-mix(in srgb, var(--accent) 6%, transparent);
    border-radius: 999px;
  }
  .compare-wrap.hub::-webkit-scrollbar-thumb {
    background: color-mix(in srgb, var(--accent) 50%, var(--hairline));
    border-radius: 999px;
    border: 2px solid transparent;
    background-clip: padding-box;
  }
  .compare-wrap.hub::-webkit-scrollbar-thumb:hover {
    background: color-mix(in srgb, var(--accent) 70%, var(--hairline));
    background-clip: padding-box;
  }

  /* the table needs to be wider than the viewport to justify the scroll, and
     each competitor column gets a sensible min-width so its value + .cnote
     wrap cleanly inside the column instead of being sliced by the scroll edge */
  .compare-wrap.hub table.compare {
    min-width: 1040px;
    table-layout: fixed;
  }
  .compare-wrap.hub table.compare th,
  .compare-wrap.hub table.compare td {
    white-space: normal;            /* allow wrapping, no mid-word clip */
    overflow-wrap: break-word;
    vertical-align: top;
  }
  /* column widths: feat label, the us hero, then 7 competitors */
  .compare-wrap.hub table.compare th.feat,
  .compare-wrap.hub table.compare td.feat { width: 190px; min-width: 190px; }
  .compare-wrap.hub table.compare th.us,
  .compare-wrap.hub table.compare td.us   { width: 150px; min-width: 150px; }
  .compare-wrap.hub table.compare thead th:not(.feat):not(.us),
  .compare-wrap.hub table.compare tbody td:not(.feat):not(.us) {
    width: 132px; min-width: 132px;
  }

  /* ---- STICKY COLUMN 1: feature labels ---- */
  .compare-wrap.hub table.compare th.feat,
  .compare-wrap.hub table.compare td.feat {
    position: sticky;
    left: 0;
    z-index: 2;
    background: var(--card);
    /* subtle right-edge separator + shadow so scrolling content can't show
       through and the column reads as pinned */
    box-shadow: 1px 0 0 var(--hairline), 6px 0 12px -8px color-mix(in srgb, var(--text) 35%, transparent);
  }
  .compare-wrap.hub table.compare thead th.feat { z-index: 4; }

  /* ---- STICKY COLUMN 2: the Businessily "us" hero ---- */
  .compare-wrap.hub table.compare th.us,
  .compare-wrap.hub table.compare td.us {
    position: sticky;
    left: 190px;                    /* == feat column width */
    z-index: 2;
    /* keep the green highlight; body cells use an opaque-over-card mix so
       scrolling competitor cells never bleed through */
    background:
      linear-gradient(color-mix(in srgb, var(--accent) 8%, var(--card)),
                      color-mix(in srgb, var(--accent) 8%, var(--card))),
      var(--card);
    box-shadow: 1px 0 0 color-mix(in srgb, var(--accent) 28%, var(--hairline)),
                8px 0 14px -8px color-mix(in srgb, var(--text) 32%, transparent);
  }
  /* the header keeps its original green gradient hero treatment, just pinned */
  .compare-wrap.hub table.compare thead th.us {
    z-index: 4;
    background:
      linear-gradient(135deg, color-mix(in srgb, var(--accent-2) 22%, var(--card)),
                      color-mix(in srgb, var(--accent) 16%, var(--card))),
      var(--card);
  }
  /* hover state must not wash out the sticky backgrounds (base styles.css adds
     a tinted hover); re-assert opaque sticky fills on row hover */
  .compare-wrap.hub table.compare tbody tr:hover td.feat { background: var(--card); }
  .compare-wrap.hub table.compare tbody tr:hover td.us {
    background:
      linear-gradient(color-mix(in srgb, var(--accent) 14%, var(--card)),
                      color-mix(in srgb, var(--accent) 14%, var(--card))),
      var(--card);
  }

  /* ---- right-edge "more →" fade affordance ----
     A gradient overlay pinned to the wrap's right edge. It is hidden once the
     container is scrolled to the end (JS toggles .at-end) or when there is no
     overflow at all (JS toggles .no-overflow). */
  .compare-wrap.hub::after {
    content: "";
    position: absolute;
    top: 0; right: 0; bottom: 0;
    width: 56px;
    pointer-events: none;
    background: linear-gradient(to right, transparent,
                color-mix(in srgb, var(--card) 92%, transparent));
    opacity: 1;
    transition: opacity .25s ease;
    z-index: 3;
  }
  .compare-wrap.hub.at-end::after,
  .compare-wrap.hub.no-overflow::after { opacity: 0; }

  /* one-time scroll hint caption under the table */
  .compare-hint {
    display: block;
    text-align: center;
    margin-top: 10px;
    font-size: .85rem;
    font-weight: 700;
    color: var(--text-2);
    letter-spacing: .2px;
    transition: opacity .3s ease;
  }
  .compare-wrap.hub.scrolled + .compare-hint,
  .compare-wrap.hub.no-overflow + .compare-hint { opacity: 0; visibility: hidden; }
}

/* Phone/tablet reflow extension: between 641px and 720px the base reflow in
   styles.css has NOT kicked in (it triggers at <=640px), so the hub's wide
   table would clip. Reflow the HUB table into the same stacked cards here.
   Mirrors the base @media(max-width:640px) block, scoped to .compare-wrap.hub
   so nothing else on the site is affected. */
@media (min-width: 641px) and (max-width: 720px) {
  .compare-wrap.hub { overflow: visible; border: none; box-shadow: none; border-radius: 0; }
  .compare-wrap.hub table.compare,
  .compare-wrap.hub table.compare tbody { display: block; width: 100%; min-width: 0; background: transparent; }
  .compare-wrap.hub table.compare thead { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); border: 0; }
  .compare-wrap.hub table.compare tr { display: block; background: var(--card); border: 1px solid var(--hairline); border-radius: var(--r-lg); box-shadow: var(--shadow-sm); padding: 2px 18px 10px; margin-bottom: 14px; }
  .compare-wrap.hub table.compare td { display: flex; align-items: center; gap: 10px; padding: 11px 0; border-bottom: 1px solid var(--hairline-2); font-size: .96rem; text-align: right; white-space: normal; }
  .compare-wrap.hub table.compare td::before { content: attr(data-label); margin-right: auto; font-family: var(--font); font-weight: 700; color: var(--text-2); text-align: left; }
  .compare-wrap.hub table.compare td:last-child { border-bottom: none; }
  .compare-wrap.hub table.compare td.feat { display: block; text-align: left; font-family: var(--font); font-weight: 800; font-size: 1.08rem; color: var(--text); padding: 12px 0 8px; border-bottom: 2px solid var(--hairline); }
  .compare-wrap.hub table.compare td.feat::before { content: none; }
  .compare-wrap.hub table.compare td.us { background: color-mix(in srgb, var(--accent) 10%, transparent); margin: 3px -18px; padding: 11px 18px; border-bottom: none; border-radius: 9px; font-weight: 800; color: var(--text); }
  .compare-wrap.hub table.compare td.us::before { color: var(--accent); }
  /* the .cnote sub-text reads better on its own line in card mode */
  .compare-wrap.hub table.compare td .cnote { flex-basis: 100%; text-align: right; margin-top: 0; }
  .compare-hint { display: none; }
}

/* On phones the base <=640px reflow handles the hub table too; just make sure
   our scroll-hint caption and any desktop-only chrome are out of the way. */
@media (max-width: 640px) {
  .compare-hint { display: none; }
  .compare-wrap.hub table.compare td .cnote { flex-basis: 100%; text-align: right; }
}

/* ---- the standalone $0 caption that carries the verdict annotation ----
   Sits BELOW the verdict card in clear space, so its annotation label can
   never overlap the verdict prose. */
.verdict-tag {
  max-width: 760px;
  margin: 18px auto 0;
  /* reserve clear space below the line for the annotation label, which the
     engine drops just under the "$0" target (placement: below) */
  padding-bottom: 44px;
  text-align: center;
  font-family: var(--font);
  font-weight: 800;
  font-size: 1.04rem;
  color: var(--text-2);
  position: relative;        /* belt-and-suspenders: also set by .annot */
}
.verdict-tag .cmp-zero-key {
  color: var(--accent);
  font-size: 1.12rem;
}
[data-theme="dark"] .verdict-tag .cmp-zero-key { color: var(--accent-2); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .verdict-tag .cmp-zero-key { color: var(--accent-2); }
}

/* ---- Cluster link cards (hub → spokes, spoke → siblings) ---- */
.clusterlinks { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
@media (max-width: 620px) { .clusterlinks { grid-template-columns: 1fr; } }
.clusterlink {
  display: flex; flex-direction: column; gap: 6px;
  padding: 20px 22px;
  background: var(--card);
  border: 1px solid var(--hairline);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
  text-decoration: none;
  color: var(--text);
  transition: transform .18s cubic-bezier(.2,.7,.2,1), box-shadow .18s ease, border-color .18s ease;
  min-height: 44px;
}
.clusterlink:hover { transform: translateY(-3px); box-shadow: var(--shadow-md, 0 8px 24px -10px rgb(0 0 0 / .22)); border-color: color-mix(in srgb, var(--accent) 36%, var(--hairline)); }
.clusterlink h3 { margin: 0; font-size: 1.08rem; display: flex; align-items: center; gap: 8px; }
.clusterlink p { margin: 0; color: var(--text-2); font-size: .92rem; }
.clusterlink .arrow { margin-top: auto; font-weight: 800; color: var(--accent); font-size: .9rem; }

/* ---- "When [competitor] is the better choice" — honest cards ---- */
.fairgrid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
@media (max-width: 620px) { .fairgrid { grid-template-columns: 1fr; } }
.faircard {
  padding: 20px 22px;
  background: var(--bg-2);
  border: 1px solid var(--hairline-2);
  border-radius: var(--r-lg);
}
.faircard .ic { color: var(--text-2); margin-bottom: 8px; }
.faircard .ic svg { width: 22px; height: 22px; }
.faircard b { font-family: var(--font); display: block; margin-bottom: 4px; }
.faircard p { margin: 0; color: var(--text-2); font-size: .94rem; }

/* ---- Differentiator strip (no Plaid / no fund custody) ---- */
.diffstrip { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
@media (max-width: 760px) { .diffstrip { grid-template-columns: 1fr; } }
.diffcard {
  padding: 22px;
  background: var(--card);
  border: 1px solid var(--hairline);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
}
.diffcard .ic {
  width: 38px; height: 38px; display: grid; place-items: center;
  border-radius: 10px; margin-bottom: 12px;
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  color: var(--accent);
}
.diffcard .ic svg { width: 20px; height: 20px; }
.diffcard h3 { margin: 0 0 6px; font-size: 1.08rem; }
.diffcard p { margin: 0; color: var(--text-2); font-size: .94rem; }

/* tiny "last reviewed" footnote pill */
.reviewed { font-size: .82rem; color: var(--text-2); }
