/* Inspect drawer (shared/_drawer): right panel over a backdrop; the [busy] pseudo-elements
   are the loading state while the drawer's lazy Turbo Frame fetches — Turbo marks the frame
   [busy] and the same backdrop + a pulsing empty panel paint immediately, so the click
   acknowledges before content arrives. Geometry is comma-grouped with the real backdrop/
   panel so the skeleton can never drift from what it stands in for. */
@layer components {
  .drawer-backdrop,
  .drawer-frame[busy]::before {
    position: fixed;
    inset: 0;
    z-index: var(--z-backdrop);
    background-color: color-mix(in oklch, var(--text) 25%, transparent);
  }

  .drawer-panel,
  .drawer-frame[busy]::after {
    position: fixed;
    inset-block: 0;
    right: 0;
    z-index: var(--z-overlay);
    width: 100%;
    max-width: 36rem;
    background-color: var(--surface);
    border-radius: var(--radius) 0 0 var(--radius);
    box-shadow: var(--shadow-md);
  }

  .drawer-backdrop {
    animation: drawer-fade-in var(--duration-normal) var(--ease-out);
  }

  .drawer-panel {
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: var(--space-5);
    animation: drawer-slide-in var(--duration-slow) var(--ease-out);
  }

  .drawer-frame[busy]::before {
    content: "";
  }
  .drawer-frame[busy]::after {
    content: "";
    display: block;
    animation: drawer-pulse var(--duration-skeleton) var(--ease-in-out) infinite;
  }

  .drawer-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--space-4);
    margin-bottom: var(--space-5);
  }

  .drawer-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    background: none;
    border-radius: var(--radius-sm);
    padding: var(--space-1);
    color: var(--text-secondary);
    transition: color var(--duration-fast) var(--ease-smooth),
      background-color var(--duration-fast) var(--ease-smooth);
  }
  .drawer-close:hover {
    color: var(--text);
    background-color: var(--nav-hover);
  }
  .drawer-close svg {
    width: var(--icon);
    height: var(--icon);
  }

  @keyframes drawer-fade-in {
    from {
      opacity: 0;
    }
  }
  @keyframes drawer-slide-in {
    from {
      transform: translateX(var(--space-6));
      opacity: 0;
    }
  }
  @keyframes drawer-pulse {
    50% {
      opacity: 0.6;
    }
  }
}
