/* ==========================================================================
   THE DOMUS — PIXEL-MATCH ENQUIRY MODAL (COMPACT SINGLE-VIEWPORT FIT)
   Fits completely inside one viewport across desktop, laptop, tablet & mobile
   ========================================================================== */

/* Prevent page scrolling when modal is open — Hard Background Lock */
html.modal-open,
body.modal-open {
  overflow: hidden !important;
  overscroll-behavior: none !important;
  touch-action: none;
}

/* Fixed Backdrop Layer — Viewport Safe Clearance */
.domus-modal-backdrop {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  height: 100svh;
  height: 100dvh;
  overflow: hidden;
  z-index: 99999;
  background: rgba(0, 0, 0, 0.44);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: max(8px, env(safe-area-inset-top, 8px)) max(12px, env(safe-area-inset-right, 12px)) max(8px, env(safe-area-inset-bottom, 8px)) max(12px, env(safe-area-inset-left, 12px));
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, visibility 0.2s ease;
  box-sizing: border-box;
  overscroll-behavior: none;
}

.domus-modal-backdrop.is-active {
  opacity: 1;
  visibility: visible;
}

/* Modal Card — Compact Architecture, Zero Inner Scrollbar, Fits 100% in Viewport */
.domus-modal-card {
  position: relative;
  width: 100%;
  max-width: 400px;
  max-height: min(100%, calc(100svh - 16px));
  max-height: min(100%, calc(100dvh - 16px));
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  scrollbar-width: none; /* No visible scrollbar */
  -ms-overflow-style: none;
  background: #FFFFFF;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 16px;
  box-shadow: 0 20px 45px rgba(0, 0, 0, 0.16), 0 4px 12px rgba(0, 0, 0, 0.05);
  padding: clamp(14px, 2.2vh, 18px) clamp(16px, 3.5vw, 22px);
  color: #171717;
  transform: translateY(8px);
  transition: transform 0.2s ease, opacity 0.2s ease;
  font-family: var(--font-sans, -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, sans-serif);
  box-sizing: border-box;
}

.domus-modal-backdrop.is-active .domus-modal-card {
  transform: translateY(0);
}

/* Hide scrollbar completely across Webkit browsers */
.domus-modal-card::-webkit-scrollbar {
  display: none;
  width: 0;
  height: 0;
}

/* Close Button — Simple Thin Dark X, Top-Right */
.domus-modal-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 28px;
  height: 28px;
  background: transparent;
  border: none;
  color: #2D3748;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  z-index: 10;
  outline: none;
  transition: opacity 0.15s ease, transform 0.15s ease;
}

.domus-modal-close:hover {
  opacity: 0.7;
  transform: scale(1.08);
}

.domus-modal-close svg {
  display: block;
}

/* Header — Tight 2-Line Hierarchy matching Reference */
.domus-ref-header {
  margin-bottom: clamp(8px, 1.4vh, 12px);
  padding-right: 32px;
}

.domus-ref-heading-line1 {
  font-family: var(--font-serif, "Playfair Display", Georgia, serif);
  font-size: clamp(20px, 2.6vh, 23px);
  font-weight: 600;
  color: #171717;
  line-height: 1.15;
  margin: 0;
  letter-spacing: -0.01em;
}

.domus-ref-heading-line2 {
  font-family: var(--font-sans, -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, sans-serif);
  font-size: clamp(14.5px, 2vh, 16.5px);
  font-weight: 600;
  color: #B87E12; /* Golden ochre / Domus champagne gold */
  line-height: 1.2;
  margin: 2px 0 0 0;
}

/* Form Layout — Compact vertical rhythm */
.domus-modal-form {
  display: flex;
  flex-direction: column;
  gap: clamp(7px, 1.2vh, 10px);
}

.domus-form-group {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

/* Labels: Uppercase, Small, Clean Sans-Serif, Medium/Semi-Bold */
.domus-form-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #26332D;
  margin: 0;
  line-height: 1.1;
}

.domus-form-label span.req {
  color: #D9381E;
  margin-left: 2px;
}

.domus-form-label span.opt {
  color: #718096;
  font-weight: 500;
  font-size: 10.5px;
}

/* Select Box: Matches Reference Dropdown Styling */
.domus-select-wrap {
  position: relative;
  width: 100%;
}

.domus-form-select {
  width: 100%;
  box-sizing: border-box;
  background: #FAFCFA;
  border: 1px solid #D9D9D9;
  border-radius: 9px;
  padding: 0 32px 0 12px;
  color: #26332D;
  font-size: 14px;
  font-family: inherit;
  height: clamp(36px, 4.8vh, 39px);
  outline: none;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  cursor: pointer;
  transition: border-color 0.2s ease, background 0.2s ease;
}

.domus-form-select:focus {
  border-color: #A0AEC0;
  background: #FFFFFF;
}

.domus-select-arrow {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
  color: #26332D;
}

/* Custom Mobile Project Selector (Hidden on Desktop by default) */
.domus-project-select-btn,
.domus-project-dropdown {
  display: none;
}
.domus-native-arrow {
  display: block;
}

/* Standard Inputs: #FAFCFA, 1px solid #D9D9D9, Radius 9px, Height ~38px */
.domus-form-input {
  width: 100%;
  box-sizing: border-box;
  background: #FAFCFA;
  border: 1px solid #D9D9D9;
  border-radius: 9px;
  padding: 0 12px;
  color: #26332D;
  font-size: 14px;
  font-family: inherit;
  height: clamp(36px, 4.8vh, 39px);
  outline: none;
  transition: border-color 0.2s ease, background 0.2s ease;
}

.domus-form-input:focus {
  border-color: #A0AEC0;
  background: #FFFFFF;
}

.domus-form-input::placeholder,
.domus-form-textarea::placeholder {
  color: #9AA6B2;
}

/* Phone Field: [ 🇮🇳 +91 ▼ ] [ 10-digit number ] */
.domus-phone-row {
  display: flex;
  gap: 6px;
  align-items: center;
  width: 100%;
}

.domus-country-select,
.domus-country-picker {
  position: relative;
  width: 104px;
  min-width: 104px;
  height: clamp(36px, 4.8vh, 39px);
}

.domus-country-select-btn {
  width: 100%;
  height: 100%;
  box-sizing: border-box;
  background: #FAFCFA;
  border: 1px solid #D9D9D9;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 0 6px;
  font-size: 13.5px;
  font-weight: 500;
  color: #171717;
  user-select: none;
  cursor: pointer;
  outline: none;
  font-family: inherit;
  transition: border-color 0.2s ease, background 0.2s ease;
}

.domus-country-select-btn:hover {
  background: #FFFFFF;
  border-color: #BDBDBD;
}

.domus-country-select-btn:focus-visible {
  border-color: #171717;
  background: #FFFFFF;
}

.domus-country-picker.is-open .domus-country-select-btn {
  border-color: #171717;
  background: #FFFFFF;
}

.domus-country-picker.is-open .domus-chevron {
  transform: rotate(180deg);
}

.domus-flag-wrap {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.domus-flag-img {
  width: 18px;
  height: 13.5px;
  object-fit: cover;
  border-radius: 2px;
  box-shadow: 0 0 1px rgba(0, 0, 0, 0.25);
  display: inline-block;
  vertical-align: middle;
}

.domus-flag-fallback {
  font-size: 15px;
  line-height: 1;
}

.domus-dial-code {
  font-size: 13px;
  font-weight: 600;
  color: #171717;
  letter-spacing: -0.01em;
}

.domus-chevron {
  color: #6B6B6B;
  transition: transform 0.2s ease;
  flex-shrink: 0;
}

/* Country Dropdown */
.domus-country-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  width: 310px;
  max-width: min(330px, calc(100vw - 40px));
  background: #FFFFFF;
  border: 1px solid #D9D9D9;
  border-radius: 10px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.12), 0 2px 6px rgba(0, 0, 0, 0.04);
  z-index: 1000;
  overflow: hidden;
  box-sizing: border-box;
}

.domus-country-picker.is-open .domus-country-dropdown {
  display: flex;
  flex-direction: column;
  animation: domusDropdownFadeIn 0.15s ease-out;
}

@keyframes domusDropdownFadeIn {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.domus-country-search-wrap {
  position: relative;
  padding: 7px 9px;
  border-bottom: 1px solid #ECECEC;
  background: #FFFFFF;
}

.domus-country-search-icon {
  position: absolute;
  left: 17px;
  top: 50%;
  transform: translateY(-50%);
  color: #8C8C8C;
  pointer-events: none;
}

.domus-country-search-input {
  width: 100%;
  height: 32px;
  box-sizing: border-box;
  background: #FAFAFA;
  border: 1px solid #D9D9D9;
  border-radius: 6px;
  padding: 0 8px 0 26px;
  font-size: 12.5px;
  font-family: inherit;
  color: #171717;
  outline: none;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.domus-country-search-input:focus {
  border-color: #171717;
  background: #FFFFFF;
}

.domus-country-search-input::placeholder {
  color: #8C8C8C;
}

.domus-country-list {
  max-height: 190px;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  padding: 4px 0;
  outline: none;
}

.domus-country-list::-webkit-scrollbar {
  width: 4px;
}
.domus-country-list::-webkit-scrollbar-track {
  background: transparent;
}
.domus-country-list::-webkit-scrollbar-thumb {
  background: #D9D9D9;
  border-radius: 3px;
}
.domus-country-list::-webkit-scrollbar-thumb:hover {
  background: #BFBFBF;
}

.domus-country-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 11px;
  font-size: 12.5px;
  color: #171717;
  cursor: pointer;
  transition: background 0.12s ease;
  user-select: none;
}

.domus-country-item:hover,
.domus-country-item.is-focused {
  background: #F5F5F5;
}

.domus-country-item.is-selected {
  background: #F5F5F5;
  font-weight: 600;
}

.domus-country-item-flag {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.domus-country-item-name {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: #171717;
}

.domus-country-item-dial {
  flex-shrink: 0;
  font-size: 12px;
  font-weight: 500;
  color: #6B6B6B;
  font-variant-numeric: tabular-nums;
  margin-left: auto;
  padding-left: 8px;
}

.domus-country-empty {
  padding: 16px 10px;
  text-align: center;
  font-size: 12.5px;
  color: #8C8C8C;
}

.domus-phone-input {
  flex: 1;
  width: 100%;
}

/* Textarea: Matches Reference ~60-64px, Radius 9px */
.domus-form-textarea {
  width: 100%;
  box-sizing: border-box;
  background: #FAFCFA;
  border: 1px solid #D9D9D9;
  border-radius: 9px;
  padding: 7px 12px;
  color: #26332D;
  font-size: 13.5px;
  font-family: inherit;
  height: clamp(52px, 7vh, 62px);
  min-height: 48px;
  max-height: 72px;
  resize: vertical;
  line-height: 1.35;
  outline: none;
  transition: border-color 0.2s ease, background 0.2s ease;
}

.domus-form-textarea:focus {
  border-color: #A0AEC0;
  background: #FFFFFF;
}

/* Error Alert */
.domus-modal-error {
  background: #FFF1F0;
  border: 1px solid #FFA39E;
  color: #CF1322;
  padding: 6px 10px;
  border-radius: 8px;
  font-size: 11.5px;
  display: none;
  line-height: 1.35;
  margin-bottom: 4px;
}

.domus-modal-error.is-active {
  display: block;
}

/* Submit Button: Domus Architectural Black #0B0908 with White Text */
.domus-modal-submit {
  width: 100%;
  background: #0B0908;
  color: #FFFFFF;
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  height: clamp(40px, 5.2vh, 44px);
  padding: 0 16px;
  border-radius: 9px;
  border: 1px solid #0B0908;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: 0 3px 12px rgba(11, 9, 8, 0.2);
  transition: background 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
  outline: none;
  box-sizing: border-box;
  margin-top: 2px;
}

.domus-modal-submit:hover:not(:disabled) {
  background: #1C1917;
  border-color: #1C1917;
  box-shadow: 0 5px 16px rgba(11, 9, 8, 0.3);
}

.domus-modal-submit:active:not(:disabled) {
  transform: scale(0.99);
}

.domus-modal-submit:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.domus-modal-submit-spinner {
  width: 13px;
  height: 13px;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: #FFFFFF;
  border-radius: 50%;
  animation: domusModalSpin 0.7s linear infinite;
  display: none;
}

.domus-modal-submit.is-loading .domus-modal-submit-spinner {
  display: inline-block;
}

@keyframes domusModalSpin {
  to { transform: rotate(360deg); }
}

/* Success View */
.domus-modal-success {
  text-align: center;
  padding: 18px 8px 10px;
  display: none;
}

.domus-modal-success.is-active {
  display: block;
  animation: domusFadeIn 0.25s ease;
}

.domus-modal-success-icon {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: #F7F5F0;
  border: 1.5px solid #B87E12;
  color: #B87E12;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 10px auto;
  font-size: 19px;
}

.domus-modal-success-title {
  font-family: var(--font-serif, "Playfair Display", Georgia, serif);
  font-size: 22px;
  color: #171717;
  margin: 0 0 5px 0;
  line-height: 1.2;
}

.domus-modal-success-desc {
  font-size: 12.5px;
  color: #6B6B6B;
  line-height: 1.45;
  margin: 0 0 14px 0;
}

.domus-modal-success-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  margin-top: 10px;
}

.domus-modal-brochure-download-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  background: #B87E12;
  color: #FFFFFF !important;
  text-decoration: none;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  height: 40px;
  padding: 0 18px;
  border-radius: 9px;
  transition: filter 0.15s ease;
  width: 100%;
  max-width: 300px;
  box-sizing: border-box;
}

.domus-modal-brochure-download-btn:hover {
  filter: brightness(1.05);
  color: #FFFFFF !important;
}

.domus-modal-success-btn {
  background: #FFFFFF;
  border: 1px solid #D9D9D9;
  color: #171717;
  font-size: 11.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  height: 36px;
  padding: 0 20px;
  border-radius: 9px;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease;
}

.domus-modal-success-btn:hover {
  background: #F5F5F5;
  border-color: #B87E12;
}

/* Mobile Project Selector — Aligned with form, strictly contained, zero overflow */
@media (max-width: 768px) {
  .domus-form-select,
  .domus-native-arrow {
    display: none !important;
  }

  .domus-select-wrap {
    position: relative;
    width: 100%;
  }

  .domus-project-select-btn {
    display: flex !important;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    height: 38px;
    box-sizing: border-box;
    background: #FAFCFA;
    border: 1px solid #D9D9D9;
    border-radius: 9px;
    padding: 0 12px;
    color: #26332D;
    font-size: 14px;
    font-family: inherit;
    font-weight: 500;
    cursor: pointer;
    text-align: left;
    outline: none;
    transition: border-color 0.2s ease, background 0.2s ease;
  }

  .domus-project-select-btn:hover {
    background: #FFFFFF;
    border-color: #BDBDBD;
  }

  .domus-project-select-btn:focus-visible,
  .domus-select-wrap.is-open .domus-project-select-btn {
    border-color: #B87E12;
    background: #FFFFFF;
  }

  .domus-select-wrap.is-open .domus-select-arrow {
    transform: translateY(-50%) rotate(180deg);
  }

  .domus-project-selected-name {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding-right: 8px;
    color: #171717;
    font-size: 13.5px;
    font-weight: 500;
  }

  /* Compact Mobile Project Dropdown Menu: Strictly fits within the form width */
  .domus-project-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    width: 100%;
    max-width: 100%;
    background: #FFFFFF;
    border: 1px solid #D9D9D9;
    border-radius: 10px;
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.12), 0 2px 6px rgba(0, 0, 0, 0.05);
    z-index: 1000;
    overflow: hidden;
    box-sizing: border-box;
  }

  .domus-select-wrap.is-open .domus-project-dropdown {
    display: flex !important;
    flex-direction: column;
    animation: domusDropdownFadeIn 0.15s ease-out;
  }

  .domus-project-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    font-size: 13px;
    color: #171717;
    cursor: pointer;
    border-bottom: 1px solid #F0F0F0;
    transition: background 0.12s ease, color 0.12s ease;
    user-select: none;
    touch-action: manipulation;
  }

  .domus-project-item:last-child {
    border-bottom: none;
  }

  .domus-project-item:hover,
  .domus-project-item:active {
    background: #F9F8F5;
    color: #B87E12;
  }

  .domus-project-item.is-selected {
    background: #F9F8F5;
    color: #B87E12;
    font-weight: 600;
  }

  .domus-project-check {
    display: none;
    color: #B87E12;
    font-size: 13px;
    font-weight: 700;
  }

  .domus-project-item.is-selected .domus-project-check {
    display: inline-block;
  }
}

/* Mobile Responsive — Handled strictly without inner scrolling */
@media (max-width: 480px) {
  .domus-modal-card {
    padding: 14px 14px 12px;
    border-radius: 16px;
    max-width: calc(100vw - 20px);
    max-height: calc(100svh - 16px);
  }

  .domus-ref-header {
    margin-bottom: 8px;
    padding-right: 30px;
  }

  .domus-ref-heading-line1 {
    font-size: 20px;
  }

  .domus-ref-heading-line2 {
    font-size: 15px;
  }

  .domus-modal-form {
    gap: 7px;
  }

  .domus-form-group {
    gap: 2px;
  }

  .domus-form-label {
    font-size: 10px;
  }

  .domus-country-select,
  .domus-country-picker {
    width: 94px;
    min-width: 94px;
    height: 38px;
  }

  .domus-country-select-btn {
    font-size: 13px;
    padding: 0 5px;
  }

  .domus-form-input,
  .domus-form-select {
    height: 38px;
    font-size: 16px; /* Prevents auto zoom in iOS Safari */
    padding: 0 11px;
  }

  .domus-project-select-btn {
    height: 38px;
    font-size: 13.5px;
    padding: 0 11px;
  }

  .domus-project-item {
    padding: 8.5px 11px;
    font-size: 12.5px;
  }

  .domus-form-textarea {
    height: 52px;
    min-height: 44px;
    font-size: 16px; /* Prevents auto zoom in iOS Safari */
    padding: 7px 11px;
    line-height: 1.3;
  }

  .domus-modal-submit {
    height: 40px;
    font-size: 12.5px;
  }

  .domus-modal-close {
    top: 12px;
    right: 12px;
    width: 26px;
    height: 26px;
  }
}

/* Short viewports (e.g. laptops with toolbars, small phones, landscape) */
@media (max-height: 640px) {
  .domus-modal-backdrop {
    padding: 6px 10px;
  }

  .domus-modal-card {
    padding: 10px 14px 10px;
    border-radius: 14px;
    max-height: calc(100svh - 12px);
  }

  .domus-ref-header {
    margin-bottom: 5px;
    padding-right: 28px;
  }

  .domus-ref-heading-line1 {
    font-size: 18px;
  }

  .domus-ref-heading-line2 {
    font-size: 13.5px;
    margin-top: 1px;
  }

  .domus-modal-form {
    gap: 5px;
  }

  .domus-form-group {
    gap: 2px;
  }

  .domus-form-label {
    font-size: 9.5px;
  }

  .domus-form-input,
  .domus-form-select,
  .domus-country-select,
  .domus-country-picker {
    height: 34px;
    font-size: 13px;
  }

  .domus-country-select-btn {
    height: 34px;
  }

  .domus-form-textarea {
    height: 44px;
    min-height: 38px;
    padding: 5px 10px;
    font-size: 12.5px;
  }

  .domus-modal-submit {
    height: 36px;
    font-size: 12px;
    margin-top: 1px;
  }

  .domus-modal-close {
    top: 10px;
    right: 10px;
    width: 24px;
    height: 24px;
  }
}

@keyframes domusFadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}
