:root {
    --on-opacity: 0.6;
    --fade-ms: 200ms;
    --slide-ms: 420ms;
  }

body {
    margin: 0;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    position: relative;
    background: #000;
  }

body::before {
    content: "";
    position: absolute;
    inset: 0;
    background-image: url("jpg/webpage/background.png");
    background-size: cover;
    background-position: center;
    filter: blur(15px);
    transform: scale(1.1);
    z-index: -2;
  }

.foreground {
    position: absolute;
    inset: 0;
    background-image: url("jpg/webpage/background.png");
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    z-index: -1;
  }

.beam {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    opacity: 0;
    background: radial-gradient(ellipse at 50% 25%,
                rgba(255,255,255,0.35) 0%,
                rgba(255,255,255,0.15) 30%,
                rgba(255,255,255,0.06) 55%,
                rgba(255,255,255,0.0) 70%);
    mix-blend-mode: screen;
  }
.beam.on { animation: beamOn 1.2s ease forwards; }
.beam.off { animation: beamOff 0.4s ease forwards; }

@keyframes beamOn {
    0% { opacity: 0; }
    30% { opacity: 0.6; }
    60% { opacity: 0.3; }
    100% { opacity: 0.35; }
  }
@keyframes beamOff {
    0% { opacity: 0.35; }
    30% { opacity: 0.5; }
    60% { opacity: 0.15; }
    100% { opacity: 0; }
  }

.overlay-wrapper {
    position: absolute;
    top: 5vh;
    left: 32.75vw;
    width: 35.5vw;
    height: clamp(40vh, 58vh, 65vh);
    z-index: 1;
    overflow: hidden;
  }

.overlay {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    opacity: 0;
    visibility: hidden;
    transform: scale(1.05);
    transition: opacity 0.3s ease;
    cursor: zoom-in;
  }
.overlay.on {
    animation: projectorOn 1.2s ease forwards;
  }
.overlay.off {
    animation: projectorOff 0.4s ease forwards;
  }
.overlay:hover {
    opacity: 1 !important;
  }

@keyframes projectorOn {
    0% { opacity: 0; filter: brightness(0.5) blur(6px); transform: scale(1.05); }
    30% { opacity: 0.9; filter: brightness(1.3) blur(4px); }
    60% { opacity: 0.5; filter: brightness(0.9) blur(2px); }
    100% { opacity: var(--on-opacity); filter: brightness(1) blur(0); transform: scale(1); visibility: visible; }
  }
@keyframes projectorOff {
    0% { opacity: var(--on-opacity); filter: brightness(1) blur(0); transform: scale(1); }
    30% { opacity: 0.6; filter: brightness(1.2) blur(2px); }
    60% { opacity: 0.3; filter: brightness(0.8) blur(4px); }
    100% { opacity: 0; filter: brightness(0.5) blur(6px); transform: scale(1.05); visibility: hidden; }
  }

.controls {
    position: absolute;
    bottom: 60px; /* moved up from 20px */
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 18px;
    z-index: 3;
  }

.toggle-btn, .nav-btn {
    display: flex;
    justify-content: center;
    align-items: center;
    border-radius: 50%;
    cursor: pointer;
  }

.toggle-btn {
    width: 64px;
    height: 64px;
    border: none;
    background-color: #1b1b1b;
    color: #ffb300;
    font-size: 28px;
    box-shadow: 0 0 10px rgba(255,179,0,0.5), inset 0 0 6px rgba(255,179,0,0.25);
    transition: background-color 0.25s ease, color 0.25s ease, box-shadow 0.25s ease;
  }
.toggle-btn:hover { background-color: #252525; }
.toggle-btn.on {
    color: #00ff66;
    box-shadow: 0 0 18px rgba(0,255,102,0.8), inset 0 0 6px rgba(0,255,102,0.4);
  }

  .nav-btn {
    width: 52px;
    height: 52px;
    border: 1px solid #333;
    background: #141414;
    color: #ddd;
    font-size: 24px;
    box-shadow: 0 0 8px rgba(0,0,0,0.4);
    transition: transform 0.2s ease, background 0.25s ease, color 0.25s ease;
  }
.nav-btn:hover { transform: scale(1.06); background:#1d1d1d; color:#fff; }
.nav-btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* Projector-style power on/off animations */
.overlay.startup { animation: projectorWarmup 1200ms ease-out 1; }
@keyframes projectorWarmup {
    0%   { opacity: 0;            filter: blur(8px) brightness(0.35) contrast(0.85); }
    20%  { opacity: 0.95;         filter: blur(5px) brightness(1.25) contrast(1.05); }
    45%  { opacity: 0.45;         filter: blur(6px) brightness(0.75) contrast(0.95); }
    70%  { opacity: 0.98;         filter: blur(2px) brightness(1.08) contrast(1.02); }
    100% { opacity: var(--on-opacity); filter: none; }
  }

.overlay.shutdown { animation: projectorShutdown 300ms ease-in 1 forwards; }
@keyframes projectorShutdown {
    0%   { opacity: var(--on-opacity); filter: none; }
    40%  { opacity: 0.25;            filter: blur(2px) brightness(0.7) contrast(0.95); }
    100% { opacity: 0;               filter: blur(6px) brightness(0.35) contrast(0.85); }
  }

/* Lightbox (full page overlay) */
.lightbox {
    position: fixed;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,0.88);
    backdrop-filter: blur(2px);
    z-index: 9999;
  }
.lightbox.open { display: flex; animation: lbFadeIn 180ms ease-out; }
@keyframes lbFadeIn { from { opacity: 0; } to { opacity: 1; } }
.lightbox img {
    max-width: 92vw;
    max-height: 92vh;
    border-radius: 10px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.6);
    object-fit: contain;
  }
.lightbox .close-btn {
    position: absolute;
    top: 16px;
    right: 20px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 1px solid #444;
    background: #111;
    color: #eee;
    font-size: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 2px 10px rgba(0,0,0,0.4);
  }
.lightbox .close-btn:hover { background:#1b1b1b; }