/* =========================================================
   MODAL — Contact flow (3 steps + completion)
   ========================================================= */

/* Overlay */
.modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  background: rgba(0, 0, 0, 0.45);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease, visibility 0.25s ease;
}
.modal.is-open {
  opacity: 1;
  visibility: visible;
}

/* Panel */
.modal__panel {
  background: #fff;
  width: 100%;
  max-width: 100%;
  max-height: 92dvh;
  overflow-y: auto;
  overflow-x: hidden;
  font-family: 'Inter', -apple-system, sans-serif;
  -webkit-overflow-scrolling: touch;
}

/* Single step — flex column */
.modal__step[hidden] { display: none; }
.modal__step {
  display: flex;
  flex-direction: column;
  padding: 24px 20px;
  box-sizing: border-box;
}

/* ── Header ──────────────────────────────────────────────── */
.modal__header {
  display: grid;
  grid-template-columns: 48px 1fr 48px;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
  min-height: 20px; /* stable height regardless of Back/Close presence */
}
.modal__header-center {
  text-align: center;
  font-size: 14px;
  font-weight: 400;
  letter-spacing: -0.84px;
  text-transform: uppercase;
  color: #000;
  line-height: 1;
  white-space: nowrap;
}
.modal__header-end {
  display: flex;
  justify-content: flex-end;
}

.modal__counter-current { color: #0411fb; }
.modal__done { color: #0411fb; }

/* Done step: header left-aligned, no left placeholder column */
[data-step="done"] .modal__header {
  grid-template-columns: 1fr 48px;
}
[data-step="done"] .modal__header-start { display: none; }
[data-step="done"] .modal__header-center { text-align: left; }

/* Done step: body sizes to its content; complete-actions gets margin-top:auto */
[data-step="done"] .modal__body {
  flex: 0 1 auto;
}

.modal__close,
.modal__back {
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  font-size: 12px;
  font-weight: 400;
  letter-spacing: -0.36px;
  color: #000;
  font-family: 'Inter', -apple-system, sans-serif;
  line-height: 1;
  height: 20px;
  display: flex;
  align-items: center;
}

/* ── Tags row (steps 2, 3) ───────────────────────────────── */
.modal__tags {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding-top: 10px;
  flex-wrap: wrap;
  flex-shrink: 0;
  min-height: 14px;
}
.modal__tag {
  font-size: 12px;
  font-weight: 400;
  letter-spacing: -0.36px;
  line-height: 1;
}
.modal__tag:empty { display: none; }
.modal__tag--type     { color: #7e7e7e; }
.modal__tag--services { color: #000; }

/* ── Body ────────────────────────────────────────────────── */
.modal__body {
  display: flex;
  flex-direction: column;
  flex: 1 0 0;
  min-height: 0;
}

/* Question heading */
.modal__question {
  padding-top: 24px;
}
.modal__question-heading {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.modal__question-title {
  font-size: 14px;
  font-weight: 400;
  letter-spacing: -0.84px;
  text-transform: uppercase;
  color: #000;
  line-height: 1.14;
}
.modal__question-sub {
  font-size: 12px;
  font-weight: 400;
  letter-spacing: -0.24px;
  color: #6a686c;
  line-height: 1.17;
}

/* ── Options list ────────────────────────────────────────── */
.modal__options {
  list-style: none;
  padding: 0;
  margin: 4px 0 0;
}
.modal__option {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 0;
  border-bottom: 0.5px solid #1c1c1e;
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.modal__option-text {
  flex: 1 0 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.modal__option-label {
  font-size: 14px;
  font-weight: 400;
  letter-spacing: -0.28px;
  text-transform: uppercase;
  color: #000;
  line-height: 1;
}
.modal__option-desc {
  font-size: 12px;
  font-weight: 400;
  letter-spacing: -0.24px;
  color: #6a686c;
  line-height: 1.17;
}

/* Media circle (step 2) */
.modal__option-media {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  overflow: hidden;
  flex-shrink: 0;
  background: #f0f0f0;
}
.modal__option-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Radio */
.modal__radio {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 1px solid #1c1c1e;
  flex-shrink: 0;
  background: #fff;
  transition: background 0.1s, border-color 0.1s;
  box-sizing: border-box;
}
.modal__option.is-selected .modal__radio {
  background: #000;
  border-color: #000;
}
@media (hover: hover) {
  .modal__option:not(.is-selected):hover .modal__radio { border-color: #1a3bff; }
  .modal__option.is-selected:hover .modal__radio { background: #0411fb; border-color: #0411fb; }
}

/* Checkbox (option) */
.modal__checkbox {
  width: 16px;
  height: 16px;
  border: 1px solid #1c1c1e;
  flex-shrink: 0;
  background: #fff;
  position: relative;
  transition: background 0.1s, border-color 0.1s;
  box-sizing: border-box;
}
.modal__option.is-selected .modal__checkbox {
  background: #000;
  border-color: #000;
}
@media (hover: hover) {
  .modal__option:not(.is-selected):hover .modal__checkbox { border-color: #1a3bff; }
  .modal__option.is-selected:hover .modal__checkbox { background: #0411fb; border-color: #0411fb; }
}

/* ── Form (step 3) ───────────────────────────────────────── */
.modal__body--form {
  padding-top: 16px;
}
.modal__form-fields {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.modal__input {
  width: 100%;
  height: 30px;
  border: none;
  border-bottom: 1px solid #1c1c1e;
  background: transparent;
  font-size: 12px;
  font-weight: 400;
  letter-spacing: -0.36px;
  color: #000;
  font-family: 'Inter', -apple-system, sans-serif;
  outline: none;
  box-sizing: border-box;
  padding: 0;
  border-radius: 0;
  -webkit-appearance: none;
  caret-color: #0411fb;
}
.modal__input::placeholder {
  color: #000;
  text-transform: uppercase;
  opacity: 1;
}
.modal__input:focus::placeholder { color: #6a686c; }
.modal__input:not(:placeholder-shown) { color: #0411fb; }
.modal__input--error { border-bottom-color: #d93025; }
.modal__input--error:not(:placeholder-shown) { color: #d93025; }

.modal__textarea {
  width: 100%;
  margin-top: 12px;
  border: 1px solid #1c1c1e;
  background: transparent;
  font-size: 12px;
  font-weight: 400;
  letter-spacing: -0.36px;
  color: #000;
  font-family: 'Inter', -apple-system, sans-serif;
  outline: none;
  box-sizing: border-box;
  padding: 6px 8px;
  resize: none;
  min-height: 72px;
  border-radius: 0;
  line-height: 1.4;
  -webkit-appearance: none;
  caret-color: #0411fb;
}
.modal__textarea::placeholder {
  color: #000;
  text-transform: uppercase;
  opacity: 1;
}
.modal__textarea:focus::placeholder { color: #6a686c; }
.modal__textarea:not(:placeholder-shown) { color: #0411fb; }
.modal__hint {
  font-size: 12px;
  font-weight: 400;
  letter-spacing: -0.72px;
  color: #000;
  margin-top: 8px;
  line-height: 1.17;
}
.modal__terms {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 16px;
  cursor: pointer;
  user-select: none;
}
.modal__terms-check {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
  pointer-events: none;
}
.modal__checkmark {
  width: 16px;
  height: 16px;
  border: 1px solid #1c1c1e;
  flex-shrink: 0;
  background: #fff;
  position: relative;
  box-sizing: border-box;
  transition: background 0.1s;
}
.modal__terms-check:checked ~ .modal__checkmark,
.modal__checkmark.is-checked {
  background: #000;
  border-color: #000;
}
@media (hover: hover) {
  .modal__terms:hover .modal__checkmark:not(.is-checked) { border-color: #1a3bff; }
  .modal__terms:hover .modal__checkmark.is-checked { background: #0411fb; border-color: #0411fb; }
}
.modal__terms-label {
  font-size: 12px;
  font-weight: 400;
  letter-spacing: -0.36px;
  color: #000;
  line-height: 1.17;
}
.modal__terms-link {
  color: #000;
  text-decoration: underline;
}

/* ── Actions (button bar) ────────────────────────────────── */
.modal__actions {
  padding-top: 20px;
  flex-shrink: 0;
  margin-top: auto;
}

/* Submit error */
.modal__submit-error {
  font-size: 12px;
  font-weight: 400;
  letter-spacing: -0.36px;
  color: #d93025;
  margin-bottom: 8px;
  line-height: 1.17;
}

/* Primary button */
.modal__btn {
  display: block;
  width: 100%;
  padding: 7px 18px;
  border-radius: 6px;
  border: none;
  font-size: 16px;
  font-weight: 400;
  letter-spacing: -0.16px;
  font-family: 'Inter', -apple-system, sans-serif;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  box-sizing: border-box;
  line-height: 1.375;
  transition: background 0.15s, color 0.15s;
}
.modal__btn--primary {
  background: #000;
  color: #fff;
}
.modal__btn--primary:disabled {
  background: #ebebeb;
  color: #b5b5b5;
  cursor: not-allowed;
}

/* ── Complete step ───────────────────────────────────────── */
.modal__complete-media {
  padding-top: 20px;
  flex-shrink: 0;
}
.modal__complete-img {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  object-fit: cover;
  display: block;
}
.modal__complete-title {
  font-size: 24px;
  font-weight: 400;
  letter-spacing: -1.44px;
  color: #000;
  line-height: 1;
  margin-top: 20px;
}
.modal__complete-text {
  font-size: 14px;
  font-weight: 400;
  letter-spacing: -0.28px;
  color: #000;
  line-height: 1.14;
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.modal__complete-actions {
  padding-top: 24px;
  flex-shrink: 0;
  margin-top: auto;
}
.modal__socials {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 16px;
}
.modal__socials-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.modal__socials-reply {
  font-size: 12px;
  font-weight: 400;
  letter-spacing: -0.72px;
  color: #000;
  line-height: 1.17;
}
.modal__socials-email {
  font-size: 12px;
  font-weight: 400;
  letter-spacing: -0.72px;
  color: #0411fb;
  text-decoration: underline;
  line-height: 1.17;
}
.modal__socials-icons {
  display: flex;
  align-items: center;
  gap: 14px;
}
.modal__socials-icons a {
  display: flex;
  align-items: center;
}
.modal__socials-icons img {
  height: 15px;
  display: block;
}

/* ── Mobile: full-screen below header ────────────────────── */
@media (max-width: 599px) {
  /* Elevate header above modal overlay */
  .modal-is-open .site-header { z-index: 300; }
  /* Hide Send Request in header when modal is open */
  .modal-is-open .header__cta { opacity: 0; pointer-events: none; }

  .modal {
    align-items: flex-start;
    background: transparent; /* panel is full-screen, no backdrop needed */
    /* dynamic gap: JS sets --modal-header-h; fallback 26px */
    padding-top: var(--modal-header-h, 26px);
  }
  .modal__panel {
    width: 100%;
    max-width: 100%;
    height: calc(100dvh - var(--modal-header-h, 26px));
    max-height: calc(100dvh - var(--modal-header-h, 26px));
    overflow-y: hidden; /* step body scrolls internally */
  }

  /* Step fills the panel; only .modal__body scrolls */
  .modal__step {
    height: 100%;
    min-height: 0;
    overflow: hidden;
  }
  .modal__body {
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }
  /* Actions pinned to bottom, no extra padding */
  .modal__actions {
    margin-top: 0;
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }
}

/* ── Desktop: centered panel, no backdrop ────────────────── */
@media (min-width: 600px) {
  .modal {
    align-items: center;
    background: transparent;
  }
  .modal__panel {
    max-width: 400px;
    max-height: 92dvh;
    border: 1px solid #000;
  }
  /* On desktop the step has no fixed height — body must size to content */
  .modal__body {
    flex: 0 1 auto;
  }
}
