/* =============================================================================
   section: age-gate (overlay a pantalla completa en TODAS las páginas)
   shopify: snippet propio megumi-age-gate en layout/theme.liquid (Vincent no lo trae)
   Diseño: prototipos/age-gate.html (v0.2). Textos: docs/legal/textos-age-gate.md § 1.
   ============================================================================= */

/* Mientras no se ha verificado la edad, el contenido existe en el HTML (sin cloaking)
   pero queda tapado e inerte. La clase la pone age-gate.js en <html> antes de pintar. */
html.ag-locked, html.ag-locked body { overflow: hidden; }
html.ag-locked body > :not(age-gate) { visibility: hidden; }

age-gate { display: block; }
/* Una sola columna centrada: el botón, la moderación y los enlaces legales caben sin scroll
   desde 320 × 568 (medido en 320×568, 375×667, 1280×720 y 1440×900). Fondo plano sumi (§ 1.1.8):
   el papel japonés solo volverá con un escaneo real. */
.ag {
  position: fixed; inset: 0; z-index: var(--z-age-gate);
  display: flex; flex-direction: column;
  overflow-y: auto; overscroll-behavior: contain;
  padding: max(12px, env(safe-area-inset-top)) 20px max(12px, env(safe-area-inset-bottom));
  background-color: var(--c-sumi);
  color: var(--c-washi);
  font: 400 var(--fs-text)/1.8 var(--ff-sans);
  text-align: center;
  transition: opacity 600ms var(--ease-out);
}
.ag.is-leaving { opacity: 0; }
.ag :focus-visible { outline: 2px solid var(--c-gold); outline-offset: 3px; }

/* margin: auto centra en vertical sin cortar el contenido si no cabe (sigue haciendo scroll) */
.ag__center { display: flex; justify-content: center; width: 100%; margin: auto 0; padding: 8px 0; }
.ag__col { width: 100%; max-width: 360px; animation: fade var(--dur-fade) var(--ease-out) 150ms both; }
.ag .logo { font-size: 2rem; color: var(--c-washi); }
.ag .hair { margin: 24px auto; background: var(--c-gold); opacity: .8; }
.ag__eyebrow { margin: 0 0 14px; color: var(--c-paper-soft); }
.ag__title { margin: 0 0 12px; font: 400 clamp(1.75rem, 1.4rem + 1.6vw, 2.5rem)/1.15 var(--ff-serif); letter-spacing: -.005em; text-wrap: balance; }
.ag__title:focus { outline: none; }
.ag__question { margin: 0 auto 28px; max-width: 34ch; text-wrap: balance; color: var(--c-paper-soft); font-size: .875rem; line-height: 1.7; }

/* Campos de una sola línea (§ 1.1.7) */
.ag__field { margin: 0 0 22px; text-align: left; }
.ag__field fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
.ag__label { display: block; margin: 0 0 4px; padding: 0; color: var(--c-paper-soft); }
.ag__line {
  display: block; width: 100%; height: 48px; padding: 0;
  border: 0; border-bottom: 1px solid rgba(247, 243, 234, .45); border-radius: 0;
  background: transparent; color: var(--c-washi);
  font: 400 1.0625rem/1 var(--ff-sans); letter-spacing: .02em;
  -webkit-appearance: none; appearance: none;
  transition: border-color var(--dur-base) var(--ease-out);
}
.ag__line::placeholder { color: rgba(247, 243, 234, .4); }
.ag__line:hover { border-bottom-color: rgba(247, 243, 234, .7); }
.ag__line:focus { outline: none; border-bottom-color: var(--c-gold); box-shadow: 0 1px 0 0 var(--c-gold); }
.ag__line[aria-invalid="true"] { border-bottom-color: var(--c-error-on-dark); }
select.ag__line {
  cursor: pointer; padding-right: 28px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%23B9B1A3' stroke-width='1'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 2px center;
}
select.ag__line option { color: #141210; background: #F7F3EA; }
.ag__line--year { height: 56px; font: 400 1.75rem/1 var(--ff-serif); letter-spacing: .12em; }
.ag__dob-extra { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; margin-top: 24px; }
.ag__dob-extra:not([hidden]) { animation: fade 600ms var(--ease-out); }
.ag__help { margin: 6px 0 0; font-size: .8125rem; line-height: 1.6; color: var(--c-paper-soft); }
.ag__error { margin: 10px 0 0; font-size: .8125rem; line-height: 1.5; color: var(--c-error-on-dark); }

.ag__check { display: flex; gap: 12px; align-items: center; justify-content: center; text-align: left; min-height: 44px; margin: -4px 0 12px; cursor: pointer; font-size: .8125rem; color: var(--c-paper-soft); }
.ag__check input {
  flex: none; width: 18px; height: 18px; margin: 0;
  border: 1px solid rgba(247, 243, 234, .6); border-radius: 0;
  -webkit-appearance: none; appearance: none; background: transparent; cursor: pointer;
  display: grid; place-content: center;
}
.ag__check input:checked { border-color: var(--c-gold); }
.ag__check input:checked::after { content: ""; width: 10px; height: 10px; background: var(--c-gold); }
@media (forced-colors: active) { .ag__check input { -webkit-appearance: auto; appearance: auto; } }

.ag__button {
  display: inline-flex; align-items: center; justify-content: center; width: 100%; min-height: 52px; padding: 0 32px;
  border: 1px solid rgba(247, 243, 234, .7); border-radius: 0; background: transparent; color: var(--c-washi); cursor: pointer;
  font: var(--fw-medium) var(--fs-caps)/1 var(--ff-sans); letter-spacing: var(--track-caps); text-transform: uppercase;
  transition: background-color var(--dur-base) var(--ease-out), color var(--dur-base) var(--ease-out);
}
.ag__button:hover { background: var(--c-washi); color: var(--c-sumi); border-color: var(--c-washi); }

/* Rechazo: solo texto, sin reintentar ni imágenes de producto */
.ag__denied p { margin: 0 auto; max-width: 32ch; color: var(--c-paper-soft); font-size: .875rem; }

/* Justo debajo del botón, dentro de la misma columna (no en un pie empujado abajo) */
.ag__foot { display: flex; flex-direction: column; align-items: center; gap: 4px; margin-top: 20px; }
.ag__responsible { margin: 0; font: italic 400 1.0625rem/1.4 var(--ff-serif); color: var(--c-washi); }
.ag__cookie { margin: 4px 0 0; max-width: 46ch; font-size: .75rem; line-height: 1.6; color: var(--c-paper-soft); }
.ag__links ul { display: flex; flex-wrap: wrap; justify-content: center; gap: 0 20px; margin: 0; padding: 0; list-style: none; color: var(--c-paper-soft); }
.ag__links a { display: inline-flex; align-items: center; min-height: 40px; text-decoration: underline; text-decoration-color: var(--c-hair-dark); text-underline-offset: 4px; }
.ag__links a:hover { color: var(--c-washi); }

@media (min-width: 750px) {
  .ag { padding: 16px 40px; }
  .ag .logo { font-size: 2.5rem; }
  .ag__col { max-width: 400px; }
}
/* Pantallas bajas (portátiles de 700–860 px de alto) */
@media (max-height: 860px) {
  .ag .logo { font-size: 1.75rem; }
  .ag .hair { margin: 12px auto; }
  .ag__eyebrow { margin-bottom: 8px; }
  .ag__title { font-size: 2rem; }
  .ag__question { margin-bottom: 16px; }
  .ag__field { margin-bottom: 12px; }
  .ag__line { height: 44px; }
  .ag__line--year { height: 48px; }
  .ag__foot { margin-top: 14px; }
}
/* Modo compacto: menos de 700 px de alto (320 × 568, 375 × 667…) */
@media (max-height: 699px) {
  .ag__center { padding: 0; }
  .ag .logo { font-size: 1.5rem; }
  .ag .hair { display: none; } /* filete decorativo: fuera para ganar alto */
  .ag .logo + .hair + * { margin-top: 8px; }
  .ag__eyebrow { display: none; } /* repite el nombre del diálogo; el título ya lo dice */
  .ag__title { margin-bottom: 6px; font-size: 1.5rem; }
  .ag__question { margin-bottom: 10px; font-size: .8125rem; line-height: 1.5; }
  .ag__field { margin-bottom: 10px; }
  .ag__label { margin-bottom: 0; }
  .ag__line { height: 40px; }
  .ag__line--year { height: 44px; font-size: 1.5rem; }
  .ag__help { margin-top: 4px; font-size: .75rem; line-height: 1.4; }
  .ag__check { min-height: 36px; margin: 0 0 8px; }
  .ag__button { min-height: 46px; }
  .ag__foot { margin-top: 10px; gap: 0; }
  .ag__responsible { font-size: 1rem; }
  .ag__links ul { gap: 0 10px; letter-spacing: .14em; }
  .ag__links a { min-height: 32px; }
  .ag__cookie { font-size: .6875rem; line-height: 1.5; }
}
