/* The pneumatic tube button: a dark Submit request button on a white page, with a glass tube that rises from its top,
   bends and climbs out of sight. The tube, the brass carriers and the puff of air are drawn in a canvas. */
:root {
  --page: #ffffff;          /* the page */
  --button: #1b2331;        /* the button */
  --button-hi: #2a3446;     /* the button under the pointer */
  --label: #f6f0e2;         /* the words on the button */
  --brass: #c99a45;         /* the carriers, the collar and the clamps */
  --brass-dark: #6f4c1c;    /* brass in the shade */
  --brass-light: #f7e2a6;   /* the shine on the brass */
  --felt: #8c3328;          /* the felt rings that seal a carrier in the tube */
  --paper: #f4ecd9;         /* the request rolled inside the carrier */
  --glass: #d6e4ea;         /* the tint of the glass */
  --glass-edge: #6f8c9e;    /* the edges of the glass, where it is thickest */
  --ok: #8ee3a8;            /* the tick on Received */
  --ink: #1b2331;           /* the focus ring */
}

* {
  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: 'Instrument Sans 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 {
  min-height: 100svh;
  display: grid;
  place-items: center;
  padding: 24px 16px;
}

/* the whole thing: the tube above, the button at the bottom */
.pneu {
  position: relative;
  width: 340px;
  height: 480px;
}

.pneu__route {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
  visibility: hidden;
}

.pneu__canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

/* ---------------------------------------------------------------- the button */
.pneu__btn {
  position: absolute;
  left: 50%;
  bottom: 0;
  z-index: 2;
  width: 250px;
  height: 60px;
  margin-left: -125px;
  padding: 0;
  border: 0;
  border-radius: 30px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0) 46%, rgba(0, 0, 0, 0.18)),
    var(--button);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.14),
    inset 0 -1px 0 rgba(0, 0, 0, 0.3),
    0 16px 28px -16px rgba(18, 26, 40, 0.65),
    0 2px 6px rgba(18, 26, 40, 0.14);
  color: var(--label);
  font: inherit;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background-color 0.3s ease;
}

@media (hover: hover) and (pointer: fine) {
  .pneu[data-state='idle'] .pneu__btn:hover {
    background-color: var(--button-hi);
  }
}

.pneu[data-state]:not([data-state='idle']) .pneu__btn {
  cursor: default;
}

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

.pneu__words {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  overflow: hidden;
}

.pneu__word {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.005em;
  white-space: nowrap;
}

.pneu__icon {
  width: 18px;
  height: 18px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  overflow: visible;
}

.pneu__icon--tick {
  stroke: var(--ok);
  stroke-width: 2.4;
}

/* the arrow of the icon lifts under the pointer, or under the finger */
.pneu__icon path:first-child {
  transition: transform 0.35s cubic-bezier(0.3, 1.7, 0.5, 1);
}

@media (hover: hover) and (pointer: fine) {
  .pneu[data-state='idle'] .pneu__btn:hover [data-icon='send'] path:first-child {
    transform: translateY(-2px);
  }
}

.pneu__btn[data-press] [data-icon='send'] path:first-child {
  transform: translateY(-2px);
}

@media (max-width: 370px) {
  .pneu {
    width: 300px;
    height: 424px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .pneu__btn,
  .pneu__icon path:first-child {
    transition: none;
  }
}
