/* ==========================================================================
   Lead capture section — sits below the hero (.countdown), page scrolls to
   reach it. Split layout: a cropped detail shot of the cover photo on one
   side, a "be the first to know" form on the other. Stacks to one column
   on narrow viewports.
   ========================================================================== */

.lead {
  position: relative;
  width: 100%;
  display: flex;
  background: var(--countdown-bg);
}

/* ---- Media: a closer crop of the same cover photo, not a new asset ----- */

.lead__media {
  position: relative;
  flex: 1 1 45%;
  min-height: 320px;
  overflow: hidden;
}

.lead__media-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  /* Dedicated 4:5 shot (helmet + covered bike, same amber-gold studio
     light as the hero) — see assets/images/lead-reveal-detail.webp.
     The panel itself is wider than the image (~1.12:1 vs 0.8:1), so
     cover crops the top/bottom; biased slightly up to keep more of the
     floor reflection than the empty haze above the light beam. */
  object-position: 50% 42%;
}

/* Bridges the hard cut between sections: the hero fades to solid black
   at its own bottom edge (.countdown__gradient) and this used to start
   again immediately at full brightness with an unrelated crop right
   below it — a jarring "solid black, then suddenly a zoomed photo" cut
   that read as two disconnected images. Fading in from the same
   background colour at the top continues that same dip-to-black beat
   instead of cutting straight through it. */
.lead__media::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 1;
  background: linear-gradient(to bottom, var(--countdown-bg) 0%, transparent 32%);
  pointer-events: none;
}

/* ---- Panel: heading, subtext, form -------------------------------------- */

.lead__panel {
  flex: 1 1 55%;
  display: flex;
  align-items: center;
  box-sizing: border-box;
  padding: clamp(32px, 6vh, 80px) clamp(24px, 5vw, 96px);
}

.lead__panel-inner {
  width: 100%;
  max-width: 520px;
}

.lead__rule {
  display: block;
  width: 40px;
  height: 2px;
  margin-bottom: clamp(12px, 2vh, 20px);
  background: var(--brand-red);
}

.lead__heading {
  margin: 0 0 clamp(10px, 1.6vh, 16px);
  font-family: var(--countdown-heading-font);
  font-weight: 400;
  font-size: clamp(28px, 4vh, 44px);
  line-height: 1.1;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: var(--countdown-message-color);
}

.lead__heading-accent {
  color: var(--brand-red);
}

.lead__subtext {
  margin: 0 0 clamp(20px, 3vh, 32px);
  font-family: var(--countdown-font);
  font-size: clamp(14px, 1.8vh, 17px);
  line-height: 1.5;
  color: var(--countdown-message-color);
}

/* ---- Form fields ---------------------------------------------------------- */

.lead__form {
  display: flex;
  flex-direction: column;
  gap: clamp(12px, 1.8vh, 18px);
}

/* An explicit display:flex above needs an equally explicit override here —
   author-origin CSS always beats the browser's built-in [hidden]{display:
   none} rule regardless of specificity, so without this the form stays
   visible even once lead-form.js sets form.hidden = true. */
.lead__form[hidden] {
  display: none;
}

.lead__field {
  position: relative;
}

.lead__field input {
  width: 100%;
  box-sizing: border-box;
  font-family: var(--countdown-font);
  font-size: 15px;
  color: var(--countdown-label-color);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--countdown-card-border);
  border-radius: 8px;
  padding: 14px 44px 14px 16px;
  appearance: none;
}

.lead__field input::placeholder {
  color: rgba(240, 240, 240, 0.45);
}

.lead__field input:focus-visible {
  outline: 2px solid var(--brand-red);
  outline-offset: 1px;
}

.lead__field-icon {
  position: absolute;
  top: 50%;
  right: 16px;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  color: rgba(240, 240, 240, 0.55);
  pointer-events: none;
}

/* ---- Terms text (implied consent — no checkbox, just a submit-time
   notice, per the reference design) ------------------------------------------ */

.lead__terms {
  margin: 0;
  text-align: left;
  font-family: var(--countdown-font);
  font-size: 12.5px;
  line-height: 1.6;
  color: rgba(240, 240, 240, 0.6);
}

.lead__terms a {
  color: var(--brand-red);
  font-weight: 700;
  text-decoration: underline;
}

.lead__terms a:hover,
.lead__terms a:focus-visible {
  color: #e2233a;
}

/* ---- WhatsApp updates toggle (optional, separate from the terms notice
   above) ----------------------------------------------------------------------- */

.lead__toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
}

/* Visually hidden but still a real, focusable checkbox — the label wrapper
   already makes the whole row clickable, and :focus-visible on this input
   drives the outline on the track below via the sibling selector. */
.lead__toggle-input {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
  padding: 0;
}

.lead__toggle-track {
  position: relative;
  flex: 0 0 auto;
  width: 40px;
  height: 22px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.15);
  transition: background 200ms ease;
}

.lead__toggle-thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--brand-red);
  transition: transform 200ms ease;
}

.lead__toggle-input:checked + .lead__toggle-track {
  background: rgba(205, 25, 45, 0.35);
}

.lead__toggle-input:checked + .lead__toggle-track .lead__toggle-thumb {
  transform: translateX(18px);
}

.lead__toggle-input:focus-visible + .lead__toggle-track {
  outline: 2px solid var(--brand-red);
  outline-offset: 2px;
}

.lead__toggle-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: var(--countdown-font);
  font-size: 13px;
  color: rgba(240, 240, 240, 0.75);
}

.lead__toggle-icon {
  width: 18px;
  height: 18px;
  color: #25d366;
}

@media (prefers-reduced-motion: reduce) {
  .lead__toggle-track,
  .lead__toggle-thumb {
    transition: none;
  }
}

/* ---- Submit ---------------------------------------------------------------- */

.lead__submit {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  appearance: none;
  border: none;
  border-radius: 8px;
  padding: 15px 24px;
  margin-top: 4px;
  font-family: var(--countdown-font);
  font-weight: 700;
  font-size: 14px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: #ffffff;
  background: var(--brand-red);
  cursor: pointer;
  transition: background 200ms ease;
}

.lead__submit:hover {
  background: #e2233a;
}

.lead__submit:focus-visible {
  outline: 2px solid #ffffff;
  outline-offset: 2px;
}

.lead__submit:disabled {
  opacity: 0.6;
  cursor: default;
}

.lead__submit-icon {
  width: 16px;
  height: 16px;
}

/* ---- Status message (shown after submit) ----------------------------------- */

.lead__status {
  margin: 12px 0 0;
  font-family: var(--countdown-font);
  font-size: 13px;
  line-height: 1.5;
  color: var(--countdown-message-color);
  min-height: 1.5em;
}

.lead__status[data-status="error"] {
  color: #ff8a8a;
}

.lead__status[data-status="success"] {
  color: #8fd19e;
}

/* ---- Thank-you (swapped in for the form on a successful submit) ------------ */

.lead__thanks {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 4px 0;
}

.lead__thanks[hidden] {
  display: none;
}

.lead__thanks-icon {
  flex: 0 0 auto;
  width: 32px;
  height: 32px;
  color: var(--brand-red);
}

.lead__thanks-text {
  margin: 0;
  font-family: var(--countdown-font);
  font-size: clamp(14px, 1.8vh, 17px);
  line-height: 1.5;
  color: var(--countdown-label-color);
}

/* ---- Submit overlay: blurs the page and shows a loader while a
   submission is in flight (see lead-form.js) ---------------------------------- */

.page-content {
  transition: filter 200ms ease;
}

.page-content.is-blurred {
  filter: blur(6px);
}

.lead__overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  background: rgba(1, 1, 1, 0.45);
  opacity: 0;
  pointer-events: none;
  transition: opacity 200ms ease;
}

.lead__overlay.is-visible {
  opacity: 1;
  pointer-events: auto;
}

.lead__spinner {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 4px solid rgba(255, 255, 255, 0.25);
  border-top-color: var(--brand-red);
  animation: lead-spin 800ms linear infinite;
}

@keyframes lead-spin {
  to {
    transform: rotate(360deg);
  }
}

.lead__overlay-text {
  margin: 0;
  font-family: var(--countdown-font);
  font-size: 14px;
  letter-spacing: 0.5px;
  color: #ffffff;
}

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

  .page-content,
  .lead__overlay {
    transition: none;
  }

  /* No spin, but the "Submitting…" text still communicates the state. */
  .lead__spinner {
    animation: none;
    border-top-color: rgba(255, 255, 255, 0.25);
  }
}

/* ---- Stack to one column on narrow viewports ------------------------------- */

@media (max-width: 768px) {
  .lead {
    flex-direction: column;
  }

  /* Dropped on mobile — the extra image height was adding scroll for no
     real benefit at this width, and the form is the actual point of
     this section. Desktop keeps it (see .lead__media above). */
  .lead__media {
    display: none;
  }

  .lead__panel {
    padding: 32px 20px 48px;
  }

  .lead__panel-inner {
    max-width: none;
  }
}
