/**
 * #284 - "Comparison table" two-column table for editor-built rich text.
 * Figma frame: "Urgent Care SaL Desktop" > "When to use" (node 672-1382).
 *
 * Strictly opt-in: this treatment is applied only by the basic_html CKEditor 5
 * "Comparison Table" style, which emits `<table class="comparison-table">`.
 * Every selector in this file is rooted at `.comparison-table`, so the site's
 * ordinary editor-inserted tables are visually untouched.
 *
 * Markup shape this CSS assumes - a label cell and a value cell per row, the
 * first row's value being the option being compared:
 *
 *   <table class="comparison-table">
 *     <tbody>
 *       <tr><td>Go to</td><td><strong>Urgent Care (here)</strong></td></tr>
 *       <tr><td>For</td><td>Cuts needing stitches, minor fractures, ...</td></tr>
 *       <tr><td>Why</td><td><strong>Prompt care needed</strong>, not life-threatening</td></tr>
 *     </tbody>
 *   </table>
 *
 * The label column is the tinted one; no header row is used, because the labels
 * repeat down the side rather than across the top. Three of these tables stack
 * to make the triage comparison in the Figma frame, so the bottom margin is the
 * gap between them.
 *
 * CKEditor 5 wraps tables in `<figure class="table">`; rooting at the table's
 * own class keeps this working with or without that wrapper.
 *
 * Typography inherits the site's BC Sans stack from `body` (as every other
 * component CSS file here does); only weight/size/line-height/colour are set.
 */

/* SPECIFICITY: `.region.region-content` scoping is needed on every rule that a
   custom-overrides.css table rule would otherwise beat - that file styles
   `.region.region-content table` and its cells (0-2-1), which outranks a bare
   component class (0-1-0). Contrast css/component/steps-list.css, whose list
   rules have no such competitor. */
.region.region-content .comparison-table {
  width: 100%;
  margin: 0 0 16px;
  border: 0;
  border-collapse: separate;
  border-spacing: 0;
  /* Radius has to be clipped on the container: the cells carry the fills. */
  border-radius: 8px;
  overflow: hidden;
  background: #FCFCFC;
  table-layout: fixed;
}

.region.region-content .comparison-table:last-child {
  margin-bottom: 0;
}

/* Row rule between the cells, dropped on the last row so it does not draw a
   line against the table's own rounded bottom edge. */
.region.region-content .comparison-table td {
  padding: 10px 16px;
  border: 0;
  border-bottom: 1px solid #E0E0E0;
  background: #FCFCFC;
  font-size: 15px;
  font-weight: 400;
  line-height: 24px;
  color: #1a1a1a;
  vertical-align: top;
}

.region.region-content .comparison-table tr:last-child td {
  border-bottom: 0;
}

/* The label column: fixed, tinted, right-aligned, quieter than the value.
   #9DA3A8 is a one-off Figma value with no design token, so it is written
   literally - as sibling component CSS already does for one-off Figma
   values. */
.region.region-content .comparison-table td:first-child {
  width: 63px;
  padding-right: 12px;
  background: var(--color-blue-96);
  font-size: 14px;
  line-height: 21px;
  color: #9DA3A8;
  text-align: right;
  white-space: nowrap;
}

/* The compared option, in the first row's value cell: the size step that makes
   each table scannable as "911 / Emergency vs Urgent Care vs family doctor".
   Link colour is deliberately left to the site's link styles - the frame's red
   911 link is the emergency link treatment, not a table concern. */
.region.region-content .comparison-table tr:first-child td:last-child {
  padding-top: 12px;
  padding-bottom: 12px;
  font-size: 19px;
  font-weight: 700;
  line-height: 28.5px;
}

/* Narrow viewports: the fixed label column costs too much of the row, so the
   pair stacks and the label becomes a caption above its value. */
@media (max-width: 575px) {
  .region.region-content .comparison-table td,
  .region.region-content .comparison-table td:first-child {
    display: block;
    width: auto;
    text-align: left;
    white-space: normal;
  }

  .region.region-content .comparison-table td:first-child {
    padding-bottom: 0;
    border-bottom: 0;
  }
}
