:root {
  --ink: #0d0f1f;                 /* the dark navy of the printed card */
  --navy: #1d1d55;
  --violet: #8b2d72;
  --text: rgba(225, 228, 255, .86);
  --muted: rgba(190, 196, 240, .6);
  --display: "Oswald", "Bebas Neue", "Arial Narrow", sans-serif;
}

html, body {
  margin: 0;
  background: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Helvetica Neue", Arial, sans-serif;
  color: #fff;
}
body { overflow-x: hidden; }

/* The card itself. page.js shrinks it a little and rounds its corners as you scroll down. */
#viewport {
  position: relative;
  width: 100%;
  height: 100vh;
  height: 100svh;
  overflow: hidden;
  cursor: crosshair;
  touch-action: pan-y;            /* a finger can still scroll the page past the card */
  -webkit-touch-callout: none;    /* no "save image" menu on a long press */
  -webkit-user-select: none;
  user-select: none;
  transform-origin: 50% 0;
  will-change: transform;
  background: #05070d;
}

/* The stage is the 2560×1280 After Effects comp. JS scales it to cover the window. */
#stage {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 2560px;
  height: 1280px;
  transform-origin: 0 0;
  will-change: transform;
}

.layer {
  position: absolute;
  left: 0;
  top: 0;
  transform-origin: 0 0;          /* main.js scales each layer around the zoom centre itself */
  will-change: transform;
  pointer-events: none;
  user-select: none;
  -webkit-user-drag: none;
}

/* Rain, flares and the firing sequences are rendered on black – screen makes black transparent. */
.screen { mix-blend-mode: screen; }

/* "Add" layers in the AE comp (muzzle light, muzzle flash, shells). Screen looks almost the same for
   bright-on-black material and renders reliably everywhere (plus-lighter dropped the flash in tests). */
.add { mix-blend-mode: screen; }

/* Film grain from the AE comp, static on top of everything */
#grain {
  position: absolute;
  inset: 0;
  background: url(assets/layers/grain.png) repeat;
  mix-blend-mode: soft-light;
  pointer-events: none;
}

#loader {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background: #05070d;
  font-size: 12px;
  letter-spacing: .3em;
  text-transform: uppercase;
  transition: opacity .8s ease, background-color 1.4s ease;
  z-index: 10;
}
/* ready: the card shows through, dimmed, already raining and following the mouse */
#loader.ready {
  background-color: rgba(5, 7, 13, .42);
  cursor: pointer;
}
#loader.ready::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(closest-side, rgba(5, 7, 13, .55), rgba(5, 7, 13, 0));   /* a soft dark patch behind the button */
  pointer-events: none;
}
.loader-inner { position: relative; }
#loader.done { opacity: 0; pointer-events: none; }
html.gate, html.gate body { overflow: hidden; }   /* no scrolling behind the enter screen */
html.gate #sound { opacity: 0; pointer-events: none; }   /* the sound toggle appears with the card */
.loader-inner { display: flex; flex-direction: column; align-items: center; gap: 34px; }
.loader-inner .s-icon { margin: 0; width: 40px; height: 40px; opacity: .9; }
#enter {
  min-width: 220px;
  padding: 15px 30px 14px 34px;       /* a little more on the left: balances the letter spacing */
  border: 1px solid rgba(255, 255, 255, 0);
  border-radius: 999px;
  background: none;
  color: rgba(225, 228, 255, .7);
  font: 300 14px/1 var(--display);
  letter-spacing: .4em;
  text-transform: uppercase;
  cursor: default;
  transition: border-color .6s, color .3s, background .3s;
}
#loader.ready #enter {
  background: rgba(5, 7, 13, .35);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  text-shadow: 0 1px 8px rgba(0, 0, 0, .8);
  border-color: rgba(255, 255, 255, .45);
  color: #fff;
  cursor: pointer;
  animation: enter-breathe 2.4s ease-in-out infinite;
}
#loader.ready #enter:hover, #loader.ready #enter:focus-visible { background: rgba(255, 255, 255, .08); border-color: rgba(255, 255, 255, .7); outline: none; }
@keyframes enter-breathe { 50% { box-shadow: 0 0 0 6px rgba(160, 150, 255, .08), 0 0 24px rgba(160, 150, 255, .18); } }
@media (prefers-reduced-motion: reduce) { #loader.ready #enter { animation: none; } }

/* "Lift subject" on hover: dim the scene, lift the figure with a soft shadow, light around its edge */
.lift-dim { background: #02040a; opacity: 0; }
.lift-cut {
  filter: brightness(1) drop-shadow(0 0 0 rgba(0, 0, 0, 0)) drop-shadow(0 0 0 rgba(255, 255, 255, 0));
  transition: filter .28s ease;   /* back to plain before the cut-out is removed */
}
.lift-cut.in { filter: brightness(1.08) drop-shadow(0 16px 26px rgba(0, 0, 0, .6)) drop-shadow(0 0 2px rgba(255, 255, 255, .25)); }
.lift-glow { mix-blend-mode: screen; filter: blur(1px) brightness(1.4); }

/* Name and title above the lifted person (sizes are comp pixels – the stage scales them with the window) */
.lift-label {
  position: absolute;
  left: 0;
  top: 0;
  opacity: 0;
  pointer-events: none;
  text-align: center;
  white-space: nowrap;
  will-change: transform, opacity;
}
.lift-label .inner { transform: translate(-50%, -100%); display: flex; flex-direction: column; align-items: center; }
.lift-label .name {
  font-size: 36px;
  font-weight: 600;
  letter-spacing: .01em;
  color: #fff;
  text-shadow: 0 2px 14px rgba(0, 0, 0, .85), 0 0 2px rgba(0, 0, 0, .6);
}
.lift-label .title {
  margin-top: 4px;
  font-size: 17px;
  font-weight: 500;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: rgba(205, 222, 255, .85);
  text-shadow: 0 1px 10px rgba(0, 0, 0, .9);
}
.lift-label .tick {
  width: 1px;
  height: 34px;
  margin-top: 12px;
  background: linear-gradient(rgba(255, 255, 255, .7), rgba(255, 255, 255, 0));
}

/* Small sound toggle (sound only starts after the first click – browsers require it) */
#sound {
  position: fixed;
  right: 20px;
  bottom: 18px;
  z-index: 15;
  padding: 6px 12px;
  border: 1px solid rgba(255, 255, 255, .35);
  border-radius: 999px;
  background: rgba(0, 0, 0, .35);
  color: rgba(255, 255, 255, .85);
  font: 11px/1 -apple-system, BlinkMacSystemFont, "Helvetica Neue", Arial, sans-serif;
  letter-spacing: .12em;
  text-transform: uppercase;
  cursor: pointer;
  backdrop-filter: blur(4px);
}
#sound:hover { background: rgba(0, 0, 0, .55); color: #fff; }

/* Edit mode for the layers whose position was lost in the export */
#editor {
  position: fixed;
  left: 16px;
  bottom: 16px;
  z-index: 20;
  max-width: calc(100vw - 64px);
  padding: 12px 14px;
  background: rgba(0, 0, 0, .8);
  border: 1px solid rgba(255, 255, 255, .25);
  border-radius: 8px;
  font-size: 12px;
  line-height: 1.6;
}
#editor button { margin: 6px 6px 0 0; font: inherit; }
body.editing .layer.editable { pointer-events: auto; cursor: move; outline: 1px dashed rgba(0, 255, 200, .5); }
body.editing .layer.editable.selected { outline: 2px solid #0fc; }

/* rounded corners while scrolling: a ring in the page colour drawn over the card's corners */
#viewport::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 6;
  border-radius: var(--r, 0px);
  box-shadow: 0 0 0 80px var(--ink);
  pointer-events: none;
}

/* ---------- below the card ---------- */

.after {
  position: relative;
  background:
    radial-gradient(120% 70% at 100% 0%, rgba(139, 45, 114, .55), transparent 60%),
    linear-gradient(110deg, #12142a 0%, #1b1c4f 48%, #201f5c 72%, #3a2266 100%);
  padding: clamp(72px, 12vh, 140px) 20px 60px;
  text-align: center;
}

.s-icon {
  display: block;
  width: 44px;
  height: 44px;
  margin: 0 auto 40px;
}

.title {
  margin: 0;
  font-family: var(--display);
  font-weight: 200;
  font-size: clamp(30px, 5.4vw, 72px);
  line-height: 1.1;
  letter-spacing: .5em;
  padding-left: .5em;             /* balances the tracking after the last letter, so it sits centred */
  text-transform: uppercase;
  color: var(--text);
}

/* 2018 ⇄ 2049: page.js switches the number and slices it with two colour-shifted copies */
.glitch { position: relative; display: inline-block; }
.glitch::before,
.glitch::after {
  content: attr(data-text);
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  opacity: 0;
  pointer-events: none;
}
.glitch.on::before {
  opacity: .9;
  color: #ff3fd2;
  transform: translate(var(--dx1, -4px), 0);
  clip-path: inset(var(--c1, 10%) 0 var(--c2, 60%) 0);
  mix-blend-mode: screen;
}
.glitch.on::after {
  opacity: .9;
  color: #3ff0ff;
  transform: translate(var(--dx2, 4px), 0);
  clip-path: inset(var(--c3, 55%) 0 var(--c4, 15%) 0);
  mix-blend-mode: screen;
}
.glitch.on { transform: skewX(var(--skew, 0deg)); text-shadow: 0 0 18px rgba(160, 120, 255, .45); }

.lede {
  max-width: 34em;
  margin: 44px auto 0;
  font-size: clamp(16px, 1.35vw, 19px);
  line-height: 1.7;
  color: var(--muted);
}
.lede strong { color: var(--text); font-weight: 500; }

.cards {
  max-width: 1180px;
  margin: clamp(90px, 14vh, 160px) auto 0;
  text-align: left;
}
.cards h2 {
  margin: 0 0 28px;
  font-family: var(--display);
  font-weight: 300;
  font-size: 15px;
  letter-spacing: .4em;
  text-transform: uppercase;
  color: var(--muted);
  text-align: center;
}
.grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 36px 28px;
}
.card { display: block; color: inherit; text-decoration: none; }
.card .img {
  aspect-ratio: 16 / 10;
  overflow: hidden;
  border-radius: 14px;
  background: rgba(255, 255, 255, .04);
}
.card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform .8s cubic-bezier(.2, .7, .2, 1), filter .5s;
  filter: saturate(.85) brightness(.9);
}
.card:hover img, .card:focus-visible img { transform: scale(1.04); filter: none; }
.card .cap {
  margin-top: 14px;
  font-family: var(--display);
  font-weight: 300;
  font-size: 14px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--muted);
  transition: color .3s;
}
.card:hover .cap, .card:focus-visible .cap { color: #fff; }
.card:focus-visible { outline: 2px solid #9fa8ff; outline-offset: 6px; border-radius: 16px; }

.foot {
  margin-top: 110px;
  font-family: var(--display);
  font-weight: 300;
  font-size: 12px;
  letter-spacing: .4em;
  text-transform: uppercase;
  color: rgba(190, 196, 240, .35);
}
.foot a { color: inherit; text-decoration: none; }
.foot a:hover { color: var(--text); }

@media (max-width: 700px) {
  .grid { grid-template-columns: 1fr; gap: 30px; }
  .title { letter-spacing: .32em; padding-left: .32em; }
}

/* the sound toggle fades out once the card has scrolled away */
#sound { transition: opacity .3s, background .2s, color .2s; }
#sound.away { opacity: 0; pointer-events: none; }

/* "Click to fire": a glint on the rifle's muzzle and a small tag above it (until the first shot) */
.hint-glint { transform-origin: 0 0; }
.fire-hint .title { margin-top: 0; font-size: 19px; color: #fff; letter-spacing: .28em; }
.fire-hint .tick { height: 28px; margin-top: 10px; }

/* the scene is drawn into one canvas; the layer elements (and their blurred copies) are only its sources.
   Edit mode (E) switches back to the real layers. */
#scene { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
body.onecanvas #stage > [data-id],
body.onecanvas #stage > [data-dof-of] { display: none; }
body:not(.onecanvas) #scene { display: none; }
