/* ═══════════════════════════════════════════════════════════════════════
   Modal.css — the demo video overlay.

   The `hidden` attribute IS the open/closed state. There is deliberately no
   `is-open` class: two flags that can disagree is how a modal ends up
   invisible but still focusable.
   ═══════════════════════════════════════════════════════════════════════ */

.Modal{ display: none; }

.Modal:not([hidden]){
  display: grid;
  place-items: center;
  position: fixed;
  inset: 0;
  z-index: var(--z-modal);
  padding: clamp(16px, 4vw, 56px);
}

.Modal-scrim{
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,.74);
  -webkit-backdrop-filter: blur(6px);
          backdrop-filter: blur(6px);
  /* Stops iOS reading a drag on the scrim as a page scroll. */
  touch-action: none;
  animation: ModalFade .22s ease both;
}

.Modal-dialog{
  position: relative;
  width: min(1120px, 100%);
  overscroll-behavior: contain;
  animation: ModalRise .28s cubic-bezier(.16, 1, .3, 1) both;
}

.Modal-video{
  display: block;
  width: 100%;
  height: auto;
  border-radius: 12px;
  background: #000;
  box-shadow: 0 24px 80px rgba(0,0,0,.5);
}

.Modal-close{
  position: absolute;
  top: -44px;
  right: 0;
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: rgba(255,255,255,.14);
  color: #fff;
  cursor: pointer;
  transition: background .15s ease;
}
.Modal-close:hover{ background: rgba(255,255,255,.26); }
.Modal-close:focus-visible{
  outline: 2px solid #fff;
  outline-offset: 3px;
}
.Modal-closeIcon{ width: 15px; height: 15px; }

/* Scroll lock.
   ⚠️ On <html>, NOT `body { position: fixed; top: -scrollY }`. With body
   fixed, window.scrollY reports 0, so the hero-recede code recomputes to full
   scale behind the modal and then snaps back again on close. Locking the root
   preserves the scroll position with no save/restore dance, and
   `scrollbar-gutter: stable` (Base.css) absorbs the scrollbar so nothing
   shifts sideways. */
html.is-modalOpen{ overflow: hidden; }

@keyframes ModalFade{ from{ opacity: 0 } to{ opacity: 1 } }
@keyframes ModalRise{
  from{ opacity: 0; transform: translateY(14px) scale(.985) }
  to  { opacity: 1; transform: none }
}

@media (prefers-reduced-motion: reduce){
  .Modal-scrim, .Modal-dialog{ animation: none; }
}

@media (max-width: 768px){
  .Modal-close{ top: -38px; }
}
