:root {
  --base-font-size: 1.6rem;
  --scale-ratio: 1.2;
  --h1-font-size: clamp(2.5rem, calc(var(--base-font-size) * var(--scale-ratio) * 2.5), 4rem);
  --h2-font-size: clamp(2rem, calc(var(--base-font-size) * var(--scale-ratio) * 2), 3.2rem);
  --h3-font-size: clamp(1.75rem, calc(var(--base-font-size) * var(--scale-ratio) * 1.75), 2.8rem);
  --h4-font-size: clamp(1.5rem, calc(var(--base-font-size) * var(--scale-ratio) * 1.5), 2.4rem);
  --h5-font-size: clamp(1.25rem, calc(var(--base-font-size) * var(--scale-ratio) * 1.25), 2rem);
  --small-font-size: clamp(.875rem, calc(var(--base-font-size) * var(--scale-ratio) * .875), 1.4rem);
  --base-spacing-unit: 1rem;
  --spacing-ratio: 1.5;
  --spacing-xxs: clamp(.25rem, calc(var(--base-spacing-unit) / var(--spacing-ratio) * .25), .5rem);
  --spacing-xs: clamp(.375rem, calc(var(--base-spacing-unit) / var(--spacing-ratio) * .375), .75rem);
  --spacing-sm: clamp(.563rem, calc(var(--base-spacing-unit) / var(--spacing-ratio) * .563), 1.125rem);
  --spacing-md: clamp(.844rem, calc(var(--base-spacing-unit) / var(--spacing-ratio) * .844), 1.688rem);
  --spacing-lg: clamp(1.266rem, calc(var(--base-spacing-unit) / var(--spacing-ratio) * 1.266), 2.531rem);
  --spacing-xl: clamp(1.898rem, calc(var(--base-spacing-unit) / var(--spacing-ratio) * 1.898), 3.797rem);
  --spacing-xxl: clamp(2.847rem, calc(var(--base-spacing-unit) / var(--spacing-ratio) * 2.847), 5.695rem);
}

/* Modal Dialog - Cross-Browser Native Animations */
.ak-modal {
  position: fixed;
  inset: 0;
  margin: auto;
  overflow: hidden;
  border: none;
  width: 50rem;
  max-width: 92vw;
  max-height: 90vh;
  border-radius: 12px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  z-index: 9999;
  background-color: #ffffff;
  padding: 0;
  will-change: transform, opacity;
}

.ak-modal::backdrop {
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.ak-modal[open] {
  display: flex;
  flex-direction: column;
  animation: slideDownModal 0.25s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.ak-modal[open]::backdrop {
  animation: fadeInBackdrop 0.25s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.ak-modal.ak-modal--closing,
.ak-modal.hidden {
  animation: slideUpModal 0.2s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.ak-modal.ak-modal--closing::backdrop,
.ak-modal.hidden::backdrop {
  animation: fadeOutBackdrop 0.2s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.ak-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.6rem 2rem;
  background: #ffffff;
  border-bottom: 1px solid #e2e8f0;
}

.ak-header-heading {
  font-size: 1.8rem;
  font-weight: 800;
  color: #0f172a;
  margin: 0;
}

.ak-body {
  padding: 2rem;
  overflow-y: auto;
  max-height: 65vh;
  background: #ffffff;
}

.ak-header-btn-close {
  cursor: pointer;
  border: none;
  font-size: 1.8rem;
  font-weight: 600;
  color: #64748b;
  width: 3.2rem;
  height: 3.2rem;
  border-radius: 50%;
  background: #f1f5f9;
  display: flex;
  justify-content: center;
  align-items: center;
  transition: background 0.1s ease, color 0.1s ease;
}

.ak-header-btn-close:hover {
  background: #e2e8f0;
  color: #0f172a;
}

.ak-footer {
  padding: 1.4rem 2rem;
  display: flex;
  justify-content: flex-end;
  gap: 1.2rem;
  border-top: 1px solid #e2e8f0;
  background: #f8fafc;
}

.ak-footer--top-shadow {
  box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.05);
}

.ak-error {
  background: #fee2e2;
  color: #dc2626;
  border: 1px solid #fca5a5;
  padding: 1rem 1.6rem;
  font-size: 1.4rem;
  font-weight: 600;
  border-radius: 6px;
  margin-bottom: 1.6rem;
}

.ak-info {
  background: #eff6ff;
  color: #1d4ed8;
  border: 1px solid #bfdbfe;
  padding: 1rem 1.6rem;
  font-size: 1.4rem;
  font-weight: 600;
  border-radius: 6px;
  margin-bottom: 1.6rem;
  line-height: 1.5;
}

@media (max-width: 600px) {
  .ak-modal {
    width: 95vw;
    max-height: 94vh;
  }
}

/* TOP-TO-BOTTOM MODAL ANIMATIONS */
@keyframes slideDownModal {
  0% {
    opacity: 0;
    transform: translateY(-24px) scale(0.97);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes slideUpModal {
  0% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
  100% {
    opacity: 0;
    transform: translateY(-16px) scale(0.97);
  }
}

@keyframes fadeInBackdrop {
  0% {
    opacity: 0;
  }
  100% {
    opacity: 1;
  }
}

@keyframes fadeOutBackdrop {
  0% {
    opacity: 1;
  }
  100% {
    opacity: 0;
  }
}