/* ==========================================================================
   Saint Polaire — lead capture takeover (10% off for an email or a phone)
   Pairs with assets/lead-capture.js. No build step, no framework, no deps.

   MOBILE IS THE POINT, so the rules that are load-bearing are called out:

     · 16px inputs.  Anything smaller and iOS Safari ZOOMS the whole page on
       focus, which is the single ugliest layout jump on a mobile modal. Every
       field and button here is pinned at 16px.
     · No 100vh.  The overlay is `position: fixed` at top/left/right with an
       explicit height, and lead-capture.js drives that height from
       window.visualViewport so the sheet tracks the visible area exactly when
       the on-screen keyboard opens instead of being pushed off-screen.
     · 44px minimum on everything tappable (Apple HIG / WCAG 2.2 §2.5.8);
       inputs and the primary button are 52px.
     · env(safe-area-inset-*) padding so nothing lands under a home indicator
       or in a notch.

   Namespaced `splc-` throughout — this file is dropped onto pages with ~2000
   lines of their own CSS and must not touch any of it.
   ========================================================================== */

/* Self-contained box model. The host pages happen to carry a `* { box-sizing:
   border-box }` reset, but this component must not DEPEND on that — without
   it every min-height below is silently inflated by its own padding and the
   52px tap targets stop being 52px. Verified in a browser: 82px before this
   rule, 52px after. */
.splc-overlay,
.splc-overlay *,
.splc-overlay *::before,
.splc-overlay *::after {
  box-sizing: border-box;
}

.splc-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 100%;
  z-index: 2147480000; /* above the site's own max (i18n panel, 9999) */
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(22, 32, 46, 0.62);
  -webkit-backdrop-filter: saturate(120%) blur(3px);
  backdrop-filter: saturate(120%) blur(3px);
  opacity: 0;
  transition: opacity 0.42s cubic-bezier(0.2, 0.6, 0.2, 1);
  overscroll-behavior: contain;
}

.splc-overlay[data-open='1'] {
  opacity: 1;
}

.splc-panel {
  position: relative;
  display: flex;
  width: min(920px, 94vw);
  max-width: 920px;
  height: min(560px, 86vh);
  max-height: 86vh;
  overflow: hidden;
  background: #ffffff;
  box-shadow: 0 30px 90px rgba(12, 18, 28, 0.42);
  transform: translateY(14px) scale(0.985);
  transition: transform 0.5s cubic-bezier(0.2, 0.6, 0.2, 1);
}

.splc-overlay[data-open='1'] .splc-panel {
  transform: none;
}

/* ── Left: the brand panel. Pure type, no image asset to fail to load. ───── */

.splc-brand {
  flex: 0 0 42%;
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 48px 40px;
  background: #3c4f69;
  color: #ffffff;
}

.splc-brand::after {
  /* A very quiet polar wash — no asset, no request. */
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(120% 80% at 20% 0%, rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0) 60%),
    radial-gradient(90% 70% at 90% 100%, rgba(184, 153, 104, 0.22), rgba(184, 153, 104, 0) 65%);
  pointer-events: none;
}

.splc-wordmark {
  position: relative;
  font-family: 'Cormorant Garamond', Georgia, 'Times New Roman', serif;
  font-style: italic;
  font-weight: 400;
  font-size: 15px;
  letter-spacing: 0.42em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.74);
  margin-bottom: 26px;
}

.splc-offer {
  position: relative;
  font-family: 'Cormorant Garamond', Georgia, 'Times New Roman', serif;
  font-weight: 300;
  font-size: clamp(34px, 4.6vw, 52px);
  line-height: 1.06;
  letter-spacing: 0.01em;
}

.splc-offer em {
  font-style: italic;
  color: #e3c48c;
}

.splc-rule {
  position: relative;
  width: 54px;
  height: 1px;
  margin: 26px 0 22px;
  background: #b89968;
}

.splc-brand-note {
  position: relative;
  font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Helvetica Neue', sans-serif;
  font-weight: 300;
  font-size: 14px;
  line-height: 1.72;
  color: rgba(255, 255, 255, 0.78);
  max-width: 30ch;
}

/* ── Right: the form. ────────────────────────────────────────────────────── */

.splc-form-side {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 48px 44px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Helvetica Neue', sans-serif;
  color: #1a1a1a;
}

.splc-eyebrow {
  font-size: 10px;
  font-weight: 400;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: rgba(26, 26, 26, 0.5);
  margin-bottom: 12px;
}

.splc-title {
  font-family: 'Cormorant Garamond', Georgia, 'Times New Roman', serif;
  font-weight: 300;
  font-size: 28px;
  line-height: 1.2;
  margin-bottom: 10px;
}

.splc-sub {
  font-size: 14px;
  font-weight: 300;
  line-height: 1.66;
  color: rgba(26, 26, 26, 0.62);
  margin-bottom: 24px;
}

/* Email / Phone switcher — two real buttons so each field can carry the right
   type + inputmode + autocomplete and the phone keypad actually appears. */
.splc-tabs {
  display: flex;
  gap: 0;
  margin-bottom: 18px;
  border-bottom: 1px solid rgba(26, 26, 26, 0.14);
}

.splc-tab {
  flex: 1 1 0;
  min-height: 44px;
  padding: 12px 8px;
  border: 0;
  border-bottom: 1px solid transparent;
  margin-bottom: -1px;
  background: none;
  cursor: pointer;
  font-family: inherit;
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: rgba(26, 26, 26, 0.48);
  transition: color 0.25s ease, border-color 0.25s ease;
}

.splc-tab[aria-selected='true'] {
  color: #3c4f69;
  border-bottom-color: #3c4f69;
}

.splc-field {
  display: none;
}

.splc-field[data-active='1'] {
  display: block;
}

.splc-label {
  display: block;
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgba(26, 26, 26, 0.52);
  margin-bottom: 8px;
}

.splc-input {
  width: 100%;
  min-height: 52px;
  padding: 14px 16px;
  border: 1px solid rgba(26, 26, 26, 0.2);
  border-radius: 0;
  background: #fbfbfa;
  font-family: inherit;
  /* 16px EXACTLY — see the header note about iOS focus zoom. */
  font-size: 16px;
  line-height: 1.4;
  color: #1a1a1a;
  -webkit-appearance: none;
  appearance: none;
  transition: border-color 0.25s ease, background 0.25s ease;
}

.splc-input:focus {
  outline: none;
  border-color: #3c4f69;
  background: #ffffff;
}

.splc-input::placeholder {
  color: rgba(26, 26, 26, 0.34);
}

/* Honeypot: off-screen, never focusable, never announced. */
.splc-hp {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.splc-btn {
  display: block;
  width: 100%;
  min-height: 52px;
  margin-top: 18px;
  padding: 16px 20px;
  border: 1px solid #3c4f69;
  background: #3c4f69;
  color: #ffffff;
  cursor: pointer;
  font-family: inherit;
  font-size: 11px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  transition: background 0.3s ease, color 0.3s ease, opacity 0.3s ease;
}

.splc-btn:hover {
  background: #2f3f56;
  border-color: #2f3f56;
}

.splc-btn[disabled] {
  opacity: 0.55;
  cursor: default;
}

.splc-decline {
  display: block;
  width: 100%;
  min-height: 44px;
  margin-top: 12px;
  padding: 10px;
  border: 0;
  background: none;
  cursor: pointer;
  font-family: inherit;
  font-size: 11px;
  letter-spacing: 0.1em;
  color: rgba(26, 26, 26, 0.48);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.splc-fine {
  margin-top: 16px;
  font-size: 11px;
  line-height: 1.6;
  color: rgba(26, 26, 26, 0.42);
}

.splc-msg {
  margin-top: 12px;
  font-size: 12px;
  line-height: 1.5;
  color: #7a2727;
  min-height: 1px;
}

.splc-close {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 0;
  background: none;
  cursor: pointer;
  color: rgba(26, 26, 26, 0.55);
  font-size: 22px;
  line-height: 1;
  z-index: 2;
}

.splc-close:hover {
  color: #1a1a1a;
}

/* ── Success state ───────────────────────────────────────────────────────── */

.splc-done {
  display: none;
}

.splc-panel[data-state='done'] .splc-form {
  display: none;
}

.splc-panel[data-state='done'] .splc-done {
  display: block;
}

.splc-code-row {
  display: flex;
  align-items: stretch;
  gap: 10px;
  margin: 18px 0 6px;
}

.splc-code {
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 56px;
  padding: 14px 16px;
  border: 1px dashed #b89968;
  background: rgba(184, 153, 104, 0.09);
  font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Helvetica Neue', sans-serif;
  font-size: 18px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: #1a1a1a;
  word-break: break-all;
}

.splc-copy {
  flex: 0 0 auto;
  min-width: 96px;
  min-height: 56px;
  padding: 10px 16px;
  border: 1px solid #3c4f69;
  background: #ffffff;
  color: #3c4f69;
  cursor: pointer;
  font-family: inherit;
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  transition: background 0.25s ease, color 0.25s ease;
}

.splc-copy:hover {
  background: #3c4f69;
  color: #ffffff;
}

/* ── Focus visibility (keyboard users must always see where they are) ────── */

.splc-overlay :focus-visible {
  outline: 2px solid #b89968;
  outline-offset: 2px;
}

/* ── Mobile: full-screen sheet ───────────────────────────────────────────── */

@media (max-width: 780px) {
  .splc-overlay {
    padding: 0;
    align-items: stretch;
  }

  .splc-panel {
    width: 100%;
    max-width: none;
    height: 100%;
    max-height: none;
    flex-direction: column;
    box-shadow: none;
    transform: translateY(22px);
  }

  .splc-brand {
    flex: 0 0 auto;
    padding: calc(28px + env(safe-area-inset-top)) 24px 26px;
  }

  .splc-wordmark {
    margin-bottom: 16px;
    font-size: 13px;
  }

  .splc-offer {
    font-size: clamp(30px, 9vw, 40px);
  }

  .splc-rule {
    margin: 18px 0 14px;
  }

  .splc-brand-note {
    font-size: 13.5px;
    max-width: none;
  }

  .splc-form-side {
    flex: 1 1 auto;
    justify-content: flex-start;
    padding: 26px 24px calc(26px + env(safe-area-inset-bottom));
  }

  .splc-close {
    top: calc(4px + env(safe-area-inset-top));
    right: 6px;
    color: rgba(255, 255, 255, 0.82);
  }

  .splc-close:hover {
    color: #ffffff;
  }

  /* On a short landscape phone the brand block would eat the form. */
  @media (max-height: 560px) {
    .splc-brand {
      padding-top: calc(18px + env(safe-area-inset-top));
      padding-bottom: 18px;
    }

    .splc-offer {
      font-size: 28px;
    }

    .splc-brand-note {
      display: none;
    }
  }
}

@media (prefers-reduced-motion: reduce) {
  .splc-overlay,
  .splc-panel {
    transition: none;
  }
}

/* Print: never. */
@media print {
  .splc-overlay {
    display: none !important;
  }
}
