/* ═══════════════════════════════════════════════════════════
   FinoMind — Contact Modal (contact-modal.css)
   Self-contained: every selector is prefixed fm- and the tokens
   live on .fm-overlay, so it works on pages with or without
   css/variables.css.
   ═══════════════════════════════════════════════════════════ */

.fm-overlay {
  --fm-cyan: #00AEEF;
  --fm-cyan-hover: #00c4ff;
  --fm-teal: #007B9E;
  --fm-dark-teal: #1A5276;
  --fm-navy: #0a1628;
  --fm-charcoal: #2C3E50;
  --fm-slate: #4A6274;
  --fm-border: #D6E8EE;
  --fm-light-cyan: #E0F7FC;
  --fm-error: #E74C3C;
  --fm-error-bg: #FDF2F2;
  --fm-font-body: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --fm-font-display: 'Playfair Display', Georgia, serif;
  --fm-ease: cubic-bezier(.16, 1, .3, 1);

  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 100000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(10, 22, 40, 0.55);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
  font-family: var(--fm-font-body);
  opacity: 0;
  visibility: hidden;
  transition: opacity .25s ease, visibility 0s linear .25s;
}

.fm-overlay.fm-open {
  opacity: 1;
  visibility: visible;
  transition: opacity .25s ease;
}

.fm-overlay,
.fm-overlay *,
.fm-overlay *::before,
.fm-overlay *::after {
  box-sizing: border-box;
}

.fm-overlay [hidden] {
  display: none !important;
}

/* ── Dialog ── */
.fm-dialog {
  position: relative;
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 480px;
  max-height: calc(100vh - 32px);
  max-height: calc(100dvh - 32px);
  overflow: hidden;
  background: #fff;
  border-radius: 24px;
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.18), 0 30px 80px rgba(10, 22, 40, 0.28);
  outline: none;
  opacity: 0;
  transform: translateY(24px) scale(.97);
  transition: transform .45s var(--fm-ease), opacity .25s ease;
}

.fm-overlay.fm-open .fm-dialog {
  opacity: 1;
  transform: none;
}

.fm-dialog::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--fm-dark-teal), var(--fm-teal), var(--fm-cyan));
  z-index: 2;
}

.fm-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  padding: 40px 32px 32px;
}

.fm-close {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--fm-slate);
  cursor: pointer;
  transition: background .2s ease, color .2s ease;
}

.fm-close:hover {
  background: var(--fm-light-cyan);
  color: var(--fm-dark-teal);
}

.fm-close svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ── Header ── */
.fm-eyebrow {
  display: block;
  margin: 0 0 10px;
  font-family: var(--fm-font-body);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .14em;
  line-height: 1.3;
  text-transform: uppercase;
  color: var(--fm-teal);
}

.fm-title {
  margin: 0 0 8px;
  padding-right: 36px;
  font-family: var(--fm-font-display);
  font-size: 28px;
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: 0;
  text-transform: none;
  color: var(--fm-dark-teal);
}

.fm-sub {
  margin: 0 0 24px;
  font-family: var(--fm-font-body);
  font-size: 15px;
  font-weight: 400;
  line-height: 1.6;
  color: var(--fm-slate);
}

/* ── Fields ── */
.fm-field {
  margin: 0 0 16px;
}

.fm-label {
  display: block;
  margin: 0 0 6px;
  font-family: var(--fm-font-body);
  font-size: 13px;
  font-weight: 600;
  line-height: 1.3;
  color: var(--fm-charcoal);
}

.fm-req {
  margin-left: 2px;
  color: var(--fm-error);
}

.fm-input,
.fm-textarea {
  display: block;
  width: 100%;
  margin: 0;
  padding: 12px 16px;
  font-family: var(--fm-font-body);
  font-size: 15px;
  font-weight: 400;
  line-height: 1.4;
  color: var(--fm-charcoal);
  background: #fff;
  border: 1.5px solid var(--fm-border);
  border-radius: 8px;
  -webkit-appearance: none;
  appearance: none;
  transition: border-color .2s ease, box-shadow .2s ease, background .2s ease;
}

.fm-textarea {
  min-height: 112px;
  max-height: 240px;
  resize: vertical;
}

.fm-input::placeholder,
.fm-textarea::placeholder {
  color: #93A4B0;
}

.fm-input:focus,
.fm-textarea:focus {
  outline: none;
  border-color: var(--fm-cyan);
  box-shadow: 0 0 0 3px rgba(0, 174, 239, .12);
}

.fm-input[aria-invalid="true"],
.fm-textarea[aria-invalid="true"] {
  border-color: var(--fm-error);
  background: var(--fm-error-bg);
}

.fm-input[aria-invalid="true"]:focus,
.fm-textarea[aria-invalid="true"]:focus {
  box-shadow: 0 0 0 3px rgba(231, 76, 60, .14);
}

/* ── Consent notice ── */
.fm-consent-note {
  margin: 0 0 16px;
  font-family: var(--fm-font-body);
  font-size: 13px;
  font-weight: 400;
  line-height: 1.5;
  color: var(--fm-slate);
}

/* Honeypot: off-screen so people never see it, but bots still fill it in */
.fm-hp {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.fm-error {
  margin: 6px 0 0;
  font-family: var(--fm-font-body);
  font-size: 12.5px;
  font-weight: 500;
  line-height: 1.4;
  color: var(--fm-error);
}

.fm-form-error {
  margin: 0 0 16px;
  padding: 12px 14px;
  font-family: var(--fm-font-body);
  font-size: 13.5px;
  font-weight: 500;
  line-height: 1.5;
  color: var(--fm-error);
  background: var(--fm-error-bg);
  border: 1px solid rgba(231, 76, 60, .3);
  border-radius: 8px;
}

/* ── Buttons ── */
.fm-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  min-height: 48px;
  margin: 0;
  padding: 14px 24px;
  font-family: var(--fm-font-body);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: .02em;
  line-height: 1.2;
  color: #fff;
  background: var(--fm-cyan);
  border: 0;
  border-radius: 8px;
  box-shadow: 0 4px 15px rgba(0, 174, 239, .3);
  cursor: pointer;
  transition: background .2s ease, transform .2s ease, box-shadow .2s ease;
}

.fm-btn:hover {
  background: var(--fm-cyan-hover);
  transform: translateY(-1px);
  box-shadow: 0 6px 22px rgba(0, 174, 239, .4);
}

.fm-btn:active {
  transform: translateY(0);
}

.fm-btn:disabled {
  cursor: progress;
  opacity: .75;
  transform: none;
}

.fm-btn svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.fm-spinner {
  display: none;
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255, 255, 255, .45);
  border-top-color: #fff;
  border-radius: 50%;
  animation: fm-spin .7s linear infinite;
}

.fm-btn[aria-busy="true"] .fm-spinner {
  display: block;
}

.fm-btn[aria-busy="true"] svg {
  display: none;
}

.fm-close:focus-visible,
.fm-btn:focus-visible {
  outline: 3px solid rgba(0, 174, 239, .55);
  outline-offset: 2px;
}

/* ── Success view ── */
.fm-success {
  padding: 8px 0 4px;
  text-align: center;
}

.fm-check {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 84px;
  height: 84px;
  margin: 8px auto 24px;
  background: linear-gradient(135deg, var(--fm-cyan), var(--fm-teal));
  border-radius: 50%;
  box-shadow: 0 12px 28px rgba(0, 174, 239, .35);
  animation: fm-pop .6s cubic-bezier(.34, 1.56, .64, 1) both;
}

.fm-check::after {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  border: 2px solid var(--fm-cyan);
  border-radius: 50%;
  opacity: 0;
  animation: fm-ring 1.1s ease-out .3s;
}

.fm-check svg {
  width: 44px;
  height: 44px;
  fill: none;
  stroke: #fff;
  stroke-width: 4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.fm-check-mark {
  stroke-dasharray: 40;
  stroke-dashoffset: 0;
  animation: fm-draw .45s ease-out .3s both;
}

.fm-success-title {
  margin: 0 0 10px;
  font-family: var(--fm-font-display);
  font-size: 26px;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: 0;
  text-transform: none;
  color: var(--fm-dark-teal);
}

.fm-success-text {
  margin: 0 0 28px;
  font-family: var(--fm-font-body);
  font-size: 15px;
  font-weight: 400;
  line-height: 1.6;
  color: var(--fm-slate);
}

/* Visually hidden live region for screen readers */
.fm-sr {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ── Confetti canvas ── */
.fm-confetti {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 100001;
  pointer-events: none;
}

/* ── Animations ── */
@keyframes fm-spin {
  to { transform: rotate(360deg); }
}

@keyframes fm-pop {
  from { transform: scale(.4); opacity: 0; }
  to   { transform: scale(1);  opacity: 1; }
}

@keyframes fm-ring {
  0%   { transform: scale(1);   opacity: .7; }
  100% { transform: scale(1.7); opacity: 0; }
}

@keyframes fm-draw {
  from { stroke-dashoffset: 40; }
  to   { stroke-dashoffset: 0; }
}

/* ── Inline (form shown on the page, e.g. contact-us.html) ── */
.fm-overlay.fm-inline {
  position: static;
  z-index: auto;
  display: block;
  padding: 0;
  background: none;
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
  opacity: 1;
  visibility: visible;
  transition: none;
}

.fm-inline .fm-dialog {
  max-width: 640px;
  max-height: none;
  margin: 0 auto;
  overflow: hidden;
  border: 1px solid rgba(0, 123, 158, .12);
  box-shadow: 0 12px 30px rgba(26, 82, 117, .08);
  opacity: 1;
  transform: none;
  transition: none;
}

.fm-inline .fm-scroll {
  overflow: visible;
  padding: 48px 40px 40px;
}

/* The page already shows this heading above the card */
.fm-inline .fm-eyebrow,
.fm-inline .fm-title,
.fm-inline .fm-sub {
  display: none;
}

.fm-inline .fm-scroll {
  padding-top: 44px;
}

@media (max-width: 640px) {
  .fm-inline .fm-scroll {
    padding: 40px 20px 28px;
  }
}

/* ── Mobile ── */
@media (max-width: 640px) {
  .fm-overlay {
    padding: 12px;
  }

  .fm-dialog {
    max-height: calc(100vh - 24px);
    max-height: calc(100dvh - 24px);
    border-radius: 20px;
  }

  .fm-scroll {
    padding: 36px 20px calc(24px + env(safe-area-inset-bottom, 0px));
  }

  .fm-title {
    font-size: 24px;
  }

  .fm-success-title {
    font-size: 22px;
  }

  /* 16px stops iOS Safari zooming the page when a field is focused */
  .fm-input,
  .fm-textarea {
    font-size: 16px;
  }

  .fm-btn {
    min-height: 50px;
  }
}

/* ── Reduced motion ── */
@media (prefers-reduced-motion: reduce) {
  .fm-overlay,
  .fm-dialog,
  .fm-btn,
  .fm-close,
  .fm-input,
  .fm-textarea {
    transition: none !important;
  }

  .fm-check,
  .fm-check::after,
  .fm-check-mark {
    animation: none !important;
  }

  .fm-check::after {
    display: none;
  }
}
