/* desktop.css — desktop area, top bar, dock */

.wallpaper-transition-cover {
  position: fixed;
  inset: 0;
  z-index: 450;
  pointer-events: none;
  opacity: 0;
  will-change: opacity;
}

.clock-glass-lens {
  z-index: 501 !important;
}

.clock-glass-specular {
  z-index: 502 !important;
}

body.wallpaper-booting .topbar__clock,
body.wallpaper-booting .lock-screen__content {
  opacity: 0;
}

/* ---- dark mode toggle (bottom right, liquid glass pill) ---- */
.glass-toggle {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 800; /* above its lens (798, injected by dark-mode-toggle.js) */
  display: flex;
  align-items: center;
  gap: 0; /* the text span collapses in; opened by hover */
  height: 48px;
  padding: 0 15px;
  border: 1px solid rgba(255, 255, 255, 0.35); /* hairline — the glass edge */
  border-radius: 999px;
  /* NO own backdrop-filter — the shuding lens div underneath provides the
     real refraction; a second blur here would stack and hide it */
  background: rgba(255, 255, 255, 0.10); /* faint tint over the lens */
  color: rgba(255, 255, 255, 0.95);
  font-family: "SF Pro Display", -apple-system, system-ui, sans-serif;
  font-size: 15px;
  font-weight: 500;
  letter-spacing: 0.01em;
  cursor: pointer;
  overflow: hidden;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.35),        /* specular top edge */
    inset 0 -1px 0 rgba(255, 255, 255, 0.12),
    0 8px 28px rgba(0, 0, 0, 0.28);                  /* float shadow */
  transition:
    width 1.1s cubic-bezier(0.34, 1.25, 0.42, 1),   /* spring overshoot, slower */
    padding 1.1s cubic-bezier(0.34, 1.25, 0.42, 1),
    gap 0.9s cubic-bezier(0.34, 1.25, 0.42, 1),
    background-color 0.7s ease,
    box-shadow 0.7s ease;
}

/* opened state: text visible */
.glass-toggle .glass-toggle__text {
  display: inline-block;
  max-width: 0;
  opacity: 0;
  transform: translateX(-6px);
  white-space: nowrap;
  transition:
    max-width 1.1s cubic-bezier(0.34, 1.25, 0.42, 1),
    opacity 0.7s ease 0.25s,
    transform 0.9s cubic-bezier(0.34, 1.25, 0.42, 1);
}

.glass-toggle .glass-toggle__icon {
  display: inline-flex;
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
}

.glass-toggle:hover {
  width: 210px;
  padding: 0 20px;
  gap: 10px;
  background-color: rgba(255, 255, 255, 0.16);
}

.glass-toggle:hover .glass-toggle__text {
  max-width: 160px;
  opacity: 1;
  transform: translateX(0);
}

/* press feedback — squish like a real glass capsule */
.glass-toggle:active {
  transform: scale(0.96);
  transition-duration: 0.3s;
}

/* accessibility: no spring for reduced motion users */
@media (prefers-reduced-motion: reduce) {
  .glass-toggle,
  .glass-toggle .glass-toggle__text {
    transition: opacity 0.35s ease, max-width 0.4s ease, width 0.4s ease;
  }
}

/* wallpaper cycler: mirrored to the bottom-left corner (shares .glass-toggle
   material + expansion animation; only the anchor differs) */
.glass-cycler {
  right: auto;
  left: 24px;
}

/* Lock screen: one centered glass mark and a quiet bottom action. */
.lock-screen {
  position: fixed;
  inset: 0;
  z-index: 850;
  pointer-events: none;
}

.lock-screen__content {
  position: absolute;
  inset: 0;
  opacity: 1;
  transition: opacity 260ms ease-out;
}

.lock-screen__mark {
  position: absolute;
  left: 50%;
  top: 49%;
  width: 96px;
  height: 96px;
  display: grid;
  place-items: center;
  transform: translate(-50%, -50%);
  border: 1px solid rgba(255, 255, 255, 0.42);
  border-radius: 50%;
  background: radial-gradient(circle at 34% 24%, rgba(255, 255, 255, 0.23), rgba(255, 255, 255, 0.07) 58%, rgba(255, 255, 255, 0.12));
  box-shadow:
    inset 0 1px 1px rgba(255, 255, 255, 0.46),
    inset 0 -2px 5px rgba(10, 20, 40, 0.16),
    0 12px 38px rgba(8, 22, 40, 0.2);
  overflow: hidden;
  opacity: 1;
  transition: opacity 680ms ease, transform 680ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

.lock-screen__lens {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  overflow: hidden;
  pointer-events: none;
}

.lock-screen__icon {
  position: relative;
  z-index: 1;
  width: 38px;
  height: 38px;
  color: rgba(255, 255, 255, 0.96);
  filter: drop-shadow(0 1px 5px rgba(12, 28, 45, 0.28));
}

.lock-screen__state {
  position: absolute;
  top: calc(49% + 70px);
  left: 50%;
  margin: 0;
  transform: translateX(-50%);
  color: rgba(255, 255, 255, 0.88);
  font-family: "SF Pro Display", -apple-system, system-ui, sans-serif;
  font-size: 16px;
  font-weight: 500;
  text-shadow: 0 1px 10px rgba(12, 28, 45, 0.3);
  white-space: nowrap;
  opacity: 1;
  transition: opacity 600ms ease;
}

.lock-screen.is-idle .lock-screen__mark,
.lock-screen.is-idle .lock-screen__state {
  opacity: 0;
  transform: translate(-50%, -54%);
  pointer-events: none;
}

.lock-screen__unlock {
  position: absolute;
  left: 50%;
  bottom: 54px;
  min-width: 142px;
  height: 50px;
  padding: 0 24px;
  transform: translateX(-50%);
  border: 1px solid rgba(255, 255, 255, 0.48);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.19);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.52),
    0 8px 28px rgba(8, 22, 40, 0.18);
  color: #fff;
  font: 600 16px/1 "SF Pro Display", -apple-system, system-ui, sans-serif;
  text-shadow: 0 1px 8px rgba(12, 28, 45, 0.24);
  backdrop-filter: blur(16px) saturate(1.55);
  -webkit-backdrop-filter: blur(16px) saturate(1.55);
  cursor: pointer;
  pointer-events: auto;
  transition: background-color 180ms ease, transform 180ms ease, box-shadow 180ms ease;
}

/* light mode: black text/icons on the lock screen (set by wallpaper.js) */
body[data-wallpaper-mode="light"] .glass-toggle,
body[data-wallpaper-mode="light"] .lock-screen__unlock {
  color: #000;
  text-shadow: 0 1px 8px rgba(255, 255, 255, 0.55);
}

.lock-screen__unlock:hover {
  background: rgba(255, 255, 255, 0.28);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.62), 0 10px 32px rgba(8, 22, 40, 0.24);
}

.lock-screen__unlock:active {
  transform: translateX(-50%) scale(0.97);
}

.lock-screen__unlock:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 4px;
}

body:not(.is-locked) .glass-toggle {
  transition: opacity 240ms ease-out, width 1.1s cubic-bezier(0.34, 1.25, 0.42, 1), padding 1.1s cubic-bezier(0.34, 1.25, 0.42, 1), gap 0.9s cubic-bezier(0.34, 1.25, 0.42, 1), background-color 0.7s ease, box-shadow 0.7s ease;
}

.passcode-screen {
  position: fixed;
  inset: 0;
  z-index: 860;
  display: grid;
  place-items: center;
  padding: 64px 24px 28px;
  color: #fff;
  background: rgba(4, 10, 22, 0.2);
  backdrop-filter: blur(22px) saturate(1.35);
  -webkit-backdrop-filter: blur(22px) saturate(1.35);
  animation: passcode-appear 320ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
  pointer-events: auto;
}

@keyframes passcode-appear {
  from { opacity: 0; }
  to { opacity: 1; }
}

.passcode-screen__content {
  width: min(100%, 340px);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
  font-family: "SF Pro Display", -apple-system, system-ui, sans-serif;
}

.passcode-screen__prompt {
  max-width: 310px;
  margin: 0;
  color: rgba(255, 255, 255, 0.96);
  font-size: 17px;
  font-weight: 500;
  line-height: 1.35;
  text-align: center;
  text-wrap: balance;
  text-shadow: 0 1px 14px rgba(0, 0, 0, 0.32);
}

.passcode-screen__dots {
  display: flex;
  justify-content: center;
  gap: 13px;
  min-height: 14px;
}

.passcode-screen__dot {
  width: 11px;
  height: 11px;
  border: 1px solid rgba(255, 255, 255, 0.88);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  transition: background-color 140ms ease, transform 140ms ease;
}

.passcode-screen__dot.is-filled {
  background: #fff;
  transform: scale(1.08);
}

.passcode-screen__keypad {
  display: grid;
  grid-template-columns: repeat(3, 68px);
  gap: 12px 18px;
  justify-content: center;
}

.passcode-screen__key,
.passcode-screen__key-spacer {
  width: 68px;
  height: 68px;
}

.passcode-screen__key {
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.34);
  border-radius: 50%;
  color: #fff;
  background: rgba(255, 255, 255, 0.1);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.3), 0 4px 18px rgba(0, 0, 0, 0.12);
  backdrop-filter: blur(12px) saturate(1.4);
  -webkit-backdrop-filter: blur(12px) saturate(1.4);
  font: 400 28px/1 "SF Pro Display", -apple-system, system-ui, sans-serif;
  cursor: pointer;
  transition: background-color 140ms ease, transform 140ms ease;
}

.passcode-screen__key[data-key="delete"] {
  border-color: transparent;
  background: transparent;
  box-shadow: none;
  font-size: 22px;
}

.passcode-screen__key:hover {
  background-color: rgba(255, 255, 255, 0.2);
}

.passcode-screen__key:active {
  transform: scale(0.92);
}

.passcode-screen__close {
  position: absolute;
  top: 28px;
  right: 24px;
  width: 42px;
  height: 42px;
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  color: #fff;
  background: rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  font: 300 28px/1 "SF Pro Display", -apple-system, system-ui, sans-serif;
  cursor: pointer;
}

@media (prefers-reduced-motion: reduce) {
  .lock-screen__content,
  .lock-screen__mark,
  .lock-screen__state,
  .lock-screen__unlock,
  .passcode-screen,
  .passcode-screen__key,
  .passcode-screen__dot,
  body:not(.is-locked) .glass-toggle {
    transition-duration: 0.01ms;
    animation-duration: 0.01ms;
  }
}

.topbar {
  position: absolute;
  top: 32px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  z-index: 500;
  pointer-events: none; /* it's a heading, not a control */
}

.topbar__date {
  margin: 0; /* UA default would add 26px — iOS has none */
  font-family: "SF Pro Display", -apple-system, system-ui, sans-serif;
  font-weight: 400;
  font-size: 26px;
  line-height: 1.25;
  color: rgba(255, 255, 255, 0.92);
  text-shadow: 0 1px 12px rgba(40, 80, 100, 0.35);
}

/* ---- the clock: REAL liquid-glass letterforms ----
   Driven by the vendored shuding/liquid-glass Shader (glass-clock.js):
   a transparent, glyph-masked overlay whose backdrop-filter is the
   library's SVG displacement filter — the wallpaper bends INSIDE the
   digit strokes. The h1's own text stays transparent; the glass in the
   glyphs IS the visual. No slab, no box. */
.topbar__clock {
  margin: 0;
  position: relative;
  font-family: "SF Pro Display", -apple-system, system-ui, sans-serif;
  font-weight: 700;
  font-size: 128px;
  line-height: normal;
  letter-spacing: -0.02em;
  /* no tabular-nums: the canvas that draws the glass digits (glass-fragment.js)
     can't use tabular figures, so the box would be wider than the ink and the
     digits would sit left of center */

  /* fallback (before glass applies): visible white text */
  color: rgba(255, 255, 255, 0.93);
  text-shadow:
    0 1px 2px rgba(255, 255, 255, 0.2),
    0 4px 24px rgba(20, 60, 80, 0.3);
}

/* glass attached (js adds .is-glass + the overlay): hide the plain text fill
   entirely — the refraction inside the glyph shapes IS the visual */
.topbar__clock.is-glass {
  color: transparent;
  text-shadow: none;
  background-image: none !important;
}
/* ---- lock-screen intro: buttons stay hidden until the lock icon has faded ----
   !important because wallpaper.js writes inline opacity/transition on these. */
body.lock-intro .lock-screen__unlock,
body.lock-intro .glass-toggle {
  opacity: 0 !important;
  pointer-events: none !important;
}

body.lock-reveal .lock-screen__unlock,
body.lock-reveal .glass-toggle {
  transition: opacity 700ms ease-out !important;
}

.lock-screen__timer {
  margin-left: 2px;
  font-variant-numeric: tabular-nums; /* steady width while counting down */
}
