/* ===========================================================
   modal.css — Godrej Barca enquiry pop-up
   Same language as the page: a limestone panel (.theme-light)
   on a blurred sea wash, ink hairlines, a terracotta top rule,
   underline-only fields that turn terracotta on focus, and the
   terracotta primary button. Kept compact so it rarely needs to scroll.
   =========================================================== */
.rp-modal {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: color-mix(in srgb, var(--sea) 76%, transparent);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
}
.rp-modal.open {
  display: flex;
  animation: modalFade 0.3s ease;
}
@keyframes modalFade {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

html.modal-open {
  overflow: hidden;
}

.rp-modal__panel {
  position: relative;
  width: min(32vw, 460px);
  min-width: 360px;
  max-height: min(92vh, 92dvh);
  overflow: hidden auto;
  overscroll-behavior: contain;
  background: var(--bg);
  border: 1px solid color-mix(in srgb, var(--ink) 10%, transparent);
  border-radius: 4px;
  box-shadow: 0 44px 100px -40px color-mix(in srgb, var(--sea) 90%, transparent);
  padding: 24px 30px 18px;
  animation: modalRise 0.45s var(--ease-out);
}
.rp-modal__panel:focus {
  outline: none;
}
/* terracotta accent along the top, fading out at both ends */
.rp-modal__panel::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--accent) 22%, var(--accent) 78%, transparent);
}

@keyframes modalRise {
  from {
    opacity: 0;
    transform: translateY(16px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

/* ── Close button ─────────────────────────────────── */
.rp-modal__close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  background: transparent;
  border: 0;
  border-radius: 50%;
  color: var(--ink-muted);
  cursor: pointer;
  transition:
    color 0.25s var(--ease-out),
    background-color 0.25s var(--ease-out);
}
.rp-modal__close svg {
  width: 16px;
  height: 16px;
}
.rp-modal__close:hover {
  color: var(--ink);
  background-color: color-mix(in srgb, var(--ink) 6%, transparent);
}

/* ── Header ───────────────────────────────────────── */
.rp-modal__header {
  padding-bottom: 14px;
  margin-bottom: 14px;
  border-bottom: 1px solid var(--hairline);
}
.rp-modal__title {
  margin: 0 0 6px;
  padding-right: 28px;
  font-size: clamp(1.4rem, 1.1rem + 0.7vw, 1.65rem);
  font-weight: 400;
  line-height: 1.15;
  letter-spacing: -0.02em;
  color: var(--ink);
  text-wrap: balance;
}
.rp-modal__title-for {
  color: var(--accent);
}
.rp-modal__sub {
  font-size: 13px;
  line-height: 1.5;
  color: var(--ink-muted);
  text-wrap: pretty;
}

/* ── Form fields ──────────────────────────────────── */
.rp-modal__form .lf-field {
  display: block;
  margin-bottom: 11px;
}
.rp-modal__form .lf-label {
  display: block;
  margin-bottom: 4px;
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--ink-muted);
}
.lf-optional {
  letter-spacing: 0.06em;
  text-transform: none;
  color: var(--ink-muted);
}
.rp-modal__form input[type="text"],
.rp-modal__form input[type="email"],
.rp-modal__form input[type="tel"],
.rp-modal__form textarea {
  width: 100%;
  padding: 8px 0;
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--hairline);
  border-radius: 0;
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.4;
  outline: none;
  resize: none;
  transition: border-color 0.25s var(--ease-out);
}
.rp-modal__form input::placeholder,
.rp-modal__form textarea::placeholder {
  color: color-mix(in srgb, var(--ink-muted) 88%, transparent);
}
.rp-modal__form input:focus,
.rp-modal__form textarea:focus {
  border-bottom-color: var(--accent);
}

/* phone field — the trigger stays flush; only the flag chip is framed */
.rp-modal__form .phone-field {
  position: relative;
  display: flex;
  align-items: center;
  border-bottom: 1px solid var(--hairline);
  transition: border-color 0.25s var(--ease-out);
}
.rp-modal__form .phone-field:focus-within {
  border-bottom-color: var(--accent);
}
.rp-modal__form .phone-field input[type="tel"] {
  min-width: 0;
  flex: 1;
  padding-left: 12px;
  border-bottom: 0;
  border-left: 1px solid var(--hairline);
}
.rp-modal__form .cc-trigger {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: none;
  padding: 8px 12px 8px 0;
  background: none;
  border: 0;
  color: var(--ink-soft);
  font-size: 14px;
  white-space: nowrap;
  cursor: pointer;
  transition: color 0.25s var(--ease-out);
}
.rp-modal__form .cc-trigger:hover {
  color: var(--ink);
}
.rp-modal__form .cc-trigger:hover .cc-flag-frame,
.rp-modal__form .cc-trigger:focus-visible .cc-flag-frame {
  border-color: var(--accent);
}
.rp-modal__form .cc-flag {
  display: flex;
  align-items: center;
}
.rp-modal__form .cc-dial-sel {
  font-weight: 500;
}
.rp-modal__form .cc-caret {
  display: flex;
  align-items: center;
  color: var(--ink-muted);
}
.rp-modal__form .cc-caret svg {
  width: 10px;
  height: 10px;
  transition: transform 0.25s var(--ease-out);
}
.rp-modal__form .phone-field:has(.cc-dropdown.open) .cc-caret svg {
  transform: rotate(180deg);
}

/* flag chip — framed, with the two-letter code beneath the image, so it
   reads as intentional whether the flag has loaded, is loading, or 404s */
.cc-flag-frame {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--accent) 45%, transparent);
  border-radius: 2px;
  background: var(--surface);
  transition: border-color 0.25s var(--ease-out);
}
.cc-flag-frame .cc-flag-img {
  position: absolute;
  inset: 0;
  width: 100% !important;
  height: 100% !important;
  object-fit: cover;
}
.cc-flag-fallback {
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.02em;
  line-height: 1;
  color: var(--accent);
}

/* ── Country selector dropdown ────────────────────── */
.rp-modal__form .cc-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  z-index: 5;
  width: min(300px, 86vw);
  max-height: 270px;
  overflow: hidden;
  background: var(--bg);
  border: 1px solid var(--hairline);
  border-radius: 4px;
  box-shadow: 0 24px 60px -20px color-mix(in srgb, var(--sea) 45%, transparent);
}
.rp-modal__form .cc-dropdown.open {
  display: flex;
  flex-direction: column;
}
.rp-modal__form .cc-search-wrap {
  padding: 8px;
  border-bottom: 1px solid var(--hairline);
}
.rp-modal__form .cc-dropdown .cc-search {
  width: 100%;
  padding: 8px 10px;
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: 2px;
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 14px;
  outline: none;
}
.rp-modal__form .cc-dropdown .cc-search:focus {
  border-color: var(--accent);
}
.rp-modal__form .cc-dropdown .cc-search::placeholder {
  color: color-mix(in srgb, var(--ink-muted) 88%, transparent);
}
.rp-modal__form .cc-list {
  overflow-y: auto;
  overscroll-behavior: contain;
}
.rp-modal__form .cc-opt {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 12px;
  background: transparent;
  border: 0;
  border-bottom: 1px solid color-mix(in srgb, var(--ink) 7%, transparent);
  color: var(--ink);
  font-size: 13px;
  text-align: left;
  cursor: pointer;
}
.rp-modal__form .cc-opt:hover,
.rp-modal__form .cc-opt:focus-visible {
  background: var(--surface);
}
.rp-modal__form .cc-opt:focus-visible {
  outline-offset: -2px;
}
.rp-modal__form .cc-name {
  flex: 1;
}
.rp-modal__form .cc-dial {
  color: var(--ink-muted);
}
.rp-modal__form .cc-divider {
  height: 1px;
  background: var(--hairline);
}

/* ── reCAPTCHA ────────────────────────────────────── */
.rp-modal__recaptcha {
  margin-top: 12px;
}
.rp-modal__recaptcha .g-recaptcha {
  min-height: 78px;
  transform-origin: left top;
}
.rp-modal__recaptcha .captcha-err {
  display: none;
  margin-top: 6px;
  font-size: 12px;
  color: var(--accent);
}
.rp-modal__recaptcha .captcha-err.visible {
  display: block;
}

/* ── Submit + fine print ──────────────────────────── */
.rp-modal__form .lf-error {
  font-size: 12px;
  line-height: 1.5;
  color: var(--accent);
}
.rp-modal__form .lf-error:not(:empty) {
  margin-top: 2px;
}
.rp-modal__form .btn {
  width: 100%;
  margin-top: 14px;
}
.rp-modal__form .btn.is-loading {
  opacity: 0.6;
  pointer-events: none;
}
.rp-modal__form .lf-fine {
  margin-top: 8px;
  font-size: 11px;
  line-height: 1.5;
  text-align: center;
  color: var(--ink-muted);
}

/* ── Tablet / mobile ──────────────────────────────── */
@media (max-width: 1080px) {
  .rp-modal__panel {
    width: min(52vw, 460px);
  }
}
@media (max-width: 760px) {
  .rp-modal__panel {
    width: min(86vw, 440px);
  }
}
/* Stays a centred dialog on phones — never a bottom sheet */
@media (max-width: 480px) {
  .rp-modal {
    padding: 12px;
  }
  .rp-modal__panel {
    width: 100%;
    min-width: 0;
    max-height: min(90vh, 90dvh);
    padding: 26px 20px 18px;
  }
  .rp-modal__header {
    padding-bottom: 14px;
    margin-bottom: 14px;
  }
  .rp-modal__form .lf-field {
    margin-bottom: 11px;
  }
  /* 16px stops iOS zooming into the field on focus */
  .rp-modal__form input[type="text"],
  .rp-modal__form input[type="email"],
  .rp-modal__form input[type="tel"],
  .rp-modal__form textarea,
  .rp-modal__form .cc-dropdown .cc-search {
    font-size: 16px;
  }
  .rp-modal__form .btn {
    margin-top: 14px;
  }
}
@media (max-width: 360px) {
  .rp-modal__recaptcha .g-recaptcha {
    transform: scale(0.88);
    margin-bottom: -9px;
  }
}
/* Short screens (laptops at 640–700px, most phones in a browser): the
   placeholders carry each field's meaning, so the small labels are hidden
   visually (screen readers still get them) and everything tightens up so
   the whole form fits without the panel scrolling */
@media (max-height: 700px) {
  .rp-modal {
    padding: 12px;
  }
  .rp-modal__panel {
    max-height: calc(100vh - 24px);
    max-height: calc(100dvh - 24px);
    padding: 20px 22px 14px;
  }
  .rp-modal__header {
    padding-bottom: 12px;
    margin-bottom: 8px;
  }
  .rp-modal__title {
    margin-bottom: 4px;
  }
  .rp-modal__form .lf-label {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }
  .rp-modal__form .lf-field {
    margin-bottom: 6px;
  }
  .rp-modal__recaptcha {
    margin-top: 10px;
  }
  .rp-modal__recaptcha .g-recaptcha {
    transform: scale(0.88);
    margin-bottom: -9px;
  }
  .rp-modal__form .btn {
    margin-top: 12px;
  }
  .rp-modal__form .lf-fine {
    margin-top: 6px;
  }
}
/* Smallest phones (iPhone SE 1st gen, 320×568) — leaves room for an error
   message and the longer residence title without the panel scrolling */
@media (max-height: 600px) {
  .rp-modal__panel {
    padding: 16px 18px 12px;
  }
  .rp-modal__header {
    padding-bottom: 10px;
    margin-bottom: 4px;
  }
  .rp-modal__title {
    font-size: 1.3rem;
  }
  .rp-modal__sub {
    font-size: 12px;
    line-height: 1.45;
  }
  .rp-modal__form .lf-field {
    margin-bottom: 4px;
  }
  .rp-modal__form .btn {
    margin-top: 10px;
  }
}
/* Phones in landscape — too short for one column, so the fields pair up
   and the CAPTCHA sits beside the submit button */
@media (max-height: 480px) and (min-width: 560px) {
  .rp-modal__panel {
    width: min(92vw, 640px);
  }
  .rp-modal__form {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    column-gap: 22px;
    align-items: end;
  }
  .rp-modal__recaptcha {
    min-width: 0;
  }
  .rp-modal__header {
    padding-bottom: 8px;
  }
  .rp-modal__form .lf-error,
  .rp-modal__form .lf-fine {
    grid-column: 1 / -1;
  }
  .rp-modal__recaptcha {
    margin-top: 6px;
  }
  .rp-modal__form .btn {
    align-self: center;
    margin-top: 6px;
  }
}
@media (max-height: 340px) and (min-width: 560px) {
  .rp-modal {
    padding: 8px;
  }
  .rp-modal__panel {
    max-height: calc(100vh - 16px);
    max-height: calc(100dvh - 16px);
  }
  .rp-modal__form .lf-fine {
    margin-top: 2px;
  }
}
/* the widget is a fixed 304px wide, so shrink it to fit a narrower column */
@media (max-height: 480px) and (min-width: 560px) and (max-width: 700px) {
  .rp-modal__recaptcha .g-recaptcha {
    transform: scale(0.74);
    margin-bottom: -20px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .rp-modal.open,
  .rp-modal__panel {
    animation: none;
  }
}
