/* ===== Affiliates page (25 Oct): Part 1 · Overview =====
   Markup: index.html #page-affiliates → .wrap.aff. Behaviour: assets/js/affiliates.js (live prices,
   calculator, active part link). Structure follows the "Strix Affiliates Page Proposal" artifact
   (three part links, hero + badges + two buttons, How it works, the sign-up form, the rate card,
   the month calculator beside the $25K bonus card, the link-worth table, two closing buttons); the
   look is the site's own light design, the same as the Rules page: white page, white cards with
   hairline borders and soft shadows, light blue table headers, Strix blue for the active link.
   Parts 2 (#aff-questions) and 3 (#aff-money) are hidden anchors until their prompts arrive. */

#page-affiliates .sub {
  background: #fff;
}
.aff {
  position: relative;
  z-index: 1;
}
.aff .note {
  font-size: 14px; /* the form's required-fields hint: never under 14px on phones */
}

/* ---- three-part navigation: Overview · Questions · The Money, in Detail. Three inline links just
   above the Part 1 label; no container, background, border or sticky behaviour. The part in view
   (.on, set by affiliates.js) is Strix blue and a touch heavier; the rest dark grey. ---- */
.aff__parts {
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  gap: 12px;
  width: max-content;
  max-width: 100%;
  margin: 0 0 16px; /* 28 Oct: the label below lost its 6px pill padding, so 16px keeps the 20-24px gap */
}
.aff__part {
  display: inline-flex;
  align-items: center;
  font-size: 15px;
  font-weight: 500;
  line-height: 1.2;
  color: #4b4f73;
  text-decoration: underline;
  text-decoration-color: transparent;
  text-underline-offset: 4px;
  text-decoration-thickness: 1.5px;
  white-space: nowrap;
  transition:
    color 0.15s,
    text-decoration-color 0.15s;
}
.aff__part:hover {
  color: var(--ink);
  text-decoration-color: currentColor;
}
.aff__part.on,
.aff__part.on:hover {
  color: var(--blue);
  font-weight: 600;
  text-decoration-color: transparent;
}
.aff__part:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 3px;
  border-radius: 3px;
}
.aff__sep {
  color: #b4b8dc;
  font-size: 15px;
  line-height: 1;
  user-select: none;
}

/* ---- hero: label, heading, lede, six badges, two buttons ---- */
.aff__sec {
  scroll-margin-top: var(--ticker-h, 0px);
}
.aff__badges {
  margin-top: 22px;
}
.aff__badges span {
  background: #f6f7ff;
  border-color: #cfd3f7;
  color: var(--ink);
}
.aff__cta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 26px;
}
.aff__cta .btn--ghost {
  background: #fff;
}
.aff__cta--end {
  margin-top: 28px;
}

/* ---- white cards (the Rules page's .rcard look) ---- */
.acard {
  background: #fff;
  border: 1px solid var(--line-d);
  border-radius: 20px;
  padding: 28px 30px 30px;
  box-shadow: 0 10px 40px rgba(20, 20, 120, 0.06);
  margin-top: 22px;
  scroll-margin-top: var(--ticker-h, 0px);
  min-width: 0;
}
.aff .acard__h {
  margin: 0;
  font-weight: 600;
  line-height: 1.1;
}
.acard__head {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 4px 14px;
}
.acard__sub {
  margin: 0;
  color: var(--ink-2);
  font-size: 17px;
  font-weight: 500;
}
.aff .acard__lede {
  margin: 12px 0 0;
  font-size: 17px;
  font-weight: 500;
  color: var(--ink-2);
  max-width: 72ch;
}
.aff__note {
  margin: 14px 0 0;
  font-size: 14px;
  line-height: 1.55;
  color: var(--ink-2);
  max-width: 72ch;
}
.aff__note a,
.acard p a {
  color: var(--blue);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* ---- How it works: three step cards, one row from 1024px, stacked below ---- */
.aff__steps {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-top: 20px;
}
.aff__step {
  background: #fff;
  border: 1px solid var(--line-d);
  border-radius: 16px;
  padding: 20px 22px 22px;
  min-width: 0;
}
.aff__step .section-eyebrow {
  margin-bottom: 8px;
}
.aff .aff__step h3 {
  margin: 0 0 8px;
  font-size: 18px;
  font-weight: 600;
  color: var(--ink);
}
.aff .aff__step p {
  margin: 0;
  font-size: 15px;
  line-height: 1.6;
  color: var(--ink-2);
}

/* ---- the sign-up form (api.js owns submission; forms.js the inline validation) ---- */
.aff__form {
  max-width: 720px;
}
.aff__form .field__help {
  margin: 0;
  font-size: 14px;
  line-height: 1.5;
  color: var(--ink-2);
}
.aff__form .chk {
  font-size: 14px;
  line-height: 1.55;
  color: var(--ink);
}
.aff__form .chk--sms {
  font-weight: 500;
}
.aff__submit {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px 18px;
  margin-top: 4px;
}
.aff__submit .form__msg {
  flex: 0 0 100%; /* a message takes its own full-width row under the button and the sign-in link */
  order: 2;
}
.aff__signin {
  order: 1;
  font-size: 15px;
  color: var(--ink-2);
}
.aff__signin a {
  color: var(--blue);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 2px;
  /* 44px tap target (T038) without moving the line: the padding is folded back with negative margins */
  display: inline-block;
  padding: 13px 6px;
  margin: -13px -6px;
}

/* ---- tables (the site's .tbl: white, hairline border, light blue header) ---- */
.aff .tbl {
  margin-top: 18px;
}
.aff .tbl table {
  min-width: 560px;
}
.aff .tbl th {
  font-size: 13px;
  color: var(--ink);
  background: var(--lav);
}
.aff .tbl th,
.aff .tbl td {
  padding: 12px 16px;
  vertical-align: top;
}
.aff .tbl td:first-child {
  font-weight: 500;
  color: var(--ink-2);
}
.aff .tbl tbody tr:last-child td {
  border-bottom: 0;
}
.aff .tbl:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
}

/* ---- calculator beside the bonus card from 1024px, stacked below ---- */
.aff__duo {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr);
  gap: 18px;
  margin-top: 22px;
}
.aff__duo > .acard {
  margin-top: 0;
}
/* 27 Oct (Ali): the sign-up form and the commission levels share one row from 1024px, so the page
   does not carry two half-empty cards one under the other */
.aff__pair {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 18px;
  margin-top: 22px;
  align-items: start;
}
.aff__pair > .acard {
  margin-top: 0;
}
/* three narrow columns: the levels table fits its half of the row without scrolling */
#ladder .tbl table {
  min-width: 0;
}
#ladder .tbl th {
  white-space: normal;
}
@media (max-width: 1199px) {
  .aff__pair {
    grid-template-columns: minmax(0, 1fr);
  }
}
.aff__slider-label {
  display: block;
  margin-top: 18px;
  font-size: 17px;
  font-weight: 500;
  color: var(--ink);
}
.aff__slider-label b {
  font-weight: 600;
}
.aff__slider {
  display: block;
  width: 100%;
  margin: 12px 0 0;
  padding: 12px 0; /* 44px touch target around the 20px thumb */
  height: 44px;
  box-sizing: border-box;
  cursor: pointer;
  accent-color: var(--blue);
  background: none;
}
.aff__slider:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 4px;
  border-radius: 6px;
}
.aff__calc-out {
  margin-top: 18px;
}
.aff__calc-label {
  font-size: 15px;
  color: var(--ink-2);
}
.aff__calc-total {
  margin-top: 2px;
  font-size: 44px;
  font-weight: 600;
  letter-spacing: -0.03em;
  line-height: 1.1;
  color: var(--blue-ink);
  font-variant-numeric: tabular-nums;
}
.aff .aff__calc-line {
  margin: 12px 0 0;
  font-size: 15px;
  line-height: 1.5;
  color: var(--ink-2);
}
.aff .aff__calc-line b {
  color: var(--ink);
  font-weight: 600;
}
.acard--bonus {
  background: #f6f7ff;
  border-color: #cfd3f7;
}
.aff .acard--bonus .acard__h {
  font-size: clamp(22px, 2.2vw, 26px);
  line-height: 1.2;
}
.aff .acard--bonus p {
  margin: 16px 0 0;
  font-size: 16px;
  line-height: 1.6;
  color: var(--ink-2);
}

/* ---- Part 2 · Questions (Part 3 is an anchor only for now): the part heading in the Rules page's
   hierarchy (eyebrow + large h2), then the Rules page's accordion — details.ac cards with hairline
   borders, the plus on the right that turns into a minus, a light shadow only while hovered or open
   (rules.css, loaded on every page). ---- */
.aff__sec--part {
  margin-top: 64px;
}
.aff__sec--part[hidden] {
  display: none;
}
.aff .aff__h {
  margin: 0;
  font-size: clamp(30px, 3.6vw, 44px);
  font-weight: 600;
  letter-spacing: -0.03em;
  line-height: 1.08;
  color: var(--blue-ink);
}
.aff__faq {
  margin-top: 26px;
}
.aff .ac__in p {
  margin: 0;
  max-width: 78ch;
}
.aff .ac__in p + p {
  margin-top: 12px;
}
.aff__sec--part .aff__cta--end {
  margin-top: 28px;
}
.aff .aff__sec--part > .lede {
  margin-top: 12px;
  max-width: 66ch;
}

/* ---- Part 3 · The money, in detail: the same accordion stack; the example month carries a seven-column
   table inside its block, the comparison and closing cards follow ---- */
.aff .ac__in .aff__note {
  margin-top: 14px;
}
.aff .ac__in .tbl {
  margin-top: 14px;
}
.aff .aff__tbl--example table {
  min-width: 760px;
}
.aff .aff__tbl--example td:nth-child(4),
.aff .aff__tbl--example td:nth-child(6) {
  font-variant-numeric: tabular-nums;
}
.aff .aff__tbl--compare table {
  min-width: 640px;
}
.aff .tbl tbody th {
  font-weight: 500;
  color: var(--ink-2);
  text-align: left;
  background: #fff;
}
.aff .aff__tbl--compare td:nth-child(2) {
  color: var(--ink);
  font-weight: 500;
}
.aff__totals {
  margin: 14px 0 0;
  font-size: 15px;
  font-weight: 500;
  color: var(--ink);
}
.aff .aff__legal {
  margin-top: 22px;
  max-width: 78ch;
}

@media (prefers-reduced-motion: reduce) {
  .aff__part {
    transition: none;
  }
}

/* ---- tablets: calculator and bonus stack, steps keep three columns ---- */
@media (max-width: 1023px) {
  .aff__duo,
  .aff__pair {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* ---- phones and small tablets ---- */
@media (max-width: 768px) {
  .aff__sec--part {
    margin-top: 44px;
  }
  .aff__parts {
    gap: 10px;
    margin-bottom: 20px;
  }
  .aff__part {
    min-height: var(--m-tap, 44px);
    font-size: 14px;
  }
  .aff__steps {
    grid-template-columns: minmax(0, 1fr);
  }
  .acard {
    padding: 20px 16px 22px;
    border-radius: 16px;
    margin-top: 16px;
  }
  .aff__cta .btn,
  .aff__submit .btn {
    width: 100%;
  }
  .aff__signin {
    width: 100%;
  }
  .aff__calc-total {
    font-size: 36px;
  }
  /* the table scrolls sideways inside its box; the label column sticks to the left edge so the row
     name stays in view while the figures scroll under it (border-collapse: separate keeps the
     sticky cells' borders with them) */
  .aff .tbl table {
    min-width: 520px;
    border-collapse: separate;
    border-spacing: 0;
  }
  .aff .tbl th,
  .aff .tbl td {
    padding: 11px 12px;
    border-bottom: 1px solid var(--line-d);
  }
  .aff .tbl thead th:first-child,
  .aff .tbl tbody td:first-child {
    position: sticky;
    left: 0;
    z-index: 1;
    width: 150px;
    min-width: 150px;
    max-width: 150px;
    white-space: normal;
    background: #fff;
    border-right: 1px solid var(--line-d);
  }
  .aff .tbl thead th:first-child {
    z-index: 2;
    background: var(--lav);
  }
  .aff .tbl tbody th {
    position: sticky;
    left: 0;
    z-index: 1;
    width: 150px;
    min-width: 150px;
    max-width: 150px;
    white-space: normal;
    border-right: 1px solid var(--line-d);
    border-bottom: 1px solid var(--line-d);
  }
  .aff .aff__tbl--example thead th:first-child,
  .aff .aff__tbl--example tbody td:first-child {
    width: 90px;
    min-width: 90px;
    max-width: 90px;
  }
  .aff .tbl tbody tr:last-child td,
  .aff .tbl tbody tr:last-child th {
    border-bottom: 0;
  }
}
@media (max-width: 374px) {
  /* the three links no longer fit one 320px line at 14px: let the row wrap instead of shrinking the text */
  .aff__parts {
    flex-wrap: wrap;
    gap: 6px 8px;
  }
}

/* ---- Mobile pass, Phase 3.3 (27 Oct): the two Part 1 tables on phones.
   The rate card (Rate | Sales this month | Commission | Per sale) and the link-worth table (Plan |
   List | On your link | They save) scrolled sideways on a phone, which left the figures that matter
   (the commission, the price on the link) off-screen. Under 640px each row becomes a two-line card:
   the name and the headline figure on line one, the two supporting figures on line two, with their
   labels drawn by CSS from the column they came from. Same markup and renderer; the header row is
   hidden (its text stays in the DOM for readers). The wider Part 3 tables keep scroll-and-pin. ---- */
@media (max-width: 640px) {
  #ladder .tbl,
  #link-worth .tbl {
    overflow: visible;
  }
  #ladder .tbl table,
  #link-worth .tbl table {
    min-width: 0;
    width: 100%;
    display: block;
    border-collapse: collapse;
  }
  #ladder .tbl thead,
  #link-worth .tbl thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }
  #ladder .tbl tbody,
  #link-worth .tbl tbody {
    display: block;
  }
  #ladder .tbl tbody tr,
  #link-worth .tbl tbody tr {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
      'name main'
      'sub1 sub2';
    column-gap: 12px;
    row-gap: 2px;
    align-items: baseline;
    padding: 12px 14px;
    border-bottom: 1px solid var(--line-d);
  }
  #ladder .tbl tbody tr:last-child,
  #link-worth .tbl tbody tr:last-child {
    border-bottom: 0;
  }
  #ladder .tbl tbody td,
  #link-worth .tbl tbody td {
    display: block;
    position: static;
    width: auto;
    min-width: 0;
    max-width: none;
    padding: 0;
    border: 0;
    white-space: normal;
    font-size: 14px;
    line-height: 1.35;
    color: var(--ink-2);
  }
  /* line one: the name, and the headline figure (commission % / price on the link) on the right */
  #ladder .tbl tbody td:first-child,
  #link-worth .tbl tbody td:first-child {
    grid-area: name;
    font-size: 16px;
    font-weight: 600;
    color: var(--ink);
  }
  #ladder .tbl tbody td:nth-child(3),
  #link-worth .tbl tbody td:nth-child(3) {
    grid-area: main;
    font-size: 16px;
    font-weight: 700;
    color: var(--ink);
    text-align: right;
    font-variant-numeric: tabular-nums;
  }
  /* line two: the other two figures, each with the label of its column */
  #ladder .tbl tbody td:nth-child(2),
  #link-worth .tbl tbody td:nth-child(2) {
    grid-area: sub1;
  }
  #ladder .tbl tbody td:nth-child(4),
  #link-worth .tbl tbody td:nth-child(4) {
    grid-area: sub2;
    text-align: right;
    font-variant-numeric: tabular-nums;
  }
  #ladder .tbl tbody td:nth-child(2)::after {
    content: ' paid referrals';
  }
  #ladder .tbl tbody td:nth-child(4)::before {
    content: 'per sale* ';
  }
  #link-worth .tbl tbody td:nth-child(2)::before {
    content: 'list ';
  }
  #link-worth .tbl tbody td:nth-child(4)::before {
    content: 'they save ';
  }
  #link-worth .tbl tbody td:nth-child(4) {
    color: var(--blue);
    font-weight: 600;
  }
  #link-worth .tbl tbody td:nth-child(3)::before {
    content: 'on your link ';
    font-size: 14px;
    font-weight: 500;
    color: var(--ink-2);
  }
}

/* ---- 27 Oct (Ali): the calculator slider showed the text cursor ---- */
#aff-calc-n,
.aff__slider-label {
  cursor: pointer;
}
#aff-calc-n::-webkit-slider-thumb {
  cursor: grab;
}
#aff-calc-n::-moz-range-thumb {
  cursor: grab;
}
#aff-calc-n:active::-webkit-slider-thumb {
  cursor: grabbing;
}

/* ---- 28 Oct (Ali): the live SMS consent block ---- */
.aff__form .sms {
  margin-top: 4px;
}
.aff__form .sms__h {
  margin: 0 0 4px;
  font-size: 15px;
  color: var(--ink);
}
.aff__form .sms__p,
.aff__form .sms__fine {
  margin: 0 0 10px;
  font-size: 14px;
  line-height: 1.5;
  color: var(--ink-2);
}
.aff__form .sms__fine {
  margin: 8px 0 0;
}
.aff__form .sms__fine a {
  color: var(--blue);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* ---- (4 Nov, Task 5) the figures could not be verified: the notice under the badges and the dotted
   line under every bound figure, as on the Rules page ---- */
.aff__alert {
  margin-top: 18px;
  padding: 14px 18px;
  border: 1px solid #e3c98a;
  border-radius: 14px;
  background: #fff8e6;
  color: var(--ink);
  font-size: 15px;
  line-height: 1.5;
}
.aff__alert[hidden] {
  display: none;
}
.aff__alert p {
  margin: 0;
  max-width: none;
}
.aff__alert-retry {
  margin-left: 6px;
  min-height: 32px;
  padding: 4px 12px;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  color: var(--blue);
  background: #fff;
  border: 1px solid #cfd3f7;
  border-radius: 999px;
  cursor: pointer;
}
.aff__alert-retry:hover,
.aff__alert-retry:focus-visible {
  border-color: var(--blue);
}
.aff--unverified [data-aff] {
  text-decoration: underline dotted #b08a2e;
  text-underline-offset: 3px;
}
