/* ── Page Modal ──────────────────────────────────────────────── */
.page-modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  backdrop-filter: blur(4px);
  z-index: 1500;  /* below sketch (2000) and mermaid expand (4000) */
  align-items: center;
  justify-content: center;
  padding: 24px;
  animation: modalFadeIn 0.2s ease;
}

.page-modal-overlay.active {
  display: flex;
}

@keyframes modalFadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.page-modal {
  background: var(--surface, #fff);
  border-radius: 16px;
  width: 100%;
  max-width: 820px;
  height: 85vh;
  max-height: 900px;
  display: flex;
  flex-direction: column;
  box-shadow: 0 32px 80px rgba(0,0,0,0.25);
  overflow: hidden;
  animation: modalSlideUp 0.25s ease;
}

@keyframes modalSlideUp {
  from { opacity: 0; transform: translateY(16px) scale(0.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.page-modal-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-mid, rgba(0,0,0,0.1));
  flex-shrink: 0;
  gap: 12px;
  background: var(--surface, #fff);
}

.page-modal-title {
  font-family: 'DM Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted, #777);
}

.page-modal-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.page-modal-open-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  font-family: 'DM Sans', sans-serif;
  font-size: 11px;
  color: var(--muted, #777);
  background: none;
  border: 1px solid var(--border-mid, rgba(0,0,0,0.12));
  border-radius: 6px;
  cursor: pointer;
  text-decoration: none;
  transition: color 0.12s, border-color 0.12s;
}

.page-modal-open-btn:hover {
  color: var(--text, #1a2b2b);
  border-color: var(--text, #1a2b2b);
}

.page-modal-close-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  background: none;
  border: 1px solid var(--border-mid, rgba(0,0,0,0.12));
  border-radius: 7px;
  cursor: pointer;
  color: var(--muted, #777);
  font-size: 16px;
  line-height: 1;
  transition: color 0.12s, border-color 0.12s;
  flex-shrink: 0;
}

.page-modal-close-btn:hover {
  color: var(--text, #1a2b2b);
  border-color: var(--text, #1a2b2b);
}

.page-modal-iframe {
  flex: 1;
  border: none;
  width: 100%;
  height:100%;
  background: var(--bg, #f2f2f2);
}

.page-modal-loading {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg, #f2f2f2);
  font-family: 'DM Mono', monospace;
  font-size: 12px;
  color: var(--muted, #777);
  pointer-events: none;
  transition: opacity 0.2s;
}

.page-modal-iframe-wrap {
  flex: 1;
  position: relative;
  overflow: hidden;
}

@media (max-width: 600px) {
  .page-modal-overlay { padding: 0; align-items: flex-end; }
  .page-modal { border-radius: 16px 16px 0 0; height: 92vh; max-width: 100%; }
}
