/* Mobile Fixes CSS - Addresses overflow and layout issues on mobile devices */

/* ============================================
   GLOBAL SCROLLBAR HIDING
   Hides the default browser scrollbar on all pages
   ============================================ */

html {
  scrollbar-width: none; /* Firefox */
  -ms-overflow-style: none; /* IE/Edge */
}

html::-webkit-scrollbar {
  display: none; /* Chrome, Safari, Edge */
}

/* ============================================
   GLOBAL OVERFLOW PREVENTION
   Prevents horizontal scrolling/page swaying
   ============================================ */

html, body {
  overflow-x: hidden !important;
  max-width: 100vw !important;
  width: 100% !important;
}

/* Services/What We Do page - prevent horizontal scroll */
.services-page,
.services-section,
.service-grid,
.services-grid {
  overflow-x: hidden !important;
  max-width: 100% !important;
}

/* Ensure all containers respect viewport width */
.container,
.hero-content,
main,
article {
  max-width: 100%;
  overflow-x: hidden;
}

/* Sections need overflow-y visible to not clip content */
section {
  max-width: 100%;
  overflow-x: hidden;
  overflow-y: visible;
}

/* Exception: Allow dropdown menus to overflow */
header,
header *,
.nav-dropdown,
.nav-dropdown-menu,
.nav-dropdown-menu * {
  overflow: visible !important;
  max-width: none !important;
}

.nav-dropdown-menu {
  height: auto !important;
  max-height: none !important;
}

/* ============================================
   MOBILE BREAKPOINT FIXES (768px and below)
   ============================================ */

@media (max-width: 768px) {
  
  /* Prevent any element from causing horizontal overflow */
  *:not(.nav-dropdown-menu):not(.nav-dropdown-menu *) {
    max-width: 100%;
  }
  
  /* Fix images that might overflow */
  img {
    max-width: 100%;
    height: auto;
  }
  
  /* Fix videos and iframes */
  video,
  iframe {
    max-width: 100%;
  }
  
  /* OnceHub/Calendly scheduler iframe - needs minimum height on mobile */
  .calendly-container iframe,
  iframe[src*="oncehub"],
  iframe[src*="calendly"] {
    min-height: 800px !important;
    height: auto !important;
    width: 100% !important;
  }
  
  /* Fix tables */
  table {
    display: block;
    overflow-x: auto;
    max-width: 100%;
  }
  
  /* Fix pre/code blocks */
  pre, code {
    white-space: pre-wrap;
    word-wrap: break-word;
    max-width: 100%;
  }
  
/* ============================================
   CONTACT US PAGE - Address Fix
   ============================================ */
  
  .contact-info,
  .contact-details,
  .address-section,
  .contact-info-grid,
  .contact-form-grid {
    padding-left: 15px;
    padding-right: 15px;
    word-wrap: break-word;
  }
  
  .contact-info-grid {
    grid-template-columns: 1fr !important;
  }
  
  .contact-form-grid {
    grid-template-columns: 1fr !important;
  }
  /* ============================================
     ESTATE PLANNING PAGE - Our Process Fix
     ============================================ */
  
  .estate-process-grid {
    padding: 0 10px !important;
  }
  
  .estate-process-grid > div {
    flex-direction: column !important;
    gap: 15px !important;
  }
  
  .estate-process-grid table {
    font-size: 12px !important;
  }
  
  .estate-process-grid th,
  .estate-process-grid td {
    padding: 8px !important;
  }
  
  .process-step,
  .step-card {
    max-width: 100%;
    margin-left: 0;
    margin-right: 0;
  }
  
  /* ============================================
     SENTIENT WEALTH PROCESS PAGE - Layout Fix
     ============================================ */
  
  .process-steps-container {
    padding: 0 15px;
    overflow-x: hidden;
  }
  
  /* Hide the tan connecting line on mobile */
  .process-steps-container::before {
    display: none !important;
    opacity: 0 !important;
    visibility: hidden !important;
  }
  
  /* Also hide calendar grid connecting line on mobile */
  .calendar-grid::before {
    display: none !important;
    opacity: 0 !important;
    visibility: hidden !important;
  }
  
  .process-step-inner {
    grid-template-columns: 1fr !important;
    gap: 30px !important;
    padding: 0 15px !important;
  }
  
  .step-content {
    order: 1 !important;
  }
  
  .step-visual,
  .step-image {
    order: 2 !important;
    width: 100% !important;
  }
  
  .step-photo {
    width: 100% !important;
    max-width: 100% !important;
    height: auto !important;
    display: block !important;
  }
  
  /* Ensure process step images are visible */
  .process-step img {
    width: 100% !important;
    max-width: 100% !important;
    height: auto !important;
    display: block !important;
  }
  
  /* Process page - ensure step images show */
  .step-visual img,
  .step-image img,
  .process-image img {
    width: 100% !important;
    max-width: 100% !important;
    height: auto !important;
    min-height: 200px !important;
    display: block !important;
    object-fit: cover !important;
  }
  
  .calendar-grid {
    grid-template-columns: 1fr !important;
    gap: 20px !important;
  }
  
  .flip-card-container {
    width: 100% !important;
  }
  
  /* ============================================
     WHO WE ARE PAGE - Our Values Stacking
     ============================================ */
  
  .values-grid,
  .values-grid-second,
  .values-container,
  .our-values {
    display: flex !important;
    flex-direction: column !important;
    gap: 25px !important;
    max-width: 100% !important;
  }
  
  .value-card,
  .value-item {
    width: 100% !important;
    max-width: 100% !important;
    flex: 1 1 100% !important;
  }
  
  /* ============================================
     WHO WE SERVE PAGE - Red Diamond Fix
     ============================================ */
  
  /* This will be handled inline or with specific class */
  
  /* ============================================
     VIDEOS PAGE - Thumbnail Text Fix
     ============================================ */
  
  .video-grid {
    grid-template-columns: 1fr !important;
    gap: 25px !important;
    padding: 0 15px !important;
    margin: 0 !important;
  }
  
  .video-card {
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
    overflow: hidden !important;
  }
  
  .video-thumbnail {
    width: 100% !important;
    height: 200px !important;
    background-position: left center !important;
    background-size: cover !important;
    margin: 0 !important;
    padding: 0 !important;
    border-radius: 8px 8px 0 0 !important;
    overflow: hidden !important;
  }
  
  /* Fix video thumbnail text overlay cutoff */
  .video-thumbnail-overlay,
  .video-overlay,
  .thumbnail-text {
    padding: 10px !important;
    left: 0 !important;
    right: 0 !important;
    text-align: center !important;
  }
  
  .video-content {
    padding: 15px !important;
  }
  
  .video-title {
    font-size: 18px !important;
    padding: 0 !important;
    margin: 0 0 10px 0 !important;
    word-wrap: break-word;
    overflow-wrap: break-word;
  }
  
  .video-description {
    font-size: 14px !important;
  }
  
  /* ============================================
     INSIGHTS BLOG PAGE - Featured Article Fix
     ============================================ */
  
  .featured-article,
  .featured-post,
  .blog-featured {
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
    padding: 0 15px !important;
    overflow: hidden !important;
  }
  
  .featured-article img,
  .featured-post img,
  .blog-featured img {
    width: 100% !important;
    max-width: 100% !important;
    height: auto !important;
    object-fit: cover !important;
  }
  
  .featured-content,
  .featured-article-content {
    padding: 15px !important;
    width: 100% !important;
  }
  
/* ============================================
   HOMEPAGE - Who We Help Cards Stacking
   ============================================ */
  
  .who-we-help-grid,
  .niches-grid,
  .client-types-grid {
    display: flex !important;
    flex-direction: column !important;
    gap: 20px !important;
    padding: 0 15px;
  }
  
  .niche-card,
  .client-type-card,
  .who-we-help-card {
    width: 100% !important;
    max-width: 100% !important;
  }
  
  /* ============================================
     HOMEPAGE - Hero Video Visibility
     ============================================ */
  
  .hero-video {
    object-fit: cover !important;
    object-position: center top !important;
    width: 100% !important;
    height: 100% !important;
  }
  
  .hero {
    min-height: 100vh;
    display: flex !important;
    align-items: flex-end !important;
  }
  
  .hero-overlay {
    background: linear-gradient(to bottom, 
      rgba(0, 0, 0, 0.05) 0%, 
      rgba(0, 0, 0, 0.1) 30%, 
      rgba(0, 0, 0, 0.35) 60%, 
      rgba(0, 0, 0, 0.55) 100%) !important;
  }
  
  .hero-content {
    padding-top: 30px !important;
    padding-bottom: 40px !important;
  }
  
  .hero h1 {
    font-size: clamp(2rem, 2rem + 1.5vw, 3.5rem) !important;
    margin-bottom: 12px !important;
  }
  
  .hero .subtitle {
    font-size: 0.95rem !important;
    line-height: 1.5 !important;
    margin-bottom: 20px !important;
  }
  
  .hero .hero-cta {
    margin-top: 0 !important;
  }
  
  /* ============================================
     HOMEPAGE - Team Photo Visibility
     ============================================ */
  
  .team-cta-section {
    min-height: 70vh !important;
  }
  
  .team-bg-image,
  [style*="Sentient_Team"] {
    background-size: cover !important;
    background-position: center 30% !important;
  }
  
  .team-cta-section .team-bg-image + div + div {
    height: 30vh !important;
  }
  
  /* Team photo on other pages - show full team */
  section[style*="Sentient_Team"] > div[style*="background-image"],
  div[style*="Sentient_Team.jpg"],
  [style*="Sentient_Team"] {
    background-position: center 30% !important;
    background-size: cover !important;
  }
  
  /* Additional team photo fixes */
  .team-section,
  .team-photo-section {
    background-position: center 30% !important;
  }

  /* Ensure team CTA section has enough height to show team */
  .team-cta-section,
  .cta-section {
    min-height: 50vh !important;
  }
  
  /* Featured article left cutoff fix */
  .featured-article,
  .featured-post,
  .blog-featured,
  .featured-section {
    margin-left: 0 !important;
    margin-right: 0 !important;
    padding-left: 10px !important;
    padding-right: 10px !important;
    box-sizing: border-box !important;
  }
  
  .featured-image,
  .featured-article-image {
    margin: 0 !important;
    padding: 0 !important;
    width: 100% !important;
  }
}

/* ============================================
   SMALLER MOBILE DEVICES (480px and below)
   ============================================ */

@media (max-width: 480px) {
  
  .container {
    padding-left: 15px;
    padding-right: 15px;
  }
  
  /* Ensure text doesn't overflow */
  h1, h2, h3, h4, h5, h6, p, span, a {
    word-wrap: break-word;
    overflow-wrap: break-word;
  }
  
  /* Fix any fixed-width elements */
  [style*="width:"],
  [style*="min-width:"] {
    max-width: 100% !important;
  }
}
