/* Contact modal — aligned with contact page inputs */

.contact-modal {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.28s ease, visibility 0.28s ease;
}

.contact-modal.is-open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.contact-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(8, 17, 31, 0.58);
  backdrop-filter: blur(3px);
}

.contact-modal__dialog {
  position: relative;
  z-index: 1;
  width: min(100%, 520px);
  max-height: min(92vh, 860px);
  overflow: auto;
  background: #fff;
  border-radius: 10px;
  border: 1px solid rgba(13, 27, 42, 0.08);
  box-shadow: 0 24px 60px rgba(8, 17, 31, 0.28);
  transform: translateY(14px) scale(0.985);
  transition: transform 0.3s ease;
}

.contact-modal.is-open .contact-modal__dialog {
  transform: translateY(0) scale(1);
}

.contact-modal__close {
  position: absolute;
  top: 0.95rem;
  right: 0.9rem;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border: 1px solid #d7dee8;
  border-radius: 6px;
  background: #f8fafc;
  color: #4b5568;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.contact-modal__close:hover {
  background: #eef3f8;
  color: var(--color-primary);
  border-color: #c0cad8;
}

.contact-modal__close:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

.contact-modal__panel {
  padding: clamp(1.5rem, 3.5vw, 2rem);
}

.contact-modal__head {
  padding-right: 1.75rem;
  margin-bottom: 1.35rem;
}

.contact-modal__head .eyebrow {
  margin: 0 0 0.45rem;
}

.contact-modal__head h2 {
  margin: 0 0 0.45rem;
  font-family: var(--font-heading);
  font-size: clamp(1.35rem, 3vw, 1.6rem);
  font-weight: 800;
  letter-spacing: -0.015em;
  color: var(--color-heading);
  line-height: 1.2;
}

.contact-modal__head p {
  margin: 0;
  max-width: 44ch;
  color: var(--color-text-muted);
  font-size: 0.94rem;
  line-height: 1.55;
}

.contact-modal__fields {
  display: grid;
  gap: 1rem;
}

.contact-modal__row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.85rem;
}

.contact-modal__form .field {
  display: grid;
  gap: 0.35rem;
  min-width: 0;
}

.contact-modal__form .field label {
  font-family: var(--font-heading);
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--color-heading);
}

.contact-modal__form .field input,
.contact-modal__form .field textarea,
.contact-modal__form .field select {
  width: 100%;
  padding: 0.7rem 0.85rem;
  border: 1px solid #d7dee8;
  border-radius: 6px;
  background: #f8fafc;
  font-family: inherit;
  font-size: 0.95rem;
  color: var(--color-heading);
  transition: border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}

.contact-modal__form .field input::placeholder,
.contact-modal__form .field textarea::placeholder {
  color: #93a0b2;
}

.contact-modal__form .field input:hover,
.contact-modal__form .field textarea:hover,
.contact-modal__form .field select:hover {
  border-color: #c0cad8;
  background: #fff;
}

.contact-modal__form .field input:focus,
.contact-modal__form .field textarea:focus,
.contact-modal__form .field select:focus {
  outline: none;
  border-color: var(--color-primary);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(1, 112, 185, 0.12);
}

.contact-modal__form .field textarea {
  min-height: 110px;
  resize: vertical;
  line-height: 1.55;
}

.field-phone-row {
  display: grid;
  grid-template-columns: 112px 1fr;
  gap: 0.7rem;
}

.country-picker {
  position: relative;
  min-width: 0;
}

.country-picker__btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  width: 100%;
  min-height: 42px;
  padding: 0.55rem 1.7rem 0.55rem 0.7rem;
  border: 1px solid #d7dee8;
  border-radius: 6px;
  background: #f8fafc;
  color: var(--color-heading);
  cursor: pointer;
  transition: border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}

.country-picker__btn:hover {
  border-color: #c0cad8;
  background: #fff;
}

.country-picker__btn:focus,
.country-picker.is-open .country-picker__btn {
  outline: none;
  border-color: var(--color-primary);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(1, 112, 185, 0.12);
}

.country-picker__flag {
  display: block;
  width: 22px;
  height: 16px;
  object-fit: cover;
  border-radius: 2px;
  box-shadow: 0 0 0 1px rgba(13, 27, 42, 0.1);
  flex-shrink: 0;
}

.country-picker__code {
  font-family: var(--font-heading);
  font-size: 0.9rem;
  font-weight: 700;
  line-height: 1;
}

.country-picker__caret {
  position: absolute;
  right: 0.7rem;
  top: 50%;
  width: 0;
  height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 5px solid #6a7688;
  transform: translateY(-35%);
  pointer-events: none;
}

.country-picker__list {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  z-index: 5;
  width: 100%;
  min-width: 112px;
  margin: 0;
  padding: 0.3rem;
  list-style: none;
  background: #fff;
  border: 1px solid #d7dee8;
  border-radius: 6px;
  box-shadow: 0 12px 28px rgba(8, 17, 31, 0.14);
}

.country-picker__option {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  padding: 0.55rem 0.6rem;
  border-radius: 4px;
  cursor: pointer;
  font-family: var(--font-heading);
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--color-heading);
  transition: background 0.15s ease;
}

.country-picker__option img {
  display: block;
  width: 22px;
  height: 16px;
  object-fit: cover;
  border-radius: 2px;
  box-shadow: 0 0 0 1px rgba(13, 27, 42, 0.1);
  flex-shrink: 0;
}

.country-picker__option:hover,
.country-picker__option.is-selected {
  background: rgba(1, 112, 185, 0.1);
}

.field.field--error .country-picker__btn {
  border-color: #d64545;
  background: #fff8f8;
}

.field-phone-number input {
  width: 100%;
  min-height: 42px;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.contact-modal__form .field--error input,
.contact-modal__form .field--error textarea,
.field.field--error input,
.field.field--error textarea {
  border-color: #d64545;
  background: #fff8f8;
}

.contact-modal__form .field--error input:focus,
.contact-modal__form .field--error textarea:focus,
.field.field--error input:focus,
.field.field--error textarea:focus {
  box-shadow: 0 0 0 3px rgba(214, 69, 69, 0.12);
}

.field__error {
  margin: 0;
  color: #c0392b;
  font-size: 0.78rem;
  font-weight: 600;
}

.contact-modal__form-error {
  margin: 0.9rem 0 0;
  padding: 0.7rem 0.85rem;
  border-radius: 6px;
  background: #fff1f0;
  color: #c0392b;
  font-size: 0.86rem;
  font-weight: 600;
}

.contact-modal__actions {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.75rem;
  margin-top: 1.35rem;
}

.contact-modal__actions .btn {
  border: 0;
  width: 100%;
  min-height: 46px;
  padding: 0.8rem 1.4rem;
  border-radius: 6px;
  font-size: 0.95rem;
}

.contact-modal__actions .btn[disabled] {
  opacity: 0.7;
  cursor: wait;
}

.contact-modal__actions .form-note {
  margin: 0;
  text-align: center;
  color: #7a8798;
  font-size: 0.8rem;
  line-height: 1.45;
}

.contact-modal__actions .form-note a {
  color: var(--color-primary);
  font-weight: 700;
  text-underline-offset: 2px;
}

.contact-modal__actions .form-note a:hover {
  text-decoration: underline;
}

.contact-modal__panel--success {
  text-align: center;
  padding-top: clamp(2rem, 5vw, 2.75rem);
  padding-bottom: clamp(2rem, 5vw, 2.75rem);
}

.contact-modal__success-icon {
  display: flex;
  justify-content: center;
  margin-bottom: 1rem;
}

.contact-modal__panel--success h2 {
  margin: 0 0 0.6rem;
  font-family: var(--font-heading);
  font-size: clamp(1.35rem, 3vw, 1.65rem);
  font-weight: 800;
  color: var(--color-heading);
}

.contact-modal__panel--success p {
  margin: 0 auto 1.5rem;
  max-width: 38ch;
  color: var(--color-text-muted);
  line-height: 1.55;
}

.contact-modal__panel--success .btn {
  border: 0;
  min-width: 220px;
  min-height: 46px;
  border-radius: 6px;
}

body.contact-modal-open {
  overflow: hidden;
}

@media (max-width: 640px) {
  .contact-modal {
    padding: 0;
    align-items: flex-end;
  }

  .contact-modal__dialog {
    width: 100%;
    max-height: 94vh;
    border-radius: 12px 12px 0 0;
  }

  .contact-modal__row {
    grid-template-columns: 1fr;
  }

  .field-phone-row {
    grid-template-columns: 1fr;
  }
}
