/* MOQI: the mascot (moqi.js), the flowing logo O, the icon sprite.
   Ported from the app: ime/ui/MoqiButton.kt (MoqiButton = the assistant key, MoqiMascot = the big face).
   MOQI's own colours below are its private tokens (SPEC §1.2: MOQI is the one place the cyan→pink lives). */

/* MOQI's palette lives in tokens.css (--moqi-*). */

/* ---------------------------------------------------------------- mascot */

.moqi {
  position: relative;
  display: block;
  inline-size: var(--moqi-size, 160px);
  aspect-ratio: 1;
  flex: none;
  container-type: inline-size;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
}

.moqi__glow,
.moqi__float,
.moqi__breath,
.moqi__body,
.moqi__layer,
.moqi__eyes {
  position: absolute;
  inset: 0;
}

/* The big MOQI's glow: cyan above left, pink below right, behind the face (MoqiMascot's Canvas). */
.moqi__glow {
  inset: -25%;
  pointer-events: none;
  background:
    radial-gradient(ellipse 41% 41% at 44% 45%, var(--moqi-cyan-a36), var(--moqi-cyan-a0)),
    radial-gradient(ellipse 40% 40% at 57% 56%, var(--moqi-pink-a32), var(--moqi-pink-a0));
  opacity: .8;
  animation: moqi-glow 5.2s infinite;
}

/* A slow float up and down (6 dp on the 168 dp face), the glow breathing with it. */
.moqi--mascot .moqi__float { animation: moqi-float 5.2s infinite; }

@keyframes moqi-float {
  0% { transform: translate3d(0, -3.57%, 0); animation-timing-function: cubic-bezier(.4, 0, .2, 1); }
  50% { transform: translate3d(0, 3.57%, 0); animation-timing-function: cubic-bezier(.4, 0, .2, 1); }
  100% { transform: translate3d(0, -3.57%, 0); }
}

@keyframes moqi-glow {
  0% { opacity: .68; animation-timing-function: cubic-bezier(.4, 0, .2, 1); }
  50% { opacity: .92; animation-timing-function: cubic-bezier(.4, 0, .2, 1); }
  100% { opacity: .68; }
}

/* The shadow under a floating MOQI (opts.shadow: the home page hero; owner, 2026-10-02: "like a ball floating,
   shallow"). A blurred ink ellipse on the ground below the face, on the float's own clock: as MOQI sinks it
   grows and darkens a little, as it rises it shrinks and fades. Ink, not a colour, and only a hint of ground. */
.moqi__shadow {
  position: absolute;
  inset-inline: 23%;
  inset-block-start: 105%;
  block-size: 8%;
  border-radius: 50%;
  background: color-mix(in oklch, var(--color-ink) 15%, transparent);
  filter: blur(4.2cqi);
  pointer-events: none;
  animation: moqi-shadow 5.2s infinite;
}

@keyframes moqi-shadow {
  0% { transform: scale(.76, .82); opacity: .5; animation-timing-function: cubic-bezier(.4, 0, .2, 1); }
  50% { transform: scale(1); opacity: 1; animation-timing-function: cubic-bezier(.4, 0, .2, 1); }
  100% { transform: scale(.76, .82); opacity: .5; }
}

/* Breathing: 1.6 % on its own period, so float and breath never line up the same way twice. */
.moqi--mascot .moqi__breath { animation: moqi-breath 3.7s cubic-bezier(.37, 0, .63, 1) infinite alternate; }

@keyframes moqi-breath {
  from { transform: scale(1); }
  to { transform: scale(1.016); }
}

.moqi--mascot.is-sleep .moqi__float { animation-duration: 7.4s; }
.moqi--mascot.is-sleep .moqi__glow { animation-duration: 7.4s; }
.moqi--mascot.is-sleep .moqi__shadow { animation-duration: 7.4s; }
.moqi--mascot.is-sleep .moqi__breath { animation-duration: 5.2s; }

/* moqi.js writes the squash, the press and the lean here. */
.moqi__body {
  transform-origin: 50% 62%;
  will-change: transform;
}

.moqi__face {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  overflow: hidden;
  isolation: isolate;
  background: linear-gradient(180deg, var(--moqi-face-top), var(--moqi-face-low));
  box-shadow:
    0 3cqw 10cqw var(--moqi-cyan-a30),
    0 .8cqw 2.4cqw var(--moqi-cyan-a16);
}

/* The glass rim: a bright 1.5 dp border fading round the circle. */
.moqi__face::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 5;
  border-radius: 50%;
  padding: max(1px, .9cqw);
  background: linear-gradient(135deg, var(--moqi-rim-hi), var(--moqi-rim-lo) 50%, var(--moqi-rim-mid));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  mask-composite: exclude;
  pointer-events: none;
}

.moqi__layer {
  border-radius: 50%;
  pointer-events: none;
}

/* Soft cyan inner glow at the rim. */
.moqi__rim { background: radial-gradient(closest-side, var(--moqi-cyan-a0) 56%, var(--moqi-cyan-a16) 86%, var(--moqi-cyan-a50)); }

/* Thinking: cyan and pink running round the inside of the rim, fading towards the middle. */
.moqi__ring {
  background: conic-gradient(var(--moqi-ring-cyan), var(--moqi-pink), var(--moqi-ring-cyan));
  -webkit-mask-image: radial-gradient(closest-side, transparent 55%, rgb(0 0 0 / .75) 82%, #000);
  mask-image: radial-gradient(closest-side, transparent 55%, rgb(0 0 0 / .75) 82%, #000);
  opacity: 0;
  transition: opacity 500ms linear;
  animation: moqi-spin 2.2s linear infinite paused;
}

.moqi.is-thinking .moqi__ring { opacity: 1; }
.moqi.is-spinning .moqi__ring { animation-play-state: running; }

@keyframes moqi-spin { to { transform: rotate(1turn); } }

.moqi__sheen { background: linear-gradient(180deg, var(--moqi-sheen), var(--moqi-white-a0) 50%); }

.moqi__eyes {
  width: 100%;
  height: 100%;
  overflow: visible;
  z-index: 4;
}

.moqi.is-asleep .moqi__glow,
.moqi.is-asleep .moqi__shadow,
.moqi.is-asleep .moqi__float,
.moqi.is-asleep .moqi__breath,
.moqi.is-asleep .moqi__ring { animation-play-state: paused; }

/* ---------------------------------------------------------------- the assistant key look */

.moqi--key .moqi__face {
  background: var(--moqi-key-fill);
  box-shadow: 0 .4px 1.6px var(--moqi-key-shadow), 0 0 .6px var(--moqi-key-shadow);
}

.moqi--key .moqi__face::after { padding: 1px; }
.moqi--key .moqi__rim { background: radial-gradient(closest-side, var(--moqi-cyan-a0) 58%, var(--moqi-cyan-a16) 86%, var(--moqi-cyan-a50)); }
.moqi--key .moqi__rim-white { background: radial-gradient(closest-side, var(--moqi-white-a0) 68%, var(--moqi-white-a50)); }
.moqi--key .moqi__open { background: linear-gradient(180deg, var(--moqi-open-top), var(--moqi-open-low)); }
.moqi--key .moqi__think { background: linear-gradient(180deg, var(--moqi-think-top), var(--moqi-think-low)); }
.moqi--key .moqi__sheen { background: linear-gradient(180deg, var(--moqi-sheen), var(--moqi-white-a0) 55%); }

.moqi--key .moqi__ring {
  -webkit-mask-image: radial-gradient(closest-side, transparent 50%, rgb(0 0 0 / .75) 80%, #000);
  mask-image: radial-gradient(closest-side, transparent 50%, rgb(0 0 0 / .75) 80%, #000);
  transition-duration: 400ms;
  animation-duration: 1.7s;
}

/* Base colours cross-fade (the app tweens them over 350 ms). */
.moqi--key .moqi__open,
.moqi--key .moqi__think,
.moqi--key .moqi__rim,
.moqi--key .moqi__rim-white {
  opacity: 0;
  transition: opacity 350ms cubic-bezier(.4, 0, .2, 1);
}

.moqi--key .moqi__rim { opacity: 1; transition-duration: 400ms; }
.moqi--key.is-open .moqi__open { opacity: 1; }
.moqi--key.is-open .moqi__rim { opacity: 0; }
.moqi--key.is-open .moqi__rim-white { opacity: 1; }
.moqi--key.is-thinking .moqi__think { opacity: 1; }
.moqi--key.is-thinking .moqi__rim,
.moqi--key.is-thinking .moqi__rim-white { opacity: 0; }

/* ---------------------------------------------------------------- logo */

.moqi-logo {
  display: block;
  inline-size: auto;
  block-size: var(--logo-height, 28px);
  overflow: visible;
}

/* ---------------------------------------------------------------- icons (partials/icons.html)
   <svg class="icon" aria-hidden="true"><use href="#i-heart"/></svg>
   Both duotone layers take the text colour; the secondary layer sits at .28 (the app's value). */

.svg-sprite {
  position: absolute;
  inline-size: 0;
  block-size: 0;
  overflow: hidden;
  pointer-events: none;
}

.icon {
  display: inline-block;
  inline-size: 1.25em;
  block-size: 1em;
  flex: none;
  fill: currentColor;
  vertical-align: -0.125em;
  overflow: visible;
}

.icon--square { inline-size: 1em; }

.fa-secondary { opacity: var(--icon-secondary-opacity, .28); }
