/* Mobile Layout Fixes for Android Firefox Compatibility */

/* CRITICAL: Mobile Performance - Prevent video loading on mobile devices */
@media (max-width: 768px) {
  /* Hide all videos on mobile to force static images */
  #hero-video,
  #hero-video-2,
  #hero-video-3,
  .background-video {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    pointer-events: none !important;
  }
  
  /* Show hero poster image instead */
  #hero-poster {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    border-radius: 12px !important;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1) !important;
  }
  
  /* Hide sound toggle on mobile */
  #sound-toggle {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
  }
  
  /* Force enterprise section static background */
  .enterprise-ai {
    background: linear-gradient(135deg, rgba(248, 244, 240, 0.95) 0%, rgba(232, 221, 212, 0.95) 100%) !important;
    min-height: 600px !important;
    position: relative !important;
  }
  
  /* Center team member role subtitle on mobile */
  .team-member .role {
    text-align: center !important;
  }
  
  .enterprise-ai::before {
    content: '' !important;
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    background-image: url('/images/robot-group-mobile.webp') !important;
    background-size: cover !important;
    background-position: center top !important;
    background-repeat: no-repeat !important;
    opacity: 0.15 !important;
    z-index: -1 !important;
  }
}

/* Prevent horizontal scrolling on mobile */
html, body {
  overflow-x: hidden;
  max-width: 100vw;
}

/* Ensure all containers respect viewport width */
* {
  max-width: 100%;
}

/* Fix for wide elements that cause horizontal scroll */
.container, .hero, .features-section, .journal-pages-container {
  max-width: 100vw;
  overflow-x: hidden;
}

/* Container mobile improvements */
@media (max-width: 768px) {
  .container {
    max-width: 100vw;
    overflow-x: hidden;
    width: 100%;
    box-sizing: border-box;
  }
}

/* Footer text contrast fixes for Android Firefox */
@media (max-width: 768px) {
  /* Simplify footer text for better mobile compatibility */
  body:not(.homepage) .footer-content .footer-section h3,
  body:not(.homepage) .footer-content .footer-section a {
    background: none !important;
    background-clip: initial !important;
    -webkit-background-clip: initial !important;
    -webkit-text-fill-color: white !important;
    color: white !important;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.9) !important;
    opacity: 1 !important;
    font-weight: 500 !important;
  }
  
  body:not(.homepage) .footer-content .footer-section a:hover {
    background: none !important;
    background-clip: initial !important;
    -webkit-background-clip: initial !important;
    -webkit-text-fill-color: #cfdcff !important;
    color: #cfdcff !important;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.9) !important;
  }

  /* Footer bottom links enhanced contrast */
  body:not(.homepage) .copyright,
  body:not(.homepage) .footer-bottom-links a,
  body:not(.homepage) .privacy-settings-link {
    color: white !important;
    background: none !important;
    -webkit-text-fill-color: white !important;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.9) !important;
    opacity: 1 !important;
    font-weight: 500 !important;
  }
}

/* Hero section mobile improvements */
@media (max-width: 768px) {
  .hero-content {
    width: 100%;
    max-width: 100vw;
    overflow-x: hidden;
  }
  
  .hero-text {
    max-width: 100%;
  }
  
  .hero-visual {
    margin: 0 auto;
    max-width: 300px;
  }
  
  .hero h1 {
    word-wrap: break-word;
    overflow-wrap: break-word;
    hyphens: auto;
    line-height: 1.2;
  }
}

/* Journal pages mobile fixes - ONLY apply on mobile screens */
@media (max-width: 768px) {
  .journal-pages-container {
    margin: 0 auto;
    overflow: visible;
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    position: relative;
  }
  
  .journal-page {
    position: relative !important;
    width: 32px;
    max-width: 32px;
    min-width: 32px;
    height: 280px;
    margin: 0 1px;
    transform: none !important;
    border-radius: 0 3px 3px 0;
    display: inline-block;
    flex-shrink: 0;
  }
  
  /* Create bookshelf effect - show pages as book spines */
  .journal-page:first-child {
    border-radius: 3px 0 0 3px;
  }
  
  .journal-page:last-child {
    border-radius: 0 3px 3px 0;
  }
  
  /* Center the entire journal section */
  .davinci-journal-showcase {
    display: flex;
    flex-direction: column;
    text-align: center;
    gap: 0;
    flex: 0;
  }
  
  /* Better journal navigation layout on mobile */
  .journal-navigation {
    margin-bottom: 1.5rem !important;
    margin-top: 1.5rem !important;
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
    gap: 1rem !important;
  }
  
  .journal-nav-button {
    background: rgba(45, 60, 52, 0.1) !important;
    border: 1px solid rgba(45, 60, 52, 0.2) !important;
    border-radius: 4px !important;
    padding: 8px 12px !important;
    font-size: 14px !important;
    color: #2d3c34 !important;
    cursor: pointer !important;
    transition: all 0.3s ease !important;
  }
  
  .journal-nav-button:hover {
    background: rgba(45, 60, 52, 0.2) !important;
    transform: translateY(-1px) !important;
  }
}

/* Preserve desktop journal page positioning */
@media (min-width: 769px) {
  .journal-page {
    position: absolute;
    width: 250px;
    height: 350px;
    transform: initial;
  }
  
  .journal-pages-container {
    position: relative;
    width: 100%;
    max-width: 350px;
    height: 500px;
    perspective: 1000px;
    margin-top: 80px;
    overflow: visible;
  }
}

/* Prevent text overflow everywhere */
@media (max-width: 768px) {
  p, h1, h2, h3, h4, h5, h6, span, div {
    word-wrap: break-word;
    overflow-wrap: break-word;
    hyphens: auto;
  }
  
  /* Force text wrapping in navigation */
  nav a, .nav-button {
    word-wrap: break-word;
    overflow-wrap: break-word;
  }
}

/* Blog post mobile improvements */
@media screen and (max-width: 768px) {
  .blog-content {
    padding: 1.5rem;
    margin: 0 0.5rem;
    overflow-x: hidden;
  }
  
  .content-body {
    overflow-x: hidden;
  }
  
  .content-body pre {
    overflow-x: auto;
    max-width: 100%;
    white-space: pre-wrap;
    word-wrap: break-word;
  }
  
  .content-body img {
    max-width: 100% !important;
    height: auto;
  }
  
  .content-body table {
    display: block;
    overflow-x: auto;
    white-space: nowrap;
  }
}

/* Fix absolute positioned elements on mobile */
@media (max-width: 768px) {
  .hero-visual {
    position: relative !important;
  }
  
  /* Ensure no elements extend beyond viewport */
  .panel-art,
  .background-sketches,
  .sacred-geometry-bg {
    max-width: 100vw;
    overflow: hidden;
  }
}

/* Typography improvements for small screens */
@media (max-width: 480px) {
  .hero h1 {
    font-size: 2rem !important;
    line-height: 1.1;
  }
  
  .hero-description {
    font-size: 1rem;
    line-height: 1.5;
  }
  
  .post-title {
    font-size: 1.6rem !important;
    line-height: 1.2;
  }
}

/* Fix mobile section title and subtitle layout - Match hero sizing */
@media (max-width: 768px) {
  /* All section titles match hero h1 sizing and alignment */
  .features-section h2,
  .section-title,
  .enterprise-ai h2,
  .team-section h2,
  .signup-section h2,
  .ai-for-good-text h2,
  .contact-header h2,
  .expert-answers-content h2,
  h2 {
    font-size: 2.5rem !important;
    line-height: 1.2 !important;
    margin-bottom: 1rem !important;
    margin-top: 2rem !important;
    text-align: left !important;
    word-wrap: break-word !important;
    overflow-wrap: break-word !important;
    hyphens: auto !important;
    padding: 0 !important; /* Let parent section handle padding */
  }
  
  /* Ensure all section containers match hero margins */
  .features-section,
  .enterprise-ai,
  .team-section,
  .signup-section,
  .ai-for-good-text,
  .contact-header,
  .expert-answers-content,
  section {
    padding-left: 1rem !important;
    padding-right: 1rem !important;
  }
  
  /* Force line break for Enterprise AI title on mobile */
  .features-section h2 {
    white-space: normal !important;
  }
  
  /* Control desktop vs mobile title display */
  .enterprise-title .desktop-title {
    display: none !important;
  }
  
  .enterprise-title .mobile-title {
    display: block !important;
    font-size: 2.5rem !important;
    line-height: 1.2 !important;
    text-align: left !important;
    margin: 2rem 0 1rem 0 !important;
    padding: 0 !important; /* Let parent section handle padding */
  }
  
  .enterprise-title .mobile-title br {
    display: block !important;
  }
  
  /* Features section title mobile control */
  .features-header h2 .desktop-title {
    display: none !important;
  }
  
  .features-header h2 .mobile-title {
    display: block !important;
    font-size: 2.5rem !important;
    line-height: 1.2 !important;
    text-align: left !important;
    margin: 0 !important;
    padding: 0 !important;
  }
  
  .features-header h2 .mobile-title br {
    display: block !important;
  }
  
  /* All subtitle/description text match hero subtitle sizing and alignment */
  .features-section p,
  .section-description,
  .section-intro,
  .enterprise-ai p,
  .team-section p,
  .signup-section p,
  .signup-intro,
  .ai-for-good-text p,
  .contact-header p,
  .expert-answers-content p,
  .hero-section + section p:first-of-type,
  .features-section .section-description {
    font-size: 1.2rem !important;
    line-height: 1.5 !important;
    margin-bottom: 2rem !important;
    margin-top: 0 !important;
    text-align: left !important;
    padding: 0 !important; /* Same as headers - no extra padding */
    word-wrap: break-word !important;
    overflow-wrap: break-word !important;
    max-width: 100% !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
  }
  
  /* Ensure subtitles have no extra margin/padding differences from headers */
  .enterprise-ai .section-intro,
  .features-section .section-description {
    padding-left: 0 !important;
    padding-right: 0 !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
  }
  
  /* Adjust spacing between sections on mobile */
  .enterprise-ai {
    margin-top: 1.5rem !important; /* Reduced space from hero */
  }
  
  /* Move enterprise header (title and subtitle) up to overlap video */
  .enterprise-header {
    position: relative !important;
    z-index: 10 !important;
    margin-bottom: -100px !important; /* Pull panels up over video */
    margin: 0 2em;
  }
  
  /* Adjust panels container to overlap video background */
  .circular-panels-wrapper {
    position: relative !important;
    z-index: 10 !important;
    margin-top: 150px !important; /* Position panels properly on mobile */
  }
  
  .features-section {
    /* padding-top: 0.5rem !important; */
    clear: both !important;
    position: relative !important;
    z-index: 2 !important;
  }
  
  .hero + section {
    margin-top: 1.5rem !important; /* Reduced space from hero */
    padding-top: 0.5rem !important;
    clear: both !important;
    position: relative !important;
    z-index: 2 !important;
  }
  
  /* Fix any overlapping with video strips */
  .video-strip,
  .background-videos {
    margin-bottom: 2rem !important;
    position: relative !important;
    z-index: 1 !important;
  }
  
  /* Reduce section spacing */
  .section-spacing {
    padding-bottom: 1rem !important;
  }
}

/* Extra small screens match hero sizing (480px) */
@media (max-width: 480px) {
  /* All section titles match hero h1 on small screens */
  .features-section h2,
  .section-title,
  .enterprise-ai h2,
  .team-section h2,
  .signup-section h2,
  .ai-for-good-text h2,
  .contact-header h2,
  .expert-answers-content h2,
  .enterprise-title .mobile-title,
  h2 {
    font-size: 2rem !important;
    line-height: 1.1 !important;
    margin-bottom: 1rem !important;
  }
  
  /* All subtitles match hero description on small screens */
  .features-section p,
  .section-description,
  .section-intro,
  .enterprise-ai p,
  .team-section p,
  .signup-section p,
  .signup-intro,
  .ai-for-good-text p,
  .contact-header p,
  .expert-answers-content p {
    font-size: 1rem !important;
    line-height: 1.5 !important;
  }
}

/* Fix dropdown positioning on mobile */
@media (max-width: 768px) {
  .language-switcher-dropdown {
    position: fixed;
    left: 50% !important;
    transform: translateX(-50%) !important;
    max-width: 90vw;
  }
  
  .privacy-dropdown-content {
    left: 0 !important;
    transform: none !important;
    min-width: 140px;
    max-width: 90vw;
  }
}

/* Transparency and backdrop filter fixes for Android Firefox */
@media (max-width: 768px) {
  /* Remove complex backdrop filters that may not work on Android Firefox */
  .glass-effect,
  .backdrop-blur {
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
  }
  
  /* Simplify transparency effects */
  .language-switcher-dropdown {
    background-color: rgba(255, 255, 255, 0.98) !important;
    backdrop-filter: none !important;
  }
  
  /* Ensure proper contrast for transparent elements */
  .overlay-text {
    background-color: rgba(255, 255, 255, 0.9);
    padding: 0.5rem;
    border-radius: 4px;
  }
}

/* Safe area adjustments for mobile browsers */
@media (max-width: 768px) {
  .container {
    padding-left: max(1rem, env(safe-area-inset-left));
    padding-right: max(1rem, env(safe-area-inset-right));
  }
  
  header {
    padding-left: max(2rem, env(safe-area-inset-left));
    padding-right: max(2rem, env(safe-area-inset-right));
  }
}

/* iOS-specific fixes for footer background and video controls */
@supports (-webkit-appearance: none) {
  /* iPhone/Safari specific fixes */
  @media (max-width: 768px) {
    /* Fix footer background stretching on iOS */
    body:not(.homepage) .site-footer {
      background-size: cover, cover, cover, 100% 100% !important;
      background-attachment: local, local, local, local !important;
      -webkit-background-size: cover, cover, cover, 100% 100% !important;
      will-change: auto !important;
      transform: translateZ(0) !important;
    }
    
    /* Prevent background blur on iOS */
    body:not(.homepage) .site-footer::before {
      -webkit-backface-visibility: hidden !important;
      backface-visibility: hidden !important;
      transform: translateZ(0) !important;
    }
    
    /* Ensure video controls work properly on iOS */
    #hero-video {
      -webkit-playsinline: true !important;
      playsinline: true !important;
      -webkit-appearance: none !important;
    }
    
    /* Fix background videos on iOS */
    .background-video {
      -webkit-playsinline: true !important;
      playsinline: true !important;
      -webkit-appearance: none !important;
      -webkit-transform: translateZ(0) !important;
      transform: translateZ(0) !important;
    }
    
    /* Ensure video container doesn't cause issues on iOS */
    .video-background-container {
      -webkit-transform: translateZ(0) !important;
      transform: translateZ(0) !important;
      -webkit-backface-visibility: hidden !important;
      backface-visibility: hidden !important;
    }
    
    /* iOS video control styling */
    #sound-toggle {
      -webkit-appearance: none !important;
      appearance: none !important;
      -webkit-touch-callout: none !important;
      -webkit-user-select: none !important;
      touch-action: manipulation !important;
    }
  }
}

/* Force GPU acceleration for smoother animations on mobile */
@media (max-width: 768px) {
  .journal-page,
  .hero-visual,
  .cta-button {
    transform: translateZ(0);
    will-change: transform;
  }
}

/* Contact panels text color improvements */
@media (max-width: 768px) {
  /* Make contact panel text more readable with white color */
  .contact-method h3 {
    color: #f8f4f0 !important;
  }
  
  .contact-method p {
    color: #f8f4f0 !important;
    opacity: 0.9 !important;
  }
  
  .contact-link {
    color: #f8f4f0 !important;
  }
  
  .contact-link:hover {
    color: #cfdcff !important;
    border-bottom-color: #cfdcff !important;
  }
}

/* Apply contact text color improvements to all screen sizes */
.contact-method h3 {
  color: #f8f4f0 !important;
}

.contact-method p {
  color: #f8f4f0 !important;
  opacity: 0.9 !important;
}

.contact-link {
  color: #f8f4f0 !important;
}

.contact-link:hover {
  color: #cfdcff !important;
  border-bottom-color: #cfdcff !important;
}

.features-section {
  margin-top: 1rem !important;
  padding-top: 1rem !important;
}

/* Desktop-specific spacing adjustments */
@media (min-width: 769px) {
  
  /* Add more space after hero and create proper section spacing */
  .enterprise-ai {
    margin-top: 4rem !important; /* Much more space from hero */
    padding-top: 2rem !important;
  }
  
  .enterprise-header {
    position: relative !important;
    z-index: 10 !important;
    margin-bottom: -100px !important; /* Pull panels up over video on desktop */
  }
  
  .circular-panels-wrapper {
    margin: 150px auto 0 auto !important;
    position: relative !important;
    z-index: 10 !important;
  }
  
  .video-background-container {
    top: calc(56% + 0px) !important;
  }
}

/* Mobile video strip panels layout */
@media (max-width: 768px) {
  /* Remove horizontal padding from circular panels wrapper on mobile */
  .circular-panels-wrapper {
    padding-left: 0 !important;
    padding-right: 0 !important;
  }

  .enterprise-ai .video-background-container {
    top: calc(62% + 0px);
  }
  
  /* Show 2 panels stacked vertically, full width matching section headers */
  .panels-container {
    grid-template-columns: 1fr !important;
    grid-template-rows: auto auto !important;
    gap: 1rem !important;
    margin: 0 !important;
    padding-left: 1rem !important; /* Match section container padding */
    padding-right: 1rem !important; /* Match section container padding */
    padding-top: 0 !important;
    padding-bottom: 0 !important;
    min-height: auto !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }
  
  /* Hide panels 2 and 4 on mobile, show 1 and 3 */
  .panels-container .panel:nth-child(2),
  .panels-container .panel:nth-child(4) {
    display: none !important;
  }
  
  /* Reset panel positioning for mobile */
  .panels-container .panel:nth-child(1),
  .panels-container .panel:nth-child(3) {
    margin-top: 0 !important;
    position: static !important;
    z-index: auto !important;
  }
  
  /* Adjust panel styling for mobile - full width matching headers exactly */
  .panel {
    padding: 1.5rem !important; /* Internal content padding only */
    min-height: 200px !important;
    border-radius: 8px !important;
    width: 100% !important;
    box-sizing: border-box !important;
    margin: 0 !important;
  }
  
  /* Adjust panel text for mobile */
  .panel h3 {
    font-size: 1.1rem !important;
    margin-bottom: 0.5rem !important;
  }
  
  .panel p {
    font-size: 0.9rem !important;
    line-height: 1.4 !important;
  }
  
  /* Scale down panel art for mobile */
  .panel-art {
    width: 60px !important;
    height: 60px !important;
  }
  
  .panels-container .panel:nth-child(1) .panel-art {
    top: -5px !important;
    left: -5px !important;
    width: 60px !important;
    height: 60px !important;
  }
  
  .panels-container .panel:nth-child(3) .panel-art {
    bottom: -5px !important;
    left: -5px !important;
    width: 60px !important;
    height: 60px !important;
  }
}

/* Mobile Navigation and Header Improvements */
@media (max-width: 768px) {
  /* Clean mobile header layout */
  header {
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 2rem;
    flex-wrap: wrap;
    gap: 1rem;
  }
  
  /* Logo stays on left */
  .logo {
    flex: 0 0 auto;
  }
  
  /* Position language switcher absolute in top right */
  .header-actions {
    position: absolute;
    top: 1rem;
    right: 1rem;
    z-index: 10002;
  }
  
  .language-switcher {
    position: relative;
  }
  
  /* Hide header demo button - use navigation one instead */
  .mobile-demo-button {
    display: none !important;
  }
  
  /* Navigation takes full width below logo */
  nav {
    flex: 1 1 100%;
    order: 2;
    margin-top: 0.5rem;
  }
  
  nav ul {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 1rem;
    align-items: center;
    margin: 0;
    padding: 0;
  }
  
  nav ul li {
    margin: 0;
    list-style: none;
  }
  
  /* Hide specific items on mobile */
  .mobile-hide {
    display: none !important;
  }
  
  /* Show mobile-only items */
  .mobile-only {
    display: inline-block !important;
  }
  
  /* Style mobile demo button as regular nav item */
  .mobile-only a {
    background: #cfdcff;
    color: #2d3c34;
    border: 2px solid #cfdcff;
    border-radius: 20px;
    padding: 0.5rem 1rem;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.3s ease;
    white-space: nowrap;
  }
  
  .mobile-only a:hover {
    background: #b8ccff;
    border-color: #b8ccff;
    transform: translateY(-1px);
  }
}

/* Desktop Header Layout - Fix positioning */
@media (min-width: 769px) {
  .mobile-only {
    display: none !important;
  }
  
  .mobile-hide {
    display: block !important;
  }
  
  /* Restore proper desktop header layout */
  header {
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    flex-wrap: nowrap !important;
    padding: 2rem 4rem !important;
    gap: 0 !important;
  }
  
  .logo {
    flex: 0 0 auto !important;
    order: 1 !important;
  }
  
  nav {
    flex: 1 1 auto !important;
    order: 2 !important;
    margin: 0 !important;
    display: flex !important;
    justify-content: center !important;
  }
  
  .header-actions {
    flex: 0 0 auto !important;
    order: 3 !important;
    position: static !important;
    display: flex !important;
    align-items: center !important;
    gap: 1rem !important;
    top: auto !important;
    right: auto !important;
  }
  
  .language-switcher {
    position: static !important;
  }
  
  /* Show desktop demo button, hide mobile one */
  .mobile-demo-button {
    display: inline-block !important;
  }
  
  /* Desktop title display */
  .enterprise-title .desktop-title {
    display: block !important;
  }
  
  .enterprise-title .mobile-title {
    display: none !important;
  }
  
  /* Features section desktop title display */
  .features-header h2 .desktop-title {
    display: block !important;
  }
  
  .features-header h2 .mobile-title {
    display: none !important;
  }
}

/* Mobile Video Fixes - Allow all videos but control via JavaScript */
@media (max-width: 768px) {
  /* Let JavaScript handle video visibility on mobile */
  #hero-video-2,
  #hero-video-3 {
    opacity: 0;
    pointer-events: none;
  }
  
  #hero-video {
    opacity: 1;
  }
  
  /* Reduce space between header and hero section on mobile */
  .hero {
    padding-top: 1rem !important;
    margin-top: 0 !important;
  }
  
  .hero-content {
    margin-top: 0 !important;
    padding-top: 0 !important;
    gap: 1rem !important;
  }
  
  /* Fix hero-image container sizing on mobile */
  .hero-image {
    flex: none !important;
    width: 100% !important;
    max-width: 400px !important;
    height: 300px !important;
    aspect-ratio: 4/3 !important;
    margin: 1rem auto !important; /* Reduced from 2rem to 1rem */
    position: relative;
    overflow: hidden;
  }
  
  /* Ensure first video shows poster frame on mobile */
  #hero-video {
    poster: url('/images/Davinci_the_painter_painting_a_robot_in_a_line_art.png');
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    position: absolute;
    top: 0;
    left: 0;
  }
  
  /* Also fix the poster image */
  .davinci-image {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    position: absolute;
    top: 0;
    left: 0;
  }
  
  .hero-video {
    max-width: 100%;
    height: auto;
  }
  
  /* Disable complex video cycling on mobile for better performance */
  .background-video {
    display: none;
  }
  
  /* Show only the default background video on mobile */
  #background-video-default {
    display: block;
  }
  
  /* Fix mobile features section layout */
  .features-grid {
    display: flex !important;
    flex-direction: column !important;
    gap: 2rem !important;
    align-items: center !important;
    text-align: center !important;
    padding: 0 1rem !important;
  }
  
  .feature-item {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    text-align: center !important;
    max-width: 280px !important;
  }
  
  .feature-item h3 {
    margin-top: 1rem !important;
    margin-bottom: 0.5rem !important;
    font-size: 1.3rem !important;
    line-height: 1.2 !important;
  }
  
  .feature-item p {
    margin-top: 0.5rem !important;
    line-height: 1.4 !important;
    font-size: 0.95rem !important;
  }
  
  /* Center CTA buttons better on mobile - side by side */
  .cta-buttons {
    display: flex !important;
    flex-direction: column !important;
    gap: 0.5rem !important;
    align-items: center !important;
    justify-content: center !important;
    margin: 0.3rem auto 0 auto !important;
    padding: 0 1rem !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }
  
  /* Only target CTA buttons in the hero section */
  .hero .cta-button,
  .hero .primary-button,
  .hero .secondary-button {
    width: 300px !important;
    max-width: 85% !important;
    text-align: center !important;
    justify-content: center !important;
    align-items: center !important;
    display: flex !important;
    white-space: nowrap !important;
    margin: 0 auto !important;
  }
  
  /* Extra specific override for Request demo button centering */
  .hero .cta-buttons .primary-button {
    text-align: center !important;
    justify-content: center !important;
    align-items: center !important;
    display: flex !important;
  }
  
  /* Keep header Request demo button normal size */
  .mobile-demo-button,
  header .cta-button {
    width: auto !important;
    max-width: none !important;
    margin: 0 !important;
    min-width: 120px !important;
    font-size: 0.85rem !important;
    padding: 0.5rem 1rem !important;
  }
  
  /* Ensure sound toggle button is visible and functional on mobile */
  #sound-toggle {
    display: block !important;
    position: absolute !important;
    bottom: 10px !important;
    right: 10px !important;
    z-index: 1000 !important;
    background: rgba(45, 60, 52, 0.8) !important;
    color: white !important;
    border: none !important;
    border-radius: 4px !important;
    padding: 8px 16px !important;
    font-size: 12px !important;
    font-weight: 600 !important;
    cursor: pointer !important;
    opacity: 0.9 !important;
    transition: all 0.3s ease !important;
    pointer-events: auto !important;
    user-select: none !important;
  }
  
  #sound-toggle:hover,
  #sound-toggle:focus,
  #sound-toggle:active {
    opacity: 1 !important;
    background: rgba(45, 60, 52, 0.95) !important;
    transform: translateY(-1px) !important;
  }
}

/* Static Images Mode - Show static backgrounds when videos are disabled */
.enterprise-ai.static-images-mode {
  background: linear-gradient(135deg, #f8f4f0 0%, #e8ddd4 100%);
  background-size: cover;
  background-position: center;
  position: relative;
  min-height: 600px;
}

.enterprise-ai.static-images-mode::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  /* Modern browsers with WebP support */
  background-image: url('/images/robot-group-mobile.webp');
  background-image: image-set(
    url('/images/robot-group-mobile.webp') type('image/webp'),
    url('/images/robot-group-mobile.png') type('image/png')
  );
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  opacity: 0.2;
  z-index: -1;
}

/* Optimize static image for mobile */
@media (max-width: 768px) {
  .enterprise-ai.static-images-mode::before {
    background-size: contain;
    background-position: center center;
    opacity: 0.1;
    background-repeat: no-repeat;
  }
  
  .enterprise-ai.static-images-mode {
    min-height: 400px;
    background: linear-gradient(135deg, rgba(248, 244, 240, 0.95) 0%, rgba(232, 221, 212, 0.95) 100%);
  }
}

/* iPhone 12 Pro specific fixes (390px width) */
@media (max-width: 400px) {
  /* Header positioning fixes */
  .header-actions {
    right: 0.5rem !important;
    top: 0.8rem !important;
    z-index: 1000 !important;
  }
  
  .language-switcher-current {
    font-size: 0.75rem !important;
    padding: 0.25rem 0.5rem !important;
    white-space: nowrap !important;
  }
  
  /* Logo positioning on very small screens */
  .logo {
    margin-left: 0.5rem !important;
  }
  
  .logo img {
    max-height: 35px !important;
    width: auto !important;
  }
  
  .logo span {
    font-size: 1.1rem !important;
  }
  
  /* Navigation fixes for iPhone 12 Pro */
  nav ul {
    padding-right: 0.5rem !important;
    margin: 0 !important;
  }
  
  nav ul li {
    margin: 0 0.3rem !important;
  }
  
  nav ul li a {
    font-size: 0.85rem !important;
    padding: 0.3rem 0.5rem !important;
  }
  
  /* Hero section adjustments */
  .hero-content {
    padding: 0.5rem !important;
    gap: 0.8rem !important;
  }
  
  .hero-text h1 {
    font-size: 1.6rem !important;
    line-height: 1.1 !important;
    margin-bottom: 0.8rem !important;
  }
  
  .hero-text p {
    font-size: 0.9rem !important;
    line-height: 1.4 !important;
    margin-bottom: 1rem !important;
  }
  
  /* Feature list in hero - better spacing */
  .hero .features {
    gap: 0.5rem !important;
    margin: 1rem 0 !important;
  }
  
  .hero .feature {
    font-size: 0.8rem !important;
    align-items: center !important;
    justify-content: flex-start !important;
    text-align: left !important;
    display: flex !important;
    flex-direction: row !important;
    gap: 0.3rem !important;
  }
  
  .hero .feature-icon {
    font-size: 1.5rem !important;
    min-width: 1.5rem !important;
    max-width: 1.5rem !important;
    height: 1.5rem !important;
    margin-right: 0 !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    flex-shrink: 0 !important;
  }
  
  /* Make heart icon specifically smaller */
  .hero .feature-icon-heart {
    font-size: 0.75rem !important;
  }
  
  /* Disable hyphenation for hero feature text - better mobile readability */
  .hero .feature-text {
    hyphens: none !important;
    word-break: keep-all !important;
    overflow-wrap: break-word !important;
    line-height: 1.3 !important;
  }
  
  /* Ensure feature containers can wrap naturally */
  .hero .feature {
    flex-wrap: wrap !important;
    max-width: 100% !important;
    margin-bottom: 0.2rem !important;
    padding: 0.1rem 0 !important;
  }
  
  /* Mobile layout for hero features - allow third item to wrap */
  .hero .features {
    display: flex !important;
    flex-wrap: wrap !important;
    justify-content: flex-start !important;
    gap: 0.1rem !important;
    margin: 0.3rem auto 0.4rem auto !important;
    max-width: 300px !important;
  }
  
  /* First two features on same row, third on new line */
  .hero .feature:nth-child(1),
  .hero .feature:nth-child(2) {
    flex: 1 1 calc(50% - 0.5rem) !important;
    min-width: 0 !important;
  }
  
  .hero .feature:nth-child(3) {
    flex: 1 1 100% !important;
    justify-self: flex-start !important;
  }
}

/* Force mobile hero layout on all mobile devices */
@media (max-width: 480px) {
  .hero .features {
    display: flex !important;
    flex-wrap: wrap !important;
    justify-content: flex-start !important;
    gap: 0.1rem !important;
    margin: 0.3rem auto 0.4rem auto !important;
    max-width: 300px !important;
  }
  
  .hero .feature:nth-child(1),
  .hero .feature:nth-child(2) {
    flex: 1 1 calc(50% - 0.5rem) !important;
    min-width: 0 !important;
    margin-bottom: 0.2rem !important;
    padding: 0.1rem 0 !important;
  }
  
  .hero .feature:nth-child(3) {
    flex: 1 1 100% !important;
    justify-self: flex-start !important;
    margin-bottom: 0.2rem !important;
    padding: 0.1rem 0 !important;
  }
  
  /* CTA buttons - more touch-friendly */
  .cta-buttons {
    flex-direction: column !important;
    gap: 0.5rem !important;
    align-items: stretch !important;
  }
  
  .primary-button,
  .secondary-button {
    min-height: 44px !important;
    font-size: 0.9rem !important;
    padding: 0.7rem 1.2rem !important;
    border-radius: 8px !important;
  }
  
  /* Enterprise section title */
  .enterprise-title .mobile-title {
    font-size: 1.6rem !important;
    line-height: 1.1 !important;
  }
  
  /* Panel text in enterprise section */
  .panel h3 {
    font-size: 1rem !important;
    line-height: 1.2 !important;
    margin-bottom: 0.5rem !important;
  }
  
  .panel p {
    font-size: 0.8rem !important;
    line-height: 1.3 !important;
  }
  
  /* Features section title */
  .features-header h2 .mobile-title {
    font-size: 1.6rem !important;
    line-height: 1.1 !important;
  }
  
  /* Journal pages - ensure they fit */
  .journal-pages-container {
    padding: 0 0.5rem !important;
    overflow-x: visible !important;
  }
  
  .journal-page {
    min-width: 28px !important;
    width: 28px !important;
    margin: 0 0.5px !important;
  }
  
  /* Prevent text overflow on small screens */
  * {
    word-wrap: break-word !important;
    overflow-wrap: break-word !important;
  }
  
  /* Improve touch targets */
  button, a, [role="button"] {
    min-height: 44px !important;
    min-width: 44px !important;
  }
  
  /* Footer adjustments */
  .footer-content {
    padding: 1rem 0.5rem !important;
  }
  
  .footer-section {
    margin-bottom: 1rem !important;
  }
  
  .footer-section h3 {
    font-size: 1rem !important;
    margin-bottom: 0.5rem !important;
  }
  
  .footer-section a {
    font-size: 0.85rem !important;
    line-height: 1.4 !important;
  }
}

/* Ensure static mode content is visible */
.enterprise-ai.static-images-mode .enterprise-header,
.enterprise-ai.static-images-mode .circular-panels-wrapper {
  position: relative;
  z-index: 2;
}

/* Hero poster image styling when videos are disabled */
#hero-poster {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: inherit;
}

/* Alternative approach: Create a mobile-specific navigation layout */
@media (max-width: 768px) {
  .mobile-nav-container {
    display: flex;
    flex-direction: column;
    width: 100%;
  }
  
  .mobile-nav-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
  }
  
  .mobile-nav-items {
    display: flex;
    gap: 1rem;
    align-items: center;
  }
}\n\n/* Additional iPhone 12 Pro fixes for specific viewport issues */
@media (max-width: 390px) {
  /* Ensure no horizontal scrolling on exact iPhone 12 Pro width */
  html {
    overflow-x: hidden !important;
    max-width: 100vw !important;
  }
  
  body {
    overflow-x: hidden !important;
    max-width: 100vw !important;
    position: relative !important;
  }
  
  /* Fix hero image container that might overflow */
  .hero-image {
    max-width: 350px !important;
    margin: 0.5rem auto !important;
  }
  
  /* Constrain wide SVG elements */
  .background-sketches,
  .feature-bg-sketch {
    max-width: 100vw !important;
    overflow: hidden !important;
  }
  
  /* Fix enterprise panels container */
  .circular-panels-wrapper {
    max-width: 100% !important;
    overflow: hidden !important;
    padding: 0 0.5rem !important;
  }
  
  .panels-container {
    max-width: 100% !important;
    gap: 0.5rem !important;
  }
  
  /* Journal showcase container */
  .davinci-journal-showcase {
    max-width: 100% !important;
    overflow: hidden !important;
    padding: 0 0.25rem !important;
  }
  
  /* Language switcher dropdown positioning */
  .language-switcher-dropdown {
    right: 0 !important;
    left: auto !important;
    min-width: 200px !important;
    max-width: 280px !important;
  }
  
  /* Fix any potentially wide flex containers */
  .features-container,
  .enterprise-content,
  .hero-content {
    max-width: 100vw !important;
    box-sizing: border-box !important;
  }
  
  /* Fix potential horizontal scroll from sections */
  section {
    max-width: 100vw !important;
    overflow-x: hidden !important;
    box-sizing: border-box !important;
  }
  
  /* Improve team section on iPhone 12 Pro */
  .team-grid {
    grid-template-columns: 1fr !important;
    gap: 1rem !important;
    padding: 0 0.5rem !important;
  }
  
  /* Fix footer width issues */
  .site-footer {
    max-width: 100vw !important;
    overflow-x: hidden !important;
  }
  
  .footer-content {
    max-width: 100% !important;
    padding: 1rem 0.5rem !important;
  }
}

/* Extra fixes for very narrow screens (iPhone SE and smaller) */
@media (max-width: 375px) {
  .hero-text h1 {
    font-size: 1.4rem !important;
  }
  
  .enterprise-title .mobile-title,
  .features-header h2 .mobile-title {
    font-size: 1.4rem !important;
  }
  
  .journal-page {
    min-width: 24px !important;
    width: 24px !important;
  }
  
  .logo span {
    font-size: 1rem !important;
  }
  
  nav ul li a {
    font-size: 0.8rem !important;
    padding: 0.25rem 0.4rem !important;
  }
}