/*
 * Agevow — the gate's look (ROADMAP §S-GATE, §S-A11Y).
 *
 * The gate shows only while <html> carries the class agevow-locked, which the head
 * lock sets before the page paints. The page underneath is fully loaded and never
 * moves: the cover and the dialog are position: fixed, so nothing shifts (layout
 * shift 0). The colours are custom properties the plugin adds inline from the
 * owner's settings (Gate::looks_css()); the defaults read at well over 4.5:1.
 */

/* The stages inside the dialog that are not showing. */
.agevow-gate [hidden] {
  display: none !important;
}

/* The page behind does not scroll while it is covered. */
html.agevow-locked,
html.agevow-locked body {
  overflow: hidden !important;
}

/* The cover: on the root element, so it is there at the first paint, before the
   dialog's own markup (at the end of the page) has arrived. */
html.agevow-locked::before {
  content: "";
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 2147483646;
  background: var(--agevow-cover, #ffffff);
}

/* The dialog, shown by the lock (it is hidden in the HTML until then). */
html.agevow-locked .agevow-gate,
html.agevow-locked .agevow-gate[hidden] {
  display: flex !important;
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 2147483647;
  box-sizing: border-box;
  align-items: center;
  justify-content: center;
  padding: 16px;
  padding: max(16px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) max(16px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

/* "Skip for logged-in users": no cover at all where the browser can tell at once.
   Two rules: a browser without :has() drops only the first. */
html.agevow-locked[data-agevow-skip="li"] body.logged-in .agevow-gate {
  display: none !important;
}

html.agevow-locked[data-agevow-skip="li"]:has(body.logged-in)::before {
  display: none !important;
}

.agevow-gate .agevow-card {
  box-sizing: border-box;
  width: 100%;
  max-width: 28rem;
  margin: auto;
  padding: 28px 24px;
  background: var(--agevow-bg, #ffffff);
  color: var(--agevow-text, #1d2327);
  font-family: inherit;
  font-size: 16px;
  line-height: 1.5;
  text-align: center;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

.agevow-gate.agevow-look-blur .agevow-card {
  border-radius: 16px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.25);
}

.agevow-gate .agevow-logo {
  margin: 0 0 16px;
}

.agevow-gate .agevow-logo img {
  display: inline-block;
  width: auto;
  height: auto;
  max-width: 160px;
  max-height: 80px;
}

.agevow-gate .agevow-title,
.agevow-section-ask .agevow-title {
  margin: 0 0 8px;
  padding: 0;
  color: inherit;
  font-family: inherit;
  font-size: 1.5em;
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: normal;
  text-transform: none;
}

.agevow-gate .agevow-title:focus,
.agevow-section-ask .agevow-title:focus {
  outline: none;
}

.agevow-gate .agevow-text,
.agevow-section-ask .agevow-text {
  margin: 0 0 16px;
  color: inherit;
  font-size: 1em;
}

.agevow-gate .agevow-text:focus,
.agevow-section-ask .agevow-text:focus {
  outline: none;
}

/* Buttons: at least 44 px tall (48 here), whatever the theme does to buttons. */
.agevow-gate .agevow-button,
.agevow-section-ask .agevow-button {
  display: block;
  box-sizing: border-box;
  width: 100%;
  min-height: 48px;
  margin: 12px 0 0;
  padding: 12px 16px;
  border: 2px solid var(--agevow-button, #1d2327);
  border-radius: 10px;
  background: var(--agevow-button, #1d2327);
  color: var(--agevow-button-text, #ffffff);
  font-family: inherit;
  font-size: 17px;
  font-weight: 600;
  line-height: 1.2;
  text-align: center;
  text-decoration: none;
  text-transform: none;
  letter-spacing: normal;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
  box-shadow: none;
}

.agevow-gate .agevow-button.agevow-secondary,
.agevow-section-ask .agevow-button.agevow-secondary {
  border-color: currentColor;
  background: transparent;
  color: var(--agevow-text, #1d2327);
}

.agevow-gate .agevow-button:hover,
.agevow-section-ask .agevow-button:hover {
  filter: brightness(1.12);
}

.agevow-gate .agevow-button:focus-visible,
.agevow-section-ask .agevow-button:focus-visible,
.agevow-gate input:focus-visible,
.agevow-section-ask input:focus-visible {
  outline: 3px solid var(--agevow-text, #1d2327);
  outline-offset: 2px;
}

/* The date of birth: three number fields side by side, 16 px text (no zoom on a
   phone), fitting a 320 px wide screen. */
.agevow-gate .agevow-fieldset,
.agevow-section-ask .agevow-fieldset {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.agevow-gate .agevow-legend,
.agevow-section-ask .agevow-legend {
  display: block;
  width: 100%;
  margin: 0 0 8px;
  padding: 0;
  color: inherit;
  font-weight: 600;
}

.agevow-gate .agevow-row,
.agevow-section-ask .agevow-row {
  display: flex;
  justify-content: center;
  margin: 0 -4px;
}

.agevow-gate .agevow-field,
.agevow-section-ask .agevow-field {
  flex: 0 1 auto;
  margin: 0 4px;
  /* "start", never "left": on a right-to-left site the labels sit on the right (P13). */
  text-align: start;
}

.agevow-gate .agevow-field label,
.agevow-section-ask .agevow-field label {
  display: block;
  margin: 0 0 4px;
  color: inherit;
  font-size: 14px;
  font-weight: 400;
}

.agevow-gate .agevow-field input,
.agevow-section-ask .agevow-field input {
  display: block;
  box-sizing: border-box;
  width: 3.75em;
  max-width: 100%;
  min-height: 48px;
  margin: 0;
  padding: 10px 8px;
  border: 2px solid #50575e;
  border-radius: 8px;
  background: #ffffff;
  color: #1d2327;
  font-family: inherit;
  font-size: 16px;
  line-height: 1.2;
  text-align: center;
  box-shadow: none;
}

.agevow-gate .agevow-field-year input,
.agevow-section-ask .agevow-field-year input {
  width: 5.25em;
}

.agevow-gate .agevow-field input[aria-invalid="true"],
.agevow-section-ask .agevow-field input[aria-invalid="true"] {
  border-color: #d63638;
}

.agevow-gate .agevow-hint,
.agevow-section-ask .agevow-hint {
  margin: 12px 0 0;
  color: inherit;
  font-size: 14px;
}

.agevow-gate .agevow-error,
.agevow-section-ask .agevow-error {
  margin: 8px 0 0;
  color: inherit;
  font-weight: 600;
  text-align: start;
}

.agevow-gate .agevow-error:empty,
.agevow-section-ask .agevow-error:empty {
  display: none;
}

.agevow-gate .agevow-error:not(:empty),
.agevow-section-ask .agevow-error:not(:empty) {
  /* The red bar at the start of the line, which is the right on a right-to-left site. */
  padding-inline-start: 10px;
  border-inline-start: 4px solid #d63638;
}

/* B2 — a section of a page behind the gate: the question in a card where the section
   is, the rest of the page untouched. The section's lock (public/js/section-lock.js)
   hides its content the moment it is read, and the gate script shows the question;
   with no script, a blocked one or one 4 s late, the content shows. */
.agevow-section-locked > .agevow-section-body {
  display: none !important;
}

.agevow-section-locked > .agevow-section-ask,
.agevow-section-locked > .agevow-section-ask[hidden] {
  display: block;
}

.agevow-section-body:focus {
  outline: none;
}

.agevow-section-ask [hidden] {
  display: none !important;
}

.agevow-section-ask {
  box-sizing: border-box;
  max-width: 32rem;
  margin: 1em 0;
  padding: 20px 16px;
  border: 2px solid var(--agevow-button, #1d2327);
  border-radius: 12px;
  background: var(--agevow-bg, #ffffff);
  color: var(--agevow-text, #1d2327);
  font-size: 16px;
  line-height: 1.5;
  text-align: center;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

.agevow-section-ask .agevow-title {
  font-size: 1.15em;
}

/* Without JavaScript the gate never locks the page: the page says who it is for. */
.agevow-noscript {
  box-sizing: border-box;
  padding: 10px 16px;
  background: #1d2327;
  color: #ffffff;
  font-size: 15px;
  line-height: 1.4;
  text-align: center;
}

/* A narrow phone (320 px): a little less padding, so the three fields fit. */
@media (max-width: 360px) {
  .agevow-gate .agevow-card {
    padding: 24px 16px;
  }
}

@media (prefers-reduced-motion: no-preference) {
  html.agevow-locked .agevow-card {
    animation: agevow-in 0.18s ease-out;
  }
}

@keyframes agevow-in {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
