/* ====== Ignition · Modals ======
   The shared .lp-modal system for every modal and pop-up: sign-in, account panel,
   Submit Feedback, Show Your Support (and Build Your Crew's sign-in, Phase 1.6).

   Global on purpose: linked on every page and NOT gated by body.lp-ignition, so a
   modal looks the same on legacy and Ignition pages (directive §3). Reads tokens only.

   Markup:
     <div class="lp-modal" id="…" role="dialog" aria-modal="true" aria-labelledby="…">
       <div class="lp-modal__panel">
         <button class="lp-modal__close" type="button" aria-label="Close">…</button>
         <h3 class="lp-modal__title">…</h3> <p class="lp-modal__sub">…</p>
         …body: .lp-modal__input, .lp-modal__btn (--go | --sec), .lp-modal__fine, .lp-modal__error
       </div>
     </div>
   Open/close by toggling .active on .lp-modal (what auth-page.js and modals.js already
   do). modals.js adds the shared behavior: Esc closes, focus moves in and back out.

   Contents
     1. Overlay + panel
     2. Header + close
     3. Form controls + buttons
     4. Account panel
     5. HubSpot embeds (feedback form, payments)
     6. Reduced motion */

/* ── 1. Overlay + panel ── */
.lp-modal {
  position: fixed;
  inset: 0;
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(4, 4, 8, .72);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  opacity: 0;
  pointer-events: none;
  visibility: hidden;
  transition: opacity .2s ease, visibility 0s linear .2s;
  font-family: var(--lp-font);
  -webkit-font-smoothing: antialiased;
}
.lp-modal.active {
  opacity: 1;
  pointer-events: auto;
  visibility: visible;
  transition: opacity .2s ease;
}
.lp-modal__panel {
  position: relative;
  width: 100%;
  max-width: 440px;
  max-height: calc(100vh - 32px);
  max-height: calc(100dvh - 32px);
  overflow-y: auto;
  box-sizing: border-box;
  padding: 28px;
  border-radius: var(--lp-radius-card);
  border: 1px solid var(--lp-surface-live-border);
  background: var(--lp-surface-live);
  box-shadow: var(--lp-inset-hi), 0 30px 80px -20px rgba(0, 0, 0, .7);
  color: var(--lp-text-body);
  text-align: left;
  transform: scale(.96);
  transition: transform .2s var(--lp-ease);
  scrollbar-width: thin;
  scrollbar-color: var(--lp-surface-live-border) transparent;
}
.lp-modal.active .lp-modal__panel { transform: scale(1); }
.lp-modal__panel--wide { max-width: 480px; }
/* Phones: a bottom sheet */
@media (max-width: 480px) {
  .lp-modal { align-items: flex-end; padding: 0; }
  .lp-modal__panel {
    max-width: none;
    max-height: 92vh;
    max-height: 92dvh;
    border-radius: var(--lp-radius-card) var(--lp-radius-card) 0 0;
    padding: 24px 20px calc(24px + env(safe-area-inset-bottom, 0px));
    transform: translateY(24px);
  }
  .lp-modal.active .lp-modal__panel { transform: none; }
}

/* ── 2. Header + close ── */
.lp-modal__mark {
  display: block;
  width: 40px;
  height: 40px;
  margin-bottom: 16px;
  border-radius: 50%;
}
.lp-modal__title {
  margin: 0 40px 8px 0;
  font-family: var(--lp-font);
  font-size: 22px;
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: -.01em;
  color: var(--lp-text);
}
.lp-modal__sub {
  margin: 0 0 20px;
  font-size: 15px;
  line-height: 1.5;
  color: var(--lp-text-body);
}
.lp-modal__sub strong { color: var(--lp-text); font-weight: 700; word-break: break-all; }
.lp-modal__close {
  position: absolute;
  top: 16px;
  right: 16px;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: var(--lp-radius-btn);
  border: 1px solid var(--lp-surface-live-border);
  background: var(--lp-hover);
  color: var(--lp-text-2);
  cursor: pointer;
  transition: color .15s, border-color .15s;
}
.lp-modal__close:hover { color: var(--lp-text); border-color: rgba(var(--lp-green-rgb), .55); }
.lp-modal__close svg { width: 16px; height: 16px; }
.lp-modal :focus-visible { outline: var(--lp-focus); outline-offset: 3px; }

/* ── 3. Form controls + buttons ── */
.lp-modal__form { display: flex; flex-direction: column; gap: 12px; margin: 0; }
.lp-modal__input {
  width: 100%;
  height: 46px;
  box-sizing: border-box;
  padding: 0 14px;
  border-radius: var(--lp-radius-btn);
  border: 1px solid var(--lp-surface-live-border);
  background: var(--lp-field);
  color: var(--lp-text);
  font-family: var(--lp-font);
  font-size: 15px;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.lp-modal__input::placeholder { color: var(--lp-text-faint); }
/* One ring only: the field's own green border replaces the global focus outline */
.lp-modal__input:focus { border-color: var(--lp-green); box-shadow: 0 0 0 1px var(--lp-green); }
.lp-modal__input:focus-visible { outline: none; }
.lp-modal__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 46px;
  padding: 0 20px;
  border-radius: var(--lp-radius-btn);
  border: 0;
  font-family: var(--lp-font);
  font-size: 15px;
  font-weight: 700;
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
  transition: filter .15s, border-color .15s, color .15s, background-color .15s;
}
.lp-modal__btn--block { width: 100%; }
/* Primary CTA: the classic Squad4 orange, dark ink. Sign-in's Send Login Link is the
   main call to action of the experience (Scott, 2026-11-14). */
.lp-modal__btn--cta {
  width: 100%;
  background: var(--lp-cta-grad);
  color: var(--lp-cta-ink);
  box-shadow: var(--lp-inset-hi), 0 8px 24px -10px rgba(var(--lp-cta-rgb), .7);
}
.lp-modal__btn--cta:hover { background: var(--lp-cta-grad-hover); color: var(--lp-cta-ink-hover); }
/* Green: other submits (e.g. Feedback) */
.lp-modal__btn--go {
  width: 100%;
  background: var(--lp-green-grad);
  color: var(--lp-green-ink);
  box-shadow: var(--lp-inset-hi), 0 8px 24px -10px rgba(var(--lp-green-rgb), .7);
}
.lp-modal__btn--go:hover { filter: brightness(1.06); }
.lp-modal__btn--sec {
  background: var(--lp-hover);
  color: var(--lp-text);
  box-shadow: inset 0 0 0 1px var(--lp-surface-live-border);
}
.lp-modal__btn--sec:hover { box-shadow: inset 0 0 0 1px rgba(var(--lp-green-rgb), .55); }
.lp-modal__btn:disabled { opacity: .6; cursor: not-allowed; filter: none; }
.lp-modal__btn svg { width: 15px; height: 15px; flex-shrink: 0; }
.lp-modal__fine {
  margin: 14px 0 0;
  font-size: 13px;
  line-height: 1.5;
  color: var(--lp-text-muted);
}
.lp-modal__fine a,
.lp-modal__sub a { color: var(--lp-green-soft); text-decoration: underline; text-underline-offset: 2px; }
.lp-modal__fine a:hover,
.lp-modal__sub a:hover { color: var(--lp-text); }
.lp-modal__error {
  margin: 10px 0 0;
  font-size: 13px;
  line-height: 1.4;
  color: var(--lp-danger);
}
.lp-modal__error:empty { display: none; }
.lp-modal__check {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  margin-bottom: 16px;
  border-radius: 50%;
  color: var(--lp-green);
  background: rgba(var(--lp-green-rgb), .12);
  box-shadow: inset 0 0 0 1px rgba(var(--lp-green-rgb), .4);
}
.lp-modal__check svg { width: 22px; height: 22px; }
.lp-modal__state > .lp-modal__btn--sec { width: 100%; }

/* ── 4. Account panel ── */
.lp-modal__account {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 8px 0 22px;
  padding: 14px;
  border-radius: var(--lp-radius-tile);
  background: var(--lp-field);
  box-shadow: inset 0 0 0 1px var(--lp-surface-live-border);
}
.lp-modal__avatar {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  font-size: 18px;
  font-weight: 800;
  color: var(--lp-green-ink);
  background: var(--lp-green-grad);
}
.lp-modal__account-text { min-width: 0; }
.lp-modal__email {
  font-size: 15px;
  font-weight: 700;
  color: var(--lp-text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.lp-modal__uid { margin-top: 3px; font-family: var(--lp-mono); font-size: 12px; color: var(--lp-text-muted); }
.lp-modal__uid:empty { display: none; }

/* ── 5. HubSpot embeds ──
   Feedback: HubSpot's form markup, restyled to match .lp-modal__input/__btn.
   !important only where HubSpot's own stylesheet uses it. */
.lp-modal .hs-form fieldset { max-width: 100% !important; }
.lp-modal .hs-form-field { margin-bottom: 16px; }
.lp-modal .hs-form label:not(.hs-form-booleancheckbox-display) {
  display: block;
  margin-bottom: 6px;
  font-family: var(--lp-font);
  font-size: 13px;
  font-weight: 700;
  color: var(--lp-text-2);
}
.lp-modal .hs-form-required { color: var(--lp-green); margin-left: 2px; }
.lp-modal .hs-input {
  width: 100% !important;
  box-sizing: border-box !important;
  min-height: 46px;
  padding: 11px 14px !important;
  border-radius: var(--lp-radius-btn) !important;
  border: 1px solid var(--lp-surface-live-border) !important;
  background: var(--lp-field) !important;
  color: var(--lp-text) !important;
  font-family: var(--lp-font) !important;
  font-size: 15px !important;
  outline: none !important;
  transition: border-color .15s, box-shadow .15s !important;
}
.lp-modal .hs-input:focus { border-color: var(--lp-green) !important; box-shadow: 0 0 0 1px var(--lp-green) !important; }
.lp-modal .hs-input:focus-visible { outline: none; }
.lp-modal .hs-input::placeholder { color: var(--lp-text-faint) !important; }
.lp-modal select.hs-input {
  -webkit-appearance: none !important;
  appearance: none !important;
  cursor: pointer;
  padding-right: 36px !important;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%23a39b9d' fill='none' stroke-width='1.5'/%3E%3C/svg%3E") !important;
  background-repeat: no-repeat !important;
  background-position: right 14px center !important;
}
.lp-modal select.hs-input.is-placeholder { color: var(--lp-text-faint) !important; }
.lp-modal textarea.hs-input { min-height: 110px; resize: vertical; line-height: 1.5; }
.lp-modal .hs-button.primary {
  width: 100%;
  height: 46px;
  padding: 0 20px !important;
  border: 0 !important;
  border-radius: var(--lp-radius-btn) !important;
  background: var(--lp-green-grad) !important;
  color: var(--lp-green-ink) !important;
  font-family: var(--lp-font) !important;
  font-size: 15px !important;
  font-weight: 700 !important;
  cursor: pointer;
  box-shadow: var(--lp-inset-hi), 0 8px 24px -10px rgba(var(--lp-green-rgb), .7);
}
.lp-modal .hs-button.primary:hover { filter: brightness(1.06); }
.lp-modal .inputs-list,
.lp-modal .hs-form-booleancheckbox { list-style: none !important; padding: 0 !important; margin: 0 !important; }
.lp-modal .hs-form-booleancheckbox::marker { content: none; }
.lp-modal .hs-form-booleancheckbox-display { display: flex; align-items: flex-start; gap: 8px; cursor: pointer; }
.lp-modal .hs-form-booleancheckbox-display input[type="checkbox"] {
  width: 16px !important;
  height: 16px;
  margin: 2px 0 0 !important;
  flex-shrink: 0;
  accent-color: var(--lp-green);
}
.lp-modal .hs-form-booleancheckbox-display > span,
.lp-modal .hs-form-booleancheckbox-display > span strong {
  font-size: 13px !important;
  font-weight: 400 !important;
  line-height: 1.5 !important;
  color: var(--lp-text-muted) !important;
  text-transform: none !important;
}
.lp-modal .legal-consent-container { margin: 8px 0 16px; }
.lp-modal .legal-consent-container .hs-richtext,
.lp-modal .legal-consent-container p { font-size: 13px; line-height: 1.5; color: var(--lp-text-muted); }
.lp-modal .legal-consent-container a { color: var(--lp-green-soft); }
.lp-modal .hs-error-msgs { list-style: none; padding: 0; margin: 6px 0 0; }
.lp-modal .hs-error-msgs label { margin: 0 !important; font-size: 13px !important; font-weight: 400 !important; color: var(--lp-danger) !important; }
.lp-modal .submitted-message { padding: 20px 0; text-align: center; font-size: 16px; color: var(--lp-green-soft); }

/* Payments: HubSpot's checkout iframe is light-themed, so it sits on its own white card */
.lp-modal__panel--embed { max-width: 520px; height: min(82vh, 760px); display: flex; flex-direction: column; }
.lp-modal__embed {
  flex: 1;
  min-height: 0;
  margin-top: 4px;
  overflow: hidden;
  border-radius: var(--lp-radius-tile);
  background: #ffffff;
}
.lp-modal__embed .payments-iframe-container,
.lp-modal__embed .payments-iframe-container iframe { width: 100% !important; height: 100% !important; border: 0; }

/* Touch: 16px text in fields so iOS Safari doesn't zoom the page on focus */
@media (pointer: coarse) {
  .lp-modal__input,
  .lp-modal .hs-input { font-size: 16px !important; }
}

/* ── 6. Reduced motion ── */
@media (prefers-reduced-motion: reduce) {
  .lp-modal,
  .lp-modal.active,
  .lp-modal__panel { transition: none; }
  .lp-modal__panel { transform: none; }
}

/* Screen-reader-only text inside modals (components.css's .lp-sr-only is Ignition-gated) */
.lp-modal .lp-sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Print: modals never print (pages used to hide their own copies) */
@media print {
  .lp-modal { display: none !important; }
}
