/* The ribbon toast: a dark satin ribbon at the bottom of a white page, blue on the side that says the message went.
   The ribbon is painted by script.js on a canvas, with these colours; the buttons on it are real and transparent. */
:root {
  --page: #ffffff;          /* the page */
  --face: #16161c;          /* the ribbon while the message goes, and after Undo */
  --face-sent: #2340e8;     /* the ribbon once the message is sent */
  --words: #ffffff;         /* the words on the ribbon */
  --shadow: #10122a;        /* the ribbon's shadow on the page */
  --button: #f0f0f3;        /* the button that sends a message */
  --button-ink: #16161c;    /* its words */
}

* {
  box-sizing: border-box;
}

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

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

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

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

/* the button sits just above the place where the notification comes */
.stage {
  min-height: 100svh;
  display: grid;
  justify-items: center;
  align-items: end;
  padding: 40px 16px calc(150px + env(safe-area-inset-bottom));
}

/* ---------------------------------------------------------------- the button that sends */
.send {
  height: 52px;
  padding: 0 26px;
  border: 0;
  border-radius: 999px;
  background: var(--button);
  color: var(--button-ink);
  font: inherit;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.005em;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
  transition: transform 160ms cubic-bezier(0.23, 1, 0.32, 1), background-color 200ms ease;
}

@media (hover: hover) and (pointer: fine) {
  .send:hover {
    background: color-mix(in srgb, var(--button) 88%, var(--button-ink));
  }
}

.send:active {
  transform: scale(0.97);
}

.send:focus-visible {
  outline: 2px solid var(--face-sent);
  outline-offset: 4px;
}

/* ---------------------------------------------------------------- the notification */
/* a strip of the page's own white along the bottom edge, under the notification: Safari on iPhone colours the band
   under its bar from a fixed element near the bottom, and without it could take the dark ribbon */
.floor {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 5;
  height: 72px;
  background: var(--page);
  pointer-events: none;
}

.toaster {
  position: fixed;
  left: 50%;
  bottom: calc(24px + env(safe-area-inset-bottom));
  z-index: 10;
  width: min(380px, calc(100vw - 32px));
  height: 70px;
  translate: -50% 0;
}

/* the ribbon's place: it takes the pointer only while there is a ribbon */
.toast {
  position: absolute;
  inset: 0;
  pointer-events: none;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.toast.is-on {
  pointer-events: auto;
}

/* the painting is bigger than the toast: the twist and the shadow need room round it */
.toast__paint {
  position: absolute;
  pointer-events: none;
}

/* the real buttons, where the script has painted them */
.toast__undo,
.toast__close {
  position: absolute;
  padding: 0;
  border: 0;
  background: transparent;
  color: transparent;
  font: inherit;
  font-size: 13.5px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.toast__undo {
  border-radius: 10px;
}

.toast__close {
  border-radius: 9px;
}

/* a finger gets a bigger target than the painted button */
.toast__undo::before,
.toast__close::before {
  content: '';
  position: absolute;
  inset: -6px -3px;
}

/* the keyboard's ring, only while the ribbon lies flat (during a twist the painting moves under it) */
.toast__undo:focus-visible,
.toast__close:focus-visible {
  outline: none;
}

.toast.is-flat .toast__undo:focus-visible,
.toast.is-flat .toast__close:focus-visible {
  outline: 2px solid var(--words);
  outline-offset: 2px;
}

.toast__undo[hidden] {
  display: none;
}

/* schermi bassi (la casella dell'anteprima sul telefono): il nastro sale un poco, così la tela della sua ombra, più
   lunga del nastro di 56 px, finisce dentro lo schermo */
@media (max-height: 520px) {
  .toaster {
    bottom: calc(52px + env(safe-area-inset-bottom));
  }
}
