/*
 * Staging environment banner.
 *
 * A fixed triangle in the bottom-left corner: translucent at rest, fully
 * opaque on hover, with hazard stripes drifting underneath.
 *
 * It styles a real element, .hs-staging-badge, which the reverse proxy injects
 * before </body>. An earlier revision drew the badge with a pseudo-element, but
 * Chrome does not reliably hit-test generated content, so :hover never fired.
 * A real element makes the hover state dependable.
 *
 * The mark and label are baked into one self-contained SVG, recoloured white
 * and pre-rotated to sit parallel to the hypotenuse. They are embedded as a
 * data: URI because the consuming application sends a Content-Security-Policy
 * whose img-src is "self" plus data:, so an externally hosted image would be
 * blocked by the browser. The mark is the brand favicon, cropped to its own
 * bounding box, since the source file is mostly padding.
 *
 * No layout is disturbed: the badge is an overlay and the page keeps its own
 * geometry.
 */

:root {
  --hs-stg-size: 120px;
  --hs-stg-red: #c1121f;
  --hs-stg-rest: 0.68;
  --hs-stg-speed: 1.8s;
}

.hs-staging-badge {
  position: fixed;
  left: 0;
  bottom: 0;
  width: var(--hs-stg-size);
  height: var(--hs-stg-size);
  z-index: 2147483647;

  /* Right angle in the corner, hypotenuse running up to the left edge. */
  clip-path: polygon(0 0, 0 100%, 100% 100%);

  background-color: var(--hs-stg-red);
  background-image:
    url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxMjAiIGhlaWdodD0iMTIwIiB2aWV3Qm94PSIwIDAgMTIwIDEyMCI+CiAgPGxpbmUgeDE9Ii02IiB5MT0iNiIgeDI9IjEyNiIgeTI9IjEzOCIgc3Ryb2tlPSIjZmZmZmZmIiBzdHJva2Utb3BhY2l0eT0iMC41NSIgc3Ryb2tlLXdpZHRoPSIxLjIiLz4KICA8ZyB0cmFuc2Zvcm09InRyYW5zbGF0ZSg0My4wMyw3Ni45Nykgcm90YXRlKDQ1KSI+CiAgICA8ZyB0cmFuc2Zvcm09InRyYW5zbGF0ZSgtNDguMDIsLTYuNTApIHNjYWxlKDAuMDI1MzkxKSB0cmFuc2xhdGUoLTk4LjAsLTI1Ni4wKSI+CjxwYXRoIGQ9Ik03NzAuMTY4IDQ2Mi4yNTlIMjgzLjkwMlY1NjEuOTMySDc3MC4xNjhWNDYyLjI1OVoiIGZpbGw9IiNmZmZmZmYiLz4KPHBhdGggZD0iTTkyNi4zMDMgMjU2SDQ2OC40NlYzNTUuNjczSDkyNi4zMDNWMjU2WiIgZmlsbD0iI2ZmZmZmZiIvPgo8cGF0aCBkPSJNNTg0LjI2NSA2NjguMzI3SDk4Vjc2OEg1ODQuMjY1VjY2OC4zMjdaIiBmaWxsPSIjZmZmZmZmIi8+CiAgICA8L2c+CiAgICA8dGV4dCB4PSItMTcuOTgiIHk9IjAiIGZpbGw9IiNmZmZmZmYiIGZvbnQtZmFtaWx5PSJ1aS1tb25vc3BhY2UsIFNGTW9uby1SZWd1bGFyLCBNZW5sbywgQ29uc29sYXMsIG1vbm9zcGFjZSIgZm9udC1zaXplPSIxMi4wIiBmb250LXdlaWdodD0iNzAwIiBsZXR0ZXItc3BhY2luZz0iMi42IiBkb21pbmFudC1iYXNlbGluZT0iY2VudHJhbCI+U1RBR0lORzwvdGV4dD4KICA8L2c+Cjwvc3ZnPg=="),
    linear-gradient(
      135deg,
      rgba(255, 255, 255, 0.20) 25%, transparent 25%,
      transparent 50%, rgba(255, 255, 255, 0.20) 50%,
      rgba(255, 255, 255, 0.20) 75%, transparent 75%, transparent
    );
  background-repeat: no-repeat, repeat;
  background-size: 100% 100%, 40px 40px;
  background-position: 0 0, 0 0;

  opacity: var(--hs-stg-rest);
  transition: opacity 0.18s ease-out;
  animation: hs-stg-drift var(--hs-stg-speed) linear infinite;

  cursor: help;
  will-change: opacity;
}

.hs-staging-badge:hover {
  opacity: 1;
}

/* Only the stripe layer travels; the label layer is pinned in both keyframes. */
@keyframes hs-stg-drift {
  from { background-position: 0 0, 0 0; }
  to   { background-position: 0 0, 40px 0; }
}

@media (prefers-reduced-motion: reduce) {
  .hs-staging-badge { animation: none; }
}

@media print {
  .hs-staging-badge { display: none; }
}
