@font-face {
  font-family: "Bricolage";
  src: url("/fonts/BricolageGrotesque-Variable.woff2") format("woff2"),
    url("/fonts/BricolageGrotesque-Variable.ttf") format("truetype");
  font-weight: 200 800;
  font-display: swap;
}

:root {
  --night: #17123b;
  --field: #221b52;
  --line: #3a3170;
  --moon-dim: #a79fd6;
  --moon: #f2eeff;
  --wake: #ffe14d;
  --asleep: #ff4a1c;
  --ink: #000;

  --bg: var(--night);
  --fg: var(--moon);
  --soft: var(--moon-dim);
  --stamp: var(--field);
  --shadow: var(--wake);

  --gutter: clamp(20px, 5vw, 72px);
  color-scheme: dark;
}

* { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  background: var(--night);
}

body {
  margin: 0;
  font-family: "Bricolage", system-ui, sans-serif;
  font-optical-sizing: auto;
  font-size: 18px;
  line-height: 1.5;
  color: var(--moon);
  background: var(--night);
  -webkit-font-smoothing: antialiased;
}

img { display: block; max-width: 100%; height: auto; }

a { color: inherit; }

:focus-visible {
  outline: 3px solid var(--wake);
  outline-offset: 3px;
}

[data-mode="wake"] :focus-visible,
[data-mode="asleep"] :focus-visible { outline-color: var(--ink); }

.skip {
  position: absolute;
  left: -9999px;
  top: 12px;
  z-index: 20;
  padding: 10px 16px;
  background: var(--wake);
  color: var(--ink);
}
.skip:focus { left: 12px; }

/* Header and the time rail stay on top of every scene and take the colour of
   the scene in view (main.js sets body[data-scene]). */
body { --chrome: var(--moon); --chrome-on: var(--wake); --chrome-bg: var(--night); }
body[data-scene="wake"] { --chrome: var(--ink); --chrome-on: var(--ink); --chrome-bg: var(--wake); }
body[data-scene="asleep"] { --chrome: var(--ink); --chrome-on: var(--ink); --chrome-bg: var(--asleep); }

.bar {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 10;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px var(--gutter);
  color: var(--chrome);
  pointer-events: none;
}
.bar > * { pointer-events: auto; }

.wordmark {
  font-weight: 800;
  font-size: 22px;
  letter-spacing: -0.02em;
  text-decoration: none;
}

.lang {
  font: inherit;
  font-weight: 700;
  font-size: 16px;
  color: inherit;
  background: none;
  border: 2px solid currentColor;
  border-radius: 999px;
  padding: 4px 14px;
  text-decoration: none;
}

.scene[data-mode] .copy p.next {
  margin: 20px 0 0;
  font-weight: 700;
  font-size: clamp(20px, 1.9vw, 26px);
  line-height: 1.25;
  color: var(--wake);
}

.rail {
  position: fixed;
  right: var(--gutter);
  top: 50%;
  translate: 0 -50%;
  z-index: 10;
  color: var(--chrome);
}
.rail ol { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.rail a {
  display: block;
  text-align: right;
  font-weight: 600;
  font-size: 14px;
  font-variant-numeric: tabular-nums;
  text-decoration: none;
  opacity: 0.45;
  transition: opacity 0.2s;
}
.rail a:hover,
.rail a[aria-current="true"] { opacity: 1; }
.rail a[aria-current="true"] { font-weight: 800; color: var(--chrome-on); }

/* A scene is one minute of the morning: a full screen in one of the app's
   three modes, its time set huge behind the phone. */
.scene {
  --bg: var(--night);
  position: relative;
  min-height: 100svh;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: clamp(24px, 6vw, 96px);
  padding: 96px calc(var(--gutter) + 120px) 72px var(--gutter);
  overflow: hidden;
  background: var(--bg);
  color: var(--fg);
}

.scene[data-mode="wake"] {
  --bg: var(--wake);
  --fg: var(--ink);
  --soft: #3d3300;
  --stamp: #f5d42f;
  --shadow: var(--ink);
}

.scene[data-mode="asleep"] {
  --bg: var(--asleep);
  --fg: var(--ink);
  --soft: #3a0d00;
  --stamp: #f23d0f;
  --shadow: var(--ink);
}

.stamp {
  position: absolute;
  z-index: 0;
  left: calc(var(--gutter) - 0.06em);
  bottom: -0.14em;
  margin: 0;
  font-weight: 800;
  font-variation-settings: "opsz" 96;
  font-size: clamp(160px, 34vw, 520px);
  line-height: 0.8;
  letter-spacing: -0.06em;
  color: var(--stamp);
  white-space: nowrap;
  user-select: none;
}

.copy {
  position: relative;
  z-index: 1;
  max-width: 40rem;
}

h1, h2 {
  margin: 0 0 0.45em;
  font-weight: 800;
  font-variation-settings: "opsz" 96;
  letter-spacing: -0.035em;
  line-height: 0.95;
  text-wrap: balance;
}
h1 { font-size: clamp(46px, 6vw, 88px); }
h2 { font-size: clamp(38px, 4.8vw, 72px); }

.copy p {
  margin: 0;
  max-width: 30rem;
  font-size: clamp(18px, 1.5vw, 21px);
  color: var(--soft);
  text-wrap: pretty;
}
.scene[data-mode="night"] .copy p { color: var(--moon-dim); }

.stores {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 32px;
}
.store {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 12px 22px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 17px;
  background: var(--wake);
  color: var(--ink);
  box-shadow: 4px 4px 0 var(--ink);
}
.scene[data-mode="night"] .store { box-shadow: 4px 4px 0 var(--asleep); }
.store .mark { width: 20px; height: 20px; flex: none; }

/* The phone: the app's own screen, a black bezel and a hard pop shadow. */
.phone {
  position: relative;
  z-index: 2;
  margin: 0;
  width: clamp(230px, 24vw, 330px);
  aspect-ratio: 390 / 844;
  border: 10px solid var(--ink);
  border-radius: 46px;
  background: var(--ink);
  box-shadow: 16px 16px 0 var(--shadow);
  overflow: hidden;
}
.phone img { width: 100%; height: 100%; object-fit: cover; }

.foot {
  position: absolute;
  z-index: 3;
  left: var(--gutter);
  bottom: 20px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 24px;
  font-size: 14px;
  color: var(--moon-dim);
}

/* Parallax: main.js moves the time, the phone and the copy at different
   speeds as a scene passes (--p runs from 1 below the fold to -1 above). */
.stamp, .phone, .copy, .deco {
  /* --s is the layer's speed against the page: below 1 it lags behind like a
     distant background, above 1 it runs ahead like the foreground. */
  transform: translate3d(0, calc((var(--s, 1) - 1) * var(--p, 0) * 100vh), 0)
    rotate(calc(var(--p, 0) * var(--r, 0deg)));
}
.stamp { --s: 0.25; }
.phone { --s: 1.3; --r: 8deg; }
.copy { --s: 1.08; }
.stamp, .phone, .copy, .deco { will-change: transform; }

.depth { position: absolute; inset: 0; z-index: 0; pointer-events: none; }
.deco { position: absolute; left: var(--x); top: var(--y); display: block; }

.moon {
  width: 34vmin;
  aspect-ratio: 1;
  border-radius: 50%;
  box-shadow: 5vmin 4vmin 0 0 var(--wake);
  --r: -20deg;
}
.star {
  width: 5vmin;
  aspect-ratio: 1;
  background: var(--wake);
  clip-path: polygon(50% 0, 62% 38%, 100% 50%, 62% 62%, 50% 100%, 38% 62%, 0 50%, 38% 38%);
  --r: 90deg;
}
.star.sm { width: 3vmin; background: var(--moon-dim); }
.burst {
  width: 46vmin;
  aspect-ratio: 1;
  background: #f5d42f;
  clip-path: polygon(50% 0, 58% 30%, 85% 15%, 70% 42%, 100% 50%, 70% 58%, 85% 85%, 58% 70%, 50% 100%, 42% 70%, 15% 85%, 30% 58%, 0 50%, 30% 42%, 15% 15%, 42% 30%);
  --r: 45deg;
}
.ring {
  width: 22vmin;
  aspect-ratio: 1;
  border-radius: 50%;
  border: 2.4vmin solid var(--ink);
}
.dot {
  width: 7vmin;
  aspect-ratio: 1;
  border-radius: 50%;
  background: var(--asleep);
  box-shadow: 1vmin 1vmin 0 var(--ink);
}
.zed {
  font-weight: 800;
  font-variation-settings: "opsz" 96;
  font-size: 44vmin;
  line-height: 1;
  color: #e43a0e;
  --r: -12deg;
}
.zed.sm { font-size: 24vmin; color: #ff6a3d; }
.zed.xs { font-size: 14vmin; color: var(--ink); }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

/* Phones: text above, the screen below; snapping loosens so a tall scene can
   still be read to its end. */
@media (max-width: 760px) {
  .rail { display: none; }
  .scene {
    grid-template-columns: 1fr;
    justify-items: start;
    align-content: center;
    padding: 88px var(--gutter) 64px;
    gap: 40px;
  }
  .phone { justify-self: center; width: min(68vw, 280px); }
  .stamp { font-size: 44vw; left: auto; right: -0.04em; bottom: auto; top: 58%; }
  .foot { position: static; grid-row: 3; }
  .bar { background: var(--chrome-bg); transition: background-color 0.2s; }
  .phone { --s: 1.08; --r: 3deg; }
  .copy { --s: 1; }
}
