/* ==========================================================================
   MST — contact modal
   Built to feel native to css/style.css: same tokens (--ink, --accent,
   --bg-light, --border-color, --muted, --body-text), same section-tag
   typography, same dark .btn-style CTA. See mst-contract.md for the
   HTML/i18n contract this styles.
   ========================================================================== */

#contact-modal-root {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: none;
}
#contact-modal-root.cm-open { display: block; }

.cm-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(12, 26, 56, .55);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.cm-dialog {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%) scale(.97);
  opacity: 0;
  width: min(520px, calc(100% - 32px));
  max-width: 520px;
  max-height: calc(100vh - 48px);
  overflow-y: auto;
  border-radius: 24px;
  background: var(--bg-light, #f6f8fc);
  box-shadow: 0 40px 80px rgba(12, 26, 56, .35);
  transition: opacity .3s ease, transform .3s ease;
}
.cm-dialog.cm-in {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

.cm-formwrap {
  position: relative;
  padding: 24px 32px 26px;
}

.cm-close {
  position: absolute;
  top: 18px;
  right: 18px;
  width: 34px;
  height: 34px;
  border: none;
  border-radius: 10px;
  background: transparent;
  color: var(--muted, #5a6a85);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.cm-close:hover { background: rgba(47, 102, 208, .08); color: var(--accent, #2f66d0); }

.cm-tag {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .26em;
  color: var(--accent, #2f66d0);
  margin-bottom: 6px;
}

.cm-title {
  margin: 0 0 12px;
  font-size: 22px;
  line-height: 1.25;
  font-weight: 500;
  letter-spacing: -.01em;
  color: var(--ink, #12244a);
  padding-right: 30px;
}

.cm-form { display: flex; flex-direction: column; gap: 10px; }

.cm-field { display: flex; flex-direction: column; gap: 5px; }
.cm-field label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .06em;
  color: var(--muted, #5a6a85);
  text-transform: uppercase;
}
.cm-required { color: var(--accent, #2f66d0); }

.cm-field input,
.cm-field textarea {
  font: inherit;
  font-size: 14.5px;
  color: var(--ink, #12244a);
  background: #fff;
  border: 1px solid var(--border-color, rgba(195, 206, 222, .8));
  border-radius: 12px;
  padding: 10px 13px;
  outline: none;
  transition: border-color .2s ease;
  width: 100%;
  box-sizing: border-box;
}
.cm-field textarea { resize: vertical; min-height: 56px; font-family: inherit; }
.cm-field input:focus,
.cm-field textarea:focus { border-color: var(--accent, #2f66d0); }

.cm-honeypot {
  position: absolute;
  left: -9999px;
  top: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.cm-consent {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 12px;
  line-height: 1.45;
  color: var(--body-text, #44546e);
  cursor: pointer;
}
.cm-consent input {
  margin-top: 3px;
  width: 16px;
  height: 16px;
  flex: none;
  accent-color: var(--accent, #2f66d0);
}
.cm-consent a { color: var(--accent, #2f66d0); text-decoration: underline; }
.cm-consent a:hover { color: var(--ink-hover, #1d3a75); }

.cm-error {
  font-size: 13px;
  line-height: 1.5;
  color: #b3261e;
  background: rgba(179, 38, 30, .08);
  border-radius: 10px;
  padding: 10px 14px;
}

.cm-submit {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: var(--ink, #12244a);
  color: #fff;
  border: none;
  border-radius: 14px;
  padding: 13px 24px;
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .1em;
  cursor: pointer;
  margin-top: 2px;
}
.cm-submit:hover:not(:disabled) { background: var(--ink-hover, #1d3a75); }
.cm-submit:disabled { opacity: .65; cursor: default; }

.cm-success { text-align: left; }
.cm-success-body {
  margin: 0 0 26px;
  font-size: 14.5px;
  line-height: 1.6;
  color: var(--body-text, #44546e);
}

/* ---------- mobile ---------- */
@media (max-width: 640px) {
  .cm-dialog {
    left: 0;
    right: 0;
    top: auto;
    bottom: 0;
    transform: translateY(16px);
    width: 100%;
    max-width: none;
    max-height: 92vh;
    border-radius: 24px 24px 0 0;
  }
  .cm-dialog.cm-in { transform: translateY(0); }
  .cm-formwrap { padding: 32px 20px 28px; }
}

/* ---------- reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  .cm-dialog {
    transition: none !important;
    transform: translate(-50%, -50%) !important;
    opacity: 1 !important;
  }
}
@media (prefers-reduced-motion: reduce) and (max-width: 640px) {
  .cm-dialog { transform: none !important; }
}
