/* The dressed figure (shared by the dock, the Look screen and the Result screen) and the dock itself. */

/* The picture lives on a 3:4 "stage" that is fitted into the view like object-fit would do it. Everything that must
   line up with the body (both cross-fading images and the zone effect) is a child of the stage, so body zones given
   in percent of the picture stay on the body whatever the size and crop of the view.
   --fig-w: cover = max(100cqw, 75cqh), contain = min(100cqw, 75cqh); --fig-y: vertical anchor (0% top, 50% centre). */
.figure { position: relative; overflow: hidden; background: #d9dcdd; container-type: size; --fig-w: max(100cqw, 75cqh); --fig-y: 0%; }
.figure-stage { position: absolute; left: 50%; top: var(--fig-y); width: var(--fig-w); aspect-ratio: 3 / 4; transform: translate(-50%, calc(-1 * var(--fig-y))); }
.figure-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: 50% 0; opacity: 0; transition: opacity .7s ease; }
.figure-img.show { opacity: 1; }

/* "Dressing" effect: a blurred copy of the picture plus a slow light sweep, both visible only through a feathered
   mask of the body zone(s) being dressed (zones.js). Nothing outside the zone is touched and there is no hard edge. */
.figure-fx { position: absolute; inset: 0; pointer-events: none; opacity: 0; transition: opacity .45s ease;
  -webkit-mask-repeat: no-repeat; mask-repeat: no-repeat; -webkit-mask-size: 100% 100%; mask-size: 100% 100%; }
.figure.busy .figure-fx { opacity: 1; }
.figure-fx-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: 50% 0;
  filter: blur(max(3px, 1.5cqw)) saturate(1.05); }
.figure-fx::after { content: ""; position: absolute; inset: 0; background: rgba(255, 255, 255, .16); animation: fx-breathe 2.800s ease-in-out infinite; }
.figure-fx-sweep { position: absolute; left: 0; right: 0; top: var(--fx-top, 0%); height: var(--fx-height, 100%); overflow: hidden; }
.figure-fx-sweep::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: max(46%, 12cqh);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0) 0%, rgba(255, 255, 255, .12) 22%, rgba(248, 252, 255, .42) 40%, rgba(244, 250, 255, .6) 50%, rgba(248, 252, 255, .42) 60%, rgba(255, 255, 255, .12) 78%, rgba(255, 255, 255, 0) 100%);
  transform: translateY(-100%); }
.figure.busy .figure-fx-sweep::before { animation: fx-sweep 2.800s cubic-bezier(.45, 0, .55, 1) infinite; }
@keyframes fx-sweep { 0% { transform: translateY(-100%); } 78%, 100% { transform: translateY(230%); } }
@keyframes fx-breathe { 0%, 100% { opacity: .35; } 50% { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .figure.busy .figure-fx-sweep::before, .figure-fx::after { animation: none; } }

.figure-status { position: absolute; left: 8px; right: 8px; bottom: 8px; display: flex; align-items: center; justify-content: center; gap: 8px; padding: 8px 10px; border-radius: 999px; background: rgba(255, 255, 255, .94); box-shadow: var(--shadow); font-size: 14px; font-weight: 700; }
.figure-status .spinner { width: 16px; height: 16px; border-width: 2px; flex: none; }
.figure-error { position: absolute; inset: auto 8px 8px 8px; display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 10px; border-radius: 18px; background: rgba(255, 255, 255, .96); box-shadow: var(--shadow); font-size: 14px; text-align: center; }
.figure-error .pill { min-height: 48px; box-shadow: inset 0 0 0 2px #000; }

/* Dock: the always-visible figure in the bottom-right corner of the catalog. */
#dock { position: fixed; right: var(--pad); bottom: var(--pad); z-index: 30; display: none; width: clamp(150px, 20vw, 215px); }
body[data-screen="catalog"] #dock { display: block; }
.dock-card { position: relative; display: block; width: 100%; padding: 6px 6px 0; border-radius: 26px; background: #fff; box-shadow: var(--shadow-lg); }
.dock-figure { aspect-ratio: 3 / 4; border-radius: 20px; }
.dock-figure .figure-error { font-size: 12.500px; padding: 8px 6px; }
.dock-figure .figure-error .pill { padding: 0 12px; font-size: 14px; }
/* The label doubles as the status line, so nothing is drawn over the figure's feet while it is being dressed. */
.dock-label { display: flex; align-items: center; justify-content: center; gap: 7px; height: 40px; padding: 0 4px 2px; font-size: 15px; font-weight: 800; text-align: center; }
.dock-label span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dock-label .spinner { width: 15px; height: 15px; border-width: 2px; flex: none; }
.dock-label.busy { font-size: 13px; font-weight: 700; color: var(--blue-dark); }
.dock-badge { position: absolute; top: -10px; right: -6px; min-width: 40px; height: 40px; padding: 0 10px; border-radius: 999px; background: var(--blue); color: #fff; font-weight: 800; font-size: 19px; line-height: 40px; text-align: center; box-shadow: 0 4px 12px rgba(0, 115, 177, .45); }

/* Look screen: the figure is centred in its card; in landscape the whole figure is shown. The status line and
   «Перерисовать» sit in a bar under the picture, never over the body. */
.look-figure-view { --fig-y: 50%; }
.look-figure-bar { flex: none; display: flex; align-items: center; justify-content: center; min-height: 60px; padding: 8px 4px 0; }
.look-figure-bar .look-redraw { position: static; min-height: 48px; padding: 0 18px; font-size: 15px; box-shadow: inset 0 0 0 2px var(--line); }
.look-status { display: flex; align-items: center; gap: 10px; min-width: 0; font-size: 17px; font-weight: 800; color: var(--blue-dark); }
.look-status span:last-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.look-status .spinner { width: 20px; height: 20px; border-width: 2.500px; flex: none; }
@media (orientation: landscape) {
  .look-figure-view { --fig-w: min(100cqw, 75cqh); background: #cdd0d1; }
  /* The whole picture is shown, so its side edges melt into the card instead of ending in a visible seam. */
  .look-figure-view .figure-stage { -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 9%, #000 91%, transparent 100%); mask-image: linear-gradient(90deg, transparent 0, #000 9%, #000 91%, transparent 100%); }
}

.fly-ghost { position: fixed; z-index: 90; object-fit: cover; pointer-events: none; border-radius: 18px; box-shadow: var(--shadow-lg); will-change: transform; }
