/* ── ctx-menu.css — context menu bottom sheet / desktop dropdown ─────────
   Standalone card pattern — does NOT share .kofi-card from cards.css.
   Mobile:  bottom sheet (ctx-mobile class added by JS)
   Desktop: small floating dropdown near cursor (ctx-desktop class)

   HTML:
     <div id="ctx-menu" class="kofi-card hidden" role="menu">
       <div id="ctx-backdrop" class="kofi-card-backdrop"></div>
       <div id="ctx-sheet"   class="kofi-card-sheet"> …items… </div>
     </div>

   JS open:  remove .hidden → rAF → add .is-open + ctx-mobile/ctx-desktop
   JS close: remove .is-open → transitionend → add .hidden
────────────────────────────────────────────────────────────────────────── */

#ctx-menu {
  position: fixed;
  inset: 0;
  z-index: 98;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  pointer-events: none;
}
#ctx-menu.hidden  { display: none; }
#ctx-menu.is-open { pointer-events: all; }

/* ── Backdrop ────────────────────────────────────────────────── */
#ctx-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  opacity: 0;
  transition: opacity 0.25s ease;
  cursor: pointer;
}
#ctx-menu.is-open #ctx-backdrop { opacity: 1; }

/* ── Sheet base ──────────────────────────────────────────────── */
#ctx-sheet {
  position: absolute;
  display: flex;
  flex-direction: column;
}

/* ── MOBILE: bottom sheet ────────────────────────────────────── */
#ctx-menu.ctx-mobile {
  align-items: flex-end;
}

#ctx-menu.ctx-mobile #ctx-sheet {
  position: relative;
  width: 100%;
  max-width: 480px;
  background: var(--surface);
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  border: 1px solid var(--border-md);
  border-bottom: none;
  min-height: 30vh;
  max-height: 85vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  padding: 0.5rem 0 calc(0.5rem + env(safe-area-inset-bottom, 0px));
  transform: translateY(100%);
  transition: transform 0.3s cubic-bezier(0.32, 0.72, 0, 1);
}

/* Drag handle pill */
#ctx-menu.ctx-mobile #ctx-sheet::before {
  content: '';
  display: block;
  width: 36px;
  height: 4px;
  background: var(--border-md);
  border-radius: 2px;
  margin: 0.65rem auto 0.5rem;
  flex-shrink: 0;
}

#ctx-menu.ctx-mobile.is-open #ctx-sheet {
  transform: translateY(0);
}

/* ── DESKTOP: small floating dropdown ────────────────────────── */
#ctx-menu.ctx-desktop {
  align-items: flex-start;
  justify-content: flex-start;
}

#ctx-menu.ctx-desktop #ctx-backdrop { display: none; }

#ctx-menu.ctx-desktop #ctx-sheet {
  position: absolute;
  width: auto;
  max-width: 240px;
  min-width: 160px;
  min-height: 0;
  max-height: none;
  background: var(--surface2);
  border: 1px solid var(--border-md);
  border-radius: var(--radius-lg);
  padding: 0.3rem 0;
  overflow: hidden;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.45);
  transform: none;
  opacity: 0;
  transition: opacity 0.12s ease, transform 0.12s ease;
  transform-origin: top left;
  transform: scale(0.95);
}
#ctx-menu.ctx-desktop.is-open #ctx-sheet {
  opacity: 1;
  transform: scale(1);
}

/* ── Items ───────────────────────────────────────────────────── */
.ctx-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 0.6rem 1rem;
  background: none;
  border: none;
  border-radius: 0;
  color: var(--text);
  font-family: var(--font);
  font-size: var(--text-base);
  text-align: left;
  cursor: pointer;
  transition: background 0.1s;
  gap: 0.5rem;
}
.ctx-item:hover,
.ctx-item:active           { background: var(--surface3); }
.ctx-item--danger          { color: var(--danger); }
.ctx-item--disabled        { opacity: 0.35; cursor: default; pointer-events: none; }
.ctx-item--label           {
  cursor: default;
  pointer-events: none;
  font-size: var(--text-sm);
  color: var(--muted);
  white-space: normal;
  line-height: 1.4;
  padding-top: 0.5rem;
  padding-bottom: 0.5rem;
}

.ctx-sep {
  border: none;
  border-top: 1px solid var(--border-md);
  margin: 0.25rem 0;
}

.ctx-hint {
  font-size: var(--text-sm);
  color: var(--muted);
  flex-shrink: 0;
}
