/* Mobile-First CSS Reset with iOS Safari fixes */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  -ms-text-size-adjust: 100%;
  height: 100%;
  /* Force dark background on all mobile browsers */
  background-color: #1a1a1a !important;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background-color: #1a1a1a !important; /* Force dark background */
  color: white !important;
  line-height: 1.6;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  height: 100%;
  position: relative;
  margin: 0;
  padding: 0;
}

/* Navigation - Mobile First with iOS fixes */
.navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  background: rgba(0, 0, 0, 0.9);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  z-index: 1000;
  padding: 15px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.nav-container {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 20px;
}

.nav-logo {
  height: 35px;
  width: auto;
}

/* HIDE desktop menu on mobile */
.nav-menu {
  display: none !important; /* Force hide on mobile */
}

/* SHOW hamburger menu on mobile */
.hamburger-menu {
  display: flex !important; /* Force show on mobile */
  flex-direction: column;
  cursor: pointer;
  padding: 10px;
  position: relative;
  z-index: 1001;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.hamburger-menu .menu {
  width: 25px;
  height: 3px;
  background: white;
  margin: 3px 0;
  transition: 0.3s;
  border-radius: 2px;
}

/* Hamburger animation */
.hamburger-menu.active .menu:nth-child(1) {
  transform: rotate(-45deg) translate(-5px, 6px);
}

.hamburger-menu.active .menu:nth-child(2) {
  opacity: 0;
}

.hamburger-menu.active .menu:nth-child(3) {
  transform: rotate(45deg) translate(-5px, -6px);
}

/* Mobile Navigation Overlay */
.mobile-nav {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100vh;
  height: 100svh;
  background: rgba(0, 0, 0, 0.95);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  z-index: 999;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
  pointer-events: none; /* Prevent interaction when hidden */
}

.mobile-nav.active {
  opacity: 1;
  visibility: visible;
  pointer-events: all; /* Allow interaction when active */
}

.mobile-nav-content {
  display: flex;
  flex-direction: column;
  gap: 30px;
  text-align: center;
  z-index: 1000;
}

.mobile-nav-link {
  color: white;
  text-decoration: none;
  font-size: 1.5rem;
  font-weight: 600;
  padding: 15px 30px;
  border-radius: 10px;
  transition: all 0.3s ease;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.mobile-nav-link:hover,
.mobile-nav-link:active {
  color: #339CFF;
  background: rgba(51, 156, 255, 0.1);
}

/* Hero Section - iOS Safari optimized */
.hero {
  background-color: #1a1a1a !important;
  background-image: url('../assets/images/MiniForgeLabs.jpg') !important;
  background-size: cover !important;
  background-position: center center !important;
  background-repeat: no-repeat !important;
  background-attachment: scroll !important; /* Always scroll on iOS */
  min-height: 100vh !important;
  min-height: 100svh !important; /* Use svh instead of -webkit-fill-available */
  width: 100% !important;
  display: flex !important;
  align-items: flex-end !important;
  justify-content: center !important;
  position: relative !important;
  /* Remove problematic iOS safe area padding */
  padding-bottom: 8vh;
}

/* iOS Safari Specific Fixes */
@supports (-webkit-touch-callout: none) {
  .hero {
    background-attachment: scroll !important;
    min-height: 100vh !important;
    height: auto !important;
    /* Remove the problematic fixed positioning */
  }
  
  body {
    /* Remove the problematic fixed positioning that was blocking the background */
    position: static !important;
    overflow: auto !important;
    height: auto !important;
  }
  
  html {
    height: auto !important;
  }
}

.overlay {
  background-color: rgba(0, 0, 0, 0.3);
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 0;
}

.hero-content {
  position: relative;
  z-index: 1;
  text-align: center;
  width: 100%;
  max-width: 90%;
  padding: 20px;
  margin-bottom: 5vh;
  /* iOS safe area adjustment */
  padding-left: max(20px, env(safe-area-inset-left));
  padding-right: max(20px, env(safe-area-inset-right));
}

.forge-btn {
  background: linear-gradient(45deg, #339CFF, #2986e6);
  border: none;
  padding: 16px 28px;
  color: white;
  font-weight: 600;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.3s ease;
  font-size: 16px;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  box-shadow: 0 4px 15px rgba(51, 156, 255, 0.4);
  margin-bottom: 15px;
  display: block;
  width: 100%;
  max-width: 280px;
  margin-left: auto;
  margin-right: auto;
  min-height: 50px;
  /* iOS specific fixes */
  -webkit-tap-highlight-color: transparent;
  appearance: none;
  -webkit-appearance: none;
  touch-action: manipulation;
  /* Prevent iOS zoom */
  font-size: 16px;
}

.forge-btn:hover,
.forge-btn:focus {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(51, 156, 255, 0.6);
  outline: none;
}

.forge-btn:active {
  transform: translateY(0);
}

.hero-content p {
  font-size: 1.2rem;
  margin: 15px 0 0 0;
  color: #333333;
  text-shadow: 1px 1px 3px rgba(255, 255, 255, 0.8);
  font-weight: 400;
  letter-spacing: 0.5px;
  line-height: 1.4;
}

/* Tablet Styles */
@media (min-width: 768px) {
  .navbar {
    padding-top: 15px;
  }
  
  .nav-container {
    padding: 0 20px;
  }
  
  .nav-logo {
    height: 45px;
  }
  
  .hamburger-menu {
    display: none;
  }
  
  .nav-menu {
    display: flex;
  }
  
  .mobile-nav {
    display: none;
  }
  
  .hero {
    background-attachment: fixed;
    padding-bottom: 0;
  }
  
  .hero-content {
    max-width: 600px;
    margin-bottom: 10vh;
    padding-left: 20px;
    padding-right: 20px;
  }
  
  .forge-btn {
    padding: 18px 35px;
    font-size: 17px;
    max-width: 320px;
  }
  
  .hero-content p {
    font-size: 1.4rem;
  }
}

/* Desktop Styles */
@media (min-width: 1024px) {
  .navbar {
    padding: 20px 0;
  }
  
  .nav-logo {
    height: 50px;
  }
  
  .hero-content {
    max-width: 800px;
    margin-bottom: 12vh;
  }
  
  .forge-btn {
    padding: 20px 40px;
    font-size: 18px;
    letter-spacing: 2px;
    max-width: 350px;
  }
  
  .hero-content p {
    font-size: 1.6rem;
    letter-spacing: 1px;
  }
}

/* Large Desktop */
@media (min-width: 1440px) {
  .nav-container {
    max-width: 1400px;
  }
  
  .hero-content p {
    font-size: 1.8rem;
  }
}

/* iOS Safari Specific Fixes */
@supports (-webkit-touch-callout: none) {
  html {
    height: -webkit-fill-available;
  }
  
  body {
    height: -webkit-fill-available;
    /* Prevent bounce scrolling */
    position: fixed;
    overflow: hidden;
    width: 100%;
  }
  
  .hero {
    background-attachment: scroll !important;
    height: -webkit-fill-available;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }
  
  /* Fix iOS keyboard issues */
  .forge-btn,
  input,
  textarea,
  select {
    font-size: 16px !important;
    appearance: none;
    -webkit-appearance: none;
  }
}

/* Prevent horizontal scroll */
html, body {
  overflow-x: hidden;
  max-width: 100%;
}

/* Fix touch highlighting and selection */
* {
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  -khtml-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
}

input, textarea, button {
  -webkit-user-select: auto;
  -khtml-user-select: auto;
  -moz-user-select: auto;
  -ms-user-select: auto;
  user-select: auto;
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* Fix iOS double-tap zoom */
a, button {
  touch-action: manipulation;
}

/* iOS status bar safe area color */
@media (display-mode: standalone) {
  body {
    padding-top: env(safe-area-inset-top);
  }
}

/* Keep all existing desktop styles, only add mobile-specific fixes */

/* Mobile-only fixes - don't change desktop */
@media (max-width: 767px) {
  /* Fix iOS background image issue */
  .hero {
    background-attachment: scroll !important;
    min-height: 100vh !important;
    min-height: 100svh !important;
  }
  
  /* Remove problematic iOS body positioning */
  body {
    position: static !important;
    overflow: auto !important;
    height: auto !important;
  }
  
  html {
    height: auto !important;
  }
  
  /* Position hamburger menu on top right */
  .hamburger-menu {
    margin-left: auto;
    order: 2;
  }
  
  .nav-logo {
    order: 1;
  }
  
  /* Ensure mobile nav works properly */
  .mobile-nav {
    height: 100vh;
    height: 100svh;
  }
  
  /* Lower the forge button more on mobile only */
  .hero-content {
    margin-bottom: 2vh !important;
    margin-bottom: 2svh !important;
  }
}

/* iOS Safari specific mobile fixes only */
@supports (-webkit-touch-callout: none) {
  @media (max-width: 767px) {
    .hero {
      background-attachment: scroll !important;
      min-height: 100vh !important;
    }
    
    body {
      position: static !important;
      overflow: auto !important;
      height: auto !important;
    }
    
    /* Fix iOS keyboard zoom */
    .forge-btn,
    input,
    textarea,
    select {
      font-size: 16px !important;
    }
  }
}

/* Mobile browser fixes - iOS Safari & Android */
@media screen and (-webkit-min-device-pixel-ratio: 0) {
  /* Android Chrome/WebView */
  body {
    background: #1a1a1a !important;
    background-color: #1a1a1a !important;
  }
  
  html {
    background: #1a1a1a !important;
    background-color: #1a1a1a !important;
  }
  
  @media (max-width: 767px) {
    .nav-menu {
      display: none !important;
    }
    
    .hamburger-menu {
      display: flex !important;
    }
  }
}

/* Desktop - only show desktop menu on larger screens */
@media (min-width: 768px) {
  .nav-menu {
    display: flex !important;
    list-style: none;
    gap: 30px;
  }
  
  .hamburger-menu {
    display: none !important;
  }
  
  .mobile-nav {
    display: none !important;
  }
}

/* iOS Safari ONLY fixes - don't affect other browsers */
@supports (-webkit-touch-callout: none) {
  /* This targets iOS Safari specifically */
  
  /* Force dark background on iOS Safari */
  html {
    background: #1a1a1a !important;
    background-color: #1a1a1a !important;
    height: -webkit-fill-available !important;
  }
  
  body {
    background: #1a1a1a !important;
    background-color: #1a1a1a !important;
    color: white !important;
    height: -webkit-fill-available !important;
    position: static !important;
    overflow: auto !important;
    -webkit-overflow-scrolling: touch;
  }
  
  /* Fix hero section on iOS Safari */
  .hero {
    background-color: #1a1a1a !important;
    background-image: url('../assets/images/MiniForgeLabs.jpg') !important;
    background-size: cover !important;
    background-position: center center !important;
    background-repeat: no-repeat !important;
    background-attachment: scroll !important;
    min-height: 100vh !important;
    min-height: -webkit-fill-available !important;
    width: 100% !important;
    display: flex !important;
    align-items: flex-end !important;
    justify-content: center !important;
    position: relative !important;
  }
  
  /* iOS Safari navigation fixes */
  .navbar {
    background: rgba(0, 0, 0, 0.95) !important;
    -webkit-backdrop-filter: blur(10px) !important;
    backdrop-filter: blur(10px) !important;
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    z-index: 1000 !important;
    padding-top: max(15px, env(safe-area-inset-top)) !important;
  }
  
  /* Force hamburger menu on iOS mobile */
  @media (max-width: 767px) {
    .nav-menu {
      display: none !important;
      visibility: hidden !important;
      opacity: 0 !important;
    }
    
    .hamburger-menu {
      display: flex !important;
      visibility: visible !important;
      opacity: 1 !important;
      flex-direction: column !important;
      cursor: pointer !important;
      padding: 10px !important;
      position: relative !important;
      z-index: 1001 !important;
      -webkit-tap-highlight-color: transparent !important;
      touch-action: manipulation !important;
    }
    
    .hamburger-menu .menu {
      width: 25px !important;
      height: 3px !important;
      background: white !important;
      margin: 3px 0 !important;
      transition: 0.3s !important;
      border-radius: 2px !important;
    }
  }
  
  /* iOS Safari mobile navigation overlay */
  .mobile-nav {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100vh !important;
    height: -webkit-fill-available !important;
    background: rgba(0, 0, 0, 0.98) !important;
    -webkit-backdrop-filter: blur(20px) !important;
    backdrop-filter: blur(20px) !important;
    z-index: 999 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    opacity: 0 !important;
    visibility: hidden !important;
    transition: all 0.3s ease !important;
    padding-top: env(safe-area-inset-top) !important;
    padding-bottom: env(safe-area-inset-bottom) !important;
  }
  
  .mobile-nav.active {
    opacity: 1 !important;
    visibility: visible !important;
  }
  
  .mobile-nav-content {
    display: flex !important;
    flex-direction: column !important;
    gap: 30px !important;
    text-align: center !important;
  }
  
  .mobile-nav-link {
    color: white !important;
    text-decoration: none !important;
    font-size: 1.5rem !important;
    font-weight: 600 !important;
    padding: 15px 30px !important;
    border-radius: 10px !important;
    transition: all 0.3s ease !important;
    -webkit-tap-highlight-color: transparent !important;
    touch-action: manipulation !important;
  }
  
  .mobile-nav-link:hover,
  .mobile-nav-link:active {
    color: #339CFF !important;
    background: rgba(51, 156, 255, 0.1) !important;
  }
  
  /* iOS specific button fixes */
  .forge-btn {
    appearance: none !important;
    -webkit-appearance: none !important;
    -webkit-tap-highlight-color: transparent !important;
    touch-action: manipulation !important;
    font-size: 16px !important; /* Prevent zoom */
  }
  
  /* Fix iOS viewport issues */
  .hero-content {
    padding-left: max(20px, env(safe-area-inset-left)) !important;
    padding-right: max(20px, env(safe-area-inset-right)) !important;
    padding-bottom: max(5vh, env(safe-area-inset-bottom)) !important;
  }
}