/* =========================================================
   SITE.CSS (Mobile-first)
   Goals:
   - Mobile-first layout
   - Overlays are PINNED TO THE IMAGE (not the viewport)
   - No scrollbar inside the bottom overlay (overlay grows to fit content)
   - Consent checkbox + text alignment is consistent (your exact HTML)
   ========================================================= */

/* =========================
   1) Global reset + mobile safety
   ========================= */
* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  overflow-x: hidden;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  padding: 10px;
  min-height: 100dvh;
  display: flex;
  justify-content: center;
  align-items: center;
  flex-direction: column;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  background: radial-gradient(circle at top, #facc15 0%, #0f172a 55%);
  color: #e5e7eb;
  max-width: 100%;
}

/* iPhone notch / safe-area padding */
@supports (padding: max(0px)) {
  body {
    padding-left: max(14px, env(safe-area-inset-left));
    padding-right: max(14px, env(safe-area-inset-right));
  }
}

/* Mobile input: finger-friendly + prevents iOS zoom */
select,
button,
input {
  font-size: 16px;
}

.wrapper {
  text-align: center;
  width: 100%;
  padding-bottom: 0; /* overlays are on the image, so no page padding needed */
}

/* =========================
   2) Card / image (the anchor for overlays)
   ========================= */
.logo-form {
  position: relative; /* IMPORTANT: overlays anchor to this */
  width: 100%;
  max-width: 520px;
  margin: 0 auto;
  overflow: visible;
}

/* Mobile: keep a stable hero height so overlays don't crush the logo */
.logo-form img {
  display: block;
  width: 100%;
  height: 78dvh;
  max-height: 78dvh;
  object-fit: contain;
  border-radius: 18px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.6);
}

/* =========================
   3) Top title badge (pinned to image)
   ========================= */
.overlay1 {
  position: absolute;
  top: 10px;
  left: 10px;
  right: 10px;
  z-index: 10;

  padding: 8px 10px;
  border-radius: 14px;
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(8px);

  display: flex;
  justify-content: center;
  align-items: center;
}

.top-link {
  font-family: "Courgette";
  font-size: 1.15rem; /* 🔥 bigger */
  font-weight: 700; /* 🔥 stronger */
  color: #1d2f28;
  text-decoration: none;
  line-height: 1.2; /* more breathing room */
  text-align: center; /* true centering */
  display: block; /* ensures full-width centering */
  width: 100%;
  letter-spacing: 0.02em; /* subtle polish */
}

.top-link:hover {
  text-decoration: underline;
}

/* =========================
   4) Bottom overlay (pinned to image)
   Key change:
   - NO max-height
   - NO overflow:auto
   => removes the scrollbar, overlay grows to content
   ========================= */
.overlay {
  position: absolute; /* pinned to .logo-form (image card) */
  left: 10px;
  right: 10px;
  bottom: 10px;
  z-index: 11;

  padding: 10px 12px; /* slightly roomier so it feels taller */
  border-radius: 14px;
  background: rgba(2, 6, 23, 0.88);
  backdrop-filter: blur(10px);

  display: flex;
  flex-direction: column;
  gap: 8px;

  /* ✅ remove scroll behavior */
  max-height: none;
  overflow: visible;
}

/* Participants counter line */
.counter {
  font-size: 0.82rem;
  font-weight: 800;
  text-align: center;
  line-height: 1.15;
  margin: 0;
}
.counter span {
  margin-left: 0.15rem;
}

/* Select + button stack on mobile */
.field-group {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  align-items: stretch;
}
.field-group select,
.field-group button {
  width: 100%;
}

#race {
  width: 100%;
  padding: 6px 8px;
  border-radius: 10px;
  border: 2px solid #4b5563;
  background: #020617;
  color: #e5e7eb;
  outline: none;
}
#race:focus {
  border-color: #38bdf8;
}

#recordBtn {
  width: 100%;
  padding: 8px 10px;
  border-radius: 10px;
  border: none;
  background: #fdca17;
  color: #022c22;
  font-weight: 800;
  cursor: pointer;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
}
#recordBtn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* =========================
   5) Consent (your EXACT HTML structure)
   HTML is:
   <label class="consent">
     <input ...>
     <span>text <button>ⓘ</button></span>
   </label>
   ========================= */
.consent-wrap {
  margin-top: 0.6rem;
  text-align: left;
  font-size: 0.85rem;
}

/* ✅ Use GRID to avoid baseline weirdness */
label.consent {
  display: grid;
  grid-template-columns: 18px 1fr;
  column-gap: 10px;
  align-items: start;
  line-height: 1.25;
  cursor: pointer;
}

/* Checkbox column */
label.consent > input[type="checkbox"] {
  margin: 0;
  width: 18px;
  height: 18px;
  align-self: start;
  transform: translateY(2px); /* tiny optical alignment */
}

/* Text column */
label.consent > span {
  display: inline; /* keep text + info button on same line */
}

/* Info button inside consent text */
#infoBtn {
  margin-left: 0.35rem;
  font-weight: 700;
  background: none;
  border: none;
  cursor: pointer;
  color: #facc15;
  padding: 0;
  vertical-align: baseline;
}
#infoBtn:focus {
  outline: 2px solid rgba(250, 204, 21, 0.6);
  outline-offset: 3px;
  border-radius: 6px;
}

/* =========================
   6) Messages + links
   ========================= */
.error {
  margin-top: 0.75rem;
  min-height: 1rem;
  font-size: 0.95rem;
  color: #fecaca;
  text-align: center;
}

.links {
  margin-top: 0.6rem;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.4rem;
  font-size: 0.75rem;
  text-align: center;
  line-height: 1.6;
  padding: 0.25rem 0;
}
.links a {
  color: #f97316;
  font-weight: 600;
  text-decoration: none;
  padding: 0.15rem 0.35rem;
  border-radius: 12px;
  line-height: 1.1;
}
.links a:hover {
  text-decoration: underline;
}

/* =========================
   7) Modal
   ========================= */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(2, 6, 23, 0.75);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  z-index: 9999;
}
.modal-backdrop.is-open {
  display: flex;
}

.modal {
  width: 100%;
  max-width: 520px;
  background: rgba(2, 6, 23, 0.98);
  border: 1px solid #1f2937;
  border-radius: 16px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.6);
  color: #e5e7eb;
  overflow: hidden;

  max-height: 85vh;
  display: flex;
  flex-direction: column;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.9rem 1rem;
  border-bottom: 1px solid #1f2937;
  flex: 0 0 auto;
}

.modal-title {
  font-weight: 800;
  font-size: 1rem;
  margin: 0;
}

.modal-close {
  background: none;
  border: none;
  color: #e5e7eb;
  cursor: pointer;
  font-size: 1.25rem;
  line-height: 1;
  padding: 0.25rem 0.4rem;
  border-radius: 10px;
}
.modal-close:hover {
  background: rgba(148, 163, 184, 0.12);
}
.modal-close:focus {
  outline: 2px solid rgba(250, 204, 21, 0.6);
  outline-offset: 2px;
}

.modal-body {
  padding: 1rem;
  font-size: 0.95rem;
  line-height: 1.35;
  overflow: auto;
  flex: 1 1 auto;
}
.modal-body ul {
  margin: 0.35rem 0 0.8rem 1.1rem;
  padding: 0;
}
.modal-body strong {
  color: #facc15;
}

.modal-footer {
  padding: 0.85rem 1rem;
  border-top: 1px solid #1f2937;
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  flex: 0 0 auto;
}

.modal-ok {
  border: none;
  background: #facc15;
  color: #022c22;
  font-weight: 800;
  border-radius: 12px;
  padding: 0.6rem 0.9rem;
  cursor: pointer;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.modal-ok:focus {
  outline: 2px solid rgba(250, 204, 21, 0.6);
  outline-offset: 3px;
}

/* =========================
   8) Small device tweaks
   ========================= */
@media (max-width: 600px) {
  .top-link {
    font-size: 1.35rem;
    line-height: 1.15;
    display: inline-block;
  }
  .consent-wrap {
    font-size: 0.78rem;
  }
}

/* Very small / short screens: shrink image a bit */
@media (max-width: 420px), (max-height: 740px) {
  .logo-form img {
    height: 85dvh;
    max-height: 85dvh;
  }
  .top-link {
    font-size: 0.92rem;
  }

  .modal {
    max-height: 80svh;
  }
  .modal-title {
    font-size: 0.95rem;
  }
  .modal-body {
    font-size: 0.9rem;
  }
}

/* =========================
   9) Desktop enhancements
   ========================= */
@media (min-width: 700px) {
  body {
    padding: 24px;
  }

  .logo-form {
    max-width: 820px;
  }

  .logo-form img {
    height: auto; /* desktop: natural sizing */
    max-height: none;
    border-radius: 24px;
  }

  .overlay1 {
    top: 0;
    left: 0;
    right: 0;
    padding: 1.2rem 1.25rem;
    min-height: 110px;
    border-radius: 0 0 24px 24px;
    background: transparent;
    backdrop-filter: blur(4px);
  }

  .top-link {
    font-size: 2.2rem;
    padding: 0.25rem 0.5rem;
  }

  /* Desktop bottom overlay: horizontal layout */
  .overlay {
    left: 0;
    right: 0;
    bottom: 0;

    border-radius: 0 0 24px 24px;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;

    padding: 0.75rem 1rem;
    background: rgba(15, 23, 42, 0.92);
    backdrop-filter: blur(4px);
  }

  .counter {
    font-size: 1.25rem;
    text-align: left;
  }

  .field-group {
    flex-direction: row;
    align-items: center;
    gap: 0.5rem;
  }

  #race {
    width: 260px;
    border-radius: 16px;
    padding: 0.75rem 1rem;
  }

  #recordBtn {
    width: auto;
    border-radius: 16px;
    padding: 0.9rem 1.2rem;
    font-size: 16px;
    letter-spacing: 0.06em;
  }
}
