/*
  Content protection of the student web portal (signed-in pages and sign-in / register), with public/web/protect.js.
  Not loaded on the public landing page. A deterrent: a web page cannot stop a determined user (see protect.js).
  - no text selection, highlight, "look up" / long-press menu or dragging outside form fields, whatever a component
    sets (!important); form fields work normally: typing, selection, paste;
  - printing shows one notice instead of the page;
  - covers (focus shield, the one-frame capture cover #pt-capture, the extension-block and developer-tools dialogs) and
    the short notices ("toasts").
  The identity watermark is only on documents: the PDF reader's overlay (portal-media.css .pdf-mark) and the stamped copy.
*/

/* ---- selection, look up and drag: off everywhere except form fields ---- */
body, body * { -webkit-user-select: none !important; user-select: none !important; -webkit-touch-callout: none !important; }
:is(input, textarea, select, [contenteditable=""], [contenteditable="true"]),
:is(input, textarea, select, [contenteditable=""], [contenteditable="true"]) * { -webkit-user-select: text !important; user-select: text !important; -webkit-touch-callout: default !important; }
body ::selection { background: transparent; }
body :is(input, textarea, [contenteditable=""], [contenteditable="true"])::selection { background: Highlight; color: HighlightText; }
img, svg, a, canvas, video { -webkit-user-drag: none !important; }

/* ---- printing: nothing but the notice ---- */
@media print {
  /* :not(#…) lifts the specificity above page rules that force a print note to show (`.print-note { … !important }`). */
  body *:not(#portal-print-disabled) { display: none !important; }
  html, body { background: #fff !important; }
  body::before { content: "Printing is disabled"; display: block; padding: 64px 24px; text-align: center; font: 700 22px system-ui, sans-serif; color: #13221f; }
}

/* ---- covers: the page disappears in the same frame (class on <html>), the panel says why ---- */
html.pt-covered body { visibility: hidden !important; }
html.pt-covered, html.pt-covered body { background: var(--navy, #0c3b35) !important; }
.pt-cover { visibility: visible !important; position: fixed; inset: 0; width: 100vw; height: 100vh; height: 100dvh; max-width: none; max-height: none; margin: 0; border: 0; padding: 24px; background: var(--navy, #0c3b35); color: #fff; }
.pt-cover[open] { display: grid; place-items: center; }
.pt-cover::backdrop { background: var(--navy, #0c3b35); }
.pt-cover-body { display: grid; gap: 10px; justify-items: center; text-align: center; max-width: 520px; }
.pt-cover .pt-brand { font: 700 13px var(--display, system-ui); letter-spacing: .1em; text-transform: uppercase; color: var(--amber, #f5a524); }
.pt-cover h2 { font: 800 26px/1.25 var(--display, system-ui); letter-spacing: -.01em; }
.pt-cover p { font: 500 15px var(--body, system-ui); opacity: .85; }
.pt-cover p:empty { display: none; }

/* ---- capture cover (protect.js layer 1-3): pre-rendered, shown in one frame by a class on <html>, no on-demand build.
   A plain element (not a <dialog>) so the class toggle paints immediately; the body is hidden the same frame. ---- */
#pt-capture { display: none; }
html.pt-capture-on body { visibility: hidden !important; }
html.pt-capture-on, html.pt-capture-on body { background: var(--navy, #0c3b35) !important; }
html.pt-capture-on #pt-capture { visibility: visible !important; display: grid; place-items: center; }
#pt-capture { position: fixed; inset: 0; z-index: 2147483647; padding: 24px; background: var(--navy, #0c3b35); color: #fff; }

/* ---- toast: one short notice at a time, bottom centre ---- */
.pt-toast { position: fixed; left: 50%; bottom: 24px; z-index: 2147483647; transform: translate(-50%, 10px); max-width: min(440px, calc(100vw - 32px)); padding: 10px 16px; border-radius: 12px; background: var(--navy, #0c3b35); color: #fff; border-left: 4px solid var(--amber, #f5a524); font: 600 14px/1.4 var(--body, system-ui); text-align: center; box-shadow: 0 14px 30px -14px rgba(0, 0, 0, .55); opacity: 0; pointer-events: none; transition: opacity .18s ease, transform .18s ease; }
.pt-toast.on { opacity: 1; transform: translate(-50%, 0); }
@media (max-width: 860px) { .pt-toast { bottom: calc(86px + env(safe-area-inset-bottom)); } } /* above the phone bottom bar */
@media (prefers-reduced-motion: reduce) { .pt-toast { transition: none; } }

/* ---- developer tools overlay (native modal dialog: top layer, the page behind is inert) ---- */
.dt-guard { margin: auto; border: 0; padding: 0; border-radius: 20px; width: min(440px, calc(100vw - 32px)); background: var(--surface, #fffefb); color: var(--ink, #13221f); box-shadow: 0 24px 50px -22px rgba(12, 59, 53, .45); }
.dt-guard::backdrop { background: rgba(8, 20, 18, .72); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); }
.dt-guard .dt-body { padding: 28px 24px; display: grid; gap: 12px; text-align: center; }
.dt-guard .dt-ico { width: 52px; height: 52px; border-radius: 16px; margin: 0 auto; display: grid; place-items: center; background: var(--red-50, #fde8e8); color: var(--red, #e5484d); }
.dt-guard .dt-ico svg { width: 26px; height: 26px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.dt-guard h2 { font: 700 19px/1.35 var(--display, system-ui); letter-spacing: -.01em; }
.dt-guard p { color: var(--muted, #66736f); font-size: 14px; }
