/* ==========================================================
   POPUP REGISTRATION FORM - AquaTerra
   Loaded via functions.php enqueue
   ========================================================== */

/* ===== Overlay ===== */
.popup-overlay {
  position: fixed;
  inset: 0;
  background: rgba(255, 255, 255, 0.8);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.35s ease, visibility 0.35s ease;
}
.popup-overlay.is-active {
  opacity: 0.95;
  visibility: visible;
}

/* ===== Container ===== */
.popup-form-wrap {
  position: relative;
  width: clamp(320px, 88vw, 720px) !important;
  max-height: 90vh;
  overflow-y: auto;
  background: #fff;
  border: 1px solid rgba(0, 0, 0, 0.08);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.12);
  padding: clamp(2rem, 5vw, 3.5rem) clamp(1.5rem, 5vw, 3.5rem);
  transform: scale(0.85);
  opacity: 0;
  transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1),
              opacity 0.35s ease;
}
.popup-overlay.is-active .popup-form-wrap {
  transform: scale(1);
  opacity: 1;
}

/* ===== Close button ===== */
.popup-close {
  position: absolute;
  top: clamp(0.75rem, 2vw, 1.25rem);
  right: clamp(0.75rem, 2vw, 1.25rem);
  width: clamp(28px, 4vw, 36px);
  height: clamp(28px, 4vw, 36px);
  background: none;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: opacity 0.2s ease;
}
.popup-close:hover { opacity: 0.5; }
.popup-close svg {
  width: 100%;
  height: 100%;
  stroke: var(--color-primary);
  stroke-width: 1.5;
}

/* ===== Logo ===== */
.popup-logo {
  text-align: center;
  margin-bottom: clamp(1rem, 3vw, 1.75rem);
}
.popup-logo img {
  width: clamp(140px, 25vw, 200px);
  height: auto;
  margin: 0 auto;
  display: block;
}

/* ===== Tagline (h4) ===== */
.popup-form-wrap h4 {
  font-family: var(--font-heading);
  font-style: italic;
  font-size: clamp(1.25rem, 2.6vw, 1.75rem);
  font-weight: 300;
  text-align: center;
  color: var(--color-secondary);
  margin: 0 0 clamp(0.75rem, 1.5vw, 1.25rem);
  line-height: 1.1;
  padding: 0;
}

/* ===== Intro text ===== */
.popup-form-wrap .popup-intro {
  font-family: var(--font-body);
  font-size: clamp(0.825rem, 1.6vw, 0.95rem);
  font-weight: 300;
  line-height: 1.65;
  text-align: center;
  color: #333;
  margin: 0 auto clamp(1.25rem, 3vw, 2rem);
  max-width: 90%;
}

/* ===== Privacy note ===== */
.popup-privacy {
  font-family: var(--font-body);
  font-size: clamp(0.6rem, 1.2vw, 0.72rem);
  color: #888;
  text-align: center;
  margin-top: clamp(0.75rem, 1.5vw, 1rem);
  letter-spacing: 0.3px;
}
.popup-privacy .popup-privacy-required {
  color: var(--color-primary);
  margin-right: 1px;
}

/* ==========================================================
   GRAVITY FORMS OVERRIDES (scoped to popup)
   Works WITH Gravity Forms 2.5+ 12-column grid, not against it
   ========================================================== */

.popup-form-wrap .gform_wrapper {
  width: 100%;
  max-width: 100%;
  margin: 0 auto;
}

/* Let Gravity's 12-column grid do its job — only override gap and reset list styling */
.popup-form-wrap .gform_wrapper .gform_fields {
  gap: clamp(0.8rem, 2vw, 1.2rem) clamp(1rem, 3vw, 2rem) !important;
  list-style: none;
  padding: 0;
  margin: 0;
}

/* Individual field — let Gravity's grid spans control width, just clean up internal layout */
.popup-form-wrap .gform_wrapper .gfield {
  margin: 0;
  padding: 0;
}

/* Labels */
.popup-form-wrap .gform_wrapper .gfield_label {
  font-family: var(--font-body) !important;
  font-size: clamp(0.7rem, 1.4vw, 0.825rem) !important;
  font-weight: 400 !important;
  letter-spacing: 0.5px !important;
  color: #000 !important;
  margin-bottom: clamp(2px, 0.5vw, 4px) !important;
  padding: 0 !important;
  display: block;
}

/* Required indicator — copper asterisk */
.popup-form-wrap .gform_wrapper .gfield_required {
  color: var(--color-primary) !important;
  font-weight: 400 !important;
  margin-left: 2px;
}

/* Hide Gravity Forms auto-generated required field legend at top of form */
.popup-form-wrap .gform_wrapper .gform_required_legend {
  display: none !important;
}

/* Input wrapper */
.popup-form-wrap .gform_wrapper .ginput_container {
  width: 100%;
  margin-top: 0 !important;
}

/* Text / email / tel inputs — underline only, no box */
.popup-form-wrap .gform_wrapper input[type="text"],
.popup-form-wrap .gform_wrapper input[type="email"],
.popup-form-wrap .gform_wrapper input[type="tel"] {
  width: 100% !important;
  inline-size: 100% !important;
  padding: clamp(6px, 1vw, 8px) 0 !important;
  border: none !important;
  border-bottom: 1px solid #000 !important;
  border-radius: 0 !important;
  font-family: var(--font-body) !important;
  font-size: clamp(0.7rem, 1.4vw, 0.825rem) !important;
  font-weight: 400 !important;
  letter-spacing: 0.3px !important;
  color: #000 !important;
  background: transparent !important;
  height: auto !important;
  box-shadow: none !important;
  box-sizing: border-box;
  -webkit-appearance: none;
  transition: border-color 0.2s ease;
}
.popup-form-wrap .gform_wrapper input::placeholder { color: #999 !important; }
.popup-form-wrap .gform_wrapper input:focus {
  outline: none !important;
  border-bottom-color: var(--color-primary) !important;
}

/* Textarea — boxed, modest height */
.popup-form-wrap .gform_wrapper textarea {
  width: 100% !important;
  inline-size: 100% !important;
  padding: clamp(10px, 1.4vw, 14px) !important;
  border: 1px solid #ccc !important;
  border-radius: 0 !important;
  font-family: var(--font-body) !important;
  font-size: clamp(0.7rem, 1.4vw, 0.825rem) !important;
  font-weight: 400 !important;
  letter-spacing: 0.3px !important;
  color: #000 !important;
  background: #fff !important;
  height: clamp(80px, 15vw, 110px) !important;
  min-height: clamp(80px, 15vw, 110px) !important;
  box-shadow: none !important;
  resize: vertical;
  -webkit-appearance: none;
  box-sizing: border-box;
  transition: border-color 0.2s ease;
}
.popup-form-wrap .gform_wrapper textarea:focus {
  outline: none !important;
  border-color: var(--color-primary) !important;
}
.popup-form-wrap .gform_wrapper textarea::placeholder { color: #999 !important; }

/* Validation errors */
.popup-form-wrap .gform_wrapper .gfield_validation_message,
.popup-form-wrap .gform_wrapper .validation_message {
  font-family: var(--font-body) !important;
  font-size: clamp(0.6rem, 1.1vw, 0.72rem) !important;
  color: #c00 !important;
  font-weight: 400 !important;
  margin-top: 4px !important;
  padding: 0 !important;
  background: none !important;
  border: none !important;
}
.popup-form-wrap .gform_wrapper .gfield_error input,
.popup-form-wrap .gform_wrapper .gfield_error textarea {
  border-bottom-color: #c00 !important;
}
.popup-form-wrap .gform_wrapper .validation_error,
.popup-form-wrap .gform_wrapper .gform_validation_errors {
  font-family: var(--font-body) !important;
  font-size: clamp(0.7rem, 1.3vw, 0.825rem) !important;
  color: #c00 !important;
  text-align: center !important;
  margin-bottom: clamp(0.75rem, 1.5vw, 1rem) !important;
  padding: clamp(0.5rem, 1vw, 0.75rem) !important;
  background: #fff5f5 !important;
  border: 1px solid #c00 !important;
}

/* Submit footer */
.popup-form-wrap .gform_wrapper .gform_footer {
  display: flex;
  justify-content: center;
  padding: clamp(0.5rem, 1.5vw, 1rem) 0 0 !important;
  margin: 0 !important;
}

/* AJAX spinner */
.popup-form-wrap .gform_wrapper .gform_ajax_spinner {
  margin-left: 10px;
  vertical-align: middle;
}

/* Confirmation message */
.popup-form-wrap .gform_confirmation_message {
  font-family: var(--font-body);
  font-size: clamp(0.9rem, 1.8vw, 1.1rem);
  color: #333;
  text-align: center;
  padding: 2rem 0;
  line-height: 1.5;
}

/* Mobile single-column — force all fields full width below 540px */
@media (max-width: 540px) {
  .popup-form-wrap .gform_wrapper .gfield--width-half,
  .popup-form-wrap .gform_wrapper .gfield--width-third,
  .popup-form-wrap .gform_wrapper .gfield--width-quarter {
    grid-column: 1 / -1 !important;
  }
}