/* ══════════════════════════════════════════════════════════
   MOBILE NAV UI  —  mobile_nav.css  v10 (Smooth Transitions)
   Fixed: Bottom sheet and overlay animations (removed display:none).
   Maintained: Immersive full-screen tabs and stability.
══════════════════════════════════════════════════════════ */

:root {
  --mob-bar-h: 64px;
  --mob-bar-bg: rgba(6, 6, 9, 0.95);
  --mob-accent: #6366f1;
  --mob-accent2: #06b6d4;
  --mob-spring: cubic-bezier(0.32, 0.72, 0, 1);
}

@media (max-width: 767px) {
  /* HIDE DESKTOP INFRASTRUCTURE */
  body > main, 
  body > footer, 
  #site-header { 
    display: none !important; 
  }
  
  html, body {
    margin: 0; padding: 0;
    width: 100%; height: 100%;
    /* Removed overflow: hidden to allow native pull-to-refresh */
    background: #000;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
    overscroll-behavior-y: auto; /* Ensure pull-to-refresh works */
  }

  /* NATIVE APP ROOT */
  #mob-app {
    position: fixed; inset: 0;
    display: flex; flex-direction: column;
    z-index: 999;
    background: #000;
  }

  /* NATIVE SWIPE TRACK */
  #mob-track {
    flex: 1;
    display: flex;
    overflow-x: auto; 
    overflow-y: hidden;
    scroll-snap-type: x mandatory;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
    scroll-behavior: smooth;
  }
  #mob-track::-webkit-scrollbar { display: none; }

  /* A SINGLE FULL-SCREEN PAGE */
  .mob-page {
    width: 100vw; 
    height: 100%;
    flex-shrink: 0;
    scroll-snap-align: center;
    scroll-snap-stop: always;
    overflow-y: auto; 
    overflow-x: hidden;
    position: relative;
    background: #000;
    overscroll-behavior-y: auto; /* ensure pull-to-refresh bubbles */
  }

  /* HERO PAGE (Centered & Fixed) */
  .mob-page[data-id="home"] {
    display: flex; flex-direction: column;
    padding: 0 !important; margin: 0 !important;
    overflow: hidden !important;
  }
  .mob-page[data-id="home"] header {
    position: relative !important;
    height: 100% !important;
    min-height: 100% !important;
    display: flex !important;
    flex-direction: column !important;
    justify-content: center !important;
    padding: 0 !important;
    margin: 0 !important;
    border: none !important;
    background: transparent !important;
  }
  /* Restore Absolute Layers */
  .mob-page[data-id="home"] #hero-bg {
    position: absolute !important; inset: 0 !important;
    opacity: 0.45 !important; z-index: 1; display: block !important;
    width: 100% !important; height: 100% !important; object-fit: cover !important;
  }
  .mob-page[data-id="home"] header > div[class*="backdrop-blur"] {
    position: absolute !important; inset: 0 !important;
    z-index: 2; display: block !important;
  }
  /* Content Container */
  .mob-page[data-id="home"] header > div.relative {
    position: relative !important;
    z-index: 10;
    padding: 2rem 1.5rem !important;
    margin: 0 !important;
    max-width: 100% !important;
    background: transparent !important;
  }

  .mob-page[data-id="home"] #hero-title   { font-size: 2.2rem !important; line-height: 1.1 !important; }
  .mob-page[data-id="home"] #hero-subtitle{ font-size: 1.15rem !important; margin-top: 0.5rem !important; }
  .mob-page[data-id="home"] #hero-body    { font-size: 0.9rem !important; line-height: 1.6 !important; margin-top: 1rem !important; }
  .mob-page[data-id="home"] #hero-icons   { max-width: 200px !important; margin-top: 1.5rem !important; }

  /* TOP BARS FOR WORK PAGES */
  .mob-topbar {
    position: sticky; top: 0; z-index: 10;
    padding: 18px 16px 12px;
    background: rgba(0,0,0,0.95);
    backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
    border-bottom: 1px solid rgba(255,255,255,0.06);
  }
  .mob-title { font-size: 1.1rem; font-weight: 700; color: #fff; }

  /* WORK FILTERS & GRIDS */
  .mob-filters {
    display: flex; gap: 8px; padding: 12px 14px 8px;
    overflow-x: auto; flex-wrap: nowrap; scrollbar-width: none;
  }
  .mob-filters::-webkit-scrollbar { display: none; }
  .mob-filters button {
    padding: 6px 14px !important; font-size: 11.5px !important;
    white-space: nowrap; flex-shrink: 0;
  }
  
  .mob-projects {
    display: grid; grid-template-columns: repeat(2, 1fr);
    gap: 8px; padding: 4px 10px 16px;
  }
  .mob-projects p { display: none !important; }
  .mob-projects div.text-xs { font-size: 9px !important; margin-bottom: 2px !important; }
  .mob-projects h3 { font-size: 11px !important; line-height: 1.2 !important; margin-top: 0 !important; }
  .mob-projects > button > div:last-child {
    padding: 8px 10px 10px !important; 
    min-height: 48px !important; display: flex !important; flex-direction: column !important; justify-content: center !important;
  }
  .mob-projects div[style*="aspect-ratio"] { aspect-ratio: 1 / 1 !important; }

  /* ONE PIECE FEED (Full Screen) */
  .mob-op-page {
    display: flex; flex-direction: column; overflow: hidden;
    padding: 0 !important; margin: 0 !important;
    height: 100% !important;
  }
  #mob-op-feed-native {
    flex: 1; overflow-y: scroll; scroll-snap-type: y mandatory;
    scrollbar-width: none;
    height: 100% !important;
    overscroll-behavior-y: auto; /* ensure pull-to-refresh bubbles */
  }
  #mob-op-feed-native::-webkit-scrollbar { display: none; }
  
  .mob-op-card {
    scroll-snap-align: start; scroll-snap-stop: always;
    width: 100%; height: 100%; position: relative; flex-shrink: 0;
    overflow: hidden; background: #000;
  }
  .mob-op-img-wrap { width: 100%; height: 100%; position: relative; }
  .mob-op-img-wrap img { width: 100%; height: 100%; object-fit: cover; object-position: center 15%; transition: transform 0.3s ease; }
  
  .mob-op-name {
    position: absolute; bottom: 0; left: 0; right: 0; padding: 40px 20px 24px;
    background: linear-gradient(transparent, rgba(0,0,0,0.9)); color: #fff;
    font-size: 1.35rem; font-weight: 800; letter-spacing: 0.02em;
  }
  .mob-op-tap-hint { display: block; font-size: 0.75rem; font-weight: 500; color: rgba(255,255,255,0.6); margin-top: 6px; }

  #mob-op-hint {
    position: absolute; right: 12px; top: 50%; transform: translateY(-50%);
    display: flex; flex-direction: column; gap: 6px; z-index: 20; pointer-events: none;
  }
  .mob-op-dot {
    width: 5px; height: 5px; border-radius: 50%; background: rgba(255,255,255,0.3);
    transition: all 0.2s ease;
  }
  .mob-op-dot.active { background: #fff; transform: scale(1.5); box-shadow: 0 0 8px rgba(255,255,255,0.5); }

  /* BACK TO TOP BUTTON (One Piece Feed) */
  #mob-op-btt {
    position: absolute; bottom: 20px; left: 50%; transform: translateX(-50%) translateY(10px);
    background: rgba(255,255,255,0.12);
    backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255,255,255,0.15);
    color: #fff; border-radius: 50px;
    padding: 10px 20px; font-size: 11px; font-weight: 700;
    text-transform: uppercase; letter-spacing: 0.08em;
    display: flex; align-items: center; gap: 8px;
    opacity: 0; pointer-events: none;
    transition: all 0.4s cubic-bezier(0.32, 0.72, 0, 1);
    z-index: 30;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    -webkit-tap-highlight-color: transparent;
  }
  #mob-op-btt.visible { opacity: 1; pointer-events: auto; transform: translateX(-50%) translateY(0); }
  #mob-op-btt:active { transform: translateX(-50%) scale(0.95); background: rgba(255,255,255,0.2); }
  #mob-op-btt svg { width: 14px; height: 14px; stroke-width: 3; }

  /* BOTTOM NAVIGATION BAR */
  #mob-bottom-bar {
    display: flex; height: calc(var(--mob-bar-h) + env(safe-area-inset-bottom, 0px));
    padding-bottom: env(safe-area-inset-bottom, 0px); padding-top: 6px;
    background: rgba(6, 6, 9, 0.98);
    backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
    border-top: 1px solid rgba(255,255,255,0.07);
    justify-content: space-around; flex-shrink: 0;
    z-index: 50; 
  }
  .mob-nav-item {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
    flex: 1; min-width: 44px; color: rgba(255,255,255,0.36);
    background: none; border: none; position: relative;
    transition: color 0.15s ease, transform 0.1s ease;
    -webkit-tap-highlight-color: transparent;
  }
  .mob-nav-item:active { transform: scale(0.85); }
  .mob-nav-item.active { color: #fff; }
  .mob-nav-item.active::before {
    content: ''; position: absolute; top: 0; left: 50%; transform: translateX(-50%);
    width: 20px; height: 3px; border-radius: 0 0 3px 3px;
    background: linear-gradient(90deg, var(--mob-accent), var(--mob-accent2));
  }
  .mob-nav-label { font-size: 9px; font-weight: 600; text-transform: uppercase; white-space: nowrap; }
  .mob-nav-cats { display: flex; flex: 3; justify-content: center; }
  .mob-nav-cats .mob-nav-item { min-width: 36px; max-width: 68px; }

  /* MORE MENU OVERLAY (Fixed for Smoothness) */
  #mob-sheet-overlay { 
    position: fixed; inset: 0; z-index: 99999; 
    display: flex !important; /* Always flex, use visibility to allow transition */
    visibility: hidden; pointer-events: none;
  }
  #mob-sheet-overlay.open { visibility: visible; pointer-events: auto; }
  #mob-sheet-backdrop { 
    position: absolute; inset: 0; background: rgba(0,0,0,0.6); 
    backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); 
    opacity: 0; transition: opacity 0.35s ease; 
  }
  #mob-sheet-overlay.open #mob-sheet-backdrop { opacity: 1; }
  #mob-sheet { 
    position: absolute; bottom: 0; left: 0; right: 0; 
    background: rgba(10,10,14,0.98); border-radius: 22px 22px 0 0; 
    border-top: 1px solid rgba(255,255,255,0.09); 
    padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 28px); 
    max-height: 82dvh; overflow-y: auto; -webkit-overflow-scrolling: touch; 
    transform: translateY(100%); transition: transform 0.4s var(--mob-spring); 
  }
  #mob-sheet-overlay.open #mob-sheet { transform: translateY(0); }
  
  .mob-sheet-handle { width: 36px; height: 4px; border-radius: 2px; background: rgba(255,255,255,0.15); margin: 12px auto 8px; }
  .mob-sheet-row { display: flex; align-items: center; gap: 14px; padding: 14px 20px; color: rgba(255,255,255,0.88); font-size: 15px; font-weight: 500; text-decoration: none; border-radius: 12px; margin: 2px 8px; }
  .mob-sheet-row-icon { width: 40px; height: 40px; border-radius: 10px; background: rgba(255,255,255,0.06); border: 1px solid rgba(255,255,255,0.09); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
  .mob-sheet-row-label { flex: 1; }
  .mob-sheet-row-chevron { color: rgba(255,255,255,0.22); font-size: 20px; }
  .mob-sheet-divider { height: 1px; background: rgba(255,255,255,0.06); margin: 6px 20px; }
  .mob-sheet-follow-header { font-size: 10px; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: rgba(255,255,255,0.28); padding: 10px 20px 4px; }
  .mob-sheet-socials { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; padding: 8px 14px 4px; }
  .mob-social-btn { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 14px 6px; background: rgba(255,255,255,0.04); border: 1px solid rgba(255,255,255,0.08); border-radius: 14px; color: rgba(255,255,255,0.78); text-decoration: none; font-size: 9.5px; font-weight: 600; }

  /* CONTENT OVERLAY (Fixed for Smoothness) */
  #mob-content-overlay { 
    position: fixed; inset: 0; background: #000; z-index: 100000; 
    display: flex !important;
    visibility: hidden; pointer-events: none;
    transform: translateY(100%); transition: transform 0.4s var(--mob-spring), visibility 0.4s;
    flex-direction: column; 
  }
  #mob-content-overlay.visible { visibility: visible; pointer-events: auto; transform: translateY(0); }
  #mob-content-inner { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; padding-bottom: 24px; }
  #mob-content-topbar { display: flex; align-items: center; gap: 12px; padding: 14px 16px 10px; position: sticky; top: 0; background: rgba(0,0,0,0.95); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); border-bottom: 1px solid rgba(255,255,255,0.06); z-index: 10; }
  #mob-content-back { display: flex; align-items: center; justify-content: center; width: 36px; height: 36px; border-radius: 50%; background: rgba(255,255,255,0.07); border: 1px solid rgba(255,255,255,0.1); color: #fff; border: none; }
  #mob-content-title { font-size: 1rem; font-weight: 700; color: #fff; flex: 1; }
  #mob-content-body { padding: 0 1.25rem; }
  .mob-content-section-wrap .max-w-7xl { padding: 0 !important; max-width: 100% !important; }
  .mob-content-section-wrap .md\:grid-cols-12, .mob-content-section-wrap .md\:grid-cols-2 { grid-template-columns: 1fr !important; gap: 2rem !important; }
  .mob-content-section-wrap h2 { font-size: 1.4rem !important; }

  /* SWIPE CUE */
  #mob-swipe-cue {
    display: flex; position: absolute; bottom: 22px; left: 50%; transform: translateX(-50%);
    z-index: 20; gap: 8px; pointer-events: none; align-items: center;
    animation: mob-cue-fadein 0.5s ease both; white-space: nowrap;
  }
  .mob-swipe-arrow { animation: mob-swipe-shimmer 1.6s ease-in-out infinite; flex-shrink: 0; }
  .mob-swipe-text { font-size: 10px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: rgba(255,255,255,0.72); text-shadow: 0 0 14px rgba(99,102,241,0.85), 0 1px 4px rgba(0,0,0,1); }
}


@keyframes mob-swipe-shimmer { 0%,100% { opacity: 0.4; transform: translateX(-4px); } 50% { opacity: 1; transform: translateX( 4px); } }
@keyframes mob-cue-fadein { from { opacity: 0; transform: translate(-50%, 8px); } to { opacity: 1; transform: translate(-50%, 0); } }

/* ══════════════════════════════════════════════════════════
   REDESIGNED MOBILE MODAL (Reference Image Match)
══════════════════════════════════════════════════════════ */
@media (max-width: 767px) {
  .mob-modal-redesign {
    position: fixed; inset: 0;
    height: 100dvh; width: 100%;
    background: #1c1c1e; /* Grey background for over-scroll bounce */
    z-index: 100010;
    display: flex; flex-direction: column;
    overflow: hidden;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    overscroll-behavior: none;
    -webkit-overflow-scrolling: auto;
  }

  .mob-modal-header {
    position: absolute; top: 0; left: 0; right: 0;
    height: 70px; display: flex; align-items: center; justify-content: space-between;
    padding: 0 20px; z-index: 100;
    background: transparent;
    pointer-events: none;
  }
  .mob-modal-header-title {
    color: #fff; font-size: 1.25rem; font-weight: 600;
    text-shadow: 0 2px 10px rgba(0,0,0,0.5);
    pointer-events: auto;
  }
  .mob-modal-header-close {
    width: 36px; height: 36px; border-radius: 50%;
    background: rgba(255,255,255,0.85); border: none;
    color: #000; font-size: 18px; display: flex; align-items: center; justify-content: center;
    pointer-events: auto; backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
  }

  .mob-modal-3d-section {
    position: absolute; inset: 0;
    width: 100%; height: 100%;
    display: flex; 
    align-items: flex-start; /* Align media to the top */
    justify-content: center;
    background: #000;
    -webkit-mask-image: linear-gradient(to bottom, black 0%, black 85%, transparent 100%);
    mask-image: linear-gradient(to bottom, black 0%, black 85%, transparent 100%);
    overflow: hidden; touch-action: none;
    z-index: 1;
    padding-top: 0; /* Removed top padding */
    padding-bottom: 0; 
    box-sizing: border-box;
    transition: opacity 0.5s cubic-bezier(0.32, 0.72, 0, 1);
    will-change: opacity;
  }

  .mob-modal-3d-section.blurred {
    opacity: 0.3;
  }

  .mob-modal-3d-section-main {
    position: relative;
    z-index: 2;
    width: 100%;
    height: auto; /* Allow natural height for top alignment */
    max-height: 100%;
    display: flex;
    align-items: flex-start;
    justify-content: center;
  }


  .mob-swipe-hint-detail {
    position: absolute; bottom: 23dvh; left: 50%; transform: translateX(-50%);
    display: flex; flex-direction: column; align-items: center; gap: 4px;
    color: rgba(255,255,255,0.6); pointer-events: none;
    z-index: 2;
    transition: opacity 0.3s ease;
  }
  .mob-modal-info-sheet.expanded ~ .mob-modal-3d-section .mob-swipe-hint-detail {
    opacity: 0;
  }
  .mob-swipe-hint-detail-text { font-size: 11px; font-weight: 500; letter-spacing: 0.05em; text-shadow: 0 2px 4px rgba(0,0,0,0.5); }
  .mob-swipe-hint-icon {
    display: flex; align-items: center; gap: 4px;
  }

  /* ── COOL SWIPE ANIMATION ── */
  .mob-swipe-cool-wrap {
    position: relative; width: 60px; height: 30px;
    display: flex; align-items: center; justify-content: center;
  }
  .mob-swipe-cool-track {
    width: 40px; height: 2px;
    background: rgba(255,255,255,0.1);
    border-radius: 2px; position: relative;
  }
  .mob-swipe-cool-orb {
    position: absolute; top: 50%; left: 0;
    width: 12px; height: 12px;
    background: #fff; border-radius: 50%;
    transform: translate(-50%, -50%);
    box-shadow: 0 0 15px #fff, 0 0 5px #fff;
    animation: mob-orb-swipe 2s infinite cubic-bezier(0.45, 0.05, 0.55, 0.95);
  }
  @keyframes mob-orb-swipe {
    0% { left: 100%; opacity: 0; transform: translate(-50%, -50%) scale(0.5); }
    20% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
    80% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
    100% { left: 0%; opacity: 0; transform: translate(-50%, -50%) scale(0.5); }
  }

  .mob-modal-info-sheet {
    position: absolute; bottom: 0; left: 0; right: 0;
    height: 85dvh; /* Always take full expanded height in DOM */
    background: rgba(28, 28, 30, 0.7);
    backdrop-filter: blur(25px); -webkit-backdrop-filter: blur(25px);
    border-radius: 32px 32px 0 0;
    padding: 12px 20px 40px;
    display: flex; flex-direction: column; gap: 20px;
    overflow: hidden; /* Lock scroll */
    touch-action: none; /* Absolutely prevent native scrolling on mobile */
    box-sizing: border-box;
    box-shadow: 0 -10px 40px rgba(0,0,0,0.5);
    z-index: 10;
    transition: transform 0.45s cubic-bezier(0.32, 0.72, 0, 1), background 0.45s ease;
    scrollbar-width: none;
    overscroll-behavior: contain;
    border: 1px solid rgba(255,255,255,0.08);
    border-bottom: none;
    will-change: transform; /* Hardware acceleration for zero lag */
  }
  .mob-modal-info-sheet.expanded { 
    background: rgba(28, 28, 30, 0.98); 
    overflow: hidden !important; /* Completely disable internal scrolling */
    padding-bottom: 40px;
  }
  .mob-modal-info-sheet::-webkit-scrollbar { display: none; }

  /* ── FULL CONTENT ALWAYS VISIBLE ── */
  .mob-modal-info-sheet .mob-cta-row,
  .mob-modal-info-sheet .mob-software-section {
    display: flex !important;
  }

  .mob-modal-info-sheet .mob-modal-desc-body {
    display: block;
    overflow: visible;
    opacity: 1;
  }


  .mob-sheet-drag-handle {
    width: 36px; height: 4px; border-radius: 2px;
    background: rgba(255,255,255,0.15);
    margin: 4px auto 8px; flex-shrink: 0;
  }

  .mob-modal-desc-title { color: #fff; font-size: 1.2rem; font-weight: 700; margin-bottom: 8px; }
  .mob-modal-desc-body { color: rgba(255,255,255,0.7); font-size: 0.95rem; line-height: 1.55; }

  /* ── SWIPE UP HINT ── */
  .mob-swipe-up-hint {
    display: flex; flex-direction: column; align-items: center; gap: 4px;
    margin-bottom: 4px; opacity: 1; transition: opacity 0.3s ease;
    margin-top: -4px;
  }
  .mob-swipe-up-hint.hidden { display: none; }
  .mob-swipe-up-text {
    font-size: 10px; font-weight: 700; color: rgba(255,255,255,0.4);
    text-transform: uppercase; letter-spacing: 0.1em;
  }
  .mob-swipe-up-arrow {
    width: 12px; height: 12px; stroke: rgba(255,255,255,0.4);
    animation: mob-swipe-up-bounce 1.5s infinite;
  }
  @keyframes mob-swipe-up-bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-4px); }
  }

  .mob-cta-row { display: flex; gap: 12px; width: 100%; margin-top: 4px; }
  .mob-cta-btn {
    flex: 1; height: 42px; border-radius: 12px;
    display: flex; align-items: center; justify-content: center; gap: 8px;
    font-size: 13px; font-weight: 600; color: #fff; text-decoration: none;
    border: none; cursor: pointer; transition: transform 0.1s;
    line-height: 1;
  }
  .mob-cta-btn:active { transform: scale(0.97); }
  .mob-btn-timelapse { background: #3a3a3c; }
  .mob-btn-instagram { background: linear-gradient(45deg, #f09433 0%, #e6683c 25%, #dc2743 50%, #cc2366 75%, #bc1888 100%); }

  .mob-software-section { margin-top: 4px; display: flex; flex-direction: column; gap: 12px; }
  .mob-software-title { color: #fff; font-size: 1.15rem; font-weight: 700; margin-bottom: 0; }
  .mob-software-list { display: flex; flex-wrap: wrap; gap: 10px; }
  .mob-software-badge {
    display: flex; align-items: center; gap: 8px;
    padding: 8px 14px; border-radius: 12px;
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.1);
    color: rgba(255,255,255,0.85); font-size: 13px; font-weight: 500;
  }
  .mob-software-badge img { width: 18px; height: 18px; object-fit: contain; }
}

/* Modals & Full-Screen Image Overlay */
.modal-backdrop, #modal-root > div { z-index: 100010 !important; }
#fs-overlay { z-index: 100020 !important; }
