/* =====================================================================
   Membership application popup (home page tier buttons)
   Markup: #apply-modal in index.html · Behaviour: assets/js/apply-form.js
   ===================================================================== */

html.apply-open,
html.apply-open body {
  overflow: hidden;
}
/* keep the Tidio chat bubble from floating over the popup */
html.apply-open #tidio-chat {
  display: none !important;
}

.apply-modal {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  visibility: hidden;
  pointer-events: none;
  transition: visibility 0s linear 0.35s;
}
.apply-modal.is-open {
  visibility: visible;
  pointer-events: auto;
  transition-delay: 0s;
}

.apply-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(10, 10, 10, 0.62);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  opacity: 0;
  transition: opacity 0.35s ease;
}
.apply-modal.is-open .apply-modal__backdrop {
  opacity: 1;
}

.apply-modal__panel {
  position: relative;
  width: 100%;
  max-width: 600px;
  max-height: 100%;
  max-height: calc(100dvh - 48px);
  display: flex;
  flex-direction: column;
  background: #fff;
  color: #181818;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.35);
  overflow: hidden;
  outline: none;
  opacity: 0;
  transform: translateY(24px) scale(0.98);
  transition: opacity 0.35s ease, transform 0.45s cubic-bezier(0.22, 1, 0.36, 1);
}
.apply-modal.is-open .apply-modal__panel {
  opacity: 1;
  transform: none;
}

.apply-modal__close {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 2;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  background: transparent;
  border: 0;
  color: #181818;
  cursor: pointer;
  transition: background-color 0.2s ease;
}
.apply-modal__close:hover {
  background: rgba(24, 24, 24, 0.08);
}
.apply-modal__close svg {
  width: 18px;
  height: 18px;
}

.apply-modal__scroll {
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  padding: 44px 40px 36px;
}

.apply-modal__eyebrow {
  margin: 0 0 10px;
  padding-right: 40px;
  font-size: 0.8rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(24, 24, 24, 0.6);
}
.apply-modal__title {
  margin: 0 0 12px;
  padding-right: 32px;
  font-family: Marlidedisplay, Arial, sans-serif;
  font-size: 2.6rem;
  font-weight: 400;
  line-height: 1;
}
.apply-modal__intro {
  margin: 0 0 28px;
  font-size: 0.95rem;
  line-height: 1.5;
  color: rgba(24, 24, 24, 0.7);
}

.apply-form {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px 16px;
  margin: 0;
}
.apply-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}
.apply-field--full {
  grid-column: 1 / -1;
}
.apply-field label {
  font-size: 0.8rem;
  letter-spacing: 0.04em;
  color: rgba(24, 24, 24, 0.75);
}
.apply-field label .apply-opt {
  color: rgba(24, 24, 24, 0.45);
}
.apply-field input,
.apply-field textarea {
  width: 100%;
  margin: 0;
  padding: 12px 14px;
  font: inherit;
  font-size: 16px; /* 16px stops iOS Safari zooming the page on focus */
  line-height: 1.3;
  color: #181818;
  background: #f6f4f4;
  border: 1px solid transparent;
  outline: none;
  -webkit-appearance: none;
  appearance: none;
  transition: border-color 0.2s ease, background-color 0.2s ease, box-shadow 0.2s ease;
}
.apply-field textarea {
  min-height: 130px;
  resize: vertical;
}
.apply-field input::placeholder,
.apply-field textarea::placeholder {
  color: rgba(24, 24, 24, 0.38);
}
.apply-field input:focus,
.apply-field textarea:focus {
  background: #fff;
  border-color: #181818;
  box-shadow: none;
}
.apply-field.is-invalid input,
.apply-field.is-invalid textarea {
  border-color: #c0392b;
  background: #fff;
}
.apply-field__error {
  display: none;
  font-size: 0.78rem;
  color: #c0392b;
}
.apply-field.is-invalid .apply-field__error {
  display: block;
}

/* honeypot — real visitors never see this */
.apply-hp {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.apply-form__error {
  grid-column: 1 / -1;
  margin: 0;
  padding: 12px 14px;
  font-size: 0.9rem;
  line-height: 1.4;
  color: #8e2a1f;
  background: rgba(192, 57, 43, 0.08);
  border: 1px solid rgba(192, 57, 43, 0.4);
}
.apply-form__error[hidden] {
  display: none;
}

.apply-form__submit {
  grid-column: 1 / -1;
  width: 100%;
  margin-top: 4px;
  cursor: pointer;
}
.apply-form__submit:disabled {
  opacity: 0.6;
  cursor: progress;
}

/* ---- success state ---- */
.apply-done {
  display: none;
  text-align: center;
  padding: 24px 0 8px;
}
.apply-modal.is-done .apply-form,
.apply-modal.is-done .apply-modal__head {
  display: none;
}
.apply-modal.is-done .apply-done {
  display: block;
  animation: apply-fade-up 0.5s ease both;
}
.apply-done__title {
  margin: 0 0 12px;
  font-family: Marlidedisplay, Arial, sans-serif;
  font-size: 2.2rem;
  font-weight: 400;
  line-height: 1;
}
.apply-done__text {
  margin: 0 auto 28px;
  max-width: 400px;
  font-size: 0.95rem;
  line-height: 1.5;
  color: rgba(24, 24, 24, 0.7);
}
.apply-done .dark-btn {
  cursor: pointer;
}

@keyframes apply-fade-up {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: none; }
}

/* ---- tablet / phone ---- */
@media screen and (max-width: 767px) {
  .apply-modal {
    padding: 12px;
    align-items: flex-end; /* sheet-style on phones */
  }
  .apply-modal__panel {
    max-height: calc(100dvh - 24px);
    transform: translateY(40px);
  }
  .apply-modal__scroll {
    padding: 40px 22px 26px;
  }
  .apply-modal__title {
    font-size: 2.1rem;
  }
  .apply-form {
    grid-template-columns: 1fr;
    gap: 16px;
  }
}
@media screen and (max-width: 479px) {
  .apply-modal {
    padding: 0;
  }
  .apply-modal__panel {
    max-height: 94vh;
    max-height: 94dvh;
  }
  .apply-modal__scroll {
    padding: 40px 18px calc(22px + env(safe-area-inset-bottom));
  }
}
/* thank-you state on phones: a centered card with breathing room, not an edge-to-edge sheet */
@media screen and (max-width: 767px) {
  .apply-modal.is-done {
    align-items: center;
    padding: 20px;
  }
  .apply-modal.is-done .apply-modal__panel {
    max-height: calc(100dvh - 40px);
    transform: none;
  }
  .apply-modal.is-done .apply-modal__scroll {
    padding: 48px 22px 36px;
  }
  .apply-done {
    padding: 8px 0;
  }
  .apply-done__title {
    font-size: 1.9rem;
  }
  .apply-done__text {
    margin-bottom: 24px;
  }
}
/* short landscape phones */
@media screen and (max-height: 520px) {
  .apply-modal__scroll {
    padding-top: 36px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .apply-modal,
  .apply-modal__backdrop,
  .apply-modal__panel {
    transition-duration: 0.01s;
  }
  .apply-modal__panel {
    transform: none;
  }
  .apply-modal.is-done .apply-done {
    animation: none;
  }
}
