/* ============== Just Jana — Story Preface Gate ============== */
/* Overlay: soft veil + backdrop blur to match JJ vibe */
.jjp-overlay {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  padding: clamp(16px, 3vw, 32px);
  background:
    radial-gradient(1200px 800px at 20% 10%, rgba(250, 236, 242, 0.45), transparent 60%),
    radial-gradient(1000px 700px at 85% 90%, rgba(243, 229, 234, 0.35), transparent 60%),
    rgba(30, 18, 22, 0.25); /* subtle dark veil */
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  z-index: 9999;
}

/* Dialog: frosted glass card with JJ accents */
.jjp-dialog {
  width: min(720px, 100%);
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid #fdf4f1;               /* your requested border tone */
  border-radius: 16px;
  box-shadow: 0 20px 50px rgba(43, 24, 32, 0.15);
  padding: clamp(18px, 3.2vw, 28px);
  color: #3b2f2f;                           /* warm deep text */
  position: relative;
}

/* Title + content */
#jjp-title {
  margin: 0 2rem 0.5rem 0;
  font-size: clamp(1.1rem, 2.2vw, 1.4rem);
  font-weight: 700;
  color: #6c4c59;                            /* muted mauve */
}

.jjp-content p {
  margin: 0 0 0.85rem 0;
  line-height: 1.6;
  font-size: clamp(0.95rem, 1.7vw, 1.05rem);
}

/* Close */
.jjp-close {
  position: absolute;
  top: 8px;
  right: 12px;
  font-size: 1.6rem;
  line-height: 1;
  background: transparent;
  border: 0;
  color: #8a6b77;
  cursor: pointer;
}

/* Opt out */
.jjp-optout {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0.5rem 0 0.75rem;
  font-size: 0.92rem;
  color: #6f5a61;
}

/* Actions */
.jjp-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 0.5rem;
}

.jjp-btn {
  appearance: none;
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 10px 14px;
  font-weight: 600;
  cursor: pointer;
  transition: transform .08s ease, box-shadow .2s ease, background .2s ease, border-color .2s ease;
}

.jjp-btn:active { transform: translateY(1px); }

.jjp-btn-primary {
  background: linear-gradient(180deg, #f3e3e8, #ead7dd);
  border-color: #e9cfd7;
  color: #3b2f2f;
  box-shadow: 0 4px 12px rgba(156, 104, 124, 0.25);
}
.jjp-btn-primary:hover { filter: brightness(1.02); }

.jjp-btn-ghost {
  background: rgba(255,255,255,0.6);
  border-color: #e8d9dd;
  color: #6c4c59;
}
.jjp-btn-ghost:hover { background: rgba(255,255,255,0.8); }

/* Show/Hide */
.jjp-overlay[aria-hidden="false"] { display: flex; }

/* Mobile niceties */
@media (max-width: 480px) {
  .jjp-actions { flex-direction: column-reverse; align-items: stretch; }
  .jjp-close { top: 6px; right: 8px; }
}

/* --- Make the dialog scrollable on small screens --- */
.jjp-overlay {
  /* allow the overlay itself to scroll if needed */
  overflow: auto;
  overscroll-behavior: contain; /* stop background bounce */
}

/* base: turn the dialog into a column so the body can scroll */
.jjp-dialog {
  display: flex;
  flex-direction: column;
  max-height: 90vh;               /* desktop/tablet guard */
}

/* the long text area should scroll, not overflow off-screen */
.jjp-content {
  flex: 1 1 auto;
  overflow: auto;
  -webkit-overflow-scrolling: touch; /* smooth iOS scroll */
}

/* keep actions visible at the bottom of the dialog */
.jjp-actions {
  flex: 0 0 auto;
  border-top: 1px solid rgba(0,0,0,0.06);
  padding-top: 0.6rem;
}

/* mobile fine-tuning */
@media (max-width: 480px) {
  .jjp-overlay {
    align-items: flex-start; /* start at top so it fits */
    padding: max(12px, env(safe-area-inset-top))
             16px
             max(16px, env(safe-area-inset-bottom))
             16px;
  }

  .jjp-dialog {
    width: 100%;
    max-width: 640px;
    /* fill the safe viewport height without being cut off */
    max-height: calc(100dvh - env(safe-area-inset-top) - env(safe-area-inset-bottom) - 24px);
  }

  /* slightly larger tap targets on mobile */
  .jjp-btn { padding: 12px 16px; }
}
