@font-face {
  font-family: "Geist Mono";
  src: url("fonts/geist-mono.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}

@font-face {
  font-family: "Noto Serif Display";
  src: url("fonts/noto-serif-display-700.woff2") format("woff2");
  font-weight: 700;
  font-display: swap;
}

:root {
  color-scheme: light;
  --sky: #b9dfe6;
  --clock-cutout: #b9dfe6;
  --ink: #244f52;
  --title-from: #163f48;
  --title-to: #3d6870;
  --title-glow: 0.18;
  --focus: #244f52;
}

:root[data-theme="night"] {
  color-scheme: dark;
  --sky: #101d38;
  --clock-cutout: #192c48;
  --ink: #d2e2dd;
  --title-from: #f4f1d8;
  --title-to: #b4d7df;
  --title-glow: 0.7;
  --focus: #e4e9be;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  overflow: hidden;
  background: var(--sky);
  color: var(--ink);
  font-family: "Geist Mono", ui-monospace, monospace;
}

main { position: fixed; inset: 0; overflow: hidden; }
#meadow, #flock { position: absolute; inset: 0; width: 100%; height: 100%; }
#meadow { display: block; }
#flock { z-index: 1; pointer-events: none; }

.clock {
  position: absolute;
  isolation: isolate;
  top: 33%;
  left: 50%;
  display: grid;
  justify-items: center;
  gap: clamp(4px, 0.9vh, 10px);
  transform: translate(-50%, -50%);
  pointer-events: none;
}

.clock canvas:not([hidden]) { display: block; }

#clock-text, #weekday-text {
  font-family: "Noto Serif Display", Georgia, serif;
  font-weight: 700;
  line-height: 1;
  white-space: nowrap;
}

#clock-text { font-size: clamp(42px, 12vmin, 112px); }
#weekday-text { font-size: clamp(26px, 6.5vmin, 62px); }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.mark-glow {
  position: absolute;
  z-index: -1;
  filter: blur(12px);
}

.date {
  margin-top: clamp(3px, 1vh, 10px);
  font-size: clamp(11px, 1.65vmin, 14px);
  font-weight: 550;
  line-height: 1.4;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  white-space: nowrap;
}

.themes {
  position: absolute;
  z-index: 2;
  top: max(clamp(12px, 2.8vmin, 28px), env(safe-area-inset-top));
  left: max(clamp(12px, 2.8vmin, 28px), env(safe-area-inset-left));
  display: flex;
  gap: 2px;
}

.themes button {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 44px;
  padding: 0 10px;
  border: 0;
  background: transparent;
  color: color-mix(in srgb, var(--ink) 81%, var(--sky));
  font: 550 13px/1 "Geist Mono", ui-monospace, monospace;
  text-transform: lowercase;
  cursor: pointer;
}

.themes button::before {
  content: "";
  width: 8px;
  height: 8px;
  border: 1px solid color-mix(in srgb, var(--ink) 55%, transparent);
  border-radius: 50%;
  background: var(--theme-dot, transparent);
}

.themes [data-mode="day"] { --theme-dot: #eae5c9; }
.themes [data-mode="night"] { --theme-dot: #14233c; }

.themes button::after {
  content: "";
  position: absolute;
  inset: 6px 0;
  border: 1px solid transparent;
  border-radius: 4px;
  pointer-events: none;
}

.themes button:is(:hover, [aria-pressed="true"]) { color: var(--ink); }
.themes button[aria-pressed="true"]::after {
  border-color: color-mix(in srgb, var(--ink) 37%, transparent);
}

.sheep {
  position: absolute;
  top: 0;
  left: 0;
  pointer-events: auto;
  border: 0;
  padding: 0;
  border-radius: 35%;
  background: transparent;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

:focus-visible { outline: 2px dashed var(--focus); outline-offset: 3px; }

@media (max-height: 420px) {
  .clock { top: 37%; }
  .themes button { padding-inline: 8px; }
}
