:root {
  color-scheme: light;
  --ink: #1c1812;
  --paper: #f4eee2;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  height: 100%;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  display: grid;
  place-items: center;
  overflow: hidden;
  background: var(--paper);
  color: var(--ink);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial,
    sans-serif;
  font-size: 1.0625rem;
  line-height: 1.5;
  cursor: ew-resize;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

.stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: max(1.5rem, env(safe-area-inset-top))
    max(1.25rem, env(safe-area-inset-right))
    max(2rem, env(safe-area-inset-bottom))
    max(1.25rem, env(safe-area-inset-left));
  max-width: 100%;
}

.north {
  position: fixed;
  top: max(0.9rem, env(safe-area-inset-top));
  left: 50%;
  transform: translateX(-50%);
  margin: 0;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.18em;
  line-height: 1.2;
  opacity: 0.38;
}

.north[data-phase="night"] {
  opacity: 0.28;
}

.date {
  margin: 1.6rem 0 0;
  max-width: 28ch;
  font-size: 1rem;
  font-weight: 500;
  letter-spacing: 0.01em;
  line-height: 1.4;
  opacity: 0.62;
}

.clock {
  display: grid;
  place-items: center;
  margin: 0;
  font-family: "Archivo Black", "Arial Black", Impact, sans-serif;
  font-weight: 400;
  font-size: clamp(3.25rem, min(20vw, 30vh), 12rem);
  font-feature-settings: "lnum", "tnum";
  font-variant-numeric: lining-nums tabular-nums;
  line-height: 0.95;
  letter-spacing: -0.02em;
  text-wrap: balance;
}

.casts {
  display: contents;
}

.face,
.cast {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  gap: 0.14em;
  grid-area: 1 / 1;
}

.face {
  position: relative;
  z-index: 1;
  color: transparent;
  -webkit-text-fill-color: transparent;
  opacity: 0;
}

.cast {
  z-index: 0;
  pointer-events: none;
  transform-origin: center center;
  color: rgb(40, 38, 36);
}

.clock.is-night .face {
  color: inherit;
  -webkit-text-fill-color: currentColor;
  opacity: 1;
}

.clock.is-night .cast {
  visibility: hidden;
}

.period {
  margin-top: 0.38em;
  font-size: 0.22em;
  letter-spacing: 0.04em;
  line-height: 1.2;
}

.hint,
.quiet {
  margin: 1.75rem 0 0;
  min-height: 1.4em;
  font-size: 1rem;
  font-weight: 500;
  letter-spacing: 0.01em;
  line-height: 1.4;
  opacity: 0.48;
}

.hint + .quiet,
.quiet + .quiet {
  margin-top: 0.4rem;
}

.quiet {
  appearance: none;
  padding: 0.35rem 0.7rem;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: inherit;
  font: inherit;
  cursor: pointer;
}

.quiet:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 4px;
}

.quiet:hover {
  opacity: 0.8;
}

.noscript {
  max-width: 36ch;
  margin: 0;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (prefers-reduced-motion: reduce) {
  body,
  .clock,
  .date,
  .hint,
  .quiet {
    transition: none;
  }
}

@media (max-width: 40rem) {
  .date {
    font-size: 0.95rem;
  }

  .hint,
  .quiet {
    font-size: 0.9rem;
  }
}
