/* page-affiliate.css – /affiliate/ only. Loaded AFTER site.css.
   The affiliate page is a marketing landing page: it reuses the shared
   v2 atoms (section-head, eyebrow, cards, steps, qa, btn, cockade) and
   only adds the surfaces the design introduces here — the hero split,
   the earnings calculator and the apply form. */

/* ---------- hero ---------- */
.aff-hero { padding-top: clamp(2.5rem, 6vw, 5rem); }
.aff-hero__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 26rem), 1fr));
  gap: clamp(2rem, 5vw, 4.5rem);
  align-items: center;
}
.aff-eyebrow {
  margin: 0 0 1.2rem;
  font-size: var(--fs-eyebrow);
  font-weight: 700;
  letter-spacing: var(--tracking-eyebrow);
  text-transform: uppercase;
  color: var(--red-strong);
}
.aff-eyebrow--sky { color: var(--sky-ink); }
.aff-h1 {
  margin: 0;
  font-size: var(--fs-mega);
  line-height: var(--lh-display);
  letter-spacing: -0.045em;
  text-wrap: balance;
}
.aff-lead {
  max-width: 32rem;
  margin: 1.6rem 0 2.2rem;
  font-size: var(--fs-lead);
  line-height: 1.5;
  color: var(--dim);
}
.aff-actions { display: flex; flex-wrap: wrap; gap: 0.75rem; }

.aff-hero__media { position: relative; }
.aff-hero__media img {
  display: block;
  width: 100%;
  /* REQUIRED: the <img> carries width/height attrs (628x754) whose
     presentational hint sets height:754px — aspect-ratio only applies when
     the height is auto. */
  height: auto;
  aspect-ratio: 5 / 6;
  object-fit: cover;
  border-radius: var(--radius-media);
  box-shadow: var(--shadow-float);
}
.aff-cockade { position: absolute; left: -1.5rem; bottom: 10%; }

.aff-stat {
  position: absolute;
  top: 1.25rem;
  right: 1.25rem;
  display: grid;
  gap: 0.15rem;
  min-width: 13rem;
  padding: 0.9rem 1.1rem;
  background: var(--white);
  border-radius: var(--radius-card-sm);
  box-shadow: var(--shadow-float);
}
.aff-stat__url { font-size: 0.75rem; font-weight: 700; color: var(--dim); }
.aff-stat__row {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  font-size: 0.9rem;
}
.aff-stat__row--sum {
  margin-top: 0.3rem;
  padding-top: 0.4rem;
  border-top: 1px solid var(--line-soft);
  color: var(--success);
  font-weight: 700;
}
.aff-stat__note { margin-top: 0.4rem; font-size: 0.68rem; color: var(--dim); }

/* ---------- perks grid: 4 cards, tighter min than .cards' 19rem ---------- */
.cards--3 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 15rem), 1fr)); }

/* ---------- earnings calculator ---------- */
.aff-calc {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 20rem), 1fr));
  gap: 2.5rem;
  align-items: center;
  padding: clamp(2rem, 4vw, 3.5rem);
  color: var(--white);
  background: var(--ink);
  border-radius: var(--radius-panel);
}
.aff-calc h2 { margin: 0 0 1rem; color: var(--white); font-size: var(--fs-h2); }
.aff-calc__intro {
  margin: 0 0 2rem;
  font-size: var(--fs-lead);
  line-height: 1.5;
  color: var(--text-on-inverse-muted);
}
.aff-range-label {
  display: flex;
  justify-content: space-between;
  margin-bottom: 0.8rem;
  font-weight: 700;
}
.aff-range-label span:last-child { color: var(--sky); }
#aff-n { width: 100%; accent-color: var(--red); }
.aff-calc__out {
  padding: 2rem;
  background: rgba(255, 255, 255, 0.06);
  border-radius: var(--radius-card);
  box-shadow: inset 0 0 0 1px var(--line-on-dark);
}
.aff-calc__label { font-weight: 600; color: var(--text-on-inverse-muted); }
.aff-calc__big {
  display: block;
  margin: 0.4rem 0 1.4rem;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(3rem, 7vw, 5.5rem);
  line-height: 1;
  letter-spacing: -0.05em;
}
.aff-calc__rows { display: grid; gap: 0.6rem; font-size: 0.95rem; }
.aff-calc__rows > div {
  display: flex;
  justify-content: space-between;
  padding-top: 0.6rem;
  border-top: 1px solid var(--line-on-dark);
}
.aff-calc__rows span { color: var(--text-on-inverse-muted); }
.aff-calc__rows b { color: var(--white); }
.aff-calc__rows > div:nth-child(2) b { color: var(--sky); }

/* ---------- apply ---------- */
.aff-apply {
  display: grid;
  grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr);
  gap: clamp(2rem, 5vw, 5rem);
  align-items: start;
}
.aff-form {
  display: grid;
  gap: 1.4rem;
  padding: clamp(1.75rem, 3.5vw, 3rem);
  background: var(--white);
  border-radius: var(--radius-panel);
  box-shadow: var(--shadow-card);
}
.aff-form__row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 14rem), 1fr));
  gap: 1rem;
}
.aff-form label {
  display: grid;
  gap: 0.5rem;
  font-size: 0.85rem;
  font-weight: 700;
}
.aff-form input[type="text"],
.aff-form input[type="email"] {
  width: 100%;
  padding: 0.9rem 1.25rem;
  font-family: var(--font-sans);
  font-size: 1rem;
  color: var(--ink);
  background: var(--white);
  border: 0;
  border-radius: var(--radius-pill);
  box-shadow: inset 0 0 0 1.5px var(--line);
}
.aff-form input:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.aff-field { margin: 0; padding: 0; border: 0; }
.aff-field legend { margin-bottom: 0.5rem; font-size: 0.85rem; font-weight: 700; }
.aff-chips { display: flex; flex-wrap: wrap; gap: 0.5rem; }

/* The chips. Without this rule every <button> inherits the global
   `button, .btn` red pill, so a SELECTED chip and an unselected one rendered
   identically — the click worked but nothing appeared to happen. Selected =
   ink fill (the same convention as .opt-chip in the configurator and
   OptionChip in the design system); idle = white with a hairline. */
.chip {
  border: 0;
  background: var(--white);
  color: var(--ink);
  border-radius: var(--radius-pill);
  padding: 0.6rem 1.1rem;
  font: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: inset 0 0 0 1.5px var(--line);
  -webkit-tap-highlight-color: transparent;
  transition: box-shadow var(--ease-fast), background var(--ease-fast), color var(--ease-fast);
}
.chip:hover { box-shadow: inset 0 0 0 1.5px var(--line-strong); color: var(--ink); filter: none; }
.chip[aria-pressed="true"] {
  background: var(--ink);
  color: var(--white);
  box-shadow: none;
}
.chip[aria-pressed="true"]:hover { color: var(--white); filter: brightness(1.1); }
.chip:active { transform: scale(0.96); }

/* one handle input per selected channel — the row is added and removed by
   page-affiliate.js as channels are toggled */
.aff-handles { display: grid; gap: 0.6rem; margin-top: 0.9rem; }
.aff-handles label { display: grid; gap: 0.4rem; font-size: 0.85rem; font-weight: 700; }

/* the slug field: a pill that reads "mossverket.se/r/" + the input */
.aff-slug {
  display: flex;
  align-items: center;
  padding-left: 1.25rem;
  background: var(--white);
  border-radius: var(--radius-pill);
  box-shadow: inset 0 0 0 1.5px var(--line);
}
.aff-slug > span { font-weight: 600; color: var(--dim); white-space: nowrap; }
.aff-slug input {
  flex: 1;
  min-width: 0;
  padding: 0.9rem 1.25rem 0.9rem 0.1rem;
  font-weight: 700;
  background: transparent;
  border: 0;
  box-shadow: none;
}
.aff-slug:focus-within { outline: 2px solid var(--focus); outline-offset: 2px; }
.aff-slug input:focus-visible { outline: none; }

.aff-form__foot {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
}
.aff-form__status { font-size: 0.92rem; }
.aff-form__status.ok { color: var(--success); }
.aff-form__status.err { color: var(--danger); }

/* the "tack" panel replaces the form after a successful send */
.aff-thanks {
  padding: clamp(2rem, 4vw, 3.5rem);
  text-align: center;
  background: var(--sky-50);
  border-radius: var(--radius-panel);
}
.aff-thanks .cockade { margin: 0 auto 1.5rem; }
.aff-thanks h3 { margin: 0 0 0.6rem; font-size: var(--fs-h3); }
.aff-thanks p { max-width: 28rem; margin: 0 auto; color: var(--dim); }
.aff-thanks b { color: var(--ink); }

@media (max-width: 860px) {
  .aff-apply { grid-template-columns: 1fr; }
  .aff-cockade { left: 0.5rem; }
  .aff-stat { right: 0.5rem; }
}

/* ---------- mobile (≤760px) ---------- */
@media (max-width: 760px) {
  /* the design keeps the stat card on a phone — it moves into the photo's
     corner and narrows (min-width 11.5rem) rather than disappearing */
  .aff-stat { right: 0.75rem; top: 0.75rem; min-width: 11.5rem; }
  .aff-hero__media img { aspect-ratio: 4 / 3; }
  /* cockade sits at the photo's bottom-left corner (design: 0.5rem/-1.25rem) */
  .aff-cockade { left: 0.5rem; bottom: -1.25rem; }
  .aff-calc__big { font-size: clamp(2.6rem, 13vw, 4rem); }
  .aff-form__row { grid-template-columns: 1fr; }
  .aff-slug > span { font-size: 0.9rem; }
}
