@font-face {
  font-family: "Instrument Serif";
  src: url("/fonts/instrument-serif.woff2") format("woff2");
  font-style: normal; font-weight: 400; font-display: swap;
}
@font-face {
  font-family: "Instrument Serif";
  src: url("/fonts/instrument-serif-italic.woff2") format("woff2");
  font-style: italic; font-weight: 400; font-display: swap;
}
@font-face {
  font-family: "Apfel Grotezk";
  src: url("/fonts/apfel-grotezk.woff2") format("woff2");
  font-weight: 400; font-display: swap;
}

:root {
  --black: #141414;
  --bone: #f2ece0;
  --orange: #da5328;
  --amber: #e2ae4a;
  --red: #ef6a7a;
  --signal: #e8372c; /* the seconds hand: a railway red, apart from the palette */
  --green: #52c08f;
  --sky: #72b4f0;

  --serif: "Instrument Serif", "Times New Roman", serif;
  --sans: "Apfel Grotezk", system-ui, sans-serif;
  --gutter: clamp(1.25rem, 4.5vw, 5rem);
  --hair: max(1.5px, .12vw);
  /* Target size: from width and height, so it never swamps short or tall screens */
  --tg: clamp(6rem, min(17vw, 34svh), 22rem);
  --pip: clamp(.5rem, .8vw, 1rem); /* one square of the palette switch */
  /* The clock's three lines, and so its height, for layouts that hang things from it */
  --tk: clamp(.8rem, .7rem + .3vw, 1.1rem);
  --tv: clamp(2.4rem, 4.2vw, 6rem);
  --time-h: calc(var(--tk) * 1.45 * (1 + var(--k-extra, 0)) + var(--tv) * 1.3 + var(--tk) * 1.45 * (1 + var(--diff-extra, 0)));
  /* The inner right-hand line in the bespoke narrow and tall layouts: the clock, the dots
     and the target all end on it, a step in from the day bar */
  --rail: calc(var(--gutter) + var(--pip) + .75rem);
  /* The day bar starts at least this far down, clear of the colour squares above it
     (their foot: the gutter, plus their padding, three squares and two gaps, then room to breathe) */
  --bar-clear: calc(var(--gutter) + .75rem + 3 * var(--pip) + 1.1vw + clamp(2.5rem, 4vw, 4rem));
  /* Where the target sits: its right and top. The labels that hang off it follow these. */
  --tr: 21%;
  --tt: 24%;
  --t: 240ms;
  --ease: cubic-bezier(.2, .7, .2, 1);

  /* Palette roles; palette.js picks one at random on each load */
  --field: var(--orange);
  --ink-full: var(--bone);
  --ink: var(--ink-full);
  --ring: var(--sky);
  --core: var(--amber);
}
html[data-theme="orange"] { --field: var(--orange); --ink-full: var(--bone);  --ring: var(--sky);   --core: var(--amber); }
html[data-theme="amber"]  { --field: var(--amber);  --ink-full: var(--black); --ring: var(--sky);   --core: var(--green); } /* not orange: the red seconds hand would vanish into it */
html[data-theme="red"]    { --field: var(--red);    --ink-full: var(--black); --ring: var(--amber); --core: var(--sky); }
html[data-theme="green"]  { --field: var(--green);  --ink-full: var(--black); --ring: var(--sky);   --core: var(--amber); } /* not a red ring: the seconds disc crosses it */
html[data-theme="sky"]    { --field: var(--sky);    --ink-full: var(--black); --ring: var(--amber); --core: var(--green); }

/* Night in Auckland (clock.js sets data-night): the ink sinks a little into the field and the grain thickens */
@property --ink { syntax: "<color>"; inherits: true; initial-value: #f2ece0; }
@supports (color: color-mix(in srgb, red, blue)) {
  html[data-night] { --ink: color-mix(in srgb, var(--ink-full) 80%, var(--field)); }
}
html[data-night] body::after { opacity: .42; }

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; overflow-x: hidden; overflow-x: clip; }
body {
  margin: 0;
  background: var(--field);
  color: var(--ink);
  font-family: var(--sans);
}
/* Print grain */
body::after {
  content: ""; position: fixed; inset: 0; z-index: 10; pointer-events: none;
  opacity: .28; mix-blend-mode: soft-light;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.95' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
a { color: inherit; }
button { -webkit-tap-highlight-color: transparent; }
::selection { background: var(--ink); color: var(--field); }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 6px; }

/* ---------- Home ---------- */
.home {
  position: relative;
  min-height: 100vh;
  min-height: 100svh;
  display: grid;
  grid-template-rows: auto 1fr;
  padding: var(--gutter);
  overflow: hidden;
  overflow: clip;
}

.brand { position: relative; z-index: 2; display: grid; justify-content: start; row-gap: 1rem; }
.logo-link { display: block; color: var(--ink); }
.logo { display: block; width: clamp(9rem, 16vw, 19rem); height: auto; }
/* Auckland time, bottom right: large serif digits that cut over each minute */
.time {
  position: absolute; z-index: 2;
  right: calc(var(--gutter) + clamp(1.5rem, 2.5vw, 3rem));
  bottom: calc(var(--gutter) + 1.75rem);
  text-align: right;
}
.time { margin-right: calc(var(--tv) * .3); } /* room for am/pm, which hangs outside the right edge */
.time[hidden] { display: none; }
.time__k, .time__diff { margin: 0; }
.time__k { font-family: var(--sans); font-size: var(--tk); line-height: 1.45; }
.time__s { display: block; } /* what Jans is up to, on its own line above the place */
/* Dot-matrix digits (clock.js builds them): 5x7 cells, one em tall */
/* The digits end on the same right edge as the lines above and below; am/pm hangs just outside it */
.time__v { font-size: var(--tv); line-height: 1; margin-block: .15em; pointer-events: auto; /* point at it to spell "my local time" (clock.js) */ }
.dm { display: flex; justify-content: flex-end; gap: .16em; height: 1em; }
.dm i { display: grid; grid-template-columns: repeat(5, 1fr); grid-template-rows: repeat(7, 1fr); width: .714em; }
.dm i.colon { grid-template-columns: 1fr; width: .143em; }
.dm b { border-radius: 50%; background: var(--ink); scale: 0; transition: scale var(--t) var(--ease); }
.dm b.on { scale: .8; }
.dm { position: relative; }
/* am/pm: two small letters stacked just outside the digits, so the clock itself doesn't move */
.dm__ap { position: absolute; left: 100%; bottom: 0; margin-left: .12em; display: grid; gap: .06em; }
.dm .dm__ap i { width: .15em; height: .21em; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
@media (prefers-reduced-motion: reduce) { .dm b { transition: none; } }
.time__diff { font-family: var(--sans); font-size: var(--tk); line-height: 1.45; min-height: 1.45em; white-space: pre-line; } /* the same type as the place line above, whatever it says */

/* Headline: upright caps, italic connectives */
.line {
  position: relative; z-index: 2;
  align-self: end; justify-self: start; /* only as wide as the words, so it never covers the dots */
  margin: 0;
  font-family: var(--serif); font-weight: 400;
  font-size: clamp(2.4rem, min(8.6vw, 16svh), 13rem); /* the longest line stops short of the hanging city name */
  line-height: .9; letter-spacing: -.012em;
  text-transform: uppercase;
}
.l { display: block; }
/* --stack-* are set where a layout has the height to stack the headline into four lines:
   the verb drops to its own line, and the second line wraps to two, the last one indented */
.l--2 { padding-left: .5em; text-indent: var(--stack-outdent, 0); max-width: var(--stack-measure, none); text-wrap: balance; }
.line em { font-style: italic; text-transform: none; letter-spacing: 0; }
/* When the headline changes on its timer (palette.js), the old words wipe away and the new ones wipe in */
.line [data-does] { display: var(--stack-verb, inline-block); width: fit-content; margin-left: var(--stack-indent, 0); }
@media (prefers-reduced-motion: no-preference) {
  .line .is-set { animation: none; }
  .line .is-leaving { animation: wipe-out 200ms cubic-bezier(.5, 0, .9, .5) both; } /* 200ms: WIPE_OUT in palette.js */
  .line .is-reprint { animation: wipe-in 420ms var(--ease) both; }
  .line .l.is-reprint { animation-duration: 640ms; animation-delay: 80ms; } /* the longer line takes longer */
}
.line .lc, .line.is-plain { text-transform: none; } /* palette.js: every other headline is in ordinary case */

/* Headline plus a sentence of plain copy */
.copy {
  position: relative; z-index: 2;
  align-self: end; justify-self: start;
  display: grid; row-gap: clamp(2rem, 3.4vw, 3.25rem); /* room between the headline and the sentence; caps sit right on the line */
}
.copy .line { align-self: auto; justify-self: start; }
.blurb {
  margin: 0; max-width: min(58ch, 46vw); /* three lines on a wide screen, and short of the city name and the clock */
  font-family: var(--sans); font-size: clamp(1.05rem, .9rem + .55vw, 1.6rem); line-height: 1.52;
  text-wrap: pretty;
  transition: color var(--t) var(--ease);
}
.blurb a {
  color: var(--ink); /* its own colour, so it holds when the sentence fades */
  transition: color var(--t) var(--ease);
  text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: .2em;
}
/* Pointing at a link doesn't highlight it: everything else in the sentence steps back instead */
.blurb:has(a:focus-visible) { color: color-mix(in srgb, var(--ink) 30%, var(--field)); }
.blurb:has(a:focus-visible) a:not(:focus-visible) { color: inherit; }
@media (hover: hover) {
  .blurb:has(a:hover) { color: color-mix(in srgb, var(--ink) 30%, var(--field)); }
  .blurb:has(a:hover) a:not(:hover) { color: inherit; }
}

/* The signature line (sign.js), under the logo: a short line of packed dots that drop into
   dot-matrix names beneath it. Every size is in cells of --p, the dot pitch. */
.sign {
  --p: clamp(3px, .28vw, 5px);
  position: relative; z-index: 3;
  width: calc(var(--line) * var(--p)); height: var(--p);
}
/* While open, an invisible pad joins the line to the names so the pointer can travel between them */
.sign.is-open::before, .sign.is-peeking::before {
  content: ""; position: absolute; left: 0; top: 0;
  width: calc(var(--cols) * var(--p)); height: calc((var(--drop) + 8) * var(--p));
}
.sign__line {
  position: absolute; left: 0; top: calc(var(--p) / 2 - 22px);
  width: 100%; height: 44px;
  padding: 0; border: 0; background: none; cursor: pointer;
}
.sign__word {
  position: absolute; top: calc(var(--drop) * var(--p)); left: calc(var(--at) * var(--p));
  width: calc(var(--w) * var(--p)); height: calc(7 * var(--p));
  pointer-events: none;
}
.is-open .sign__word, .is-peeking .sign__word { pointer-events: auto; }
.sign__word b {
  position: absolute; left: 0; top: 0;
  width: var(--p); height: var(--p); border-radius: 50%;
  background: var(--ink);
  translate: calc(var(--rx) * var(--p)) calc(var(--ry) * var(--p));
  scale: .55;
}
.is-open .sign__word b { translate: calc(var(--x) * var(--p)) calc(var(--y) * var(--p)); scale: .85; }
/* .is-peeking (hints.js): the line spells "get in touch?" for a moment instead, with no link behind
   it. The hint's dots wait unseen in the line; while they show, the link's dots fade out of it.
   It's set at half size: a quiet question, not a second name. In the line its dots are the line's
   size, so the handover back is seamless. */
.sign__hint b { opacity: 0; }
.is-peeking .sign__hint b { opacity: 1; translate: calc(var(--x) * var(--p) / 2) calc(var(--y) * var(--p) / 2); scale: .425; }
.is-peeking .sign__word:not(.sign__hint) b { opacity: 0; }
.is-open .sign__hint { pointer-events: none; }
.is-open .sign__hint b { opacity: 0; translate: calc(var(--rx) * var(--p)) calc(var(--ry) * var(--p)); scale: .55; }
/* When the peek ends, the hint's dots fly back into the line before they fade, and the link's dots
   reappear once they've landed. When it starts, both swap at once. */
.sign__word b { transition: translate 460ms var(--ease) calc(var(--d) * 5ms), scale var(--t) var(--ease), opacity 160ms var(--ease) 850ms; }
.is-peeking .sign__word b { transition: translate 460ms var(--ease) calc(var(--d) * 5ms), scale var(--t) var(--ease), opacity 120ms var(--ease); }
.is-open .sign__word:hover b, .is-open .sign__word:focus-visible b { scale: 1.1; }
@media (prefers-reduced-motion: reduce) {
  .sign__word b { transition: none; }
}

/* ---------- Screen-print registration ----------
   The second plate prints in the ring colour under the ink, off register.
   clock.js sets --tx/--ty from the visitor's distance from Auckland and the time there;
   palette.js adds --mx/--my, a knock for every palette switch.
   Both are in plate units; --u turns a unit into pixels for this screen. */
:root {
  --tx: 0; --ty: 0; --mx: 0; --my: 0;
  --u: clamp(.5px, .07vw, 1.2px);
  --ox: calc((var(--tx) + var(--mx)) * var(--u));
  --oy: calc((var(--ty) + var(--my)) * var(--u));
}
.line { text-shadow: var(--ox) var(--oy) 0 var(--ring); }
.logo { filter: drop-shadow(var(--ox) var(--oy) 0 var(--ring)); }

/* ---------- Composition, after the mrrbt sleeve ---------- */
.deco > * { position: absolute; display: block; margin: 0; pointer-events: none; }

/* The three squares are also the palette switch */
.pips {
  position: absolute; z-index: 3;
  right: calc(var(--gutter) - .75rem); top: calc(var(--gutter) - .75rem);
  display: grid; gap: .55vw; justify-items: center; align-content: center;
  min-width: 44px; min-height: 44px;
  padding: .75rem;
  border: 0; background: none; cursor: pointer;
}
.pips b {
  display: block; width: var(--pip); aspect-ratio: 1; background: var(--ink);
  transition: rotate 420ms var(--ease), background-color var(--t) var(--ease);
}
/* They are always swatches of the next three colours (palette.js sets --n1..3), each edged in
   ink so it shows on any field. Pointed at or focused, the middle one turns to a diamond. */
.pips b { outline: var(--hair) solid var(--ink); outline-offset: calc(-1 * var(--hair)); }
.pips b:nth-child(1) { background: var(--n1); }
.pips b:nth-child(2) { background: var(--n2); }
.pips b:nth-child(3) { background: var(--n3); }
.pips:focus-visible b:nth-child(2) { rotate: 45deg; }
@media (hover: hover) { .pips:hover b:nth-child(2) { rotate: 45deg; } }
/* hints.js: now and then they bump each other: the top square drops into the next, which knocks
   the bottom one, and all three bounce back, squashing as they land and softening at the corners
   while they show the next colours. Each knock is a little stronger (--a). */
@keyframes pip-bump {
  0%   { translate: 0 0; scale: 1; border-radius: 0; }
  22%  { translate: 0 calc(var(--a) * 4px); scale: 1.14 .8; border-radius: 28%; }
  50%  { translate: 0 calc(var(--a) * -4px); scale: .92 1.1; border-radius: 20%; }
  74%  { translate: 0 calc(var(--a) * 1px); scale: 1.03 .97; }
  100% { translate: 0 0; scale: 1; border-radius: 0; }
}
.pips.is-hinting b { --a: 1; animation: pip-bump 760ms cubic-bezier(.3, 1.3, .5, 1) both; }
.pips.is-hinting b:nth-child(2) { --a: 1.2; rotate: 0deg; animation-delay: 90ms; }
.pips.is-hinting b:nth-child(3) { --a: 1.5; animation-delay: 180ms; }
@media (prefers-reduced-motion: reduce) { .pips.is-hinting b { animation: none; } }

/* The brand's target mark, in the site palette */
.target {
  pointer-events: auto; /* point at it for 4:20 (clock.js) */
  width: var(--tg); aspect-ratio: 1; border-radius: 50%;
  right: var(--tr); top: var(--tt);
  /* The core stays dead centre: it is a clock face, and an off-centre one looks broken */
  background: radial-gradient(circle, var(--core) 0 calc(var(--tg) * .311), var(--ring) 0);
}
/* The target is also a clock face (clock.js sets --hr, --mn and --sec). The hour and minute hands
   are plain black batons, the hour short and heavier, the minute long and fine; the seconds hand is a red rod with a disc
   near its tip, after the railway clock, sweeping round and waiting at 12 each minute. Sizes are in parts of the
   target, so the hands grow with it. */
.target::after {
  content: ""; position: absolute; left: 50%; top: 50%;
  width: 3.4%; aspect-ratio: 1; border-radius: 50%;
  translate: -50% -50%; background: var(--signal);
}
.hand {
  /* All in parts of the target's width (--tg), so the pivot is exactly its centre */
  --tl: calc(var(--tg) * var(--tail)); --wd: calc(var(--tg) * var(--w));
  position: absolute; left: 50%; bottom: calc(50% - var(--tl));
  width: var(--wd); margin-left: calc(var(--wd) / -2);
  height: calc(var(--tg) * var(--len) + var(--tl));
  background: var(--black);
  transform-origin: 50% calc(100% - var(--tl));
}
.hand--h, .hand--m { --tail: .035; }
.hand--h { --w: .026; --len: .22; rotate: var(--hr, 0deg); } /* short and a little heavier */
.hand--m { --w: .014; --len: .41; rotate: var(--mn, 0deg); } /* long and fine */
.hand--s {
  --tail: .12; --w: .011; --len: .37;
  background: var(--signal);
  animation: sweep 60s linear infinite var(--sec, 0s);
}
.hand--s::after {
  content: ""; position: absolute; left: 50%; top: 0;
  width: calc(var(--tg) * .07); aspect-ratio: 1; border-radius: 50%;
  translate: -50% -30%; background: var(--signal);
}
/* Railway seconds: round in 58.5s, then a wait at 12 while the minute hand jumps */
@keyframes sweep { 0% { rotate: 0deg; } 97.5%, 100% { rotate: 360deg; } }
/* The hour and minute hands overshoot a touch and settle, the hour hand a beat behind */
.hand--m { transition: rotate 650ms cubic-bezier(.3, 1.7, .5, 1); }
.hand--h { transition: rotate 800ms cubic-bezier(.3, 1.5, .5, 1) 70ms; }
html.is-scrubbing .hand--m, html.is-scrubbing .hand--h, html.is-easing .hand--m, html.is-easing .hand--h { transition: none; } /* dragging and gliding back: they follow at once */
@media (prefers-reduced-motion: reduce) { .hand--m, .hand--h { transition: none; } }
@media (prefers-reduced-motion: reduce) { .hand--s { animation-timing-function: steps(60); } }

/* The visitor's city hangs under the target, whose hands show their time */
.vert.is-crowded { visibility: hidden; }
.vert {
  right: calc(var(--tr) + var(--tg) / 2 - .5ch);
  top: calc(var(--tt) + var(--tg) + 2.5rem);
  writing-mode: vertical-rl; text-orientation: upright;
  font-family: var(--sans); font-weight: 400;
  font-size: clamp(.8rem, .7rem + .4vw, 1.2rem);
  /* One column, however long the name: the spacing closes up so --n letters (set by clock.js)
     fit in the room between the target and the bottom margin. */
  --room: calc(76svh - var(--tg) - 2.5rem - var(--gutter));
  white-space: nowrap;
  letter-spacing: clamp(0em, calc(var(--room) / var(--n, 8) - 1.42em), .6em); /* 1.42em: one upright letter */
}

/* Dot grid: hover (or tap) and only the dots that spell "Hi" stay */
.dots {
  width: clamp(3.6rem, 5.4vw, 6.6rem); aspect-ratio: 1;
  right: 11%; top: calc(var(--tt) + var(--tg) * .62); /* tied to the target, clear of the clock */
  display: grid; grid-template-columns: repeat(15, 1fr);
  pointer-events: auto; cursor: default;
}
/* eggs.js: a 7x7 display. Dots never move. Drawing, the lit ones swell and the rest fade back to a
   faint grid, in a wave out from the middle (--d), so one picture morphs into the next */
.dots b {
  display: block; border-radius: 50%; background: var(--ink); scale: .44;
  transition: scale 420ms var(--ease) calc(var(--d, 0) * 17ms), opacity 420ms var(--ease) calc(var(--d, 0) * 17ms);
}
.dots.is-spelling b { scale: .36; opacity: .22; }
.dots.is-spelling b.on { scale: .86; opacity: 1; }
.dots.is-scrolling b { transition-duration: 70ms; transition-delay: 0ms; } /* a scrolling word steps, no wave */
@media (prefers-reduced-motion: reduce) { .dots b { transition: none; } }

/* The vertical rule is a day bar: dashed track, solid fill up to now in Auckland */
.rule--v {
  position: absolute; display: block; pointer-events: none; /* only the handle inside takes input */
  width: var(--hair); height: 52%; right: calc(var(--gutter) + .4vw); top: max(var(--tt), var(--bar-clear));
  background: repeating-linear-gradient(to bottom, var(--ink) 0 2px, transparent 2px 7px);
}
.rule--v::before, .rule--v::after { content: ""; position: absolute; left: 0; background: var(--ink); }
.rule--v::before { top: 0; width: 100%; height: calc(var(--day, 0) * 100%); }
.rule--v::after { top: calc(var(--day, 0) * 100%); left: -5px; width: 11px; height: var(--hair); }
/* Drag along the day bar to scrub Auckland's day; let go and it returns to now */
.scrub {
  position: absolute; top: -12px; bottom: -12px; left: -22px; width: 44px;
  pointer-events: auto; cursor: ns-resize; touch-action: none;
}
/* While scrubbing (or pointing at the bar) the hours show: a short hairline tick every 15 minutes,
   and every 6 hours a label joined to the bar by a longer one */
.hours {
  position: absolute; top: 0; bottom: 0; left: 0; width: 4px;
  background: linear-gradient(var(--ink) 1px, transparent 0) 0 0 / 100% calc(100% / 96) repeat-y;
  opacity: 0; transition: opacity var(--t) var(--ease);
}
.hours b {
  position: absolute; left: 14px; translate: 0 -50%; /* outside the line, clear of the clock */
  font-family: var(--sans); font-size: clamp(.7rem, .62rem + .2vw, .9rem);
  font-variant-numeric: tabular-nums;
}
.hours b::before { content: ""; position: absolute; top: 50%; right: calc(100% + 3px); width: 11px; height: 1px; background: var(--ink); }
.hours b:nth-child(1) { top: 0; }
.hours b:nth-child(2) { top: 25%; }
.hours b:nth-child(3) { top: 50%; }
.hours b:nth-child(4) { top: 75%; }
.hours b:nth-child(5) { top: 100%; }
html.is-scrubbing .hours { opacity: 1; }
@media (hover: hover) { .rule--v:has(.scrub:hover) .hours { opacity: 1; } }
/* While the ticks show they are the track: the dashes, at a different spacing, step aside */
html.is-scrubbing .rule--v { background: none; }
@media (hover: hover) { .rule--v:has(.scrub:hover) { background: none; } }
html.is-scrubbing .rule--v::after { left: -9px; width: 19px; }

/* ---------- Assembly on load: hard cuts, in reading order ---------- */
@media (prefers-reduced-motion: no-preference) {
  /* The logo writes itself: a smooth left-to-right reveal, slanted like the pen */
  .logo { animation: write 1100ms cubic-bezier(.5, .1, .35, 1) both 60ms; }
  body::after { transition: opacity 600ms var(--ease); }
  html { transition: --ink 600ms var(--ease); }
  .sign { animation: cut-in 1ms both 180ms; }
  .l--1 { animation: wipe 220ms steps(5, end) both 340ms; }
  .l--2 { animation: wipe 220ms steps(5, end) both 520ms; }
  .blurb { animation: cut-in 1ms both 720ms; }
  .target { animation: cut-in 1ms both 900ms; }
  .rule--v { animation: draw-y 280ms steps(7, end) both 960ms; transform-origin: 50% 0; }
  .vert, .pips, .time { animation: cut-in 1ms both 1080ms; }
  .dots { animation: cut-in 1ms both 1180ms; }
}
@keyframes cut-in { from { visibility: hidden; } }
@keyframes write {
  from { clip-path: polygon(0 0, 0 0, -12% 100%, -12% 100%); }
  to   { clip-path: polygon(0 0, 112% 0, 100% 100%, -12% 100%); }
}
@keyframes wipe   { from { clip-path: inset(0 100% 0 0); } to { clip-path: inset(-10% -50% -10% 0); } } /* ends well past the box, so a wide word is never cut */
/* The smooth pair for headline changes. They reach past the box so the offset print isn't cut. */
@keyframes wipe-in  { from { clip-path: inset(-10% 104% -10% -4%); } to { clip-path: inset(-10% -4% -10% -4%); } }
@keyframes wipe-out { from { clip-path: inset(-10% -4% -10% -4%); } to { clip-path: inset(-10% -4% -10% 104%); } }
@keyframes draw-y { from { scale: 1 0; } }

/* ---------- Narrow and upright: a top-down stack. The target, clock and socials hang from the top
   in fixed steps, and the copy keeps clear of them, so nothing collides on short phones
   (the page scrolls a little on the smallest instead).
   Spare height goes to the target first: it grows by whatever the stack leaves over
   (26rem + 21.3vw: the logo, the clock, a two-line headline, the sentence and the margins). ---------- */
@media (max-width: 699px) and (orientation: portrait) {
  .home { --tg: clamp(min(44vw, 28svh), calc(100svh - 26rem - 21.3vw), var(--tg-max)); --top: calc(var(--gutter) + 5rem + var(--slack, 0px) * .35);
    --tr: var(--rail); --tt: var(--top);
    --rail: calc(var(--gutter) + var(--pip) + 1.4rem); /* wider here: the hour labels sit in this gap */
    /* The target stops growing while there is still room beside it for the dots */
    --tg-max: min(60vw, calc(100vw - var(--rail) - var(--gutter) - 5.6rem));
  }
  .line { font-size: 11.8vw; } /* the longest headline, "Software & tools", just fits at this size */
  .copy { margin-top: calc(var(--tg) + 9.1rem + var(--tk) * 1.45 * var(--diff-extra, 0) + var(--tk) * 1.45 * var(--k-extra, 0) + var(--slack, 0px) * .35); } /* more lines under the clock push the copy down */
  .blurb { max-width: 58ch; }
  /* Two lines on the right: the squares and the day bar share the outer one, with the squares'
     edge on the margin; the target and the clock end on the inner one. The day bar runs
     from the top of the target to the foot of the clock. */
  .pips { right: calc(var(--gutter) + var(--pip) / 2 - 22px); width: 44px; padding-inline: 0; }
  .rule--v { right: calc(var(--gutter) + var(--pip) / 2 - var(--hair) / 2); top: var(--top); height: calc(var(--tg) + 1rem + var(--time-h)); }
  .time { right: var(--rail); bottom: auto; top: calc(var(--top) + var(--tg) + 1rem); }
  .vert { display: none; }
  /* The hours go in the margin outside the bar: inside it, the target, the clock and its am/pm
     leave no room. Small labels, no connectors, just past the ticks. */
  .hours { left: var(--hair); }
  .hours b { left: 6px; font-size: .62rem; }
  .hours b::before { display: none; }
  /* The dots sit on the target's centre line, where its hands turn */
  /* (.019 of the grid: the outer dots sit that far inside its box, so this puts them on the margin) */
  .dots { right: auto; left: calc(var(--gutter) - 4.6rem * .019); width: 4.6rem; top: calc(var(--top) + var(--tg) / 2 - 2.3rem); }
}
/* Taller still, the headline stacks into four lines. The height that needs grows with the width
   (about 91vw + 25.5rem), which a media query can't say, so the break steps up in bands.
   From there the target and the headline share the spare height
   (26rem: the stack without a headline; 3.6: four lines at this leading). */
@media (max-width: 399px) and (min-height: 770px) and (orientation: portrait),
       (min-width: 400px) and (max-width: 449px) and (min-height: 815px) and (orientation: portrait),
       (min-width: 450px) and (max-width: 499px) and (min-height: 860px) and (orientation: portrait),
       (min-width: 500px) and (max-width: 549px) and (min-height: 905px) and (orientation: portrait),
       (min-width: 550px) and (max-width: 599px) and (min-height: 950px) and (orientation: portrait),
       (min-width: 600px) and (max-width: 649px) and (min-height: 995px) and (orientation: portrait),
       (min-width: 650px) and (max-width: 699px) and (min-height: 1045px) and (orientation: portrait) {
  .home {
    --tg: clamp(min(44vw, 28svh), calc(100svh - 26rem - 68.4vw), var(--tg-max));
    --fs: min(19vw, calc((100svh - var(--tg) - 26rem) / 3.6));
    /* Once both have hit their width limits, a third of what is left over goes above the target,
       so a very tall, thin window doesn't pool it all in one gap */
    --slack: max(0px, calc(100svh - 26rem - var(--tg) - 3.6 * var(--fs)));
    --stack-verb: block; --stack-indent: .5em; --stack-outdent: -.5em; --stack-measure: 5.2em;
  }
  .line { font-size: var(--fs); }
}

/* Short, wide windows (phones on their side, short desktop windows): the target grows into the
   empty band across the top, with the dots beside it; the day bar runs the full height down the
   right edge, just outside the squares and the clock; the headline comes down a size to stay
   clear of the logo */
@media (max-height: 500px) and (orientation: landscape) {
  .home { --tg: min(24vw, 50svh); --tr: calc(var(--gutter) + 26vw); --tt: var(--gutter); }
  .line { font-size: min(6.6vw, 11.5svh); }
  .copy { row-gap: min(clamp(1.5rem, 3vw, 3rem), 5.5svh); } /* the gap follows the height too */
  /* Wide enough to take the sentence in two or three lines, short of the clock */
  .blurb { max-width: min(78ch, calc(100vw - 2 * var(--gutter) - 17rem)); font-size: min(clamp(1.05rem, .9rem + .55vw, 1.6rem), 4.4svh); }
  .dots { top: var(--gutter); right: calc(var(--tr) + var(--tg) + clamp(1.5rem, 4vw, 4rem)); width: clamp(3rem, 5vw, 5rem); }
  .pips { right: calc(var(--gutter) + .9rem); }
  .rule--v { right: calc(var(--gutter) / 2); top: var(--gutter); bottom: var(--gutter); height: auto; }
  /* The headline sits close under the logo here: the contact line comes up and down a size, and
     its letters get their room kept */
  .brand { row-gap: .45rem; }
  .sign { --p: 2.5px; margin-bottom: calc((var(--drop) + 7) * var(--p)); }

}
/* Phones on their side have no room in the middle: the target goes top right, above the clock,
   as big as the height between them allows */
@media (max-height: 500px) and (orientation: landscape) and (max-width: 999px) {
  /* Its right edge clears the squares' 44px tap area; its foot clears the clock */
  .home { --tr: calc(var(--gutter) + .9rem + 44px + 1rem); --tg: min(30vw, calc(100svh - 2 * var(--gutter) - var(--time-h) - 3.25rem)); }
}

/* The smallest phones on their side: everything in the copy comes down a step to fit the height */
@media (max-height: 360px) and (orientation: landscape) {
  .line { font-size: min(6.4vw, 13svh); }
  .copy { row-gap: .9rem; }
  .time__s { display: none; } :root { --k-extra: 0 !important; } /* no room for the extra line */
  .blurb { font-size: .92rem; max-width: calc(100vw - 2 * var(--gutter) - 13rem); } /* wider, so it takes fewer lines */
}

/* Tall and near-square windows with height to spare: the same arrangement, with the headline
   set larger and stacked into four lines. Its size follows the height as much as the width.
   The target moves up to make room, and the hanging city name goes, as on phones. */
@media (min-width: 700px) and (min-height: 760px) and (max-aspect-ratio: 6/5) {
  .home {
    --fs: min(15.5vw, 10.5svh); --top: 12%; --dots: clamp(3.6rem, 5.4vw, 6.6rem);
    --tr: calc(var(--rail) + var(--dots) + clamp(1.5rem, 4vw, 4rem)); --tt: var(--top);
    --rail: calc(var(--gutter) + var(--pip) + clamp(1.5rem, 3vw, 3rem)); /* the dots and clock stand well clear of the day bar */
    /* The target takes the height the copy leaves under the top margin
       (3.6: four headline lines; 11rem: the sentence and the gaps either side of the headline) */
    --tg: clamp(min(46vw, 30svh), calc(88svh - 3.6 * var(--fs) - 11rem - var(--gutter)), 58vw);
    --stack-verb: block; --stack-indent: .5em; --stack-outdent: -.5em; --stack-measure: 5.2em;
  }
  .line { font-size: var(--fs); }
  /* The same two right-hand lines as the narrow layout. The clock's foot is level with the
     sentence's, and the day bar runs from the top of the target down to it. */
  .pips { right: calc(var(--gutter) + var(--pip) / 2 - 22px); width: 44px; padding-inline: 0; }
  .rule--v { right: calc(var(--gutter) + var(--pip) / 2 - var(--hair) / 2); top: max(var(--top), var(--bar-clear)); bottom: var(--gutter); height: auto; }
  .dots { width: var(--dots); top: calc(var(--top) + var(--tg) * .62); right: calc(var(--rail) - var(--dots) * .019); }
  .time { right: var(--rail); bottom: var(--gutter); }
  .blurb { max-width: min(58ch, calc(100vw - var(--gutter) - var(--rail) - 17rem)); } /* short of the clock */
  .vert { display: none; }
}

/* Short screens: the hanging city name would run into the headline */
@media (max-height: 760px) { .vert { display: none; } }
/* Wide but not tall: below the target the dots would crowd the clock, so they go up beside the
   target on its open side, level with the top of the page */
@media (min-width: 1000px) and (max-height: 760px) and (min-height: 501px) and (orientation: landscape) {
  .dots { top: var(--gutter); right: calc(var(--tr) + var(--tg) + clamp(1.5rem, 4vw, 4rem)); }
  .home { --tt: calc(var(--gutter) + 2rem); } /* the target comes up, clear of the clock's two lines */
  /* The headline sits close under the logo too: contact comes up and down a size */
  .brand { row-gap: .45rem; }
  .sign { --p: 2.5px; margin-bottom: calc((var(--drop) + 7) * var(--p)); }
  .line { font-size: clamp(2.4rem, min(8.6vw, 13svh), 13rem); } /* a size down, to fit the height */
  .copy { row-gap: min(clamp(2rem, 3.4vw, 3.25rem), 7svh); }
}

@media (min-width: 1800px) { html { font-size: 125%; } }
/* ...but not when the window is short: there isn't the height for larger type */
@media (min-width: 1800px) and (max-height: 760px) { html { font-size: 100%; } }

/* Still reading the stylesheet? Respect. Every colour above is one of five, and the squares at the top right cycle them. */
