/* ==========================================================================
   chiragkoradia.com — motion
   Restrained: short fades with a small rise, hairlines that draw in.
   Everything here is decorative and is switched off for reduced-motion users.
   ========================================================================== */

[data-reveal] {
  opacity: 0;
  transform: translateY(14px);
  transition:
    opacity 0.75s var(--ease),
    transform 0.75s var(--ease);
  transition-delay: var(--reveal-delay, 0ms);
  will-change: opacity, transform;
}
[data-reveal].is-revealed {
  opacity: 1;
  transform: none;
}

[data-reveal="rule"] {
  opacity: 1;
  transform: none;
  transform-origin: left center;
  scale: 0 1;
  transition: scale 0.85s var(--ease);
  transition-delay: var(--reveal-delay, 0ms);
}
[data-reveal="rule"].is-revealed { scale: 1 1; }

[data-reveal="plate"] {
  opacity: 0;
  transform: translateY(22px);
  transition:
    opacity 0.9s var(--ease),
    transform 0.9s var(--ease);
  transition-delay: var(--reveal-delay, 0ms);
}
[data-reveal="plate"].is-revealed { opacity: 1; transform: none; }

/* mobile menu panel */
.mobile-nav {
  opacity: 0;
  transition: opacity 0.32s var(--ease);
}
.mobile-nav.is-open { opacity: 1; }

.mobile-nav__item {
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 0.5s var(--ease), transform 0.5s var(--ease);
}
.mobile-nav.is-open .mobile-nav__item { opacity: 1; transform: none; }
.mobile-nav.is-open .mobile-nav__item:nth-child(1) { transition-delay: 0.05s; }
.mobile-nav.is-open .mobile-nav__item:nth-child(2) { transition-delay: 0.10s; }
.mobile-nav.is-open .mobile-nav__item:nth-child(3) { transition-delay: 0.15s; }
.mobile-nav.is-open .mobile-nav__item:nth-child(4) { transition-delay: 0.20s; }
.mobile-nav.is-open .mobile-nav__item:nth-child(5) { transition-delay: 0.25s; }
.mobile-nav.is-open .mobile-nav__item:nth-child(6) { transition-delay: 0.30s; }
.mobile-nav.is-open .mobile-nav__item:nth-child(7) { transition-delay: 0.35s; }

/* lightbox */
.lightbox { opacity: 0; transition: opacity 0.28s var(--ease); }
.lightbox.is-open { opacity: 1; }

/* scroll progress bar */
.masthead__progress span { transition: width 0.12s linear; }

/* entry gate: a single, quiet settle on load */
.gate__aside > *, .gate-form > * {
  animation: ck-settle 0.85s var(--ease) both;
}
.gate__aside > *:nth-child(2) { animation-delay: 0.08s; }
.gate__aside > *:nth-child(3) { animation-delay: 0.16s; }
.gate-form > *:nth-child(2) { animation-delay: 0.08s; }
.gate-form > *:nth-child(3) { animation-delay: 0.16s; }
.gate-form > *:nth-child(4) { animation-delay: 0.22s; }
.gate-form > *:nth-child(5) { animation-delay: 0.28s; }

@keyframes ck-settle {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: none; }
}

/* a brief shake on a rejected passcode — small amplitude, one pass */
.gate-form.is-rejected .gate-form__field { animation: ck-nudge 0.42s var(--ease) 1; }
@keyframes ck-nudge {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-5px); }
  60% { transform: translateX(4px); }
}

/* ------------------------------------------------------- reduced motion */

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }

  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }

  [data-reveal],
  [data-reveal="plate"] { opacity: 1 !important; transform: none !important; }
  [data-reveal="rule"] { scale: 1 1 !important; }
  .mobile-nav { opacity: 1; }
  .mobile-nav__item { opacity: 1; transform: none; }
  .lightbox { opacity: 1; }
  .gate__aside > *, .gate-form > * { animation: none; opacity: 1; transform: none; }
  .gate-form.is-rejected .gate-form__field { animation: none; }
}
