/* =========================================================================
   RealTAG · Registration.Portal
   Modern split-screen sign-up: a branded value panel paired with the form.
   Full-bleed on desktop and mobile — no floating box.
   Palette: #BF311A (RealTAG red) · ink #131920 · off-white #F9FAFB canvas,
   per the iLeads Brand Style Guide v29. Supporting greys are cool to match.
   Type: Inter for body/UI, Montserrat for headings and uppercase labels
   (loaded by css/fonts.css); system UI stack as the fallback.
   ========================================================================= */

:root {
  --red: #BF311A;
  --red-dark: #a52915;
  --ink: #131920;
  --ink-soft: #555;
  --muted: #888;
  --canvas: #F9FAFB;
  --card: #fff;
  --border: #a6adb8;
  --border-soft: #e3e7eb;
  --ok: #1a8a4a;
  --radius-sm: 6px;
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Helvetica, Arial, sans-serif;
  --font-display: "Montserrat", "Inter", system-ui, -apple-system, "Segoe UI", Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

/* Ensure the [hidden] attribute wins over display rules below. */
[hidden] { display: none !important; }

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--card);
  color: var(--ink);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

::placeholder { color: #aeb5be; }

/* =========================================================================
   Layout — two full-height columns on desktop, stacked on mobile.
   ========================================================================= */
.auth {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.12fr);
}

/* =========================================================================
   Brand / value panel
   ========================================================================= */
.brand-panel {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: hidden;
  display: flex;
  color: #fff;
  /* Anchored on brand ink (#131920) with RealTAG red blended into the lit
     corner: ~45% red at the origin, ~20% by the midpoint, pure ink at the edge. */
  background:
    radial-gradient(120% 90% at 15% 10%, #60241d 0%, #351e1f 52%, #131920 100%);
}

/* Concentric bullseye motif echoing the logo mark — large, faint, bottom-left. */
.brand-rings {
  position: absolute;
  left: -240px;
  bottom: -260px;
  width: 720px;
  height: 720px;
  border-radius: 50%;
  background:
    repeating-radial-gradient(circle at center,
      rgba(255, 255, 255, .05) 0 2px,
      transparent 2px 54px);
  -webkit-mask-image: radial-gradient(circle at center, #000 60%, transparent 72%);
          mask-image: radial-gradient(circle at center, #000 60%, transparent 72%);
  pointer-events: none;
}
/* A warm red glow behind the rings for depth. */
.brand-panel::after {
  content: "";
  position: absolute;
  right: -180px;
  top: -160px;
  width: 460px;
  height: 460px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(191, 49, 26, .42), transparent 70%);
  pointer-events: none;
}

.brand-inner {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 48px;
  width: 100%;
  max-width: 620px;
  margin-left: auto;     /* hug the dividing line */
  padding: 56px clamp(40px, 5vw, 80px);
}

/* ---- Hero copy ---- */
.brand-hero { max-width: 46ch; }
.brand-title {
  font: 800 clamp(30px, 3.4vw, 44px)/1.08 var(--font-display);
  letter-spacing: -0.02em;
  margin: 0 0 18px;
}
.brand-sub {
  font: 400 clamp(15px, 1.3vw, 17px)/1.6 var(--font);
  color: rgba(255, 255, 255, .72);
  margin: 0 0 32px;
  max-width: 46ch;
}

.brand-points {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  /* Uniform row height keeps every target evenly spaced, whether the copy
     runs one line or wraps to two. */
  gap: 4px;
}
.brand-points li {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  min-height: 64px;
  font: 400 16.5px/1.5 var(--font);
  color: rgba(255, 255, 255, .9);
}
.brand-points strong { font-weight: 700; color: #fff; }
/* Concentric target rings echoing the RealTAG logo mark, sized to read as
   the bullseye itself rather than an icon inside a badge. The monogram is
   always #BF311A (never recolored), alternating with black. */
.bp-ico {
  flex: 0 0 auto;
  width: 26px;
  height: 26px;
  margin-top: -2px;   /* optically center the target on the first line */
  border-radius: 50%;
  background: radial-gradient(circle at center,
    var(--red) 0 3px,
    #000 3px 6px,
    var(--red) 6px 8px,
    #000 8px 11px,
    var(--red) 11px 13px,
    transparent 13px);
}

.brand-foot {
  font: 400 13.5px/1.5 var(--font);
  color: rgba(255, 255, 255, .5);
  margin: 0;
}

/* =========================================================================
   Form panel
   ========================================================================= */
.form-panel {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--canvas);
  padding: 48px clamp(24px, 4vw, 64px);
}
.form-shell {
  width: 100%;
  max-width: 460px;
}

.brand-logo {
  height: 46px;
  width: auto;
  display: block;
  margin: 0 0 30px;
}

.form-head { margin: 0 0 28px; }
.reg-card h1 {
  font: 800 28px/1.12 var(--font-display);
  letter-spacing: -0.02em;
  color: var(--ink);
  margin: 0 0 8px;
}
.lede {
  font: 400 15px/1.55 var(--font);
  color: var(--ink-soft);
  margin: 0;
}

/* =========================================================================
   Fields
   ========================================================================= */
.field { margin: 0 0 16px; }
.field-row { display: flex; gap: 14px; }
.field-row .field { flex: 1; }
/* City / State / ZIP: city gets the room, state and ZIP are short codes. */
.field-row.addr-row .field.city { flex: 1.9; }
.field-row.addr-row .field.state { flex: 1; }
.field-row.addr-row .field.zip { flex: 1.1; }

label {
  display: block;
  font: 600 11px/1 var(--font-display);
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 7px;
}
label .optional {
  text-transform: none;
  letter-spacing: 0;
  font-weight: 400;
  color: #aaa;
}

.input-wrap { position: relative; }

input {
  width: 100%;
  height: 46px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0 38px 0 14px;
  font: 400 15px/1 var(--font);
  color: var(--ink);
  background: #fff;
  transition: border-color .15s ease, box-shadow .15s ease;
}
input:focus {
  outline: none;
  border-color: var(--red);
  box-shadow: 0 0 0 3px rgba(191, 49, 26, .12);
}

/* ---------- Address line 2: a quiet companion under the street input ---------- */
/* Same group as the street address (one label, one feedback slot). Shorter and
   smaller so it reads as optional at a glance; most registrants tab straight past. */
.addr2-wrap { margin-top: 8px; }
.addr2-wrap input {
  height: 40px;
  font-size: 14px;
  padding-right: 14px;   /* no status icon on this one */
}

/* ---------- State select, styled to match the inputs ---------- */
select {
  width: 100%;
  height: 46px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0 30px 0 12px;
  font: 400 15px/1.2 var(--font);
  color: var(--ink);
  background: #fff;
  appearance: none;
  -webkit-appearance: none;
  transition: border-color .15s ease, box-shadow .15s ease;
}
select:focus {
  outline: none;
  border-color: var(--red);
  box-shadow: 0 0 0 3px rgba(191, 49, 26, .12);
}
/* Placeholder color while nothing is picked; registration.js drops the class on change. */
select.is-empty { color: #aeb5be; }
.select-wrap::after {
  content: "";
  position: absolute;
  right: 13px;
  top: 50%;
  transform: translateY(-50%);
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-top: 6px solid var(--muted);
  pointer-events: none;
}
.field.is-valid select { border-color: var(--ok); }
.field.is-invalid select { border-color: var(--red); }

/* ---------- Two-step flow ---------- */
.steps {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 16px;
}
.steps .bar {
  height: 4px;
  width: 64px;
  border-radius: 2px;
  background: var(--border-soft);
}
.steps .bar.is-on { background: var(--red); }
.steps .step-label {
  font: 700 11px/1 var(--font-display);
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
  margin-left: 6px;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0;
  border: none;
  background: none;
  font: 600 13.5px/1 var(--font);
  color: var(--ink-soft);
  cursor: pointer;
  margin: 18px 0 0;
}
.back-link:hover { color: var(--ink); }
.back-link:focus-visible { outline: 2px solid var(--red); outline-offset: 2px; }
.back-link svg { width: 15px; height: 15px; display: block; }

/* ---------- Password strength meter (12+ chars, a letter, a number) ---------- */
.pw-meter { display: flex; gap: 5px; margin: 7px 0 0; }
.pw-meter span {
  height: 4px;
  flex: 1;
  border-radius: 2px;
  background: var(--border-soft);
  transition: background .15s ease;
}
.pw-meter.m1 span:first-child { background: var(--red); }
.pw-meter.m2 span:nth-child(-n+2) { background: #d98a16; }
.pw-meter.m3 span { background: var(--ok); }

/* ---------- Password show/hide toggle ---------- */
.pw-toggle {
  position: absolute;
  right: 6px;
  top: 23px;                 /* matches the 46px input's vertical center */
  transform: translateY(-50%);
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  padding: 0;
  border: none;
  background: none;
  color: var(--muted);
  cursor: pointer;
  border-radius: var(--radius-sm);
}
.pw-toggle:hover { color: var(--ink); }
.pw-toggle:focus-visible { outline: 2px solid var(--red); outline-offset: 1px; }
.pw-toggle svg { width: 20px; height: 20px; display: block; }
.pw-toggle .ico-eye-off { display: none; }
.pw-toggle.is-on .ico-eye { display: none; }
.pw-toggle.is-on .ico-eye-off { display: block; }

/* Reserve room for the toggle, and tuck the validation icon to its left. */
.input-wrap.has-toggle input { padding-right: 66px; }
.input-wrap.has-toggle .status-icon { right: 42px; }

/* ---------- Per-field validation states ---------- */
.field.is-valid input { border-color: var(--ok); }
.field.is-valid input:focus { box-shadow: 0 0 0 3px rgba(26, 138, 74, .14); }
.field.is-invalid input { border-color: var(--red); }
.field.is-invalid input:focus { box-shadow: 0 0 0 3px rgba(191, 49, 26, .14); }

.feedback {
  font: 400 12.5px/1.4 var(--font);
  margin: 6px 0 0;
  min-height: 16px;
  color: var(--muted);
}
.field.is-valid .feedback { color: var(--ok); }
.field.is-invalid .feedback { color: var(--red); }
.field.is-checking .feedback { color: var(--muted); }

/* Status icon inside the input (✓ / ✗ / spinner) */
.status-icon {
  position: absolute;
  right: 12px;
  top: 23px;                 /* vertical center of the 46px input */
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  display: none;
}
.field.is-valid .status-icon,
.field.is-invalid .status-icon,
.field.is-checking .status-icon { display: block; }

.field.is-valid .status-icon::after {
  content: "✓";
  color: var(--ok);
  font-size: 15px;
  font-weight: 700;
  line-height: 18px;
}
.field.is-invalid .status-icon::after {
  content: "✕";
  color: var(--red);
  font-size: 14px;
  font-weight: 700;
  line-height: 18px;
}
.field.is-checking .status-icon {
  border: 2px solid #ddd;
  border-top-color: var(--red);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: translateY(-50%) rotate(360deg); } }

/* ---------- Form-level error ---------- */
.form-error {
  background: #fdf3f1;
  border: 1px solid #f0cdc6;
  border-radius: var(--radius-sm);
  color: #7d2414;
  font: 400 14px/1.45 var(--font);
  padding: 12px 14px;
  margin: 0 0 18px;
}

/* ---------- Terms of Service / Privacy consent ---------- */
.field.consent { margin: 2px 0 18px; }
.consent-label {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 0;
  /* Override the uppercase field-label defaults for readable sentence copy.
     12.5px (down from 13.5) so the whole line fits one row at the card's width;
     it still wraps gracefully on narrow phones. */
  text-transform: none;
  letter-spacing: 0;
  font: 400 12.5px/1.5 var(--font);
  color: var(--ink-soft);
  cursor: pointer;
}
.consent-check {
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  margin: 1px 0 0;
  accent-color: var(--red);
  cursor: pointer;
}
.consent-text a { color: var(--red); font-weight: 600; text-decoration: none; }
.consent-text a:hover { text-decoration: underline; }
.field.consent .feedback { margin-left: 28px; }
.field.consent.is-invalid .consent-text { color: var(--red); }
.field.consent.is-invalid .consent-check { outline: 2px solid var(--red); outline-offset: 2px; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border-radius: var(--radius-sm);
  font: 700 16px/1 var(--font);
  cursor: pointer;
  border: none;
  text-decoration: none;
  transition: background .15s ease, color .15s ease, transform .05s ease, box-shadow .15s ease;
}
.btn-block { width: 100%; height: 50px; margin-top: 6px; }
.btn-primary {
  background: var(--red);
  color: #fff;
  box-shadow: 0 1px 2px rgba(191, 49, 26, .25);
}
.btn-primary:hover { background: var(--red-dark); }
.btn-primary:active { transform: translateY(1px); }
.btn:disabled { opacity: .6; cursor: not-allowed; }

.btn-spinner { display: none; width: 18px; height: 18px;
  border: 2px solid rgba(255,255,255,.5); border-top-color: #fff;
  border-radius: 50%; animation: btnspin .7s linear infinite; }
.btn.is-loading .btn-spinner { display: inline-block; }
.btn.is-loading .btn-label { opacity: .85; }
@keyframes btnspin { to { transform: rotate(360deg); } }

.signin {
  font: 400 14px/1.5 var(--font);
  color: var(--muted);
  text-align: center;
  margin: 22px 0 0;
}
.signin a { color: var(--red); font-weight: 600; text-decoration: none; }
.signin a:hover { text-decoration: underline; }

/* =========================================================================
   Success card
   ========================================================================= */
.success-body { text-align: center; }
.success-check {
  width: 56px; height: 56px; margin: 4px auto 18px;
  border-radius: 50%; background: rgba(26,138,74,.12); color: var(--ok);
  font-size: 28px; line-height: 56px; font-weight: 700;
}
.success-card h1 {
  font: 800 28px/1.12 var(--font-display); letter-spacing: -0.02em; margin: 0 0 8px;
}
.success-card .lede { text-align: center; margin: 0 auto 24px; }

/* =========================================================================
   Responsive — stack the panels, keep the form edge-to-edge (never a box).
   ========================================================================= */
/* =========================================================================
   Confirmation summary (verify-recipient)
   A read-only "here is what you are agreeing to" block. Deliberately plain and
   high-contrast: it is the only thing standing between a stranger's inbox and a
   recurring email, so the address has to be the most legible thing on the page.
   ========================================================================= */
.summary {
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
  margin: 0 0 20px;
  padding: 4px 16px;
}
.summary-row {
  border-bottom: 1px solid var(--border-soft);
  padding: 12px 0;
}
.summary-row:last-child { border-bottom: 0; }
.summary dt {
  color: var(--muted);
  font: 600 11px/1.2 var(--font-display);
  letter-spacing: .06em;
  text-transform: uppercase;
  margin: 0 0 4px;
}
.summary dd {
  color: var(--ink);
  font: 600 16px/1.35 var(--font);
  margin: 0;
  /* Long addresses must wrap rather than widen the card or get clipped. */
  overflow-wrap: anywhere;
}

.fine-print {
  color: var(--ink-soft);
  font: 400 13px/1.5 var(--font);
  margin: 16px 0 0;
  text-align: center;
}

@media (max-width: 900px) {
  .auth { grid-template-columns: 1fr; }

  /* Keep the panel a positioned containing block so overflow:hidden still
     clips the decorative rings/glow — otherwise they spill past the viewport
     and create horizontal scroll into the canvas. */
  .brand-panel {
    position: relative;
    height: auto;
    min-height: auto;
  }
  .brand-inner {
    max-width: none;
    margin: 0;
    gap: 24px;
    padding: 40px clamp(24px, 6vw, 56px) 44px;
  }
  /* Trim the hero to a compact, full-width banner on top. */
  .brand-hero { max-width: none; }
  .brand-title { margin-bottom: 10px; }
  .brand-sub { margin-bottom: 0; max-width: 56ch; }
  .brand-points,
  .brand-foot { display: none; }
  .brand-rings { left: auto; right: -300px; bottom: -360px; }

  .form-panel {
    align-items: flex-start;
    padding: 40px clamp(24px, 6vw, 56px) 56px;
  }
  .form-shell { max-width: 540px; margin: 0 auto; }
}

@media (max-width: 520px) {
  .brand-inner { padding: 30px 22px 34px; }
  .form-panel { padding: 28px 22px 44px; }
  .reg-card h1 { font-size: 24px; }
  .field-row { flex-direction: column; gap: 0; }
}
