/* Only Elite Sports: the line device. One module, laid over any photograph the same way.

   What it draws
   1. The grade: a thin claret wash over the whole picture, so any photo sits in the palette.
   2. The line: one cream rule at the mark's lean (3 across for every 10 down), 78% of the way across.
   3. The lanes: past the line the same picture is printed in claret alone, cut into the mark's three lanes.

   Markup. The picture is named twice: once in colour, once for the print. The second copy comes from the cache.

     <figure class="ees-line">
       <picture><source srcset="today-800.avif" type="image/avif"><img src="today-800.webp" alt="" width="800" height="450"></picture>
       <span class="ees-line-print" aria-hidden="true"><img src="today-800.webp" alt="" width="800" height="450" loading="lazy"></span>
       <i class="ees-line-rule" aria-hidden="true"></i>
     </figure>

   The box needs a size: give it a height or an aspect-ratio. Anything else placed inside (a scrim, a title)
   takes z-index 4 or more.

   Variants
     .ees-line.is-grade   a firmer grade, for a library photo that arrives in its own colours
     .ees-line.is-plain   the device off: the picture as it is
     --ees-line-x         where the line meets the top edge (default 78cqw)

   The colours are the app's tokens with their values as fallbacks, so the file works on its own. */
.ees-line {
  --ees-line-x: 78cqw;
  --ees-claret: var(--masthead, #7a1f33);
  --ees-claret-deep: var(--masthead-pill, #5f1828);
  --ees-cream: #f2f1ec;
  position: relative; overflow: hidden; isolation: isolate; container-type: size;
  width: 100%; margin: 0; background: var(--ees-claret-deep);
}
.ees-line > picture, .ees-line > picture img, .ees-line > img, .ees-line-print img { display: block; width: 100%; height: 100%; object-fit: cover; }
.ees-line > picture img, .ees-line > img { filter: saturate(1.06) contrast(1.04); }

/* 1. The grade. */
.ees-line::after { content: ""; position: absolute; inset: 0; z-index: 1; pointer-events: none; background: var(--ees-claret); mix-blend-mode: soft-light; opacity: .32; }

/* 3. The lanes: 0 to 30%, 34 to 66% and 70 to 100% of the height, each starting on the line. */
.ees-line-print {
  position: absolute; inset: 0; z-index: 2; isolation: isolate; background: var(--ees-claret-deep);
  clip-path: polygon(
    var(--ees-line-x) 0, 100% 0, 100% 100%, calc(var(--ees-line-x) - 30cqh) 100%,
    calc(var(--ees-line-x) - 21cqh) 70%, 100% 70%, 100% 66%, calc(var(--ees-line-x) - 19.8cqh) 66%,
    calc(var(--ees-line-x) - 10.2cqh) 34%, 100% 34%, 100% 30%, calc(var(--ees-line-x) - 9cqh) 30%);
}
.ees-line-print img { filter: grayscale(1) contrast(1.2) brightness(1.25); }
.ees-line-print::after { content: ""; position: absolute; inset: 0; background: #8e243b; mix-blend-mode: multiply; }

/* 2. The line: 2.5px wide, top to bottom, leaning with the mark. */
.ees-line-rule {
  position: absolute; inset: 0; z-index: 3; background: var(--ees-cream);
  clip-path: polygon(calc(var(--ees-line-x) - 2.5px) 0, var(--ees-line-x) 0, calc(var(--ees-line-x) - 30cqh) 100%, calc(var(--ees-line-x) - 30cqh - 2.5px) 100%);
}

/* A library photo takes a firmer grade before the device goes on. */
.ees-line.is-grade > picture img, .ees-line.is-grade > img { filter: saturate(.72) contrast(1.1) brightness(.96) sepia(.18); }
.ees-line.is-grade::after { opacity: .62; }
.ees-line.is-grade::before { content: ""; position: absolute; inset: 0; z-index: 1; pointer-events: none; background: var(--ees-claret); mix-blend-mode: color; opacity: .2; }

/* The device off. */
.ees-line.is-plain::after, .ees-line.is-plain::before, .ees-line.is-plain .ees-line-print, .ees-line.is-plain .ees-line-rule { display: none; }
.ees-line.is-plain > picture img, .ees-line.is-plain > img { filter: none; }

/* A browser without container units (before Safari 16, Chrome 105) keeps the grade and drops the line and lanes. */
@supports not (width: 1cqw) { .ees-line-print, .ees-line-rule { display: none; } }

/* A printed page keeps the picture and the line and drops the blend layers, which printers draw badly. */
@media print { .ees-line::after, .ees-line::before { display: none; } }
