/*
 * Free Sample lead-capture modal: one question per screen, Typeform-style.
 * Scoped entirely under .fsm so it never touches landing-page styles.
 * Reuses .how-it-works__cta as-is for every primary button (per spec —
 * same gradient/radius/inset-highlight/spot-hover/focus-ring, and it also
 * picks up hero-cta-magnetic.js's magnetic pointer effect for free, since
 * that script's querySelectorAll runs after this markup already exists).
 */

.fsm {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  opacity: 0;
  visibility: hidden;
  transition: opacity 240ms ease;
}

.fsm[hidden] {
  display: none;
}

.fsm.is-open {
  opacity: 1;
  visibility: visible;
}

.fsm__scrim {
  position: absolute;
  inset: 0;
  background: rgba(17, 17, 17, 0.88);
  backdrop-filter: blur(22px);
  -webkit-backdrop-filter: blur(22px);
}

.fsm__panel {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 600px;
  max-height: min(720px, 100dvh - 48px);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  background: var(--cream);
  border-radius: 28px;
  box-shadow: 0 40px 100px rgba(17, 17, 17, 0.45);
  padding: 64px 48px 48px;
  transform: scale(0.96) translateY(12px);
  transition: transform 280ms cubic-bezier(0.16, 1, 0.3, 1);
}

.fsm.is-open .fsm__panel {
  transform: scale(1) translateY(0);
}

.fsm__back,
.fsm__close {
  position: absolute;
  top: 20px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  background: rgba(17, 17, 17, 0.06);
  color: var(--black);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 180ms ease, transform 180ms ease;
}

.fsm__back { left: 20px; }
.fsm__close { right: 20px; font-size: 22px; line-height: 1; }
.fsm__back[hidden] { display: none; }

.fsm__back:hover,
.fsm__close:hover {
  background: rgba(17, 17, 17, 0.12);
  transform: scale(1.08);
}

.fsm__back:focus-visible,
.fsm__close:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px var(--cream), 0 0 0 4.5px var(--orange);
}

/* Progress: thin orange bar + "Step N of 7" — only shown for the 7
   numbered steps, not the intro or the terminal result screens. */
.fsm__progress {
  margin: 0 0 32px;
  padding-right: 32px;
}

.fsm__progress-track {
  height: 4px;
  border-radius: 999px;
  background: rgba(17, 17, 17, 0.08);
  overflow: hidden;
}

.fsm__progress-bar {
  height: 100%;
  width: 0%;
  background: var(--orange);
  border-radius: 999px;
  transition: width 320ms ease;
}

.fsm__progress-label {
  margin: 10px 0 0;
  font-family: 'Inter', sans-serif;
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #8B4A1C;
}

.fsm__viewport {
  position: relative;
  overflow: hidden;
}

/* Sliding track: each .fsm__screen is a full-width slide; the track
   translates horizontally to the active one. Pure transform, same
   technique as the rest of the site's scroll-scrub work, just driven by
   step index instead of scroll position. */
.fsm__track {
  display: flex;
  width: 100%;
  will-change: transform;
  transition: transform 420ms cubic-bezier(0.16, 1, 0.3, 1);
}

.fsm__screen {
  flex: 0 0 100%;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

/* [hidden] loses to any same-specificity `display` rule targeting the same
   element, since author-origin CSS always wins over the UA stylesheet's
   own `[hidden] { display: none }` — every class below that sets its own
   `display` needs this explicit override or toggling .hidden in JS does
   nothing visually. */
.fsm__screen[hidden] {
  display: none;
}

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

  .fsm__panel {
    transition: none;
  }
}

.fsm__intro-headline {
  font-family: 'Inter', sans-serif;
  font-weight: 900;
  letter-spacing: -0.025em;
  font-size: clamp(2rem, 5vw, 2.75rem);
  line-height: 1.1;
  color: var(--black);
  margin: 0 0 20px;
  text-align: center;
}

.fsm__accent {
  font-family: 'Playfair Display', serif;
  font-style: italic;
  font-weight: 700;
  color: var(--orange);
}

.fsm__question {
  font-family: 'Inter', sans-serif;
  font-weight: 900;
  letter-spacing: -0.025em;
  font-size: clamp(1.6rem, 4.4vw, 2.35rem);
  line-height: 1.15;
  color: var(--black);
  margin: 0 0 16px;
  text-align: center;
}

.fsm__body {
  font-family: 'Inter', sans-serif;
  font-weight: 400;
  font-size: 16px;
  line-height: 1.6;
  color: #5C3317;
  margin: 0 0 28px;
  text-align: center;
}

.fsm__helper {
  font-family: 'Inter', sans-serif;
  font-weight: 500;
  font-size: 14px;
  line-height: 1.5;
  color: #5C3317;
  margin: 0 0 22px;
  text-align: center;
}

.fsm__small {
  font-family: 'Inter', sans-serif;
  font-weight: 500;
  font-size: 13px;
  color: #8B4A1C;
  margin: 18px 0 0;
  text-align: center;
}

/* Big, minimal Typeform-style input: no box, just a bottom rule that
   goes orange on focus. */
.fsm__input,
.fsm__textarea {
  display: block;
  width: 100%;
  border: none;
  border-bottom: 2px solid rgba(17, 17, 17, 0.18);
  background: transparent;
  padding: 10px 2px;
  font-family: 'Inter', sans-serif;
  font-weight: 500;
  font-size: clamp(1.1rem, 3vw, 1.4rem);
  color: var(--black);
  margin: 0 0 24px;
  transition: border-color 180ms ease;
}

.fsm__textarea {
  font-size: 16px;
  font-weight: 400;
  min-height: 110px;
  resize: vertical;
  line-height: 1.5;
  margin-bottom: 20px;
}

.fsm__input::placeholder,
.fsm__textarea::placeholder {
  color: rgba(17, 17, 17, 0.32);
}

.fsm__input:focus,
.fsm__textarea:focus {
  outline: none;
  border-bottom-color: var(--orange);
}

.fsm__input.fsm__field--invalid,
.fsm__textarea.fsm__field--invalid {
  border-bottom-color: #d33;
}

.fsm__error {
  margin: -16px 0 20px;
  font-family: 'Inter', sans-serif;
  font-weight: 500;
  font-size: 13px;
  color: #c62828;
  min-height: 1em;
  text-align: center;
}

.fsm__error:empty {
  display: none;
}

/* Chips (step 4, multi-select) */
.fsm__chips {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin: 0 0 28px;
}

.fsm__chip {
  font-family: 'Inter', sans-serif;
  font-weight: 700;
  font-size: 14px;
  color: var(--black);
  background: rgba(17, 17, 17, 0.05);
  border: 1.5px solid rgba(17, 17, 17, 0.14);
  border-radius: 999px;
  padding: 12px 20px;
  cursor: pointer;
  transition: background 180ms ease, border-color 180ms ease, color 180ms ease, transform 180ms ease;
}

.fsm__chip:hover {
  border-color: rgba(17, 17, 17, 0.32);
  transform: translateY(-1px);
}

.fsm__chip[aria-pressed="true"] {
  background: var(--orange);
  border-color: var(--orange);
  color: #FFFFFF;
}

.fsm__chip:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px var(--cream), 0 0 0 4.5px var(--orange);
}

/* Select (step 7 budget) */
.fsm__select-label {
  display: block;
  font-family: 'Inter', sans-serif;
  font-weight: 700;
  font-size: 14px;
  color: var(--black);
  margin: 0 0 8px;
  text-align: center;
}

.fsm__select {
  display: block;
  width: 100%;
  border: none;
  border-bottom: 2px solid rgba(17, 17, 17, 0.18);
  background: transparent;
  padding: 10px 2px;
  font-family: 'Inter', sans-serif;
  font-weight: 500;
  font-size: 16px;
  color: var(--black);
  margin: 0 0 10px;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='9' viewBox='0 0 14 9'%3E%3Cpath d='M1 1.5L7 7.5L13 1.5' stroke='%23111111' stroke-width='1.6' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 4px center;
}

.fsm__select:focus {
  outline: none;
  border-bottom-color: var(--orange);
}

/* File upload (step 6) */
.fsm__upload {
  display: block;
  border: 1.5px dashed rgba(17, 17, 17, 0.28);
  border-radius: 18px;
  padding: 28px 20px;
  text-align: center;
  cursor: pointer;
  margin: 0 0 18px;
  transition: border-color 180ms ease, background 180ms ease;
}

.fsm__upload:focus-within {
  border-color: var(--orange);
  box-shadow: 0 0 0 2px var(--cream), 0 0 0 4.5px var(--orange);
}

.fsm__upload:hover {
  border-color: var(--orange);
  background: rgba(255, 92, 0, 0.04);
}

.fsm__file-input {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.fsm__upload-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  font-family: 'Inter', sans-serif;
  font-weight: 600;
  font-size: 15px;
  color: #5C3317;
}

.fsm__upload-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(255, 92, 0, 0.12);
  color: var(--orange);
  font-size: 18px;
}

.fsm__upload-preview {
  display: flex;
  align-items: center;
  gap: 14px;
  text-align: left;
}

.fsm__upload-empty[hidden],
.fsm__upload-preview[hidden] {
  display: none;
}

.fsm__upload-thumb {
  width: 56px;
  height: 56px;
  border-radius: 10px;
  object-fit: cover;
  flex: none;
  background: rgba(17, 17, 17, 0.08);
}

.fsm__upload-filename {
  flex: 1;
  min-width: 0;
  font-family: 'Inter', sans-serif;
  font-weight: 600;
  font-size: 14px;
  color: var(--black);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.fsm__upload-replace {
  flex: none;
  font-family: 'Inter', sans-serif;
  font-weight: 700;
  font-size: 13px;
  color: var(--orange);
  text-decoration: underline;
}

.fsm__upload-progress {
  margin: 0 0 18px;
}

.fsm__upload-progress-track {
  height: 6px;
  border-radius: 999px;
  background: rgba(17, 17, 17, 0.08);
  overflow: hidden;
}

.fsm__upload-progress-bar {
  height: 100%;
  width: 0%;
  background: var(--orange);
  border-radius: 999px;
  transition: width 160ms ease;
}

.fsm__upload-progress-label {
  margin: 8px 0 0;
  font-family: 'Inter', sans-serif;
  font-weight: 600;
  font-size: 13px;
  color: #8B4A1C;
}

/* Primary CTA — .how-it-works__cta supplies the visual language; this
   sizes it to 70% of that shared style's own font-size/padding (16px /
   18px 34px) and 70% width, and is excluded from hero-cta-magnetic.js's
   targets (see that file) so the hover/active overrides below can be a
   plain zoom with no cursor-follow drift and no lift. */
.fsm__cta {
  width: 70%;
  margin: 4px auto 0;
  padding: 13px 24px;
  font-size: 11px;
}

/* Zoom on hover, but no drift — scale only, no translate, so it grows in
   place instead of sliding toward the cursor (the shared
   .how-it-works__cta:hover rule also lifts it -6px, which this
   overrides away). */
.fsm__cta:hover {
  transform: scale(1.045);
}

.fsm__cta:active {
  transform: scale(0.98);
}

.fsm__cta:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none !important;
}

.fsm__skip {
  display: block;
  width: 100%;
  text-align: center;
  margin: 16px 0 0;
  padding: 8px;
  font-family: 'Inter', sans-serif;
  font-weight: 600;
  font-size: 14px;
  color: #8B4A1C;
  text-decoration: underline;
  background: none;
  border: none;
  cursor: pointer;
}

.fsm__mailto {
  display: block;
  text-align: center;
  margin-top: 16px;
  font-family: 'Inter', sans-serif;
  font-weight: 700;
  font-size: 14px;
  color: var(--orange);
}

.fsm__screen--result {
  padding-top: 8px;
}

.fsm__sr-live {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Honeypot: visually hidden but NOT display:none (bots specifically
   check for and skip display:none/visibility:hidden fields). */
.fsm__honeypot {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
}

@media (max-width: 640px) {
  .fsm {
    padding: 0;
    align-items: flex-end;
  }

  .fsm__panel {
    max-width: none;
    max-height: 92dvh;
    width: 100%;
    border-radius: 24px 24px 0 0;
    padding: 56px 24px 32px;
  }

  .fsm.is-open .fsm__panel {
    transform: translateY(0);
  }

  .fsm__panel {
    transform: translateY(24px);
  }
}
