/* ==============================================
   BLOG MOBILE ENHANCEMENTS - ESL Fun Online
   Enhanced mobile experience for blog pages
   ============================================== */

/* Enhanced Mobile Responsive Design */
@media (max-width: 768px) {
  /* Blog Container - Mobile Only */
  .blog-container {
    grid-template-columns: 1fr !important;
    gap: 1.5rem !important;
    padding: 0.5rem !important;
  }

  /* Hide sidebar on mobile */
  .sidebar {
    order: 2;
    margin-top: 2rem;
  }

  /* Blog Header Mobile Optimization */
  .blog-header {
    padding: 1.5rem 1rem !important;
    margin-bottom: 2rem !important;
  }

  .blog-title {
    font-size: 1.75rem !important;
    line-height: 1.2 !important;
  }

  .blog-meta {
    flex-direction: column !important;
    gap: 0.5rem !important;
    font-size: 0.8rem !important;
  }

  /* Content Sections */
  .content-section {
    padding: 1rem !important;
  }

  .section-title {
    font-size: 1.3rem !important;
    margin-bottom: 1rem !important;
  }

  /* Interactive Elements */
  .interactive-demo {
    padding: 1rem !important;
    margin: 1rem 0 !important;
  }

  .demo-button {
    padding: 0.75rem 1.25rem !important;
    font-size: 0.9rem !important;
    width: 100% !important;
    margin: 0.25rem 0 !important;
  }

  .demo-result {
    padding: 1rem !important;
    font-size: 0.8rem !important;
  }

  /* Code Snippets */
  .code-snippet {
    padding: 0.75rem !important;
    font-size: 0.75rem !important;
    overflow-x: auto !important;
  }

  .code-snippet::before {
    font-size: 0.7rem !important;
    padding: 0.2rem 0.4rem !important;
  }

  /* Tech Cards */
  .tech-grid {
    grid-template-columns: 1fr !important;
    gap: 1rem !important;
  }

  .tech-card {
    padding: 1rem !important;
  }

  .tech-title {
    font-size: 1rem !important;
  }

  /* Learning Path */
  .learning-path,
  .project-showcase,
  .tech-overview {
    padding: 1rem !important;
    margin: 1rem 0 !important;
  }

  .milestone-item {
    padding: 0.75rem !important;
    flex-direction: column !important;
    text-align: center !important;
    gap: 0.5rem !important;
  }

  .milestone-number {
    width: 24px !important;
    height: 24px !important;
    font-size: 0.8rem !important;
  }

  .milestone-title {
    font-size: 0.95rem !important;
  }

  /* Progress Checkboxes */
  .progress-checkbox {
    transform: scale(1.1) !important;
    margin-right: 0.5rem !important;
  }

  /* Form Elements */
  input[type="text"],
  input[type="url"],
  input[type="email"],
  input[type="color"] {
    font-size: 16px !important; /* Prevents zoom on iOS */
    padding: 0.75rem !important;
  }

  /* Live Preview */
  .live-preview {
    margin: 0.5rem 0 !important;
  }

  .preview-content {
    padding: 0.75rem !important;
  }

  /* Navigation Elements */
  .breadcrumb {
    font-size: 0.8rem !important;
    margin-bottom: 1rem !important;
    padding: 0 0.5rem !important;
  }

  .back-link {
    font-size: 0.9rem !important;
    margin-bottom: 1rem !important;
    padding: 0 0.5rem !important;
  }

  /* Table of Contents Mobile */
  .table-of-contents {
    margin: 1rem 0 !important;
  }

  .toc-header {
    padding: 0.75rem 1rem !important;
  }

  .toc-header h3 {
    font-size: 1rem !important;
  }

  .toc-link {
    padding: 0.5rem 1rem !important;
    font-size: 0.85rem !important;
  }

  /* Image Modal Mobile */
  .image-modal-content {
    padding: 1rem !important;
  }

  .modal-close {
    top: -10px !important;
    right: -10px !important;
    width: 35px !important;
    height: 35px !important;
  }

  /* Keyboard Hints Mobile */
  .keyboard-hints {
    bottom: 10px !important;
    right: 10px !important;
    left: 10px !important;
    width: auto !important;
  }

  .hints-content {
    padding: 0.75rem !important;
  }

  .hint {
    font-size: 0.8rem !important;
  }

  /* Reading Progress */
  .reading-progress {
    height: 2px !important;
  }

  /* Notification System Mobile */
  .notification {
    left: 10px !important;
    right: 10px !important;
    top: 80px !important;
    max-width: none !important;
    padding: 0.75rem 1rem !important;
  }

  .notification-content {
    gap: 8px !important;
    font-size: 0.85rem !important;
  }
}

/* Ultra-small screens (iPhone SE, etc.) */
@media (max-width: 375px) {
  .blog-container {
    padding: 0.25rem !important;
  }

  .blog-header {
    padding: 1rem 0.5rem !important;
  }

  .blog-title {
    font-size: 1.5rem !important;
  }

  .content-section {
    padding: 0.75rem !important;
  }

  .section-title {
    font-size: 1.1rem !important;
  }

  .demo-button {
    padding: 0.5rem 1rem !important;
    font-size: 0.85rem !important;
  }

  .tech-card,
  .interactive-demo,
  .learning-path,
  .project-showcase {
    padding: 0.75rem !important;
  }

  .milestone-item {
    padding: 0.5rem !important;
  }

  input[type="text"],
  input[type="url"],
  input[type="email"] {
    padding: 0.5rem !important;
    font-size: 16px !important;
  }
}

/* Landscape Mobile Optimization */
@media (max-width: 768px) and (orientation: landscape) {
  .blog-header {
    padding: 1rem !important;
  }

  .content-section {
    padding: 1.25rem !important;
  }

  .tech-grid {
    grid-template-columns: 1fr 1fr !important;
    gap: 0.75rem !important;
  }

  .milestone-item {
    flex-direction: row !important;
    text-align: left !important;
  }
}

/* Touch Improvements */
@media (hover: none) and (pointer: coarse) {
  /* Increase touch targets */
  .demo-button,
  .category-link,
  .tag,
  .back-link {
    min-height: 44px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
  }

  .progress-checkbox {
    transform: scale(1.3) !important;
  }

  /* Improve hover states for touch */
  .tech-card:hover,
  .milestone-item:hover {
    transform: none !important;
  }

  .tech-card:active,
  .milestone-item:active {
    transform: scale(0.98) !important;
    transition: transform 0.1s ease !important;
  }

  /* Remove hover animations that don't work on touch */
  .demo-button::before {
    display: none !important;
  }

  .tech-card::before {
    display: none !important;
  }
}

/* Dark Mode Mobile Optimizations */
@media (max-width: 768px) and (prefers-color-scheme: dark) {
  .blog-header {
    background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%) !important;
  }

  .content-section {
    background: #1e293b !important;
    color: #e2e8f0 !important;
  }

  .interactive-demo {
    background: #0f172a !important;
    border-color: #374151 !important;
  }

  .code-snippet {
    background: #0d1117 !important;
    border-color: #21262d !important;
  }

  .demo-result {
    background: #1e293b !important;
    border-color: #374151 !important;
    color: #e2e8f0 !important;
  }
}

/* Accessibility Improvements for Mobile */
@media (max-width: 768px) {
  /* Focus states */
  .demo-button:focus,
  .category-link:focus,
  .tag:focus,
  input:focus {
    outline: 3px solid #46bbe5 !important;
    outline-offset: 2px !important;
  }

  /* Reduce motion for users who prefer it */
  @media (prefers-reduced-motion: reduce) {
    * {
      animation-duration: 0.01ms !important;
      animation-iteration-count: 1 !important;
      transition-duration: 0.01ms !important;
    }
  }

  /* High contrast improvements */
  @media (prefers-contrast: high) {
    .blog-post {
      border: 2px solid #000 !important;
    }

    .demo-button {
      border: 2px solid #000 !important;
    }

    .tech-card {
      border-width: 3px !important;
    }
  }
}

/* Performance Optimizations */
@media (max-width: 768px) {
  /* Reduce complexity for mobile */
  .blog-header::before {
    display: none !important;
  }

  .tech-card::before,
  .milestone-item::before {
    display: none !important;
  }

  /* Optimize fonts for mobile */
  body {
    -webkit-text-size-adjust: 100% !important;
    text-rendering: optimizeLegibility !important;
  }

  /* Reduce box shadows for performance */
  .tech-card,
  .interactive-demo,
  .learning-path {
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1) !important;
  }
}

/* Print Styles for Mobile */
@media print {
  .blog-container {
    max-width: none !important;
    padding: 0 !important;
  }

  .blog-header {
    background: none !important;
    color: #000 !important;
    padding: 1rem 0 !important;
  }

  .interactive-demo,
  .demo-button,
  .progress-checkbox,
  .keyboard-hints,
  .reading-progress,
  .image-modal {
    display: none !important;
  }

  .content-section {
    page-break-inside: avoid !important;
    break-inside: avoid !important;
  }

  .section-title {
    page-break-after: avoid !important;
    break-after: avoid !important;
  }
}
