/*--------------------------------------------------------------
# ENHANCED RESPONSIVE DESIGN
# Mobile-First Approach with Breakpoints:
# Mobile: 320px - 639px (phones)
# Tablet: 640px - 1023px (tablets)
# Desktop: 1024px+ (desktops)
--------------------------------------------------------------*/

/*--------------------------------------------------------------
# 1. MOBILE TYPOGRAPHY & BASE (320px and up)
--------------------------------------------------------------*/
html, body {
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}

/* Responsive heading sizes */
h1 { font-size: 1.75rem; }
h2 { font-size: 1.375rem; }
h3 { font-size: 1.125rem; }
h4 { font-size: 1rem; }
p { font-size: 0.9375rem; line-height: 1.6; }

.container { padding: 0 1rem; }

/* Touch-friendly button sizes for mobile */
a, button, input[type="button"], input[type="submit"] {
  min-height: 44px;
  min-width: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

button:active, a:active {
  opacity: 0.85;
}

/*--------------------------------------------------------------
# 2. MOBILE HEADER & NAVIGATION (320px and up)
--------------------------------------------------------------*/
.site-header .container {
  flex-wrap: wrap;
  padding: 0.75rem 1rem;
  gap: 0.5rem;
}

.site-branding {
  min-width: 180px;
  flex-shrink: 0;
}

.site-title {
  font-size: 1.25rem;
}

.site-description {
  font-size: 0.6875rem;
}

.site-logo-icon {
  width: 40px;
  height: 40px;
  font-size: 1.25rem;
}

.main-navigation {
  width: 100%;
  order: 3;
}

/* Mobile menu styling */
.mobile-menu {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease;
}

.mobile-menu.is-open {
  max-height: 500px;
  overflow-y: auto;
}

.mobile-menu ul {
  padding: 0.5rem 0;
}

.mobile-menu a {
  padding: 0.75rem 1rem;
  font-size: 0.9375rem;
  border-radius: 0.375rem;
}

.header-actions {
  order: 2;
}

.menu-toggle {
  min-width: 44px;
  min-height: 44px;
  padding: 0.5rem;
}

.menu-toggle svg {
  width: 20px;
  height: 20px;
}

/* Search form for mobile */
.header-search-form {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease;
}

.header-search-form.is-open {
  max-height: 80px;
}

.header-search-form input[type="search"] {
  padding: 0.75rem 2.75rem 0.75rem 1rem;
  font-size: 16px; /* Prevents zoom on iOS */
  border-radius: 0.5rem;
}

.header-search-form button {
  min-height: 44px;
  min-width: 44px;
}

.btn-subscribe {
  padding: 0.5rem 1.25rem;
  font-size: 0.875rem;
}

/*--------------------------------------------------------------
# 3. HERO SECTION - MOBILE (320px and up)
--------------------------------------------------------------*/
.hero {
  padding: 2rem 0;
}

.hero .container {
  gap: 1.5rem;
}

.hero-badge {
  font-size: 0.75rem;
  padding: 0.25rem 0.75rem;
  margin-bottom: 1rem;
}

.hero h1 {
  font-size: 1.5rem;
  line-height: 1.2;
}

.hero p {
  font-size: 0.9375rem;
  margin-bottom: 1.5rem;
}

.hero-buttons {
  gap: 0.75rem;
}

.btn {
  padding: 0.75rem 1.5rem;
  font-size: 0.875rem;
  width: 100%;
}

.btn-primary, .btn-outline, .btn-green {
  width: 100%;
  border-radius: 0.5rem;
}

.hero::before {
  width: 8rem;
  height: 8rem;
  top: 1rem;
}

.hero::after {
  width: 12rem;
  height: 12rem;
  bottom: 1rem;
  right: 1rem;
}

/*--------------------------------------------------------------
# 4. FEATURED SECTION - MOBILE (320px and up)
--------------------------------------------------------------*/
.featured-section {
  padding: 2rem 0;
}

.featured-section h2 {
  margin-bottom: 1.5rem;
}

.view-all-mobile {
  text-align: center;
  margin-top: 1.5rem;
}

.featured-list {
  display: grid;
  gap: 1rem;
}

/*--------------------------------------------------------------
# 5. CARD STYLES - MOBILE (320px and up)
--------------------------------------------------------------*/
.card {
  border-radius: 0.5rem;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.card img {
  width: 100%;
  height: 200px;
  object-fit: cover;
}

.card-body {
  padding: 1rem;
}

.card-title {
  font-size: 0.9375rem;
  line-height: 1.4;
}

.card-meta {
  font-size: 0.75rem;
  margin-top: 0.5rem;
}

.card-compact {
  flex-direction: row;
}

.card-compact img {
  width: 100px;
  height: 100px;
  flex-shrink: 0;
}

.card-compact-body {
  padding: 0.75rem;
}

.card-compact .card-title {
  font-size: 0.8125rem;
}

/*--------------------------------------------------------------
# 6. GRID LAYOUTS - MOBILE (320px and up)
--------------------------------------------------------------*/
.grid-1 { grid-template-columns: 1fr; }
.grid-2 { grid-template-columns: 1fr; }
.grid-3 { grid-template-columns: 1fr; }

.featured-grid,
.category-card-grid {
  display: grid;
  gap: 1rem;
}

/*--------------------------------------------------------------
# 7. STATS SECTION - MOBILE (320px and up)
--------------------------------------------------------------*/
.stats {
  padding: 2rem 0;
}

.stats-grid {
  gap: 1rem;
}

.stat-number {
  font-size: 1.875rem;
  margin-bottom: 0.25rem;
}

.stat-label {
  font-size: 0.8125rem;
}

/*--------------------------------------------------------------
# 8. NEWSLETTER FORM - MOBILE (320px and up)
--------------------------------------------------------------*/
.newsletter {
  padding: 2rem 0;
}

.newsletter h2 {
  font-size: 1.375rem;
  margin-bottom: 1rem;
}

.newsletter p {
  font-size: 0.9375rem;
  margin-bottom: 1.5rem;
}

.newsletter-form {
  flex-direction: column;
  gap: 0.75rem;
}

.newsletter-form input[type="email"] {
  min-width: 100%;
  padding: 0.75rem 1rem;
  font-size: 16px; /* Prevents zoom on iOS */
}

.newsletter-form button {
  width: 100%;
  padding: 0.75rem 1rem;
  font-size: 0.9375rem;
}

/*--------------------------------------------------------------
# 9. SIDEBAR & BLOG LAYOUT - MOBILE (320px and up)
--------------------------------------------------------------*/
.blog-grid {
  grid-template-columns: 1fr;
}

.sidebar {
  display: grid;
  gap: 1rem;
  order: 2;
}

.widget {
  border-radius: 0.5rem;
  padding: 1rem;
}

.widget-title {
  font-size: 0.9375rem;
  margin-bottom: 0.75rem;
}

.recent-post img {
  width: 60px;
  height: 60px;
}

.recent-post-title {
  font-size: 0.75rem;
}

/*--------------------------------------------------------------
# 10. CONTACT FORM - MOBILE (320px and up)
--------------------------------------------------------------*/
.contact-grid {
  grid-template-columns: 1fr;
}

input[type="text"],
input[type="email"],
input[type="tel"],
textarea,
select {
  width: 100%;
  padding: 0.75rem;
  font-size: 16px; /* Prevents zoom on iOS */
  border-radius: 0.375rem;
  border: 1px solid #d1d5db;
  margin-bottom: 1rem;
}

textarea {
  resize: vertical;
  min-height: 150px;
}

/*--------------------------------------------------------------
# 11. FOOTER - MOBILE (320px and up)
--------------------------------------------------------------*/
.site-footer {
  padding: 2rem 0;
}

.footer-content {
  display: grid;
  gap: 1.5rem;
}

.footer-widget {
  margin-bottom: 1rem;
}

.footer-widget h3 {
  font-size: 0.9375rem;
  margin-bottom: 0.75rem;
}

.footer-bottom {
  border-top: 1px solid #e5e7eb;
  padding-top: 1rem;
  margin-top: 1rem;
  text-align: center;
  font-size: 0.75rem;
}

/*--------------------------------------------------------------
# 12. PAGINATION - MOBILE (320px and up)
--------------------------------------------------------------*/
.pagination {
  justify-content: center;
  gap: 0.375rem;
  margin: 2rem 0 0 0;
}

.pagination a,
.pagination span {
  padding: 0.5rem 0.75rem;
  font-size: 0.875rem;
  min-width: 40px;
  text-align: center;
}

/*--------------------------------------------------------------
# TABLET BREAKPOINT (640px and up)
--------------------------------------------------------------*/
@media (min-width: 640px) {
  h1 { font-size: 2rem; }
  h2 { font-size: 1.625rem; }
  h3 { font-size: 1.25rem; }

  .container { padding: 0 1.5rem; }

  .site-header .container {
    padding: 1rem 1.5rem;
    gap: 1rem;
  }

  .site-title {
    font-size: 1.375rem;
  }

  .site-logo-icon {
    width: 44px;
    height: 44px;
  }

  .btn-subscribe {
    display: inline-flex !important;
    width: auto;
    padding: 0.625rem 1.5rem;
  }

  .hero {
    padding: 3rem 0;
  }

  .hero h1 {
    font-size: 1.875rem;
  }

  .hero p {
    font-size: 1rem;
  }

  .btn {
    width: auto;
    padding: 0.75rem 2rem;
  }

  .btn-primary,
  .btn-outline,
  .btn-green {
    width: auto;
  }

  .hero-buttons {
    justify-content: flex-start;
  }

  .grid-2 { grid-template-columns: repeat(2, 1fr); }

  .featured-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .card-compact img {
    width: 120px;
    height: 120px;
  }

  .card img {
    height: 250px;
  }

  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .newsletter-form {
    flex-direction: row;
    gap: 1rem;
  }

  .newsletter-form input[type="email"] {
    flex: 1;
    min-width: 200px;
  }

  .newsletter-form button {
    width: auto;
  }

  .contact-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .footer-content {
    grid-template-columns: repeat(2, 1fr);
  }

  input[type="text"],
  input[type="email"],
  input[type="tel"],
  textarea,
  select {
    font-size: 1rem;
  }
}

/*--------------------------------------------------------------
# DESKTOP BREAKPOINT (1024px and up)
--------------------------------------------------------------*/
@media (min-width: 1024px) {
  h1 { font-size: 2.25rem; }
  h2 { font-size: 1.875rem; }
  h3 { font-size: 1.375rem; }

  .container { padding: 0 2rem; }

  .site-header .container {
    flex-wrap: nowrap;
    padding: 1rem 2rem;
    gap: 1.5rem;
  }

  .site-branding {
    flex: 0 0 auto;
    min-width: auto;
  }

  .main-navigation {
    order: auto;
    width: auto;
    flex: 1 1 auto;
    display: block !important;
  }

  .menu-toggle {
    display: none !important;
  }

  .header-actions {
    order: auto;
    gap: 1rem;
  }

  .hero {
    padding: 5rem 0;
  }

  .hero .container {
    grid-template-columns: 1fr 1fr;
    gap: 3rem;
  }

  .hero h1 {
    font-size: 3rem;
  }

  .hero-buttons {
    justify-content: flex-start;
  }

  .hero-image {
    display: block !important;
  }

  .grid-3 { grid-template-columns: repeat(3, 1fr); }

  .featured-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .card img {
    height: 300px;
  }

  .blog-grid {
    grid-template-columns: 1fr 320px;
    gap: 2rem;
  }

  .sidebar {
    order: 0;
  }

  .stats-grid {
    grid-template-columns: repeat(4, 1fr);
  }

  .stat-number {
    font-size: 3rem;
  }

  .footer-content {
    grid-template-columns: repeat(4, 1fr);
  }

  .newsletter h2 {
    font-size: 1.875rem;
  }

  .newsletter p {
    font-size: 1.125rem;
  }

  input[type="text"],
  input[type="email"],
  input[type="tel"],
  textarea,
  select {
    font-size: 1rem;
  }
}

/*--------------------------------------------------------------
# EXTRA LARGE SCREENS (1280px and up)
--------------------------------------------------------------*/
@media (min-width: 1280px) {
  .container {
    max-width: 1280px;
  }
}

/*--------------------------------------------------------------
# VERY LARGE SCREENS (1536px and up)
--------------------------------------------------------------*/
@media (min-width: 1536px) {
  h1 { font-size: 3rem; }
  h2 { font-size: 2.25rem; }

  .container {
    max-width: 1400px;
  }
}

/*--------------------------------------------------------------
# LANDSCAPE MODE OPTIMIZATION (any height less than 600px)
--------------------------------------------------------------*/
@media (max-height: 600px) and (orientation: landscape) {
  .hero {
    padding: 2rem 0;
  }

  .hero h1 {
    font-size: 1.5rem;
  }

  .hero p {
    margin-bottom: 1rem;
  }

  .stats {
    padding: 1.5rem 0;
  }
}

/*--------------------------------------------------------------
# PRINT STYLES
--------------------------------------------------------------*/
@media print {
  .site-header,
  .site-footer,
  .sidebar,
  .menu-toggle,
  .mobile-menu,
  .pagination {
    display: none;
  }

  .blog-grid {
    grid-template-columns: 1fr;
  }

  body {
    font-size: 12pt;
    line-height: 1.5;
  }
}

/*--------------------------------------------------------------
# ACCESSIBILITY & PREFERENCE-BASED STYLES
--------------------------------------------------------------*/
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

@media (prefers-color-scheme: dark) {
  /* Optional: Add dark mode support here */
}

/*--------------------------------------------------------------
# HIGH DPI / RETINA DISPLAY OPTIMIZATION
--------------------------------------------------------------*/
@media (min-resolution: 2dppx) {
  /* Optimize for high-resolution displays */
}
