/* ============================================================================
   components-ext-overlays.css — MMD Central Design System, CDS expansion
   round (2026-09-02). Ben named this explicitly: "mouse buttons, right
   mouse options". Right-click context menu, driven by ds-runtime.js
   (data-attribute wiring, no framework dependency, lives in the DS package
   not in app code per the standing CDS rule).
   ========================================================================= */

.ds-ctxmenu {
  position: fixed; z-index: 2000; min-width: 180px; display: none;
  background: var(--rp-white, var(--paper)); border: 1px solid var(--rp-border-strong, var(--hairline-dark));
  border-radius: var(--rp-radius, var(--ds-radius-sm)); box-shadow: var(--shadow-drag);
  padding: 4px; font-family: var(--font-ui);
}
.ds-ctxmenu[data-open="true"] { display: block; }
.ds-ctxmenu-item {
  display: flex; align-items: center; gap: 9px; width: 100%; border: 0; background: transparent;
  padding: 7px 10px; border-radius: 3px; cursor: pointer; text-align: left;
  font-size: 12px; color: var(--ink);
}
.ds-ctxmenu-item:hover, .ds-ctxmenu-item[data-active="true"] { background: var(--baobab-bg); color: var(--baobab); }
.ds-ctxmenu-item:disabled { color: var(--ink-faint); cursor: not-allowed; background: transparent; }
.ds-ctxmenu-item-icon { flex: none; width: 14px; height: 14px; color: var(--ink-mute); }
.ds-ctxmenu-item:hover .ds-ctxmenu-item-icon { color: var(--baobab); }
.ds-ctxmenu-item-label { flex: 1; min-width: 0; }
.ds-ctxmenu-item-kbd {
  flex: none; font-family: var(--font-mono); font-size: 9.5px; color: var(--ink-mute);
}
.ds-ctxmenu-item--danger { color: var(--baobab); }
.ds-ctxmenu-item--danger:hover { background: var(--baobab); color: var(--baobab-on, var(--paper)); }
.ds-ctxmenu-item--danger:hover .ds-ctxmenu-item-icon { color: var(--baobab-on, var(--paper)); }
.ds-ctxmenu-sep { height: 1px; background: var(--hairline); margin: 4px 2px; }
.ds-ctxmenu-label {
  font-family: var(--font-mono); font-size: 8.5px; font-weight: 700; letter-spacing: 0.06em;
  text-transform: uppercase; color: var(--ink-faint); padding: 5px 10px 3px;
}

/* Surface that OWNS a context menu is marked so the mouse-interaction spec
   in the gallery can point at it; also gives a visible affordance on hover
   without requiring the click itself. */
[data-ctxmenu-target] { cursor: default; }
[data-ctxmenu-target]:hover { outline: 1px dashed var(--hairline-dark); outline-offset: 2px; }

/* ============================================================================
   Batch 2 (2026-09-03) — overlays: tooltip, popover, hover-card, toast
   stack, drawer, modal-size modifiers (reusing .ds-modal--dialog, not a
   second modal system), skeleton loaders, empty-state.
   ========================================================================= */

/* ---- Tooltip: pure CSS, hover/focus, 4 placements ---- */
.ds-tooltip-host { position: relative; display: inline-flex; }
.ds-tooltip-host::after {
  content: attr(data-ds-tooltip); position: absolute; z-index: 50; display: block;
  background: var(--rp-ink, var(--ink)); color: var(--rp-white, var(--paper));
  font-family: var(--font-ui); font-size: 11px; font-weight: 600; white-space: nowrap;
  padding: 5px 9px; border-radius: var(--rp-radius, var(--ds-radius-sm));
  box-shadow: var(--shadow-slip); opacity: 0; visibility: hidden; pointer-events: none;
  transition: opacity 0.1s ease;
}
.ds-tooltip-host:hover::after, .ds-tooltip-host:focus-within::after { opacity: 1; visibility: visible; }
.ds-tooltip-host[data-ds-tooltip-placement="top"]::after,
.ds-tooltip-host:not([data-ds-tooltip-placement])::after { bottom: calc(100% + 6px); left: 50%; transform: translateX(-50%); }
.ds-tooltip-host[data-ds-tooltip-placement="bottom"]::after { top: calc(100% + 6px); left: 50%; transform: translateX(-50%); }
.ds-tooltip-host[data-ds-tooltip-placement="left"]::after { right: calc(100% + 6px); top: 50%; transform: translateY(-50%); }
.ds-tooltip-host[data-ds-tooltip-placement="right"]::after { left: calc(100% + 6px); top: 50%; transform: translateY(-50%); }

/* ---- Popover: click-triggered floating panel with real content ---- */
.ds-popover-host { position: relative; display: inline-flex; }
.ds-popover {
  position: absolute; top: calc(100% + 6px); left: 0; z-index: 45; display: none; min-width: 220px;
  background: var(--rp-white, var(--paper)); border: 1px solid var(--rp-border-strong, var(--hairline-dark));
  border-radius: var(--rp-radius, var(--ds-radius-sm)); box-shadow: var(--shadow-drag); padding: 12px;
}
.ds-popover-host[data-open="true"] .ds-popover { display: block; }
.ds-popover-title { display: block; font-family: var(--font-ui); font-weight: 700; font-size: 12.5px; color: var(--ink); margin: 0 0 4px; }
.ds-popover-body { font-size: 12px; color: var(--ink-soft); line-height: 1.5; }

/* ---- Hover-card: pure CSS, hover/focus preview panel (richer than a
   tooltip -- a small profile/preview card, not one-line text) ---- */
.ds-hover-card-host { position: relative; display: inline-flex; }
.ds-hover-card {
  position: absolute; top: calc(100% + 6px); left: 0; z-index: 45; min-width: 220px;
  background: var(--rp-white, var(--paper)); border: 1px solid var(--rp-border-strong, var(--hairline-dark));
  border-radius: var(--rp-radius, var(--ds-radius-sm)); box-shadow: var(--shadow-drag); padding: 12px;
  opacity: 0; visibility: hidden; pointer-events: none; transition: opacity 0.12s ease;
}
.ds-hover-card-host:hover .ds-hover-card, .ds-hover-card-host:focus-within .ds-hover-card { opacity: 1; visibility: visible; pointer-events: auto; }

/* ---- Toast stack ---- */
.ds-toast-stack {
  position: fixed; right: 16px; bottom: 16px; z-index: 3000; display: flex; flex-direction: column;
  gap: 8px; width: 300px; pointer-events: none;
}
.ds-toast {
  display: flex; align-items: flex-start; gap: 9px; padding: 11px 12px; pointer-events: auto;
  background: var(--rp-white, var(--paper)); border: 1px solid var(--rp-border-strong, var(--hairline-dark));
  border-left: 3px solid var(--rp-ink, var(--ink)); border-radius: var(--rp-radius, var(--ds-radius-sm));
  box-shadow: var(--shadow-drag); font-size: 12px; color: var(--ink);
}
.ds-toast--info { border-left-color: var(--rp-ink, var(--ink)); }
.ds-toast--success { border-left-color: var(--signal-grass); }
.ds-toast--warn { border-left-color: var(--signal-amber); }
.ds-toast--danger { border-left-color: var(--baobab); }
.ds-toast-body { flex: 1; min-width: 0; }
.ds-toast-title { font-weight: 700; margin-bottom: 2px; }
.ds-toast-close { flex: none; border: 0; background: transparent; color: var(--ink-mute); cursor: pointer; padding: 0; font-size: 13px; line-height: 1; }
.ds-toast-close:hover { color: var(--baobab); }

/* ---- Drawer ---- */
.ds-drawer-backdrop {
  position: fixed; inset: 0; background: transparent; z-index: 1000; display: none;
  transition: background 0.15s ease;
}
.ds-drawer-backdrop[data-open="true"] { display: block; background: color-mix(in srgb, var(--rp-ink, var(--ink)) 45%, transparent); }
.ds-drawer {
  position: fixed; top: 0; bottom: 0; width: 360px; max-width: calc(100vw - 24px);
  background: var(--rp-white, var(--paper)); box-shadow: var(--shadow-sheet-window);
  display: flex; flex-direction: column; transform: translateX(100%); transition: transform 0.18s ease;
}
.ds-drawer--right { right: 0; }
.ds-drawer--left { left: 0; transform: translateX(-100%); }
.ds-drawer-backdrop[data-open="true"] .ds-drawer { transform: translateX(0); }
.ds-drawer--sm { width: 280px; }
.ds-drawer--lg { width: 480px; }
.ds-drawer-head {
  display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 18px;
  border-bottom: 1px solid var(--hairline); flex: none;
}
.ds-drawer-title { font-family: var(--font-ui); font-weight: 700; font-size: 14px; color: var(--ink); margin: 0; }
.ds-drawer-close { border: 1px solid var(--hairline); background: transparent; color: var(--ink-mute); cursor: pointer; width: 24px; height: 24px; border-radius: var(--ds-radius-sm); }
.ds-drawer-close:hover { color: var(--baobab); border-color: var(--baobab); }
.ds-drawer-body { flex: 1; overflow-y: auto; padding: 16px 18px; font-size: 12.5px; color: var(--ink-soft); }

/* ---- Modal family sizes -- modifiers on the existing .ds-modal--dialog
   chrome (components.css), not a second modal system. ---- */
.ds-modal--dialog.ds-modal--alert { width: min(420px, calc(100vw - 24px)); height: auto; min-height: 0; max-height: calc(100vh - 32px); }
.ds-modal--dialog.ds-modal--confirm { width: min(480px, calc(100vw - 24px)); height: auto; min-height: 0; max-height: calc(100vh - 32px); }
.ds-modal--dialog.ds-modal--form { width: min(680px, calc(100vw - 24px)); height: min(600px, calc(100vh - 32px)); }
.ds-modal--dialog.ds-modal--full-height { height: calc(100vh - 32px); max-height: calc(100vh - 32px); }

/* ---- Skeleton loaders ---- */
@keyframes ds-skeleton-shimmer { 0% { background-position: -120px 0; } 100% { background-position: 120px 0; } }
.ds-skeleton {
  border-radius: var(--ds-radius-sm); background-color: var(--rp-silver, var(--paper-2));
  background-image: linear-gradient(90deg, transparent, color-mix(in srgb, var(--rp-white, var(--paper)) 70%, transparent), transparent);
  background-size: 120px 100%; background-repeat: no-repeat; animation: ds-skeleton-shimmer 1.2s ease-in-out infinite;
}
.ds-skeleton-text { height: 10px; margin-bottom: 6px; }
.ds-skeleton-text:last-child { margin-bottom: 0; width: 70%; }
.ds-skeleton-table { display: flex; flex-direction: column; gap: 5px; }
.ds-skeleton-table-row { display: flex; gap: 8px; }
.ds-skeleton-table-row .ds-skeleton { height: 14px; flex: 1; }
.ds-skeleton-card { display: flex; flex-direction: column; gap: 8px; padding: 12px; border: 1px solid var(--hairline); border-radius: var(--ds-radius-sm); }
.ds-skeleton-card-avatar { width: 32px; height: 32px; border-radius: 50%; }

/* ---- Empty state ---- */
.ds-empty-state {
  display: flex; flex-direction: column; align-items: center; text-align: center; gap: 6px;
  padding: 32px 20px; color: var(--ink-mute);
}
.ds-empty-state-icon { width: 32px; height: 32px; color: var(--ink-faint, var(--ink-mute)); }
.ds-empty-state-title { font-family: var(--font-ui); font-weight: 700; font-size: 13px; color: var(--ink); }
.ds-empty-state-desc { font-size: 12px; max-width: 280px; }
.ds-empty-state-action { margin-top: 4px; }

/* ---- Avatar (shadcn parity) ---- */
.ds-avatar {
  display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px;
  border-radius: 50%; background: var(--rp-ink, var(--ink)); color: var(--rp-white, var(--paper));
  font-family: var(--font-display); font-weight: 800; font-size: 11px; overflow: hidden; flex: none;
}
.ds-avatar img { width: 100%; height: 100%; object-fit: cover; }
.ds-avatar--sm { width: 22px; height: 22px; font-size: 9px; }
.ds-avatar--lg { width: 44px; height: 44px; font-size: 14px; }
.ds-avatar-group { display: inline-flex; }
.ds-avatar-group .ds-avatar { border: 2px solid var(--rp-white, var(--paper)); margin-left: -8px; }
.ds-avatar-group .ds-avatar:first-child { margin-left: 0; }

/* ---- Alert (shadcn parity -- distinct from a toast: inline, persistent,
   part of page flow, not a transient stacked notification) ---- */
.ds-alert { display: flex; gap: 10px; padding: 12px 14px; border: 1px solid var(--hairline); border-radius: var(--rp-radius, var(--ds-radius-sm)); background: var(--rp-white, var(--paper)); }
.ds-alert-icon { flex: none; width: 16px; height: 16px; color: var(--ink-mute); margin-top: 1px; }
.ds-alert-body { flex: 1; min-width: 0; }
.ds-alert-title { font-weight: 700; font-size: 12.5px; color: var(--ink); margin: 0 0 2px; }
.ds-alert-desc { font-size: 12px; color: var(--ink-soft); }
.ds-alert--info { border-color: var(--rp-line-2, var(--hairline)); }
.ds-alert--success { border-color: var(--signal-grass); background: color-mix(in srgb, var(--signal-grass) 8%, var(--rp-white, var(--paper))); }
.ds-alert--success .ds-alert-icon { color: var(--signal-grass); }
.ds-alert--warn { border-color: var(--signal-amber); background: color-mix(in srgb, var(--signal-amber) 8%, var(--rp-white, var(--paper))); }
.ds-alert--warn .ds-alert-icon { color: var(--signal-amber); }
.ds-alert--danger { border-color: var(--baobab); background: color-mix(in srgb, var(--baobab) 6%, var(--rp-white, var(--paper))); }
.ds-alert--danger .ds-alert-icon { color: var(--baobab); }

/* ---- Gallery-only layout helper: a row of demo trigger buttons that
   needs to wrap, e.g. the toast-kind buttons below. Belongs beside
   .ds-gallery-mock-window in components.css, added here since that is
   this batch's own touched file. ---- */
.ds-gallery-inline-actions { display: flex; gap: 6px; flex-wrap: wrap; }
