/* One skeleton for everything that loads (round 42 «Скелетоны», owner 2026-10-17: «А делаем всё, принимаю по рекомендациям»): one plate,
   six parts, one sheen, one set of timings. A kind only says which parts and where (its silhouette, ui/skeleton.js); colours, radius,
   motion and the reveal are here and nowhere else. It replaced five systems: Home's breathing plates, the dock's and a busy card's 1.3 s
   linear shimmer, the video's spinner, the live page's own line and the HTML cards' square bars (ui/kinds.css .kwait). The board's dock
   sweeps with the same sheen, still only while the person waits for something (ui/busy.js). */
:root, [data-hy-theme] {
  /* colours: the plate is one step above the board, never its colour; the parts one step lighter; the sheen a soft light that passes */
  --hy-sk-ground: color-mix(in srgb, var(--ink) 5%, var(--raise));
  --hy-sk-part: color-mix(in srgb, var(--ink) 8%, transparent);
  --hy-sk-sheen: color-mix(in srgb, var(--ink) 7%, transparent);
  --hy-sk-dim: rgba(0, 0, 0, .22);   /* an older picture under the line, dimmed a little */
}
:root[data-theme=light], [data-hy-theme=light], .hy-sk[data-tone=light] { --hy-sk-part: rgba(0, 0, 0, .07); --hy-sk-sheen: rgba(255, 255, 255, .55); }
.hy-sk[data-tone=dark] { --hy-sk-part: rgba(255, 255, 255, .08); --hy-sk-sheen: rgba(255, 255, 255, .07); }
:root {
  /* geometry: a line's height (a capsule), the top line's thickness; a block's radius is set per plate (ui/skeleton.js, decision 4) */
  --hy-sk-line: 7px; --hy-sk-lh: 3px;
  /* motion: one sheen for all, 100°, a pass of 1.4 s and a rest of 0.6 s; every sheen on screen in the same phase: a plate starts where the
     screen's sheen is (--hy-sk-ph, a negative delay set when it is made) and hySkeleton.sync puts any that started anew back in step */
  --hy-sk-angle: 100deg; --hy-sk-period: 2s; --hy-sk-ease: cubic-bezier(.45, 0, .2, 1);
  /* timing: nothing for 150 ms, then the skeleton comes in over 120 ms; the content fades in over 200 ms and the skeleton goes with it */
  --hy-sk-delay: 150ms; --hy-sk-in: 120ms; --hy-sk-reveal: 200ms;
}

/* the plate: over the object's content, under its marks (z 3) */
.hy-sk, .hy-sk-old { position: absolute; inset: 0; z-index: var(--hy-z-local); overflow: hidden; pointer-events: none; border-radius: var(--hy-sk-r-card, 0px);
  opacity: 0; animation: hySkIn var(--hy-sk-in) ease var(--hy-sk-delay) forwards; }
.hy-sk { background: var(--hy-sk-ground); }
.hy-sk.in, .hy-sk-old.in { animation-delay: 0s; }   /* put in by ui/skeleton.js, which waited the 150 ms itself */
.hy-sk.now, .hy-sk-old.now { opacity: 1; animation: none; }   /* drawn at once, or already in: put back after a redraw, it does not fade in again */
.hy-sk.out, .hy-sk-old.out { animation: hySkOut var(--hy-sk-reveal) var(--hy-ease) forwards; }
@keyframes hySkIn { to { opacity: 1; } }
@keyframes hySkOut { from { opacity: 1; } to { opacity: 0; } }
.hy-skbox { position: relative; }   /* a place of its own for a plate in a page's flow (Home's list and its updates) */

/* the six parts, every one rounded, nothing square (sk-: the board has its own .bar and .dot) */
.hy-sk > i { position: absolute; display: block; background: var(--hy-sk-part); }
.hy-sk > :is(.sk-bar, .sk-blk) { border-radius: var(--hy-sk-r, 5px); }   /* a header or a toolbar; a picture, a panel, a card inside */
.hy-sk > :is(.sk-ln, .sk-trk) { border-radius: var(--hy-r-pill); }   /* a line of text, a capsule; a video's time line at the bottom edge */
.hy-sk > :is(.sk-dot, .sk-play) { border-radius: 50%; }   /* an avatar, an icon, a model; a video's ▶ */
.hy-sk > .sk-play { display: grid; place-items: center; }
.hy-sk > .sk-play::before { content: ""; width: 34%; height: 40%; margin-left: 10%; background: color-mix(in srgb, var(--ink) 22%, transparent); clip-path: polygon(0 0, 100% 50%, 0 100%); }

/* decision 1, the sheen: one band of light across the plate, a transform only (the compositor moves it, nothing is painted again) */
.hy-sk::after, .dk-skel > i:not(.dk-gap)::after { content: ""; position: absolute; inset: 0; transform: translateX(-100%);
  background: linear-gradient(var(--hy-sk-angle), transparent 30%, var(--hy-sk-sheen) 50%, transparent 70%);
  animation: hySkSheen var(--hy-sk-period) var(--hy-sk-ease) var(--hy-sk-ph, 0s) infinite; }   /* --hy-sk-ph: the screen's phase when it came */
@keyframes hySkSheen { 0% { transform: translateX(-100%); } 70%, 100% { transform: translateX(100%); } }

/* the plate over the colours of its picture (skeleton.js o.grid; owner 2026-11-06: «вместо серого бекграунда брал бы цвет самой
   карточки»): a 49 x 33 image of the card's 4 x 3 colours
   blended as Rust blends them (ui/rustgrid.js png), stretched by 49/48 and 33/32 and centred, so its first and last pixel centres lie on the plate's edges, as the card's edges are
   the first and last cell's centres in Rust (hyrender gridmap.rs uv). The parts over it are white at 14 % on a dark colour, black at 11 % on a light one, the ▶ white at 50 % or
   black at 40 %, as Rust draws them (skel.rs tone) */
.hy-sk[data-grid] { background: var(--hy-sk-grid) 50% 50% / 102.0834% 103.125% no-repeat, var(--hy-sk-ground); }
.hy-sk[data-grid][data-tone=dark] { --hy-sk-part: rgba(255, 255, 255, .14); --hy-sk-play: rgba(255, 255, 255, .5); --hy-sk-sheen: rgba(255, 255, 255, .08); }
.hy-sk[data-grid][data-tone=light] { --hy-sk-part: rgba(0, 0, 0, .112); --hy-sk-play: rgba(0, 0, 0, .4); --hy-sk-sheen: rgba(255, 255, 255, .4); }
.hy-sk[data-grid] > .sk-play::before { background: var(--hy-sk-play); }

/* decision 6, an older picture is there: it stands dimmed a little and the line runs along its top until the right one comes; no parts */
.hy-sk-old { background: var(--hy-sk-pic, none) top / cover no-repeat; }
.hy-sk-old::before { content: ""; position: absolute; inset: 0; background: var(--hy-sk-dim); }
/* the line, on an older picture (.hy-sk-old > .tk) or alone over an object that shows something already (.hy-skl: a live page over its
   still, a video whose copy is in the making, Frame Studio's preview): the video's time line, 3 px, white on its track over a faint shade */
.hy-sk-old > .tk, .hy-skl { position: absolute; left: 0; right: 0; top: 0; height: var(--hy-sk-lh); overflow: hidden; pointer-events: none;
  background: linear-gradient(var(--hy-vline-track, rgba(255, 255, 255, .3)) 0 0), var(--hy-vline-shade, rgba(0, 0, 0, .18)); }
.hy-sk-old > .tk::before, .hy-skl::before { content: ""; position: absolute; top: 0; bottom: 0; left: 0; width: 40%; background: var(--hy-vline, #fff);
  transform: translateX(-100%); animation: hySkRun var(--hy-sk-period) var(--hy-sk-ease) var(--hy-sk-ph, 0s) infinite; }
@keyframes hySkRun { 0% { transform: translateX(-100%); } 70%, 100% { transform: translateX(250%); } }
.hy-skl { z-index: var(--hy-z-local-3); opacity: 0; transition: opacity var(--hy-sk-reveal) ease; }
.hy-skl.on { opacity: 1; transition: opacity var(--hy-sk-in) ease var(--hy-sk-delay); }   /* a quick one never shows */

/* decision 3, the reveal: the content comes in over 200 ms while the skeleton goes */
.hy-sk-reveal { animation: hySkReveal var(--hy-sk-reveal) var(--hy-ease) both; }
@keyframes hySkReveal { from { opacity: 0; } }

/* calm: the page says so (the board far out): the parts stand, nothing moves. And a plate that nobody looks at stands too (ui/skeleton.js tick: .still is
   every plate but a selected or a large one); the one under the pointer sheens at once (owner 2026-11-06, decision 3 B) */
.hy-sk-calm .hy-sk::after { animation: none; opacity: 0; }
:is(.it, .plg):not(:hover, .lodhov) > .hy-sk.still::after { animation: none; opacity: 0; }
:not(:hover, .lodhov, .sel) > .hy-sk.stand::after { animation: none; opacity: 0; }   /* markup plates (Home, the library) are made .stand unless large, and the same rule: skeleton.js html */
@media (prefers-reduced-motion: reduce) {
  .hy-sk, .hy-sk-old { animation: none; opacity: 1; } .hy-sk::after { animation: none; opacity: 0; }
  .hy-sk-old > .tk::before, .hy-skl::before { animation: none; display: none; }
}

/* the board ----------------------------------------------------------------------------------------------------------------------------
   the top line keeps 3 px on screen at any zoom; far out the pictures are one canvas (#world.lod) and the sheens stand while zooming */
:is(.it, .plg) { --hy-sk-lh: calc(3px / var(--z, 1)); }
#world.lod .it > :is(.hy-sk, .hy-sk-old) { display: none; }
#world.lod :is(.it, .plg) > .hy-sk::after, #items.zooming :is(.it, .plg) > .hy-sk::after { animation: none; opacity: 0; }
/* the dock sweeps while the person waits for something (ui/busy.js), with the same sheen: over the glass and along its rim. The band moves
   by a transform on an element of its own (.hy-dock-sweep, made by busy.js), so the compositor runs it while the page is busy loading:
   moving the gradient (background-position) needed a repaint every frame and the band stood still in the middle of the dock exactly
   while a page loaded (owner 2026-10-29: «скелетон зависает и не движется на доке»). Its pop-ups stand over it */
:is(#dock, .bug-dock) > .hy-dock-sweep { position: absolute; inset: 0; border-radius: inherit; pointer-events: none; overflow: hidden; opacity: 0; transition: opacity var(--hy-t-page); }
/* hy-allow: spacing-literal a hairline nudge below the 2 px step */
:is(#dock, .bug-dock) > .hy-dock-sweep.rim { inset: -1px; padding: 1.5px; -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor; mask-composite: exclude; }
:is(#dock, .bug-dock) > .hy-dock-sweep::after { content: ""; position: absolute; inset: 0; transform: translateX(-100%); will-change: transform;
  background: linear-gradient(var(--hy-sk-angle), transparent 18%, color-mix(in srgb, var(--ink) 34%, transparent) 50%, transparent 82%); }
:is(#dock, .bug-dock) > .hy-dock-sweep.rim::after { background: linear-gradient(var(--hy-sk-angle), transparent 25%, color-mix(in srgb, var(--ink) 95%, transparent) 50%, transparent 75%); }
:is(#dock, .bug-dock).working > .hy-dock-sweep { opacity: 1; }
:is(#dock, .bug-dock).working > .hy-dock-sweep::after { animation: hySkDock var(--hy-sk-period) var(--hy-sk-ease) infinite; }
@keyframes hySkDock { 0% { transform: translateX(-100%); } 70%, 100% { transform: translateX(100%); } }
/* a card being worked on (HY.busy with its id: Frame Studio making a picture's frame, owner 2026-10-07): the same sheen over the card */
/* hy-allow: z-literal a stacking step above --hy-z-local-3 inside one part (local range, tokens stop at 3) */
:is(.it, .plg).working::after { content: ""; position: absolute; inset: 0; z-index: 5; pointer-events: none; transform: translateX(-100%);
  background: linear-gradient(var(--hy-sk-angle), transparent 25%, color-mix(in srgb, var(--ink) 30%, transparent) 50%, transparent 75%);
  animation: hySkSheen var(--hy-sk-period) var(--hy-sk-ease) infinite; }
@media (prefers-reduced-motion: reduce) { :is(#dock, .bug-dock).working > .hy-dock-sweep::after, :is(.it, .plg).working::after { animation: none; opacity: .5; transform: none; } }
/* the skeleton's spinner (2026-10-17, the paste placeholder's kind pill while what comes is not known yet, ui/pending.js): a ring in the
   pill's own colour, one turn in the skeletons' period; in Экономия and with less motion it stands */
.hy-sk-spin { display: block; box-sizing: border-box; width: 72%; height: 72%; border-radius: 50%; border: calc(2px / var(--z, 1)) solid currentColor;
  border-right-color: transparent; opacity: .85; animation: hySkTurn calc(var(--hy-sk-period) / 2.5) linear infinite; }
@keyframes hySkTurn { to { transform: rotate(1turn); } }
/* Экономия (ui/power.js .hy-saver): the plates stand, no sheen, no turn */
:root.hy-saver .hy-sk::after { animation: none; opacity: 0; }
:root.hy-saver .hy-sk-spin, .hy-sk-calm .hy-sk-spin { animation: none; border-right-color: color-mix(in srgb, currentColor 35%, transparent); }
@media (prefers-reduced-motion: reduce) { .hy-sk-spin { animation: none; border-right-color: color-mix(in srgb, currentColor 35%, transparent); } }

/* Board cards can span tens of thousands of board units. Raster their animated loading plate at screen size,
   then restore its board bounds, so the sheen does not allocate a card-sized compositor texture while zoomed out. */
#world.rs :is(.plg.rsp, .it) > .hy-sk {
  --hy-sk-raster-scale: min(1, var(--z, 1), var(--hy-sk-raster-cap, 1));
  right: auto; bottom: auto;
  width: calc(100% * var(--hy-sk-raster-scale)); height: calc(100% * var(--hy-sk-raster-scale));
  transform-origin: 0 0; transform: scale(calc(1 / var(--hy-sk-raster-scale)));
  border-radius: calc(var(--hy-sk-r-card, 0px) * var(--hy-sk-raster-scale));
}
#world.rs :is(.plg.rsp, .it) > .hy-sk > :is(.sk-bar, .sk-blk) {
  border-radius: calc(var(--hy-sk-r, 5px) * var(--hy-sk-raster-scale));
}
