:root {
  --night: #000000;        /* the night: black */
  --day: #ffffff;          /* the day: white */
  --night-star: #ffffff;   /* the stars at night */
  --day-star: #111111;     /* the stars by day, ink dots */
  --line-night: rgba(170, 168, 214, 0.42); /* the thin constellation lines at night, a grey lilac */
  --line-day: rgba(0, 0, 0, 0.28);         /* the same lines by day */
  --mono: "Geist Mono Variable", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  overflow: hidden;
  background: var(--night);
  font-family: var(--mono);
  -webkit-font-smoothing: antialiased;
}

.page {
  position: relative;
  width: 100%;
  height: 100vh;
  min-height: 300px;
  overflow: hidden;
}

/* every layer has its own pair of colours, tweened one after the other */
.layer { --bg: var(--night); --fg: var(--day); color: var(--fg); }
/* the small parts carry their own colours too, so each one turns when the wave touches it */
.brand, .nav, .panel, .ticker__col { color: var(--fg); }

/* ---------------------------------------------------------------- sky */
.sky { position: absolute; inset: 0; background: var(--bg); }
.sky__wipe {
  position: absolute;
  inset: 0;
  background: var(--wipe, #fff);
  clip-path: circle(0px at 50% 50%);
  will-change: clip-path;
}
.sky__stars { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }

/* ---------------------------------------------------------------- header */
.head {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: clamp(14px, 4.4vh, 34px) clamp(16px, 4vw, 44px);
  z-index: 3;
}
.brand { display: flex; align-items: center; gap: 10px; color: inherit; text-decoration: none; }
.brand__mark { width: clamp(20px, 3.4vh, 26px); height: clamp(20px, 3.4vh, 26px); fill: currentColor; overflow: visible; }
.brand__small { transform-origin: 19.2px 6.2px; }
.brand__name {
  display: flex;
  flex-direction: column;
  font-size: clamp(13px, 2.2vh, 16px);
  font-weight: 560;
  letter-spacing: 0.02em;
  line-height: 1.05;
}
.brand__sub {
  font-size: 9.5px;
  font-weight: 400;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  opacity: 0.55;
  margin-top: 3px;
}
.nav { display: flex; gap: clamp(14px, 2.6vw, 28px); align-items: center; }
.nav a {
  color: inherit;
  text-decoration: none;
  font-size: 11px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  position: relative;
}
.nav__join {
  padding: 8px 14px;
  border: 1px solid currentColor;
  transition: background-color 0.25s ease, color 0.25s ease;
}
@media (hover: hover) {
  .nav a:not(.nav__join) { transition: opacity 0.25s ease; }
  .nav:hover a:not(.nav__join):not(:hover) { opacity: 0.45; }
  .nav__join:hover { background: var(--fg); color: var(--bg); }
}

/* ---------------------------------------------------------------- panel */
.panel {
  position: absolute;
  left: clamp(16px, 4vw, 44px);
  top: 50%;
  translate: 0 -58%;
  width: min(340px, calc(100% - 32px));
  padding: clamp(16px, 3.4vh, 26px) clamp(16px, 2.6vw, 24px);
  background: var(--bg);
  border: 1px solid var(--fg);
  z-index: 2;
}
.panel__close {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
  border-radius: 2px;
}
.panel__close svg { width: 11px; height: 11px; stroke: currentColor; stroke-width: 1.3; fill: none; stroke-linecap: round; transition: transform 0.35s cubic-bezier(.3, 1.6, .5, 1); }
@media (hover: hover) {
  .panel__close:hover svg { transform: rotate(90deg); }
}
.panel__close:active svg { transform: scale(0.8); }
.label {
  display: block;
  font-size: 10.5px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  opacity: 0.55;
  line-height: 1.3;
}
.panel__title {
  font-size: clamp(16px, 3vh, 22px);
  font-weight: 460;
  line-height: 1.18;
  letter-spacing: -0.01em;
  margin: 10px 0 clamp(12px, 2.6vh, 20px);
}
.panel__row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding-top: 12px;
  border-top: 1px solid color-mix(in srgb, var(--fg) 30%, transparent);
  font-size: 10.5px;
  letter-spacing: 0.12em;
}
.panel__when { opacity: 0.8; white-space: nowrap; }
.panel__book {
  color: inherit;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  text-transform: uppercase;
}
.panel__book svg { width: 10px; height: 10px; stroke: currentColor; stroke-width: 1.4; fill: none; transition: transform 0.35s cubic-bezier(.3, 1.6, .5, 1); }
@media (hover: hover) {
  .panel__book:hover svg { transform: translate(2px, -2px); }
}

/* ---------------------------------------------------------------- ticker */
.ticker {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  padding: 0 clamp(16px, 4vw, 44px) clamp(14px, 4vh, 30px);
  z-index: 3;
}
.ticker__col { display: flex; flex-direction: column; align-items: flex-start; min-width: 0; }
.ticker__col--sun { align-items: center; }
.ticker__col--right { align-items: flex-end; }
.value {
  display: block;
  font-size: clamp(16px, 3vh, 22px);
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
  white-space: nowrap;
  margin: 2px 0 1px;
}
.clock { min-width: 11ch; }
.sub {
  display: block;
  font-size: 10px;
  letter-spacing: 0.2em;
  opacity: 0.45;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.gauge { width: 96px; height: 32px; overflow: visible; margin: 6px 0 4px; }
.gauge__arc { fill: none; stroke: currentColor; stroke-width: 1; stroke-dasharray: 2 3; opacity: 0.45; }
.gauge__line { stroke: currentColor; stroke-width: 1; opacity: 0.7; }
.gauge__sun { fill: var(--bg); stroke: currentColor; stroke-width: 1.2; }

/* the switch: a 104 x 28 pill with a 1 px edge, as on the site */
.switch {
  --w: 104px;
  --h: 28px;
  --knob: 22px;
  position: relative;
  width: var(--w);
  height: var(--h);
  border: 1px solid currentColor;
  border-radius: 999px;
  background: transparent;
  color: inherit;
  font: inherit;
  font-size: 10.5px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  cursor: pointer;
  margin-bottom: 9px;
  -webkit-tap-highlight-color: transparent;
}
.switch:focus-visible { outline: 1px solid currentColor; outline-offset: 3px; }
.switch__word {
  position: absolute;
  top: 50%;
  translate: 0 -50%;
  line-height: 1;
  white-space: nowrap;
  pointer-events: none;
}
.switch__word--night { left: 13px; }
.switch__word--day { right: 15px; }
.switch__knob {
  position: absolute;
  top: 50%;
  left: 2px;
  width: var(--knob);
  height: var(--knob);
  margin-top: calc(var(--knob) / -2);
}
.switch__squash {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: currentColor;
  display: grid;
  place-items: center;
  box-shadow: 0 1px 0 color-mix(in srgb, var(--fg) 25%, transparent);
}
.switch__icon {
  grid-area: 1 / 1;
  width: 13px;
  height: 13px;
  color: var(--bg);
  overflow: visible;
}
.switch__icon--sun circle { fill: currentColor; }
.switch__icon--sun path { stroke: currentColor; stroke-width: 1.4; stroke-linecap: round; fill: none; }
.switch__icon--moon path { fill: currentColor; }

.status {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 5px;
}
.status__text {
  font-size: 10px;
  letter-spacing: 0.2em;
  opacity: 0.55;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.status__line {
  display: block;
  width: 100%;
  min-width: 120px;
  height: 1px;
  background: color-mix(in srgb, var(--fg) 18%, transparent);
  overflow: hidden;
}
.status__line span { display: block; height: 100%; background: currentColor; transform-origin: 0 50%; transform: scaleX(0); }

/* ---------------------------------------------------------------- narrow */
@media (max-width: 620px) {
  .ticker__col--sun { display: none; }
  .nav__wide { display: none; }
}
@media (max-width: 420px) {
  .nav a:not(.nav__join) { display: none; }
  .panel { left: 50%; translate: -50% -56%; width: calc(100% - 32px); }
  .ticker { gap: 10px; }
  .status__line { min-width: 96px; }
  .status__text { font-size: 9px; letter-spacing: 0.14em; }
  .value { font-size: 16px; }
}
@media (max-height: 460px) {
  .panel__title { margin: 6px 0 10px; }
  .panel { padding: 14px 16px; translate: 0 -60%; }
}
@media (max-height: 460px) and (max-width: 420px) {
  .panel { translate: -50% -60%; }
}
