/*
  The NOCTS mark and its approved reveal (brand/motion/export-tools/anim-night.html), the same
  rules as the app's src/styles/nocts-mark.css and v1's landing/css/nocts_mark.css, keyed off
  the same data-mark-motion / data-mark-part attributes. The markup is the app's geometry
  (src/components/common/icons/nocts-mark-geometry.ts). CSP-safe: the pens' mask type is set
  here rather than in a style attribute, and they draw in currentColor (an alpha mask), so no
  colour is written in the markup.
*/

.mark {
  color: var(--accent);
}

.mark mask {
  mask-type: alpha;
}

[data-mark-motion] [data-mark-part^='ring'],
[data-mark-motion] [data-mark-part^='pen'],
[data-mark-motion] [data-mark-part='s'] {
  stroke-dasharray: 1;
}

[data-mark-motion] [data-mark-part='eyes'] {
  transform-box: view-box;
  transform-origin: 85.75px 20px;
}

[data-mark-motion] [data-mark-part='eye'],
[data-mark-motion] [data-mark-part='pop'] {
  transform-box: fill-box;
  transform-origin: center;
}

[data-mark-motion] [data-mark-part='ring-o'] {
  animation: mark-draw 0.8s cubic-bezier(0.65, 0, 0.35, 1) 0.15s both;
}
[data-mark-motion] [data-mark-part='ring-c'] {
  animation: mark-draw 0.8s cubic-bezier(0.65, 0, 0.35, 1) 0.3s both;
}
[data-mark-motion] [data-mark-part='pop'] {
  animation: mark-pop 0.38s cubic-bezier(0.3, 1.6, 0.5, 1) 0.85s both;
}
[data-mark-motion] [data-mark-part='pupil'] {
  animation: mark-look 3.9s linear 1.2s both;
}
[data-mark-motion] [data-mark-part='eye'] {
  animation: mark-blink 0.24s ease-in-out 2.95s both;
}
[data-mark-motion='reveal'] [data-mark-part='eyes'] {
  animation: mark-settle 0.95s cubic-bezier(0.7, 0, 0.2, 1) 3.3s both;
}
[data-mark-motion='reveal'] [data-mark-part='pen-n'] {
  animation: mark-draw 0.6s cubic-bezier(0.55, 0, 0.25, 1) 3.75s both;
}
[data-mark-motion='reveal'] [data-mark-part='pen-t'] {
  animation: mark-draw 0.5s cubic-bezier(0.55, 0, 0.25, 1) 3.92s both;
}
[data-mark-motion='reveal'] [data-mark-part='s'] {
  animation: mark-draw 0.7s cubic-bezier(0.55, 0, 0.25, 1) 4.02s both;
}

@keyframes mark-draw {
  from {
    stroke-dashoffset: 1;
  }
  to {
    stroke-dashoffset: 0;
  }
}

@keyframes mark-pop {
  from {
    transform: scale(0);
  }
  to {
    transform: scale(1);
  }
}

@keyframes mark-blink {
  0%,
  100% {
    transform: scaleY(1);
  }
  35% {
    transform: scaleY(0.06);
  }
}

@keyframes mark-settle {
  from {
    transform: translate(19px, 0) scale(1.7);
  }
  to {
    transform: translate(0, 0) scale(1);
  }
}

@keyframes mark-look {
  0% {
    transform: translate(0, 0);
    animation-timing-function: cubic-bezier(0.25, 0.9, 0.3, 1);
  }
  2.3% {
    transform: translate(-5px, 0);
  }
  10.3% {
    transform: translate(-5px, 0);
    animation-timing-function: cubic-bezier(0.25, 0.9, 0.3, 1);
  }
  12.6% {
    transform: translate(5px, -1px);
  }
  21% {
    transform: translate(5px, -1px);
    animation-timing-function: cubic-bezier(0.25, 0.9, 0.3, 1);
  }
  23.3% {
    transform: translate(3px, 4px);
  }
  29.7% {
    transform: translate(3px, 4px);
    animation-timing-function: cubic-bezier(0.25, 0.9, 0.3, 1);
  }
  32.1% {
    transform: translate(-4px, -3.5px);
  }
  41% {
    transform: translate(-4px, -3.5px);
    animation-timing-function: cubic-bezier(0.25, 0.9, 0.3, 1);
  }
  43.3% {
    transform: translate(0, 0);
  }
  93.8% {
    transform: translate(0, 0);
    animation-timing-function: cubic-bezier(0.25, 0.9, 0.3, 1);
  }
  96.4%,
  100% {
    transform: translate(2px, -2px);
  }
}

/* Every piece rests on the logo's final frame, so with motion off the still mark is what shows. */
@media (prefers-reduced-motion: reduce) {
  [data-mark-motion] * {
    animation: none !important;
  }
}
