/* Loaders, tooltips and notifications adapted from Uiverse.io (MIT, https://github.com/uiverse-io/galaxy).
 * Looping animations carry the `.ambient` class so the "Pause motion" switch can stop them. */

/* ── Uiverse.io by ashish-yadv: loaders/ashish-yadv_heavy-walrus-26 ─ bouncing dots (sending) ─ */
.uv-dots {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  opacity: 0;
  pointer-events: none;
}

.uv-dots i {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--cream-100);
}

.uv-glow[aria-busy="true"] .uv-dots {
  opacity: 1;
}

.uv-glow[aria-busy="true"] .uv-dots i {
  animation: uv-bounce 1.2s ease-in-out infinite;
}

.uv-glow[aria-busy="true"] .uv-dots i:nth-child(2) {
  animation-delay: 0.15s;
}

.uv-glow[aria-busy="true"] .uv-dots i:nth-child(3) {
  animation-delay: 0.3s;
}

@keyframes uv-bounce {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-8px);
  }
}

/* ── Uiverse.io by Yaya12085: loaders/Yaya12085_giant-shrimp-51 ─ pulse dot ─ */
.uv-pulse {
  flex: none;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--gold-500);
  animation: none;
}

@keyframes uv-pulse {
  0% {
    box-shadow: 0 0 0 0 var(--gold-500);
  }
  100% {
    box-shadow: 0 0 0 12px rgb(244 183 49 / 0);
  }
}

/* ── Uiverse.io by Rodrypaladin: loaders/Rodrypaladin_evil-goat-39 ─ sun, shown while the painting loads ─ */
.uv-sun {
  position: absolute;
  z-index: -3;
  bottom: calc(var(--art-h, 50vh) * 0.4); /* sits under the painting, so it only shows while the image loads */
  left: 50%;
  width: 100px;
  height: 100px;
  margin: -50px 0 0 -50px;
  border-radius: 50%;
  background: #ffb52e;
  box-shadow: none;
  transform: rotate(0) scale(0.8);
  animation: uv-sun 1.6s infinite;
}

@keyframes uv-sun {
  0% {
    transform: rotate(360deg) scale(0.8);
  }
  50% {
    transform: rotate(0) scale(1.2);
  }
}

/* ── Uiverse.io by guilhermeyohan: Checkboxes/guilhermeyohan_white-cheetah-13 ─ drawn tick ─ */
.uv-tick {
  position: relative;
  display: inline-block;
  flex: none;
  width: 36px;
  height: 36px;
}

.uv-tick svg {
  width: 100%;
  height: 100%;
}

.uv-tick__bg {
  fill: var(--tick-bg);
  transition: fill 0.6s ease;
}

.uv-tick__ring,
.uv-tick__check {
  fill: none;
  stroke: #fff;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2px;
  opacity: 0; /* a zero-length dash still paints a round cap, so hide until drawn */
  transition: stroke-dashoffset 0.6s ease, opacity 0.1s ease;
}

.uv-tick__ring {
  stroke-miterlimit: 10;
  stroke-dasharray: 100;
  stroke-dashoffset: 100;
}

.uv-tick__check {
  stroke-dasharray: 22;
  stroke-dashoffset: 22;
}

.is-active .uv-tick__bg {
  fill: var(--cobalt-600);
}

.is-done .uv-tick__bg {
  fill: var(--leaf-600);
}

.is-done .uv-tick__ring,
.is-done .uv-tick__check {
  opacity: 1;
  stroke-dashoffset: 0;
}

/* ── Uiverse.io by bociKond: loaders/bociKond_foolish-sloth-24 ─ progress pill ─ */
.uv-meter {
  --clr: var(--cobalt-600);
  position: relative;
  height: 14px;
  overflow: hidden;
  border-radius: 5rem;
  outline: 3px solid var(--clr);
  outline-offset: 3px;
}

.uv-meter__fill {
  position: absolute;
  inset: 0;
  background: var(--clr);
  transform: scaleX(var(--progress, 0));
  transform-origin: left;
  transition: transform 0.6s var(--ease);
}

/* ── Uiverse.io by mrhyddenn: loaders/mrhyddenn_calm-snail-67 ─ spinner (sending) ─ */
.uv-spinner {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 24px;
  height: 24px;
  margin: -12px 0 0 -12px;
  border: 3px solid var(--gold-500);
  border-radius: 50%;
  border-top-color: transparent;
  border-bottom-color: transparent;
  opacity: 0;
}

.uv-ink[aria-busy="true"] .uv-spinner {
  opacity: 1;
  animation: uv-rot5 1s infinite;
}

@keyframes uv-rot5 {
  0% {
    transform: rotate(0);
  }
  50% {
    transform: rotate(180deg);
    border-top-color: var(--rose-500);
    border-bottom-color: var(--cream-100);
    border-right-color: transparent;
    border-left-color: transparent;
  }
  100% {
    transform: rotate(360deg);
  }
}

/* ── Uiverse.io by mrhyddenn: loaders/mrhyddenn_tasty-crab-98 ─ progress line (sending, and page scroll) ─ */
.uv-bar {
  height: 3px;
  overflow: hidden;
  border-radius: 7px;
  background: rgb(236 236 238 / 0.28);
}

.uv-bar > span {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 7px;
  background: var(--cream-50);
  transform: scaleX(0);
  transform-origin: left;
  animation: uv-load 2s ease infinite;
}

@keyframes uv-load {
  0% {
    transform: scaleX(0);
  }
  10% {
    transform: scaleX(0.1);
  }
  50% {
    transform: scaleX(0.4);
  }
  60% {
    transform: scaleX(0.6);
  }
  100% {
    transform: scaleX(1);
  }
}

.scroll-progress {
  position: fixed;
  inset: 0 0 auto;
  z-index: 70;
  height: 3px;
  border-radius: 0;
  background: transparent;
  pointer-events: none;
}

.scroll-progress > span {
  background: var(--gold-500);
  border-radius: 0;
  transform: scaleX(var(--scroll, 0));
  animation: none;
}

/* ── Uiverse.io by Quezaquo: Tooltips/Quezaquo_bitter-wolverine-27 ─ underlined term that pops ─ */
.uv-tip-pop,
.uv-tip-card,
.uv-tip-flip {
  position: relative;
  display: inline-block;
}

.uv-tip-pop__term,
.uv-tip-card__term,
.uv-tip-flip__term {
  display: inline;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  text-decoration: underline;
  text-decoration-color: var(--accent);
  text-decoration-thickness: 2px;
  text-underline-offset: 4px;
  cursor: help;
}

.uv-tip-pop__bubble {
  position: absolute;
  z-index: 6;
  bottom: calc(100% + 14px);
  left: 50%;
  width: max-content;
  max-width: min(300px, 78vw);
  padding: 0.75em 0.95em;
  border-radius: 12px;
  background: var(--ink-900);
  color: var(--cream-50);
  font-size: 0.875rem;
  font-weight: 500;
  line-height: 1.45;
  text-align: left;
  visibility: hidden;
  opacity: 0;
  translate: calc(-50% + var(--shift, 0px)) 10px;
  transform-origin: 50% 100%;
  box-shadow: 0 12px 28px -12px rgb(30 41 39 / 0.6);
}

/* a see-through bridge across the gap, so the pointer can travel from the term onto the tip (WCAG 1.4.13) */
.uv-tip-pop__bubble::before,
.uv-tip-card__panel::before,
.uv-tip-flip__panel::before {
  content: "";
  position: absolute;
  right: 0;
  left: 0;
  height: 16px;
}

.uv-tip-pop__bubble::before {
  top: 100%;
}

.uv-tip-card__panel::before,
.uv-tip-flip__panel::before {
  bottom: 100%;
}

.uv-tip-pop__bubble::after {
  content: "";
  position: absolute;
  top: 100%;
  left: calc(50% - var(--shift, 0px));
  margin-left: -7px;
  border: 7px solid transparent;
  border-top-color: var(--ink-900);
}

.uv-tip-pop:hover .uv-tip-pop__bubble,
.uv-tip-pop:focus-within .uv-tip-pop__bubble {
  visibility: visible;
  opacity: 1;
  animation: uv-popup 0.5s cubic-bezier(0.68, -0.55, 0.27, 1.55) forwards;
}

@keyframes uv-popup {
  0% {
    opacity: 0;
    scale: 0.9;
    translate: calc(-50% + var(--shift, 0px)) 10px;
  }
  60% {
    opacity: 1;
    scale: 1.03;
    translate: calc(-50% + var(--shift, 0px)) -4px;
  }
  100% {
    opacity: 1;
    scale: 1;
    translate: calc(-50% + var(--shift, 0px)) 0;
  }
}

/* ── Uiverse.io by SteveBloX: Tooltips/SteveBloX_orange-fox-41 ─ Material 3 style card tooltip ─ */
.uv-tip-card__panel {
  position: absolute;
  z-index: 6;
  top: calc(100% + 12px);
  left: 50%;
  display: block;
  width: max-content;
  max-width: min(320px, 80vw);
  padding: 16px 18px;
  border-radius: 12px;
  background: var(--cream-50);
  color: var(--ink-900);
  font-size: 0.875rem;
  line-height: 1.5;
  text-align: left;
  opacity: 0;
  visibility: hidden;
  scale: 0;
  translate: calc(-50% + var(--shift, 0px)) -10px;
  transform-origin: 50% 0;
  box-shadow: 0 1px 2px rgb(0 0 0 / 0.3), 0 2px 6px 2px rgb(0 0 0 / 0.15);
  transition: scale 0.25s var(--ease), opacity 0.2s, visibility 0.25s;
}

.uv-tip-card__title {
  display: block;
  margin-bottom: 4px;
  font-size: 1em;
  font-weight: 700;
}

.uv-tip-card__content {
  display: block;
  font-size: 0.9em;
}

.uv-tip-card:hover .uv-tip-card__panel,
.uv-tip-card:focus-within .uv-tip-card__panel {
  opacity: 1;
  visibility: visible;
  scale: 1;
}

/* ── Uiverse.io by Pipo-13: Tooltips/Pipo-13_ugly-swan-20 ─ tooltip that flips down ─ */
.uv-tip-flip {
  perspective: 600px;
}

.uv-tip-flip__panel {
  position: absolute;
  z-index: 6;
  top: calc(100% + 10px);
  left: 50%;
  width: max-content;
  max-width: min(280px, 78vw);
  padding: 0.75em 1em;
  border-radius: 8px;
  background: var(--terra-600);
  color: #fff;
  font-size: 0.875rem;
  line-height: 1.45;
  text-align: left;
  opacity: 0;
  visibility: hidden;
  translate: calc(-50% + var(--shift, 0px)) 0;
  transform: rotateX(90deg);
  transform-origin: 50% 0;
  box-shadow: 0 12px 28px -12px rgb(48 54 51 / 0.6);
  transition: transform 0.5s ease, opacity 0.5s ease, visibility 0.5s;
}

.uv-tip-flip:hover .uv-tip-flip__panel,
.uv-tip-flip:focus-within .uv-tip-flip__panel {
  opacity: 1;
  visibility: visible;
  transform: rotateX(0);
}

/* Esc closes any open tooltip (WCAG 1.4.13); main.js sets the attribute until the pointer or focus leaves. */
[data-tip-dismissed] .uv-tip-pop__bubble,
[data-tip-dismissed] .uv-tip-card__panel,
[data-tip-dismissed] .uv-tip-flip__panel,
.uv-infoball[data-tip-dismissed] .uv-infoball__tip {
  opacity: 0 !important;
  visibility: hidden !important;
}

/* ── Notifications ─ Uiverse.io by Yaya12085 (Notifications/Yaya12085_smooth-seahorse-63) ─ */
.toasts {
  position: fixed;
  bottom: max(16px, env(safe-area-inset-bottom));
  left: 50%;
  z-index: var(--z-toast);
  display: grid;
  gap: 10px;
  width: min(94vw, 400px);
  transform: translateX(-50%);
  pointer-events: none;
}

.uv-toast {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 10px 10px 12px;
  border-radius: 16px;
  background: var(--cream-50);
  box-shadow: var(--shadow-soft);
  color: var(--ink-900);
  pointer-events: auto;
  animation: uv-appear 0.5s var(--ease) both;
}

.uv-toast.is-leaving {
  animation: uv-leave 0.3s ease forwards;
}

.uv-toast__icon {
  display: grid;
  flex: none;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: #dcf1e3;
  color: var(--leaf-600);
  transition: transform 0.6s ease;
}

.uv-toast:hover .uv-toast__icon {
  transform: rotate(45deg) scale(1.05);
}

.uv-toast__body {
  flex: 1;
  min-width: 0;
}

.uv-toast__title {
  font-size: 0.95rem;
  font-weight: 700;
  line-height: 1.2;
}

.uv-toast__text {
  margin-top: 2px;
  color: var(--ink-700);
  font-size: 0.8125rem;
  line-height: 1.4;
}

.uv-toast__close {
  flex: none;
  min-height: 44px;
  padding: 0.5rem 1rem;
  border: 0;
  border-radius: 10px;
  background: var(--cobalt-800);
  box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -1px rgb(0 0 0 / 0.06);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  transition: transform 0.4s ease, background-color 0.4s ease;
}

.uv-toast__close:hover {
  background: var(--cobalt-800);
  transform: scale(1.05);
}

/* ── Notifications ─ Uiverse.io by Gianluks90 (Notifications/Gianluks90_funny-impala-78) ─ gradient edge ─ */
.uv-toast--note {
  isolation: isolate;
  border-radius: 20px;
}

.uv-toast--note::before {
  content: "";
  position: absolute;
  z-index: -1;
  inset: -3px;
  border-radius: 23px;
  background: linear-gradient(75deg, var(--gold-500), var(--rose-500), var(--cobalt-600), var(--gold-500));
  background-size: 300% 300%;
  animation: uv-edge 4s ease alternate infinite;
}

.uv-toast--note .uv-toast__icon {
  background: #ececf4;
  color: var(--cobalt-800);
}

@keyframes uv-edge {
  0% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
  100% {
    background-position: 0% 50%;
  }
}

@keyframes uv-appear {
  from {
    opacity: 0;
    transform: translateY(14px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes uv-leave {
  to {
    opacity: 0;
    transform: translateY(10px) scale(0.97);
  }
}

/* ── Uiverse.io by elijahgummer: Cards/elijahgummer_hot-fly-77 ─ skeleton shimmer while the painting loads ─ */
.uv-skeleton {
  position: absolute;
  inset: 0;
  z-index: -2;
  padding: 26px;
  overflow: hidden;
  background: #2a57d6;
}

.uv-skeleton__avatar,
.uv-skeleton__line {
  position: relative;
  display: block;
  overflow: hidden;
  border-radius: 10px;
  background: rgb(255 255 255 / 0.2);
}

.uv-skeleton__avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
}

.uv-skeleton__line {
  height: 12px;
  margin-top: 14px;
}

.uv-skeleton__line--1 { width: 60%; }
.uv-skeleton__line--2 { width: 78%; }
.uv-skeleton__line--3 { width: 44%; }

.uv-skeleton__avatar::before,
.uv-skeleton__line::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: linear-gradient(to right, transparent 0, rgb(255 255 255 / 0.4) 20%, transparent 40%);
  background-repeat: no-repeat;
  background-size: 450px 100%;
  animation: uv-shimmer 1s linear infinite;
}

.stage[data-ready="true"] .uv-skeleton,
.hero[data-ready="true"] .uv-sun {
  display: none;
}

@keyframes uv-shimmer {
  0% {
    background-position: -450px 0;
  }
  100% {
    background-position: 450px 0;
  }
}

/* ── Uiverse.io by Yaya12085: Tooltips/Yaya12085_average-earwig-11 ─ envelope that opens a letter ─ */
.uv-envelope {
  --w: 120px;
  --h: 76px;
  position: relative;
  display: block;
  width: var(--w);
  height: var(--h);
  margin-top: clamp(36px, 5vw, 64px);
  padding: 0;
  border: 1px solid var(--cream-50);
  border-radius: 5px;
  background-image: linear-gradient(to left bottom, #f2f5f8, #ecf1f2, #e7eceb, #e3e7e4, #e1e2de);
  background-color: var(--cream-200);
  box-shadow: 0 10px 14px rgb(0 0 0 / 0.2);
  color: var(--ink-900);
}

.uv-envelope::before {
  content: "";
  position: absolute;
  top: -50%;
  width: 100%;
  height: 50%;
  clip-path: polygon(50% 0, 0 100%, 100% 100%);
  border-radius: 5px;
  background-image: linear-gradient(to left bottom, #f2f5f8, #e4eaec, #d8dfde, #cdd3cf, #c5c7c1);
  transform-style: preserve-3d;
  transform: perspective(1000px) rotateX(-150deg) translateY(-110%);
  transition: transform 0.3s ease;
}

/* the wrapper is the envelope, the button fills it, and the letter is the button's sibling (a button's children are presentational) */
.uv-envelope__btn {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 0;
  border-radius: inherit;
  background: none;
}

.uv-envelope__at {
  font-size: 2.4rem;
  font-weight: 700;
  line-height: 1;
}

.uv-envelope__letter {
  position: absolute;
  bottom: calc(100% + 16px);
  left: 50%;
  width: min(250px, 78vw);
  padding: 12px 16px;
  border: 1px solid #cecccc;
  border-radius: 5px;
  background:
    linear-gradient(rgb(0 0 0 / 0.045) 1px, transparent 1px) 0 0 / 100% 7px,
    #f6f4ef;
  color: var(--ink-900);
  font-size: 0.9375rem;
  font-weight: 600;
  line-height: 1.4;
  letter-spacing: 0.01em;
  text-align: left;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  translate: calc(-50% + var(--shift, 0px)) 0;
  transform: translateY(26px);
  transition: transform 0.3s ease, opacity 0.2s, visibility 0.2s;
}

.uv-envelope:hover,
.uv-envelope:focus-within {
  border-top-left-radius: 0;
  border-top-right-radius: 0;
}

.uv-envelope:hover::before,
.uv-envelope:focus-within::before {
  background-color: #fff;
  background-image: none;
  transform: rotateY(0);
}

.uv-envelope:hover .uv-envelope__letter,
.uv-envelope:focus-within .uv-envelope__letter {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: none;
}

.uv-envelope__letter::before {
  content: "";
  position: absolute;
  top: 100%;
  right: 0;
  left: 0;
  height: 20px;
}

.uv-envelope[data-tip-dismissed] .uv-envelope__letter {
  opacity: 0 !important;
  visibility: hidden !important;
}
