/* ==========================================================================
   Ingonyama Trust — Copyright / Copy-Protection Layer
   ==========================================================================
   Client-side COPY DETERRENCE only — this is not a security mechanism and
   does not prevent screenshots, browser dev tools, or a determined user.
   The legal notice lives at /copyright-intellectual-property/.

   Scope: applied to <body class="itb-protect"> (see the body_class filter
   in functions.php — ingonyama_body_protection_class()). Explicitly does
   NOT apply to: form controls, editable regions, the accessibility panel,
   the language switcher / GTranslate widget, mailto/tel links, footer
   contact details, or anything opted out via .allow-select.
   ========================================================================== */

body.itb-protect {
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
}

/* Re-enable normal selection for interactive / form / accessibility
   elements. user-select is inherited, so setting it on the container
   restores it for children too. */
body.itb-protect input,
body.itb-protect textarea,
body.itb-protect select,
body.itb-protect button,
body.itb-protect label,
body.itb-protect form,
body.itb-protect [contenteditable],
body.itb-protect .itb-a11y-panel,
body.itb-protect .itb-a11y-fab,
body.itb-protect .itb-lang,
body.itb-protect .gtranslate_wrapper,
body.itb-protect .f-contact-item,
body.itb-protect .allow-select {
  -webkit-user-select: text;
  -moz-user-select: text;
  -ms-user-select: text;
  user-select: text;
}

/* Images: block the drag-to-save gesture and iOS long-press save menu. */
body.itb-protect img,
body.itb-protect .protected-image {
  -webkit-user-drag: none;
  user-drag: none;
  -webkit-touch-callout: none;
}
/* Images inside forms/interactive widgets (e.g. an icon button) stay normal. */
body.itb-protect form img,
body.itb-protect .itb-a11y-panel img,
body.itb-protect .itb-lang img {
  -webkit-user-drag: initial;
  user-drag: initial;
  -webkit-touch-callout: default;
}

/* Print deterrence for protected content. Legal/contact pages opt out via
   .itb-allow-print (added in functions.php) so they remain fully printable. */
@media print {
  /* "main" is the shared content wrapper across every page template
     (template-parts/site-header.php opens it, or individual templates use
     it directly) — hiding it, plus any explicit .protected-content region,
     covers protected content without needing markup changes per page. */
  body.itb-protect:not(.itb-allow-print) main,
  body.itb-protect:not(.itb-allow-print) .protected-content {
    display: none !important;
  }
  body.itb-protect:not(.itb-allow-print)::after {
    content: "This content is protected under copyright. Reproduction is subject to permission — see ingonyamatrust.org.za/copyright-intellectual-property/";
    display: block;
    padding: 24px;
    font: 13px/1.6 Arial, sans-serif;
  }
}

/* ── Optional watermark helper ─────────────────────────────────────────
   Opt-in only — apply the .itb-watermarked class (with a data-watermark
   attribute) to a specific image wrapper via itbWatermark() in
   js/copy-protection.js. Nothing is watermarked automatically. */
.itb-watermarked {
  position: relative;
  display: inline-block;
  max-width: 100%;
}
.itb-watermarked::after {
  content: attr(data-watermark);
  position: absolute;
  right: 10px;
  bottom: 10px;
  padding: 4px 10px;
  font: 600 11px/1.2 Arial, Helvetica, sans-serif;
  color: rgba(255, 255, 255, 0.85);
  background: rgba(0, 0, 0, 0.35);
  border-radius: 4px;
  letter-spacing: 0.02em;
  pointer-events: none;
  user-select: none;
}
