:root {
  --alert-bg: rgba(242, 242, 247, 0.8);
  --alert-text: #000;
  --alert-separator: rgba(60, 60, 67, 0.29);
  --alert-field-bg: #fff;
  --alert-placeholder: rgba(60, 60, 67, 0.3);
  --alert-pressed: rgba(0, 0, 0, 0.06);
  --alert-tint: #007aff;
  --lock-dim: rgba(0, 0, 0, 0.2);
}

@media (prefers-color-scheme: dark) {
  :root {
    --alert-bg: rgba(37, 37, 39, 0.8);
    --alert-text: #fff;
    --alert-separator: rgba(84, 84, 88, 0.65);
    --alert-field-bg: rgba(28, 28, 30, 0.9);
    --alert-placeholder: rgba(235, 235, 245, 0.3);
    --alert-pressed: rgba(255, 255, 255, 0.08);
    --alert-tint: #0a84ff;
    --lock-dim: rgba(0, 0, 0, 0.42);
  }
}

.lock,
.lock * {
  box-sizing: border-box;
}

.lock [hidden] {
  display: none !important;
}

.lock {
  position: relative;
  height: 100dvh;
  overflow: hidden;
  color: #fff;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  /* The swipe up is handled here, so the browser must not scroll or zoom on it. */
  touch-action: none;
}

.lock .status-time {
  visibility: hidden;
}

.lock.is-prompting .wallpaper {
  filter: blur(22px) brightness(0.92);
  scale: 1.08;
}

/* Time and date */

.lock-face {
  position: absolute;
  top: calc(var(--safe-top) + var(--status-bar-height) + 4px);
  left: 0;
  right: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  text-shadow: 0 1px 12px rgba(0, 0, 0, 0.12);
  transition: opacity 260ms ease, transform 420ms var(--spring);
  will-change: transform, opacity;
}

.lock.is-prompting .lock-face {
  opacity: 0;
  transform: translateY(-28px) scale(0.96);
}

.lock-padlock {
  display: block;
  margin-bottom: 8px;
  overflow: visible;
  color: rgba(255, 255, 255, 0.92);
}

.lock-shackle {
  transform-box: view-box;
  transform-origin: 5px 12px;
  transition: transform 420ms var(--spring);
}

.lock.is-unlocked .lock-shackle {
  transform: translateY(-2px) rotate(-22deg);
}

.lock-date {
  margin: 0;
  min-height: 1.2em;
  font-size: 20px;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: rgba(255, 255, 255, 0.88);
}

.lock-time {
  margin: -4px 0 0;
  min-height: 1em;
  font-size: clamp(84px, 26vw, 112px);
  font-weight: 600;
  line-height: 1;
  letter-spacing: -0.035em;
  font-variant-numeric: tabular-nums;
  color: rgba(255, 255, 255, 0.94);
}

/* Unlock hint */

.lock-hint {
  position: absolute;
  left: 50%;
  bottom: calc(var(--safe-bottom) + var(--home-bar-space) + 12px);
  translate: -50% 0;
  padding: 12px 18px;
  border: 0;
  background: none;
  color: #fff;
  font: inherit;
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  transition: opacity 220ms ease;
}

.lock-hint span {
  background: linear-gradient(100deg, rgba(255, 255, 255, 0.55) 42%, #fff 50%, rgba(255, 255, 255, 0.55) 58%) 0 0 / 300% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: hint-shimmer 2.6s linear infinite;
}

@keyframes hint-shimmer {
  from {
    background-position: 100% 0;
  }

  to {
    background-position: 0 0;
  }
}

.lock-hint-pointer {
  display: none;
}

@media (hover: hover) and (pointer: fine) {
  .lock-hint-touch {
    display: none;
  }

  .lock-hint-pointer {
    display: inline;
  }
}

.lock-hint:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 2px;
  border-radius: 12px;
}

.lock.is-prompting .lock-hint,
.lock.is-prompting .home-bar,
.lock.is-unlocked .lock-hint,
.lock.is-unlocked .home-bar {
  opacity: 0;
}

.lock .home-bar {
  transition: opacity 220ms ease;
}

/* Sign-in sheet */

.lock-sheet {
  position: fixed;
  inset: var(--visual-viewport-top, 0px) 0 auto;
  height: var(--visual-viewport-height, 100dvh);
  z-index: 10;
  display: grid;
  place-items: center;
  padding: 16px;
  touch-action: manipulation;
}

/* A sibling of the alert, not its parent: fading an ancestor would stop the
   alert's glass from blurring the wallpaper. */
.lock-dim {
  position: absolute;
  inset: 0;
  background: var(--lock-dim);
}

.ios-alert {
  position: relative;
  width: 270px;
  max-width: 100%;
  overflow: hidden;
  border-radius: 14px;
  background: var(--alert-bg);
  backdrop-filter: blur(40px) saturate(1.8);
  -webkit-backdrop-filter: blur(40px) saturate(1.8);
  color: var(--alert-text);
  text-align: center;
  font-family: -apple-system, BlinkMacSystemFont, "Helvetica Neue", sans-serif;
  will-change: transform, opacity;
}

.ios-alert-body {
  padding: 19px 16px 16px;
}

.ios-alert-title {
  margin: 0;
  font-size: 17px;
  font-weight: 600;
  line-height: 22px;
  letter-spacing: -0.02em;
}

.ios-alert-message {
  margin: 2px 0 0;
  font-size: 13px;
  line-height: 16px;
  letter-spacing: -0.005em;
}

.ios-alert-fields {
  display: flex;
  flex-direction: column;
  margin-top: 16px;
}

/* 16px at least: iOS Safari zooms the page into any smaller field it focuses. */
.ios-alert-fields input {
  width: 100%;
  height: 36px;
  margin: 0;
  padding: 0 8px;
  border: 0.5px solid var(--alert-separator);
  border-radius: 0;
  background: var(--alert-field-bg);
  color: var(--alert-text);
  font: inherit;
  font-size: 16px;
  outline: none;
  -webkit-appearance: none;
  appearance: none;
  user-select: text;
  -webkit-user-select: text;
}

.ios-alert-fields input:first-child {
  border-radius: 7px 7px 0 0;
}

.ios-alert-fields input + input {
  border-top: 0;
  border-radius: 0 0 7px 7px;
}

.ios-alert-fields input::placeholder {
  color: var(--alert-placeholder);
}

.ios-alert-actions {
  display: flex;
  border-top: 0.5px solid var(--alert-separator);
}

.ios-alert-action {
  position: relative;
  flex: 1;
  display: grid;
  place-items: center;
  height: 44px;
  padding: 0 8px;
  border: 0;
  background: none;
  color: var(--alert-tint);
  font: inherit;
  font-size: 17px;
  letter-spacing: -0.02em;
  cursor: pointer;
}

.ios-alert-action + .ios-alert-action {
  border-left: 0.5px solid var(--alert-separator);
}

.ios-alert-action.is-preferred {
  font-weight: 600;
}

.ios-alert-action:active {
  background: var(--alert-pressed);
}

.ios-alert-action:focus-visible {
  outline: 2px solid var(--alert-tint);
  outline-offset: -4px;
  border-radius: 8px;
}

.ios-alert-action > * {
  grid-area: 1 / 1;
}

.ios-spinner {
  visibility: hidden;
  color: var(--alert-text);
  opacity: 0.6;
}

.ios-alert.is-busy .ios-alert-label {
  visibility: hidden;
}

.ios-alert.is-busy .ios-spinner {
  visibility: visible;
  animation: spinner-turn 0.8s steps(8) infinite;
}

@keyframes spinner-turn {
  to {
    rotate: 360deg;
  }
}

/* Wider screens */

@media (min-width: 768px) {
  .lock-face {
    top: 12vh;
  }

  .lock-date {
    font-size: 22px;
  }

  .lock-time {
    font-size: 128px;
  }

  .lock-hint {
    bottom: 40px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .lock-face,
  .lock-shackle,
  .lock-hint,
  .lock .home-bar {
    transition: none;
  }

  .lock-hint span {
    animation: none;
  }
}

/* Signing in and out play their own animations; home.css opts every page that
   loads it into cross-document view transitions, so this one opts back out. */
@view-transition {
  navigation: none;
}
