/* ============================================
   TECHLIFE MAGAZINE - RESPONSIVE STYLES
   Mobile-First Responsive Design
   ============================================ */

/* ============================================
   MOBILE OPTIMIZATIONS (up to 768px)
   ============================================ */

@media (max-width: 768px) {
  /* Typography */
  body {
    font-size: 15px;
    line-height: 1.6;
  }

  h1 { font-size: 1.75rem; }
  h2 { font-size: 1.5rem; }
  h3 { font-size: 1.25rem; }
  h4 { font-size: 1.1rem; }
  h5 { font-size: 1rem; }
  h6 { font-size: 0.95rem; }

  /* Layout */
  .main {
    padding: 1rem 0;
  }

  /* Hero Section Mobile */
  .hero-section {
    margin: 1rem 0 2rem;
  }

  .hero-container {
    border-radius: 12px;
  }

  .hero-content-wrapper {
    height: 300px;
  }

  .hero-text {
    padding: 1.25rem;
  }

  .hero-badge {
    font-size: 0.7rem;
    padding: 0.4rem 0.8rem;
    margin-bottom: 0.75rem;
    display: inline-block;
  }

  .hero-title {
    font-size: 1.35rem;
    margin: 0.5rem 0;
  }

  .hero-description {
    font-size: 0.95rem;
    margin: 0.75rem 0 1rem;
    line-height: 1.5;
  }

  .hero-meta {
    font-size: 0.85rem;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.25rem;
  }

  .hero-reading-time::before {
    display: none;
  }

  /* Articles Grid Mobile */
  .articles-grid {
    grid-template-columns: 1fr;
    gap: 1.25rem;
    margin: 1.5rem 0;
  }

  .article-card {
    border-radius: 10px;
  }

  .card-image {
    height: 160px;
  }

  .card-content {
    padding: 1rem;
  }

  .card-title {
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
  }

  .card-summary {
    font-size: 0.9rem;
    -webkit-line-clamp: 2;
  }

  .card-meta {
    font-size: 0.8rem;
  }

  /* Category Sections Mobile */
  .category-showcase {
    margin: 2rem 0;
  }

  .category-grid {
    grid-template-columns: 1fr;
    gap: 1.25rem;
  }

  .category-image {
    height: 140px;
  }

  .category-info {
    padding: 1rem;
  }

  .category-name {
    font-size: 1.15rem;
  }

  .category-count {
    font-size: 0.85rem;
  }

  .category-arrow {
    font-size: 1.25rem;
    top: 1rem;
    right: 1rem;
  }

  .category-latest {
    padding: 0.75rem 1rem 1rem;
  }

  .category-post-title {
    font-size: 0.85rem;
  }

  .category-post-date {
    font-size: 0.75rem;
  }

  /* Newsletter Mobile */
  .newsletter-section {
    margin: 2rem 0;
  }

  .newsletter-container {
    padding: 1.5rem;
    border-radius: 12px;
  }

  .newsletter-content {
    flex-direction: column;
    text-align: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
  }

  .newsletter-icon {
    width: 50px;
    height: 50px;
  }

  .newsletter-icon svg {
    width: 28px;
    height: 28px;
  }

  .newsletter-title {
    font-size: 1.35rem;
  }

  .newsletter-description {
    font-size: 0.9rem;
  }

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

  .newsletter-input {
    padding: 0.875rem 1.25rem;
    font-size: 0.95rem;
  }

  .newsletter-button {
    width: 100%;
    justify-content: center;
    padding: 0.875rem 1.5rem;
  }

  .newsletter-privacy {
    justify-content: center;
    font-size: 0.8rem;
  }

  /* Trending Sidebar Mobile */
  .trending-widget,
  .tags-widget {
    margin-bottom: 1.5rem;
    padding: 1.25rem;
    border-radius: 10px;
  }

  .widget-header {
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
  }

  .widget-title {
    font-size: 1.1rem;
  }

  .trending-list {
    gap: 0.75rem;
  }

  .trending-item {
    padding: 0.75rem;
  }

  .trending-number {
    width: 28px;
    height: 28px;
    font-size: 0.85rem;
  }

  .trending-title {
    font-size: 0.85rem;
  }

  .trending-meta {
    font-size: 0.75rem;
  }

  .trending-thumb {
    width: 50px;
    height: 50px;
  }

  .tag-item {
    padding: 0.4rem 0.8rem;
    font-size: 0.8rem;
  }

  .tag-count {
    min-width: 20px;
    height: 20px;
    font-size: 0.7rem;
  }

  /* Header Mobile */
  .magazine-header {
    position: sticky;
    top: 0;
    left: 0;
    right: 0;
    width: 100%;
  }

  .nav {
    padding: 0.875rem 1rem;
    gap: 1rem;
  }

  .site-name {
    font-size: 1.15rem;
  }

  .site-logo img {
    height: 24px;
  }

  .menu-list {
    gap: 0.5rem;
    padding: 1rem 0 0.5rem;
  }

  .menu-item {
    width: 100%;
    padding: 0.75rem 1rem;
    font-size: 0.9rem;
  }

  .theme-toggle,
  .menu-toggle {
    width: 36px;
    height: 36px;
  }

  /* Footer Mobile */
  .magazine-footer {
    padding: 1.5rem 0 1rem;
    margin-top: 2rem;
  }

  .footer-container {
    padding: 0 1rem;
  }

  .footer-top {
    grid-template-columns: 1fr;
    gap: 1.5rem;
    padding-bottom: 1.5rem;
  }

  .footer-column h3,
  .footer-column h4 {
    font-size: 1rem;
    margin-bottom: 0.875rem;
  }

  .footer-description {
    font-size: 0.875rem;
  }

  .footer-links a {
    font-size: 0.875rem;
  }

  .footer-newsletter-text {
    font-size: 0.85rem;
  }

  .footer-input,
  .footer-btn {
    padding: 0.625rem 0.875rem;
    font-size: 0.85rem;
  }

  .footer-bottom {
    flex-direction: column;
    text-align: center;
    padding-top: 1.25rem;
    gap: 0.75rem;
  }

  .footer-copyright p,
  .footer-meta {
    font-size: 0.85rem;
  }

  /* Section Headers Mobile */
  .section-header {
    margin: 2rem 0 1.25rem;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
  }

  .section-title {
    font-size: 1.35rem;
  }

  .section-title::before {
    width: 50px;
  }

  .view-all-link {
    font-size: 0.9rem;
  }

  /* Single Post Mobile */
  .tech-blog-post {
    font-size: 16px;
  }

  .tech-header {
    margin-bottom: 1.5rem;
    padding-bottom: 1.25rem;
  }

  .tech-header .post-title {
    font-size: 1.75rem;
  }

  .tech-lead {
    font-size: 1.05rem;
  }

  .tech-meta {
    font-size: 0.85rem;
  }

  .tech-content {
    margin: 1.5rem 0;
  }

  .tech-content h2 {
    font-size: 1.5rem;
    margin-top: 2rem;
  }

  .tech-content h3 {
    font-size: 1.2rem;
    margin-top: 1.5rem;
  }

  .tech-content img {
    margin: 1.5rem 0;
  }

  .tech-toc {
    padding: 1rem;
    margin: 1.5rem 0;
    max-width: 100%;
    overflow-x: auto;
  }

  .tech-toc ul {
    padding-left: 1.5rem;
  }

  .tech-toc li {
    font-size: 0.9rem;
    line-height: 1.6;
  }

  .tech-footer {
    margin-top: 2rem;
    padding-top: 1.5rem;
  }

  .tech-author {
    padding: 1.25rem;
    margin-top: 2rem;
  }

  /* Tables Mobile */
  table {
    font-size: 0.85rem;
  }

  th, td {
    padding: 0.75rem 0.5rem;
  }

  /* Buttons Mobile */
  .btn {
    padding: 0.625rem 1.25rem;
    font-size: 0.9rem;
  }

  /* Code Blocks Mobile */
  pre {
    padding: 1rem;
    margin: 1rem 0;
    font-size: 0.85rem;
    border-radius: 8px;
  }

  code {
    font-size: 0.85em;
  }

  /* Blockquotes Mobile */
  blockquote {
    padding: 1rem;
    margin: 1.5rem 0;
    font-size: 0.95rem;
  }
}

/* ============================================
   TABLET OPTIMIZATIONS (769px to 1024px)
   ============================================ */

@media (min-width: 769px) and (max-width: 1024px) {
  /* Typography */
  body {
    font-size: 16px;
  }

  h1 { font-size: 2.25rem; }
  h2 { font-size: 1.85rem; }
  h3 { font-size: 1.4rem; }

  /* Hero Section Tablet */
  .hero-content-wrapper {
    height: 400px;
  }

  .hero-title {
    font-size: 2rem;
  }

  .hero-text {
    padding: 2rem;
  }

  /* Grid Layouts */
  .articles-grid,
  .category-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
  }

  /* Newsletter Tablet */
  .newsletter-container {
    padding: 2.5rem;
  }

  .newsletter-title {
    font-size: 1.75rem;
  }

  /* Navigation Tablet */
  .menu-list {
    gap: 0.25rem;
  }

  .menu-item {
    padding: 0.6rem 1rem;
    font-size: 0.9rem;
  }

  /* Footer Tablet */
  .footer-top {
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
  }
}

/* ============================================
   LARGE DESKTOP (1440px and above)
   ============================================ */

@media (min-width: 1440px) {
  /* Increase max widths for large screens */
  .magazine-home,
  .nav,
  .footer-container {
    max-width: 1600px;
  }

  /* Hero Section Large */
  .hero-content-wrapper {
    height: 600px;
  }

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

  .hero-description {
    font-size: 1.3rem;
  }

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

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

/* ============================================
   TOUCH DEVICE OPTIMIZATIONS
   ============================================ */

@media (hover: none) and (pointer: coarse) {
  /* Increase touch targets */
  .menu-item,
  .footer-btn,
  .newsletter-button,
  .theme-toggle,
  .menu-toggle {
    min-height: 44px;
    min-width: 44px;
  }

  /* Remove hover effects on touch devices */
  .article-card:hover,
  .category-card:hover,
  .trending-item:hover {
    transform: none;
  }

  /* Make links easier to tap */
  a {
    padding: 0.25rem 0;
  }
}

/* ============================================
   PRINT OPTIMIZATIONS
   ============================================ */

@media print {
  /* Hide non-essential elements */
  .magazine-header,
  .nav-actions,
  .newsletter-section,
  .trending-widget,
  .tags-widget,
  .share-section,
  .magazine-footer,
  .menu-toggle,
  .theme-toggle {
    display: none !important;
  }

  /* Optimize for print */
  body {
    font-size: 12pt;
    line-height: 1.6;
    background: white;
    color: black;
  }

  .hero-section,
  .article-card,
  .category-card {
    break-inside: avoid;
    page-break-inside: avoid;
  }

  /* Simplify images */
  img {
    max-width: 100%;
    page-break-inside: avoid;
  }

  /* Show URLs for links */
  a[href]:after {
    content: " (" attr(href) ")";
    font-size: 0.8em;
  }

  /* Remove shadows and effects */
  * {
    box-shadow: none !important;
    text-shadow: none !important;
  }
}

/* ============================================
   REDUCED MOTION
   ============================================ */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ============================================
   HIGH CONTRAST MODE
   ============================================ */

@media (prefers-contrast: high) {
  .article-card,
  .category-card,
  .trending-widget,
  .tags-widget {
    border-width: 2px;
  }

  .btn,
  .tag-item,
  .social-link {
    border-width: 2px;
  }
}
