/**
 * CHLAT Age Gate — modal styles (v2.3.7 visual spec, framework-agnostic).
 *
 * Two overlays, printed after the page content:
 *   .chlat-age-gate    dark whitelabel gate (regulated zones, persistent)
 *   .chlat-terms-gate  white terms gate (free zones, until "I AGREE")
 *
 * The content blur itself is a separate critical <style> emitted inline in
 * <head> by PHP (chlat_blur_style_html) — it must never live in this file.
 */

/* Scoped box-sizing reset (never global). */
#chlat-age-gate,
#chlat-age-gate *,
#chlat-terms-gate,
#chlat-terms-gate * {
  box-sizing: border-box;
}

.chlat-hidden {
  display: none !important;
}

/* Scroll lock while the terms gate is open. The whitelabel gate must NOT
   lock scrolling — the (blurred) site stays browsable behind it. */
html.chlat-terms-open,
body.chlat-terms-open {
  overflow: hidden !important;
}

@keyframes chlat-fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* ════════════════════════════════════════════════════════════
   Whitelabel gate — dark modal (regulated jurisdictions)
   ════════════════════════════════════════════════════════════ */

.chlat-age-gate {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 999999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  /* NO backdrop-filter here: the site must remain visible behind the
     overlay — its images are already blurred by the content blur. */
  background: rgba(0, 0, 0, 0.5);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    Helvetica, Arial, sans-serif;
  animation: chlat-fade-in 0.22s ease-out;
}

.chlat-age-gate__modal {
  background: #131820;
  border: 1px solid #232b36;
  border-radius: 12px;
  width: 100%;
  max-width: 580px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 32px 28px;
  text-align: center;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.55);
}

.chlat-age-gate__header {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-bottom: 16px;
}

.chlat-age-gate__icon {
  width: 32px;
  height: 32px;
  flex: 0 0 auto;
}

/* Title is a <div> on purpose — never an h1/h2 (SEO). */
.chlat-age-gate__title {
  font-size: 22px;
  font-weight: 800;
  text-transform: uppercase;
  color: #ffffff;
  line-height: 1.25;
}

.chlat-age-gate__message {
  margin: 0 0 24px;
  font-size: 17px;
  line-height: 1.55;
  color: #b9c2cf;
}

.chlat-age-gate__buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: center;
}

.chlat-age-gate__btn {
  flex: 1 1 auto;
  padding: 13px 30px;
  border: 0;
  border-radius: 8px;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.2;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  display: inline-block;
}

.chlat-age-gate__btn--primary {
  background: #4caf50;
  color: #ffffff;
}

.chlat-age-gate__btn--primary:hover,
.chlat-age-gate__btn--primary:focus {
  background: #3f9844;
  color: #ffffff;
}

.chlat-age-gate__btn--secondary {
  background: #2a323d;
  color: #ffffff;
}

.chlat-age-gate__btn--secondary:hover,
.chlat-age-gate__btn--secondary:focus {
  background: #353f4d;
  color: #ffffff;
}

.chlat-age-gate__footer {
  margin-top: 18px;
  font-size: 13px;
  color: #768290;
}

@media (max-width: 480px) {
  .chlat-age-gate__modal {
    padding: 26px 20px;
  }
  .chlat-age-gate__title {
    font-size: 19px;
  }
  .chlat-age-gate__icon {
    width: 26px;
    height: 26px;
  }
  .chlat-age-gate__message {
    font-size: 16px;
  }
  .chlat-age-gate__buttons {
    flex-direction: column;
  }
  .chlat-age-gate__btn {
    width: 100%;
    font-size: 20px;
    padding: 20px 28px;
  }
  .chlat-age-gate__footer {
    font-size: 12px;
  }
}

/* ════════════════════════════════════════════════════════════
   Terms gate — white modal (free jurisdictions)
   ════════════════════════════════════════════════════════════ */

.chlat-terms-gate {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 999999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(0, 0, 0, 0.5);
  /* Frosted backdrop: the site is hinted at but unreadable. */
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    Helvetica, Arial, sans-serif;
  animation: chlat-fade-in 0.22s ease-out;
}

.chlat-terms-gate__modal {
  display: flex;
  flex-direction: column;
  background: #ffffff;
  border-radius: 20px;
  width: 100%;
  max-width: 1008px;
  max-height: 92vh;
  padding: 32px 30px 18px;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.35);
}

/* Title is a <div> on purpose — never an h1/h2 (SEO). */
.chlat-terms-gate__title {
  font-size: 16px;
  font-weight: 700;
  text-align: center;
  color: #1a1a1a;
  margin: 0 0 20px;
}

/* The legal text scrolls inside its own box; the page behind is locked. */
.chlat-terms-gate__text {
  border: 1px solid #c9c9c9;
  padding: 10px 16px;
  font-size: 14px;
  line-height: 1.55;
  color: #555555;
  text-align: left;
  max-height: 32vh;
  min-height: 110px;
  overflow-y: auto;
}

.chlat-terms-gate__text p {
  margin: 0 0 12px;
}

.chlat-terms-gate__text p:last-child {
  margin-bottom: 0;
}

.chlat-terms-gate__text ul {
  margin: 0 0 12px;
  padding-left: 24px;
}

.chlat-terms-gate__text li {
  margin: 0 0 8px;
}

.chlat-terms-gate__text a {
  color: #0c6a93;
  text-decoration: underline;
}

.chlat-terms-gate__buttons {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 18px;
  margin-top: 28px;
}

.chlat-terms-gate__btn {
  min-width: 298px;
  padding: 12px 62px;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 700;
  line-height: 1.2;
  font-family: inherit;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  display: inline-block;
}

.chlat-terms-gate__btn--exit {
  background: transparent;
  border: 1px solid #6c6c6c;
  color: #6c6c6c;
}

.chlat-terms-gate__btn--agree {
  background: #f47321;
  border: 1px solid #cd5d26;
  color: #ffffff;
}

/* Desktop-only hover/focus (trap #7: mobile taps trigger :hover, and the
   site's global button:hover would repaint the CTA — hence !important). */
@media (min-width: 481px) {
  .chlat-terms-gate__btn--agree:hover,
  .chlat-terms-gate__btn--agree:focus {
    background: #f47321 !important;
    border-color: #a3400f !important;
    color: #ffffff !important;
  }
}

.chlat-terms-gate__badges {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin-top: 24px;
}

.chlat-terms-gate__badges img {
  height: 40px;
  width: auto;
  display: block;
}

@media (max-width: 480px) {
  .chlat-terms-gate__modal {
    padding: 14px 16px;
  }
  .chlat-terms-gate__title {
    font-size: 15px;
    margin-bottom: 10px;
  }
  .chlat-terms-gate__text {
    max-height: 30vh;
    font-size: 13.5px;
  }
  /* I AGREE on top at full width, Exit below as plain text. */
  .chlat-terms-gate__buttons {
    flex-direction: column-reverse;
    gap: 12px;
    margin-top: 14px;
  }
  .chlat-terms-gate__btn {
    min-width: 0;
    width: 100%;
    padding: 12px 20px;
  }
  .chlat-terms-gate__btn--agree {
    background: #0c6a93;
    border-color: #0c6a93;
  }
  /* A tap must keep the SAME blue — mobile pins its own hover/focus. */
  .chlat-terms-gate__btn--agree:hover,
  .chlat-terms-gate__btn--agree:focus,
  .chlat-terms-gate__btn--agree:active {
    background: #0c6a93 !important;
    border-color: #0c6a93 !important;
    color: #ffffff !important;
  }
  .chlat-terms-gate__btn--exit {
    background: none;
    border: none;
    color: #6c6c6c;
    font-size: 15px;
    font-weight: 400;
    padding: 8px;
  }
  .chlat-terms-gate__badges {
    margin-top: 12px;
  }
  .chlat-terms-gate__badges img {
    height: 34px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .chlat-age-gate,
  .chlat-terms-gate {
    animation: none;
  }
}
