/* ============================================================
   Луна на орбите (luna.js). Сцена 720×720 масштабируется под ширину карточки.
   Все правила внутри .lo, чтобы не задевать остальной навигатор.
   Цвета — из переменных «Орбит» (app.css): графитовые круги, оранжевая дуга и точки, стеклянный круг с цифрой.
   ============================================================ */

/* «Мой рабочий день» как в макете «Орбиты»: Луна на кольце «N из 13» в шапке
   (сетка экрана и подпись .hero-say — в app.css, раздел «Мой рабочий день») */
.hero-orbit { position: relative; z-index: 1; flex: 0 0 280px; width: 280px; align-self: center; margin: -4px -8px -18px 0; }
@media (max-width: 900px) {
  .hero-orbit { flex: 1 1 100%; width: auto; max-width: 240px; margin: 0 auto; }
}

.lo { display: flex; flex-direction: column; gap: 10px; }
.lo-fit { position: relative; width: 100%; aspect-ratio: 860 / 850; }
.lo-stage { position: absolute; left: 0; top: 0; width: 720px; height: 720px; transform-origin: 0 0; }
.lo-ring { position: absolute; inset: 0; width: 720px; height: 720px; overflow: visible; }
.lo-outer { fill: none; stroke: var(--ink, #1C1E27); stroke-opacity: .16; stroke-dasharray: 1.5 6; }
.lo-base { fill: none; stroke: var(--ink, #1C1E27); stroke-opacity: .34; stroke-width: 1.2; }
.lo-arc { fill: none; stroke: var(--acc, #CA663E); stroke-width: 2.75; transition-property: stroke-dasharray; transition-timing-function: cubic-bezier(.45, .05, .4, 1); }
.lo-halo { position: absolute; left: 238px; top: 238px; width: 244px; height: 244px; border-radius: 50%; pointer-events: none;
  background: conic-gradient(from 0deg, #E6C9DD, #BECFE3, #CFC6E6, #E6C9DD);
  -webkit-mask-image: radial-gradient(closest-side, transparent 60%, #000 71%, #000 80%, transparent 100%);
  mask-image: radial-gradient(closest-side, transparent 60%, #000 71%, #000 80%, transparent 100%); animation: lo-spin 36s linear infinite; }
@keyframes lo-spin { to { transform: rotate(360deg); } }
.lo-disc { position: absolute; left: 264px; top: 264px; width: 192px; height: 192px; border-radius: 50%; display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: var(--glass, rgba(242, 243, 246, .72)); border: 1px solid var(--glass-border, rgba(28, 30, 39, .12)); box-shadow: var(--glass-shadow, inset 0 1px 0 rgba(255, 255, 255, .8)), 0 16px 40px -18px rgba(28, 30, 39, .3);
  -webkit-backdrop-filter: blur(18px) saturate(1.2); backdrop-filter: blur(18px) saturate(1.2); }
.lo-cap { display: none; }
.lo-num { font: 300 84px/1 var(--font-head); color: var(--ink); margin: 4px 0 2px; }
.lo-of { font: 400 calc(14px * var(--inv, 1)) var(--font-head); color: var(--muted); }
.lo-dot { position: absolute; z-index: 3; width: 12px; height: 12px; border-radius: 50%; border: 1.3px solid var(--muted, #555768); background: #F2F3F6; pointer-events: none;
  transform: translate(-50%, -50%); transition: background-color .25s, border-color .25s, transform .25s; }
.lo-dot.on { background: var(--acc, #CA663E); border-color: var(--acc-deep, #A94F29); }
.lo-dot.cur { transform: translate(-50%, -50%) scale(1.3); }
.lo-dot.cur::after { content: ""; position: absolute; inset: -7px; border-radius: 50%; border: 1.3px solid rgba(var(--acc-rgb, 202, 102, 62), .6); animation: lo-ring 2.6s ease-out infinite; }
@keyframes lo-ring { 0% { transform: scale(.7); opacity: 1; } 100% { transform: scale(1.5); opacity: 0; } }

.lo-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }

/* ---------- Компактный вид (шапка «Моего рабочего дня») ---------- */
.lo-compact .lo-disc { left: 240px; top: 240px; width: 240px; height: 240px; }
.lo-compact .lo-halo { left: 206px; top: 206px; width: 308px; height: 308px; }
.lo-compact .lo-num { font-size: 116px; margin: 0; }
.lo-compact .lo-of { font-size: calc(13px * var(--inv, 1)); }
.lo-compact .lo-outer { stroke-width: calc(1px * var(--inv, 1)); stroke-dasharray: calc(1.5px * var(--inv, 1)) calc(5px * var(--inv, 1)); }
.lo-compact .lo-base { stroke-width: calc(1px * var(--inv, 1)); }
.lo-compact .lo-arc { stroke-width: calc(2.2px * var(--inv, 1)); }
.lo-compact .lo-dot { width: calc(8px * var(--inv, 1)); height: calc(8px * var(--inv, 1)); border-width: calc(1.2px * var(--inv, 1)); }
.lo-compact .lo-dot.cur::after { inset: calc(-4px * var(--inv, 1)); border-width: calc(1.1px * var(--inv, 1)); }
.lo-compact .lu { transform: scale(1.22); }
.lo-still-ic { position: absolute; right: 2px; bottom: 2px; z-index: 5; display: grid; place-items: center; width: 34px; height: 34px; padding: 0; border-radius: 50%;
  border: 1px solid var(--chip-line, rgba(28, 30, 39, .18)); background: var(--glass-t, rgba(245, 246, 249, .9)); color: var(--ink, #1C1E27); cursor: pointer;
  transition: border-color .18s, transform .18s; }
.lo-still-ic:hover { border-color: var(--ink, #1C1E27); transform: translateY(-1px); }
.lo-still-ic:focus-visible { outline: 2px solid var(--ink, #1C1E27); outline-offset: 2px; box-shadow: var(--focus, 0 0 0 6px rgba(202, 102, 62, .3)); }
/* Круглая кнопка в зоне 44 px для пальца — невидимое поле вокруг */
.lo-still-ic::before { content: ""; position: absolute; inset: -5px; border-radius: 50%; }
.lo-say { font-size: 13.5px; color: var(--muted); }

/* ---------- Сама Луна ---------- */
.lo-mv { position: absolute; left: 360px; top: 360px; z-index: 4; width: 0; height: 0; pointer-events: none; transform-origin: 0 0;
  transition-property: transform; transition-timing-function: cubic-bezier(.45, .05, .4, 1); }
.lo .lu { position: absolute; left: 0; top: 0; width: 0; height: 0; }
.lo .pz { position: absolute; visibility: hidden; }
.lo .pz img { position: absolute; inset: 0; display: block; width: 100%; height: 100%; -webkit-user-select: none; user-select: none; -webkit-user-drag: none; }
.lo .br, .lo .bob, .lo .hop, .lo .ly-sit { position: absolute; inset: 0; }
.lo .pz-sit { left: -108px; top: -182px; width: 138px; height: 190px; transform-origin: 108px 182px; }
.lo .pz-sit .br { transform-origin: 78% 96%; }
/* Правое ухо — отдельный слой той же картинки, поворачивается у основания */
.lo .ly-base { -webkit-clip-path: polygon(0 0, 66.47% 0, 66.47% 13.91%, 95.21% 13.91%, 95.21% 0, 100% 0, 100% 100%, 0 100%); clip-path: polygon(0 0, 66.47% 0, 66.47% 13.91%, 95.21% 13.91%, 95.21% 0, 100% 0, 100% 100%, 0 100%); }
.lo .ly-ear { transform-origin: 89.82% 14.78%;
  -webkit-clip-path: polygon(66.47% 0, 95.21% 0, 95.21% 13.91%, 92.22% 17.83%, 67.66% 17.83%, 66.47% 13.91%); clip-path: polygon(66.47% 0, 95.21% 0, 95.21% 13.91%, 92.22% 17.83%, 67.66% 17.83%, 66.47% 13.91%);
  -webkit-mask-image: linear-gradient(to bottom, #000 15.65%, transparent 17.83%); mask-image: linear-gradient(to bottom, #000 15.65%, transparent 17.83%); }
.lo .ly-tail, .lo .ly-blink, .lo .run-b { opacity: 0; }
.lo .pz-run { left: -226px; top: -179px; width: 280px; height: 172px; transform-origin: 213px 41px; }
.lo .f-l .pz-run { left: -201px; }
.lo .pz-run .bob { transform-origin: 56% 97%; }
.lo .pz-jump { left: -200px; top: -220px; width: 220px; height: 214px; transform-origin: 187px 62px; }
.lo .f-l .pz-jump { left: -175px; }
.lo .pz-jump .hop { transform-origin: 50% 100%; }
.lo .pz-sleep { left: -100px; top: -151px; width: 200px; height: 157px; }
.lo .pz-sleep .br { transform-origin: 50% 96%; }
.lo .m-idle .pz-sit, .lo .m-wag .pz-sit, .lo .m-run .pz-run, .lo .m-jump .pz-jump, .lo .m-sleep .pz-sleep { visibility: visible; }

/* Добежала — три взмаха хвостом (кадр «хвост вверх» целиком заменяет сидящую Луну) */
.lo .m-wag .ly-tail { animation: lo-wag .52s steps(1, end) 3; }
.lo .m-wag .ly-sit { animation: lo-wag-hide .52s steps(1, end) 3; }
@keyframes lo-wag { 0% { opacity: 1; } 50% { opacity: 0; } 100% { opacity: 0; } }
@keyframes lo-wag-hide { 0% { opacity: 0; } 50% { opacity: 1; } 100% { opacity: 1; } }
/* Покой: один цикл 8 с — моргает, машет хвостом, шевелит ухом, снова моргает (события не пересекаются) */
.lo .m-idle .ly-blink { animation: lo-blink 8s steps(1, end) .6s infinite; }
@keyframes lo-blink { 0% { opacity: 0; } 10% { opacity: 1; } 11.8% { opacity: 0; } 62% { opacity: 1; } 63.8% { opacity: 0; } 100% { opacity: 0; } }
.lo .m-idle .ly-tail { animation: lo-tail-up 8s steps(1, end) .6s infinite; }
.lo .m-idle .ly-sit { animation: lo-tail-hide 8s steps(1, end) .6s infinite; }
@keyframes lo-tail-up { 0% { opacity: 0; } 22% { opacity: 1; } 25% { opacity: 0; } 28% { opacity: 1; } 31% { opacity: 0; } 100% { opacity: 0; } }
@keyframes lo-tail-hide { 0% { opacity: 1; } 22% { opacity: 0; } 25% { opacity: 1; } 28% { opacity: 0; } 31% { opacity: 1; } 100% { opacity: 1; } }
.lo .m-idle .ly-ear { animation: lo-ear 8s ease-in-out .6s infinite; }
@keyframes lo-ear { 0%, 40% { transform: rotate(0); } 42% { transform: rotate(-8deg); } 44% { transform: rotate(4deg); } 46% { transform: rotate(-2deg); } 48%, 100% { transform: rotate(0); } }
.lo .m-idle .pz-sit .br { animation: lo-breathe 3.6s ease-in-out infinite; }
.lo .m-sleep .pz-sleep .br { animation: lo-breathe 4.2s ease-in-out infinite; }
@keyframes lo-breathe { 0%, 100% { transform: scale(1, 1); } 50% { transform: scale(1.008, 1.018); } }
/* Бег: два настоящих кадра (лапы вытянуты / подобраны) и подпрыгивание в такт */
.lo .m-run .run-a { animation: lo-gallop-a .32s steps(1, end) infinite; }
.lo .m-run .run-b { animation: lo-gallop-b .32s steps(1, end) infinite; }
@keyframes lo-gallop-a { 0% { opacity: 1; } 50% { opacity: 0; } 100% { opacity: 0; } }
@keyframes lo-gallop-b { 0% { opacity: 0; } 50% { opacity: 1; } 100% { opacity: 1; } }
.lo .m-run .bob { animation: lo-bob .32s ease-in-out infinite; }
@keyframes lo-bob { 0%, 100% { transform: translateY(-3px) rotate(-1deg); } 25% { transform: translateY(-11px) rotate(-2.5deg); } 50% { transform: translateY(-2px) rotate(0); } 75% { transform: translateY(0) rotate(1deg) scale(1.02, .98); } }
/* Все пункты — прыжок от радости */
.lo .m-jump .hop { animation: lo-hop .95s cubic-bezier(.3, .7, .4, 1) 2; }
@keyframes lo-hop { 0% { transform: translateY(0) scale(1, 1); } 12% { transform: translateY(0) scale(1.06, .92); } 45% { transform: translateY(-86px) scale(.97, 1.04); } 80% { transform: translateY(0) scale(1.05, .94); } 100% { transform: translateY(0) scale(1, 1); } }

/* ---------- Луна выглядывает из-за карточки ---------- */
.lo-peek-host { position: relative; }
.lo-peek { position: absolute; z-index: 2; right: 26px; bottom: calc(100% - 10px); width: 96px; height: 106px; pointer-events: none;
  -webkit-clip-path: inset(-40px -40px 10px -40px); clip-path: inset(-40px -40px 10px -40px); animation: lo-peek-clip 6.5s steps(1, end) .6s both; }
.lo-peek-img { position: absolute; left: 0; right: 0; bottom: 0; height: 96px; transform: translateY(112%); transform-origin: 50% 100%; animation: lo-peek 6.5s cubic-bezier(.3, .8, .3, 1) .6s both; }
.lo-peek-img img { display: block; width: 100%; height: 100%; -webkit-user-select: none; user-select: none; -webkit-user-drag: none; }
@keyframes lo-peek { 0% { transform: translateY(112%); } 12% { transform: translateY(0); } 40% { transform: translateY(0) rotate(0); } 44% { transform: translateY(0) rotate(-5deg); } 48% { transform: translateY(0) rotate(3deg); } 52% { transform: translateY(0) rotate(-1deg); } 55%, 80% { transform: translateY(0) rotate(0); } 92%, 100% { transform: translateY(112%); } }
@keyframes lo-peek-clip { 0% { -webkit-clip-path: inset(-40px -40px 10px -40px); clip-path: inset(-40px -40px 10px -40px); } 13% { -webkit-clip-path: inset(-40px -40px 0 -40px); clip-path: inset(-40px -40px 0 -40px); } 80%, 100% { -webkit-clip-path: inset(-40px -40px 10px -40px); clip-path: inset(-40px -40px 10px -40px); } }

/* ---------- Без движения: кнопка «Остановить Луну» или системная настройка ---------- */
.lo.lo-calm *, .lo.lo-calm *::before, .lo.lo-calm *::after, .lo-peek.lo-calm, .lo-peek.lo-calm * { animation: none !important; transition: none !important; }
.lo-peek.lo-calm { -webkit-clip-path: inset(-40px -40px 0 -40px); clip-path: inset(-40px -40px 0 -40px); }
.lo-peek.lo-calm .lo-peek-img { transform: none; }
@media (prefers-reduced-motion: reduce) {
  .lo *, .lo *::before, .lo *::after, .lo-peek, .lo-peek * { animation: none !important; transition: none !important; }
  .lo-peek { -webkit-clip-path: inset(-40px -40px 0 -40px); clip-path: inset(-40px -40px 0 -40px); }
  .lo-peek .lo-peek-img { transform: none; }
}
