/*
 * Age gate.
 *
 * Colours and type prefer the theme's semantic tokens, then the active brand's
 * values (--age-gate-brand-*, printed by the plugin), then neutral system
 * colours, so the gate works under any theme.
 *
 * Hidden unless the head script adds age-gate-open to <html>, so a visitor
 * without JavaScript, or with a valid cookie, never sees it.
 */
.age-gate {
  --age-gate-text: var(--color-text, var(--age-gate-brand-ink, CanvasText));
  --age-gate-surface: var(--color-surface, var(--age-gate-brand-surface, Canvas));
  --age-gate-border: var(
    --color-border,
    var(--age-gate-brand-border, color-mix(in srgb, CanvasText 14%, Canvas))
  );
  --age-gate-structure: var(--color-structure, var(--age-gate-brand-structure, CanvasText));
  --age-gate-accent: var(--color-accent, var(--age-gate-brand-accent, CanvasText));
  --age-gate-accent-text: var(--color-accent-text, var(--age-gate-brand-accent-text, CanvasText));
  --age-gate-text-muted: var(
    --color-text-muted,
    color-mix(in srgb, var(--age-gate-text) 74%, var(--age-gate-surface))
  );
  --age-gate-control-border: var(
    --color-control-border,
    color-mix(in srgb, var(--age-gate-text) 52%, var(--age-gate-surface))
  );
  --age-gate-font-sans: var(--font-sans, var(--age-gate-brand-font-sans, system-ui), system-ui, sans-serif);
  --age-gate-font-mono: var(--font-mono, var(--age-gate-brand-font-mono, ui-monospace), ui-monospace, monospace);
  --age-gate-radius-panel: var(--radius-panel, 8px);
  --age-gate-radius-control: var(--radius-control, 6px);
  --age-gate-ease-out: cubic-bezier(0.16, 1, 0.3, 1);

  display: none;
}

html.age-gate-open,
html.age-gate-open body {
  overflow: hidden;
}

html.age-gate-open .age-gate {
  position: fixed;
  inset: 0;
  z-index: 2147483000;
  display: block;
  overflow-y: auto;
  overscroll-behavior: contain;
  color: var(--age-gate-text);
  font-family: var(--age-gate-font-sans);
  text-align: center;
}

.age-gate [hidden] {
  display: none !important;
}

.age-gate-veil {
  position: fixed;
  inset: 0;
  background: color-mix(in srgb, var(--age-gate-text) 34%, transparent);
  backdrop-filter: blur(10px);
  animation: age-gate-veil-in 420ms ease-out both;
}

.age-gate-frame {
  position: relative;
  display: grid;
  place-items: center;
  box-sizing: border-box;
  min-height: 100%;
  padding: 24px 16px;
}

.age-gate .age-gate-card {
  position: relative;
  box-sizing: border-box;
  width: 100%;
  max-width: 440px;
  margin: 0;
  padding: 40px 36px 30px;
  border: 1px solid var(--age-gate-border);
  border-radius: var(--age-gate-radius-panel);
  background: var(--age-gate-surface);
  box-shadow:
    0 24px 64px -16px color-mix(in srgb, var(--age-gate-text) 38%, transparent),
    0 2px 8px color-mix(in srgb, var(--age-gate-text) 10%, transparent);
  animation: age-gate-card-in 560ms var(--age-gate-ease-out) 80ms both;
}

/* Logo */
.age-gate-logo {
  display: flex;
  justify-content: center;
  margin: 0 0 36px;
}

.age-gate .age-gate-logo-svg {
  display: block;
  width: auto;
  max-width: 100%;
  height: 37px;
  overflow: visible;
}

.age-gate .age-gate-logo-rule,
.age-gate .age-gate-logo-tick {
  transform-box: fill-box;
  transform-origin: center;
}

.age-gate .age-gate-logo-tick {
  animation: age-gate-grow-y 360ms var(--age-gate-ease-out) 260ms both;
}

.age-gate .age-gate-logo-rule {
  animation: age-gate-grow-x 700ms var(--age-gate-ease-out) 380ms both;
}

.age-gate .age-gate-logo-text {
  font-family: var(--age-gate-font-sans);
  font-size: 1.5rem;
  font-weight: 600;
  line-height: 1;
  letter-spacing: 0.16em;
}

/* Copy */
.age-gate .age-gate-eyebrow {
  margin: 0 0 12px;
  color: var(--age-gate-accent-text);
  font-family: var(--age-gate-font-mono);
  font-size: 0.6875rem;
  font-weight: 500;
  line-height: 1.3;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.age-gate .age-gate-heading {
  margin: 0 0 10px;
  padding: 0;
  color: var(--age-gate-text);
  font-family: var(--age-gate-font-sans);
  font-size: 1.75rem;
  font-weight: 600;
  line-height: 1.18;
  letter-spacing: -0.02em;
  text-transform: none;
  text-wrap: balance;
}

/* Focus moves to the card, then to each view's heading, only so a screen
   reader announces them; neither is a control, so neither shows a ring. */
.age-gate .age-gate-card:focus,
.age-gate .age-gate-heading:focus {
  outline: none;
}

.age-gate .age-gate-text {
  max-width: 18.5rem;
  margin: 0 auto;
  color: var(--age-gate-text-muted);
  font-family: var(--age-gate-font-sans);
  font-size: 0.9375rem;
  font-weight: 400;
  line-height: 1.55;
  text-wrap: pretty;
}

/* The question's text is set in even lines, as in the approved mockup. */
.age-gate [data-age-gate-view="ask"] .age-gate-text {
  text-wrap: balance;
}

/* Buttons */
.age-gate .age-gate-actions {
  display: flex;
  gap: 12px;
  margin: 28px 0 0;
}

.age-gate .age-gate-actions-single {
  justify-content: center;
}

.age-gate .age-gate-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  width: auto;
  min-height: 48px;
  margin: 0;
  padding: 10px 24px;
  border: 1px solid transparent;
  border-radius: var(--age-gate-radius-control);
  box-shadow: none;
  font-family: var(--age-gate-font-sans);
  font-size: 1rem;
  font-weight: 500;
  line-height: 1.2;
  letter-spacing: 0;
  text-decoration: none;
  text-transform: none;
  cursor: pointer;
  appearance: none;
  transition:
    background-color 160ms ease,
    border-color 160ms ease;
}

.age-gate .age-gate-button:focus-visible {
  outline: 2px solid var(--age-gate-accent);
  outline-offset: 2px;
}

.age-gate .age-gate-button-primary {
  flex: 1 1 auto;
  border-color: var(--age-gate-structure);
  background: var(--age-gate-structure);
  color: var(--age-gate-surface);
}

.age-gate .age-gate-button-primary:hover {
  border-color: color-mix(in srgb, var(--age-gate-structure) 86%, var(--age-gate-text));
  background: color-mix(in srgb, var(--age-gate-structure) 86%, var(--age-gate-text));
}

.age-gate .age-gate-button-secondary {
  flex: 0 0 auto;
  border-color: var(--age-gate-control-border);
  background: var(--age-gate-surface);
  color: var(--age-gate-text);
}

.age-gate .age-gate-button-secondary:hover {
  border-color: var(--age-gate-text);
}

/* Fine print, under a hairline rule */
.age-gate .age-gate-fine {
  margin: 20px 0 0;
  padding: 16px 0 0;
  border-top: 1px solid var(--age-gate-border);
}

.age-gate .age-gate-fine-text {
  max-width: 19rem;
  margin: 0 auto;
  color: var(--age-gate-text-muted);
  font-family: var(--age-gate-font-sans);
  font-size: 0.8125rem;
  line-height: 1.45;
  text-wrap: balance;
}

.age-gate .age-gate-fine-text a {
  color: inherit;
  text-decoration: underline;
  text-decoration-color: var(--age-gate-accent);
  text-decoration-thickness: 1px;
  text-underline-offset: 4px;
}

.age-gate .age-gate-fine-text a:hover {
  color: var(--age-gate-text);
}

.age-gate .age-gate-fine-text a:focus-visible {
  outline: 2px solid var(--age-gate-accent);
  outline-offset: 2px;
  border-radius: 2px;
}

/* Entrance: each line follows the card in a short stagger. */
html.age-gate-open .age-gate-line {
  animation: age-gate-line-in 420ms var(--age-gate-ease-out) both;
}

html.age-gate-open .age-gate-eyebrow.age-gate-line {
  animation-delay: 220ms;
}

html.age-gate-open .age-gate-heading.age-gate-line {
  animation-delay: 270ms;
}

html.age-gate-open .age-gate-text.age-gate-line {
  animation-delay: 320ms;
}

html.age-gate-open .age-gate-actions.age-gate-line {
  animation-delay: 370ms;
}

html.age-gate-open .age-gate-fine-text.age-gate-line {
  animation-delay: 420ms;
}

/* Exit, after Yes: the card lifts and fades while the veil clears. */
html.age-gate-closing .age-gate-veil {
  animation: age-gate-veil-out 400ms ease-in both;
}

html.age-gate-closing .age-gate .age-gate-card {
  animation: age-gate-card-out 400ms ease-in both;
}

@media (width <= 479px) {
  .age-gate .age-gate-card {
    padding: 32px 20px 24px;
  }

  .age-gate .age-gate-logo {
    margin-bottom: 40px;
  }

  .age-gate .age-gate-actions {
    flex-direction: column;
  }

  .age-gate .age-gate-actions-single {
    align-items: center;
  }

  .age-gate .age-gate-actions .age-gate-button {
    width: 100%;
  }

  .age-gate .age-gate-actions-single .age-gate-button {
    width: auto;
  }
}

@keyframes age-gate-veil-in {
  from {
    opacity: 0;
    backdrop-filter: blur(0);
  }

  to {
    opacity: 1;
    backdrop-filter: blur(10px);
  }
}

@keyframes age-gate-veil-out {
  from {
    opacity: 1;
    backdrop-filter: blur(10px);
  }

  to {
    opacity: 0;
    backdrop-filter: blur(0);
  }
}

@keyframes age-gate-card-in {
  from {
    opacity: 0;
    transform: translateY(14px);
  }

  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes age-gate-card-out {
  from {
    opacity: 1;
    transform: none;
  }

  to {
    opacity: 0;
    transform: translateY(-8px);
  }
}

@keyframes age-gate-line-in {
  from {
    opacity: 0;
    transform: translateY(6px);
  }

  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes age-gate-grow-x {
  from {
    transform: scaleX(0);
  }

  to {
    transform: scaleX(1);
  }
}

@keyframes age-gate-grow-y {
  from {
    transform: scaleY(0);
  }

  to {
    transform: scaleY(1);
  }
}

/*
 * Hold the entrance until the page has painted. The head script adds
 * age-gate-ready two frames after it opens the gate. On a slow first load the
 * gate is styled long before the browser can paint anything, and an entrance
 * that started then would be over before it was ever on screen.
 */
html.age-gate-open:not(.age-gate-ready) .age-gate,
html.age-gate-open:not(.age-gate-ready) .age-gate * {
  animation-play-state: paused !important;
}

@media (prefers-reduced-motion: reduce) {
  .age-gate,
  .age-gate *,
  .age-gate *::before,
  .age-gate *::after {
    animation: none !important;
    transition: none !important;
  }
}
