@layer components {

/* ── Aegis Dialog (ported from feedback-dialog--guidelines) ──
 * Modal pattern: full-viewport backdrop + centered white card with
 * Title / Content / Actions sections. Five maxWidth sizes matching
 * MUI's xs/sm/md/lg/xl scale. Backdrop click handler is consumer
 * responsibility; CSS only provides the visual contract. */

/* Backdrop — full-viewport dimmer */
.ds-dialog-backdrop {
  position: fixed;
  inset: 0;
  background: var(--color-bg-overlay);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-4);
  overflow-y: auto;
}
.ds-dialog-backdrop.hidden { display: none; }

/* Dialog "paper" — the white card */
.ds-dialog {
  width: 100%;
  max-width: 600px; /* default = small */
  background: var(--color-bg-surface);
  color: var(--color-text-primary);
  border-radius: var(--radius-md);
  box-shadow:
    0 11px 15px -7px rgba(0, 0, 0, 0.2),
    0 24px 38px 3px rgba(0, 0, 0, 0.14),
    0 9px 46px 8px rgba(0, 0, 0, 0.12);
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - var(--space-8));
  outline: none;
  position: relative;
}

/* Size variants (MUI maxWidth equivalents) */
.ds-dialog--xs { max-width: 444px; }
.ds-dialog--sm { max-width: 600px; }
.ds-dialog--md { max-width: 900px; }
.ds-dialog--lg { max-width: 1200px; }
.ds-dialog--xl { max-width: calc(100vw - var(--space-8)); }

/* Title section */
.ds-dialog__title {
  margin: 0;
  padding: var(--space-6) var(--space-6) 0;
  font-family: var(--font-family-sans);
  font-size: var(--font-size-lg);
  font-weight: var(--font-weight-semibold);
  line-height: 1.4;
  color: var(--color-text-primary);
}

/* Optional subtitle (Aegis sometimes has a small caption under title) */
.ds-dialog__subtitle {
  padding: var(--space-1) var(--space-6) 0;
  font-size: var(--font-size-sm);
  color: var(--color-text-secondary);
}

/* Content section */
.ds-dialog__content {
  flex: 1;
  padding: var(--space-4) var(--space-6);
  font-family: var(--font-family-sans);
  font-size: var(--font-size-base);
  line-height: 1.5;
  color: var(--color-text-secondary);
  overflow-y: auto;
}

/* Actions row — right-aligned by default */
.ds-dialog__actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-2);
  padding: var(--space-4) var(--space-4) var(--space-4) var(--space-6);
  border-top: var(--border-width-1) solid var(--color-divider);
}
.ds-dialog__actions--left  { justify-content: flex-start; }
.ds-dialog__actions--between { justify-content: space-between; }
.ds-dialog__actions--no-divider { border-top: none; }

/* Top-right close button affordance (× button) */
.ds-dialog__close {
  position: absolute;
  top: var(--space-3);
  right: var(--space-3);
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: transparent;
  color: var(--color-text-secondary);
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: background 0.15s ease, color 0.15s ease;
}
.ds-dialog__close:hover { background: var(--color-bg-surface-alt); color: var(--color-text-primary); }
.ds-dialog__close:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(63, 91, 255, 0.3);
}

} /* end @layer components */
