/* v3 dialogs: confirm (3 strengths), timeout warning, session ended
   (reference §5; core §6, §8). Native <dialog>: top layer, Esc, focus
   return. Fade + scale from 0.98 on desktop; a bottom sheet that slides up
   on phones. Modals are only for confirms and the session notices. */

.lg-dialog {
  width: min(28rem, calc(100vw - var(--space-8)));
  max-height: calc(100dvh - var(--space-8));
  margin: auto;
  padding: 0;
  overflow: auto;
  border: 1px solid var(--float-border);
  border-radius: var(--radius-sheet);
  background: var(--raised);
  color: var(--text);
  box-shadow: var(--shadow-sheet);
}
.lg-dialog::backdrop { background: color-mix(in srgb, var(--text) 35%, transparent); }
/* Session ended: nothing behind it stays readable. */
.lg-dialog--blocking::backdrop { background: var(--page); }

.lg-dialog__body { display: flex; flex-direction: column; gap: var(--space-3); padding: var(--space-6) var(--space-6) var(--space-4); }
.lg-dialog__title {
  margin: 0;
  font-size: var(--size-section);
  line-height: var(--leading-section);
  font-weight: 600;
  letter-spacing: -0.01em;
  overflow-wrap: anywhere;
}
.lg-dialog__text { margin: 0; color: var(--text-muted); overflow-wrap: anywhere; }
.lg-dialog__actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: var(--space-3);
  padding: 0 var(--space-6) var(--space-6);
}
.lg-dialog__form { display: contents; }

@media (prefers-reduced-motion: no-preference) {
  .lg-dialog[open] { animation: lg-dialog-in var(--dur-enter) var(--ease); }
}
@keyframes lg-dialog-in { from { opacity: 0; transform: scale(0.98); } }

/* Phones: the same dialog as a bottom sheet (reference §5). */
@media (max-width: 39.99em) {
  .lg-dialog {
    width: 100%;
    max-width: 100%;
    margin: auto 0 0;
    border-width: 1px 0 0;
    border-radius: var(--radius-sheet) var(--radius-sheet) 0 0;
    padding-bottom: env(safe-area-inset-bottom);
  }
  .lg-dialog__body { padding: var(--space-6) var(--space-4) var(--space-4); }
  .lg-dialog__actions { flex-direction: column-reverse; padding: 0 var(--space-4) var(--space-4); }
  .lg-dialog__actions > .lg-btn, .lg-dialog__actions form .lg-btn { width: 100%; }
}
@media (prefers-reduced-motion: no-preference) and (max-width: 39.99em) {
  .lg-dialog[open] { animation-name: lg-dialog-up; }
}
@keyframes lg-dialog-up { from { transform: translateY(100%); } }
