/* The blind pressed button: a hairline pill on a white page, made of words and a line. Pressed, the paper sinks into
   a blind deboss from the point you press; the new words are pressed into the paper, with a dark edge above and a
   light edge below each letter. One vermilion only, for the small line once you are on the list. */
:root {
  --page: #ffffff;          /* the page */
  --ink: #161513;           /* the words at rest and the outline under the pointer */
  --muted: #8b877e;         /* the brand and the small line */
  --line: #cfcbc2;          /* the pill outline at rest */
  --sunk: #f2f0eb;          /* the paper pressed down inside the pill */
  --sunk-ink: #dcd8cf;      /* the pressed in words, a touch darker than the pressed paper */
  --accent: #d9442b;        /* the small line once you are on the list */
  --focus: #161513;         /* the ring of the keyboard's focus */
}

* {
  box-sizing: border-box;
}

html {
  touch-action: manipulation;
}

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

body {
  min-height: 100svh;
  background: var(--page);
  color: var(--ink);
  font-family: 'Archivo Variable', 'Archivo', 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 {
  min-height: 100svh;
  display: grid;
  place-items: center;
  padding: 32px 16px;
}

.press {
  display: grid;
  justify-items: center;
  gap: 14px;
}

.press__brand {
  margin: 0 0 4px;
  font-size: 11px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--muted);
  font-variation-settings: 'wdth' 112;
}

.press__note {
  margin: 4px 0 0;
  min-height: 1.4em;
  font-size: 13px;
  color: var(--muted);
  font-variation-settings: 'wdth' 96;
  text-align: center;
}

.press__note.is-done {
  color: var(--accent);
}

/* the pill: the button is moved by GSAP (y, scale), the two layers inside are drawn by the CSS */
.press__btn {
  --w: 100;
  position: relative;
  width: clamp(220px, 64vw, 300px);
  height: clamp(54px, 11vh, 64px);
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: var(--page);
  color: inherit;
  font: inherit;
  cursor: pointer;
  overflow: hidden;
  isolation: isolate;
  -webkit-tap-highlight-color: transparent;
}

.press__btn:focus {
  outline: none;
}

.press__btn:focus-visible {
  outline: 1.5px solid var(--focus);
  outline-offset: 4px;
}

.press__face,
.press__sunk {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  border-radius: inherit;
}

.press__face {
  border: 1px solid var(--line);
  transition: border-color 0.25s ease;
}

/* the pressed paper: a slightly darker sheet with the shadows of a deboss, and a fine grain; JS opens it with a circle
   that grows from the point you press */
.press__sunk {
  background-color: var(--sunk);
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='120' height='120'><filter id='g'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0  0 0 0 0 0  0 0 0 0 0  0 0 0 0.05 0'/></filter><rect width='120' height='120' filter='url(%23g)'/></svg>");
  box-shadow:
    inset 0 2px 5px rgba(22, 21, 19, 0.16),
    inset 0 1px 1px rgba(22, 21, 19, 0.1),
    inset 0 -1px 1px rgba(255, 255, 255, 0.95),
    inset 0 -3px 6px rgba(255, 255, 255, 0.6);
  clip-path: circle(0px at 50% 50%);
}

.press__word {
  font-size: clamp(16px, 2.6vh, 19px);
  font-weight: 560;
  letter-spacing: 0.01em;
  font-variation-settings: 'wdth' var(--w);
  white-space: nowrap;
  pointer-events: none;
}

/* the pressed in words: a dark edge above, a light edge below, as if the type had pushed the paper down */
.press__word--sunk {
  color: var(--sunk-ink);
  font-weight: 640;
  text-shadow:
    0 -1px 0 rgba(22, 21, 19, 0.34),
    0 -0.5px 1px rgba(22, 21, 19, 0.18),
    0 1px 0 rgba(255, 255, 255, 1),
    0 1.5px 1px rgba(255, 255, 255, 0.7);
}

/* the thin ring of pressure that runs out from the point you press */
.press__ring {
  position: absolute;
  left: 0;
  top: 0;
  border-radius: 50%;
  border: 1px solid rgba(22, 21, 19, 0.1);
  pointer-events: none;
  opacity: 0;
}

@media (hover: hover) {
  .press__btn:hover .press__face {
    border-color: var(--ink);
  }
}
