/*
 * The test waitlist (SPEC §7b): the store badges (hero and footer) and the dialog that 立即試用 and the badges open.
 * On every page. The dialog is .glass--panel; nothing inside it is glass except the 3D button, which is opaque.
 */

/* ---------- Store badges ---------- */
/* Apple's and Google's artwork as provided: no hover motion, no tint, at least a quarter of the badge's height of
   clear space around each (both brands' rules). --badge-h is the height of the visible badge. */
.stores {
  --badge-h: 44px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: calc(var(--badge-h) / 4) calc(var(--badge-h) / 3);
  margin: 0;
  padding: 0;
  list-style: none;
}

.stores > li {
  display: flex;
}

.stores__badge {
  display: inline-flex;
  border-radius: 10px;
  line-height: 0;
  -webkit-tap-highlight-color: transparent;
}

.stores__badge:focus-visible {
  outline: 2px solid var(--color-focus);
  outline-offset: 3px;
}

.stores__apple {
  display: block;
  width: auto;
  height: var(--badge-h);
}

/* Google's PNG carries its own clear space; the negative margins take it back so both badges line up. */
.stores__google {
  display: block;
  width: auto;
  max-width: none;
}

.stores__google--band {
  height: calc(var(--badge-h) * 250 / 192);
  margin-block: calc(var(--badge-h) * -29 / 192);
}

.stores__google--pad {
  height: calc(var(--badge-h) * 250 / 168);
  margin: calc(var(--badge-h) * -41 / 168);
}

.hero__stores {
  margin-top: var(--space-md);
}

.site-foot__stores .stores {
  --badge-h: 40px;
}

/* ---------- The dialog ---------- */

.wl {
  --wl-pad: clamp(1.25rem, 4vw, 2rem);
  width: min(30rem, calc(100vw - 2rem));
  max-width: none;
  max-height: calc(100dvh - 2rem);
  margin: auto;
  padding: var(--wl-pad);
  overflow: auto;
  overscroll-behavior: contain;
  border: 0;
  color: var(--color-ink);
  text-align: start;
}

.wl:not([open]) {
  display: none;
}

.wl::backdrop {
  background: color-mix(in oklch, var(--color-paper) 52%, transparent);
  -webkit-backdrop-filter: blur(6px) saturate(1.2);
  backdrop-filter: blur(6px) saturate(1.2);
}

.wl__close {
  position: absolute;
  inset-block-start: calc(var(--wl-pad) - 0.6rem);
  inset-inline-end: calc(var(--wl-pad) - 0.6rem);
  z-index: 1;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--color-ink-2);
  cursor: pointer;
  transition: transform var(--dur) var(--ease-out);
}

@media (hover: hover) {
  .wl__close:hover {
    background: color-mix(in oklch, var(--color-ink) 7%, transparent);
    color: var(--color-ink);
  }
}

.wl__close:active {
  transform: scale(0.92);
  transition-duration: 80ms;
}

.wl__close:focus-visible {
  outline: 2px solid var(--color-focus);
  outline-offset: 2px;
}

.wl__close-ico {
  width: 16px;
  height: 16px;
  fill: currentColor;
}

.wl__step {
  display: grid;
  gap: var(--space-sm);
}

.wl__step[hidden] {
  display: none;
}

.wl__moqi {
  width: 56px;
  height: 56px;
}

/* The heading face, weight and line height come from base.css's per-language heading rules. */
.wl__title {
  margin: 0;
  padding-inline-end: 2.5rem;
  font-size: var(--text-xl);
}

.wl__title:focus {
  outline: none;
}

.wl__lead {
  margin: 0;
  color: var(--color-ink-2);
  font-size: var(--text-base);
  line-height: 1.6;
}

/* Which phone: two cards, the radio itself hidden but focusable. */
.wl__phones {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-xs);
  margin: var(--space-xs) 0 0;
  padding: 0;
  border: 0;
  min-width: 0;
}

.wl__legend {
  grid-column: 1 / -1;
  margin-bottom: var(--space-xs);
  padding: 0;
  font-size: var(--text-sm);
  font-weight: 600;
  float: left; /* lets the legend sit inside the grid */
  width: 100%;
}

.wl__phone {
  position: relative;
  display: grid;
  align-content: start;
  gap: 0.15rem;
  min-height: 4.5rem;
  padding: 0.85rem 2.25rem 0.85rem 1rem;
  border-radius: 16px;
  background: color-mix(in oklch, var(--color-card) 78%, transparent);
  box-shadow: inset 0 0 0 1px var(--color-rule);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: transform var(--dur) var(--ease-out);
}

.wl__phone:active {
  transform: scale(0.98);
  transition-duration: 80ms;
}

.wl__phone:has(:checked) {
  background: var(--color-cyan-soft);
  box-shadow: inset 0 0 0 2px var(--color-cyan-ink);
}

.wl__phone:has(:focus-visible) {
  outline: 2px solid var(--color-focus);
  outline-offset: 2px;
}

.wl__radio {
  position: absolute;
  inset: 0;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}

.wl__phone-name {
  font-weight: 700;
  font-size: var(--text-base);
}

.wl__phone-note {
  color: var(--color-ink-2);
  font-size: var(--text-sm);
  line-height: 1.35;
}

/* The tick: a shape, so the choice never rests on colour alone. */
.wl__phone-check {
  position: absolute;
  inset-block-start: 0.9rem;
  inset-inline-end: 0.85rem;
  width: 16px;
  height: 16px;
  fill: var(--color-cyan-ink);
  opacity: 0;
  transform: scale(0.6);
  transition: opacity var(--dur-fast) var(--ease-out), transform var(--dur) var(--ease-spring);
}

.wl__phone:has(:checked) .wl__phone-check {
  opacity: 1;
  transform: none;
}

.wl__field {
  display: grid;
  gap: var(--space-2xs);
  margin-top: var(--space-xs);
}

.wl__label {
  font-size: var(--text-sm);
  font-weight: 600;
}

.wl__input {
  width: 100%;
  min-height: 48px;
  padding: 0 1rem;
  border: 0;
  border-radius: 14px;
  background: var(--color-card);
  box-shadow: inset 0 0 0 1px var(--color-rule), 0 1px 2px color-mix(in oklch, var(--color-ink) 6%, transparent);
  color: var(--color-ink);
  font: inherit;
  font-size: max(16px, var(--text-base)); /* 16px or more: iOS does not zoom into it */
}

.wl__input:focus {
  outline: none;
  box-shadow: inset 0 0 0 2px var(--color-cyan-ink), 0 0 0 4px color-mix(in oklch, var(--color-cyan) 22%, transparent);
}

.wl__input[aria-invalid="true"] {
  box-shadow: inset 0 0 0 2px var(--color-ink);
}

.wl__hint {
  margin: 0;
  color: var(--color-ink-2);
  font-size: var(--text-sm);
  line-height: 1.5;
}

.wl__trap {
  position: absolute;
  inset-inline-start: -10000px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.wl__captcha {
  display: grid;
  justify-items: start;
  min-height: 0;
}

.wl__captcha:empty {
  display: none;
}

.wl__checking {
  margin: 0;
  color: var(--color-muted);
  font-size: var(--text-xs);
}

/* Errors: ink and a warning shape, never colour alone (pink is the MOQI gradient's, not an alarm). */
.wl__error {
  display: flex;
  gap: 0.5rem;
  align-items: flex-start;
  margin: 0;
  padding: 0.7rem 0.85rem;
  border-radius: 12px;
  background: var(--color-paper-2);
  box-shadow: inset 0 0 0 1.5px var(--color-ink);
  font-size: var(--text-sm);
  line-height: 1.5;
}

.wl__error[hidden] {
  display: none;
}

.wl__error-ico {
  flex: none;
  width: 16px;
  height: 16px;
  margin-top: 0.15rem;
  fill: currentColor;
}

.wl__submit,
.wl__ok {
  width: 100%;
  margin-top: var(--space-xs);
}

.wl__privacy {
  margin: 0;
  color: var(--color-caption);
  font-size: var(--text-xs);
  line-height: 1.55;
}

.wl__privacy a {
  color: var(--color-ink);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.25em;
}

.wl__done {
  justify-items: center;
  text-align: center;
  padding-block: var(--space-sm) 0;
}

.wl__done .wl__title {
  padding-inline-end: 0;
}

.wl__moqi--done {
  width: 72px;
  height: 72px;
}
