/* ==========================================================================
   Dialog (native <dialog>, geöffnet über core/dialog.js → showModal)
   <dialog class="dialog" aria-labelledby="x-title" data-theme="light">
     <div class="dialog__panel">
       <button class="dialog__close btn btn--icon" data-dialog-close aria-label="Schließen">…</button>
       <p class="eyebrow">…</p><h2 class="dialog__title" id="x-title">…</h2>
       <div class="dialog__body">…</div>
       <div class="dialog__actions">…</div>
     </div>
   </dialog>
   .dialog--sheet  unter 768 px als Bottom-Sheet (mit Griff), darüber zentriert
   .dialog--wide   bis 880 px breit
   Schließen-Animation: core/dialog.js setzt .is-closing und wartet auf animationend.
   ========================================================================== */

.dialog {
  --dlg-max: 35rem;
  width: min(var(--dlg-max), calc(100vw - 2 * var(--margin)));
  max-width: none;
  max-height: calc(100dvh - 2rem);
  margin: auto;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--fg);
  overflow: visible;
}
.dialog--wide { --dlg-max: 55rem; }
.dialog::backdrop {
  background: rgb(20 17 15 / .5);
  -webkit-backdrop-filter: blur(3px);
          backdrop-filter: blur(3px);
  animation: dlg-fade var(--d-3) var(--ease-out);
}
.dialog.is-closing::backdrop { animation: dlg-fade var(--d-2) var(--ease-in) reverse forwards; }
.dialog__panel {
  position: relative;
  max-height: calc(100dvh - 2rem);
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: clamp(1.5rem, 1rem + 2vw, 2.75rem);
  border-radius: var(--r-popover);
  background-color: var(--bg-raised);
  background-image: var(--twill);
  --twill-ink: rgb(35 31 28 / .025);
  box-shadow: var(--shadow-deep);
  animation: dlg-in var(--d-3) var(--ease-out);
}
.dialog.is-closing .dialog__panel { animation: dlg-out var(--d-2) var(--ease-in) forwards; }
.dialog__title {
  --wght: 360;
  --soft: 30;
  font-family: var(--font-display);
  font-weight: var(--wght);
  font-variation-settings: "SOFT" var(--soft), "WONK" 0;
  font-size: var(--step-3);
  line-height: 1.05;
  letter-spacing: -.015em;
  margin-top: var(--s-2);
  padding-right: 2.5rem;
}
.dialog__body { margin-top: var(--s-4); color: var(--fg-2); }
.dialog__body > * + * { margin-top: .85em; }
.dialog__actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-3);
  margin-top: var(--s-6);
}
.dialog__close {
  position: absolute;
  top: var(--s-3);
  right: var(--s-3);
  z-index: 1;
}
@keyframes dlg-fade { from { opacity: 0; } }
@keyframes dlg-in { from { opacity: 0; transform: translateY(16px) scale(.985); } }
@keyframes dlg-out { to { opacity: 0; transform: translateY(8px) scale(.99); } }

/* ---- Bottom-Sheet ------------------------------------------------------------ */
@media (max-width: 767.98px) {
  .dialog--sheet {
    width: 100%;
    max-height: calc(100dvh - 3rem);
    margin: auto 0 0;
  }
  .dialog--sheet .dialog__panel {
    max-height: calc(100dvh - 3rem);
    padding-top: 2.25rem;
    padding-bottom: calc(var(--s-6) + var(--safe-bottom));
    border-radius: var(--r-sheet) var(--r-sheet) 0 0;
    animation: sheet-in 420ms var(--ease-out);
  }
  .dialog--sheet .dialog__panel::before {
    content: "";
    position: absolute;
    top: 10px;
    left: 50%;
    width: 40px;
    height: 4px;
    margin-left: -20px;
    border-radius: 2px;
    background: var(--line-strong);
  }
  .dialog--sheet.is-closing .dialog__panel { animation: sheet-out var(--d-2) var(--ease-in) forwards; }
}
@keyframes sheet-in { from { transform: translateY(100%); } }
@keyframes sheet-out { to { transform: translateY(100%); } }

/* Toast (kurze Bestätigungen, z. B. „Adresse kopiert.“) – core/a11y.js toast() */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--mobile-bar-h) + var(--safe-bottom) + var(--s-5));
  z-index: var(--z-toast);
  display: inline-flex;
  align-items: center;
  gap: .6rem;
  max-width: calc(100vw - 2 * var(--margin));
  padding: .75rem 1.1rem;
  border-radius: var(--r-pill);
  background: var(--c-ink);
  color: var(--c-paper);
  font-size: var(--step--1);
  font-weight: 500;
  box-shadow: var(--shadow-2);
  transform: translate(-50%, 12px);
  opacity: 0;
  transition: opacity var(--d-2) var(--ease-out), transform var(--d-3) var(--ease-out);
  pointer-events: none;
}
.toast.is-visible { opacity: 1; transform: translate(-50%, 0); }
.toast .icon { width: 1.1rem; height: 1.1rem; color: var(--c-narzisse); }
