/* ===============================================
   Homepage Mobile-First Responsive Styles
   Production-ready CSS for Milivault homepage
   =============================================== */

/* 
   NOTE: If your site uses a fixed header, add this to body:
   body {
     padding-top: 80px;
   }
   Currently, Milivault's header is position: relative, so no body padding needed.
*/

/* Prevent horizontal scrolling on mobile */
body[data-page="home"] {
  overflow-x: hidden;
  max-width: 100vw;
  width: 100%;
  overscroll-behavior-x: contain;
}

body[data-page="home"] * {
  box-sizing: border-box;
  max-inline-size: 100%; /* Prevent inline overflow from long content */
}

/* Ensure images don't cause overflow */
body[data-page="home"] img {
  max-width: 100%;
  height: auto;
}

/* Align homepage header with inner content width */
body[data-page="home"] .header-inner {
  width: auto;
  max-width: 1400px;
  margin: 0 auto;
  padding-left: var(--space-lg, 2rem);
  padding-right: var(--space-lg, 2rem);
}

/* Constrain main-inner on homepage to match content width */
body[data-page="home"] .main-inner {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0;
}

/* Mobile-only: Ensure consistent padding for all sections */
@media (max-width: 767px) {
  body[data-page="home"] .beta-notice {
    padding-left: 1rem;
    padding-right: 1rem;
  }
  
  /* Make header full-width on mobile */
  body[data-page="home"] header {
    max-width: none;
    width: 100%;
  }
  body[data-page="home"] .header-inner {
    padding-left: 1rem;
    padding-right: 1rem;
  }
  
  body[data-page="home"] .hero__inner {
    padding-left: 1rem;
    padding-right: 1rem;
  }
  
  body[data-page="home"] .content-container {
    padding-left: 1rem;
    padding-right: 1rem;
  }
  
  /* Make footer full-width on mobile */
  body[data-page="home"] footer,
  body[data-page="home"] footer > div {
    max-width: none !important;
    width: 100%;
  }
  body[data-page="home"] footer {
    padding-left: 1rem;
    padding-right: 1rem;
  }
}

/* Page container - horizontal padding only, no top padding to avoid double-offset with body */
.page-container {
  max-width: 1800px;
  padding: 0 1.25rem;
  margin: 0 auto;
  width: 100%;
  box-sizing: border-box;
}

/* Content container - add padding since main-inner has none */
.content-container {
  width: 100%;
  padding: 0 var(--space-lg, 2rem);
  box-sizing: border-box;
  overflow-x: hidden; /* Guard against inner overflow */
}

@media (max-width: 767px) {
  .content-container {
    padding: 0 1rem;
  }
}

/* Hero inner container - add padding for content */
.hero__inner {
  width: 100%;
  padding: 0 var(--space-lg, 2rem);
  box-sizing: border-box;
}

@media (max-width: 767px) {
  .hero__inner {
    padding: 0 1rem;
  }
}

/* ===============================================
   Hero Section
   =============================================== */

.hero {
  text-align: center;
  padding: 1.5rem 0;
  min-height: 40vh;
  /* Removed max-height to prevent content clipping on smaller screens */
  position: relative;
  border-bottom: 1px solid #d4c9b0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #f5f1e8 0%, #e8dfc4 100%);
  width: 100%;
  box-sizing: border-box;
}

/* Hero modifier: with background image */
.hero--with-background {
  background-size: cover;
  background-position: center;
}

.hero__content {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

/* Hero text colors - modifier classes */
.hero--light-text .hero-title,
.hero--light-text .hero__subheading {
  color: white;
  text-shadow: 2px 2px 4px rgba(0,0,0,0.7);
}

.hero--light-text .hero__subheading {
  text-shadow: 1px 1px 2px rgba(0,0,0,0.7);
}

.hero--dark-text .hero-title {
  color: #2d2d2d;
}

.hero--dark-text .hero__subheading {
  color: #4a4a4a;
}

.hero-title {
  font-size: clamp(1.5rem, 5vw, 2.25rem);
  margin-bottom: 0.3em;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.hero__subheading {
  max-width: 600px;
  margin: 0 auto 1.25em;
  font-size: 1em;
  line-height: 1.5;
}

.hero__cta-group {
  display: flex;
  gap: 1.25em;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
}

/* Primary CTA button */
.hero-cta-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.75em 2em;
  background: #556B2F;
  color: white;
  text-decoration: none;
  border-radius: 6px;
  font-weight: 600;
  font-size: 1em;
  min-height: 44px;
  min-width: 44px;
  transition: all 0.2s ease;
  box-shadow: 0 2px 8px rgba(85, 107, 47, 0.3);
}

.hero-cta-primary:hover {
  background: #6b8a3a;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(85, 107, 47, 0.4);
}

.hero-cta-primary:active {
  transform: translateY(0);
  box-shadow: 0 2px 8px rgba(85, 107, 47, 0.3);
}

/* Secondary CTA button */
.hero-cta-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.75em 2em;
  background: transparent;
  color: #556B2F;
  text-decoration: none;
  border: 2px solid #556B2F;
  border-radius: 6px;
  font-weight: 600;
  font-size: 1em;
  min-height: 44px;
  min-width: 44px;
  transition: all 0.2s ease;
}

.hero--light-text .hero-cta-secondary {
  color: white;
  border-color: white;
}

.hero-cta-secondary:hover {
  background: rgba(85, 107, 47, 0.1);
  transform: translateY(-2px);
}

.hero--light-text .hero-cta-secondary:hover {
  background: rgba(255, 255, 255, 0.15);
}

.hero-cta-secondary:active {
  transform: translateY(0);
}

/* ===============================================
   Hero Stats - Horizontal Scroll on Mobile
   =============================================== */

.hero-stats {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  align-items: center;
  justify-content: center;
  padding: 0.5rem 0;
  margin: 0 auto;
  max-width: 100%;
}

@media (min-width: 640px) {
  .hero-stats {
    flex-direction: row;
    flex-wrap: wrap;
  }
}

@media (min-width: 1024px) {
  .hero-stats {
    overflow-x: auto;
    overflow-y: hidden;
    flex-wrap: nowrap;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: rgba(0, 0, 0, 0.2) transparent;
  }
  
  .hero-stats::-webkit-scrollbar {
    height: 4px;
  }

  .hero-stats::-webkit-scrollbar-track {
    background: transparent;
  }

  .hero-stats::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 2px;
  }
}

.hero-stat {
  flex: 0 0 auto;
  width: 100%;
  max-width: 280px;
  padding: 0.5rem 1rem;
  background: white;
  border: 1px solid #e0e0e0;
  border-radius: 999px;
  font-size: 0.85rem;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  justify-content: center;
  height: 40px;
  white-space: nowrap;
}

@media (min-width: 640px) {
  .hero-stat {
    width: auto;
    min-width: 140px;
    max-width: none;
  }
}

.hero-stat__label {
  color: #666;
}

.hero-stat__value {
  font-weight: 700;
  color: #2d2d2d;
}

/* Stats value color variants */
.hero-stat__value--available {
  color: #5d7c32;
}

.hero-stat__value--sold {
  color: #9b6b6b;
}

.hero-stat__value--dealers {
  color: #4a7c59;
}

.hero-stat__value--new {
  color: #c49102;
}

.hero-stat__value--countries {
  color: #6b4c93;
}

/* Last update text */
.hero-update-text {
  margin-top: 0.5rem;
  font-size: 0.75rem;
  color: #888;
}

.hero--light-text .hero-update-text {
  color: rgba(255, 255, 255, 0.8);
}

/* ===============================================
   Responsive Grid System - .mv-grid
   (Milivault namespace to avoid Tailwind collision)
   =============================================== */

.mv-grid {
  display: grid;
  gap: 0.75rem;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  overflow-x: hidden;
  overflow-y: visible;
}

@media (min-width: 768px) {
  .mv-grid {
    gap: 1.25rem;
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (min-width: 1440px) {
  .mv-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

/* Homepage specific: .mv-grid inside 50% column should stay at 3 columns max */
.home-content-column .mv-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

@media (min-width: 768px) {
  .home-content-column .mv-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 1200px) {
  .home-content-column .mv-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 1600px) {
  .home-content-column .mv-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

/* ===============================================
   Desktop/Mobile Visibility Utilities
   =============================================== */

.desktop-only {
  display: none;
}

@media (min-width: 768px) {
  .desktop-only {
    display: revert; /* Safer than 'initial' - returns to element's default display */
  }
}

.mobile-only {
  display: revert;
}

@media (min-width: 768px) {
  .mobile-only {
    display: none;
  }
}

/* Explicit display utilities for layout contexts where 'revert' might not work as expected */
.mobile-only-block {
  display: block;
}

@media (min-width: 768px) {
  .mobile-only-block {
    display: none;
  }
}

.mobile-only-flex {
  display: flex;
}

@media (min-width: 768px) {
  .mobile-only-flex {
    display: none;
  }
}

.mobile-only-inline {
  display: inline;
}

@media (min-width: 768px) {
  .mobile-only-inline {
    display: none;
  }
}

/* ===============================================
   Homepage Content Layout
   =============================================== */

.home-content-row {
  display: flex;
  flex-direction: column;
  gap: 1.5em;
  align-items: stretch;
  margin-top: 2em;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

@media (min-width: 1024px) {
  .home-content-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 2.5em;
    align-items: start;
  }
}

.home-content-column {
  width: 100%;
  min-width: 0; /* Allows flex items to shrink below content size */
  max-width: 100%;
  box-sizing: border-box;
}

/* Grid handles widths on desktop; allow columns to grow naturally */

.home-content-column--blog {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.home-content-column--products {
  display: flex;
  flex-direction: column;
}

/* Featured items: always two columns on mobile */
@media (max-width: 767px) {
  body[data-page="home"] .home-products-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--space-sm, 1rem);
  }
}

/* Featured items pricing: prevent clipping by stacking on mobile */
@media (max-width: 767px) {
  body[data-page="home"] .home-products-grid .product-card__pricing {
    flex-direction: column;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap; /* allow items to move to next line */
  }
  body[data-page="home"] .home-products-grid .product-card__price {
    display: block;
    width: 100%;
    overflow-wrap: anywhere; /* prevent long prices/strings from overflowing */
  }
  body[data-page="home"] .home-products-grid .price-converted {
    display: block;
    width: 100%;
    margin-top: 4px;
    line-height: 1.2;
    white-space: normal;
    overflow-wrap: anywhere;
  }
}

/* ===============================================
   View All Link
   =============================================== */

.view-all-link {
  display: inline-block;
  margin-top: 1.5rem;
  padding: 0.75rem 1.5rem;
  background: #556B2F;
  color: white;
  text-decoration: none;
  border-radius: 6px;
  font-weight: 600;
  text-align: center;
  min-height: 44px;
  transition: all 0.2s ease;
}

.view-all-link:hover {
  background: #6b8a3a;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(85, 107, 47, 0.4);
}

.view-all-link:active {
  transform: translateY(0);
}

/* ===============================================
   Mobile Responsive Adjustments
   =============================================== */

@media (max-width: 767px) {
  .hero {
    padding: 1.5rem 1rem;
    min-height: 40vh;
  }
  
  .hero-title {
    font-size: clamp(1.5rem, 5vw, 2rem);
  }
  
  .hero__subheading {
    font-size: 0.9rem;
  }
  
  .hero__cta-group {
    flex-direction: column;
    width: 100%;
    max-width: 300px;
    margin-left: auto;
    margin-right: auto;
  }
  
  .hero-cta-primary,
  .hero-cta-secondary {
    width: 100%;
  }
}

/* ===============================================
   Touch Target Enforcement
   All interactive elements meet 44×44px minimum
   =============================================== */

button,
.btn,
.btn-link,
.action-link {
  min-height: 44px;
  min-width: 44px;
}

/* Remove underline from button-styled links */
.btn-link {
  text-decoration: none;
}

.btn-link:hover,
.btn-link:focus {
  text-decoration: none;
}
