/* Environmental soft glow from the work-list cover.
   Visual reference: YouTube official Ambient Mode design language
   (wide soft bloom, fade into a dark field, no hard rectangle,
   picture and type stay clear). This is a cover-based look only.
   It is not real-time sync, not an official Ambient switch on a
   third-party iframe, and it does not read iframe pixels. */
.page-project{overflow-x:clip}
.page-project .shell{overflow:visible}

.ambient-frame{
  --ambient-pad:6.5rem;
  position:relative;
  isolation:isolate;
  margin:var(--ambient-pad) 0;
}
.ambient-frame[data-ambient-state="pending"]{margin:0}
.ambient-frame[data-ambient-state="pending"] .ambient-glow{display:none}

/* Limit the bloom around tall official Instagram embeds so it does not wash the page. */
.ambient-frame:has(.player-instagram){--ambient-pad:3.5rem}

.ambient-glow{
  position:absolute;
  inset:calc(-1 * var(--ambient-pad));
  z-index:0;
  pointer-events:none;
  -webkit-mask-image:radial-gradient(ellipse farthest-side at 50% 45%,#000 10%,rgb(0 0 0 / .72) 40%,rgb(0 0 0 / .28) 68%,transparent 100%);
  mask-image:radial-gradient(ellipse farthest-side at 50% 45%,#000 10%,rgb(0 0 0 / .72) 40%,rgb(0 0 0 / .28) 68%,transparent 100%);
}

.ambient-glow-layer{
  position:absolute;
  inset:0;
  background-image:var(--ambient-cover,none);
  background-size:cover;
  background-position:center;
  background-repeat:no-repeat;
  opacity:0;
}
.ambient-frame[data-ambient-state="ready"] .ambient-glow-layer--far{
  opacity:.42;
  filter:blur(80px) saturate(1.2);
  transform:scale(1.4);
}
.ambient-frame[data-ambient-state="ready"] .ambient-glow-layer--mid{
  opacity:.32;
  filter:blur(48px) saturate(1.1);
  transform:scale(1.22);
}
.ambient-frame[data-ambient-state="ready"] .ambient-glow-layer--near{
  opacity:.18;
  filter:blur(24px) saturate(1.05);
  transform:scale(1.08);
}

.ambient-frame .player{
  position:relative;
  z-index:1;
  background:#000;
}

.page-project .stage-actions,
.page-project .project-synopsis,
.page-project .embed-file-note,
.page-project .series-head,
.page-project .series-controls,
.page-project .series-live,
.page-project .controls{
  position:relative;
  z-index:2;
  background:#000;
}

@media (max-width:767px){
  .ambient-frame{--ambient-pad:3.25rem}
  .ambient-frame:has(.player-instagram){--ambient-pad:2.25rem}
}

/* Strong sample (Goedhuis + Myonghi only). Wider, brighter, softer bloom.
   The player stays z-index 1 with a black fill, so the visible light is the
   halo around the frame, not a sheet over the film. Type and controls stay
   z-index 2. On small screens horizontal pad is capped to the 1rem shell
   gutter because .page-project uses overflow-x:clip; a larger side pad
   would be clipped while still opaque and read as a hard edge. Vertical
   pad can grow because the page can scroll. */
.ambient-frame[data-ambient-strength="strong"]{
  --ambient-pad-x:9rem;
  --ambient-pad-y:8.5rem;
  margin:var(--ambient-pad-y) 0;
}
.ambient-frame[data-ambient-strength="strong"]:has(.player-instagram){
  --ambient-pad-x:7rem;
  --ambient-pad-y:6.75rem;
}
/* Even frame bloom for the two strong samples.
   The previous vertically shifted radial ellipse ended at the mid-sides
   and left the rectangle's four corners unlit — a bright top, thin sides,
   and missing corners. Intersected
   linear fades follow the player rectangle: the same pad length on each
   axis, including the corners. This is geometric evenness only; side colors
   may still differ because they come from the cover. */
.ambient-frame[data-ambient-strength="strong"] .ambient-glow{
  inset:calc(-1 * var(--ambient-pad-y)) calc(-1 * var(--ambient-pad-x));
  -webkit-mask-image:linear-gradient(to right,transparent 0,rgb(0 0 0 / .18) calc(var(--ambient-pad-x) * .28),rgb(0 0 0 / .55) calc(var(--ambient-pad-x) * .55),rgb(0 0 0 / .9) calc(var(--ambient-pad-x) * .82),#000 var(--ambient-pad-x),#000 calc(100% - var(--ambient-pad-x)),rgb(0 0 0 / .9) calc(100% - (var(--ambient-pad-x) * .82)),rgb(0 0 0 / .55) calc(100% - (var(--ambient-pad-x) * .55)),rgb(0 0 0 / .18) calc(100% - (var(--ambient-pad-x) * .28)),transparent 100%),linear-gradient(to bottom,transparent 0,rgb(0 0 0 / .18) calc(var(--ambient-pad-y) * .28),rgb(0 0 0 / .55) calc(var(--ambient-pad-y) * .55),rgb(0 0 0 / .9) calc(var(--ambient-pad-y) * .82),#000 var(--ambient-pad-y),#000 calc(100% - var(--ambient-pad-y)),rgb(0 0 0 / .9) calc(100% - (var(--ambient-pad-y) * .82)),rgb(0 0 0 / .55) calc(100% - (var(--ambient-pad-y) * .55)),rgb(0 0 0 / .18) calc(100% - (var(--ambient-pad-y) * .28)),transparent 100%);
  mask-image:linear-gradient(to right,transparent 0,rgb(0 0 0 / .18) calc(var(--ambient-pad-x) * .28),rgb(0 0 0 / .55) calc(var(--ambient-pad-x) * .55),rgb(0 0 0 / .9) calc(var(--ambient-pad-x) * .82),#000 var(--ambient-pad-x),#000 calc(100% - var(--ambient-pad-x)),rgb(0 0 0 / .9) calc(100% - (var(--ambient-pad-x) * .82)),rgb(0 0 0 / .55) calc(100% - (var(--ambient-pad-x) * .55)),rgb(0 0 0 / .18) calc(100% - (var(--ambient-pad-x) * .28)),transparent 100%),linear-gradient(to bottom,transparent 0,rgb(0 0 0 / .18) calc(var(--ambient-pad-y) * .28),rgb(0 0 0 / .55) calc(var(--ambient-pad-y) * .55),rgb(0 0 0 / .9) calc(var(--ambient-pad-y) * .82),#000 var(--ambient-pad-y),#000 calc(100% - var(--ambient-pad-y)),rgb(0 0 0 / .9) calc(100% - (var(--ambient-pad-y) * .82)),rgb(0 0 0 / .55) calc(100% - (var(--ambient-pad-y) * .55)),rgb(0 0 0 / .18) calc(100% - (var(--ambient-pad-y) * .28)),transparent 100%);
  -webkit-mask-composite:source-in;
  mask-composite:intersect;
  -webkit-mask-repeat:no-repeat;
  mask-repeat:no-repeat;
  -webkit-mask-size:100% 100%;
  mask-size:100% 100%;
}
.ambient-frame[data-ambient-strength="strong"][data-ambient-state="ready"] .ambient-glow-layer--far{
  opacity:.72;
  filter:blur(120px) saturate(1.35);
  transform:scale(1.7);
}
.ambient-frame[data-ambient-strength="strong"][data-ambient-state="ready"] .ambient-glow-layer--mid{
  opacity:.55;
  filter:blur(72px) saturate(1.22);
  transform:scale(1.4);
}
.ambient-frame[data-ambient-strength="strong"][data-ambient-state="ready"] .ambient-glow-layer--near{
  opacity:.32;
  filter:blur(40px) saturate(1.12);
  transform:scale(1.16);
}

@media (max-width:767px){
  .ambient-frame[data-ambient-strength="strong"]{
    --ambient-pad-x:1rem;
    --ambient-pad-y:5.75rem;
  }
  .ambient-frame[data-ambient-strength="strong"]:has(.player-instagram){
    --ambient-pad-x:1rem;
    --ambient-pad-y:4.5rem;
  }
}
