/* modal.css — Madame Regenbogen (privacy modal)
   - Accessible modal overlay
   - Works with fetch() and iframe fallback
   - Readability-focused typography inside .mr-content
*/

:root {
  --modal-bg: rgba(0,0,0,.6);
  --modal-radius: 18px;
  --modal-max-w: min(920px, 92vw);
  --modal-max-h: min(82vh, 720px);
}

/* === Overlay & Container === */
.mr-modal-overlay {
  position: fixed;
  inset: 0;
  background: var(--modal-bg);
  display: grid;
  place-items: center;
  z-index: 9999;
  padding: 1rem;
  animation: mr-fade-in .15s ease-out;
}

@keyframes mr-fade-in { from { opacity: 0 } to { opacity: 1 } }
@keyframes mr-pop { from { transform: scale(.98) } to { transform: scale(1) } }

.mr-modal {
  background: #fff;
  color: #111;
  width: var(--modal-max-w);
  max-height: var(--modal-max-h);
  border-radius: var(--modal-radius);
  box-shadow: 0 10px 40px rgba(0,0,0,.25);
  overflow: hidden;
  display: grid;
  grid-template-rows: auto 1fr;
  animation: mr-pop .2s ease-out;
}

/* === Header === */
.mr-modal header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .5rem;
  padding: .75rem 1rem;
  border-bottom: 1px solid #eee;
}

.mr-modal header h2 {
  margin: 0;
  font-size: 1.125rem;
  font-weight: 700;
  color: #111;
  letter-spacing: .2px;
}

.mr-modal .mr-close {
  appearance: none;
  border: 0;
  background: transparent;
  cursor: pointer;
  font-size: 1.5rem;
  line-height: 1;
  padding: .25rem .5rem;
}

/* === Content Area === */
.mr-modal .mr-content {
  overflow: auto;
  padding: 10px;
  text-align: left !important;   /* Force left text even if global styles center text */
  color: #222;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Ensure common text elements inside modal are left-aligned */
.mr-content p,
.mr-content ul,
.mr-content ol,
.mr-content li,
.mr-content table,
.mr-content blockquote,
.mr-content pre { text-align: left !important; }

/* Headings — improve readability, remove shadows, ensure contrast */
.mr-content h1,
.mr-content h2,
.mr-content h3,
.mr-content h4 {
  color: #111 !important;
  text-shadow: none !important;
  font-weight: 700;
  line-height: 1.25;
  margin: 1.25rem 0 .75rem;
  text-align: left !important;
}

/* Sizes */
.mr-content h1 { font-size: 1.6rem; }
.mr-content h2 { font-size: 1.35rem; border-bottom: 1px solid #eee; padding-bottom: .25rem; }
.mr-content h3 { font-size: 1.15rem; }
.mr-content h4 { font-size: 1.05rem; }

/* Lists spacing */
.mr-content ul, .mr-content ol { padding-left: 1.25rem; margin: .5rem 0 .75rem; }
.mr-content li { margin: .25rem 0; }

/* Links */
.mr-content a { color: #0b66ff; text-underline-offset: 2px; }
.mr-content a:hover { text-decoration: underline; }

/* Muted helper */
.mr-content .muted { color: #666; font-size: .95rem; }

/* Hide the on-page table of contents inside the modal (we use native scrolling) */
.mr-content .toc { display:none !important; }

/* Chips / badges inside content */
.mr-content .chip {
  display: inline-block;
  border: 1px solid #ddd;
  padding: .125rem .5rem;
  border-radius: 999px;
  margin-right: .5rem;
  font-size: .85rem;
  background: #fff;
  color: #333;
}

/* Notes */
.mr-content .note {
  background: #fff6d6;
  border-left: 4px solid #ffd24d;
  padding: .75rem 1rem;
  border-radius: .25rem;
}

/* Allow iframes to fill modal content when used as fallback */
.mr-content iframe {
  display: block;
  width: 100%;
  height: calc(var(--modal-max-h) - 56px);
  border: 0;
}

/* When the modal is open, prevent body scroll */
.mr-no-scroll { overflow: hidden !important; }
