/* The close cross (Сергей, 2026-11-29) — shared by a book's own page (book.html: back to the library) and My Library
   (library.html: back to the tree), in place of the kit's «Библиотека» / «Ёлка» buttons. A big graphic cross in the
   page's accent, top-left, no button behind it: two flat strokes, nothing else.
   Colour: --x-color on the element (book page: the cover's frame colour; library: the books' colour).
   Motion (all springy, short): data-arrive — on arrival the strokes grow out from the centre one after the other ·
   hover (a real pointer only): the cross turns a quarter and its strokes thicken · press: it gives, a little smaller ·
   click: .is-closing — the strokes fold into the centre as it spins on; the page's script navigates ~240 ms later.
   Reduced motion: none.
   Markup: <a class="x-close" …><svg viewBox="0 0 24 24" fill="none" aria-hidden="true"><line …/><line …/></svg></a> */
.x-close {
  --spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --x: clamp(44px, 7vw, 64px); /* the cross itself */
  position: fixed; z-index: 3; top: max(8px, env(safe-area-inset-top)); left: max(8px, env(safe-area-inset-left));
  width: calc(var(--x) + 20px); height: calc(var(--x) + 20px); display: grid; place-items: center; border-radius: 50%;
  color: var(--x-color, currentColor); background: none; -webkit-tap-highlight-color: transparent; cursor: pointer;
}
.x-close svg { width: var(--x); height: var(--x); overflow: visible; transition: rotate 560ms var(--spring), scale 300ms var(--spring); }
.x-close line {
  stroke: currentColor; stroke-width: 1.15; stroke-linecap: round; /* of a 24 box: ~3 px at 64 px */
  transform-box: fill-box; transform-origin: center;
  transition: stroke-width 240ms var(--ease), scale 260ms cubic-bezier(0.5, 0, 0.75, 0);
}
.x-close[data-arrive] line { animation: x-close-in 620ms var(--spring) 380ms both; }
.x-close[data-arrive] line + line { animation-delay: 470ms; }
@keyframes x-close-in { from { scale: 0; } }
@media (hover: hover) and (pointer: fine) {
  .x-close:hover svg { rotate: 90deg; }
  .x-close:hover line { stroke-width: 1.6; }
}
.x-close:active svg { scale: 0.84; transition-duration: 560ms, 110ms; }
.x-close:focus-visible { outline: 2px solid currentColor; outline-offset: -2px; }
/* closing: the strokes fold into the centre, one after the other, as the cross spins on */
.x-close.is-closing svg { rotate: 225deg; scale: 0.9; transition-duration: 320ms, 200ms; }
.x-close.is-closing line { scale: 0; animation: none; }
.x-close.is-closing line + line { transition-delay: 0ms, 50ms; }
@media (prefers-reduced-motion: reduce) {
  .x-close svg, .x-close line { transition: none !important; animation: none !important; }
  .x-close.is-closing svg { rotate: 0deg; }
}
