/* Quote / callback modal — Vitality theme, desktop + mobile
   -------------------------------------------------------------------------- */
[data-tl="modern"] .tl-qmodal {
  position: fixed;
  inset: 0;
  z-index: 12000;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding:
    max(1.25rem, env(safe-area-inset-top, 0px))
    max(0.75rem, env(safe-area-inset-right, 0px))
    max(0.75rem, env(safe-area-inset-bottom, 0px))
    max(0.75rem, env(safe-area-inset-left, 0px));
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}
[data-tl="modern"] .tl-qmodal[hidden] {
  display: none !important;
}
html.tl-qmodal-lock,
html.tl-qmodal-lock body {
  overflow: hidden;
}

[data-tl="modern"] .tl-qmodal__backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 61, 47, 0.55);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  border: 0;
  cursor: pointer;
}

[data-tl="modern"] .tl-qmodal__dialog {
  position: relative;
  z-index: 1;
  width: min(880px, 100%);
  margin: min(5vh, 2.75rem) auto 1.25rem;
  max-height: calc(100svh - max(1.25rem, env(safe-area-inset-top, 0px)) - max(1.25rem, env(safe-area-inset-bottom, 0px)) - 1.5rem);
  overflow: auto;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 24px 64px rgba(15, 61, 47, 0.28);
  outline: none;
  -webkit-overflow-scrolling: touch;
}

[data-tl="modern"] .tl-qmodal__close {
  position: absolute;
  top: 0.85rem;
  right: 0.85rem;
  z-index: 2;
  width: 2.5rem;
  height: 2.5rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 999px;
  background: rgba(27, 94, 74, 0.08);
  color: #1b5e4a;
  cursor: pointer;
  transition: background 0.15s ease;
}
[data-tl="modern"] .tl-qmodal__close:hover {
  background: rgba(27, 94, 74, 0.16);
}
[data-tl="modern"] .tl-qmodal__close svg {
  width: 1.15rem;
  height: 1.15rem;
}

[data-tl="modern"] .tl-qmodal__grid {
  display: grid;
  grid-template-columns: minmax(0, 0.92fr) minmax(0, 1.08fr);
  min-height: 100%;
}

[data-tl="modern"] .tl-qmodal__aside {
  padding: clamp(1.75rem, 4vw, 2.5rem);
  padding-right: clamp(1.25rem, 3vw, 2rem);
  background:
    radial-gradient(80% 60% at 10% 0%, rgba(129, 215, 66, 0.28), transparent 55%),
    linear-gradient(165deg, #1b5e4a 0%, #143f33 100%);
  color: #fff;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0.85rem;
}
[data-tl="modern"] .tl-qmodal__eyebrow {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #b8ec8a;
}
[data-tl="modern"] .tl-qmodal__aside h2 {
  margin: 0;
  max-width: 14ch;
  font-family: var(--ff-sans, "Nunito", sans-serif);
  font-size: clamp(1.65rem, 1.25rem + 1.2vw, 2.15rem);
  line-height: 1.1;
  letter-spacing: -0.02em;
  color: #fff;
}
[data-tl="modern"] .tl-qmodal__aside > p,
[data-tl="modern"] .tl-qmodal__lede {
  margin: 0;
  max-width: 32ch;
  font-size: 0.98rem;
  line-height: 1.5;
  color: rgba(255, 255, 255, 0.82);
}
[data-tl="modern"] .tl-qmodal__bullets {
  list-style: none;
  margin: 0.35rem 0 0;
  padding: 0;
  display: grid;
  gap: 0.45rem;
}
[data-tl="modern"] .tl-qmodal__bullets li {
  position: relative;
  padding-left: 1.15rem;
  font-size: 0.92rem;
  color: rgba(255, 255, 255, 0.9);
}
[data-tl="modern"] .tl-qmodal__bullets li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.45rem;
  width: 0.45rem;
  height: 0.45rem;
  border-radius: 50%;
  background: #81d742;
}
[data-tl="modern"] .tl-qmodal__phone {
  margin-top: 0.75rem;
  display: grid;
  gap: 0.2rem;
  color: rgba(255, 255, 255, 0.7);
  text-decoration: none;
  font-size: 0.88rem;
}
[data-tl="modern"] .tl-qmodal__phone strong {
  color: #fff;
  font-size: 1.05rem;
}
[data-tl="modern"] .tl-qmodal__phone:hover {
  color: #b8ec8a;
  text-decoration: none;
}
[data-tl="modern"] .tl-qmodal__phone:hover strong {
  color: #b8ec8a;
}

[data-tl="modern"] .tl-qmodal__form {
  padding: clamp(1.75rem, 4vw, 2.35rem);
  padding-top: clamp(2.75rem, 5vw, 3rem);
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  background: #fff;
}
[data-tl="modern"] .tl-qmodal__fields {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}
[data-tl="modern"] .tl-qmodal__foot {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  margin-top: 0.15rem;
}
[data-tl="modern"] .tl-qmodal__row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.85rem;
}
[data-tl="modern"] .tl-qmodal__form .tl-field label {
  display: block;
  margin-bottom: 0.35rem;
  font-size: 0.86rem;
  font-weight: 700;
  color: #1b5e4a;
}
[data-tl="modern"] .tl-qmodal__form .tl-field input,
[data-tl="modern"] .tl-qmodal__form .tl-field select,
[data-tl="modern"] .tl-qmodal__form .tl-field textarea {
  width: 100%;
  min-height: 2.75rem;
  padding: 0.65rem 0.85rem;
  border: 1px solid #d5e6ce;
  border-radius: 10px;
  background: #f8fcf6;
  color: #12261c;
  font-family: inherit;
  font-size: 1rem;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}
[data-tl="modern"] .tl-qmodal__form .tl-field input:focus,
[data-tl="modern"] .tl-qmodal__form .tl-field select:focus,
[data-tl="modern"] .tl-qmodal__form .tl-field textarea:focus {
  outline: none;
  border-color: #4ea01b;
  background: #fff;
  box-shadow: 0 0 0 3px rgba(78, 160, 27, 0.18);
}
[data-tl="modern"] .tl-qmodal__form .tl-field textarea {
  min-height: 88px;
  resize: vertical;
}
[data-tl="modern"] .tl-qmodal__form .tl-btn--primary {
  background: #1b5e4a;
  border: 1px solid #1b5e4a;
  border-radius: 10px;
  color: #fff;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-top: 0.25rem;
  min-height: 3rem;
}
[data-tl="modern"] .tl-qmodal__form .tl-btn--primary:hover {
  background: #164a3b;
  border-color: #164a3b;
  color: #fff;
}
[data-tl="modern"] .tl-qmodal__fine {
  margin: 0;
  text-align: center;
  font-size: 0.78rem;
  color: #6b7c72;
}

@media (prefers-reduced-motion: no-preference) {
  [data-tl="modern"] .tl-qmodal.is-open .tl-qmodal__backdrop {
    animation: tl-qmodal-fade 0.22s ease both;
  }
  [data-tl="modern"] .tl-qmodal.is-open .tl-qmodal__dialog {
    animation: tl-qmodal-rise 0.28s cubic-bezier(0.2, 0.7, 0.2, 1) both;
  }
}
@keyframes tl-qmodal-fade {
  from { opacity: 0.001; }
  to   { opacity: 1; }
}
@keyframes tl-qmodal-rise {
  from { opacity: 0.001; transform: translateY(14px) scale(0.985); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* ---- Mobile: compact bottom sheet, form-first, sticky submit ------------ */
@media (max-width: 800px) {
  [data-tl="modern"] .tl-qmodal {
    align-items: flex-end;
    justify-content: stretch;
    padding: 0;
    overflow: hidden;
  }

  [data-tl="modern"] .tl-qmodal__dialog {
    width: 100%;
    height: auto;
    max-height: min(92dvh, 92svh);
    margin: 0;
    border-radius: 18px 18px 0 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 -12px 40px rgba(15, 61, 47, 0.22);
  }

  [data-tl="modern"] .tl-qmodal__grid {
    grid-template-columns: 1fr;
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }

  /* Compact header strip (no long marketing block to scroll past) */
  [data-tl="modern"] .tl-qmodal__aside {
    order: 0;
    flex: 0 0 auto;
    display: grid;
    grid-template-columns: 1fr auto;
    grid-template-areas:
      "eyebrow eyebrow"
      "title phone";
    align-items: center;
    gap: 0.15rem 0.75rem;
    padding:
      calc(1rem + env(safe-area-inset-top, 0px))
      3.5rem
      0.75rem
      1.1rem;
    background: #fff;
    color: #1b5e4a;
    border-bottom: 1px solid #e5efe0;
  }

  [data-tl="modern"] .tl-qmodal__eyebrow {
    grid-area: eyebrow;
    color: #4ea01b;
    font-size: 0.65rem;
    letter-spacing: 0.12em;
  }

  [data-tl="modern"] .tl-qmodal__aside h2 {
    grid-area: title;
    max-width: none;
    font-size: 1.2rem;
    line-height: 1.2;
    color: #1b5e4a;
    padding-right: 0.25rem;
  }

  [data-tl="modern"] .tl-qmodal__lede,
  [data-tl="modern"] .tl-qmodal__aside > p,
  [data-tl="modern"] .tl-qmodal__bullets {
    display: none !important;
  }

  [data-tl="modern"] .tl-qmodal__phone {
    grid-area: phone;
    margin: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 2.35rem;
    padding: 0.4rem 0.7rem;
    background: #f4fbf0;
    border: 1px solid #cfe8c4;
    border-radius: 999px;
    color: #1b5e4a;
    font-size: 0;
    white-space: nowrap;
  }

  [data-tl="modern"] .tl-qmodal__phone span {
    display: none;
  }

  [data-tl="modern"] .tl-qmodal__phone strong {
    font-size: 0.82rem;
    font-weight: 700;
    color: #1b5e4a;
  }

  [data-tl="modern"] .tl-qmodal__phone:hover,
  [data-tl="modern"] .tl-qmodal__phone:hover strong {
    color: #0f3d2f;
    background: #e8f6df;
  }

  /* Form: scroll fields only; submit stays pinned */
  [data-tl="modern"] .tl-qmodal__form {
    order: 1;
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding: 0;
    gap: 0;
  }

  [data-tl="modern"] .tl-qmodal__fields {
    flex: 1 1 auto;
    min-height: 0;
    overflow: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    padding: 0.85rem 1.1rem 0.5rem;
    gap: 0.55rem;
  }

  [data-tl="modern"] .tl-qmodal__foot {
    flex: 0 0 auto;
    margin: 0;
    padding:
      0.65rem 1.1rem
      calc(0.75rem + env(safe-area-inset-bottom, 0px));
    border-top: 1px solid #e5efe0;
    background: #fff;
    box-shadow: 0 -6px 18px rgba(15, 61, 47, 0.06);
    gap: 0.35rem;
  }

  [data-tl="modern"] .tl-qmodal__form .tl-field label {
    margin-bottom: 0.2rem;
    font-size: 0.78rem;
  }

  [data-tl="modern"] .tl-qmodal__form .tl-field input,
  [data-tl="modern"] .tl-qmodal__form .tl-field select,
  [data-tl="modern"] .tl-qmodal__form .tl-field textarea {
    min-height: 2.55rem;
    padding: 0.55rem 0.75rem;
    font-size: 16px; /* prevent iOS zoom */
    border-radius: 9px;
  }

  [data-tl="modern"] .tl-qmodal__form .tl-field textarea,
  [data-tl="modern"] .tl-qmodal__msg textarea {
    min-height: 3.25rem;
    max-height: 5.5rem;
    resize: none;
  }

  [data-tl="modern"] .tl-qmodal__row {
    grid-template-columns: 1fr 1fr;
    gap: 0.55rem;
  }

  [data-tl="modern"] .tl-qmodal__form .tl-btn--primary {
    margin-top: 0;
    min-height: 2.85rem;
    border-radius: 10px;
  }

  [data-tl="modern"] .tl-qmodal__fine {
    font-size: 0.7rem;
    line-height: 1.3;
  }

  [data-tl="modern"] .tl-qmodal__close {
    top: calc(0.7rem + env(safe-area-inset-top, 0px));
    right: 0.7rem;
    width: 2.35rem;
    height: 2.35rem;
    background: #f4fbf0;
    color: #1b5e4a;
    border: 1px solid #d5e6ce;
  }

  [data-tl="modern"] .tl-qmodal__close:hover {
    background: #e8f6df;
  }
}

/* Narrow phones: stack phone/email if needed, keep sheet shorter */
@media (max-width: 380px) {
  [data-tl="modern"] .tl-qmodal__row {
    grid-template-columns: 1fr;
  }

  [data-tl="modern"] .tl-qmodal__aside {
    grid-template-columns: 1fr;
    grid-template-areas:
      "eyebrow"
      "title"
      "phone";
    padding-right: 3.25rem;
  }

  [data-tl="modern"] .tl-qmodal__phone {
    justify-self: start;
  }
}

/* Short viewports (landscape phones / small height): keep everything tight */
@media (max-height: 640px) and (max-width: 800px) {
  [data-tl="modern"] .tl-qmodal__dialog {
    max-height: 100dvh;
    max-height: 100svh;
    border-radius: 0;
  }

  [data-tl="modern"] .tl-qmodal__aside {
    padding-top: calc(0.65rem + env(safe-area-inset-top, 0px));
    padding-bottom: 0.5rem;
  }

  [data-tl="modern"] .tl-qmodal__eyebrow {
    display: none;
  }

  [data-tl="modern"] .tl-qmodal__aside h2 {
    font-size: 1.05rem;
  }

  [data-tl="modern"] .tl-qmodal__fields {
    padding-top: 0.55rem;
    gap: 0.4rem;
  }

  [data-tl="modern"] .tl-qmodal__msg {
    display: none;
  }
}

@media (prefers-reduced-motion: no-preference) {
  @media (max-width: 800px) {
    [data-tl="modern"] .tl-qmodal.is-open .tl-qmodal__dialog {
      animation: tl-qmodal-sheet 0.3s cubic-bezier(0.2, 0.7, 0.2, 1) both;
    }
  }
}
@keyframes tl-qmodal-sheet {
  from { opacity: 0.001; transform: translateY(100%); }
  to   { opacity: 1; transform: translateY(0); }
}
