/*
 * fix-v1-loader (2026-10-24, the owner: "revert the loading thing to be like the one that we had in V1"): the ONE "the
 * app is working" mark of web v2, V1's ThinkingMark (src/app/thinking-mark.tsx + src/app/thinking-mark.css) as it was:
 * the same 24 x 24 glyph (three dots that turn a third of the way round while drifting apart and back, and a middle
 * core dot that breathes), the same 2 s loop with its rest, the same ending (the glyph fades and shrinks while a green
 * check draws in), the same reduced motion (the mark only fades slowly). Drawn by vidlab-thinking-mark.js
 * (window.__vlThinkingMark, window.__vlGeneratingMark); a file, so the sign-in pages keep style-src 'self'.
 *
 * V1's colours: the dots take the text colour (currentColor); the core is V1's accent tint (#ffffff); the check is
 * V1's "good" green (#3fcf6f). On a white button the core takes the button's dark text colour, as V1 did.
 * Everything moves with transform and opacity only.
 */

.tm {
  --tm-loop: 2s;
  --tm-ease: cubic-bezier(0.65, 0, 0.35, 1);
  --tm-accent: #ffffff;
  display: inline-block;
  flex: none;
  overflow: visible;
  vertical-align: middle;
}
.tm * {
  transform-box: view-box;
  transform-origin: 12px 12px;
}
.tm-accent {
  fill: var(--tm-accent);
  stroke: var(--tm-accent);
}

/* On a white primary button the white core would vanish: the whole glyph takes the button's dark text colour. */
.tm[data-on-light],
button.primary .tm,
.vlc-btn-white .tm,
.vlk-white .tm,
.vls-white .tm,
.vlx-white .tm,
.vlbs-white .tm,
.vlbk-white .tm,
.vlcf-primary .tm {
  --tm-accent: currentColor;
}

/* --- the ending: the living glyph hands over to the check (or to its own still shape) without a jump ---------- */
.tm-live,
.tm-rest,
.tm-check {
  transition:
    opacity 0.18s cubic-bezier(0.23, 1, 0.32, 1),
    transform 0.18s cubic-bezier(0.23, 1, 0.32, 1);
}
.tm-rest,
.tm-check {
  opacity: 0;
}
.tm[data-state='idle'] .tm-live,
.tm[data-state='done'] .tm-live {
  opacity: 0;
}
.tm[data-state='done'] .tm-live {
  transform: scale(0.6);
}
.tm[data-state='idle'] .tm-rest {
  opacity: 1;
}
.tm-check {
  stroke: #3fcf6f;
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
}
.tm[data-state='done'] .tm-check {
  opacity: 1;
  stroke-dashoffset: 0;
  transition:
    opacity 0.1s linear 0.06s,
    stroke-dashoffset 0.25s cubic-bezier(0.23, 1, 0.32, 1) 0.06s;
}
/* A check that was already done when the page drew it (an old message) does not replay. */
.tm[data-still] .tm-check,
.tm[data-still] .tm-live,
.tm[data-still] .tm-rest {
  transition: none;
}

/* The glyph keeps its pose while it fades away at the end: paused, never snapped back. */
.tm:not([data-state='working']) .tm-live * {
  animation-play-state: paused !important;
}

/* --- the glyph, "orbit": three dots turn a third of the way round, drifting apart and back; the middle one breathes */
.tm-o1 {
  --tx: 0px;
  --ty: -2.3px;
}
.tm-o2 {
  --tx: 2px;
  --ty: 1.15px;
}
.tm-o3 {
  --tx: -2px;
  --ty: 1.15px;
}
.tm-live .tm-orbit {
  animation: tm-orbit var(--tm-loop) var(--tm-ease) infinite;
}
.tm-live .tm-orbit > * {
  animation: tm-apart var(--tm-loop) var(--tm-ease) infinite;
}
.tm-live .tm-core {
  animation: tm-core var(--tm-loop) var(--tm-ease) infinite;
}
@keyframes tm-orbit {
  0% {
    transform: rotate(0deg);
  }
  68%,
  100% {
    transform: rotate(120deg);
  }
}
@keyframes tm-apart {
  0%,
  68%,
  100% {
    transform: translate(0, 0);
  }
  34% {
    transform: translate(var(--tx), var(--ty));
  }
}
@keyframes tm-core {
  0%,
  68%,
  100% {
    transform: scale(1);
    opacity: 1;
  }
  34% {
    transform: scale(0.45);
    opacity: 0.55;
  }
}

/* --- a tile that is still being made (V1's GeneratingMark, generating-mark.tsx): the mark in the middle of the tile and
 * one word under it. The mark follows the tile's width (never under 24 px or over 44 px), so a small grid tile and a
 * large single tile both read. Behind it, V1's Studio tile glow: a soft light from the top that slowly pulses. ------ */
.vl-gm {
  position: absolute;
  inset: 0;
  z-index: 1;
  container-type: inline-size;
  pointer-events: none;
}
.vl-gm-glow {
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom, rgba(255, 255, 255, 0.05), transparent);
  animation: vl-gm-pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}
@keyframes vl-gm-pulse {
  50% {
    opacity: 0.5;
  }
}
.vl-gm-in {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: clamp(8px, 4cqw, 14px);
  padding: 8px;
  color: #ffffff;
  text-align: center;
}
.vl-gm-in > .tm {
  width: clamp(24px, 16cqw, 44px);
  height: clamp(24px, 16cqw, 44px);
  opacity: 0.9;
}
.vl-gm-word {
  font-size: clamp(11.5px, 3.4cqw, 13px);
  line-height: 16px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.75);
}
.vl-gm-sub {
  margin-top: calc(-1 * clamp(4px, 2cqw, 8px));
  font-size: clamp(11px, 3.2cqw, 12px);
  line-height: 16px;
  color: rgba(255, 255, 255, 0.5);
  font-variant-numeric: tabular-nums;
}

/* --- the shell's own "running" marks (the sidebar's Recents, its loading icons) show the same mark ------------- */
/* Its comet (a span with no children of its own): vidlab-thinking-mark.js puts the mark inside it. */
.rail-comet[data-vl-tm] {
  background: none !important;
  -webkit-mask: none !important;
  mask: none !important;
  animation: none !important;
  width: 14px;
  height: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.rail-comet[data-vl-tm]::after {
  display: none !important;
}
.rail-comet[data-vl-tm] > .tm {
  width: 14px;
  height: 14px;
}
/* Its spinning loader icons: the icon's own lines are hidden and the same glyph is painted in their place. */
svg.animate-spin:not(.tm) {
  animation: none !important;
  background-color: currentColor;
  -webkit-mask: var(--vl-tm-mask) center / contain no-repeat;
  mask: var(--vl-tm-mask) center / contain no-repeat;
}
svg.animate-spin:not(.tm) > * {
  visibility: hidden;
}
:root {
  --vl-tm-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cstyle%3E*%7Btransform-box:view-box;transform-origin:12px 12px%7D.o%7Banimation:o 2s cubic-bezier(.65,0,.35,1) infinite%7D.o circle%7Banimation:a 2s cubic-bezier(.65,0,.35,1) infinite%7D.c%7Banimation:c 2s cubic-bezier(.65,0,.35,1) infinite%7D.d1%7B--tx:0px;--ty:-2.3px%7D.d2%7B--tx:2px;--ty:1.15px%7D.d3%7B--tx:-2px;--ty:1.15px%7D@keyframes o%7B0%25%7Btransform:rotate(0)%7D68%25,100%25%7Btransform:rotate(120deg)%7D%7D@keyframes a%7B0%25,68%25,100%25%7Btransform:translate(0,0)%7D34%25%7Btransform:translate(var(--tx),var(--ty))%7D%7D@keyframes c%7B0%25,68%25,100%25%7Btransform:scale(1);opacity:1%7D34%25%7Btransform:scale(.45);opacity:.55%7D%7D@media (prefers-reduced-motion:reduce)%7B.o,.o circle,.c%7Banimation:none%7D%7D%3C/style%3E%3Cg class='o'%3E%3Ccircle class='d1' cx='12' cy='7' r='2.7'/%3E%3Ccircle class='d2' cx='16.33' cy='14.5' r='2.7'/%3E%3Ccircle class='d3' cx='7.67' cy='14.5' r='2.7'/%3E%3C/g%3E%3Ccircle class='c' cx='12' cy='12' r='1.7'/%3E%3C/svg%3E");
}

/* --- reduced motion: nothing moves; the mark only fades slowly ------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  .tm[data-state='working'] .tm-live * {
    animation: none !important;
  }
  .tm[data-state='working'] .tm-live {
    animation: tm-pulse 2.4s ease-in-out infinite;
  }
  .tm-live,
  .tm-rest,
  .tm-check,
  .tm[data-state='done'] .tm-check {
    transition: none;
  }
  .tm[data-state='done'] .tm-live {
    transform: none;
  }
  .vl-gm-glow {
    animation: none;
  }
  svg.animate-spin:not(.tm) {
    animation: tm-pulse 2.4s ease-in-out infinite !important;
  }
}
@keyframes tm-pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.45;
  }
}
