/* KNOX BANK — Content Protection Layer
 *
 * Paired with src/js/security/. Every rule is gated on .knox-protect-on, which
 * the runtime puts on <html> only for non-exempt roles inside the product
 * shell — the public landing page and the admin console are untouched.
 */

/* ── Selection & extraction surface ──────────────────────────────────────── */

html.knox-protect-on .knox-protected {
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

/* The highlighter tool works off a real text selection, and students type in
   their own note fields. Both stay selectable; the clipboard guard is what
   stops the text leaving. */
html.knox-protect-on .knox-protected .question-stem,
html.knox-protect-on .knox-protected input,
html.knox-protect-on .knox-protected textarea,
html.knox-protect-on .knox-protected select,
html.knox-protect-on .knox-protected [contenteditable="true"] {
  -webkit-user-select: text;
  user-select: text;
  -webkit-touch-callout: default;
}

html.knox-protect-on .knox-protected img,
html.knox-protect-on .knox-protected svg {
  -webkit-user-drag: none;
  pointer-events: none;
}

/* Buttons built around an icon still need to be clickable. */
html.knox-protect-on .knox-protected button svg,
html.knox-protect-on .knox-protected [role="button"] svg,
html.knox-protect-on .knox-protected a svg {
  pointer-events: none;
}

/* ── Blocked-action notice ───────────────────────────────────────────────── */

#knox-protect-notice {
  position: fixed;
  left: 50%;
  bottom: 26px;
  transform: translate(-50%, 12px);
  z-index: 2147483500;
  max-width: min(420px, calc(100vw - 32px));
  padding: 10px 16px;
  border-radius: var(--r-lg, 12px);
  border: 1px solid var(--border-strong, #9aa4bd);
  background: var(--surface-solid, #fff);
  box-shadow: var(--shadow-overlay, 0 16px 40px -10px rgba(10, 16, 32, 0.28));
  font-family: var(--f-ui, system-ui, sans-serif);
  font-size: 0.8rem;
  font-weight: 600;
  line-height: 1.5;
  color: var(--text, #16203a);
  text-align: center;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 160ms ease-out, transform 160ms ease-out;
}

#knox-protect-notice.is-visible {
  opacity: 1;
  visibility: visible;
  transform: translate(-50%, 0);
}

/* ── Session lockout ─────────────────────────────────────────────────────── */

#knox-lock {
  position: fixed;
  inset: 0;
  z-index: 2147483647;
  display: grid;
  place-items: center;
  padding: 24px;
  background: var(--canvas, #f4f6fb);
}

.knox-lock-card {
  max-width: 440px;
  padding: 28px;
  border-radius: var(--r-xl, 16px);
  border: 1px solid var(--border, #d4dae8);
  background: var(--surface-solid, #fff);
  box-shadow: var(--shadow-overlay, 0 16px 40px -10px rgba(10, 16, 32, 0.28));
  font-family: var(--f-ui, system-ui, sans-serif);
  color: var(--text, #16203a);
  text-align: center;
}

.knox-lock-mark {
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.18em;
  color: var(--accent, #2f6bd8);
}

.knox-lock-card h2 {
  margin: 14px 0 10px;
  font-size: 1.25rem;
  font-weight: 750;
}

.knox-lock-card p {
  margin: 0 0 12px;
  font-size: 0.88rem;
  line-height: 1.6;
  color: var(--text-muted, #4a5570);
}

.knox-lock-ref {
  font-family: var(--f-data, monospace);
  font-size: 0.74rem;
  color: var(--text-faint, #6b7590);
}

.knox-lock-btn {
  margin: 6px 0 14px;
  padding: 10px 20px;
  border: 0;
  border-radius: var(--r-md, 8px);
  background: var(--accent, #2f6bd8);
  color: var(--on-accent, #fff);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.knox-lock-btn:hover {
  background: var(--accent-hover, #2456b4);
}

.knox-lock-note {
  font-size: 0.76rem !important;
  color: var(--text-faint, #6b7590) !important;
}

/* ── Print ───────────────────────────────────────────────────────────────── */

@media print {
  html.knox-protect-on body > * {
    display: none !important;
  }

  html.knox-protect-on body::after {
    content: "KNOX BANK — printing question content is not permitted. " var(--knox-trace-id, "");
    display: block;
    padding: 48px;
    font-family: system-ui, sans-serif;
    font-size: 13px;
    font-weight: 700;
    line-height: 1.7;
    color: #000;
  }
}
