/* Mobile layout — desktop styles unchanged in index.html */

@media screen and (max-width: 768px), (max-height: 500px) and (orientation: landscape) {
  /* Hide desktop top nav bar; use hamburger overlay instead */
  .site-nav:not(.open) {
    visibility: hidden !important;
    opacity: 0 !important;
    pointer-events: none !important;
  }

  .site-nav:not(.open) .site-nav-scroll {
    pointer-events: none !important;
  }

  .nav-toggle {
    display: flex !important;
    position: fixed;
    top: max(10px, env(safe-area-inset-top));
    right: 12px;
    z-index: 10050;
    width: 40px;
    height: 40px;
    padding: 0;
    border: 1px solid rgba(255, 255, 255, 0.22);
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    color: rgba(255, 255, 255, 0.92);
    cursor: pointer;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease, border-color 0.2s ease;
    -webkit-tap-highlight-color: transparent;
  }

  .nav-toggle:hover {
    background: rgba(0, 0, 0, 0.62);
    border-color: rgba(255, 255, 255, 0.35);
  }

  .nav-toggle-icon {
    display: block;
    width: 18px;
    height: 2px;
    background: currentColor;
    border-radius: 2px;
    position: relative;
    transition: background 0.2s ease;
  }

  .nav-toggle-icon::before,
  .nav-toggle-icon::after {
    content: "";
    position: absolute;
    left: 0;
    width: 18px;
    height: 2px;
    background: currentColor;
    border-radius: 2px;
    transition: transform 0.25s ease, top 0.25s ease;
  }

  .nav-toggle-icon::before { top: -6px; }
  .nav-toggle-icon::after { top: 6px; }

  .nav-toggle[aria-expanded="true"] .nav-toggle-icon {
    background: transparent;
  }

  .nav-toggle[aria-expanded="true"] .nav-toggle-icon::before {
    top: 0;
    transform: rotate(45deg);
  }

  .nav-toggle[aria-expanded="true"] .nav-toggle-icon::after {
    top: 0;
    transform: rotate(-45deg);
  }
  html, body {
    -webkit-text-size-adjust: 100%;
  }

  .photo-frame {
    height: 100dvh;
    overflow-x: hidden;
    overflow-y: auto;
    touch-action: pan-y;
    overscroll-behavior-y: contain;
  }

  .modal-content h2.phase-title {
    font-weight: 700;
  }

  .site-nav {
    position: fixed;
    inset: 0;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: max(64px, env(safe-area-inset-top)) 20px max(24px, env(safe-area-inset-bottom));
    pointer-events: none;
    visibility: hidden;
    opacity: 0;
    z-index: 10040;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(22px);
    -webkit-backdrop-filter: blur(22px);
    transition: opacity 0.3s ease, visibility 0.3s ease;
  }

  .site-nav.open {
    pointer-events: auto;
    visibility: visible !important;
    opacity: 1 !important;
  }

  .site-nav-scroll {
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    max-width: 340px;
    max-height: 100%;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 10px 4px;
    transform: translateY(16px);
    opacity: 0;
    transition: transform 0.32s ease, opacity 0.32s ease;
  }

  .site-nav.open .site-nav-scroll {
    transform: translateY(0);
    opacity: 1;
  }

  .site-nav-scroll button {
    width: 100%;
    padding: 14px 16px;
    border: none;
    border-radius: 10px;
    background: transparent;
    font-size: 18px;
    font-weight: 600;
    letter-spacing: 0.03em;
    text-align: center;
  }

  .site-nav-scroll button.active {
    background: rgba(var(--accent-red-rgb), 0.18);
    color: #fff;
  }

  .site-nav-scroll button.nav-logo-btn {
    padding: 16px 10px 24px;
  }

  .site-nav-scroll button.nav-logo-btn img {
    height: 120px;
    margin: 0 auto;
  }

  .scene-section {
    left: 0 !important;
    width: 100% !important;
  }

  .scene-section:nth-child(1) { top: 0; height: 9%; }
  .scene-section:nth-child(2) { top: 12%; height: 20%; }
  .scene-section:nth-child(3) { top: 21%; height: 40%; }
  .scene-section:nth-child(4) { top: 36%; height: 55%; }
  .scene-section:nth-child(5) { top: 70%; height: 25%; }

  .photo-scene {
    display: block;
    margin: 0 auto;
  }

  .photo-scene > img.page-background {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: auto;
  }

  .scroll-arrow {
    display: none !important;
    pointer-events: none !important;
  }

  .video-button:hover,
  .video-button:active {
    opacity: 0.95;
  }

  .video-box {
    z-index: 20;
    border-radius: 8px;
    background: #000;
  }

  .video-box video {
    object-fit: contain;
    background: #000;
  }

  .video-box--landscape {
    z-index: 30;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.45);
  }

  .video-box--landscape video {
    object-fit: contain;
  }

  html.is-mobile.video-playing .video-box--portrait {
    z-index: 25;
  }

  html.is-mobile.video-playing .video-box--portrait video {
    object-fit: contain;
  }

  html.is-landscape .video-box--landscape {
    border-radius: 0;
  }

  html.is-landscape .video-box--landscape video {
    object-fit: contain;
    width: 100%;
    height: 100%;
  }

  .gif-hotspot {
    opacity: 1;
  }

  .graph-button {
    padding: calc(10px * var(--scene-scale, 1));
  }

  .graph-info h3 {
    margin: 0 0 calc(14px * var(--scene-scale, 1));
    font-size: calc(42px * var(--scene-scale, 1));
    line-height: 1.12;
  }

  .graph-info p {
    margin: 0 0 calc(14px * var(--scene-scale, 1));
    font-size: calc(35px * var(--scene-scale, 1));
    line-height: 1.38;
  }

  #graphInfo {
    display: block;
  }

  ::-webkit-scrollbar {
    width: 5px;
    height: auto;
  }
}

/* Desktop-only: hide mobile controls */
@media screen and (min-width: 769px) {
  .nav-toggle {
    display: none !important;
  }

  .scroll-arrow.up,
  .scroll-arrow.down {
    display: none !important;
  }
}
