/* ==========================================================================
   Launch Labs — SHAPE modal
   Clicking "Begin SHAPE" (data-shape-open) no longer scrolls to an embedded
   form — it opens this fullscreen, one-question-at-a-time modal instead
   (wired in js/shape-modal.js). The homepage stays visible underneath,
   dimmed and blurred, never unmounted.

   Calm and premium by design: one dark panel, generous padding, rounded
   corners, no heavy shadow, no gradients. Large single-column typography —
   this is meant to feel like the opening pages of a strategy workshop, not
   a web form in a lightbox.

   Structure: .shape-modal (fixed, full viewport, always present — opacity/
              pointer-events toggle on .is-open rather than display, so the
              open/close transition can animate) -> .shape-modal__overlay
              (blur + scrim, click to close) -> .shape-modal__panel (the
              actual dialog) -> close button, progress dots, then
              .shape-modal__stage holding every .shape-modal__step. Only the
              step carrying .is-active is displayed; switching steps is
              handled entirely in JS (display swap + a fade/rise replay).
   ========================================================================== */

body.shape-modal-open {
  overflow: hidden;
}

/* The homepage dims and softens behind the modal, but is never removed
   from the DOM — .final-cta's own reveal state, scroll position etc. all
   survive a close. */
body.shape-modal-open > header,
body.shape-modal-open > main {
  filter: blur(10px) brightness(0.7);
  transition: filter 0.6s var(--ease);
}

.shape-modal {
  --ink: #FFFFFF;
  --ink-muted: rgba(255, 255, 255, 0.66);
  --ink-soft: rgba(255, 255, 255, 0.5);
  --ink-faint: rgba(255, 255, 255, 0.36);
  --hairline: rgba(255, 255, 255, 0.14);
  --contrast: #D92632;

  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(1rem, 4vw, 3rem);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.5s var(--ease);
}

.shape-modal.is-open {
  opacity: 1;
  pointer-events: auto;
}

.shape-modal__overlay {
  position: absolute;
  inset: 0;
  background: rgba(1, 2, 2, 0.78);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.shape-modal__panel {
  position: relative;
  width: 100%;
  max-width: 40rem;
  max-height: min(46rem, 90vh);
  display: flex;
  flex-direction: column;
  background: #0c0c0e;
  border: 1px solid var(--hairline);
  border-radius: 28px;
  box-shadow: 0 30px 70px rgba(0, 0, 0, 0.35);
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: clamp(2.5rem, 6vw, 4rem);
  color: var(--ink);
  opacity: 0;
  transform: translateY(20px) scale(0.97);
  transition: opacity 0.5s var(--ease), transform 0.5s var(--ease);
}

.shape-modal.is-open .shape-modal__panel {
  opacity: 1;
  transform: translateY(0) scale(1);
}

@media (max-width: 32rem) {
  .shape-modal {
    padding: 0;
  }

  .shape-modal__panel {
    max-width: none;
    max-height: none;
    height: 100%;
    border-radius: 0;
    border: none;
  }
}

/* ==========================================================================
   Close button
   ========================================================================== */
.shape-modal__close {
  position: absolute;
  top: clamp(1.25rem, 3vw, 1.75rem);
  right: clamp(1.25rem, 3vw, 1.75rem);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 50%;
  color: var(--ink-soft);
  transition: color 0.3s var(--ease-ui), background-color 0.3s var(--ease-ui);
}

.shape-modal__close svg {
  width: 1.05rem;
  height: 1.05rem;
}

@media (hover: hover) and (pointer: fine) {
  .shape-modal__close:hover {
    color: var(--ink);
    background: rgba(255, 255, 255, 0.06);
  }
}

.shape-modal__close:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}

/* ==========================================================================
   Progress dots
   ========================================================================== */
.shape-modal__progress {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: clamp(2rem, 5vw, 3rem);
}

.shape-modal__dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--hairline);
  transition: background-color 0.4s var(--ease), transform 0.4s var(--ease), width 0.4s var(--ease);
}

.shape-modal__dot.is-filled {
  background: var(--contrast);
}

.shape-modal__dot.is-current {
  width: 20px;
  border-radius: 3px;
}

/* ==========================================================================
   Steps
   ========================================================================== */
.shape-modal__stage {
  position: relative;
}

.shape-modal__step {
  display: none;
}

.shape-modal__step.is-active {
  display: block;
}

.shape-modal__step.is-anim {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.5s var(--ease), transform 0.5s var(--ease);
}

.shape-modal__step.is-anim.is-shown {
  opacity: 1;
  transform: translateY(0);
}

.shape-modal__eyebrow {
  font-family: 'Hanken Grotesk', sans-serif;
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--contrast);
}

.shape-modal__heading {
  margin-top: 0.75rem;
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: clamp(2rem, 4.5vw, 2.75rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.15;
  color: var(--ink);
}

.shape-modal__copy {
  margin-top: 1.1rem;
  max-width: 30rem;
  font-size: 1.0625rem;
  line-height: 1.65;
  color: var(--ink-muted);
}

.shape-modal__time {
  margin-top: 0.5rem;
  font-size: 0.875rem;
  color: var(--ink-faint);
}

.shape-modal__index {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  color: var(--ink-faint);
}

.shape-modal__question {
  display: block;
  margin-top: 0.85rem;
  max-width: 26rem;
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: clamp(1.625rem, 4vw, 2.25rem);
  font-weight: 700;
  letter-spacing: -0.018em;
  line-height: 1.3;
  color: var(--ink);
}

/* ---------- Radio options ---------- */
.shape-modal__options {
  margin-top: clamp(2rem, 4vw, 2.5rem);
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
}

.shape-modal__option {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  padding: 1rem 1.2rem;
  border-radius: 14px;
  border: 1px solid var(--hairline);
  cursor: pointer;
  transition:
    border-color 0.3s var(--ease-ui), background-color 0.3s var(--ease-ui),
    box-shadow 0.3s var(--ease-ui), transform 0.3s var(--ease-ui);
}

@media (hover: hover) and (pointer: fine) {
  .shape-modal__option:hover {
    border-color: rgba(255, 255, 255, 0.28);
    transform: translateX(3px);
  }
}

.shape-modal__option:has(input:checked) {
  border-color: var(--contrast);
  background: rgba(217, 38, 50, 0.07);
  box-shadow: 0 0 0 1px var(--contrast), 0 10px 24px rgba(217, 38, 50, 0.14);
}

.shape-modal__option span {
  font-size: 1rem;
  color: var(--ink-muted);
}

.shape-modal__option:has(input:checked) span {
  color: var(--ink);
}

.shape-modal__option input[type="radio"] {
  appearance: none;
  -webkit-appearance: none;
  position: relative;
  width: 1.1rem;
  height: 1.1rem;
  flex: 0 0 auto;
  margin: 0;
  border-radius: 50%;
  border: 1.5px solid var(--hairline);
  transition: border-color 0.3s var(--ease-ui);
}

.shape-modal__option input[type="radio"]::before {
  content: '';
  position: absolute;
  inset: 3px;
  border-radius: 50%;
  background: var(--contrast);
  transform: scale(0);
  transition: transform 0.25s var(--ease-ui);
}

.shape-modal__option input[type="radio"]:checked {
  border-color: var(--contrast);
}

.shape-modal__option input[type="radio"]:checked::before {
  transform: scale(1);
}

.shape-modal__option input[type="radio"]:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 3px;
}

/* ---------- Textareas + text inputs ---------- */
.shape-modal__textarea,
.shape-modal__group input {
  display: block;
  width: 100%;
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--hairline);
  color: var(--ink);
  font-family: 'Hanken Grotesk', sans-serif;
  font-size: 1.1875rem;
  line-height: 1.65;
  transition: border-color 0.3s var(--ease-ui);
}

.shape-modal__textarea::placeholder,
.shape-modal__group input::placeholder {
  color: var(--ink-faint);
}

.shape-modal__textarea:focus,
.shape-modal__group input:focus {
  outline: none;
  border-color: var(--contrast);
}

.shape-modal__textarea {
  margin-top: clamp(2rem, 4vw, 2.5rem);
  min-height: 4rem;
  padding: 0.25rem 0.1rem 0.75rem;
  resize: none;
  overflow: hidden;
}

/* ---------- Final screen: contact form ---------- */
.shape-modal__form {
  margin-top: clamp(2rem, 4vw, 2.5rem);
  display: flex;
  flex-direction: column;
  gap: 1.75rem;
}

.shape-modal__row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.75rem;
}

.shape-modal__group {
  display: flex;
  flex-direction: column;
}

.shape-modal__group label {
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--ink-soft);
  margin-bottom: 0.6rem;
}

.shape-modal__group input {
  padding: 0.5rem 0.1rem 0.7rem;
}

.shape-modal__optional {
  font-weight: 400;
  color: var(--ink-faint);
}

.shape-modal__reassurance {
  margin-top: 1.5rem;
  font-size: 0.8125rem;
  line-height: 1.6;
  color: var(--ink-faint);
}

/* ---------- Success ---------- */
.shape-modal__check {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 3rem;
  height: 3rem;
  border-radius: 50%;
  border: 1px solid rgba(217, 38, 50, 0.4);
  color: var(--contrast);
}

.shape-modal__check svg {
  width: 1.35rem;
  height: 1.35rem;
}

.shape-modal__step[data-step="success"] .shape-modal__heading {
  margin-top: 1.1rem;
}

/* ==========================================================================
   Actions (Back / Continue)
   ========================================================================== */
.shape-modal__actions {
  margin-top: clamp(2.5rem, 5vw, 3rem);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
}

.shape-modal__actions--start {
  justify-content: flex-start;
}

.shape-modal__next {
  padding: 1.05rem 2.5rem;
  font-size: 0.9375rem;
}

.shape-modal__back {
  font-family: 'Hanken Grotesk', sans-serif;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--ink-soft);
  padding: 0.5rem 0;
  transition: color 0.3s var(--ease-ui);
}

@media (hover: hover) and (pointer: fine) {
  .shape-modal__back:hover {
    color: var(--ink);
  }
}

.shape-modal__back:focus-visible,
.shape-modal__next:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 3px;
}

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 30rem) {
  .shape-modal__row {
    grid-template-columns: 1fr;
    gap: 1.25rem;
  }

  .shape-modal__actions {
    flex-direction: column-reverse;
    align-items: stretch;
    gap: 1rem;
  }

  .shape-modal__back {
    text-align: center;
  }
}
