/*!
 * Content protection styles — casual-copy deterrent, not security.
 * Pairs with protect.js. See that file for what this does and does not stop.
 */

/* ---------------------------------------------------------------------------
   Drag-to-save.

   -webkit-user-drag is what Blink and WebKit read; Firefox reads only the
   draggable attribute, which protect.js stamps on. -webkit-touch-callout is
   the iOS long-press "Save Image" sheet.
   --------------------------------------------------------------------------- */
img, video, picture, canvas, svg {
  -webkit-user-drag: none;
  -khtml-user-drag: none;
  -moz-user-drag: none;
  user-drag: none;
}
img, video, canvas {
  -webkit-touch-callout: none;
}

/* ---------------------------------------------------------------------------
   Selection.

   Deliberately NOT site-wide. These are news and directory sites: readers
   copy a headline, a frequency, a station name, a quote. Making body text
   unselectable would break that for every honest visitor and buy nothing,
   since text lifts out of view-source anyway. Selection is only suppressed on
   media and on player chrome, where a stray drag-select over the control bar
   is a bug rather than a feature.
   --------------------------------------------------------------------------- */
video,
.xcp-shield,
.xcp-chrome,
.xcp-chrome * {
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
}

/* ---------------------------------------------------------------------------
   The shield.

   A transparent sheet over the <video> so the native context menu — and the
   "Save video as" on it — never reaches the element.

   NO z-index, on purpose. A positioned element with z-index:auto stacks in
   DOM order, and protect.js inserts this directly after the <video>. That is
   what lets the control bar, badges and message plates that come later in the
   markup keep painting and receiving clicks above it. Adding a z-index here
   would bury the player's own controls.
   --------------------------------------------------------------------------- */
.xcp-shield {
  position: absolute;
  top: 0; right: 0; bottom: 0; left: 0;
  display: block;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
  -webkit-touch-callout: none;
  touch-action: manipulation;    /* still allows the page to be panned */
  transition: background .2s ease, -webkit-backdrop-filter .2s ease, backdrop-filter .2s ease;
}

/* Away: the tab is hidden, or the window lost focus to something that is not
   an ad iframe. Frosted rather than a hard cut, so coming back reads as a
   veil lifting instead of the stream having died.

   Cost note: backdrop-filter is composited work. When the tab is hidden it is
   free (nothing paints); on a background-but-visible window it is not, which
   is why protect.js waits before engaging on focus loss. */
.xcp-shield.is-away {
  background: rgba(6, 7, 10, .90);
  -webkit-backdrop-filter: blur(20px) saturate(55%);
  backdrop-filter: blur(20px) saturate(55%);
}

/* No backdrop-filter (older Firefox): the flat plate alone still hides the
   picture, which is the point. */
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .xcp-shield.is-away { background: rgba(6, 7, 10, .97); }
}

@media (prefers-reduced-motion: reduce) {
  .xcp-shield { transition: none; }
}

/* ---------------------------------------------------------------------------
   Haiti Streaming player chrome.

   .tv-player-wrap / .radio-player  the app's own players
   .player-tv / .player-radio       the standalone /embed.html player
   media-player is Vidstack's custom element; its layout draws the controls.

   The station directory, the search results and every article stay selectable.
   --------------------------------------------------------------------------- */
.tv-player-wrap, .tv-player-wrap *,
.radio-player, .radio-player *,
.player-tv, .player-tv *,
.player-radio, .player-radio *,
media-player, media-player * {
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
}
