/* sede.html only — Mobile-only intro for .video-section / #promoVideo.
   Strategy: promote the existing <section> to fullscreen (no DOM move),
   then shrink it to a picture-in-picture on swipe down.
   Only applies on ≤768px OR touch devices ≤1024px (cubre iPhone 14 Pro Max en horizontal). */

@media (max-width: 768px),
  ((hover: none) and (pointer: coarse) and (max-width: 1024px)) {
  body.mob-intro-active {
    overflow: hidden;
    overscroll-behavior: none;
    touch-action: none;
  }

  body.mob-intro-active .video-section #unmuteBtn {
    display: none !important;
  }

  /* ── Fullscreen takeover (same <section>, new positioning) ── */
  /* Use !important on position/size to defeat inline style="position: relative"
     on the <section class="video-section"> node. */
  .video-section.mob-video-intro-fullscreen {
    position: fixed !important;
    inset: 0 !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    height: 100dvh !important;
    z-index: 100000 !important;
    background: #000 !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: hidden !important;
    transform-origin: center center;
    animation: mobIntroZoomIn 0.85s cubic-bezier(0.22, 1, 0.36, 1) both;
    transition:
      transform 0.45s cubic-bezier(0.22, 1, 0.36, 1),
      opacity 0.4s ease;
    will-change: transform, opacity;
    touch-action: none;
  }

  .video-section.mob-video-intro-fullscreen.is-exiting {
    animation: none !important;
    transform: translateY(18%) scale(0.96) !important;
    opacity: 0 !important;
    pointer-events: none !important;
  }

  .video-section.mob-video-intro-fullscreen.is-reduced-motion {
    animation: none;
    transition: none;
  }

  .video-section.mob-video-intro-fullscreen #promoVideo {
    position: absolute !important;
    inset: 0 !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    max-height: none !important;
    margin: 0 !important;
    display: block !important;
    object-fit: cover !important;
    background: #000;
  }

  /* Tap-to-play fallback button when iOS blocks autoplay. */
  .mob-tap-to-play {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 88px;
    height: 88px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.96);
    color: #003b5c;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
    z-index: 5;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    animation: mobTapPulse 1.6s ease-out infinite;
  }
  .mob-tap-to-play svg {
    width: 38px;
    height: 38px;
    margin-left: 4px;
  }
  .mob-tap-to-play:active {
    transform: translate(-50%, -50%) scale(0.95);
  }

  @keyframes mobTapPulse {
    0% {
      box-shadow:
        0 10px 30px rgba(0, 0, 0, 0.45),
        0 0 0 0 rgba(255, 255, 255, 0.45);
    }
    70% {
      box-shadow:
        0 10px 30px rgba(0, 0, 0, 0.45),
        0 0 0 26px rgba(255, 255, 255, 0);
    }
    100% {
      box-shadow:
        0 10px 30px rgba(0, 0, 0, 0.45),
        0 0 0 0 rgba(255, 255, 255, 0);
    }
  }

  .video-section.mob-video-intro-fullscreen .mob-swipe-hint {
    position: absolute;
    left: 0;
    right: 0;
    bottom: max(18px, env(safe-area-inset-bottom));
    margin: 0;
    text-align: center;
    color: rgba(255, 255, 255, 0.85);
    font-size: 0.82rem;
    line-height: 1.35;
    padding: 0 16px;
    pointer-events: none;
    text-shadow: 0 1px 6px rgba(0, 0, 0, 0.65);
    animation: mobHintFade 2.2s ease-out 0.2s both;
  }

  @keyframes mobIntroZoomIn {
    from {
      transform: scale(0.88);
      opacity: 0.1;
    }
    to {
      transform: scale(1);
      opacity: 1;
    }
  }

  @keyframes mobHintFade {
    0% {
      opacity: 0;
      transform: translateY(8px);
    }
    25% {
      opacity: 1;
      transform: translateY(0);
    }
    75% {
      opacity: 1;
      transform: translateY(0);
    }
    100% {
      opacity: 0.55;
      transform: translateY(0);
    }
  }

  /* ── Picture-in-Picture after swipe down ── */
  .video-section.mob-video-intro-pip {
    position: fixed !important;
    right: max(10px, env(safe-area-inset-right));
    bottom: max(72px, env(safe-area-inset-bottom));
    top: auto;
    left: auto;
    width: 132px !important;
    max-width: 34vw;
    height: auto !important;
    min-height: 0 !important;
    z-index: 40;
    margin: 0 !important;
    padding: 0 !important;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.45);
    opacity: 0.94;
    pointer-events: none;
    background: #050505;
    animation: mobPipIn 0.45s cubic-bezier(0.22, 1, 0.36, 1) both;
  }

  .video-section.mob-video-intro-pip #promoVideo {
    position: static !important;
    width: 100% !important;
    height: auto !important;
    max-height: none !important;
    margin: 0 !important;
    display: block;
    object-fit: contain !important;
  }

  .video-section.mob-video-intro-pip #unmuteBtn,
  .video-section.mob-video-intro-pip .mob-swipe-hint {
    display: none !important;
  }

  @keyframes mobPipIn {
    from {
      transform: translateY(20%) scale(0.85);
      opacity: 0;
    }
    to {
      transform: translateY(0) scale(1);
      opacity: 0.94;
    }
  }
}

@media (prefers-reduced-motion: reduce) {
  .video-section.mob-video-intro-fullscreen,
  .video-section.mob-video-intro-fullscreen .mob-swipe-hint,
  .video-section.mob-video-intro-pip {
    animation: none !important;
    transition: none !important;
  }
}
