/* ============================================================
   bloomind.dev — Modal "Start Project"
   Formulario de contacto premium en 2 pasos.
   Hereda los tokens del sistema visual (styles.css).
   ============================================================ */

/* ---------- Overlay / backdrop ---------- */
.sp-overlay {
  position: fixed; inset: 0; z-index: 1000;
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
  background: rgba(12, 11, 16, .42);
  -webkit-backdrop-filter: blur(8px) saturate(120%);
  backdrop-filter: blur(8px) saturate(120%);
  opacity: 0;
  transition: opacity .26s cubic-bezier(.4, 0, .2, 1);
}
.sp-overlay.is-open      { opacity: 1; }
.sp-overlay.is-closing   { opacity: 0; }
.sp-overlay[hidden]      { display: none; }

/* ---------- Panel ---------- */
.sp-modal {
  position: relative;
  width: 100%; max-width: 440px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow:
    0 2px 6px rgba(16,16,16,.06),
    0 24px 60px -16px rgba(16,16,16,.30),
    0 60px 120px -40px rgba(16,16,16,.34);
  padding: 32px 32px 30px;
  transform: translateY(10px) scale(.97);
  opacity: 0;
  transition: transform .3s cubic-bezier(.16, 1, .3, 1), opacity .26s ease;
  max-height: calc(100dvh - 48px);
  overflow-y: auto;
}
.sp-overlay.is-open    .sp-modal { transform: translateY(0) scale(1); opacity: 1; }
.sp-overlay.is-closing .sp-modal { transform: translateY(8px) scale(.98); opacity: 0; }

@media (prefers-reduced-motion: reduce) {
  .sp-overlay, .sp-modal { transition: opacity .12s linear; }
  .sp-overlay.is-open .sp-modal { transform: none; }
}

/* ---------- Close button ---------- */
.sp-close {
  position: absolute; top: 16px; right: 16px;
  width: 34px; height: 34px;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid transparent; border-radius: 999px;
  background: transparent; color: var(--muted);
  cursor: pointer;
  transition: background .16s ease, color .16s ease, border-color .16s ease;
}
.sp-close:hover { background: var(--surface-2); color: var(--ink); border-color: var(--line); }
.sp-close svg { width: 17px; height: 17px; }

/* ---------- Header ---------- */
.sp-head { margin-bottom: 22px; padding-right: 28px; }
.sp-eyebrow {
  font-family: var(--font-mono); font-size: 11px; font-weight: 700;
  letter-spacing: .16em; text-transform: uppercase; color: var(--faint);
  display: block; margin-bottom: 10px;
}
.sp-title {
  font-family: var(--font-display); font-weight: 700;
  font-size: 23px; line-height: 1.18; letter-spacing: -.02em;
  color: var(--ink); margin: 0 0 6px;
}
.sp-desc { font-family: var(--font-body); font-size: 14.5px; line-height: 1.5; color: var(--muted); margin: 0; }

/* ---------- Progress ---------- */
.sp-progress { display: flex; gap: 6px; margin-bottom: 22px; }
.sp-progress span {
  flex: 1; height: 3px; border-radius: 999px;
  background: var(--line); transition: background .3s ease;
}
.sp-progress span.is-active { background: var(--ink); }

/* ---------- Steps ---------- */
.sp-step { display: none; flex-direction: column; gap: 14px; }
.sp-step.is-active { display: flex; animation: sp-step-in .32s cubic-bezier(.16, 1, .3, 1); }
@keyframes sp-step-in {
  from { opacity: 0; transform: translateX(10px); }
  to   { opacity: 1; transform: translateX(0); }
}
@media (prefers-reduced-motion: reduce) { .sp-step.is-active { animation: none; } }

/* ---------- Fields ---------- */
.sp-field { display: flex; flex-direction: column; gap: 7px; }
.sp-field label {
  font-family: var(--font-body); font-size: 13px; font-weight: 600; color: var(--ink-2);
}
.sp-input, .sp-textarea {
  font-family: var(--font-body); font-size: 15px; color: var(--ink);
  background: var(--surface-2);
  border: 1px solid var(--line-2); border-radius: var(--radius-sm);
  padding: 12px 14px; width: 100%;
  transition: border-color .16s ease, box-shadow .16s ease, background .16s ease;
}
.sp-input::placeholder, .sp-textarea::placeholder { color: var(--faint); }
.sp-input:focus, .sp-textarea:focus {
  outline: none; background: var(--surface);
  border-color: var(--violet-ink);
  box-shadow: 0 0 0 3px var(--violet-soft);
}
.sp-textarea { resize: none; min-height: 96px; line-height: 1.5; }
.sp-input[aria-invalid="true"], .sp-textarea[aria-invalid="true"] {
  border-color: #d4453b; box-shadow: 0 0 0 3px rgba(212,69,59,.12);
}
.sp-error {
  font-family: var(--font-body); font-size: 12.5px; color: #d4453b;
  min-height: 0; margin-top: -2px;
}

/* ---------- Chips (intención del proyecto) ---------- */
.sp-chip-label {
  font-family: var(--font-body); font-size: 13px; font-weight: 600; color: var(--ink-2);
  margin-bottom: 2px;
}
.sp-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.sp-chip {
  font-family: var(--font-body); font-size: 13px; font-weight: 600; color: var(--ink-2);
  background: var(--surface-2); border: 1px solid var(--line-2); border-radius: 999px;
  padding: 8px 14px; cursor: pointer;
  transition: border-color .15s ease, background .15s ease, color .15s ease, transform .15s ease;
}
.sp-chip:hover { border-color: var(--ink); transform: translateY(-1px); }
.sp-chip.is-selected {
  background: var(--ink); color: var(--accent-ink); border-color: var(--ink);
}

/* ---------- Footer / actions ---------- */
.sp-actions { display: flex; align-items: center; gap: 10px; margin-top: 8px; }
.sp-actions .sp-btn-primary { flex: 1; justify-content: center; }
.sp-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 9px;
  font-family: var(--font-body); font-size: 15px; font-weight: 700;
  padding: 13px 20px; border-radius: 999px; border: 1px solid transparent;
  cursor: pointer; white-space: nowrap;
  transition: transform .18s ease, background .18s ease, border-color .18s ease, color .18s ease, opacity .18s ease;
}
.sp-btn .arrow { font-family: var(--font-mono); font-size: 14px; transition: transform .2s ease; }
.sp-btn:hover .arrow { transform: translateX(3px); }
.sp-btn-primary {
  background: var(--ink); color: var(--accent-ink);
  box-shadow: 0 8px 22px -8px rgba(16,16,16,.28), inset 0 1px 0 rgba(255,255,255,.12);
}
.sp-btn-primary:hover { transform: translateY(-2px); background: var(--btn-hover); }
.sp-btn-primary:disabled { opacity: .55; cursor: default; transform: none; box-shadow: none; }
.sp-btn-ghost {
  background: var(--surface); color: var(--ink); border-color: var(--line-2);
}
.sp-btn-ghost:hover { border-color: var(--ink); }
.sp-btn-back {
  background: transparent; border: none; padding: 13px 8px;
  font-family: var(--font-body); font-size: 14px; font-weight: 600; color: var(--muted);
  cursor: pointer; transition: color .15s ease;
}
.sp-btn-back:hover { color: var(--ink); }

/* ---------- Footnote ---------- */
.sp-foot {
  margin: 16px 0 0; font-family: var(--font-body); font-size: 12px;
  line-height: 1.5; color: var(--faint); text-align: center;
}

/* ---------- Spinner ---------- */
.sp-spinner {
  width: 16px; height: 16px; border-radius: 999px;
  border: 2px solid rgba(255,255,255,.35); border-top-color: #fff;
  animation: sp-spin .7s linear infinite; display: none;
}
.sp-btn-primary.is-loading .sp-spinner { display: inline-block; }
.sp-btn-primary.is-loading .sp-btn-label,
.sp-btn-primary.is-loading .arrow { display: none; }
@keyframes sp-spin { to { transform: rotate(360deg); } }

/* ---------- Success ---------- */
.sp-success { display: none; flex-direction: column; align-items: center; text-align: center; padding: 8px 4px; }
.sp-success.is-active { display: flex; animation: sp-step-in .34s cubic-bezier(.16, 1, .3, 1); }
.sp-success-mark {
  width: 56px; height: 56px; border-radius: 999px;
  display: flex; align-items: center; justify-content: center;
  background: var(--violet-soft); color: var(--violet-ink);
  margin-bottom: 18px;
}
.sp-success-mark svg { width: 26px; height: 26px; }
.sp-success .sp-title { margin-bottom: 8px; }
.sp-success .sp-desc { margin-bottom: 22px; }

/* ============================================================
   Responsive — smartphones
   ============================================================ */
@media (max-width: 480px) {
  .sp-overlay { padding: 14px; align-items: flex-end; }   /* hoja anclada abajo, pulgar-friendly */
  .sp-modal {
    padding: 26px 22px 24px;
    max-height: calc(100dvh - 28px);
    border-radius: 24px;
  }
  .sp-title { font-size: 21px; }
  /* 16px evita el auto-zoom de iOS al enfocar inputs */
  .sp-input, .sp-textarea { font-size: 16px; }
  .sp-actions { flex-wrap: wrap; }
  .sp-actions .sp-btn-primary { min-width: 100%; }   /* botón principal ancho completo */
  .sp-btn-back { order: 2; }
}

/* Pantallas muy bajas (landscape de móvil): permitir scroll cómodo */
@media (max-height: 560px) {
  .sp-overlay { align-items: flex-start; }
  .sp-modal { margin: 8px 0; }
}
