/*
 * Clingphilm: the protection mechanism, and nothing else. Presentation lives in theme.css.
 *
 *   1. #clingfilm lays a grid of transparent buttons over the whole page, so a right-click lands on a
 *      button and not on the image (this is what stops "Save image as" in Firefox and Safari).
 *   2. pointer-events: none on the image itself stops it in Chrome, and stops the image being dragged out.
 */

:root {
  --tile-min: 200px;
  --tile-height: 360px;
  --layer-content: 1;
  --layer-overlay: 2;
}

body {
  position: relative;   /* the overlay is sized to the page (body), not to the viewport */
  min-height: 100dvh;
  margin: 0;
}

#clingfilm {
  position: absolute;
  inset: 0;
  overflow: hidden;     /* tiles past the end of the page are clipped; they must not stretch the document */
  z-index: var(--layer-overlay);
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(var(--tile-min), 1fr));  /* tiles stretch to the exact width: no uncovered strip */
  grid-auto-rows: var(--tile-height);

  & button {
    inline-size: 100%;
    block-size: 100%;
    margin: 0;
    padding: 0;
    border: 0;
    background: transparent;
    cursor: default;
  }
}

#content {
  z-index: var(--layer-content);

  & img {
    pointer-events: none;
  }
}
