/* Sizes follow the 1728px-wide Figma artboard: calc(N * var(--s)) is N design pixels, scaled to the window. */
:root {
  --s: calc(min(100vw, 1728px) / 1728);
  --bg: #000;
  --fg: #fff;
  --muted: #8a8a8a;
  --close-bg: #3d3d3d;
  --display: "Funnel Display", "Helvetica Neue", Arial, sans-serif;
  --sans: "Funnel Sans", "Helvetica Neue", Arial, sans-serif;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
}
body.clock-open { overflow: hidden; }

/* ---------- landing ---------- */
.landing {
  max-width: 1728px;
  margin: 0 auto;
  padding: calc(64 * var(--s)) 0 0;
  overflow-x: clip;               /* the glass canvas reaches past the ends of the title; never widen the page */
}
.video {
  display: block;
  margin-left: calc(64 * var(--s));
  width: calc(730 * var(--s));
  aspect-ratio: 730 / 411;
  position: relative;
  background: var(--bg);
}
.video video { display: block; width: 100%; height: 100%; object-fit: cover; }
.video .play {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  background: rgb(0 0 0 / 0.5);
  color: var(--fg);
}
.video .play[hidden] { display: none; }
/* The title overlaps the bottom of the video by 100 design px. */
.title {
  position: relative;
  width: fit-content;
  margin: calc(-100 * var(--s)) 0 0 calc(224 * var(--s));
}
.title h1 {
  margin: 0;
  font: 600 calc(160 * var(--s)) / normal var(--display);
  white-space: nowrap;
}
/* With WebGL running, the canvas draws the title and the real text stays for screen readers and search. */
.title h1.refracted { color: transparent; }
.title canvas.glass { position: absolute; top: 0; pointer-events: none; }

.statement {
  width: calc(766 * var(--s));
  margin: calc(40 * var(--s)) 0 0 calc(794 * var(--s));
  font-size: max(14px, calc(16 * var(--s)));
  line-height: normal;
}
.statement p { margin: 0 0 1.2em; }
.statement p:last-of-type { margin-bottom: 0; }

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 12px;
  border: 0;
  border-radius: 4px;
  background: var(--fg);
  color: var(--bg);
  font: 600 16px / normal var(--sans);
  cursor: pointer;
}
.button:focus-visible { outline: 2px solid var(--fg); outline-offset: 3px; }
.statement .button { margin-top: max(24px, calc(40 * var(--s))); }

/* Lines up with the statement column, 128px below the Try it out button. */
.credit {
  max-width: 1728px;
  margin: 128px auto 0;
  padding: 0 0 max(24px, calc(48 * var(--s))) calc(794 * var(--s));
  font-size: 12px;
  opacity: 0.5;
}

/* ---------- clock ---------- */
.clock {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: var(--bg);
}
.clock[hidden] { display: none; }
/* The dot grid is 1530×771 on the 1728-wide artboard. */
#grid {
  width: min(88.54vw, calc((100dvh - 140px) * 1530 / 771));
  aspect-ratio: 1530 / 771;
}
.close {
  position: absolute;
  top: max(16px, calc(32 * var(--s)));
  right: max(16px, calc(33 * var(--s)));
  background: var(--close-bg);
  color: var(--fg);
}
.status {
  position: absolute;
  bottom: max(24px, calc(80 * var(--s)));
  margin: 0;
  color: var(--muted);
  font-size: 15px;
  text-align: center;
  padding: 0 16px;
}
#video { position: fixed; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
#debug {
  position: absolute; left: 16px; bottom: 16px;
  color: #888; font: 12px/1.4 ui-monospace, Menlo, monospace;
  display: none;
}
#debug.on { display: block; }
#debug canvas { width: 200px; display: block; margin-bottom: 6px; transform: scaleX(-1); border-radius: 4px; }

/* ---------- phones ---------- */
@media (max-width: 760px) {
  .landing { padding: 16px 16px 0; }
  .video { margin: 0; width: 100%; }
  /* Two lines, "unobserved" over "time": up to 64px, smaller where "unobserved" (~5.75em) wouldn't fit.
     Keeps the design's overlap with the video (0.625em). */
  .title { font-size: min(64px, calc((100vw - 32px) / 5.8)); margin: -0.625em 0 0; }
  .title h1 { font-size: 1em; line-height: 1; white-space: normal; }
  .statement { width: auto; margin: 28px 0 0; font-size: 15px; }
  .credit { padding: 0 16px 24px; }
  #grid { width: calc(100vw - 32px); }
}
/* Phones held upright: the clock fills the screen, hours over minutes over seconds (drawn by clock.js). */
@media (max-width: 760px) and (orientation: portrait) {
  #grid { width: 100vw; height: 100dvh; aspect-ratio: auto; }
}
