/* The offices clock with the odometer digits: the card of a made-up executive search firm (Halden Row) on a warm
   light page. A big clock with the real time of each office, a row of cities and three numbers of the firm. */
:root {
  --page: #ecebe6;          /* the page */
  --page-light: #f7f6f2;    /* the soft light on the page */
  --card: #fbfaf8;          /* the body of the card */
  --well: #f1f0ec;          /* the well behind the cities and the numbers */
  --ink: #16171a;           /* the words and the digits */
  --muted: #7b7c80;         /* the small words */
  --line: rgba(22, 23, 26, 0.08); /* the thin lines */
  --accent: #ff5b24;        /* ember: the running hairline, the open office, the accent tile */
  --accent-ink: #250c02;    /* the words on the accent tile */
  --rim: #ffffff;           /* the light the edge of the card catches */
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
  overflow: hidden;
}

body {
  background:
    radial-gradient(70% 60% at 30% 18%, var(--page-light), transparent 70%),
    var(--page);
  color: var(--ink);
  font-family: 'Mona Sans Variable', 'Mona Sans', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.stage {
  position: relative;
  height: 100vh;
  display: grid;
  place-items: center;
  padding: min(4vw, 4vh);
  overflow: hidden;
}

.sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* ---------------------------------------------------------------- the card */
.card {
  --pad: clamp(14px, min(4.6vw, 4.4vh), 26px);
  --lx: 22%;
  --ly: 0%;
  --lit: 0.55;
  position: relative;
  width: min(452px, 100%);
  padding: var(--pad);
  border-radius: clamp(18px, min(5vw, 5vh), 26px);
  background: linear-gradient(180deg, #fefefd, var(--card) 40%);
  box-shadow:
    0 0 0 1px rgba(22, 23, 26, 0.06),
    0 1px 1px rgba(22, 23, 26, 0.04),
    0 4px 8px -2px rgba(22, 23, 26, 0.05),
    0 18px 32px -12px rgba(22, 23, 26, 0.12),
    0 44px 70px -30px rgba(22, 23, 26, 0.18);
  opacity: 0;
}

/* the 1px edge that catches the light where the pointer is */
.card__rim {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  background: radial-gradient(240px 180px at var(--lx) var(--ly), rgba(255, 255, 255, var(--lit)), rgba(255, 255, 255, 0) 70%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.9), rgba(255, 255, 255, 0) 30%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
  pointer-events: none;
  z-index: 3;
}

/* a soft sheen on the face, under the same light */
.card__shine {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: radial-gradient(320px 220px at var(--lx) var(--ly), rgba(255, 255, 255, calc(var(--lit) * 0.7)), rgba(255, 255, 255, 0) 70%);
  pointer-events: none;
  z-index: 0;
}

.card > *:not(.card__rim):not(.card__shine) {
  position: relative;
  z-index: 1;
}

.card__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: clamp(12.5px, min(3.6vw, 3.4vh), 14.5px);
  font-weight: 620;
  font-stretch: 108%;
  letter-spacing: -0.01em;
}

.brand__mark {
  width: 1.55em;
  height: 1.55em;
  fill: var(--ink);
  stroke: none;
}

.brand__mark path {
  fill: none;
  stroke: var(--card);
  stroke-width: 1.7;
  stroke-linecap: round;
}

.tag {
  font-family: 'Geist Mono Variable', ui-monospace, monospace;
  font-size: clamp(9px, min(2.6vw, 2.4vh), 10.5px);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 0.45em 0.8em;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.6);
}

/* ---------------------------------------------------------------- the clock */
.clock {
  margin-top: clamp(12px, min(4.4vw, 4vh), 26px);
}

.clock__label {
  margin: 0 0 clamp(2px, 1vh, 8px);
  font-size: clamp(10.5px, min(3vw, 2.9vh), 12.5px);
  color: var(--muted);
  letter-spacing: 0.005em;
}

.clock__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

/* a small dial with the same office's time, its hands turning to the new city */
.dial {
  flex: none;
  width: clamp(48px, min(15vw, 13vh), 86px);
  height: auto;
  overflow: visible;
  filter: drop-shadow(0 6px 10px rgba(22, 23, 26, 0.08));
}

.dial__face {
  fill: #fff;
  stroke: rgba(22, 23, 26, 0.1);
  stroke-width: 1;
}

.dial__ticks line {
  stroke: rgba(22, 23, 26, 0.28);
  stroke-width: 1.2;
  stroke-linecap: round;
}

.dial__ticks line.is-major {
  stroke: rgba(22, 23, 26, 0.7);
  stroke-width: 2;
}

.dial__hour,
.dial__min {
  stroke: var(--ink);
  stroke-linecap: round;
}

.dial__hour {
  stroke-width: 4;
}

.dial__min {
  stroke-width: 2.6;
}

.dial__sec {
  stroke: var(--accent);
  stroke-width: 1.2;
  stroke-linecap: round;
}

.dial__hub {
  fill: #fff;
  stroke: var(--accent);
  stroke-width: 1.4;
}

.clock__window {
  flex: 1;
  min-width: 0;
  --lh: 1.08em;
  position: relative;
  font-size: clamp(42px, min(15.4vw, 13.6vh), 88px);
  height: var(--lh);
  overflow: hidden;
  -webkit-mask-image: linear-gradient(180deg, transparent, #000 9%, #000 91%, transparent);
  mask-image: linear-gradient(180deg, transparent, #000 9%, #000 91%, transparent);
}

.clock__reel {
  will-change: transform;
}

.line {
  display: flex;
  align-items: center;
  height: var(--lh);
  gap: 0.16em;
  white-space: nowrap;
}

.line__time {
  display: inline-flex;
  align-items: flex-start;
  font-weight: 520;
  font-stretch: 92%;
  letter-spacing: -0.035em;
  font-variant-numeric: tabular-nums;
  line-height: var(--lh);
}

.colon {
  display: inline-block;
  height: var(--lh);
  line-height: 0.98em;
  opacity: 0.32;
  padding: 0 0.02em;
}

.line__side {
  display: inline-grid;
  gap: 0.18em;
  align-self: center;
  margin-left: 0.1em;
  font-family: 'Geist Mono Variable', ui-monospace, monospace;
  font-size: 0.17em;
  letter-spacing: 0.06em;
  line-height: 1;
}

.line__ampm {
  color: var(--muted);
}

.line__code {
  font-weight: 560;
}

/* an odometer digit: a column 0-9 0-9 behind a window one line tall */
.d {
  display: inline-block;
  height: var(--lh);
  overflow: hidden;
  vertical-align: top;
}

.d__nudge,
.d__col {
  display: block;
  will-change: transform;
}

.d__col > span {
  display: block;
  height: var(--lh);
  line-height: var(--lh);
  text-align: center;
}

.ch {
  display: inline-block;
  height: var(--lh);
  line-height: var(--lh);
}

.clock__sub {
  position: relative;
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-top: clamp(2px, 0.8vh, 6px);
  height: 1.4em;
  overflow: hidden;
  font-size: clamp(11px, min(3.2vw, 3vh), 13px);
}

.sub__slot {
  position: relative;
  flex: 1;
  height: 1.4em;
}

.sub__slot > span {
  position: absolute;
  inset: 0 auto 0 0;
  line-height: 1.4em;
  white-space: nowrap;
}

.sub__slot--right > span {
  inset: 0 0 0 auto;
  color: var(--muted);
  font-family: 'Geist Mono Variable', ui-monospace, monospace;
  font-size: 0.86em;
  line-height: 1.628em;
  letter-spacing: 0.04em;
}

.sub__slot--right .is-open {
  color: var(--accent);
}

/* ---------------------------------------------------------------- the cities */
.cities {
  position: relative;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  margin-top: clamp(10px, min(4vw, 3.6vh), 22px);
  padding: 3px;
  border-radius: 999px;
  background: var(--well);
  box-shadow: inset 0 1px 2px rgba(22, 23, 26, 0.06), inset 0 0 0 1px rgba(22, 23, 26, 0.035);
}

.cities__pill {
  position: absolute;
  top: 3px;
  bottom: 3px;
  left: 0;
  width: 10px;
  border-radius: 999px;
  background: #fff;
  box-shadow:
    0 0 0 1px rgba(22, 23, 26, 0.05),
    0 1px 2px rgba(22, 23, 26, 0.08),
    0 4px 10px -4px rgba(22, 23, 26, 0.16);
  overflow: hidden;
  will-change: transform;
}

/* the hairline that runs under the city on show: the five seconds before the next one */
.cities__fill {
  position: absolute;
  left: 22%;
  right: 22%;
  bottom: 3px;
  height: 1.5px;
  border-radius: 2px;
  background: var(--accent);
  transform-origin: 0 50%;
  transform: scaleX(0);
}

.city {
  position: relative;
  z-index: 1;
  appearance: none;
  border: 0;
  background: none;
  font: inherit;
  font-size: clamp(10.5px, min(3vw, 2.9vh), 13px);
  font-weight: 520;
  font-stretch: 100%;
  color: var(--muted);
  padding: clamp(7px, min(2.2vw, 2vh), 10px) 2px;
  border-radius: 999px;
  cursor: pointer;
  white-space: nowrap;
  transition: color 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

.city.is-on {
  color: var(--ink);
}

.city:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

/* ---------------------------------------------------------------- the numbers */
.stats {
  display: grid;
  grid-template-columns: 1fr 0.82fr 1.32fr;
  gap: clamp(5px, 1.6vw, 8px);
  margin-top: clamp(10px, min(3.6vw, 3.2vh), 18px);
}

.stat {
  position: relative;
  padding: clamp(9px, min(2.8vw, 2.6vh), 14px) clamp(8px, min(2.6vw, 2.4vh), 13px);
  border-radius: clamp(12px, min(3.4vw, 3.2vh), 16px);
  background: var(--well);
  box-shadow: inset 0 0 0 1px rgba(22, 23, 26, 0.035);
  overflow: hidden;
  opacity: 0;
  transition: box-shadow 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.stat--accent {
  background: linear-gradient(160deg, #ff7a45, var(--accent) 55%, #f24d12);
  color: var(--accent-ink);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35), inset 0 0 0 1px rgba(160, 40, 0, 0.18), 0 8px 18px -10px rgba(255, 91, 36, 0.6);
}

.stat.is-over {
  box-shadow: inset 0 0 0 1px rgba(22, 23, 26, 0.09), 0 6px 16px -10px rgba(22, 23, 26, 0.3);
}

.stat--accent.is-over {
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.45), inset 0 0 0 1px rgba(160, 40, 0, 0.22), 0 12px 24px -10px rgba(255, 91, 36, 0.75);
}

.stat__num {
  --lh: 1.08em;
  display: flex;
  font-size: clamp(19px, min(6.2vw, 5.4vh), 31px);
  font-weight: 540;
  font-stretch: 90%;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
  height: var(--lh);
  -webkit-mask-image: linear-gradient(180deg, transparent, #000 12%, #000 88%, transparent);
  mask-image: linear-gradient(180deg, transparent, #000 12%, #000 88%, transparent);
}

.stat__cap {
  display: block;
  margin-top: clamp(3px, 1vh, 8px);
  font-size: clamp(9.5px, min(2.7vw, 2.6vh), 11.5px);
  line-height: 1.3;
  color: var(--muted);
}

.stat--accent .stat__cap {
  color: rgba(37, 12, 2, 0.72);
}

@media (hover: hover) {
  .city:hover {
    color: var(--ink);
  }
  .stat {
    cursor: default;
  }
}

/* ---------------------------------------------------------------- the pointer of the walk on its own */
.cursor {
  position: absolute;
  left: 0;
  top: 0;
  width: 22px;
  height: 22px;
  fill: var(--ink);
  stroke: #fff;
  stroke-width: 1.4;
  stroke-linejoin: round;
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.25));
  pointer-events: none;
  opacity: 0;
  z-index: 10;
}

@media (prefers-reduced-motion: reduce) {
  .city,
  .stat {
    transition: none;
  }
}
