/* art.css: the generative art slots.
   A slot is an empty element the layout places and sizes:
     <div class="art" data-art="NAME" aria-hidden="true"></div>
   art/core.js and one file per piece (art/NAME.js) fill it. Nothing here sets the strip colour: that is the layout's.
   If the art scripts never run, a slot stays empty and the strip is a plain colour field.
   Per piece: --sm-grain (strength of the grain, 0..1) and --sm-vignette (a gradient). A piece
   file may override either on its own host: inst.host.style.setProperty("--sm-grain", ".2"). */

/* Default box. Zero specificity, so any layout rule for .art wins. */
:where(.art) {
  position: absolute;
  inset: 0;
}

.art {
  overflow: hidden;
  pointer-events: none;
  contain: layout paint style;
}

/* The mounted piece. Fades in over the colour field once its first frame is drawn. */
.art > .sm-art {
  position: absolute;
  inset: 0;
  overflow: hidden;
  opacity: 0;
  transition: opacity 1.1s cubic-bezier(.3, 0, .2, 1);
}
.art > .sm-art.is-ready { opacity: 1; }

.sm-art > canvas {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  display: block;
}

.sm-art > svg {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  display: block;
}

/* The one place the art takes a click: the slit of the gate. Everything else lets the pointer through. */
.sm-art > .sm-hit {
  position: absolute;
  z-index: 10;
  pointer-events: auto;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

/* Film grain that belongs to the "photograph" (the tile is made once by art/core.js). */
.sm-art::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 8;
  background-image: var(--sm-art-grain, none);
  background-size: 180px 180px;
  opacity: var(--sm-grain, .5);
  pointer-events: none;
}

/* Soft vignette inside the photograph strips. */
.sm-art::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 9;
  pointer-events: none;
  background: var(--sm-vignette, none);
}

.art[data-art="murmuration"] {
  --sm-grain: .3;
  --sm-vignette: radial-gradient(130% 105% at 50% 42%, rgba(60, 84, 105, 0) 52%, rgba(60, 84, 105, .26) 100%);
}
.art[data-art="dial"] {
  --sm-grain: .3;
  --sm-vignette: radial-gradient(125% 100% at 46% 46%, rgba(40, 14, 6, 0) 50%, rgba(40, 14, 6, .34) 100%);
}
.art[data-art="stroke"] {
  --sm-grain: .22;
  --sm-vignette: radial-gradient(130% 110% at 50% 50%, rgba(92, 78, 60, 0) 58%, rgba(92, 78, 60, .13) 100%);
}
.art[data-art="gate"] {
  --sm-grain: .16;
  --sm-vignette: radial-gradient(120% 100% at 55% 52%, rgba(0, 0, 0, 0) 45%, rgba(0, 0, 0, .42) 100%);
}
.art[data-art="ring"] {
  --sm-grain: .16;
  --sm-vignette: radial-gradient(130% 110% at 50% 48%, rgba(120, 60, 50, 0) 60%, rgba(120, 60, 50, .12) 100%);
}
.art[data-art="calendar"] {
  --sm-grain: .28;
  --sm-vignette: radial-gradient(125% 105% at 50% 48%, rgba(30, 36, 22, 0) 50%, rgba(30, 36, 22, .30) 100%);
}
.art[data-art="meter"] {
  --sm-grain: .2;
  --sm-vignette: radial-gradient(120% 100% at 50% 52%, rgba(0, 0, 0, 0) 50%, rgba(0, 0, 0, .40) 100%);
}
.art[data-art="horizon"] {
  --sm-grain: .16;
  --sm-vignette: radial-gradient(130% 110% at 50% 60%, rgba(0, 0, 0, 0) 55%, rgba(0, 0, 0, .38) 100%);
}

/* The paper dinosaur is a cut-out, not a photograph: no grain of its own, no vignette. */
.art[data-art="paperdino"] > .sm-art::before,
.art[data-art="paperdino"] > .sm-art::after { content: none; }

@media (prefers-reduced-motion: reduce) {
  .art > .sm-art { transition: none; }
}

@media print {
  .art > .sm-art { display: none; }
}
