/* Production menu chrome — radii, no cast shadow, spacing, hover. */
:root {
  --radius-menu: 1.75rem;
  --radius-menu-open: 1.35rem;
  --menu-inset: 0.5rem;
  --radius-menu-control: calc(var(--radius-menu) - var(--menu-inset));
  --radius-menu-item: 0.65rem;
  --press-scale: 0.96;
  --color-image-outline: color-mix(in oklab, #fff 14%, transparent);
}

html:not(.dark) {
  --color-image-outline: color-mix(in oklab, #000 14%, transparent);
}

.menu-scrim {
  background: color-mix(in oklab, #000 42%, transparent) !important;
}

.menu {
  border-radius: var(--radius-menu) !important;
  outline: 1px solid var(--border);
  box-shadow: none !important;
}

.menu-wrap.is-open .menu {
  border-radius: var(--radius-menu-open) var(--radius-menu-open) var(--radius-menu) var(--radius-menu) !important;
  box-shadow: none !important;
}

.dark .menu-wrap.is-open .menu {
  box-shadow: none !important;
}

@media (min-width: 640px) {
  .menu-wrap.is-open .menu {
    border-radius: var(--radius-menu) var(--radius-menu) var(--radius-menu-open) var(--radius-menu-open) !important;
  }
}

.menu-bar {
  padding: var(--menu-inset) !important;
  gap: 0.5rem !important;
  cursor: pointer;
}

.menu-burger {
  cursor: pointer;
}

.menu-wrap:not(.is-open) {
  max-width: 22rem !important;
}

.menu-status {
  padding: 0 !important;
  gap: 0.65rem !important;
}

.menu-avatar {
  width: 2.5rem !important;
  height: 2.5rem !important;
  outline: 1px solid var(--color-image-outline) !important;
  outline-offset: -1px !important;
  flex-shrink: 0;
}

.menu-links {
  gap: 0.35rem !important;
  padding-inline: var(--menu-inset) !important;
  padding-block-end: 0.65rem !important;
}

@media (max-width: 639px) {
  .menu-links {
    padding-block-start: 0.65rem !important;
  }
}

.menu-link {
  min-height: 2.85rem;
  border-radius: var(--radius-menu-item) !important;
  transition:
    background 160ms ease,
    opacity 180ms ease,
    color 160ms ease,
    scale 200ms ease-out !important;
}

.menu-burger,
.book-drawer-close {
  border-radius: var(--radius-menu-control) !important;
  width: 2.5rem !important;
  height: 2.5rem !important;
  transition:
    background 160ms ease,
    color 160ms ease,
    scale 200ms ease-out !important;
}

.menu-burger {
  margin: 0 !important;
  margin-inline-start: auto !important;
}

.download-pdf {
  min-height: 0 !important;
  padding-block: 0.28rem !important;
  padding-inline: 0.75rem !important;
  transition:
    background 160ms ease,
    color 160ms ease,
    scale 200ms ease-out !important;
}

.menu-link:hover {
  background: transparent;
}

@media (hover: hover) {
  .menu-links .menu-link:hover {
    opacity: 1;
    background: color-mix(in oklab, #000 32%, transparent) !important;
  }

  html:not(.dark) .menu-links .menu-link:hover {
    background: color-mix(in oklab, #000 9%, transparent) !important;
  }

  .book-drawer-close:hover,
  .download-pdf:hover {
    background: color-mix(in oklab, #000 32%, transparent) !important;
  }

  html:not(.dark) .book-drawer-close:hover,
  html:not(.dark) .download-pdf:hover {
    background: color-mix(in oklab, #000 9%, transparent) !important;
  }
}

@media (prefers-reduced-motion: no-preference) {
  .menu-link:active,
  .menu-burger:active,
  .book-drawer-close:active,
  .download-pdf:active {
    scale: var(--press-scale) !important;
  }
}

.menu-links a.menu-link[target="_blank"] {
  cursor: pointer !important;
}

/* Identity word reveal — soft cascade */
.menu-identity .mi-word {
  display: inline-block;
  will-change: opacity, transform;
}

.menu-identity.is-mi-ready .mi-word {
  opacity: 0;
  transform: translateY(5px) scale(0.985);
  animation: mi-word-in 900ms cubic-bezier(0.22, 1, 0.36, 1) forwards;
  animation-delay: calc(var(--line, 0) * 140ms + var(--i, 0) * 48ms);
}

@keyframes mi-word-in {
  0% {
    opacity: 0;
    transform: translateY(5px) scale(0.985);
  }
  55% {
    opacity: 1;
  }
  72% {
    transform: translateY(-0.5px) scale(1.005);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.menu-identity.is-mi-done .mi-word {
  will-change: auto;
}

@media (prefers-reduced-motion: reduce) {
  .menu-identity.is-mi-ready .mi-word {
    opacity: 1;
    transform: none;
    animation: none;
    will-change: auto;
  }
}

/* Production menu icon motion + copy success. */
.menu-link .menu-link-icon {
  position: relative;
  width: 1.15rem;
  height: 1.15rem;
  flex-shrink: 0;
}

.menu-link .menu-link-icon svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  transition:
    opacity 220ms ease-out,
    transform 220ms ease-out,
    filter 220ms ease-out;
}

.menu-link .menu-link-icon .icon-done {
  opacity: 0;
  transform: scale(0.25);
  filter: blur(4px);
  color: #34c759;
}

.menu-copy-email.is-copied .menu-link-icon .icon-copy {
  opacity: 0;
  transform: scale(0.25);
  filter: blur(4px);
}

.menu-copy-email.is-copied .menu-link-icon .icon-done {
  opacity: 1;
  transform: scale(1);
  filter: blur(0);
}

.menu-copy-email.is-copied .menu-copy-label {
  color: #34c759 !important;
}

.menu-kbd {
  display: none !important;
}

.menu-burger {
  display: flex !important;
  position: relative;
}

.menu-burger svg {
  position: absolute !important;
  inset: 0;
  margin: auto;
  width: 1.2rem;
  height: 1.2rem;
  pointer-events: none;
  display: block !important;
  transition:
    opacity 220ms ease-out,
    transform 220ms ease-out,
    filter 220ms ease-out;
}

.menu-burger .icon-close {
  opacity: 0;
  transform: scale(0.25);
  filter: blur(4px);
}

.menu-wrap.is-open .menu-burger .icon-burger {
  display: block !important;
  opacity: 0;
  transform: scale(0.25);
  filter: blur(4px);
}

.menu-wrap.is-open .menu-burger .icon-close {
  display: block !important;
  opacity: 1;
  transform: scale(1);
  filter: blur(0);
}

.menu-link-hint {
  margin-inline-start: auto;
  padding-inline-start: 0.5rem;
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.01em;
  color: var(--muted);
  opacity: 0;
  transform: translateX(6px);
  transition:
    opacity 180ms ease,
    transform 180ms cubic-bezier(0.22, 1, 0.36, 1);
  pointer-events: none;
  white-space: nowrap;
}

@media (hover: hover) {
  .menu-link:hover .menu-link-hint {
    opacity: 1;
    transform: translateX(0);
  }
}

.menu-link:focus-visible .menu-link-hint {
  opacity: 1;
  transform: translateX(0);
}

.hi-icon .hi-svg {
  overflow: visible;
}

.hi-copy-occlusion {
  visibility: hidden;
}

.hi-cal-dots .hi-cal-dot {
  transform-box: fill-box;
  transform-origin: center;
}

.hi-home-smile {
  stroke-dasharray: 12;
  stroke-dashoffset: 0;
}

.hi-menu-line {
  transform-origin: 4px center;
  transform-box: fill-box;
}

@media (hover: hover) and (prefers-reduced-motion: no-preference) {
  .menu-link.hi-play .hi-copy-front {
    animation: hi-copy-front 0.86s cubic-bezier(0.23, 1, 0.32, 1) both;
  }

  .menu-link.hi-play .hi-copy-occlusion {
    visibility: visible;
    animation: hi-copy-occlusion 0.86s cubic-bezier(0.23, 1, 0.32, 1) both;
  }

  .menu-link.hi-play .hi-home-body {
    animation: hi-home-bob 0.5s ease-in-out both;
  }

  .menu-link.hi-play .hi-home-smile {
    animation: hi-home-smile 0.4s ease-out 0.2s both;
  }

  .menu-link.hi-play .hi-folder-path {
    animation: hi-folder-tilt 0.56s cubic-bezier(0.23, 1, 0.32, 1) both;
  }

  .menu-link.hi-play .hi-file-body {
    animation: hi-file-tilt 0.58s cubic-bezier(0.23, 1, 0.32, 1) both;
  }

  .menu-link.hi-play .hi-file-line {
    animation: hi-file-line 0.48s cubic-bezier(0.23, 1, 0.32, 1) 0.12s both;
  }

  .menu-link.hi-play .hi-cal-rings {
    animation: hi-cal-rings 0.46s cubic-bezier(0.23, 1, 0.32, 1) both;
  }

  .menu-link.hi-play .hi-cal-dot:nth-child(1) {
    animation: hi-cal-dot 0.3s cubic-bezier(0.23, 1, 0.32, 1) 0.08s both;
  }
  .menu-link.hi-play .hi-cal-dot:nth-child(2) {
    animation: hi-cal-dot 0.3s cubic-bezier(0.23, 1, 0.32, 1) 0.145s both;
  }
  .menu-link.hi-play .hi-cal-dot:nth-child(3) {
    animation: hi-cal-dot 0.3s cubic-bezier(0.23, 1, 0.32, 1) 0.21s both;
  }
  .menu-link.hi-play .hi-cal-dot:nth-child(4) {
    animation: hi-cal-dot 0.3s cubic-bezier(0.23, 1, 0.32, 1) 0.275s both;
  }
  .menu-link.hi-play .hi-cal-dot:nth-child(5) {
    animation: hi-cal-dot 0.3s cubic-bezier(0.23, 1, 0.32, 1) 0.34s both;
  }

  .menu-bar.hi-play .hi-menu-line:nth-child(1) {
    animation: hi-menu-scan 0.32s cubic-bezier(0.23, 1, 0.32, 1) both;
  }
  .menu-bar.hi-play .hi-menu-line:nth-child(2) {
    animation: hi-menu-scan 0.32s cubic-bezier(0.23, 1, 0.32, 1) 0.075s both;
  }
  .menu-bar.hi-play .hi-menu-line:nth-child(3) {
    animation: hi-menu-scan 0.32s cubic-bezier(0.23, 1, 0.32, 1) 0.15s both;
  }

  .menu-bar.hi-play .hi-cancel-body {
    animation: hi-cancel-impact 0.5s cubic-bezier(0.23, 1, 0.32, 1) both;
    transform-origin: 12px 12px;
  }
}

@keyframes hi-copy-front {
  0% { transform: translate(0, 0) scale(1); stroke-width: 1.5; }
  10% { transform: translate(0.45px, 0.45px) scale(0.97); stroke-width: 1.546; }
  34% { transform: translate(-6.2px, -6.2px) scale(1.2); stroke-width: 1.25; }
  46%,
  56% { transform: translate(-6px, -6px) scale(1.14); stroke-width: 1.316; }
  76% { transform: translate(0.65px, 0.65px) scale(0.96); stroke-width: 1.562; }
  88% { transform: translate(-0.25px, -0.25px) scale(1.03); stroke-width: 1.456; }
  100% { transform: translate(0, 0) scale(1); stroke-width: 1.5; }
}

@keyframes hi-copy-occlusion {
  0% { transform: translate(0, 0) scale(1); }
  10% { transform: translate(0.45px, 0.45px) scale(0.97); }
  34% { transform: translate(-6.2px, -6.2px) scale(1.24); }
  46%,
  56% { transform: translate(-6px, -6px) scale(1.18); }
  76% { transform: translate(0.65px, 0.65px) scale(1.06); }
  88% { transform: translate(-0.25px, -0.25px) scale(1.03); }
  100% { transform: translate(0, 0) scale(1); }
}

@keyframes hi-home-bob {
  0%,
  100% { transform: translateY(0); }
  35% { transform: translateY(-2px); }
}

@keyframes hi-home-smile {
  0% { stroke-dashoffset: 12; opacity: 0; }
  100% { stroke-dashoffset: 0; opacity: 1; }
}

@keyframes hi-folder-tilt {
  0%,
  100% { transform: translateY(0) rotate(0deg); }
  35% { transform: translateY(-1.7px) rotate(-2deg); }
  70% { transform: translateY(0.4px) rotate(0.7deg); }
}

@keyframes hi-file-tilt {
  0%,
  100% { transform: translateY(0) rotate(0deg); }
  35% { transform: translateY(-0.8px) rotate(-1deg); }
  70% { transform: translateY(0.45px) rotate(0.5deg); }
}

@keyframes hi-file-line {
  0%,
  100% { transform: scaleX(1); }
  35% { transform: scaleX(0.5); }
  70% { transform: scaleX(1.1); }
}

@keyframes hi-cal-rings {
  0%,
  100% { transform: translateY(0); }
  35% { transform: translateY(-1.1px); }
  70% { transform: translateY(0.25px); }
}

@keyframes hi-cal-dot {
  0%,
  100% { transform: scale(1); }
  55% { transform: scale(1.22); }
}

@keyframes hi-menu-scan {
  0%,
  100% { transform: scaleX(1); }
  42% { transform: scaleX(0.82); }
  76% { transform: scaleX(1.03); }
}

@keyframes hi-cancel-impact {
  0%,
  100% { transform: scale(1) rotate(0deg); }


@media (prefers-reduced-motion: reduce) {
  .menu-link.hi-play .hi-copy-front,
  .menu-link.hi-play .hi-copy-occlusion,
  .menu-link.hi-play .hi-home-body,
  .menu-link.hi-play .hi-home-smile,
  .menu-link.hi-play .hi-folder-path,
  .menu-link.hi-play .hi-file-body,
  .menu-link.hi-play .hi-file-line,
  .menu-link.hi-play .hi-cal-rings,
  .menu-link.hi-play .hi-cal-dot,
  .menu-bar.hi-play .hi-menu-line,
  .menu-bar.hi-play .hi-cancel-body,
  .menu-link-hint,
  .menu-burger svg,
  .menu-link .menu-link-icon svg {
    animation: none !important;
    transition: none !important;
  }
}
