/*
 * Intro widget: the winged "a" (.flyer) flies in, lands, and the elements marked data-reveal fade in.
 * No data-intro attribute = final state (what a reader, a thumbnail and reduced-motion see).
 * States set by js/widgets/kamo-intro.js on the root element: wait > fly > land > reveal > (removed).
 * Timings come from CONFIG in kamo-intro.js through --fly-ms and --reveal-dur;
 * the stagger of the reveal is --delay on each [data-reveal] item.
 */

/* ---------- the mark (logo) ---------- */
.kamo-mark__body { display: block; transform-origin: 50% 100%; }
.kamo-mark__glyph { display: block; }
.kamo-mark__svg { display: block; width: 100%; height: auto; overflow: visible; }

.kamo-wing {
  fill: var(--wing);
  transform-box: fill-box;
}
.kamo-wing--l { transform-origin: 100% 100%; }
.kamo-wing--r { transform-origin: 0% 100%; }

.kamo-a {
  fill: none;
  stroke: var(--ink);
  stroke-width: 58;
  stroke-linecap: round;
}
.kamo-eye { fill: var(--ink); }
.kamo-mask__keep { fill: var(--white); }
.kamo-mask__cut { fill: rgb(var(--black-rgb)); }

/* ---------- flight ---------- */
[data-intro="wait"] .flyer {
  translate: -100cqw 36px;
}
[data-intro="fly"] .flyer {
  will-change: translate, rotate;
  animation: kamo-fly var(--fly-ms, 1200ms) both;
}
[data-intro="fly"] .flyer .kamo-mark__body {
  animation: kamo-bob calc(var(--fly-ms, 1200ms) / 2) ease-in-out 2;
}
[data-intro="fly"] .kamo-wing--l { animation: kamo-flutter-l 85ms ease-in-out infinite alternate; }
[data-intro="fly"] .kamo-wing--r { animation: kamo-flutter-r 85ms ease-in-out infinite alternate; }

/* ---------- landing ---------- */
[data-intro="land"] .flyer .kamo-mark__body { animation: kamo-land 420ms ease-out both; }
[data-intro="land"] .kamo-wing--l { animation: kamo-flap-l 420ms ease-in-out both; }
[data-intro="land"] .kamo-wing--r { animation: kamo-flap-r 420ms ease-in-out both; }

/* ---------- reveal ---------- */
[data-intro]:is([data-intro="wait"], [data-intro="fly"], [data-intro="land"]) [data-reveal] {
  opacity: 0;
  translate: 0 20px;
}
[data-intro="reveal"] [data-reveal] {
  transition:
    opacity var(--reveal-dur, 460ms) ease,
    translate var(--reveal-dur, 460ms) cubic-bezier(0.2, 0.7, 0.2, 1);
  transition-delay: var(--delay, 0ms);
}

@keyframes kamo-fly {
  0% { translate: -100cqw 36px; rotate: -10deg; animation-timing-function: cubic-bezier(0.2, 0.7, 0.3, 1); }
  60% { translate: -14cqw -26px; rotate: 7deg; animation-timing-function: ease-in-out; }
  82% { translate: -3cqw 10px; rotate: -4deg; animation-timing-function: ease-out; }
  100% { translate: 0 0; rotate: 0deg; }
}
@keyframes kamo-bob {
  0%, 100% { translate: 0 0; }
  25% { translate: 0 -6px; }
  75% { translate: 0 6px; }
}
@keyframes kamo-flutter-l { from { rotate: -22deg; } to { rotate: 12deg; } }
@keyframes kamo-flutter-r { from { rotate: 22deg; } to { rotate: -12deg; } }
@keyframes kamo-flap-l { 0% { rotate: 0deg; } 30% { rotate: -24deg; } 60% { rotate: 6deg; } 100% { rotate: 0deg; } }
@keyframes kamo-flap-r { 0% { rotate: 0deg; } 30% { rotate: 24deg; } 60% { rotate: -6deg; } 100% { rotate: 0deg; } }
@keyframes kamo-land {
  0% { scale: 1 1; }
  30% { scale: 1.06 0.92; }
  60% { scale: 0.98 1.03; }
  100% { scale: 1 1; }
}

@media (prefers-reduced-motion: reduce) {
  [data-intro] * { animation: none; transition: none; }
}
