/* /what-we-build/ranking: the first capability page. Layers on top of
   base.css.

   Section order matches src/views/what-we-build-ranking.ejs and the
   capability-page structure in SITE-ARCHITECTURE.md section 5.

   Most of this page is already shared. The three cards under "What this
   settles" and the two under "Two that work with it" are base.css's
   .hub-grid and .hub-card, and the teal marks above two headlines are
   the shared .accent-rule. What is left here is the hero, the two-column
   split inside the dark band, the ranked table, and the closing block.

   The ranked table is the one genuinely new component. It is built as a
   real table because the rows are data and a screen reader should be
   able to move through them by column. */

/* ── Hero ───────────────────────────────────────────────────────── */

.rk-hero { padding: 70px 0 76px; }

/* Same treatment as the hub hero: two deliberate lines that should not
   wrap into four on a desktop width. */
.rk-hero h1 .line { display: block; }
.rk-hero h1 .line + .line { margin-top: 0.1em; }

.rk-hero h1 {
  font-size: clamp(33px, 4.5vw, 57px);
  max-width: 21em;
}

.rk-hero-lede { font-size: 19.5px; max-width: 38em; }

/* Shared measure for a paragraph sitting directly under a section
   headline. Capped short of the 1300px container so a long argument does
   not run the full width of a desktop. */
.rk-measure { max-width: 40em; }

/* ── What this settles ──────────────────────────────────────────── */

.rk-settles h2 { max-width: 16em; }
.rk-settles-grid { margin-top: 42px; }

@media (min-width: 901px) {
  .rk-settles-grid { grid-template-columns: repeat(3, 1fr); }
}

/* ── What it looks like ─────────────────────────────────────────── */

.rk-looks h2 { max-width: 16em; }

.rk-looks-list {
  margin-top: 40px;
  display: grid;
  gap: 30px;
  max-width: 46em;
}

/* Numbered visually by nothing: these are three facets of one thing
   rather than three steps, so they take a rule rather than a counter. */
.rk-looks-item {
  padding-top: 20px;
  border-top: 1px solid var(--rule);
}

.rk-looks-item h3 { margin-bottom: 8px; }

.rk-looks-item p {
  font-size: 17px;
  line-height: 1.6;
  color: var(--body);
}

/* The panel separating this from a CRM lead score. Set on the surface so
   it reads as an aside to the section rather than as another point in
   the list. */
.rk-distinction {
  margin-top: 40px;
  max-width: 46em;
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: 12px;
  padding: 24px 26px;
}

.rk-distinction p {
  font-size: 16.5px;
  line-height: 1.62;
  color: var(--body);
}

/* ── Two numbers ────────────────────────────────────────────────── */

.rk-two { padding: 78px 0 84px; }
.rk-two h2 { max-width: 13em; }
.rk-two .lede + .lede { margin-top: 18px; }

.rk-two-grid {
  margin-top: 44px;
  display: grid;
  gap: 34px;
  max-width: 52em;
}

@media (min-width: 761px) {
  .rk-two-grid { grid-template-columns: 1fr 1fr; gap: 44px; }
}

/* A hairline above each column, which is the only division the two need:
   the point is that they are parallel, not that one leads to the other. */
.rk-two-col { padding-top: 18px; border-top: 1px solid var(--rule-dark); }

.rk-two-label {
  display: block;
  font-family: var(--display);
  font-weight: 600;
  font-size: 13px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  /* On the dark ground plain --teal clears contrast comfortably, so the
     eyebrow does not need --teal-deep here the way it does on paper. */
  color: var(--teal);
  margin-bottom: 10px;
}

.rk-two-col p {
  font-size: 16.5px;
  line-height: 1.6;
  color: var(--dark-body);
}

.rk-two-pointer {
  margin-top: 38px;
  font-family: var(--mono);
  font-size: 12.5px;
  letter-spacing: 0.02em;
  color: var(--dark-body);
}

/* ── The list ───────────────────────────────────────────────────── */

.rk-list h2 { max-width: 15em; }

/* Run metadata. Instrument type: this is chrome reporting what the run
   was, not copy, and the figures should align rather than flow. */
.rk-run {
  margin-top: 26px;
  font-family: var(--mono);
  font-size: 12.5px;
  letter-spacing: 0.02em;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.rk-run span { margin: 0 6px; color: var(--rule); }

/* The table scrolls sideways below the width where the two score columns
   and a readable reason can co-exist. Without this the reason line
   crushes to three words a row. */
.rk-table-wrap {
  margin-top: 26px;
  border: 1px solid var(--rule);
  border-radius: 12px;
  background: var(--surface);
  overflow-x: auto;
}

.rk-table {
  width: 100%;
  min-width: 720px;
  border-collapse: collapse;
}

/* The caption carries the table's summary for a screen reader. It is
   visually hidden rather than deleted: the sighted reader already has
   the headline and the lede above it saying the same thing. */
.rk-table-caption,
.rk-sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.rk-table thead th {
  font-family: var(--display);
  font-weight: 600;
  font-size: 11.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  text-align: left;
  padding: 14px 18px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--rule);
}

.rk-table tbody tr + tr td { border-top: 1px solid var(--rule); }

.rk-table td {
  padding: 15px 18px;
  vertical-align: top;
}

.rk-col-rank {
  width: 52px;
  font-family: var(--mono);
  font-size: 12.5px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  /* Nudged onto the company name's baseline rather than the cell top,
     which the reason line pulls away from. */
  padding-top: 17px !important;
}

.rk-co {
  display: block;
  font-size: 16px;
  font-weight: 500;
  color: var(--ink);
}

/* The reason each company sits where it does. This is the row's real
   content, so it gets a readable size rather than caption treatment. */
.rk-why {
  display: block;
  margin-top: 5px;
  max-width: 44em;
  font-size: 14.5px;
  line-height: 1.5;
  color: var(--muted);
}

.rk-col-score { width: 132px; white-space: nowrap; }

.rk-bar {
  display: inline-block;
  width: 72px;
  height: 5px;
  border-radius: 3px;
  /* --track rather than --rule, so the unfilled remainder reads as the
     rest of the scale rather than as a border. */
  background: var(--track);
  overflow: hidden;
  vertical-align: middle;
}

/* Teal as a fill, which is what it is for. Both columns take the same
   fill on purpose: a second color would imply the two scores measure
   things of different kinds, and the argument of this page is that they
   are two equal measurements of different questions. */
.rk-bar-fill { display: block; height: 100%; background: var(--teal); }

.rk-num {
  display: inline-block;
  margin-left: 9px;
  min-width: 24px;
  font-family: var(--mono);
  font-size: 13px;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  vertical-align: middle;
}

/* The two instructive rows. Tinted ground and a heavier name, never
   teal: teal means something was verified, and being the row that makes
   the argument is not a finding about the company. */
.rk-row-marked { background: var(--tint); }
.rk-row-marked .rk-co { font-weight: 600; }

.rk-provisional {
  margin-top: 14px;
  font-size: 13.5px;
  line-height: 1.5;
  color: var(--muted);
  max-width: 40em;
}

.rk-contrast {
  margin-top: 36px;
  max-width: 46em;
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: 12px;
  padding: 26px 28px;
}

.rk-contrast h3 { margin-bottom: 10px; }

.rk-contrast p {
  font-size: 16.5px;
  line-height: 1.62;
  color: var(--body);
}

.rk-contrast-link,
.rk-onward-link {
  display: inline-block;
  margin-top: 18px;
  font-family: var(--display);
  font-weight: 600;
  font-size: 14.5px;
  color: var(--teal-deep);
  text-decoration: none;
}

.rk-contrast-link span,
.rk-onward-link span {
  display: inline-block;
  margin-left: 5px;
  transition: transform 160ms ease;
}

.rk-contrast-link:hover span,
.rk-onward-link:hover span { transform: translateX(3px); }

/* ── Two that work with it ──────────────────────────────────────── */

.rk-onward h2 { max-width: 14em; }
.rk-onward-grid { margin-top: 38px; }

@media (min-width: 901px) {
  .rk-onward-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ── Closing ────────────────────────────────────────────────────── */

.rk-cta-inner { text-align: center; }
.rk-cta h2 { max-width: 18em; margin: 0 auto; }

.rk-cta .lede {
  max-width: 40em;
  margin: 18px auto 0;
}

.rk-cta .actions { justify-content: center; }

/* ── Motion ─────────────────────────────────────────────────────── */

@media (prefers-reduced-motion: reduce) {
  .rk-contrast-link span,
  .rk-onward-link span { transition: none; }
}

/* ── The list, narrow ───────────────────────────────────────────── */

/* Below 820px the table cannot hold a readable reason line and two
   score columns at once, and the container is 720px plus gutters.

   The first build let it scroll sideways inside .rk-table-wrap. That
   technically worked and was the wrong answer: on a phone the reader saw
   company names and clipped reasons, and both scores sat off the right
   edge behind a gesture nobody was told about. The scores are the entire
   argument of this page, so a layout that hides them by default fails
   here more badly than it would anywhere else on the site.

   So below this width each row stops being a table row and becomes a
   stacked block: rank and company, then the reason, then the two scores
   one above the other. Stacked rather than side by side on purpose, so
   the two bars share a left edge and the same scale, which is what makes
   a 100 sitting above a 68 legible at a glance. */

@media (max-width: 820px) {
  .rk-table-wrap { overflow-x: visible; }

  .rk-table { min-width: 0; }

  /* The header is dropped, so every row carries its own labels. */
  .rk-table thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }

  .rk-table tbody tr {
    display: grid;
    grid-template-columns: 30px 1fr;
    column-gap: 10px;
    padding: 18px 18px 20px;
  }

  /* The rule moves from the cell to the row, because the cells are no
     longer laid out in a line. */
  .rk-table tbody tr + tr { border-top: 1px solid var(--rule); }
  .rk-table tbody tr + tr td { border-top: none; }

  .rk-table td { display: block; padding: 0; }

  /* Written as `td.rk-col-rank` so it outranks `.rk-table td` above,
     which sets display and padding on every cell in this block. */
  .rk-table td.rk-col-rank {
    grid-column: 1;
    grid-row: 1;
    width: auto;
    padding-top: 2px;
  }

  .rk-table td:nth-child(2) { grid-column: 2; grid-row: 1; }

  .rk-table td.rk-col-score {
    grid-column: 2;
    width: auto;
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 12px;
  }

  /* Fixed width so the two bars start at the same x and stay comparable. */
  .rk-score-label {
    flex: 0 0 auto;
    width: 46px;
    font-family: var(--display);
    font-weight: 600;
    font-size: 11px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--muted);
  }

  .rk-bar { flex: 1 1 auto; width: auto; }
  .rk-num { margin-left: 0; text-align: right; }

  .rk-why { font-size: 14px; }
}

/* Above that width the header carries the labels, so the per-row copies
   are redundant and would read as noise in every cell. */
@media (min-width: 821px) {
  .rk-score-label { display: none; }
}
