/* The rocket launch button: a graphite pill on a black page, with a small rocket in a well on its left. The smoke is
   drawn on two canvases over the whole page, one under the button and one over it; the rocket, its flame and the
   sparks are an SVG above everything. */
:root {
  --page: #000000;          /* the page */
  --pill: #181a23;          /* the button */
  --pill-edge: #262935;     /* the button's rim, lit from above */
  --well: #0b0c12;          /* the round well the rocket stands in */
  --ink: #f4f1ea;           /* the words on the button */
  --muted: #8b8d99;         /* the line under the button */
  --coral: #ff5a3c;         /* the rocket's nose and fins, and the countdown ring */
  --hull: #f1ede4;          /* the rocket's body */
  --glass: #7cc6ff;         /* the rocket's window */
  --smoke: #dcd8d2;         /* the colour of the smoke */
  --flame: #ff8a2b;         /* the colour of the flame's edge and of its light on the smoke */
}

* {
  box-sizing: border-box;
}

/* a tap is a click at once: no wait for a double tap */
html {
  touch-action: manipulation;
}

html,
body {
  margin: 0;
  overflow-x: clip;
}

body {
  min-height: 100svh;
  background: var(--page);
  color: var(--ink);
  font-family: 'Geist Variable', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.stage {
  position: relative;
  z-index: 1;
  min-height: 100svh;
  display: grid;
  place-items: center;
  padding: 72px 16px;
}

/* the line under the button lines up with the words in it, right of the well */
.launch {
  display: grid;
  width: min(340px, calc(100vw - 48px));
  gap: 18px;
}

.launch__hint {
  margin: 0;
  padding-left: 72px;
  color: var(--muted);
  font-size: 14px;
  letter-spacing: 0.005em;
  text-align: left;
}

.launch__hint span {
  display: inline-block;
}

/* ---------------------------------------------------------------- the button */
.launch__btn {
  position: relative;
  display: block;
  width: 100%;
  height: 64px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: linear-gradient(180deg, var(--pill-edge), var(--pill) 46%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.09),
    inset 0 0 0 1px rgba(255, 255, 255, 0.05),
    0 1px 0 rgba(0, 0, 0, 0.6),
    0 18px 40px -16px rgba(0, 0, 0, 0.9);
  color: var(--ink);
  font: inherit;
  text-align: left;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
}

/* the flame's light on the button: a warm glow from the well, faded in by the script (only its opacity changes) */
.launch__heat {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: radial-gradient(180px 80px at 32px 100%, rgba(255, 138, 43, 0.5), transparent 70%);
  box-shadow: 0 0 56px -6px rgba(255, 120, 40, 0.45);
  opacity: 0;
  pointer-events: none;
  will-change: opacity;
}

.launch__btn:focus-visible {
  outline: 2px solid var(--coral);
  outline-offset: 5px;
}

html[data-using='pointer'] .launch__btn:focus-visible {
  outline: none;
}

/* the well on the left: the rocket stands in it, and the ring of the countdown runs round it */
.launch__pad {
  position: absolute;
  top: 6px;
  left: 6px;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 30%, #12141c, var(--well) 70%);
  box-shadow:
    inset 0 2px 6px rgba(0, 0, 0, 0.8),
    inset 0 -1px 0 rgba(255, 255, 255, 0.06);
}

.launch__ring {
  position: absolute;
  inset: -6px;
  width: 64px;
  height: 64px;
  overflow: visible;
  transform: rotate(-90deg);
  fill: none;
  stroke: var(--coral);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
}

/* the three lines of the label take turns in the same place */
.launch__label {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 72px;
  right: 16px;
  overflow: hidden;
  pointer-events: none;
}

.launch__line {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 16.5px;
  font-weight: 600;
  letter-spacing: -0.012em;
  white-space: nowrap;
}

.launch__line[data-line='count'],
.launch__line[data-line='done'] {
  visibility: hidden;
}

/* the rolling digit: a column of numbers seen through a window one number high */
.launch__digits {
  position: relative;
  display: inline-block;
  height: 1.25em;
  min-width: 0.7em;
  overflow: hidden;
  color: var(--coral);
  font-variant-numeric: tabular-nums;
  font-weight: 700;
}

.launch__reel {
  display: flex;
  flex-direction: column;
  line-height: 1.25em;
}

.launch__check {
  width: 20px;
  height: 20px;
  margin-right: 2px;
  fill: none;
  stroke: var(--coral);
  stroke-width: 2.6;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
}

/* ---------------------------------------------------------------- the sky and the rocket */
.sky {
  position: fixed;
  inset: 0;
  z-index: 2;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.sky--back {
  z-index: 0;
}

.rocket {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 3;
  width: 80px;
  height: 120px;
  overflow: visible;
  visibility: hidden;
  pointer-events: none;
  will-change: transform;
}

.rocket__hull {
  fill: url(#rk-hull);
}

.rocket__hull-a {
  stop-color: #a8a49c;
}

.rocket__hull-b {
  stop-color: var(--hull);
}

.rocket__hull-c {
  stop-color: var(--hull);
}

.rocket__hull-d {
  stop-color: #8e8a83;
}

.rocket__cap,
.rocket__fin {
  fill: url(#rk-fin);
}

.rocket__fin-a {
  stop-color: var(--coral);
}

.rocket__fin-b {
  stop-color: color-mix(in srgb, var(--coral) 62%, #000);
}

.rocket__band {
  fill: rgba(0, 0, 0, 0.16);
}

.rocket__keel {
  fill: color-mix(in srgb, var(--coral) 70%, #000);
}

.rocket__nozzle {
  fill: url(#rk-metal);
}

.rocket__rim {
  fill: #2a2d38;
}

.rocket__glass {
  fill: var(--glass);
}

.rocket__shine {
  fill: none;
  stroke: rgba(255, 255, 255, 0.85);
  stroke-width: 1.1;
  stroke-linecap: round;
}

/* the flame, its glow, and its splash on the floor of the well */
.rocket__halo {
  fill: url(#rk-glow);
}

.rocket__glow-a {
  stop-color: var(--flame);
  stop-opacity: 0.42;
}

.rocket__glow-m {
  stop-color: var(--flame);
  stop-opacity: 0.14;
}

.rocket__glow-b {
  stop-color: var(--flame);
  stop-opacity: 0;
}

.rocket__splash {
  fill: url(#rk-glow);
  opacity: 0;
}

.rocket__fire {
  fill: url(#rk-flame);
}

.rocket__flame-a {
  stop-color: #fff6dc;
}

.rocket__flame-b {
  stop-color: var(--flame);
}

.rocket__flame-c {
  stop-color: #c8321a;
  stop-opacity: 0;
}

.rocket__core {
  fill: url(#rk-core);
}

.rocket__core-a {
  stop-color: #fff2c4;
  stop-opacity: 0.8;
}

.rocket__core-b {
  stop-color: #fff2c4;
  stop-opacity: 0;
}

.rocket__knots {
  fill: #fff4d2;
}

.rocket__sparks {
  fill: none;
  stroke: #ffe2a6;
  stroke-width: 1.6;
  stroke-linecap: round;
}

/* the flame's light on the lower hull */
.rocket__burn {
  fill: url(#rk-heat);
  opacity: 0;
}

.rocket__heat-a {
  stop-color: var(--flame);
  stop-opacity: 0;
}

.rocket__heat-b {
  stop-color: var(--flame);
  stop-opacity: 0.85;
}
