/*
 * AP Publisher Join Form — styles.
 *
 * Deliberately unopinionated about typography and colour beyond the WPForms
 * brand purple (#300c4a, taken from the form's own progress-indicator
 * setting). Everything inherits the host page's font stack so this drops into
 * the rebuilt /join/ page without fighting the site's own CSS.
 *
 * All custom properties are overridable from the host stylesheet.
 *
 * ⚠️ NO rem UNITS IN THIS FILE, DELIBERATELY. Measured 3 Dec 2026.
 *
 * This page loads /assets/library/css/bootstrap.min.css, and Bootstrap 3 sets
 * `html { font-size: 10px }`. rem is always root-relative, so every rem here
 * resolved to 62.5% of what it was authored for: the form's max-width was 460px
 * instead of 736px, the submit/next buttons 7px/15px of padding instead of
 * 11px/24px at a 10px inherited font-size, the textarea 80px tall instead of
 * 128px, and the field gap 12.5px instead of 20px. The whole form rendered
 * cramped and narrow, which is what "smaller than the old site" turned out to
 * mean - the two values first reported (label and field text) were only the
 * part that was easiest to name.
 *
 * All 41 rem values were converted to the px they were authored to mean, at the
 * 16px base this file assumed. Do not reintroduce rem unless the host's root
 * size is known: .jf-root cannot change what rem means for its own children,
 * so there is no local fix. em would work but compounds through nesting.
 */

.jf-root {
  --jf-brand: #300c4a;
  --jf-brand-ink: #ffffff;
  --jf-text: #1b1b1f;
  --jf-muted: #5c5c68;
  --jf-border: #c8c8d0;
  --jf-border-focus: var(--jf-brand);
  --jf-error: #b3261e;
  --jf-bg-subtle: #f6f5f8;
  /* Square corners, requested 2 Dec 2026. This is the single knob for it, so
     reverting is one line. It squares the buttons, the terms box, the alert and
     the confirmation panel as well as the fields - a form with square inputs
     and a rounded submit button reads as unfinished. */
  --jf-radius: 0;
  --jf-gap: 20px;

  /* Type sizes, requested 2 Dec 2026: labels 12px, field text 16px. Absolute
     px rather than rem on purpose - the host page's root size is not ours to
     rely on, and these were asked for as exact values. 16px on the controls
     also stops iOS Safari zooming the viewport on focus, which it does to any
     field under 16px. */
  --jf-label-size: 12px;
  --jf-field-size: 16px;

  color: var(--jf-text);
  max-width: 736px;
  margin: 0 auto;
  font-size: 16px;
  line-height: 1.5;
}

/* Visually hidden but available to screen readers. */
.jf-sr {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* ── progress ───────────────────────────────────────────────────────────── */

.jf-progress {
  margin-bottom: var(--jf-gap);
}

.jf-progress-track {
  height: 8px;
  background: var(--jf-bg-subtle);
  border-radius: 999px;
  overflow: hidden;
}

.jf-progress-bar {
  height: 100%;
  background: var(--jf-brand);
  border-radius: 999px;
  transition: width 250ms ease;
}

.jf-progress-text {
  margin: 8px 0 0;
  font-size: 14px;
  color: var(--jf-muted);
}

/* ── alerts and errors ──────────────────────────────────────────────────── */

.jf-alert {
  margin-bottom: var(--jf-gap);
  padding: 12px 16px;
  border-left: 4px solid var(--jf-error);
  background: #fdf0ef;
  color: var(--jf-error);
  border-radius: var(--jf-radius);
}

.jf-error {
  margin: 6px 0 0;
  color: var(--jf-error);
  font-size: 14px;
}

.jf-has-error .jf-input,
.jf-has-error .jf-select,
.jf-has-error .jf-file {
  border-color: var(--jf-error);
}

/* ── fields ─────────────────────────────────────────────────────────────── */

.jf-field {
  margin-bottom: var(--jf-gap);
}

/* .jf-label is on <label> for simple fields and on <legend> for the seven
   fieldsets (Name, Address, Offer Types, Affiliate Network, Traffic Channels,
   Terms). The legend case needs the extra resets below, because this page loads
   /assets/library/css/bootstrap.min.css BEFORE join-form.css, and Bootstrap
   ships:
     legend{display:block;width:100%;padding:0;margin-bottom:20px;
            font-size:21px;line-height:inherit;color:#333;border:0;
            border-bottom:1px solid #e5e5e5}
   That 21px and that border-bottom are what made "Name" read as a section
   heading with a rule under it. A class beats a bare element selector, so these
   win without !important. */
.jf-label {
  display: block;
  margin-bottom: 6px;
  font-weight: 600;
  font-size: var(--jf-label-size);
  /* Undo Bootstrap's legend treatment. */
  border-bottom: 0;
  color: inherit;
  line-height: inherit;
  width: auto;
}

.jf-sublabel {
  display: block;
  font-size: var(--jf-label-size);
  color: var(--jf-muted);
  /* Sits UNDER its field - see .jf-cols below - so the gap goes above it. */
  margin: 4px 0 0;
}

.jf-req {
  color: var(--jf-error);
}

.jf-desc {
  margin: 0 0 8px;
  font-size: 15px;
  color: var(--jf-muted);
}

.jf-hint {
  margin: 6px 0 0;
  font-size: 13px;
  color: var(--jf-muted);
}

.jf-fieldset {
  margin: 0;
  padding: 0;
  border: 0;
}

/* Covers every text-bearing control: 17 inputs, the 4 selects (.jf-input
   .jf-select) and the textarea (.jf-input .jf-textarea). */
.jf-input {
  display: block;
  width: 100%;
  padding: 10px 12px;
  font: inherit;
  /* MUST come after `font: inherit`, which resets font-size to the inherited
     value and would otherwise discard this. */
  font-size: var(--jf-field-size);
  color: inherit;
  background: #fff;
  border: 1px solid var(--jf-border);
  border-radius: var(--jf-radius);
  /* Without this, padding pushes the field past its container on iOS. */
  box-sizing: border-box;
}

.jf-input:focus-visible,
.jf-file:focus-visible,
.jf-btn:focus-visible,
.jf-choice input:focus-visible {
  outline: 2px solid var(--jf-border-focus);
  outline-offset: 2px;
}

.jf-textarea {
  resize: vertical;
  min-height: 128px;
}

.jf-file {
  display: block;
  width: 100%;
  padding: 8px;
  font-size: var(--jf-field-size);
  border: 1px dashed var(--jf-border);
  border-radius: var(--jf-radius);
  box-sizing: border-box;
}

/* ── layout helpers ─────────────────────────────────────────────────────── */

.jf-cols {
  display: grid;
  gap: 12px;
}

.jf-cols-2 {
  grid-template-columns: 1fr 1fr;
}

/* SUBLABELS UNDER THEIR FIELDS, requested 2 Dec 2026 for First and Last.
   Each cell is `<div><label class="jf-sublabel">First</label><input></div>`, so
   the label precedes the input in source order - which is what we want to keep
   for screen readers and for `for`/`id` association. Reordering visually with
   flex `order` leaves the DOM alone.
   `.jf-cols` is a safe hook: it appears exactly once in the built page, on the
   Name field. The choice groups use `.jf-choices.jf-cols-2`, which shares only
   the `jf-cols-2` modifier, so they are untouched.
   NOTE: the Address field's sublabels still sit above their inputs - it uses
   .jf-address, not .jf-cols. Only First/Last were asked for. */
.jf-cols > div {
  display: flex;
  flex-direction: column;
}

.jf-cols > div > .jf-sublabel {
  order: 2;
}

.jf-address {
  display: grid;
  gap: 12px;
  grid-template-columns: 1fr 1fr;
}

.jf-address .jf-addr-address1,
.jf-address .jf-addr-address2 {
  grid-column: 1 / -1;
}

/* Choice groups. The traffic-channel field has 44 options and is unreadable
   as a single column on a wide screen; auto-fit keeps it sane at every width
   without a media query per breakpoint. */
.jf-choices {
  display: grid;
  gap: 6px 16px;
}

.jf-choices.jf-cols-1 {
  grid-template-columns: 1fr;
}

.jf-choices.jf-cols-2,
.jf-choices.jf-cols-3 {
  grid-template-columns: repeat(auto-fit, minmax(224px, 1fr));
}

.jf-choice {
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.jf-choice input {
  margin-top: 4.8px;
  flex: none;
}

.jf-choice label {
  cursor: pointer;
}

/* ── terms and conditions ───────────────────────────────────────────────── */

/* ~59 KB of legal copy, reproduced verbatim from the source form. Scrollable
   so it does not push the submit button several screens down the page. */
.jf-terms {
  max-height: 288px;
  overflow-y: auto;
  padding: 16px;
  border: 1px solid var(--jf-border);
  border-radius: var(--jf-radius);
  background: var(--jf-bg-subtle);
  font-size: 13px;
  line-height: 1.45;
  color: var(--jf-text);
  /* Keyboard users must be able to scroll this; a focusable scroll container
     needs a visible focus ring. */
  scrollbar-gutter: stable;
}

.jf-terms h6 {
  margin: 16px 0 8px;
  font-size: 14px;
}

.jf-terms ol {
  padding-left: 20px;
}

.jf-terms p {
  margin: 0 0 12px;
}

/* ── navigation ─────────────────────────────────────────────────────────── */

.jf-nav {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 24px;
}

.jf-btn {
  font: inherit;
  font-weight: 600;
  padding: 11px 24px;
  border-radius: var(--jf-radius);
  border: 1px solid var(--jf-brand);
  background: var(--jf-brand);
  color: var(--jf-brand-ink);
  cursor: pointer;
}

.jf-btn-prev {
  background: transparent;
  color: var(--jf-brand);
}

.jf-btn[disabled] {
  opacity: 0.6;
  cursor: progress;
}

/* ── honeypot ───────────────────────────────────────────────────────────── */

/* Off-canvas rather than display:none — some bots skip hidden inputs, and a
   real visitor can neither see nor tab to this. */
.jf-hp {
  position: absolute !important;
  left: -9999px;
  top: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

/* ── confirmation ───────────────────────────────────────────────────────── */

.jf-confirmation {
  padding: 24px;
  border-left: 4px solid var(--jf-brand);
  background: var(--jf-bg-subtle);
  border-radius: var(--jf-radius);
  font-size: 18px;
}

.jf-confirmation p {
  margin: 0;
}

.jf-captcha {
  margin-top: var(--jf-gap);
}

/* ── narrow screens ─────────────────────────────────────────────────────── */

@media (max-width: 512px) {
  .jf-cols-2,
  .jf-address {
    grid-template-columns: 1fr;
  }
  .jf-nav .jf-btn {
    flex: 1 1 auto;
  }
}

/* ── motion and contrast preferences ────────────────────────────────────── */

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

@media (prefers-contrast: more) {
  .jf-root {
    --jf-border: #000;
    --jf-muted: #333;
  }
}
