:root {
  --ink: #000;
  --paper: #fff;
  --muted: rgba(255, 255, 255, 0.6);
  --sans: "Helvetica Neue", "Segoe UI", Arial, "PingFang SC", "Microsoft YaHei", sans-serif;
  --mono: "SFMono-Regular", "Cascadia Mono", Consolas, "Liberation Mono", monospace;
  --pad: clamp(24px, 3.9vw, 58px);
  --ease: cubic-bezier(0.65, 0.05, 0.36, 1);
}

* {
  box-sizing: border-box;
}

html {
  height: 100%;
  -webkit-text-size-adjust: 100%;
  scrollbar-width: none;
}

html::-webkit-scrollbar,
body::-webkit-scrollbar {
  width: 0;
  height: 0;
}

body {
  min-height: 100vh;
  min-height: 100svh;
  margin: 0;
  overflow-x: hidden;
  overflow-y: auto;
  background: var(--ink);
  color: var(--paper);
  font-family: var(--sans);
  isolation: isolate;
}

::selection {
  background: var(--paper);
  color: var(--ink);
}

/* ------------------------------------------------------------------ scene */

.scene {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  background: var(--ink);
  pointer-events: none;
}

.slab {
  position: absolute;
  inset: -12% -35%;
  background: var(--paper);
  clip-path: polygon(64% 0, 100% 0, 100% 100%, 26% 100%);
  transform: translate3d(-2.5%, 0, 0);
  animation: slab-drift 13s var(--ease) infinite alternate;
  will-change: transform;
}

@keyframes slab-drift {
  from {
    transform: translate3d(-2.5%, 0, 0);
  }
  to {
    transform: translate3d(4.5%, 0, 0);
  }
}

.scan {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 240vmax;
  height: 1px;
  margin-left: -120vmax;
  background: var(--paper);
  mix-blend-mode: difference;
  opacity: 0;
  animation: scan-sweep 11s linear infinite;
  will-change: transform;
}

@keyframes scan-sweep {
  0% {
    transform: translateY(-68vh) rotate(62deg);
    opacity: 0;
  }
  10% {
    opacity: 0.38;
  }
  90% {
    opacity: 0.38;
  }
  100% {
    transform: translateY(68vh) rotate(62deg);
    opacity: 0;
  }
}

/* ------------------------------------------------------------------- page */

.page {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  min-height: 100vh;
  min-height: 100svh;
  padding: var(--pad);
  color: var(--paper);
  mix-blend-mode: difference;
}

.topbar {
  position: absolute;
  top: var(--pad);
  left: var(--pad);
  display: flex;
  align-items: center;
  font-family: var(--mono);
  font-size: 10px;
  line-height: 1;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  display: block;
  width: 13px;
  height: 13px;
  border: 1px solid currentColor;
  background: linear-gradient(135deg, currentColor 0 50%, transparent 50% 100%);
}

.brand-name {
  font-weight: 700;
  letter-spacing: 0.2em;
}

.brand-slash {
  margin: 0 0.35em;
  font-weight: 400;
  opacity: 0.45;
}

/* ----------------------------------------------------------------- footer */

.footer {
  position: relative;
  z-index: 2;
  display: flex;
  flex-wrap: wrap;
  gap: 0 0.8em;
  padding: 0 var(--pad) var(--pad);
  margin-top: -2px;
  font-family: var(--mono);
  font-size: 10px;
  line-height: 1.6;
  letter-spacing: 0.08em;
  color: var(--paper);
  opacity: 0.55;
}

.footer a {
  color: inherit;
  text-decoration: none;
}

.footer a:hover {
  text-decoration: underline;
}

/* ------------------------------------------------------------------ clock */

.clock {
  position: relative;
  min-width: 0;
  text-align: left;
}

.clock-head {
  margin: 0;
  font-weight: inherit;
  font-size: inherit;
  position: absolute;
  left: 0;
  bottom: calc(100% + clamp(12px, 2vh, 22px));
  display: flex;
  align-items: baseline;
  gap: 12px;
  white-space: nowrap;
}

.label {
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

.label-cn {
  font-size: 11px;
  letter-spacing: 0.12em;
  color: var(--muted);
}

.time {
  margin: 0;
  font-family: var(--sans);
  font-size: clamp(72px, min(18vw, 34vh), 300px);
  font-weight: 600;
  line-height: 0.82;
  letter-spacing: -0.055em;
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
  white-space: nowrap;
}

/* ------------------------------------------------------------------ orbit */

.orbit {
  position: fixed;
  top: -12vmax;
  right: -14vmax;
  z-index: -1;
  width: 58vmax;
  height: 58vmax;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 50%;
  pointer-events: none;
  animation: spin 64s linear infinite;
}

.orbit::before {
  content: "";
  position: absolute;
  inset: 9%;
  border: 1px dashed rgba(255, 255, 255, 0.22);
  border-radius: 50%;
}

.orbit::after {
  content: "";
  position: absolute;
  top: -4px;
  left: 50%;
  width: 7px;
  height: 7px;
  margin-left: -3.5px;
  border-radius: 50%;
  background: var(--paper);
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ---------------------------------------------------------------- offline */

body.is-offline .clock {
  opacity: 0.35;
  transition: opacity 0.3s linear;
}

@media (prefers-reduced-motion: reduce) {
  .slab,
  .scan,
  .orbit {
    animation: none !important;
  }

  .slab {
    transform: none;
  }

  .scan {
    transform: translateY(0) rotate(62deg);
    opacity: 0.25;
  }
}
