/* ══════════════════════════════════════════════════════════════════════
   Community Safety Popup — NIMFA Belfast
   Temporary modal. Remove this file + its <link> and <script> tags
   in index.html when no longer needed.
   ══════════════════════════════════════════════════════════════════════ */

/* ── Backdrop overlay ── */
.csp-backdrop {
  position: fixed;
  inset: 0;
  z-index: 9998;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  opacity: 0;
  transition: opacity 260ms ease;
}

.csp-backdrop.is-visible {
  opacity: 1;
}

/* ── Dialog container ── */
.csp-dialog {
  position: fixed;
  z-index: 9999;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  padding-top: calc(env(safe-area-inset-top, 0px) + 1rem);
  padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 1rem);
  padding-left: calc(env(safe-area-inset-left, 0px) + 1rem);
  padding-right: calc(env(safe-area-inset-right, 0px) + 1rem);
  pointer-events: none;
}

/* ── The popup card ── */
.csp-card {
  position: relative;
  width: 100%;
  max-width: 460px;
  max-height: calc(100dvh - 2rem - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px));
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: var(--bg-elevated);
  box-shadow: var(--shadow), 0 0 60px rgba(0, 0, 0, 0.12);
  padding: 1.75rem 1.5rem 1.5rem;
  pointer-events: auto;

  /* Entrance animation */
  opacity: 0;
  transform: translateY(18px) scale(0.97);
  transition: opacity 320ms ease, transform 320ms ease;
}

.csp-card.is-visible {
  opacity: 1;
  transform: translateY(0) scale(1);
}

/* Glass tint on dark mode */
body.dark .csp-card {
  background: rgba(22, 30, 26, 0.92);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

/* ── Close X button ── */
.csp-close-x {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  font-size: 1.15rem;
  cursor: pointer;
  transition: background 140ms ease, color 140ms ease, border-color 140ms ease;
}

.csp-close-x:hover,
.csp-close-x:focus-visible {
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  border-color: var(--accent);
  color: var(--text);
}

.csp-close-x:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ── Icon accent dot ── */
.csp-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.75rem;
  height: 2.75rem;
  margin-bottom: 0.85rem;
  border-radius: 12px;
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent) 22%, transparent);
  font-size: 1.35rem;
}

/* ── Title ── */
.csp-title {
  margin: 0 0 0.65rem;
  font-family: "Inter", system-ui, -apple-system, sans-serif;
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.3;
  padding-right: 2.5rem; /* keep clear of X button */
}

/* ── Body text ── */
.csp-body p {
  margin: 0 0 0.75rem;
  font-family: "Inter", system-ui, -apple-system, sans-serif;
  font-size: 0.95rem;
  line-height: 1.72;
  color: var(--text);
}

.csp-body p:last-child {
  margin-bottom: 0;
}

.csp-body p strong {
  font-weight: 600;
}

/* Emphasised closing line */
.csp-body .csp-closing {
  color: var(--accent);
  font-weight: 600;
  font-style: italic;
  font-family: "Lora", serif;
  font-size: 0.98rem;
}

/* ── Divider ── */
.csp-divider {
  height: 1px;
  background: var(--border);
  margin: 1rem 0;
}

/* ── "I Understand" button ── */
.csp-btn-primary {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 2.85rem;
  border: none;
  border-radius: 12px;
  background: var(--accent);
  color: #fff;
  font-family: "Inter", system-ui, -apple-system, sans-serif;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 160ms ease, transform 140ms ease, box-shadow 160ms ease;
}

.csp-btn-primary:hover {
  background: color-mix(in srgb, var(--accent) 85%, #000);
  box-shadow: 0 8px 20px color-mix(in srgb, var(--accent) 30%, transparent);
  transform: translateY(-1px);
}

.csp-btn-primary:active {
  transform: translateY(0);
}

.csp-btn-primary:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

/* ── Responsive: mobile-first refinements ── */
@media (max-width: 480px) {
  .csp-card {
    padding: 1.5rem 1.15rem 1.25rem;
    border-radius: 18px;
  }

  .csp-title {
    font-size: 1.18rem;
  }

  .csp-body p {
    font-size: 0.9rem;
  }

  .csp-btn-primary {
    height: 2.75rem;
    font-size: 0.9rem;
  }
}

/* Very small screens (iPhone SE / 320px) */
@media (max-width: 360px) {
  .csp-dialog {
    padding: 0.75rem;
  }

  .csp-card {
    padding: 1.25rem 1rem 1rem;
  }

  .csp-title {
    font-size: 1.08rem;
  }

  .csp-body p {
    font-size: 0.86rem;
  }
}
