/* Greetings while it loads: a dark curtain over a light page */
:root {
  --paper: #efebe4;
  --ink: #1e2a24;
  --cream: #f1ead9;
  --cream-soft: rgba(241, 234, 217, 0.6);
  --muted: #5b655f;
  --accent: #e2703a;
  /* the elastic curve of the button: it overshoots, then settles */
  --bounce: cubic-bezier(0.34, 1.9, 0.45, 1);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: 'Mona Sans Variable', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

/* while the curtain covers, the page behind is dark too: on a phone no light line shows under the curtain's edge,
   and the browser's bars take the curtain's colour */
html.covered {
  background: var(--ink);
}

/* ------------------------------------------------------------------ the curtain */
.curtain {
  --bow: 0;
  position: fixed;
  inset: 0;
  z-index: 10;
  background: var(--ink);
  color: var(--cream);
  will-change: transform;
}

/* under the curtain, a half ellipse of the same colour: while it flies up, the bottom edge bows */
.curtain::after {
  content: '';
  position: absolute;
  top: calc(100% - 1px);
  left: -5%;
  width: 110%;
  height: 12vh;
  border-radius: 0 0 50% 50% / 0 0 100% 100%;
  background: inherit;
  transform: scaleY(var(--bow));
  transform-origin: 50% 0;
}

.curtain__inner {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  justify-items: center;
  padding: 0 20px;
}

/* the greeting's line keeps the same height whatever the script, so the counter never moves */
.curtain__say {
  display: grid;
  place-items: center;
  height: 1.3em;
  margin: 0;
  font-size: clamp(64px, 11vw, 150px);
  line-height: 1;
}

/* Latin words in a serif, the others in a typeface made for their own script */
.curtain__word {
  font-family: 'Instrument Serif', serif;
  font-weight: 400;
  letter-spacing: -0.02em;
  white-space: nowrap;
}

.curtain__word[data-script='other'] {
  font-family: 'Noto Sans Tifinagh', 'Geeza Pro', 'Noto Naskh Arabic', 'Hiragino Sans', 'Yu Gothic', system-ui, sans-serif;
  font-size: 0.8em;
  letter-spacing: 0;
}

.curtain__count {
  margin: 14px 0 0;
  font-size: 15px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.04em;
}

.curtain__count small {
  margin-left: 2px;
  font-size: 10px;
  opacity: 0.7;
}

.curtain__label {
  margin: 6px 0 0;
  color: var(--cream-soft);
  font-size: 12px;
  letter-spacing: 0.06em;
}

/* ------------------------------------------------------------------ the page underneath */
.page {
  min-height: 100svh;
  padding: clamp(18px, 3.4vh, 32px) clamp(20px, 4vw, 56px) clamp(32px, 6vh, 56px);
  display: grid;
  grid-template-rows: auto 1fr auto auto;
}

.top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
}

.brand {
  margin: 0;
  font-size: 19px;
  font-weight: 720;
  font-stretch: 108%;
  letter-spacing: -0.02em;
}

.top__line {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.title {
  align-self: end;
  margin: 0;
  padding-top: 14vh;
  font-family: 'Instrument Serif', serif;
  font-size: clamp(46px, 9vw, 132px);
  font-weight: 400;
  line-height: 0.98;
  letter-spacing: -0.02em;
}

/* each line rises out of a mask */
.title__line {
  display: block;
  overflow: hidden;
  padding-bottom: 0.08em;
}

.title__line > span {
  display: inline-block;
}

.text {
  max-width: 34ch;
  margin: 24px 0 0;
  color: var(--muted);
  font-size: 18px;
  line-height: 1.45;
}

.actions {
  margin-top: 28px;
}

/* ------------------------------------------------------------------ the button: an elastic pill
   With the pointer over it the words widen along the typeface's width axis and the pill swells with an overshoot;
   pressed, it squashes. The fill is a layer of its own and the wide words already have their room, so nothing
   around it moves. */
.replay {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 54px;
  padding: 0 26px;
  border: 0;
  border-radius: 999px;
  background: none;
  color: var(--paper);
  font: inherit;
  font-size: 16px;
  font-weight: 640;
  font-stretch: 100%;
  letter-spacing: -0.01em;
  white-space: nowrap;
  cursor: pointer;
  isolation: isolate;
  -webkit-tap-highlight-color: transparent;
}

.replay::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -1;
  border-radius: inherit;
  background: var(--ink);
  transition: inset 0.6s var(--bounce), transform 0.2s cubic-bezier(0.23, 1, 0.32, 1);
}

.replay__text {
  display: inline-block;
  text-align: center;
  transition: font-stretch 0.6s var(--bounce);
}

/* the words at their widest, invisible and zero tall: they keep the room */
.replay__text::before {
  content: attr(data-text);
  display: block;
  height: 0;
  overflow: hidden;
  visibility: hidden;
  font-stretch: 125%;
}

.replay__icon {
  flex: none;
  width: 18px;
  height: 18px;
  fill: none;
  stroke: var(--accent);
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform 0.6s var(--bounce);
}

@media (hover: hover) and (pointer: fine) {
  .replay:hover::before {
    inset: -2px -7px;
  }

  .replay:hover .replay__text {
    font-stretch: 125%;
  }

  .replay:hover .replay__icon {
    transform: translateX(3px) rotate(-40deg);
  }
}

.replay:active::before {
  transform: scale(1.03, 0.88);
}

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

@media (prefers-reduced-motion: reduce) {
  .replay::before,
  .replay__text,
  .replay__icon {
    transition: none;
  }
}
