/* Pop-up notifications in the bottom right (js/notify.js). On every page, so this only leans
   on the tokens in style.css and brings its own spring. */

.onote-stack {
  --spring-in: cubic-bezier(0.22, 1.35, 0.36, 1);
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 90;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  width: min(360px, calc(100vw - 32px));
  pointer-events: none;
}

.onote {
  --tone: var(--blue, #2D97F8);
  position: relative;
  overflow: hidden;
  width: 100%;
  margin-top: 10px;
  border-radius: 14px;
  background: rgba(var(--plate-rgb, 14, 19, 27), .94);
  box-shadow: inset 0 0 0 1.5px rgba(255, 255, 255, .09), 0 18px 40px rgba(0, 0, 0, .45), 0 2px 8px rgba(0, 0, 0, .3);
  backdrop-filter: blur(14px) saturate(1.3);
  -webkit-backdrop-filter: blur(14px) saturate(1.3);
  color: var(--text, #E6EDF6);
  pointer-events: auto;
  opacity: 0;
  transform: translateX(calc(100% + 30px));
  transition: transform 560ms var(--spring-in), opacity 240ms ease-out,
    height 380ms cubic-bezier(.2, .8, .2, 1), margin-top 380ms cubic-bezier(.2, .8, .2, 1), box-shadow 200ms ease-out;
}
.onote.in { opacity: 1; transform: none; }
.onote.out {
  height: 0 !important;
  margin-top: 0;
  opacity: 0;
  transform: translateX(40px) scale(.96);
  transition: transform 300ms ease-in, opacity 220ms ease-in, height 360ms cubic-bezier(.4, 0, .2, 1) 80ms, margin-top 360ms cubic-bezier(.4, 0, .2, 1) 80ms;
}
.onote:hover { box-shadow: inset 0 0 0 1.5px rgba(var(--blue-rgb, 45, 151, 248), .45), 0 20px 44px rgba(0, 0, 0, .5); }
.onote::before { content: ""; position: absolute; left: 0; top: 12px; bottom: 12px; width: 3px; border-radius: 0 3px 3px 0; background: var(--tone); }

.onote--request, .onote--accepted { --tone: #3DD6A0; }
.onote--online { --tone: #37D28A; }
.onote--lobby { --tone: #7FD6FF; }

.onote__main { display: flex; align-items: center; gap: 12px; min-width: 0; padding: 13px 44px 15px 16px; color: inherit; text-decoration: none; }
.onote__ava {
  position: relative;
  flex: none;
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: linear-gradient(145deg, var(--blue-deep, #1B6FC4), var(--blue-deeper, #0B2A4F));
  font: 800 18px var(--display, system-ui);
  color: #fff;
}
.onote__ava img { width: 100%; height: 100%; border-radius: inherit; object-fit: cover; }
.onote__ico {
  position: absolute;
  right: -5px;
  bottom: -5px;
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border-radius: 7px;
  background: var(--tone);
  box-shadow: 0 0 0 2.5px rgb(var(--plate-rgb, 14, 19, 27));
  color: #04101F;
}
.onote__ico svg { width: 12px; height: 12px; }
.onote__txt { min-width: 0; display: grid; gap: 1px; }
.onote__txt b { font: 800 15px/1.25 var(--display, system-ui); color: #fff; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.onote__txt > span { font-size: 13.5px; line-height: 1.35; color: var(--text-4, #AEB9C6); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.onote__q { color: var(--text-2, #DCE3EC); }
.onote.is-done .onote__txt > span { color: #7EE8B4; }

.onote__x {
  position: absolute;
  top: 9px;
  right: 9px;
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--faint, #7F8B9B);
  cursor: pointer;
  transition: background-color 160ms ease-out, color 160ms ease-out;
}
.onote__x svg { width: 12px; height: 12px; }
.onote__x:hover, .onote__x:focus-visible { background: rgba(255, 255, 255, .08); color: #fff; }

.onote__acts { display: flex; gap: 8px; padding: 0 14px 15px 70px; margin-top: -4px; }
.onote__btn {
  flex: 1;
  min-height: 32px;
  border: 0;
  border-radius: 8px;
  background: rgba(255, 255, 255, .07);
  box-shadow: inset 0 0 0 1.5px rgba(255, 255, 255, .12);
  color: var(--text-2, #DCE3EC);
  font: 800 12.5px var(--display, system-ui);
  letter-spacing: .06em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background-color 160ms ease-out, box-shadow 160ms ease-out, translate 160ms ease-out;
}
.onote__btn:hover { background: rgba(255, 255, 255, .12); translate: 0 -1px; }
.onote__btn--yes { background: var(--blue, #2D97F8); box-shadow: none; color: #fff; }
.onote__btn--yes:hover { background: var(--blue-bright, #5BB0FF); }
.onote__btn:disabled { opacity: .5; pointer-events: none; }

/* The line that runs out as the pop-up does, and stops when it's held. */
.onote__bar {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 2.5px;
  background: var(--tone);
  opacity: .85;
  transform-origin: left center;
  animation: onote-drain var(--life, 5200ms) linear forwards;
}
.onote.is-held .onote__bar { animation-play-state: paused; }
.onote.is-done .onote__bar { opacity: 0; }
@keyframes onote-drain { to { transform: scaleX(0); } }

@media (max-width: 560px) {
  .onote-stack { right: 12px; left: 12px; bottom: calc(12px + env(safe-area-inset-bottom, 0px)); width: auto; align-items: stretch; }
  .onote { transform: translateY(calc(100% + 24px)); }
  .onote.out { transform: translateY(20px) scale(.97); }
  .onote__main { padding: 12px 42px 14px 14px; }
  .onote__acts { padding-left: 68px; }
}

/* Less movement: it fades instead of flying in. The draining line stays, since it says how
   long is left rather than decorating anything. */
@media (prefers-reduced-motion: reduce) {
  .onote, .onote.out { transform: none; transition: opacity 200ms ease-out, height 200ms ease-out, margin-top 200ms ease-out; }
}
