/* ═══════════════════════════════════════════════
   Ákotí Modal v2 — HTML-First
   Uses <dialog> + Invoker Commands. Minimal JS.

   Usage (zero JS for basic open/close):
     <button commandfor="my-modal" command="show-modal">Open</button>

     <dialog id="my-modal" class="akm2">
       <div class="akm2-header">
         <h3 class="akm2-title">Title</h3>
         <button commandfor="my-modal" command="close" class="akm2-close">✕</button>
       </div>
       <div class="akm2-body">
         <p>Content here.</p>
       </div>
       <div class="akm2-footer">
         <button commandfor="my-modal" command="close" class="akm2-btn akm2-ghost">Cancel</button>
         <button class="akm2-btn akm2-primary">Save</button>
       </div>
     </dialog>

   That's it. No JavaScript needed to open/close.
   ═══════════════════════════════════════════════ */

/* ═══ BACKDROP ═══ */
.akm2::backdrop {
  background: rgba(15, 27, 61, 0.4);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  opacity: 0;
  transition: opacity 0.25s;
}

.akm2[open]::backdrop {
  opacity: 1;
}

@starting-style {
  .akm2[open]::backdrop {
    opacity: 0;
  }
}

/* ═══ DIALOG ═══ */
.akm2 {
  font-family: 'Outfit', system-ui, -apple-system, sans-serif;
  border: none;
  border-radius: 24px 8px 24px 8px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15), inset 0 2px 6px rgba(0, 0, 0, 0.04);
  padding: 0;
  max-width: 560px;
  width: calc(100% - 48px);
  max-height: calc(100vh - 48px);
  display: flex;
  flex-direction: column;
  background: #faf8f6;
  color: #1e1e24;
  /* Center the dialog */
  margin: auto;
  position: fixed;
  inset: 0;
  height: fit-content;

  /* Entry animation */
  opacity: 0;
  transform: scale(0.92) translateY(12px);
  transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1),
              transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1),
              overlay 0.3s allow-discrete,
              display 0.3s allow-discrete;
}

.akm2[open] {
  opacity: 1;
  transform: scale(1) translateY(0);
}

@starting-style {
  .akm2[open] {
    opacity: 0;
    transform: scale(0.92) translateY(12px);
  }
}

/* ═══ SIZE VARIANTS ═══ */
.akm2-sm { max-width: 400px; }
.akm2-lg { max-width: 720px; }
.akm2-full { max-width: 100%; max-height: 100%; height: 100%; border-radius: 0; }

/* ═══ HEADER ═══ */
.akm2-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px 12px;
  gap: 12px;
}

.akm2-title {
  font-family: 'Fraunces', Georgia, serif;
  font-size: 1.2rem;
  font-weight: 800;
  margin: 0;
  color: #1e1e24;
}

.akm2-close {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: #8a8a96;
  cursor: pointer;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.akm2-close:hover {
  background: #fae8ea;
  color: #e8b4b8;
}

/* ═══ BODY ═══ */
.akm2-body {
  padding: 12px 24px 16px;
  overflow-y: auto;
  flex: 1;
  font-size: 14px;
  line-height: 1.6;
  color: #4a4a56;
}

.akm2-body p { margin: 0 0 12px; }
.akm2-body p:last-child { margin: 0; }

/* ═══ FOOTER ═══ */
.akm2-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  padding: 12px 24px 20px;
}

/* ═══ BUTTONS ═══ */
.akm2-btn {
  font-family: 'Outfit', system-ui, sans-serif;
  font-size: 13px;
  font-weight: 700;
  padding: 8px 20px;
  border: none;
  border-radius: 20px 6px 20px 6px;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.akm2-btn:hover { border-radius: 6px 20px 6px 20px; }
.akm2-btn:active { transform: scale(0.96); }

.akm2-primary { background: #a8c8e8; color: #0f1b3d; }
.akm2-primary:hover { background: #d0e4f5; }

.akm2-ghost { background: transparent; color: #4a4a56; border: 1px solid rgba(26, 47, 94, 0.12); }
.akm2-ghost:hover { background: rgba(26, 47, 94, 0.04); }

.akm2-danger { background: #e8b4b8; color: #1e1e24; }
.akm2-danger:hover { background: #f5d5d8; }

/* ═══ CONFIRM VARIANT ═══ */
.akm2-confirm-icon {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  margin: 0 auto 16px;
}

.akm2-confirm-icon.warn { background: #fae8ea; color: #9D0208; }
.akm2-confirm-icon.info { background: #e8f1fa; color: #2c4a8a; }
.akm2-confirm-icon.success { background: #e8f5ef; color: #2D6A4F; }

/* ═══ MOBILE ═══ */
@media (max-width: 640px) {
  .akm2 {
    max-width: 100%;
    width: 100%;
    border-radius: 20px 20px 0 0;
    margin: auto 0 0;
    max-height: 85vh;
  }
  .akm2-header { padding: 16px 16px 10px; }
  .akm2-body { padding: 10px 16px 14px; }
  .akm2-footer { padding: 10px 16px 16px; }
}
