@font-face {
  font-family: Instrument Serif;
  src: url("/invite-assets/display.ttf") format("truetype");
  font-display: swap;
}
@font-face {
  font-family: Instrument Serif;
  src: url("/invite-assets/italic.ttf") format("truetype");
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: Geist;
  src: url("/invite-assets/body.ttf") format("truetype");
  font-display: swap;
}
@font-face {
  font-family: Geist;
  src: url("/launch-assets/label.ttf") format("truetype");
  font-weight: 500;
  font-display: swap;
}

/* Paper, ink and gilt: the materials of a printed Quran. */
:root {
  color-scheme: light;
  --paper: var(--seed-paper);
  --paper-lit: var(--seed-paper-lit);
  --ink: var(--seed-ink);
  --ink-soft: var(--seed-ink-soft);
  --gold: var(--seed-gilt);
  --gold-deep: var(--seed-gilt-dark);
  --gold-lit: var(--brand-seed);
  --shadow: color-mix(in srgb, var(--ink) 80%, transparent);
  --display: "Instrument Serif", "Iowan Old Style", Georgia, serif;
  --text: Geist, system-ui, sans-serif;
  --gutter: clamp(18px, 4vw, 56px);
  --ease: var(--seed-ease);
  font-family: var(--text);
}

*, *::after, *::before { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* A title page: every part sits on one centre line. */
.page {
  position: relative;
  isolation: isolate;
  display: grid;
  grid-template-rows: auto minmax(clamp(190px, 36svh, 340px), 1fr) auto;
  justify-items: center;
  min-height: 100svh;
  overflow: hidden;
  padding: max(env(safe-area-inset-top), clamp(18px, 3.2svh, 34px)) var(--gutter)
    max(env(safe-area-inset-bottom), clamp(22px, 4.6svh, 48px));
  background:
    radial-gradient(ellipse 62% 48% at 50% 40%, var(--paper-lit), transparent 74%),
    var(--paper);
}

.masthead { color: var(--ink); }
.masthead .seed-mark { color: var(--gold); }

.plate {
  position: relative;
  width: 100%;
  max-width: 1180px;
}

.plant {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.plate-mark {
  position: absolute;
  left: 50%;
  bottom: 14%;
  width: min(44vw, 190px);
  height: min(44vw, 190px);
  transform: translateX(-50%);
  color: var(--gold);
}

.title {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  text-align: center;
}

.title h1 {
  max-width: 25ch;
  margin: clamp(10px, 2.2svh, 24px) 0 0;
  font: 400 clamp(23px, 15px + 1.5vw, 38px) / 1.12 var(--display);
  letter-spacing: -0.012em;
  text-wrap: balance;
}

.title h1 em { font-style: italic; }

/* Instrument Serif sets its hyphen with wide side bearings; close it up inside a compound word. */
.title h1 .join { margin-inline: -0.05em; }

.launch-time { width: 100%; }

.countdown { margin-top: clamp(18px, 3.6svh, 38px); }

.countdown-label,
.countdown-units dt {
  color: var(--ink-soft);
  font: 500 11px / 1 var(--text);
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

.countdown-label { margin: 0 0 clamp(8px, 1.5svh, 16px); }

.countdown-units {
  display: flex;
  justify-content: center;
  margin: 0;
  font-size: min(clamp(40px, 14svh, 136px), (100vw - 2 * var(--gutter)) / var(--ems, 6.32));
}

.countdown-units div {
  position: relative;
  display: flex;
  flex-direction: column-reverse;
  align-items: center;
  /* launch.js sizes the line with this padding (8 * 0.3em in --ems): change both together. */
  padding-inline: 0.3em;
}

/* One seed of the mark (brand/dist/svg/seed.svg) stands between the units, where a colon would be. */
.countdown-units div + div::before {
  content: "";
  position: absolute;
  top: 0.31em;
  left: -0.04em;
  width: 0.08em;
  height: 0.13em;
  background: var(--gold);
  mask: url(seed.svg) center / contain no-repeat;
  -webkit-mask: url(seed.svg) center / contain no-repeat;
}

.countdown-units dd {
  display: flex;
  margin: 0;
  font: 400 1em / 0.84 var(--display);
  font-variant-numeric: lining-nums;
}

.digit {
  position: relative;
  display: inline-block;
  width: 0.47em;
  text-align: center;
}

.digit > span { display: block; }

.digit::before {
  content: attr(data-prev);
  position: absolute;
  inset: 0;
  opacity: 0;
}

.countdown-units dt {
  margin-top: clamp(8px, 0.14em, 16px);
  letter-spacing: 0.18em;
}

.date-fallback,
.availability {
  margin: clamp(16px, 3.2svh, 34px) 0 0;
  font: italic 400 clamp(25px, 16px + 2vw, 46px) / 1.12 var(--display);
  letter-spacing: -0.01em;
  text-wrap: balance;
}

.watch {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  min-height: 52px;
  margin-top: clamp(18px, 3.8svh, 38px);
  padding: 0 28px 0 24px;
  border: 0;
  border-radius: 999px;
  background: var(--ink);
  color: var(--paper-lit);
  box-shadow: 0 14px 30px -18px var(--shadow);
  font: 500 15px / 1 var(--text);
  cursor: pointer;
  transition: background-color 240ms var(--ease), transform 240ms var(--ease), box-shadow 240ms var(--ease);
}

.watch-seed {
  width: 8px;
  height: 13px;
  background: var(--gold-lit);
  mask: url(seed.svg) center / contain no-repeat;
  -webkit-mask: url(seed.svg) center / contain no-repeat;
  transition: transform 420ms var(--ease);
}

.watch:hover {
  background: color-mix(in srgb, var(--ink) 90%, var(--paper-lit));
  box-shadow: 0 18px 34px -18px var(--shadow);
}

.watch:hover .watch-seed { transform: rotate(180deg); }
.watch:active {
  transform: scale(0.965);
  transition-duration: 105ms;
  box-shadow: 0 8px 18px -14px var(--shadow);
}

:focus-visible {
  outline: 2px solid var(--gold-deep);
  outline-offset: 4px;
}

@media (prefers-reduced-motion: no-preference) {
  .title h1, .launch-time, .title > .availability, .watch {
    animation: arrive 900ms var(--ease) backwards;
  }
  .title h1 { animation-delay: 260ms; }
  .launch-time, .title > .availability { animation-delay: 420ms; }
  .watch { animation-delay: 580ms; }
}

@keyframes arrive {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (prefers-reduced-motion: reduce) {
  .watch, .watch-seed { transition: none; }
  .watch:active { transform: none; }
}

/* Wide pages set the mission on one line, so the device keeps the height. */
@media (min-width: 900px) {
  .title h1 { max-width: none; }
}

@media (max-width: 560px) {
  .countdown-label, .countdown-units dt { font-size: 10px; letter-spacing: 0.16em; }
}

@media (max-width: 350px) {
  .countdown-units dt { letter-spacing: 0.08em; }
}
