/* ═══════════════════════════════════════════════════════════════════════════
   PyStatR+ MOBILE FIXES
   Final Version - January 2026
   
   Issues Addressed:
   1. Horizontal overflow (white bars on sides)
   2. Team section image cropping and layout
   3. Membership card text overflow
   4. Article/blog page top padding
   5. Footer column hiding on mobile
   
   USAGE: Add after styles.css in _quarto.yml
   ═══════════════════════════════════════════════════════════════════════════ */

/* ==========================================================================
   1. GLOBAL OVERFLOW FIX - Prevents white bars on sides
   ========================================================================== */

html {
  overflow-x: hidden;
}

body {
  overflow-x: hidden;
  width: 100%;
  max-width: 100vw;
}

/* Fix sections that might extend beyond viewport */
.section-team-wrapper,
.section-team-dark,
.section-ethics-wrapper,
.section-blog-wrapper,
.membership-section,
[class*="section-"] {
  max-width: 100vw;
  overflow-x: hidden;
}

/* ==========================================================================
   2. MOBILE ONLY STYLES (max-width: 767px)
   ========================================================================== */

@media only screen and (max-width: 767px) {

  /* -------------------------------------------------------------------------
     2a. OVERFLOW & CONTAINER FIXES
     ------------------------------------------------------------------------- */
  
  * {
    max-width: 100vw;
  }
  
  .container {
    padding-left: 1rem !important;
    padding-right: 1rem !important;
    max-width: 100% !important;
  }
  
  .section-team-dark,
  .section-ethics-dark,
  .section-blog-dark {
    margin-left: 0 !important;
    margin-right: 0 !important;
    border-radius: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
  }
  
  /* Remove wrapper padding that causes white bars */
  .section-team-wrapper,
  .section-ethics-wrapper,
  .section-blog-wrapper {
    padding-left: 0 !important;
    padding-right: 0 !important;
  }

  /* -------------------------------------------------------------------------
     2b. TEAM SECTION - Image cropping for faces
     ------------------------------------------------------------------------- */
  
  .team-grid-2col {
    grid-template-columns: 1fr !important;
    gap: 1.5rem !important;
  }
  
  .team-card-horizontal {
    flex-direction: column !important;
    margin: 0 !important;
  }
  
  .team-photo-side {
    width: 100% !important;
    height: 320px !important;
    min-height: 320px !important;
    max-height: 400px !important;
  }
  
  .team-photo-img {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    object-position: center 25% !important; /* Show faces - adjusted from top */
  }
  
  .team-info-side {
    width: 100% !important;
    padding: 1.5rem !important;
  }

  /* -------------------------------------------------------------------------
     2c. MEMBERSHIP CARD - Text overflow fix
     ------------------------------------------------------------------------- */
  
  .membership-card,
  .pricing-card,
  [class*="membership"] {
    max-width: 100% !important;
    margin-left: 0.5rem !important;
    margin-right: 0.5rem !important;
    padding: 1.5rem 1rem !important;
    overflow-wrap: break-word !important;
    word-wrap: break-word !important;
  }
  
  .membership-card li,
  .pricing-card li {
    padding-right: 0.5rem !important;
    word-break: break-word !important;
  }

  /* -------------------------------------------------------------------------
     2d. FOOTER - Hide navigation columns
     ------------------------------------------------------------------------- */
  
  .footer-column {
    display: none !important;
  }
  
  .footer-grid {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    gap: 1.5rem !important;
  }
  
  .footer-brand {
    display: block !important;
    text-align: center !important;
    max-width: 100% !important;
  }
  
  .footer-logo {
    justify-content: center !important;
  }
  
  .footer-social {
    justify-content: center !important;
  }
  
  .footer-bottom {
    flex-direction: column !important;
    text-align: center !important;
    gap: 1rem !important;
  }
  
  .footer-legal {
    justify-content: center !important;
    flex-wrap: wrap !important;
  }

  /* -------------------------------------------------------------------------
     2e. SECTION TITLES - Prevent text cutoff
     ------------------------------------------------------------------------- */
  
  .section-title,
  [class*="-title"] {
    word-wrap: break-word !important;
    overflow-wrap: break-word !important;
    hyphens: auto !important;
    padding-left: 0.5rem !important;
    padding-right: 0.5rem !important;
  }
}

/* ==========================================================================
   3. HERO SECTION TOP PADDING FIX
   ========================================================================== */

/* Fix for hero sections - label/content too close to navbar on mobile */
@media only screen and (max-width: 767px) {
  
  /* Generic hero sections - minimal adjustment */
  .hero-section,
  [class*="-hero"] {
    padding-top: calc(60px + 0.5rem) !important;
  }
}

/* ==========================================================================
   4. ARTICLE/BLOG PAGE TOP PADDING
   ========================================================================== */

/* Fix for Quarto article pages - content too close to navbar */
@media only screen and (max-width: 767px) {
  
  /* Article content needs space below fixed navbar */
  .quarto-title-block,
  #title-block-header,
  article > section:first-child,
  article > h1:first-child,
  article > h2:first-child,
  main.content > section:first-child,
  #quarto-content > section:first-child {
    padding-top: 1rem !important;
    margin-top: 0.5rem !important;
  }
  
  /* When there's no title block, add space to first element */
  article > *:first-child {
    margin-top: 1rem !important;
  }
}

/* ==========================================================================
   5. TABLET STYLES (768px - 1024px) - Restore footer
   ========================================================================== */

@media only screen and (min-width: 768px) {
  
  .footer-column {
    display: block !important;
  }
  
  .footer-grid {
    display: grid !important;
  }
}

/* ==========================================================================
   6. ADDITIONAL SAFETY OVERFLOWS
   ========================================================================== */

/* Ensure dark sections don't cause horizontal scroll */
.section-team-dark,
.section-ethics-dark,
.section-blog-dark,
.section-final-cta,
.section-final-cta-v2,
.footer {
  overflow-x: hidden !important;
}

/* Images should never exceed container */
img {
  max-width: 100%;
  height: auto;
}

/* Tables can cause overflow - make them scrollable */
@media only screen and (max-width: 767px) {
  table {
    display: block;
    overflow-x: auto;
    max-width: 100%;
  }
  
  pre {
    overflow-x: auto;
    max-width: 100%;
  }
  
  code {
    word-break: break-word;
  }
}

/* ==========================================================================
   7. DONATE PAGE - Hide Logo Container & Fix Label on Mobile
   ========================================================================== */

@media only screen and (max-width: 767px) {
  
  /* Hide the pulsating heart logo on mobile */
  .donate-hero-logo-container {
    display: none !important;
  }
  
  /* Fix the hero label - add top padding and center */
  .donate-hero-label {
    display: inline-block !important;
    width: auto !important;
    max-width: none !important;
    padding: 0.5rem 1rem !important;
    font-size: 0.7rem !important;
    margin-top: 1.5rem !important;
    margin-bottom: 1rem !important;
  }
  
  /* Fix donate hero stats */
  .donate-hero-stats {
    flex-direction: column !important;
    gap: 1rem !important;
  }
  
  .donate-stat-divider {
    width: 60px !important;
    height: 1px !important;
  }
}

/* ==========================================================================
   8. BLOG PAGE - Hide Logo Container on Mobile
   ========================================================================== */

@media only screen and (max-width: 767px) {
  
  /* Hide the pulsating logo on mobile */
  .blog-hero-logo-container {
    display: none !important;
  }
  
  /* Fix blog hero stats layout */
  .blog-hero-stats {
    flex-direction: column !important;
    gap: 1rem !important;
    align-items: center !important;
  }
  
  .blog-stat-item {
    flex-direction: row !important;
    gap: 0.75rem !important;
  }
  
  .blog-stat-divider {
    width: 60px !important;
    height: 1px !important;
  }
  
  /* Reduce blog hero title size */
  .blog-hero-title {
    font-size: 2rem !important;
  }
  
  .blog-hero-subtitle {
    font-size: 0.95rem !important;
    padding: 0 0.5rem !important;
  }
  
  .blog-hero-label {
    font-size: 0.7rem !important;
  }
}

/* ==========================================================================
   9. CONTACT PAGE - Center "Get in Touch" Label on Mobile
   ========================================================================== */

@media only screen and (max-width: 767px) {
  
  /* Center the contact hero content */
  .contact-hero-content {
    text-align: center !important;
  }
  
  /* Center the hero label */
  .contact-hero-label {
    display: inline-block !important;
    text-align: center !important;
    width: 100% !important;
  }
  
  /* Center title and subtitle */
  .contact-hero-title,
  .contact-hero-subtitle {
    text-align: center !important;
  }
}

/* ==========================================================================
   10. SHOP PAGE - Fix Hero Label Display
   ========================================================================== */

/* Fix for shop hero label appearing as oversized box */
.shop-hero-label,
.shop-hero .shop-hero-label,
section.shop-hero .shop-hero-label {
  display: inline-block !important;
  width: auto !important;
  max-width: none !important;
  height: auto !important;
  min-height: 0 !important;
  padding: 0.5rem 1.25rem !important;
  font-size: 0.7rem !important;
  border-radius: 30px !important;
  background: rgba(16, 185, 129, 0.1) !important;
  border: 1px solid rgba(16, 185, 129, 0.3) !important;
  box-sizing: border-box !important;
  margin-top: 1rem !important;
}

@media only screen and (max-width: 767px) {
  .shop-hero-label,
  .shop-hero .shop-hero-label,
  section.shop-hero .shop-hero-label {
    padding: 0.4rem 1rem !important;
    font-size: 0.6rem !important;
    margin-top: 0.5rem !important;
    margin-bottom: 1rem !important;
  }
  
  /* Fix bottom padding of hero nav section */
  .shop-hero-nav {
    margin-bottom: 1.5rem !important;
    padding-bottom: 0 !important;
  }
  
  .shop-hero-content {
    padding-bottom: 1rem !important;
  }
}
