/* ============================================================
   THE ARCHIVE — projector device, light beam, dust
   A 3/4 front view rendered entirely in CSS. The lens points
   up toward the screen; the beam connects the two.
   ============================================================ */

.projector-wrap {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  filter: drop-shadow(0 30px 40px rgba(0,0,0,0.7));
  transform-origin: bottom center;
}

/* ---------- the lens barrel (points up toward screen) ---------- */
.lens {
  position: relative;
  width: 132px;
  height: 92px;
  margin-bottom: -10px;
  z-index: 4;
  display: flex;
  justify-content: center;
}
.lens-barrel {
  position: relative;
  width: 132px;
  height: 92px;
  border-radius: 16px 16px 10px 10px;
  background:
    linear-gradient(90deg, #0c0a08 0%, #2b2622 12%, #4a4441 30%, #1f1b18 50%, #4a4441 70%, #2b2622 88%, #0c0a08 100%);
  box-shadow:
    inset 0 2px 3px rgba(255,255,255,0.12),
    inset 0 -6px 10px rgba(0,0,0,0.6),
    0 6px 14px rgba(0,0,0,0.5);
  overflow: hidden;
}
/* focus rings */
.lens-barrel::before {
  content: "";
  position: absolute; inset: 0;
  background: repeating-linear-gradient(180deg,
    rgba(255,255,255,0.05) 0px, rgba(255,255,255,0.05) 1px,
    rgba(0,0,0,0.22) 2px, rgba(0,0,0,0.22) 6px);
  opacity: 0.5;
}
/* glass element at the top of the barrel */
.lens-glass {
  position: absolute;
  top: 6px; left: 50%;
  transform: translateX(-50%);
  width: 96px; height: 34px;
  border-radius: 50%;
  background:
    radial-gradient(60% 120% at 50% 30%, #fff5e0 0%, #f0a94b 22%, #8a5a22 55%, #2a1809 100%);
  box-shadow:
    inset 0 0 12px rgba(0,0,0,0.6),
    inset 0 3px 6px rgba(255,255,255,0.4);
  opacity: 0.35;
  transition: opacity 0.5s var(--ease-soft), box-shadow 0.5s, filter 0.5s;
}
.stage[data-lamp="on"] .lens-glass {
  opacity: 1;
  filter: brightness(1.15);
  box-shadow:
    0 0 30px 6px rgba(255,180,90,0.65),
    inset 0 0 14px rgba(255,240,210,0.55);
}
.stage[data-proj="on"] .lens-glass {
  box-shadow:
    0 0 46px 12px rgba(255,190,100,0.85),
    inset 0 0 16px rgba(255,245,220,0.7);
}

/* ---------- the body ---------- */
.proj-body {
  position: relative;
  width: 320px;
  height: 168px;
  border-radius: 16px 16px 20px 20px;
  z-index: 3;
  background:
    linear-gradient(180deg, #6b4a2d 0%, #4e3420 14%, #3a2616 55%, #2a1a10 100%);
  box-shadow:
    inset 0 2px 2px rgba(255,210,150,0.25),
    inset 0 -16px 26px rgba(0,0,0,0.55),
    inset 14px 0 30px rgba(0,0,0,0.35),
    inset -14px 0 30px rgba(0,0,0,0.35),
    0 18px 30px rgba(0,0,0,0.55);
}
/* brushed metal top deck where the carousel sits */
.proj-deck {
  position: absolute;
  top: -2px; left: 50%;
  transform: translateX(-50%);
  width: 300px; height: 40px;
  border-radius: 14px 14px 6px 6px;
  background:
    linear-gradient(90deg, #1c1814 0%, #423b34 18%, #6a625a 50%, #423b34 82%, #1c1814 100%);
  box-shadow: inset 0 2px 2px rgba(255,255,255,0.18), inset 0 -6px 10px rgba(0,0,0,0.5);
}
.proj-deck::after {
  content: "";
  position: absolute; inset: 0;
  background: repeating-linear-gradient(90deg,
    rgba(255,255,255,0.05) 0 1px, transparent 1px 3px);
  opacity: 0.5;
}

/* the rotary carousel tray ring */
.carousel {
  position: absolute;
  top: -30px; left: 50%;
  transform: translateX(-50%);
  width: 150px; height: 56px;
  border-radius: 50%;
  background:
    radial-gradient(60% 80% at 50% 35%, #2a221b, #16110c 70%);
  box-shadow:
    inset 0 3px 6px rgba(0,0,0,0.7),
    inset 0 -2px 3px rgba(255,200,140,0.12),
    0 3px 6px rgba(0,0,0,0.4);
  border: 2px solid rgba(120,90,46,0.4);
  z-index: 5;
}
.carousel::before {
  content: "";
  position: absolute; inset: 8px;
  border-radius: 50%;
  background: repeating-conic-gradient(from 0deg,
    rgba(255,200,140,0.10) 0deg 4deg, transparent 4deg 12deg);
  opacity: 0.6;
  transform: rotate(var(--carousel, 0deg));   /* advances a notch per memory */
  transition: transform 0.9s var(--ease-mech);
}
.carousel::after {
  content: "";
  position: absolute; top: 50%; left: 50%;
  width: 14px; height: 14px; border-radius: 50%;
  transform: translate(-50%,-50%);
  background: radial-gradient(#5a3d28, #1a120b);
  box-shadow: inset 0 1px 2px rgba(255,220,170,0.3);
}

/* slide insertion slot on the front-top of the body */
.proj-slot {
  position: absolute;
  top: 16px; left: 50%;
  transform: translateX(-50%);
  width: 132px; height: 14px;
  border-radius: 3px;
  background: linear-gradient(180deg, #000 0%, #150f0a 60%, #2a1d12 100%);
  box-shadow:
    inset 0 3px 5px rgba(0,0,0,0.9),
    0 1px 0 rgba(255,200,140,0.12);
  z-index: 6;
}
.proj-slot::after {
  content: "";
  position: absolute; left: 6px; right: 6px; top: 2px; height: 1px;
  background: rgba(255,200,140,0.10);
}

/* ventilation grille */
.vents {
  position: absolute;
  bottom: 26px; left: 50%;
  transform: translateX(-50%);
  width: 220px; height: 64px;
  display: grid;
  grid-template-columns: repeat(16, 1fr);
  gap: 4px;
  opacity: 0.9;
}
.vents span {
  border-radius: 2px;
  background: linear-gradient(180deg, #0c0907, #221911);
  box-shadow: inset 1px 0 1px rgba(255,200,140,0.10), inset -1px 0 2px rgba(0,0,0,0.7);
}

/* brand plate */
.proj-plate {
  position: absolute;
  bottom: 8px; left: 50%;
  transform: translateX(-50%);
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.4em;
  white-space: nowrap;
  color: rgba(216,192,138,0.7);
  text-transform: uppercase;
}

/* power lamp dot */
.proj-power {
  position: absolute;
  top: 22px; right: 26px;
  width: 8px; height: 8px; border-radius: 50%;
  background: #4a1c0c;
  box-shadow: inset 0 0 2px rgba(0,0,0,0.8);
  transition: all 0.4s;
}
.stage[data-lamp="on"] .proj-power {
  background: #ff7a3a;
  box-shadow: 0 0 8px 2px rgba(255,120,60,0.8);
}

/* feet + contact shadow */
.proj-foot {
  position: absolute; bottom: -6px;
  width: 36px; height: 12px; border-radius: 0 0 6px 6px;
  background: linear-gradient(180deg, #1a120b, #000);
}
.proj-foot.l { left: 30px; }
.proj-foot.r { right: 30px; }

/* ---------- the light beam ---------- */
.beam-layer {
  position: absolute;
  inset: 0;
  z-index: 12;
  pointer-events: none;
  mix-blend-mode: screen;
  overflow: hidden;
  transition: opacity 0.7s var(--ease-soft);
}
.dust-host { position: absolute; z-index: 13; pointer-events: none; transition: opacity 0.7s var(--ease-soft); }
.beam {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  transform-origin: bottom center;
  background:
    linear-gradient(180deg,
      rgba(255,210,150,0.0) 0%,
      rgba(255,200,140,0.16) 40%,
      rgba(255,190,120,0.28) 78%,
      rgba(255,200,140,0.42) 100%);
  clip-path: polygon(42% 100%, 58% 100%, 100% 0%, 0% 0%);
  filter: blur(2px);
  opacity: 0;
  transition: opacity 0.8s var(--ease-soft);
}
.stage[data-lamp="on"] .beam { opacity: 0.5; }
.stage[data-proj="on"] .beam { opacity: 0.85; }

/* a brighter inner core of the beam */
.beam-core {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  transform-origin: bottom center;
  background: linear-gradient(180deg, rgba(255,235,200,0.0), rgba(255,225,180,0.5) 100%);
  clip-path: polygon(46% 100%, 54% 100%, 74% 0%, 26% 0%);
  filter: blur(6px);
  opacity: 0;
  transition: opacity 0.8s var(--ease-soft);
}
.stage[data-proj="on"] .beam-core { opacity: 0.6; }

/* flicker driven by JS adds a class briefly */
.beam.flick { animation: beamFlick 0.5s steps(2) 1; }
@keyframes beamFlick {
  0%,100% { opacity: 0.85; }
  20% { opacity: 0.35; }
  45% { opacity: 0.95; }
  70% { opacity: 0.5; }
}

/* dust motes float inside the beam */
.dust { position: absolute; inset: 0; pointer-events: none; z-index: 13; mix-blend-mode: screen; opacity: 0; transition: opacity 1.4s; }
.stage[data-lamp="on"] .dust { opacity: 1; }
.mote {
  position: absolute;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255,230,190,0.9), rgba(255,210,150,0.0) 70%);
}
@keyframes moteFloat {
  0%   { transform: translate(0, 0) scale(0.6); }
  25%  { transform: translate(calc(var(--drift) * 0.4), -22%) scale(1); }
  50%  { transform: translate(var(--drift), -48%) scale(0.8); }
  75%  { transform: translate(calc(var(--drift) * 0.3), -72%) scale(1.05); }
  100% { transform: translate(0, -100%) scale(0.5); }
}
