/* ═══════════════════════════════════════════════════════════════════════════
   Lens hero art: a plant-floor panel PC, not a browser window.

   A dark bezel around a 1024x600 screen, on a light mounting flange. The screen
   boots (dark, a generic customer splash, the Raylux mark with the beam as a
   progress bar), fades straight into a touch-sized HP HMI, stages the fans on,
   takes one tap, holds, and dims. No desktop or browser chrome at any point.

   RULES THAT KEEP IT HONEST
     - Decoration: the markup is aria-hidden; nothing here is a claim.
     - The screen is a device display, not site chrome: its grays are fixed
       (RAYLUX-STD-HMI-001: gray screen, black values, no color without an
       alarm) so it reads the same in Daylight and Night. They are built with
       color-mix from the white/black keywords, not literals. The flange and
       the page around it use tokens.
     - The beam is allowed on the splash only: Raylux working.
     - Motion is one 10 s loop, ease-in-out, only under .is-playing (main.js
       toggles it while the art is on screen). The base styles are the finished
       HMI frame, which is what reduced motion and no-JS show.
     - Numbers tick as CSS counters driven by registered integers; the real
       text sits in .lens-num and is hidden while playing.
     - The root also carries .part so main.js's observer finds it. product-art.css
       is not loaded here, so .part adds nothing else.
   ═══════════════════════════════════════════════════════════════════════════ */

@property --lens-stage { syntax: "<integer>"; inherits: true; initial-value: 7; }
@property --lens-fpm { syntax: "<integer>"; inherits: true; initial-value: 412; }

@media (min-width: 901px) {
  .hero-grid.lens-grid {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  }
}

/* ---------- the mounting flange ---------- */
.lens-art {
  width: 100%;
  max-width: 600px;
  justify-self: end;
  position: relative;
  z-index: 1;
  padding: 9px;
  background: var(--paper);
  border: 1px solid var(--border-strong);
  border-radius: calc(var(--r-lg) + 10px);
  box-shadow: var(--shadow-lg);
}

@media (max-width: 900px) {
  .lens-art {
    justify-self: start;
    max-width: 560px;
  }
}

/* ---------- the bezel ---------- */
.lens-bezel {
  padding: 14px;
  border-radius: var(--r-lg);
  background: color-mix(in srgb, black 90%, white);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, black 76%, white);
}

/* ---------- the screen: everything inside scales with its width ---------- */
.lens-screen {
  --lz-screen: color-mix(in srgb, white 84.7%, black);
  --lz-cont: color-mix(in srgb, white 91%, black);
  --lz-bar: color-mix(in srgb, white 94.5%, black);
  --lz-line: color-mix(in srgb, white 78.8%, black);
  --lz-stop: color-mix(in srgb, white 50.2%, black);
  --lz-sec: color-mix(in srgb, white 37.3%, black);
  --lz-edge: color-mix(in srgb, white 60%, black);
  --lens-stage: 7;
  --lens-fpm: 412;
  position: relative;
  overflow: hidden;
  aspect-ratio: 1024 / 600;
  container-type: inline-size;
  border-radius: 6px;
  background: var(--lz-screen);
  color: black;
  font-size: 10px; /* cqw cannot size the container itself; children set their own */
  line-height: 1.25;
  font-variant-numeric: tabular-nums;
}

.lens-hmi {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: grid;
  grid-template-rows: 8.4cqw minmax(0, 1fr);
}

.lens-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2cqw;
  padding: 0 2.4cqw;
  background: var(--lz-bar);
  border-bottom: 1px solid var(--lz-line);
}

.lens-head b {
  font-size: max(11px, 3.1cqw);
  font-weight: 700;
  white-space: nowrap;
}

.lens-head span {
  font-size: max(10px, 2.4cqw);
  color: var(--lz-sec);
  font-weight: 600;
  white-space: nowrap;
}

.lens-main {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 1.8cqw;
  padding: 2.2cqw 2.4cqw;
}

.lens-tiles {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1.6cqw;
}

.lens-tile {
  position: relative;
  display: grid;
  gap: 0.8cqw;
  align-content: center;
  padding: 1.8cqw;
  border-radius: max(6px, 1.4cqw);
  background: var(--lz-cont);
  box-shadow: inset 0 0 0 0 transparent;
}

.lens-k {
  font-size: max(10px, 2.4cqw);
  color: var(--lz-sec);
  font-weight: 600;
  white-space: nowrap;
}

.lens-v {
  font-size: max(16px, 5.6cqw);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.1;
  white-space: nowrap;
}

.lens-v small {
  margin-left: 0.4em;
  font-size: max(10px, 2.4cqw);
  font-weight: 500;
  letter-spacing: 0;
}

.lens-fans {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 1.2cqw;
  padding: 1.8cqw;
  border-radius: max(6px, 1.4cqw);
  background: var(--lz-cont);
}

.lens-cols {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 1cqw;
}

.lens-col {
  display: grid;
  grid-template-rows: repeat(4, minmax(0, 1fr));
  gap: 0.9cqw;
}

/* A fan is on when the stage has reached its column: white, the HP "run" look. */
.lens-col i {
  position: relative;
  display: block;
  border-radius: max(2px, 0.6cqw);
  background: var(--lz-stop);
}

.lens-col i::after {
  content: "";
  position: absolute;
  inset: 0;
  border: 1px solid var(--lz-edge);
  border-radius: inherit;
  background: white;
  opacity: clamp(0, calc(var(--lens-stage) - var(--n) + 1), 1);
}

.lens-col:nth-child(1) { --n: 1; }
.lens-col:nth-child(2) { --n: 2; }
.lens-col:nth-child(3) { --n: 3; }
.lens-col:nth-child(4) { --n: 4; }
.lens-col:nth-child(5) { --n: 5; }
.lens-col:nth-child(6) { --n: 6; }
.lens-col:nth-child(7) { --n: 7; }
.lens-col:nth-child(8) { --n: 8; }
.lens-col:nth-child(9) { --n: 9; }
.lens-col:nth-child(10) { --n: 10; }
.lens-col:nth-child(11) { --n: 11; }
.lens-col:nth-child(12) { --n: 12; }

/* ---------- the finger: parked off the tile, invisible in the still ---------- */
.lens-finger {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 7cqw;
  height: 7cqw;
  margin: -3.5cqw 0 0 -3.5cqw;
  border-radius: 50%;
  background: color-mix(in srgb, black 24%, transparent);
  border: 2px solid color-mix(in srgb, black 40%, transparent);
  opacity: 0;
  pointer-events: none;
}

.lens-finger::after {
  content: "";
  position: absolute;
  inset: -2px;
  border: 2px solid color-mix(in srgb, black 45%, transparent);
  border-radius: 50%;
  opacity: 0;
}

/* ---------- boot splash and the dark cover ---------- */
.lens-splash {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: grid;
  place-items: center;
  background: white;
  opacity: 0;
}

.lens-acme,
.lens-boot {
  grid-area: 1 / 1;
  display: grid;
  justify-items: center;
}

.lens-acme {
  grid-auto-flow: column;
  align-items: center;
  gap: 1.6cqw;
  font-size: max(15px, 5.2cqw);
  font-weight: 700;
  letter-spacing: -0.02em;
}

.lens-acme i {
  display: block;
  width: 0.9em;
  height: 0.9em;
  border: 0.22em solid var(--lz-stop);
  border-radius: 50%;
}

.lens-boot {
  gap: 3.4cqw;
  opacity: 0;
}

.lens-boot img {
  display: block;
  width: 15cqw;
  height: 15cqw;
}

.lens-beam {
  width: 34cqw;
  height: max(3px, 0.8cqw);
  border-radius: var(--r-full);
  background: var(--lz-line);
  overflow: hidden;
}

.lens-beam i {
  display: block;
  height: 100%;
  background: var(--beam);
}

.lens-cover {
  position: absolute;
  inset: 0;
  z-index: 3;
  background: color-mix(in srgb, black 94%, white);
  opacity: 0;
  pointer-events: none;
}

/* ---------- motion: only while on screen ---------- */
.lens-art.is-playing .lens-num {
  display: none;
}

.lens-art.is-playing .lens-n-stage::before {
  counter-reset: lens-n var(--lens-stage);
  content: counter(lens-n) " / 12";
}

.lens-art.is-playing .lens-n-fpm::before {
  counter-reset: lens-n var(--lens-fpm);
  content: counter(lens-n);
}

.lens-art.is-playing .lens-screen {
  animation: lens-run 10s ease-in-out infinite;
}

.lens-art.is-playing .lens-cover {
  animation: lens-cover 10s ease-in-out infinite;
}

.lens-art.is-playing .lens-splash {
  animation: lens-splash 10s ease-in-out infinite;
}

.lens-art.is-playing .lens-acme {
  animation: lens-acme 10s ease-in-out infinite;
}

.lens-art.is-playing .lens-boot {
  animation: lens-boot 10s ease-in-out infinite;
}

.lens-art.is-playing .lens-beam i {
  animation: lens-fill 10s ease-in-out infinite;
}

.lens-art.is-playing .lens-tile-tap {
  animation: lens-tile 10s ease-in-out infinite;
}

.lens-art.is-playing .lens-finger {
  animation: lens-finger 10s ease-in-out infinite;
}

.lens-art.is-playing .lens-finger::after {
  animation: lens-ring 10s ease-out infinite;
}

/* 0-0.5 s dark, the cover lifts on the splash, Acme, then the Raylux mark with
   the beam filling, then the splash gives way to the HMI. The fans stage on,
   a finger taps a tile, hold, the screen dims. Everything is reset while the
   cover is fully dark (95-100 %), so the seam is not visible. */
@keyframes lens-cover {
  0%, 5% { opacity: 1; }
  9%, 90% { opacity: 0; }
  95%, 100% { opacity: 1; }
}

@keyframes lens-splash {
  0%, 53% { opacity: 1; }
  58%, 95% { opacity: 0; }
  95.5%, 100% { opacity: 1; }
}

@keyframes lens-acme {
  0%, 24% { opacity: 1; }
  30%, 94% { opacity: 0; }
  100% { opacity: 1; }
}

@keyframes lens-boot {
  0%, 26% { opacity: 0; }
  32%, 53% { opacity: 1; }
  58%, 100% { opacity: 0; }
}

@keyframes lens-fill {
  0%, 33% { clip-path: inset(0 100% 0 0); }
  50%, 94% { clip-path: inset(0 0 0 0); }
  95%, 100% { clip-path: inset(0 100% 0 0); }
}

@keyframes lens-run {
  0%, 58% { --lens-stage: 0; --lens-fpm: 0; }
  72%, 95% { --lens-stage: 7; --lens-fpm: 412; }
  95.5%, 100% { --lens-stage: 0; --lens-fpm: 0; }
}

@keyframes lens-tile {
  0%, 80.5% {
    background-color: var(--lz-cont);
    box-shadow: inset 0 0 0 0 transparent;
  }
  82%, 94% {
    background-color: color-mix(in srgb, var(--lz-cont) 86%, black);
    box-shadow: inset 0 0 0 max(2px, 0.5cqw) var(--accent-fill);
  }
  95.5%, 100% {
    background-color: var(--lz-cont);
    box-shadow: inset 0 0 0 0 transparent;
  }
}

@keyframes lens-finger {
  0%, 76% { opacity: 0; transform: translate(12cqw, 11cqw) scale(1); }
  79.5%, 80.5% { opacity: 1; transform: translate(0, 0) scale(1); }
  81.5%, 83% { opacity: 1; transform: translate(0, 0) scale(0.82); }
  84.5% { opacity: 1; transform: translate(0, 0) scale(1); }
  88%, 100% { opacity: 0; transform: translate(5cqw, 9cqw) scale(1); }
}

@keyframes lens-ring {
  0%, 81.4% { opacity: 0; transform: scale(1); }
  81.5% { opacity: 0.6; transform: scale(1); }
  86%, 100% { opacity: 0; transform: scale(2.3); }
}

/* Reduced motion: the base styles above are the finished HMI frame. */
@media (prefers-reduced-motion: reduce) {
  .lens-art,
  .lens-art *,
  .lens-art *::before,
  .lens-art *::after {
    animation: none !important;
  }

  .lens-art .lens-num {
    display: inline !important;
  }

  .lens-art .lens-n-stage::before,
  .lens-art .lens-n-fpm::before {
    content: none !important;
  }
}

/* ---------- phone ---------- */
@media (max-width: 560px) {
  .lens-art {
    padding: 6px;
  }

  .lens-bezel {
    padding: 10px;
  }
}
