/* Shared contact modal — used across product pages (Hive, Krios, Cardly).
   Themable via CSS custom properties set on each page:
     --cm-bg-dark      brand dark color (close button, title)
     --cm-accent       brand accent (submit button, focus ring)
     --cm-accent-on    text colour on accent button
     --cm-accent-rgb   accent in "r,g,b" form for shadow tints
   Defaults below match the SmarTeeth palette.
*/

.cm-modal {
  position: fixed; inset: 0; z-index: 2000;
  display: none; align-items: flex-start; justify-content: center;
  padding: 4rem 1rem 2rem; overflow-y: auto;
  background: rgba(8, 8, 14, 0.72);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
}
.cm-modal.is-open { display: flex; }
body.cm-modal-open { overflow: hidden; }

.cm-modal__panel {
  background: #fff; border-radius: 14px;
  max-width: 880px; width: 100%;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.5);
  position: relative; overflow: hidden;
  animation: cm-modal-in .25s ease;
}
@keyframes cm-modal-in {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: none; }
}

.cm-modal__close {
  position: absolute; top: 0.9rem; right: 0.9rem; z-index: 2;
  width: 38px; height: 38px; border-radius: 50%; border: none;
  background: rgba(255, 255, 255, 0.94);
  color: var(--cm-bg-dark, #152547);
  font-size: 1.4rem; line-height: 1; cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  display: flex; align-items: center; justify-content: center;
  transition: transform .15s ease, background .15s ease;
}
.cm-modal__close:hover { background: #fff; transform: scale(1.05); }

.cm-modal__body { padding: 2.2rem 2.2rem 1.8rem; }
.cm-modal__eyebrow {
  font-family: "JetBrains Mono", monospace; font-size: 0.78rem;
  text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--cm-accent, #5bc0eb); margin-bottom: 0.5rem;
}
.cm-modal__title {
  font-family: "DM Serif Display", serif;
  font-size: clamp(1.6rem, 3vw, 2.3rem); line-height: 1.15;
  margin: 0 0 1rem; color: var(--cm-bg-dark, #152547);
  letter-spacing: -0.01em;
}
.cm-modal__lead {
  font-size: 1.02rem; line-height: 1.55;
  color: #3a4a66; margin: 0 0 1.5rem;
}

.cm-form { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem 1.2rem; }
@media (max-width: 640px) { .cm-form { grid-template-columns: 1fr; } }
.cm-form__row { display: flex; flex-direction: column; gap: 0.3rem; min-width: 0; }
.cm-form__row--full { grid-column: 1 / -1; }
.cm-form label {
  font-family: "JetBrains Mono", monospace; font-size: 0.76rem;
  text-transform: uppercase; letter-spacing: 0.05em;
  color: var(--cm-bg-dark, #152547); font-weight: 600;
}
.cm-form label .req { color: #d9534f; margin-left: 0.2rem; }
.cm-form input,
.cm-form select,
.cm-form textarea {
  font-family: "DM Sans", sans-serif; font-size: 0.95rem;
  padding: 0.65rem 0.8rem; border: 1px solid #d4dbe6; border-radius: 6px;
  background: #fff; color: #1a1a1a;
  transition: border-color .15s, box-shadow .15s;
  box-sizing: border-box; width: 100%;
}
.cm-form input:focus,
.cm-form select:focus,
.cm-form textarea:focus {
  outline: none; border-color: var(--cm-accent, #5bc0eb);
  box-shadow: 0 0 0 3px rgba(var(--cm-accent-rgb, 91, 192, 235), 0.22);
}
.cm-form textarea { resize: vertical; min-height: 110px; }

.cm-form__hint {
  font-size: 0.85rem; color: #6a7a95;
  grid-column: 1 / -1; margin: -0.4rem 0 0;
}
.cm-form__error {
  font-size: 0.88rem; color: #b3261e;
  background: #fdecea; border: 1px solid #f5c2bd;
  padding: 0.6rem 0.9rem; border-radius: 6px;
  grid-column: 1 / -1; display: none;
}
.cm-form__error.is-visible { display: block; }

.cm-form__actions {
  grid-column: 1 / -1; display: flex; gap: 0.8rem; justify-content: flex-end;
  margin-top: 0.4rem;
}
.cm-form__submit {
  background: var(--cm-accent, #5bc0eb);
  color: var(--cm-accent-on, #152547);
  border: none; padding: 0.75rem 1.6rem; border-radius: 6px;
  font-weight: 600; font-size: 0.98rem; cursor: pointer;
  box-shadow: 0 4px 12px rgba(var(--cm-accent-rgb, 91, 192, 235), 0.32);
  transition: transform .15s, box-shadow .15s;
}
.cm-form__submit:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(var(--cm-accent-rgb, 91, 192, 235), 0.45);
}
.cm-form__submit:disabled { opacity: 0.55; cursor: progress; }

/* Post-submit thank-you card */
.cm-thanks { display: none; text-align: center; padding: 0.6rem 0 0.4rem;
             animation: cm-thanks-in .35s ease; }
.cm-thanks.is-visible { display: block; }
@keyframes cm-thanks-in {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: none; }
}
.cm-thanks__icon {
  width: 74px; height: 74px; border-radius: 50%;
  background: linear-gradient(135deg, #4caf6e 0%, #2d8a4f 100%);
  color: #fff; display: inline-flex; align-items: center; justify-content: center;
  margin: 0 auto 1.3rem; box-shadow: 0 10px 24px rgba(45, 138, 79, 0.3);
  animation: cm-thanks-pop .5s cubic-bezier(.34, 1.56, .64, 1) .1s both;
}
@keyframes cm-thanks-pop { from { transform: scale(.3); } to { transform: scale(1); } }
.cm-thanks__icon svg { width: 36px; height: 36px; }
.cm-thanks__title {
  font-family: "DM Serif Display", serif;
  font-size: clamp(1.7rem, 3vw, 2.4rem); line-height: 1.15;
  color: var(--cm-bg-dark, #152547); margin: 0 0 0.9rem;
}
.cm-thanks__lead {
  font-size: 1.02rem; line-height: 1.55; color: #3a4a66;
  margin: 0 auto 1.4rem; max-width: 52ch;
}
.cm-thanks__meta {
  font-family: "JetBrains Mono", monospace; font-size: 0.78rem;
  color: #6a7a95; margin: 0 0 1.6rem; letter-spacing: 0.02em;
}
.cm-thanks__meta strong { color: var(--cm-bg-dark, #152547); font-weight: 600; }
.cm-thanks__close {
  background: var(--cm-bg-dark, #152547); color: #fff;
  border: none; padding: 0.7rem 1.8rem; border-radius: 6px;
  font-weight: 600; font-size: 0.96rem; cursor: pointer;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.28);
  transition: transform .15s, box-shadow .15s;
}
.cm-thanks__close:hover { transform: translateY(-1px); box-shadow: 0 6px 16px rgba(0, 0, 0, 0.4); }

.cm-modal__body.is-thanks .cm-modal__eyebrow,
.cm-modal__body.is-thanks .cm-modal__title,
.cm-modal__body.is-thanks .cm-modal__lead,
.cm-modal__body.is-thanks .cm-form { display: none; }
