/* ---- Reveal on scroll (framer-motion: opacity 0/y20 -> 1/y0, easeInOut) ---- */
.reveal {
  opacity: 0;
  transform: translateY(20px);
  transition:
    opacity 0.5s cubic-bezier(0.42, 0, 0.58, 1),
    transform 0.5s cubic-bezier(0.42, 0, 0.58, 1);
}
.reveal.in-view {
  opacity: 1;
  transform: translateY(0);
}

/* ---- Waving emoji (rotate keyframes over 2.5s linear, on hover) ---- */
.wave-emoji {
  display: inline-block;
  transform-origin: bottom right;
}
.wave-emoji:hover {
  animation: wave 2.5s linear infinite;
}
@keyframes wave {
  0% { transform: rotate(0deg); }
  16.666% { transform: rotate(14deg); }
  33.333% { transform: rotate(-8deg); }
  50% { transform: rotate(14deg); }
  66.666% { transform: rotate(-4deg); }
  83.333% { transform: rotate(10deg); }
  100% { transform: rotate(0deg); }
}

/* ---- Fanned card deck: static tilt + hover straighten/lift/scale ---- */
.card-wrapper {
  position: relative;
  z-index: 0;
}
.card-wrapper:hover {
  z-index: 10;
}

/* Physics layer. On desktop the transform is driven per-frame from JS
   (src/physics.rs) so the cards float and push/pull each other; `will-change`
   keeps each on its own compositor layer. On narrow/touch screens JS stands
   down and this pure-CSS bob takes over, staggered per card via `--i`. */
.card-float {
  will-change: transform;
}
@media (max-width: 768px) {
  .card-float {
    animation: card-bob 6s ease-in-out infinite;
    animation-delay: calc(var(--i, 0) * -0.8s);
  }
}
@keyframes card-bob {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-9px);
  }
}
/* Respect reduced-motion: no float, no bob, no leftover inline transform. */
@media (prefers-reduced-motion: reduce) {
  .card-float,
  .nav-float {
    animation: none !important;
    transform: none !important;
    will-change: auto;
  }
}
.base-card {
  width: 100%;
  max-width: 300px;
  margin: 20px 0;
  margin-left: var(--ml, 0);
  transition: all 0.3s ease-in-out;
  transform: rotate(var(--rot, 0deg));
  box-shadow:
    0 1px 3px rgba(0, 0, 0, 0.12),
    0 1px 2px rgba(0, 0, 0, 0.24);
  z-index: var(--cz, 0);
}
.card-wrapper:hover .base-card {
  transform: rotate(0deg) translateY(-10px) scale(1.05);
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
  z-index: 10;
}

/* ---- Navbar ---- */
.navbar-wrapper {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
}
.icon-group {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  gap: var(--m-spacing-md);
}
/* .nav-float is the physics transform layer (desktop, driven by src/physics.rs)
   and carries the overlap; the icon inside keeps its own hover transform. */
.nav-float {
  /* flex (not block) so the inline-flex icon generates no line box / descender
     strut — the wrapper collapses to the icon's exact box in every browser. */
  display: flex;
  will-change: transform;
  margin-right: -22px;
}
.nav-float:last-child {
  margin-right: 0;
}
.nav-float:hover {
  z-index: 20;
}
.nav-icon {
  transition: all 0.3s ease;
}
.nav-icon:hover {
  transform: translateY(5px) rotate(5deg);
}
.nav-float:nth-child(2n) .nav-icon:hover {
  transform: translateY(5px) translateX(-3px) rotate(-5deg);
}
.nav-float:nth-child(3n) .nav-icon:hover {
  transform: translateY(5px) translateX(3px) rotate(5deg);
}
@media (max-width: 480px) {
  .nav-float {
    margin-right: -15px;
  }
}
.nav-name {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--m-color-dark-text);
}
html[data-scheme="dark"] .nav-name {
  color: var(--m-color-white);
}
.m-ai.burger {
  color: var(--m-color-dark-text);
}
html[data-scheme="dark"] .m-ai.burger {
  color: var(--m-color-white);
}

/* ---- Mobile drawer (Mantine Drawer: position top, size 100%) ---- */
.drawer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: 1000000;
}
.drawer-panel {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1000000;
  background: var(--m-color-body);
  padding: var(--m-spacing-md);
  overflow-y: auto;
}
.drawer-header {
  display: flex;
  justify-content: flex-end;
  margin-bottom: var(--m-spacing-md);
}
.drawer-close {
  width: 44px;
  height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: transparent;
  border-radius: var(--m-radius-default);
  cursor: pointer;
  color: var(--m-color-text);
  font-size: 28px;
  line-height: 1;
}
.drawer-close:hover {
  background: var(--m-color-default-hover);
}
