/*
 * The comparison page.
 *
 * Three moves: the choice, made by two sentences; the table, whose job is to
 * make it obvious that Trader Pro contains all of Starter; and the free course
 * for anyone still undecided.
 */

.courses {
  background: var(--sg-ground);
}

.courses .courses-band {
  background: var(--sg-sunk);
  border-block: 1px solid var(--sg-line);
}

/* Hero -------------------------------------------------------------------- */

.courses .courses-hero {
  position: relative;
  isolation: isolate;
  padding-block: clamp(2.75rem, 5vw, 4.25rem) clamp(2rem, 4vw, 3rem);
  text-align: center;
}

.courses .courses-hero__inner {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.courses .courses-hero__title {
  margin-top: 1.125rem;
  max-width: 18ch;
}

.courses .courses-hero__lead {
  margin-inline: auto;
  max-width: 56ch;
}

/* The chooser ---------------------------------------------------------------- */

.courses .courses-chooser {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.25rem;
  padding-bottom: clamp(3rem, 6vw, 4.75rem);
  align-items: start;
}

.courses .courses-choice {
  display: flex;
  flex-direction: column;
  gap: 0.875rem;
  padding: clamp(1.5rem, 3vw, 1.875rem);
  border: 1px solid var(--sg-line);
  border-radius: var(--sg-radius-lg);
  background: var(--sg-raised);
}

.courses .courses-choice.is-lead {
  border-color: var(--sg-trpro);
  box-shadow: var(--sg-shadow);
}

.courses .courses-choice__tagline {
  margin-top: 0.15rem;
}

/*
 * The sentence someone recognises themselves in. The first half is the
 * qualifier and carries the weight; the rest is what they want.
 */
.courses .courses-choice__said {
  margin: 0;
  padding: 0;
  border: 0;
  max-width: 27ch;
  font-size: 1.25rem;
  line-height: 1.35;
  letter-spacing: -0.018em;
}

.courses .courses-choice__said b {
  color: var(--sg-ink);
  font-weight: 600;
}

.courses .courses-choice__said span {
  color: var(--sg-soft);
  font-weight: 400;
}

.courses .courses-choice__terms {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  margin: 0;
  padding-top: 0.875rem;
  border-top: 1px solid var(--sg-line);
  font-size: 0.9375rem;
  color: var(--sg-body);
}

.courses .courses-choice__terms svg {
  width: 18px;
  height: 18px;
  flex: none;
  color: var(--sg-soft);
}

.courses .courses-choice__terms b {
  color: var(--sg-ink);
  font-weight: 600;
}

.courses .courses-choice > .sg-btn {
  align-self: flex-start;
  margin-top: 0.25rem;
}

@media (max-width: 767px) {
  .courses .courses-chooser {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* The table -------------------------------------------------------------------- */

/*
 * Scrolls sideways inside its own box rather than collapsing into two stacked
 * lists on a phone: a comparison you cannot see both halves of at once has
 * stopped being a comparison. `tabIndex` on the container makes the scroll
 * reachable from the keyboard, which is why it also takes a focus ring.
 */
.courses .courses-table {
  overflow-x: auto;
  overscroll-behavior-x: contain;
}

.courses .courses-table table {
  width: 100%;
  min-width: 680px;
  border-collapse: collapse;
  font-variant-numeric: tabular-nums;
}

.courses .courses-table col.is-lead {
  background: oklch(0.755 0.095 259 / 0.05);
}

.courses .courses-table th,
.courses .courses-table td {
  padding: 0.9375rem 1.125rem;
  text-align: left;
  vertical-align: middle;
  border-bottom: 1px solid var(--sg-line);
}

.courses .courses-table thead th {
  padding-bottom: 1.125rem;
  vertical-align: bottom;
  border-bottom: 2px solid var(--sg-ink);
}

.courses .courses-table thead td {
  border-bottom: 2px solid var(--sg-ink);
}

/* The row label stays put while the columns scroll under it. */
.courses .courses-table tbody th {
  position: sticky;
  left: 0;
  z-index: 1;
  width: 40%;
  background: var(--sg-sunk);
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--sg-ink);
}

.courses .courses-table tbody th span {
  display: block;
  margin-top: 0.125rem;
  font-size: 0.84rem;
  font-weight: 400;
  color: var(--sg-soft);
}

.courses .courses-table td b {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--sg-ink);
}

.courses .courses-col {
  display: flex;
  align-items: center;
  gap: 0.6875rem;
}

.courses .courses-col svg {
  width: 34px;
  height: 34px;
  flex: none;
}

.courses .courses-col__name {
  display: block;
  font-size: 1.1875rem;
  font-weight: 700;
  letter-spacing: -0.022em;
  line-height: 1.1;
  color: var(--sg-ink);
}

.courses .courses-col__for {
  display: block;
  margin-top: 0.125rem;
  font-size: 0.78rem;
  font-weight: 400;
  color: var(--sg-soft);
}

.courses .courses-yes svg {
  display: block;
  width: 18px;
  height: 18px;
  color: var(--sg-up-text);
}

/* Absent, and drawn as absent: a faint mark, not a red warning. */
.courses .courses-no svg {
  display: block;
  width: 16px;
  height: 16px;
  color: var(--sg-line);
}

.courses .courses-price td {
  padding-top: 1.375rem;
}

.courses .courses-price b {
  font-size: 1.875rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--sg-ink);
}

.courses .courses-price s {
  margin-left: 0.5rem;
  font-size: 0.9375rem;
  color: var(--sg-soft);
}

.courses .courses-plans td {
  padding-top: 0;
  border-bottom: 0;
}

.courses .courses-plans th,
.courses .courses-cta th,
.courses .courses-price th {
  border-bottom: 0;
}

.courses .courses-cta td {
  padding-top: 1rem;
  border-bottom: 0;
}

.courses .courses-cta__note {
  display: block;
  margin-top: 0.5rem;
  font-size: 0.78rem;
  color: var(--sg-soft);
}

/*
 * On a phone the label column was taking 272px of a 343px viewport, which left
 * a sliver of one course and none of the other — the table scrolled, but you
 * could never see the two answers side by side, which is the entire point.
 *
 * Narrower everything: the whole table now sits ~460px wide, so a small nudge
 * brings both columns into view and the sticky label keeps the row identified.
 */
@media (max-width: 767px) {
  .courses .courses-table table {
    min-width: 460px;
  }

  .courses .courses-table th,
  .courses .courses-table td {
    padding: 0.75rem 0.75rem;
  }

  .courses .courses-table tbody th {
    width: 190px;
    font-size: 0.875rem;
  }

  .courses .courses-table tbody th span {
    font-size: 0.75rem;
  }

  .courses .courses-col {
    gap: 0.5rem;
  }

  .courses .courses-col svg {
    width: 26px;
    height: 26px;
  }

  .courses .courses-col__name {
    font-size: 1rem;
  }

  .courses .courses-col__for {
    font-size: 0.6875rem;
  }

  .courses .courses-price b {
    font-size: 1.5rem;
  }
}

/* À la carte --------------------------------------------------------------------- */

.courses .courses-bespoke {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 1.25rem 1.375rem;
  margin-top: 1.625rem;
  padding: 1.375rem 1.625rem;
  border: 1px dashed var(--sg-line);
  border-radius: 14px;
  background: var(--sg-raised);
}

.courses .courses-bespoke p {
  margin: 0;
  max-width: 62ch;
  font-size: 0.9375rem;
  color: var(--sg-body);
}

.courses .courses-bespoke b {
  color: var(--sg-ink);
  font-weight: 600;
}

.courses .courses-bespoke .sg-btn {
  margin-left: auto;
  flex: none;
}

/* The free course ------------------------------------------------------------------ */

.courses .courses-free {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: clamp(1.5rem, 4vw, 2.5rem);
  align-items: center;
  padding: clamp(1.75rem, 3.5vw, 2rem);
  border: 1px solid var(--sg-line);
  border-radius: var(--sg-radius-lg);
  background: var(--sg-raised);
}

.courses .courses-free__title {
  margin-top: 0.75rem;
  font-size: clamp(1.625rem, 1.2rem + 1.6vw, 2.125rem);
}

.courses .courses-free__body {
  margin: 0.75rem 0 0;
  max-width: 54ch;
  font-size: 0.9375rem;
  color: var(--sg-body);
}

.courses .courses-free__go {
  display: flex;
  flex-direction: column;
  gap: 0.625rem;
}

.courses .courses-free__go span {
  font-size: 0.78rem;
  color: var(--sg-soft);
  text-align: center;
}

@media (max-width: 767px) {
  .courses .courses-free {
    grid-template-columns: minmax(0, 1fr);
  }

  .courses .courses-bespoke .sg-btn {
    margin-left: 0;
  }
}
