/* Standby: the stage, its controls and Customize panel, night mode, slideshow layers,
   clocks over photos, and the widget pair. Always dark, whatever the page theme. */

.standby {
  position: fixed;
  inset: 0;
  background: #000;
  color: #fff;
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  outline: none;
  color-scheme: dark;
}
.standby:not(.show-controls) {
  cursor: none;
}

.stage {
  position: absolute;
  inset: 0;
  container-type: size;
}

/* ---- Night mode: everything grayscale and dim, then tinted red by multiplying ---- */
.standby.night .stage,
.standby.night .controls,
.standby.night .panel {
  filter: grayscale(1) brightness(0.7) contrast(1.15);
}
.night-tint {
  position: absolute;
  inset: 0;
  background: #ff1f0f;
  mix-blend-mode: multiply;
  pointer-events: none;
  opacity: 0;
  z-index: 40;
  transition: opacity 0.6s;
}
.standby.night .night-tint {
  opacity: 1;
}

/* ---- Controls ---- */
.controls {
  position: absolute;
  inset: 0;
  z-index: 20;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.standby.show-controls .controls {
  opacity: 1;
}
.standby.show-controls .controls > * {
  pointer-events: auto;
}
.ctl-top,
.ctl-bottom {
  padding: calc(12px + var(--safe-top)) calc(16px + var(--safe-right)) 12px calc(16px + var(--safe-left));
}
.ctl-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  background: linear-gradient(to bottom, rgba(0, 0, 0, 0.6), transparent);
  padding-bottom: 28px;
}
.ctl-bottom {
  padding: 28px calc(16px + var(--safe-right)) calc(14px + var(--safe-bottom)) calc(16px + var(--safe-left));
  background: linear-gradient(to top, rgba(0, 0, 0, 0.65), transparent);
  display: grid;
  gap: 10px;
  justify-items: center;
}
.ctl-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
}
.ctl-group {
  display: flex;
  gap: 6px;
  align-items: center;
}
.ctl {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-width: 48px;
  height: 48px;
  padding: 0 12px;
  border: 0;
  border-radius: 999px;
  background: rgba(60, 60, 64, 0.62);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
  color: #fff;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
}
.ctl:hover {
  background: rgba(90, 90, 96, 0.7);
}
.ctl[aria-pressed="true"] {
  background: #fff;
  color: #000;
}
.ctl-wide {
  padding: 0 18px 0 14px;
}
.ctl-screens {
  background: rgba(60, 60, 64, 0.62);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
  border: 0;
  border-radius: 999px;
  padding: 4px;
}
.ctl-screens button {
  min-height: 40px;
  border-radius: 999px;
  color: rgba(255, 255, 255, 0.75);
  padding: 6px 16px;
}
.ctl-screens button.on {
  background: #fff;
  color: #000;
}
.ctl-media {
  display: grid;
  justify-items: center;
  gap: 8px;
}
.ctl-caption {
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.8);
  max-width: min(80vw, 640px);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.6);
}
.standby :focus-visible {
  outline-color: #fff;
}

@media (max-width: 560px) {
  .ctl-wide span,
  .ctl-screens span {
    display: none;
  }
  .ctl-screens button {
    padding: 6px 14px;
  }
}

.tap-hint {
  position: absolute;
  left: 50%;
  bottom: calc(28px + var(--safe-bottom));
  transform: translate(-50%, 8px);
  padding: 10px 18px;
  border-radius: 999px;
  background: rgba(40, 40, 44, 0.8);
  color: #fff;
  font-size: 0.9rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s, transform 0.4s;
  z-index: 30;
}
.tap-hint.on {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* ---- Customize panel: a sheet from the bottom on phones, from the side on wide screens ---- */
.panel {
  position: absolute;
  z-index: 25;
  left: 0;
  right: 0;
  bottom: 0;
  max-height: min(72vh, 640px);
  display: flex;
  flex-direction: column;
  background: rgba(28, 28, 30, 0.92);
  -webkit-backdrop-filter: blur(24px);
  backdrop-filter: blur(24px);
  border-radius: 20px 20px 0 0;
  box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.5);
  transform: translateY(calc(100% + 60px));
  transition: transform 0.3s ease;
  cursor: auto;
  /* Closed, it sits off screen and is inert (set in standby.js). Not visibility: hidden:
     WebKit left a redrawn panel's contents hidden after night mode's filter (NOTES.md). */
}
.standby.panel-open .panel {
  transform: none;
}
@media (min-width: 820px) {
  .panel {
    left: auto;
    top: 0;
    width: 400px;
    max-height: none;
    border-radius: 0;
    transform: translateX(calc(100% + 60px));
    padding-top: var(--safe-top);
  }
  .standby.panel-open .ctl-bottom {
    padding-right: calc(416px + var(--safe-right));
  }
}
.pn-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 18px 8px;
}
.pn-head h2 {
  margin: 0;
  font-size: 1.15rem;
}
.pn-done {
  border: 0;
  background: none;
  color: #c8b6ff;
  font-weight: 700;
  font-size: 1rem;
  min-height: 44px;
  padding: 0 6px;
  cursor: pointer;
}
.pn-body {
  overflow-y: auto;
  padding: 4px 18px calc(18px + var(--safe-bottom));
  overscroll-behavior: contain;
  user-select: none;
}
.pn-row {
  padding: 10px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.pn-row:last-child {
  border-bottom: 0;
}
.pn-label {
  font-size: 0.8rem;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.55);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 8px;
}
.pn-content {
  display: grid;
  gap: 10px;
}
.pn-note {
  margin: 0;
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.6);
}
.pn-link {
  justify-self: start;
  border: 0;
  background: none;
  color: #c8b6ff;
  font-weight: 600;
  padding: 6px 0;
  min-height: 40px;
  cursor: pointer;
  text-align: left;
}
.pn-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.pn-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 40px;
  padding: 6px 12px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
}
.pn-chip.on {
  background: #fff;
  color: #000;
  border-color: #fff;
}
.pn-faces,
.pn-fonts {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(84px, 1fr));
}
.pn-faces .pn-chip,
.pn-fonts .pn-chip {
  flex-direction: column;
  padding: 10px 6px;
  gap: 4px;
}
.font-sample {
  font-size: 1.5rem;
  line-height: 1.1;
}
.panel .swatch {
  border-color: rgba(255, 255, 255, 0.25);
}
.panel .swatch.on {
  outline-color: #fff;
}
.pn-flags {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(76px, 1fr));
  gap: 8px;
}
.flag-chip {
  display: grid;
  justify-items: center;
  gap: 4px;
  padding: 6px;
  border: 2px solid transparent;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.05);
  color: #fff;
  font-size: 0.72rem;
  cursor: pointer;
}
.flag-chip canvas {
  width: 54px;
  height: 36px;
  border-radius: 5px;
}
.flag-chip.on {
  border-color: #fff;
}
.pn-albums {
  display: grid;
  gap: 4px;
}
.pn-album {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 46px;
  padding: 6px 10px;
  border: 0;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.05);
  color: #fff;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
}
.pn-album.on {
  background: rgba(164, 135, 255, 0.28);
}
.pn-check {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.4);
  display: grid;
  place-items: center;
  flex: none;
}
.pn-album.on .pn-check {
  background: #fff;
  color: #000;
  border-color: #fff;
}
.pn-album-name {
  flex: 1;
}
.pn-album-count {
  color: rgba(255, 255, 255, 0.55);
  font-variant-numeric: tabular-nums;
}
.panel .segmented {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.1);
}
.panel .segmented button {
  color: rgba(255, 255, 255, 0.7);
}
.panel .segmented button.on {
  background: #fff;
  color: #000;
}
.panel .input {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.15);
  color: #fff;
}
.panel select.input option {
  color: #000;
}
.panel .switch {
  background: rgba(255, 255, 255, 0.2);
}

/* ---- Slideshow ---- */
.slideshow {
  position: absolute;
  inset: 0;
  overflow: hidden;
  container-type: size;
  background: #000;
}
.slide {
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity 1.2s ease;
  container-type: size;
}
.slide.on {
  opacity: 1;
}
.slide.instant {
  transition: none;
}
.slide-media {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  max-width: none;
}
.slide.fill .slide-media {
  object-fit: cover;
}
.slide.fit .slide-media {
  object-fit: contain;
}
.slide-backdrop {
  position: absolute;
  inset: -10%;
  width: 120%;
  height: 120%;
  max-width: none;
  object-fit: cover;
  filter: blur(40px) brightness(0.55) saturate(1.2);
}
/* Blur photos (a Photos-screen option): drawn a little larger so the soft edges stay off screen. */
.photos-blur .slide-media {
  inset: -6%;
  width: 112%;
  height: 112%;
  filter: blur(28px) brightness(0.85);
  filter: blur(min(3.5cqmin, 48px)) brightness(0.85);
}
.slide.motion.on .slide-media {
  animation: drift var(--motion-time, 30s) ease-in-out forwards;
}
@keyframes drift {
  from {
    transform: scale(1.0) translate(0, 0);
  }
  to {
    transform: scale(1.08) translate(-1.5%, -1%);
  }
}
.slide-empty {
  position: absolute;
  inset: 0;
  display: none;
  place-content: center;
  text-align: center;
  padding: 24px;
  color: rgba(255, 255, 255, 0.7);
}
.slide-empty.on {
  display: grid;
}
.slide-empty-title {
  font-size: 1.3rem;
  font-weight: 600;
  color: #fff;
}

/* ---- Clocks over photos ---- */
.overlay-clock {
  position: absolute;
  padding: 5cqmin 6cqmin;
  pointer-events: none;
  color: #fff;
  display: flex;
}
.overlay-clock .digital-clock {
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.35), 0 2px 18px rgba(0, 0, 0, 0.35);
}
.overlay-clock .flag-text {
  text-shadow: none;
  filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.45));
}
.overlay-clock.dark-ink .digital-clock {
  text-shadow: 0 1px 12px rgba(255, 255, 255, 0.5);
}
.pos-top-left {
  top: 0;
  left: 0;
}
.pos-top {
  top: 0;
  left: 0;
  right: 0;
  justify-content: center;
}
.pos-top-right {
  top: 0;
  right: 0;
  justify-content: flex-end;
}
.pos-center {
  inset: 0;
  align-items: center;
  justify-content: center;
}
.pos-bottom-left {
  bottom: 0;
  left: 0;
}
.pos-bottom {
  bottom: 0;
  left: 0;
  right: 0;
  justify-content: center;
}
.pos-bottom-right {
  bottom: 0;
  right: 0;
  justify-content: flex-end;
}
.overlay-clock .dc-time {
  font-size: var(--ov-size);
}
.overlay-clock .dc-date {
  font-size: calc(var(--ov-size) * 0.2);
}
.overlay-clock.size-s {
  --ov-size: 10cqmin;
  --ov-dial: 18cqmin;
}
.overlay-clock.size-m {
  --ov-size: 15cqmin;
  --ov-dial: 26cqmin;
}
.overlay-clock.size-l {
  --ov-size: 22cqmin;
  --ov-dial: 36cqmin;
}
.overlay-clock.size-xl {
  --ov-size: min(34cqmin, 26cqw);
  --ov-dial: 58cqmin;
}
.overlay-clock .analog-wrap {
  width: var(--ov-dial);
  height: var(--ov-dial);
  filter: drop-shadow(0 4px 18px rgba(0, 0, 0, 0.35));
}
.pos-top-left .digital-clock,
.pos-bottom-left .digital-clock {
  align-items: flex-start;
  text-align: left;
}
.pos-top-right .digital-clock,
.pos-bottom-right .digital-clock {
  align-items: flex-end;
  text-align: right;
}
.slideshow.compact .overlay-clock {
  padding: 6cqmin;
}

/* ---- Clock screen ---- */
.clock-screen {
  position: absolute;
  inset: 0;
}
.clock-bg,
.clock-bg canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  max-width: none;
}
.clock-face {
  position: absolute;
  inset: 0;
  container-type: size;
  display: grid;
  place-items: center;
  padding: calc(4cqmin + var(--safe-top)) calc(4cqmin + var(--safe-right)) calc(4cqmin + var(--safe-bottom)) calc(4cqmin + var(--safe-left));
}
.clock-screen.on-flag .digital-clock {
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3), 0 4px 30px rgba(0, 0, 0, 0.35);
}
.clock-screen.on-flag .flag-text {
  text-shadow: none;
}
.face-digital .dc-time {
  font-size: min(27cqw, 62cqh);
}
.face-digital .with-seconds .dc-time {
  font-size: min(23cqw, 58cqh);
}
.face-digital .dc-date {
  font-size: min(4.6cqw, 8cqh);
}
.face-analog .analog-wrap {
  width: min(88cqh, 88cqw);
  height: min(88cqh, 88cqw);
}

/* ---- Widget pair ---- */
.widget-pair {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3cqmin;
  padding: calc(4cqmin + var(--safe-top)) calc(4cqmin + var(--safe-right)) calc(4cqmin + var(--safe-bottom)) calc(4cqmin + var(--safe-left));
}
@container (max-aspect-ratio: 1/1) {
  .widget-pair {
    grid-template-columns: 1fr;
    grid-template-rows: 1fr 1fr;
  }
}
.widget-slot {
  position: relative;
  container-type: size;
  border-radius: 7cqmin;
  overflow: hidden;
  background: #111114;
  min-width: 0;
  min-height: 0;
}
.widget {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 7cqmin;
}
.widget-clock .analog-wrap {
  width: 86cqmin;
  height: 86cqmin;
}
.widget-clock .dc-time {
  font-size: min(25cqw, 48cqh);
}
.widget-clock .dc-date {
  font-size: min(6cqw, 11cqh);
}
.widget-photo {
  padding: 0;
}

.widget-calendar {
  display: grid;
  grid-template-rows: auto 1fr;
  place-items: stretch;
  gap: 3cqh;
  padding: 7cqh 7cqw;
}
.cal-title {
  color: #ff453a;
  font-weight: 700;
  font-size: min(8cqh, 6.5cqw);
  letter-spacing: 0.04em;
}
.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  grid-auto-rows: 1fr;
  align-items: center;
  justify-items: center;
  font-size: min(7.5cqh, 6cqw);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.cal-grid.six-weeks {
  font-size: min(6.6cqh, 6cqw);
}
.cal-head {
  color: rgba(255, 255, 255, 0.5);
  font-size: 0.85em;
}
.cal-day.weekend,
.cal-head.weekend {
  color: rgba(255, 255, 255, 0.55);
}
.cal-day.today {
  background: #ff453a;
  color: #fff;
  border-radius: 50%;
  width: 1.8em;
  height: 1.8em;
  display: grid;
  place-items: center;
}

.widget-timer {
  display: grid;
  grid-template-rows: auto 1fr auto auto;
  place-items: center;
  gap: 2cqh;
  padding: 5cqh 6cqw;
  user-select: none;
}
.tw-tabs {
  display: flex;
  gap: 4px;
  background: rgba(255, 255, 255, 0.08);
  padding: 3px;
  border-radius: 999px;
}
.tw-tabs button {
  border: 0;
  background: none;
  color: rgba(255, 255, 255, 0.65);
  font-weight: 600;
  font-size: max(13px, min(4.2cqh, 3.6cqw));
  padding: 6px 14px;
  min-height: 36px;
  border-radius: 999px;
  cursor: pointer;
}
.tw-tabs button.on {
  background: #fff;
  color: #000;
}
.tw-face {
  font: 300 min(26cqh, 19cqw) / 1 ui-rounded, system-ui, sans-serif;
  font-variant-numeric: tabular-nums;
  color: #ff9f0a;
}
.tw-sub {
  color: rgba(255, 255, 255, 0.6);
  font-size: max(12px, min(5cqh, 4cqw));
  min-height: 1.4em;
}
.tw-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
}
.tw-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: center;
}
.tw-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  padding: 6px 14px;
  border: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  font-weight: 600;
  font-size: max(14px, min(4.5cqh, 3.8cqw));
  cursor: pointer;
}
.tw-btn.primary {
  background: #ff9f0a;
  color: #000;
}
.tw-btn.preset .icon {
  display: none;
}
.widget-timer.ringing .tw-face {
  animation: ring 1s steps(2) infinite;
}
@keyframes ring {
  50% {
    opacity: 0.25;
  }
}
