/* ==========================================================================
   OLD-FILM LOOK for the photos in a case file (the button "Film look" in the file's top bar).
   ON    = a little grain, faint flicker, thin scratches and dust, slightly faded colour.
   SEPIA = the same, in brown tones.        OFF = just the normal look.
   The moving parts are slow and gentle (nothing faster than about 3 changes a second) and stop for "reduce motion".
   ========================================================================== */
.casefile .lead-cover .cover, .casefile .cf-body .ph { position: relative; overflow: hidden; display: block; }
.casefile .cf-body .ph img { width: 100%; }

/* the overlay: scratches (::before) and flicker + dust + grain + vignette (::after) */
.casefile:not(.film-off) .lead-cover .cover::before, .casefile:not(.film-off) .cf-body .ph::before,
.casefile:not(.film-off) .lead-cover .cover::after, .casefile:not(.film-off) .cf-body .ph::after { content: ""; position: absolute; inset: 0; pointer-events: none; }
.casefile:not(.film-off) .lead-cover .cover::before, .casefile:not(.film-off) .cf-body .ph::before {
  z-index: 2; opacity: .55;
  background:
    linear-gradient(90deg, transparent 0 14%, rgba(255,255,255,.5) 14% 14.35%, transparent 14.35% 63%, rgba(255,255,255,.34) 63% 63.25%, transparent 63.25% 88%, rgba(0,0,0,.28) 88% 88.3%, transparent 88.3%);
  background-size: 100% 100%; animation: scratch 2.6s steps(1) infinite;
}
@keyframes scratch { 0% { background-position: 0 0; opacity: .5; } 18% { background-position: 21% 0; opacity: .25; } 34% { background-position: -9% 0; opacity: .6; } 52% { background-position: 37% 0; opacity: 0; } 70% { background-position: 8% 0; opacity: .5; } 86% { background-position: -22% 0; opacity: .3; } }
.casefile:not(.film-off) .lead-cover .cover::after, .casefile:not(.film-off) .cf-body .ph::after {
  z-index: 3; mix-blend-mode: soft-light; opacity: .9;
  background:
    radial-gradient(circle at 18% 28%, rgba(255,255,255,.9) 0 1.2px, transparent 1.8px),
    radial-gradient(circle at 72% 61%, rgba(0,0,0,.8) 0 1.4px, transparent 2px),
    radial-gradient(circle at 44% 82%, rgba(255,255,255,.8) 0 1px, transparent 1.6px),
    radial-gradient(ellipse at 50% 50%, transparent 52%, rgba(0,0,0,.55) 100%),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.55'/%3E%3C/svg%3E");
  animation: filmflick 3.4s steps(1) infinite, dust 5.2s steps(1) infinite;
}
@keyframes filmflick { 0%, 100% { filter: brightness(1); } 13% { filter: brightness(1.07); } 29% { filter: brightness(.95); } 47% { filter: brightness(1.04); } 66% { filter: brightness(.97); } 82% { filter: brightness(1.06); } }
@keyframes dust { 0% { background-position: 0 0, 0 0, 0 0, 0 0, 0 0; } 25% { background-position: 9px -4px, -7px 6px, 3px 10px, 0 0, 31px 12px; } 50% { background-position: -5px 8px, 6px -9px, -8px -3px, 0 0, -18px 40px; } 75% { background-position: 12px 3px, -3px -6px, 5px 7px, 0 0, 22px -26px; } }

/* colour: faded for FILM, brown for SEPIA. Applied to the pictures only, not the paper around them. */
.casefile.film-film .lead-cover .cover > *, .casefile.film-film .cf-body .ph img { filter: contrast(1.08) saturate(.72) sepia(.14) brightness(.98); }
.casefile.film-sepia .lead-cover .cover > *, .casefile.film-sepia .cf-body .ph img { filter: sepia(.92) contrast(1.1) saturate(.9) brightness(.94); }
@media (prefers-reduced-motion: reduce) {
  .casefile .lead-cover .cover::before, .casefile .cf-body .ph::before, .casefile .lead-cover .cover::after, .casefile .cf-body .ph::after { animation: none !important; }
}
