:root {
  --bg1: #0a0c14;
  --bg2: #111827;
  --text: #e5e7eb;
  --muted: #9ca3af;
  --accent: #7c3aed;
  --radius: 16px;
  --shadow: 0 4px 24px rgba(0,0,0,0.4);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Inter", system-ui, Arial, sans-serif;
  background:
    linear-gradient(135deg, rgba(15, 23, 42, 0.88) 0%, rgba(37, 99, 235, 0.55) 100%),
    url("/assets/images/MSL_BACKGROUND.png") center center / cover no-repeat fixed;
  color: var(--text);
  min-height: 100vh;
  background-attachment: fixed;
  background-position: center center;
}

/* === GENERAL === */
.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 24px;
}

/* === TOPBAR === */
.topbar {
  position: sticky;
  top: 0;
  z-index: 1000;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 24px;
  background: rgba(2, 6, 23, 0.3);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(255,255,255,0.08);
  box-shadow: 0 2px 20px rgba(0,0,0,0.3);
}

.topbar-left { display: flex; align-items: center; gap: 10px; }
.topbar-logo { height: 40px; width: 40px; border-radius: 8px; }
.topbar-title { font-size: 1.3rem; color: #fff; letter-spacing: 0.5px; }
.topbar-title .font-bold { font-weight: 700; color: #fff; }

.topbar-links { display: flex; align-items: center; gap: 16px; }
.topbar-link { color: #e5e7eb; text-decoration: none; font-weight: 500; transition: color 0.2s; }
.topbar-link:hover { color: #93c5fd; }

.topbar-btn {
  background: #ff0000;
  color: #fff;
  padding: 8px 16px;
  border-radius: 8px;
  text-decoration: none;
  font-weight: 600;
  transition: opacity 0.2s, transform 0.2s;
}
.topbar-btn:hover { background: #cc0000; transform: translateY(-2px); opacity: 0.95; }

/* === MOBILE === */
.hamburger { display: none; font-size: 1.8rem; color: white; background: none; border: none; cursor: pointer; }
.mobile-menu {
  display: none;
  position: fixed;
  top: 64px;
  left: 0;
  width: 100%;
  background: rgba(2, 6, 23, 0.95);
  backdrop-filter: blur(8px);
  flex-direction: column;
  align-items: center;
  padding: 20px;
  gap: 14px;
  z-index: 999;
}
.mobile-item {
  color: #e5e7eb;
  text-decoration: none;
  font-size: 1.1rem;
  padding: 10px 20px;
  border-radius: 8px;
  transition: background 0.3s;
}
.mobile-item:hover { background: rgba(124, 58, 237, 0.2); }
.menu-open .mobile-menu { display: flex; }
@media (max-width: 768px) { .topbar-links { display: none; } .hamburger { display: block; } }

/* === CARDS === */
.card {
  background: rgba(17,24,39,0.65);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
  backdrop-filter: blur(8px);
  margin-top: 24px;
}

/* === BUTTONS === */
.btn {
  display: inline-block;
  padding: 12px 20px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.2);
  text-decoration: none;
  color: var(--text);
  transition: 0.2s ease;
}
.btn:hover { opacity: 0.85; transform: translateY(-2px); }
.btn-primary { background: var(--accent); color: white; border: none; }
.btn-primary[href*="youtube.com"], .btn-primary[href*="youtu.be"],
.btn[href*="youtube.com"], .btn[href*="youtu.be"] {
  background: #ff0000 !important;
  color: #fff !important;
  border: none !important;
}
.btn-primary[href*="youtube.com"]:hover, .btn-primary[href*="youtu.be"]:hover,
.btn[href*="youtube.com"]:hover, .btn[href*="youtu.be"]:hover {
  background: #cc0000 !important;
  opacity: 0.95;
  transform: translateY(-2px);
}


/* === FEATURED VIDEOS === */
.grid.grid-2 {
  display: grid;
  gap: 24px;
}
@media (min-width: 900px) {
  .grid.grid-2 {
    grid-template-columns: 1fr 1fr;
    align-items: start;
  }
}

.video-card {
  text-align: left;
}

.video-card h3 {
  font-size: 1.15rem;
  font-weight: 600;
  margin-top: 10px;
  margin-bottom: 4px;
  color: #f1f5f9;
}
.video-card .video-desc {
  font-size: 0.9rem;
  line-height: 1.6;
  color: #a1a1aa;
  margin-bottom: 14px;
}
.video-card img.responsive {
  cursor: pointer;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}
.video-card img.responsive:hover {
  transform: scale(1.03);
  box-shadow: 0 0 25px rgba(124, 58, 237, 0.6); /* neon blue glow */
}

/* === HERO LOGO EFFECT === */
img[alt="M SPACE LOG hero"] {
  transition: transform 0.4s ease, box-shadow 0.4s ease;
  box-shadow: 0 0 20px rgba(124, 58, 237, 0.25);
}

img[alt="M SPACE LOG hero"]:hover {
  transform: scale(1.05);
  box-shadow: 0 0 45px rgba(124, 58, 237, 0.7);
}

/* Video hero hover & glow */
video.hero-float {
  box-shadow: 0 0 20px rgba(124, 58, 237, 0.25);
  transition: transform 0.4s ease, box-shadow 0.4s ease;
}
video.hero-float:hover {
  transform: scale(1.03);
  box-shadow: 0 0 40px rgba(124, 58, 237, 0.6);
}



/* === PARALLAX & HERO FLOAT === */
.hero-float { transform: translateY(0); transition: transform 0.3s ease-out; will-change: transform; }
body.scrolled .hero-float { transform: translateY(-8px); }

/* === ANIMATIONS (Fade + Slide) === */
.fade-slide {
  opacity: 0;
  transform: translateY(30px);
  transition: all 0.8s ease-out;
}
.fade-slide.in-view {
  opacity: 1;
  transform: translateY(0);
}
.slide-left.in-view { animation: slideLeft 0.8s ease-out forwards; }
.slide-right.in-view { animation: slideRight 0.8s ease-out forwards; }

@keyframes slideLeft {
  from { opacity: 0; transform: translateX(-50px); }
  to { opacity: 1; transform: translateX(0); }
}
@keyframes slideRight {
  from { opacity: 0; transform: translateX(50px); }
  to { opacity: 1; transform: translateX(0); }
}

.fade-slide.in-view {
  animation-delay: calc(var(--i, 0) * 0.1s);
}

/* === MOBILE RESPONSIVE FIXES === */
@media (max-width: 768px) {
  /* Stack grid cards vertically on mobile */
  .grid.grid-2 {
    grid-template-columns: 1fr;
  }

  /* Ensure images scale inside the viewport */
  img.responsive, video.responsive {
    max-width: 100%;
    height: auto;
    border-radius: 12px;
  }

  /* Prevent hero image from overflowing */
  .hero-float {
    max-width: 90% !important;
    margin: 0 auto;
  }

  /* Center video cards */
  .video-card {
    text-align: center !important;
  }

  .video-card img.responsive {
    max-width: 95%;
    margin: 0 auto;
  }
}


/* === FOOTER === */
.footer {
  margin-top: 60px;
  padding: 20px 0;
  text-align: center;
  font-size: 14px;
  color: var(--muted);
}

/* === Force all YouTube buttons to red === */
a[href*="youtube.com"].btn-primary,
a[href*="youtube.com"].btn,
a[href*="youtu.be"].btn-primary,
a[href*="youtu.be"].btn {
  background-color: #ff0000 !important;
  border: none !important;
  color: #fff !important;
}

a[href*="youtube.com"].btn-primary:hover,
a[href*="youtube.com"].btn:hover,
a[href*="youtu.be"].btn-primary:hover,
a[href*="youtu.be"].btn:hover {
  background-color: #cc0000 !important;
  transform: translateY(-2px);
  opacity: 0.95;
}

/* Limit large logos like msl lamp or tools */
img[alt="M SPACE LOG logo"],
img[alt="Digital Products"] {
  max-width: 60px;
  height: auto;
}

.card:hover {
  transform: translateY(-4px);
  box-shadow: 0 0 20px rgba(124, 58, 237, 0.25);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}


/* === PRODUCT IMAGE FIX === */
.product-image {
  max-width: 90%;
  height: auto;
  margin: 0 auto;
  display: block;
  border-radius: 12px;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  box-shadow: 0 0 20px rgba(124, 58, 237, 0.25);
}

.product-image:hover {
  transform: scale(1.03);
  box-shadow: 0 0 35px rgba(124, 58, 237, 0.6);
}

/* Keep animation and parallax uniform with index */
.fade-slide {
  opacity: 0;
  transform: translateY(30px);
  transition: all 0.8s ease-out;
}
.fade-slide.in-view {
  opacity: 1;
  transform: translateY(0);
  animation-delay: calc(var(--i, 0) * 0.1s);
}
.slide-left.in-view { animation: slideLeft 0.8s ease-out forwards; }
.slide-right.in-view { animation: slideRight 0.8s ease-out forwards; }

@keyframes slideLeft {
  from { opacity: 0; transform: translateX(-50px); }
  to { opacity: 1; transform: translateX(0); }
}
@keyframes slideRight {
  from { opacity: 0; transform: translateX(50px); }
  to { opacity: 1; transform: translateX(0); }
}

