/* ============================================================
   UN THEORY — COSMIC SITE CSS (FIXED NAV, LOGO HEADER & FULL PAN/ZOOM)
   ============================================================ */

/* Reset browser defaults & allow native double-tap, pinch zoom, and 2D viewport panning */
html, body {
    margin: 0;
    padding: 0;
    /* Gives the browser full freedom for native pinch-zoom, double-tap, and single-finger panning */
    touch-action: auto;
}

/* Base body + cosmic background */
body {
    font-family: Arial, sans-serif;
    background: url('copilot_image_1782117868506.jpeg') no-repeat center center fixed;
    background-size: cover;
    background-attachment: fixed;
    color: #fff;
    line-height: 1.6;

    /* Space for fixed nav (~50px) + logo band (180px) + padding */
    padding-top: 250px;
    padding-bottom: 120px;
}

/* 1. NAV BAR — FIXED AT VERY TOP (TOP: 0) */
.main-nav {
    background: #000;
    border-bottom: 2px solid #00aaff;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 3000; /* Highest priority so buttons are never covered */
    box-sizing: border-box;
}

.main-nav ul {
    list-style: none;
    margin: 0;
    padding: 10px 20px;
    display: flex;
    gap: 20px;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
}

.main-nav a {
    color: #00ccff;
    text-decoration: none;
    font-weight: bold;
    font-size: 1rem;
}

.main-nav a:hover {
    color: #fff;
}

.main-nav a.active {
    color: #fff;
    border-bottom: 2px solid #00aaff;
}

/* 2. GREY LOGO BAND — FIXED DIRECTLY BELOW NAV BAR */
.logo-band {
    position: fixed;
    top: 48px; /* Sits right beneath the nav bar border */
    left: 0;
    width: 100%;
    height: 180px;
    background: #222;
    display: flex;
    justify-content: center;
    align-items: center;
    border-bottom: 3px solid #00aaff;
    z-index: 2500;
    box-sizing: border-box;
}

.logo-band img {
    max-height: 150px;
    width: auto;
}

/* MAIN CONTENT — SCROLLS UNDER HEADER */
main {
    max-width: 900px;
    margin: 20px auto 40px auto;
    padding: 30px;
    background: rgba(0, 0, 0, 0.85);
    border-radius: 12px;
    border: 1px solid #334155;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
}

/* TABLE BORDERS & CONTAINER STYLING */
.table-container {
    width: 100%;
    overflow-x: auto;
    margin: 1.5rem 0;
    -webkit-overflow-scrolling: touch;
}

table {
    width: 100%;
    border-collapse: collapse;
    border: 1px solid #00aaff;
    background-color: rgba(15, 23, 42, 0.9);
    color: #e2e8f0;
}

th, td {
    padding: 12px 14px;
    border: 1px solid #334155;
    text-align: left;
}

th {
    background-color: #020617;
    color: #f8fafc;
    font-weight: bold;
    border-bottom: 2px solid #00aaff;
}

tbody tr:nth-child(even) {
    background-color: rgba(30, 41, 59, 0.5);
}

/* FOOTER — FIXED AT BOTTOM */
.site-footer {
    width: 100%;
    background: rgba(0, 0, 0, 0.95);
    border-top: 3px solid #00aaff;
    padding: 20px 0;
    text-align: center;
    font-size: 0.9rem;
    position: fixed;
    bottom: 0;
    left: 0;
    z-index: 2000;
    box-sizing: border-box;
}

.site-footer a {
    color: #00ccff;
    text-decoration: none;
}

.site-footer a:hover {
    text-decoration: underline;
}

/* 3. MOBILE & SMALL SCREEN RESPONSIVE ADJUSTMENTS */
<script>
  let touchStartX = 0, touchStartY = 0;
  const minSwipeDistance = 80;
  const prevPage = "un-theory-comparison.html";
  const nextPage = "unified-theory-of-everything.html";

  document.addEventListener('touchstart', e => { 
    if (e.touches.length > 1) return; // Ignore 2-finger pinch/zoom gestures
    touchStartX = e.touches[0].clientX; 
    touchStartY = e.touches[0].clientY; 
  }, { passive: true });

  document.addEventListener('touchend', e => {
    if (window.visualViewport && window.visualViewport.scale > 1.05) return;

    const distX = e.changedTouches[0].clientX - touchStartX;
    const distY = e.changedTouches[0].clientY - touchStartY;

    // Only redirect if horizontal swipe is distinctly greater than vertical scroll
    if (Math.abs(distX) > Math.abs(distY) * 1.5) {
      if (distX < -minSwipeDistance && nextPage) window.location.href = nextPage;
      if (distX > minSwipeDistance && prevPage) window.location.href = prevPage;
    }
  }, { passive: true });
</script>
