/* THE APERTURE — 8-blade lens iris, 3D-tilted, projects the menu with
   streaming photons. Shared by TIME LAB (index) + VIEWFINDER (m). */
#aperture { position: fixed; right: 24px; bottom: 26px; z-index: 57;
  perspective: 620px; }

#ap-btn { position: relative; width: 92px; height: 92px; padding: 0;
  background: transparent; border: none; cursor: pointer; display: block;
  transform: rotateX(26deg) rotateY(-17deg);
  transform-style: preserve-3d;
  transition: transform .55s cubic-bezier(.16,1,.3,1);
  -webkit-tap-highlight-color: transparent;
  filter: drop-shadow(0 14px 16px rgba(0,0,0,.6)); }
#ap-btn:hover { transform: rotateX(18deg) rotateY(-10deg) scale(1.03); }
#aperture.open #ap-btn { transform: rotateX(8deg) rotateY(-5deg) scale(1.05); }
#ap-btn svg { display: block; width: 100%; height: 100%; }

/* iris blades: each pivots at the rim, swinging open like a real leaf */
.blade8 path { transform-origin: 50px 9px;
  transition: transform .6s cubic-bezier(.34,1.2,.4,1); }
#aperture.open .blade8 path { transform: rotate(54deg); }

/* core: the light source revealed when the leaves part */
#ap-core { opacity: 0; transition: opacity .45s ease .15s; }
#aperture.open #ap-core { opacity: 1; }

#ap-ring { transition: stroke .3s; }
body.frozen #ap-ring { stroke: #5ad0ff; }

#ap-label { position: absolute; left: 50%; transform: translateX(-50%);
  bottom: -24px; font: bold 12px "Consolas", monospace; letter-spacing: .42em;
  padding-left: .42em;   /* visually re-center the tracked-out text */
  color: #ffb142; pointer-events: none;
  text-shadow: 0 0 12px rgba(255,177,66,.55), 0 1px 4px rgba(0,0,0,.9); }

/* backdrop */
#ap-veil { position: fixed; inset: 0; z-index: 54;
  background: rgba(8,8,11,.55); backdrop-filter: blur(4px);
  opacity: 0; pointer-events: none; transition: opacity .35s; }
#ap-veil.open { opacity: 1; pointer-events: auto; }

/* photon beams: light streaming through the open iris to each option */
#ap-beams { position: absolute; right: 46px; bottom: 46px; z-index: 55;
  pointer-events: none; overflow: visible; }
#ap-beams line { stroke: #ffb142; stroke-width: 1.4;
  stroke-dasharray: 1.6 9.5; stroke-linecap: round;
  opacity: 0; transition: opacity .4s; }
#aperture.open #ap-beams line { opacity: .65;
  animation: apflow .8s linear infinite; }
@keyframes apflow { from { stroke-dashoffset: 22.2; } to { stroke-dashoffset: 0; } }

/* projected menu: items focus-pull in (blurred light -> sharp image) */
#ap-menu { position: absolute; right: 46px; bottom: 46px; z-index: 56;
  pointer-events: none; }
.ap-head { position: absolute; right: 0; bottom: 0; display: block;
  white-space: nowrap;
  font: bold 9.5px "Consolas", monospace; letter-spacing: .34em; color: #8a8478;
  padding-right: 26px; pointer-events: none;
  transform: translate(0, 0) scale(.15); opacity: 0;
  transition: transform .5s cubic-bezier(.22,1.1,.36,1), opacity .35s; }
.ap-item { position: absolute; right: 0; bottom: 0;
  display: flex; align-items: center; gap: 9px;
  text-decoration: none; white-space: nowrap;
  font: 12px "Consolas", monospace; letter-spacing: .14em; color: #e8e4da;
  transform: translate(0, 0) scale(.15); opacity: 0; filter: blur(7px);
  transition: transform .6s cubic-bezier(.22,1.1,.36,1), opacity .4s,
              filter .55s ease; }
.ap-item .ap-dot { width: 11px; height: 11px; border-radius: 50%;
  background: #2a2418; border: 1.5px solid #8a8478; flex: none;
  transition: background .25s, border-color .25s, box-shadow .25s; }
.ap-item span { background: rgba(10,10,14,.88); border: 1px solid #3a3220;
  border-radius: 6px; padding: 6px 11px; }
.ap-item:hover .ap-dot, .ap-item:active .ap-dot {
  background: #ffb142; border-color: #ffb142; box-shadow: 0 0 10px #ffb142; }
.ap-item:hover span { border-color: #ffb142; }
.ap-star { color: #ffb142; font-weight: bold; }
.ap-star .ap-dot { border-color: #ffb142; background: #4a3410;
  box-shadow: 0 0 8px rgba(255,177,66,.5); }
.ap-star span { border-color: rgba(255,177,66,.55); }
#aperture.open .ap-item { pointer-events: auto; opacity: 1; filter: blur(0); }
#aperture.open .ap-head { opacity: .85; }

@media (max-width: 768px) {
  #aperture { right: 16px; bottom: max(60px, calc(env(safe-area-inset-bottom) + 50px)); }
  #ap-btn { width: 78px; height: 78px; }
  #ap-label { font-size: 11px; bottom: -21px; }
  #ap-menu, #ap-beams { right: 39px; bottom: 39px; }
  .ap-item { font-size: 11px; }
  .ap-item span { padding: 5px 9px; }
}
@media (prefers-reduced-motion: reduce) {
  .ap-item, .blade8 path, #ap-veil, #ap-btn { transition: none; }
  #ap-beams line { animation: none; }
}
