/* ============================================================================
   GATE INTEGRATION MOCKUP (v59)
   Four layers that tie the film to the gate panel, each switchable from the
   mockup panel (bottom left) while Enzo decides:
     light gradient  multiply over the film and picture, lit from the top left
     contact shadow  the rim's shadow on the film (assets/gate-shadow.png)
     lamp flicker    a faint, irregular dip in brightness while playing
     bounce light    the film's own colours glowing on the rim (v60: added light,
                     a tight lip reflection plus a soft spill)
     black point     v65: the film and the footage meet halfway, a slightly lifted black
     (v61: the bounce light sits on the left and right sides only)
   Stacking inside #gateBay: film and picture (≤9) < gradient 17 < shadow 18 <
   flicker 19 < panel 20 (::after) < bounce 21 (lip reflection and spill).
   ========================================================================= */
#gateBay{isolation:isolate;--fx-grad:1;--fx-shadow:1;--fx-flicker:1;--fx-bounce:1}
#gateBay .gfx{position:absolute;inset:0;pointer-events:none}
.gfx-grad{z-index:17;mix-blend-mode:multiply;opacity:calc(var(--fx-grad)*.9);
  background:radial-gradient(135% 125% at 30% -12%,#fff 0%,#f4f4f4 30%,#d6d6d6 68%,#b9b9b9 100%)}
.gfx-shadow{z-index:18;opacity:calc(var(--fx-shadow)*.85);
  background:url('assets/gate-shadow.png') center/100% 100% no-repeat}
.gfx-flicker{z-index:19;background:#000;opacity:0}
#gateBay[data-playing="true"] .gfx-flicker{animation:gfxLamp 2.6s infinite}
/* v60: bounce light as real added light, in two parts: a tight reflection on the lip
   (gate-spec.png, shaped by the metal's own highlights) and a soft spill across the face
   (gate-spill.png). Colour comes from the film and picture next to each spot. */
.gfx-spec,.gfx-spill{z-index:21;mix-blend-mode:plus-lighter}
@supports not (mix-blend-mode:plus-lighter){.gfx-spec,.gfx-spill{mix-blend-mode:screen}}
.gfx-spec{-webkit-mask:url('assets/gate-spec.png') center/100% 100% no-repeat;mask:url('assets/gate-spec.png') center/100% 100% no-repeat}
.gfx-spill{-webkit-mask:url('assets/gate-spill.png') center/100% 100% no-repeat;mask:url('assets/gate-spill.png') center/100% 100% no-repeat}
.gfx-spec canvas,.gfx-spill canvas{position:absolute;inset:0;width:100%;height:100%}
.gfx-spec canvas{opacity:calc(var(--fx-bounce)*1)}
.gfx-spill canvas{opacity:calc(var(--fx-bounce)*.9)}
#gateBay[data-playing="true"] .gfx-spec,#gateBay[data-playing="true"] .gfx-spill{animation:gfxLampGlow 2.6s infinite}
/* v65: the black point meets halfway. film-top.js levels the film's blacks (16,22,20) down to RGB 8,11,10,
   and the footage's (0) are lifted to the same value here. Screen with a solid colour is a straight linear
   lift, out = c + in*(1-c), so nothing is clipped. */
#stage .win::after{content:"";position:absolute;inset:0;pointer-events:none;background:rgb(8,11,10);mix-blend-mode:screen}
#gateBay.no-blackpt #stage .win::after{display:none}
#gateBay.no-grad .gfx-grad,#gateBay.no-shadow .gfx-shadow,#gateBay.no-flicker .gfx-flicker,#gateBay.no-bounce .gfx-spec,#gateBay.no-bounce .gfx-spill{display:none}
#gateBay.no-flicker .gfx-spec,#gateBay.no-flicker .gfx-spill{animation:none}
/* the lamp: mostly steady, with small irregular dips; the rim glow dips with it */
@keyframes gfxLamp{
  0%{opacity:0} 7%{opacity:calc(var(--fx-flicker)*.035)} 9%{opacity:0} 23%{opacity:calc(var(--fx-flicker)*.015)}
  31%{opacity:calc(var(--fx-flicker)*.05)} 33%{opacity:calc(var(--fx-flicker)*.01)} 48%{opacity:0}
  52%{opacity:calc(var(--fx-flicker)*.03)} 55%{opacity:0} 71%{opacity:calc(var(--fx-flicker)*.02)}
  74%{opacity:calc(var(--fx-flicker)*.06)} 76%{opacity:calc(var(--fx-flicker)*.015)} 90%{opacity:0} 100%{opacity:0}}
@keyframes gfxLampGlow{
  0%{opacity:1} 7%{opacity:.88} 9%{opacity:1} 23%{opacity:.95} 31%{opacity:.82} 33%{opacity:.97} 48%{opacity:1}
  52%{opacity:.9} 55%{opacity:1} 71%{opacity:.93} 74%{opacity:.78} 76%{opacity:.95} 90%{opacity:1} 100%{opacity:1}}
html.is-pocket #gateBay .gfx{display:none}

/* the mockup panel: a small tab in the top-left corner, opened by clicking it or pressing G */
.gfx-panel{position:fixed;left:6px;top:6px;z-index:9999;width:230px;padding:10px 12px 8px;
  font:11px/1.3 ui-monospace,Menlo,Consolas,monospace;letter-spacing:.06em;color:#d9e0dc;
  background:rgba(14,17,18,.92);border:1px solid #3a4447;border-radius:6px;box-shadow:0 6px 24px rgba(0,0,0,.6)}
.gfx-panel h4{margin:0 0 8px;font-size:10px;letter-spacing:.2em;color:#f0b44a;font-weight:600;display:flex;justify-content:space-between}
.gfx-panel h4 button{all:unset;cursor:pointer;color:#8d9a9e}
.gfx-panel label{display:grid;grid-template-columns:16px 1fr 70px;align-items:center;gap:6px;margin:5px 0;cursor:pointer}
.gfx-panel input[type=range]{width:70px;accent-color:#f0b44a}
.gfx-panel input[type=checkbox]{accent-color:#f0b44a;margin:0}
.gfx-panel .row{display:flex;gap:6px;margin-top:8px}
.gfx-panel .row button{flex:1;transition:background .15s,color .15s;font:inherit;font-size:10px;letter-spacing:.12em;color:#d9e0dc;background:#263033;border:1px solid #3a4447;border-radius:3px;padding:4px 0;cursor:pointer}
.gfx-panel.min label,.gfx-panel.min .row{display:none}
.gfx-panel.min{width:auto;padding:5px 8px}
.gfx-panel.min h4{margin:0;gap:8px}
html.is-pocket .gfx-panel{display:none}
/* v68: the single FX toggle; when it's off the switches dim but keep their settings */
.gfx-panel .row button[data-bypass]{color:#1b1406;background:#f0b44a;border-color:#f0b44a;font-weight:600}
.gfx-panel .row button[data-bypass].off{color:#d9e0dc;background:#263033;border-color:#3a4447;font-weight:400}
.gfx-panel.bypassed label{opacity:.45}
