/* Identity section: four pictures, one per benefit (identity-scenes.js).
   They sit exactly where the single original picture was, under the section's own fade masks.
   Each picture has its own entrance (slide, circle, rise, diagonal) and a slow drift. */

html:root body #identity .identity-scene.nl-id-ready > img { visibility: hidden; }

html:root body #identity .nl-id-stack {
  position: absolute;
  left: 0;
  top: 0;
  width: var(--w, 88%);
  height: 100%;
  overflow: hidden;
  z-index: 0;            /* own stacking context: stays under the section's darkening gradient */
}
html:root body #identity .nl-id-layer {
  position: absolute;
  inset: 0;
  opacity: 0;
  z-index: 0;
}
html:root body #identity .nl-id-layer img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 40%;
  display: block;
  filter: brightness(.78) saturate(1.05) contrast(1.04);
}
html:root body #identity .nl-id-layer.is-prev { opacity: 1; z-index: 1; }
html:root body #identity .nl-id-layer.is-active { opacity: 1; z-index: 2; }

/* entrances, one per picture */
html:root body #identity .nl-id-layer.is-active[data-fx="0"] { animation: nl-id-slide 1.2s cubic-bezier(.7, 0, .2, 1) both; }
html:root body #identity .nl-id-layer.is-active[data-fx="1"] { animation: nl-id-circle 1.4s cubic-bezier(.6, 0, .2, 1) both; }
html:root body #identity .nl-id-layer.is-active[data-fx="2"] { animation: nl-id-rise 1.2s cubic-bezier(.7, 0, .2, 1) both; }
html:root body #identity .nl-id-layer.is-active[data-fx="3"] { animation: nl-id-diag 1.3s cubic-bezier(.7, 0, .2, 1) both; }
@keyframes nl-id-slide  { from { clip-path: inset(0 100% 0 0); } to { clip-path: inset(0 0 0 0); } }
@keyframes nl-id-circle { from { clip-path: circle(0% at 62% 45%); } to { clip-path: circle(140% at 62% 45%); } }
@keyframes nl-id-rise   { from { clip-path: inset(100% 0 0 0); } to { clip-path: inset(0 0 0 0); } }
@keyframes nl-id-diag   { from { clip-path: polygon(0 0, 0 0, -40% 100%, -40% 100%); } to { clip-path: polygon(0 0, 140% 0, 100% 100%, -40% 100%); } }

/* the incoming picture also settles from a slight zoom, then drifts (direction differs per picture) */
html:root body #identity .nl-id-layer.is-active img {
  animation:
    nl-id-settle 1.4s cubic-bezier(.2, .7, .2, 1) both,
    nl-id-drift 14s ease-in-out 1.4s infinite alternate;
}
html:root body #identity .nl-id-layer[data-fx="0"] img { --dx: -2%; --dy: -1%; }
html:root body #identity .nl-id-layer[data-fx="1"] img { --dx: 2%;  --dy: -2%; }
html:root body #identity .nl-id-layer[data-fx="2"] img { --dx: -1%; --dy: 2%; }
html:root body #identity .nl-id-layer[data-fx="3"] img { --dx: 2%;  --dy: 1%; }
@keyframes nl-id-settle { from { transform: scale(1.14); } to { transform: scale(1.06); } }
@keyframes nl-id-drift  { from { transform: scale(1.06) translate(0, 0); } to { transform: scale(1.12) translate(var(--dx), var(--dy)); } }

/* caption chip with a timer bar, bottom left of the picture */
html:root body #identity .nl-id-caption {
  position: absolute;
  left: max(24px, 5%);
  bottom: 18%;
  z-index: 3;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px 12px;
  border-radius: 999px;
  background: rgba(6, 9, 16, .62);
  border: 1px solid rgba(255, 255, 255, .14);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  overflow: hidden;
}
html:root body #identity .nl-id-num { font: 600 11px/1 var(--mono, ui-monospace, monospace); letter-spacing: .18em; color: #c48af3; }
html:root body #identity .nl-id-label { font: 600 12px/1 var(--display, inherit); letter-spacing: .12em; text-transform: uppercase; color: #eef2f8; }
html:root body #identity .nl-id-bar {
  position: absolute;
  left: 0;
  bottom: 0;
  height: 2px;
  width: 100%;
  background: linear-gradient(90deg, #70d9ec, #c48af3);
  transform-origin: left;
  animation: nl-id-timer 5.5s linear both;
}
html:root body #identity .nl-id-stack.is-paused .nl-id-bar { animation-play-state: paused; }
@keyframes nl-id-timer { from { transform: scaleX(0); } to { transform: scaleX(1); } }

/* the benefit whose picture is showing */
html:root body #identity .nl-id-current .identity-benefit-action strong,
html:root body #identity .identity-benefit-action.nl-id-current strong,
html:root body #identity .nl-id-current strong { color: #e4b8ff; }

@media (max-width: 760px) {
  html:root body #identity .nl-id-caption { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  html:root body #identity .nl-id-layer.is-active,
  html:root body #identity .nl-id-layer.is-active img { animation: none; }
  html:root body #identity .nl-id-layer.is-active { transition: opacity .4s ease; }
  html:root body #identity .nl-id-bar { display: none; }
}

/* extra fade towards the text column, so the copy always reads on any picture */
html:root body #identity .nl-id-stack::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 4;
  pointer-events: none;
  background: linear-gradient(90deg, transparent 30%, rgba(5, 7, 12, .35) 42%, rgba(5, 7, 12, .85) 55%, #05070c 68%);
}
@media (max-width: 760px) {
  html:root body #identity .nl-id-stack::after { background: linear-gradient(180deg, transparent 40%, rgba(5, 7, 12, .9) 85%); }
}
