/* ============================================
   Base Layout
   ============================================ */

*, *::before, *::after {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  overflow-x: hidden;
  background-color: hsl(32 37% 94%);
  font-family: Arial, Helvetica, sans-serif;
}

.container {
  position: relative;
  width: 100%;
  margin: 0 auto;
  padding: 0;
  overflow: hidden;
  background-color: #000;
}

/* ============================================
   Background Image
   ============================================ */

.image {
  display: block;
  width: 100%;
  max-width: 100%;
  height: auto;
  max-height: 100vh;
  object-fit: cover;
  object-position: center !important;
  transition: opacity 0.5s ease;
  backface-visibility: hidden;
  opacity: 1;
}

.container picture img.image {
  object-position: center !important;
}

.bgimg-1,
.container {
  background-position: center !important;
}

/* ============================================
   Hover Text (Desktop)
   ============================================ */

.middle {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 85%;
  text-align: center;
  font-family: "Times New Roman", Times, serif;
  font-size: 1.35rem;
  font-weight: 600;
  line-height: 1.6;
  opacity: 0;
  transition: opacity 0.5s ease;
  color: #ffffff;
  background: rgba(0, 0, 0, 0.55);
  padding: 30px;
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

/* Reveal text when hovering the open-button OR the text block itself */
.container:has(.open-button:hover) .middle,
.middle:hover {
  opacity: 1;
}

.middle h2 {
  font-size: 1.6rem;
  margin-bottom: 10px;
}

/* ============================================
   Button (Desktop)
   ============================================ */

.open-button {
  background-color: #555;
  color: white;
  padding: 16px 20px;
  border: none;
  cursor: pointer;
  opacity: 0.8;
  position: absolute;
  bottom: 30px;
  right: 30px;
  width: auto;
  font-size: 1rem;
  border-radius: 6px;
  z-index: 99;
  transition: opacity 0.3s ease;
}

.open-button:hover {
  opacity: 1;
}

/* ============================================
   Popup Form
   ============================================ */

.form-popup {
  display: none;
  position: fixed;
  bottom: 0;
  right: 15px;
  border: 3px solid #f1f1f1;
  background: #fff;
  padding: 20px;
  max-width: 400px;
  box-shadow: 0 4px 8px rgba(0,0,0,0.1);
  z-index: 1000;
}

.form-container {
  max-width: 400px;
  padding: 10px;
}

.form-container input[type=text],
.form-container input[type=password],
.form-container input[type=email] {
  width: 100%;
  padding: 15px;
  margin: 5px 0 22px 0;
  border: none;
  background: #f1f1f1;
}

.form-container input:focus {
  background-color: #ddd;
  outline: none;
}

.form-container .btn {
  background-color: #04AA6D;
  color: white;
  padding: 16px 20px;
  border: none;
  cursor: pointer;
  width: 100%;
  margin-bottom: 10px;
  opacity: 0.8;
}

.form-container .cancel {
  background-color: grey;
}

.form-container .btn:hover {
  opacity: 1;
}

/* ============================================
   Honeypot (hidden anti-spam field)
   ============================================ */

.honeypot {
  display: none !important;
}

/* ============================================
   reCAPTCHA spacing & responsive scaling
   ============================================ */

/* Wrapper clips the scaled captcha so it doesn't overflow */
.g-recaptcha-wrapper {
  width: 100%;
  overflow: hidden;
  min-height: 78px;      /* Reserves height so layout doesn't jump */
  margin-bottom: 10px;
}

.g-recaptcha {
  transform-origin: 0 0;
}

/* Stepped scaling for narrow screens */
@media screen and (max-width: 400px) {
  .g-recaptcha { transform: scale(0.85); }
}

@media screen and (max-width: 350px) {
  .g-recaptcha { transform: scale(0.75); }
}

@media screen and (max-width: 310px) {
  .g-recaptcha { transform: scale(0.65); }
}

/* ============================================
   TABLET (601px - 1024px)
   ============================================ */

@media screen and (min-width: 601px) and (max-width: 1024px) {

  .container {
    position: relative;
    min-height: 100vh;
    width: 100%;
    margin: 0;
    padding: 0;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .image {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: 0;
  }

  .middle {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 80%;
    text-align: center;
    font-family: "Times New Roman", Times, serif;
    font-size: 1.6rem;
    line-height: 1.7;
    opacity: 0;
    transition: opacity 0.5s ease;
    color: #fff;
  }

  .middle h2 {
    font-size: 1.6rem;
  }

  .open-button {
    position: absolute;
    z-index: 2;
    bottom: 120px;
    left: 50%;
    transform: translateX(-50%);
    padding: 20px 40px;
    font-size: 2rem;
    width: 80%;
    max-width: 400px;
    border-radius: 12px;
  }

  .form-popup {
    left: 0;
    right: 0;
    bottom: 0;
    max-width: 100%;
    width: 100%;
    border-radius: 12px 12px 0 0;
  }

  .form-container input[type=email],
  .form-container .btn {
    font-size: 1.4rem;
    padding: 14px;
  }

  /* Slightly more breathing room for the captcha inside the larger form */
  .g-recaptcha-wrapper {
    margin-bottom: 12px;
  }
}

/* ============================================
   MOBILE (max-width: 600px)
   ============================================ */

@media screen and (max-width: 600px) {

  /* Container set up as a centered phone canvas */
  .container {
    position: relative;
    width: 100%;
    aspect-ratio: 9 / 16;
    margin: 0 auto;
    border-radius: 36px;
    overflow: hidden;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.25);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 24px 16px;
    box-sizing: border-box;
  }

  /* Force the picture & child image to act as a full background layer */
  .container picture {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
  }

  .container picture img.image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    display: block;
  }

  /* Overlay content positioning & readability */
  .middle {
    position: relative;
    z-index: 1;
    background: rgba(0, 0, 0, 0.5);
    padding: 16px;
    border-radius: 12px;
    color: #ffffff;
    backdrop-filter: blur(4px);
  }

  .middle h2 {
    margin: 0;
    font-size: 1rem;
    line-height: 1.4;
    text-align: center;
  }

  /* Call to Action Button */
  .open-button {
    position: relative;
    z-index: 1;
    padding: 12px 20px;
    font-weight: bold;
    border: none;
    border-radius: 20px;
    background-color: #007bff;
    color: #ffffff;
    cursor: pointer;
    /* Undo desktop absolute positioning */
    bottom: auto;
    right: auto;
  }

  /* Modal form popup overlay — anchored to the viewport, not the canvas,
     so the form (with captcha) can never be clipped by the aspect-ratio box */
  .form-popup {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
    max-width: 100%;
    border: none;
    border-radius: 0;
    z-index: 2;
    background-color: rgba(0, 0, 0, 0.7);
    box-sizing: border-box;
    padding: 20px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  .form-container {
    background-color: #ffffff;
    padding: 20px;
    border-radius: 16px;
    color: #333333;
    max-width: 100%;
  }

  
  /* ============================================
   reCAPTCHA spacing & responsive scaling
   ============================================ */

  .g-recaptcha-wrapper {
    width: 100%;
    overflow: hidden;
    min-height: 78px;      /* Standard widget height */
    margin-bottom: 14px;
  }

  .g-recaptcha {
    transform-origin: 0 0;
  }

  /* Only scale on genuinely tiny screens */
  @media screen and (max-width: 360px) {
    .g-recaptcha { transform: scale(0.85); }
  }

  @media screen and (max-width: 320px) {
    .g-recaptcha { transform: scale(0.75); }
  }
}
