/* =========================================================
   CUBERST — modal.css
   Generic overlay system for showing another page (auth,
   submit, profile) as a popup instead of a full navigation.
   The page itself renders inside an <iframe> unmodified — this
   file only styles the overlay chrome around it.
   ========================================================= */

.cuberst-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(10, 14, 20, 0.72);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s var(--ease-out);
}

.cuberst-modal-overlay.is-open {
  opacity: 1;
  pointer-events: auto;
}

.cuberst-modal-box {
  position: relative;
  width: 100%;
  max-width: var(--content-narrow);
  height: min(720px, 100%);
  background: var(--bg-base);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: 0 24px 64px -16px rgba(0, 0, 0, 0.6);
  overflow: hidden;
  transform: translateY(12px) scale(0.98);
  transition: transform 0.2s var(--ease-out);
}

.cuberst-modal-overlay.is-open .cuberst-modal-box {
  transform: translateY(0) scale(1);
}

.cuberst-modal-close {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 2;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1.1rem;
  line-height: 1;
  transition: border-color 0.15s var(--ease-out), color 0.15s var(--ease-out);
}

.cuberst-modal-close:hover {
  border-color: var(--accent-red);
  color: var(--accent-red);
}

.cuberst-modal-iframe {
  width: 100%;
  height: 100%;
  border: none;
  display: block;
  background: var(--bg-base);
}

.cuberst-modal-loading {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--text-tertiary);
  background: var(--bg-base);
  transition: opacity 0.15s var(--ease-out);
}

.cuberst-modal-loading.is-hidden {
  opacity: 0;
  pointer-events: none;
}

@media (max-width: 640px) {
  .cuberst-modal-overlay {
    padding: 0;
  }
  .cuberst-modal-box {
    max-width: 100%;
    height: 100%;
    border-radius: 0;
  }
}

/* ---------------------------------------------------------
   Applied by modal.js to <body> when a page detects it's
   running inside a modal iframe (see the DOMContentLoaded
   check at the bottom of modal.js). The site logo is hidden
   in that context; without re-justifying the topbar, its
   remaining content (sign-in/user-chip controls) would shift
   to the left since space-between only has one group of
   children left to distribute.
   --------------------------------------------------------- */

.cuberst-in-modal .topbar-inner {
  justify-content: flex-end;
}
