/* =====================================================================
 * /css/qk-affiliates.css — Affiliates / Referral page redesign
 *
 * Body-scoped via [data-page="affiliates"]. Reuses canonical --s-*
 * tokens from stake.css and the --qk-* palette. The "Your code" card
 * is intentionally preserved (user feedback: keep this) — only its
 * surrounding chrome is upgraded.
 * =================================================================== */

body[data-page="affiliates"] {
  background: var(--s-bg);
}

/* =====================================================================
 * Page wrap
 * =================================================================== */
.aff-page {
  max-width: 1200px;
  margin: 0 auto;
  padding: 28px 0 64px;
}

/* =====================================================================
 * Hero header — title left, summary right (mirrors versus-stats head)
 * =================================================================== */
.aff-head {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 24px;
  align-items: end;
  padding-bottom: 22px;
  margin-bottom: 28px;
  border-bottom: 1px solid var(--s-line);
}
.aff-head-l { min-width: 0; }
.aff-head-kicker {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11px;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--s-muted-2);
  font-weight: 800;
  margin-bottom: 6px;
}
.aff-head-title {
  margin: 0;
  font-size: 36px;
  font-weight: 900;
  letter-spacing: -.025em;
  line-height: 1.05;
}
.aff-head-title .accent { color: var(--s-green); }
.aff-deck {
  margin: 10px 0 0;
  max-width: 560px;
  color: var(--s-muted);
  font-size: 14px;
  line-height: 1.55;
}
.aff-head-r {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  font-variant-numeric: tabular-nums;
}
.aff-head-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(127,248,0,.08);
  border: 1px solid rgba(127,248,0,.28);
  color: var(--s-green);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .14em;
  text-transform: uppercase;
}
.aff-head-pill::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--s-green);
  box-shadow: 0 0 6px var(--s-green);
}
.aff-head-reward {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11px;
  color: var(--s-muted);
}
.aff-head-reward b { color: var(--s-text); font-weight: 900; }

/* =====================================================================
 * Two-column grid: explainer (left) + your-code card (right, sticky-ish)
 * =================================================================== */
.aff-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 24px;
  align-items: flex-start;
}

/* =====================================================================
 * Explainer card — three sections (overview, wallet, rules)
 * =================================================================== */
.aff-explain {
  background: var(--s-bg-2);
  border: 1px solid var(--s-line);
  border-radius: 14px;
  padding: 26px 30px;
  position: relative;
  overflow: hidden;
}
.aff-explain::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--s-green);
  opacity: .85;
}
.aff-explain-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border-radius: 10px;
  background: rgba(127,248,0,.12);
  border: 1px solid rgba(127,248,0,.3);
  margin-bottom: 14px;
}
.aff-explain-icon img {
  width: 24px;
  height: 24px;
  object-fit: contain;
  display: block;
}
.aff-explain h3 {
  margin: 0 0 4px;
  font-size: 22px;
  font-weight: 900;
  letter-spacing: -.015em;
  color: var(--s-text);
}
.aff-explain-lead {
  margin: 0 0 22px;
  color: var(--s-muted);
  font-size: 14px;
  line-height: 1.6;
}

/* Sub-sections inside the explainer */
.aff-section {
  margin-top: 24px;
  padding-top: 22px;
  border-top: 1px solid var(--s-line);
}
.aff-section h4 {
  margin: 0 0 8px;
  font-size: 11px;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--s-muted);
  font-weight: 900;
}
.aff-section p {
  margin: 0 0 8px;
  color: var(--s-muted);
  font-size: 13px;
  line-height: 1.65;
}
.aff-section p:last-child { margin-bottom: 0; }
.aff-section ul {
  margin: 6px 0 0;
  padding: 0 0 0 18px;
  color: var(--s-muted);
  font-size: 13px;
  line-height: 1.75;
}
.aff-section ul li { margin-bottom: 4px; }
.aff-section ul li::marker { color: var(--s-green); }

/* Wallet split — visual two-tone card to disambiguate Regular vs PP */
.aff-wallet-split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin: 12px 0 6px;
}
.aff-wallet-cell {
  background: var(--s-bg-3);
  border: 1px solid var(--s-line);
  border-radius: 10px;
  padding: 12px 14px;
}
.aff-wallet-cell.regular { border-left: 3px solid var(--s-green); }
.aff-wallet-cell.pp      { border-left: 3px solid var(--qk-gold); }
.aff-wallet-cell-l {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 9px;
  letter-spacing: .2em;
  text-transform: uppercase;
  color: var(--s-muted-2);
  font-weight: 800;
  margin-bottom: 4px;
}
.aff-wallet-cell-v {
  color: var(--s-text);
  font-size: 13px;
  font-weight: 800;
  margin-bottom: 4px;
}
.aff-wallet-cell-d {
  color: var(--s-muted);
  font-size: 12px;
  line-height: 1.5;
}

/* =====================================================================
 * Your-code card — preserved per user feedback, just polished
 * =================================================================== */
.aff-code-card {
  position: sticky;
  top: 24px;
  padding: 28px;
  background:
    radial-gradient(ellipse at 0% 0%, rgba(127,248,0,.10), transparent 55%),
    linear-gradient(160deg, var(--s-bg-2) 0%, var(--s-bg-3) 100%);
  border: 1px solid rgba(127,248,0,.32);
  border-radius: 14px;
  box-shadow: 0 14px 36px rgba(0,0,0,.35), 0 0 0 1px rgba(127,248,0,.05);
  text-align: center;
  align-self: flex-start;
}
.aff-code-kicker {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .2em;
  text-transform: uppercase;
  color: var(--s-green);
  margin-bottom: 12px;
}
.aff-code-value {
  font-family: ui-monospace, "Courier New", monospace;
  font-size: 30px;
  font-weight: 900;
  letter-spacing: 4px;
  color: var(--s-text);
  padding: 18px 12px;
  background: rgba(0,0,0,.4);
  border: 1px dashed rgba(127,248,0,.4);
  border-radius: 10px;
  word-break: break-all;
  margin-bottom: 14px;
  min-height: 64px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.aff-code-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.aff-code-actions .s-btn {
  width: 100%;
}
.aff-code-msg {
  margin-top: 10px;
  font-size: 11px;
  color: var(--s-muted);
  min-height: 14px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  letter-spacing: .04em;
}

/* "Reward summary" stat row inside the code card — small, dense */
.aff-code-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid rgba(127,248,0,.18);
}
.aff-code-stat-l {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 9px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--s-muted-2);
  font-weight: 800;
}
.aff-code-stat-v {
  font-size: 16px;
  font-weight: 900;
  color: var(--s-text);
  margin-top: 2px;
  font-variant-numeric: tabular-nums;
}
.aff-code-stat-v.green { color: var(--s-green); }

/* =====================================================================
 * Guest CTA — shown when user is not signed in (replaces the hidden
 * code card slot)
 * =================================================================== */
.aff-guest-card {
  padding: 28px;
  background: var(--s-bg-2);
  border: 1px dashed var(--s-line);
  border-radius: 14px;
  text-align: center;
  align-self: flex-start;
}
.aff-guest-card h4 {
  margin: 0 0 8px;
  font-size: 16px;
  color: var(--s-text);
}
.aff-guest-card p {
  margin: 0 0 16px;
  font-size: 13px;
  color: var(--s-muted);
  line-height: 1.55;
}

/* =====================================================================
 * Responsive
 * =================================================================== */
@media (max-width: 920px) {
  .aff-grid {
    grid-template-columns: 1fr;
  }
  .aff-code-card {
    position: static;
  }
  .aff-head {
    grid-template-columns: 1fr;
    gap: 16px;
  }
  .aff-head-r {
    flex-direction: row;
    align-items: center;
    flex-wrap: wrap;
  }
}
@media (max-width: 600px) {
  .aff-head-title { font-size: 28px; }
  .aff-explain { padding: 22px 22px; }
  .aff-explain h3 { font-size: 18px; }
  .aff-wallet-split { grid-template-columns: 1fr; }
  .aff-code-card { padding: 22px; }
  .aff-code-value { font-size: 24px; padding: 16px 10px; }
}

/* =====================================================================
 * Share-link block — sits inside .aff-code-card under the existing
 * "your code" CTA. Same dark-card visual language as the parent.
 * ===================================================================== */
.aff-share {
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid var(--s-line, #2a3037);
  display: flex;
  flex-direction: column;
  gap: 10px;
  /* Parent .aff-code-card has text-align:center; the share block reads
   * like a form, not a centered headline, so override here. */
  text-align: left;
}
.aff-share-label {
  font-size: 12px;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--s-muted, #8b96a3);
  font-weight: 700;
}
.aff-share-row {
  display: flex;
  gap: 8px;
  align-items: stretch;
}
.aff-share-input {
  flex: 1 1 auto;
  min-width: 0;
  padding: 10px 12px;
  background: var(--s-bg, #0d1117);
  border: 1px solid var(--s-line, #2a3037);
  border-radius: 8px;
  color: var(--s-text, #e7edf3);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 13px;
}
.aff-share-input:focus {
  outline: none;
  border-color: var(--s-green, #66ffe5);
}
.aff-share-stats {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin-top: 6px;
}
.aff-stat {
  background: var(--s-bg, #0d1117);
  border: 1px solid var(--s-line, #2a3037);
  border-radius: 8px;
  padding: 10px 12px;
  text-align: center;
}
.aff-stat-num {
  font-size: 22px;
  font-weight: 900;
  color: var(--s-green, #66ffe5);
  line-height: 1;
}
.aff-stat-lbl {
  margin-top: 4px;
  font-size: 11px;
  letter-spacing: .03em;
  color: var(--s-muted, #8b96a3);
  text-transform: uppercase;
}
.aff-share-hint {
  font-size: 12px;
  color: var(--s-muted, #8b96a3);
  line-height: 1.5;
}
