/*
 * The passcode screen (pages/passcode.js): Zeo, the entry, and nothing else. It covers the whole
 * window until the passcode is right.
 */

.passcode {
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  background: var(--paper);
  color: var(--ink);
}
.passcode::backdrop {
  background: var(--paper);
}

/* Held in the upper part of the window, where a phone's number pad does not cover it. */
.passcode-form {
  display: grid;
  justify-items: center;
  gap: var(--s32);
  padding: 18vh var(--s24) 0;
}
.passcode-zeo {
  width: 128px;
  height: 96px;
}

/* A number: the field lies unseen over the dots, so that a tap on them opens the number pad. */
.passcode-entry {
  position: relative;
  display: block;
  border-radius: var(--radius-card);
}
.passcode-entry.dotted {
  padding: var(--s16) var(--s24);
}
.passcode-entry.dotted .passcode-field {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  opacity: 0;
  /* Below 16px, iOS zooms the page when the field takes focus. */
  font-size: 16px;
}
.passcode-dots {
  display: flex;
  gap: var(--s24);
}
.passcode-dots i {
  width: 20px;
  height: 20px;
  border: var(--line-ink);
  border-radius: 50%;
  background: var(--white);
  transition:
    background 80ms,
    border-color 80ms;
}
.passcode-dots i.filled {
  background: var(--ink);
}

/* Any other passcode: a plain field. */
.passcode-entry:not(.dotted) .passcode-field {
  width: min(280px, 80vw);
  padding: var(--s12) var(--s16);
  border: var(--line-ink);
  border-radius: var(--radius-12);
  background: var(--white);
  color: var(--ink);
  font: inherit;
  font-size: 18px;
  text-align: center;
}

.passcode-entry.missed {
  animation: passcode-miss 320ms;
}
.passcode-entry.missed .passcode-dots i {
  background: var(--coral);
}
@keyframes passcode-miss {
  20%,
  60% {
    transform: translateX(-8px);
  }
  40%,
  80% {
    transform: translateX(8px);
  }
}
@media (prefers-reduced-motion: reduce) {
  @keyframes passcode-miss {
    50% {
      opacity: 0.4;
    }
  }
}

.passcode-wait {
  min-height: 1.5em;
  margin: 0;
  color: var(--muted);
}

/* The way back to Zeo, when the screen stands in front of the parent's pages. */
.passcode-leave {
  position: absolute;
  top: var(--s12);
  right: var(--s12);
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: none;
  color: var(--ink);
  cursor: pointer;
}
.passcode-leave:hover {
  background: var(--sunk);
}
.passcode-leave svg {
  width: var(--s24);
  height: var(--s24);
}
.passcode-leave:focus-visible {
  outline: var(--focus-ring);
}
