/**
 * Responsive Styles
 * 
 * Media queries for different screen sizes
 * Mobile-first approach: Base styles are for mobile, 
 * media queries add complexity for larger screens
 */

/* ===== BREAKPOINT REFERENCE ===== */
/*
 * xs: < 640px   (phones)
 * sm: 640px     (large phones)
 * md: 768px     (tablets)
 * lg: 1024px    (laptops)
 * xl: 1280px    (desktops)
 * 2xl: 1536px   (large desktops)
 */

/* ===== TABLET (768px and below) ===== */

@media (max-width: 768px) {
  
  /* Navigation */
  .nav-container {
    padding: var(--space-md) var(--space-md);
  }

  .nav-links {
    position: fixed;
    top: var(--navbar-height);
    left: 0;
    right: 0;
    flex-direction: column;
    background: var(--color-bg-secondary);
    padding: var(--space-xl);
    gap: var(--space-lg);
    transform: translateY(-100%);
    opacity: 0;
    visibility: hidden;
    transition: transform var(--transition-base), 
                opacity var(--transition-base),
                visibility var(--transition-base);
    box-shadow: var(--shadow-lg);
  }

  .nav-links.active {
    transform: translateY(0);
    opacity: 1;
    visibility: visible;
  }

  .social-links {
    display: none;
  }

  .mobile-menu-toggle {
    display: flex;
  }

  /* Hero Section */
  .hero {
    min-height: 100vh;
    padding: var(--space-lg) var(--space-md);
  }

  .hero-title {
    font-size: clamp(2rem, 8vw, 3rem);
  }

  .hero-subtitle {
    font-size: clamp(1rem, 4vw, 1.5rem);
  }

  .hero-description {
    font-size: var(--font-size-base);
  }

  .cta-buttons {
    flex-direction: column;
    width: 100%;
  }

  .btn {
    width: 100%;
    justify-content: center;
  }

  /* Sections */
  .section {
    padding: var(--space-3xl) var(--space-md);
  }

  .section-header {
    margin-bottom: var(--space-2xl);
  }

  .section-title {
    font-size: clamp(1.75rem, 5vw, 2.5rem);
  }

  .section-description {
    font-size: var(--font-size-base);
  }

  /* About Section */
  .about-content {
    grid-template-columns: 1fr;
    gap: var(--space-2xl);
  }

  .about-images {
    order: -1; /* Show images first on mobile */
  }

  .about-text p {
    font-size: var(--font-size-base);
  }

  /* Projects Grid */
  .projects-grid {
    grid-template-columns: 1fr;
    gap: var(--space-xl);
  }

  .project-image-container {
    height: 200px;
  }

  .project-content {
    padding: var(--space-lg);
  }

  .project-title {
    font-size: var(--font-size-xl);
  }

  /* Skills Grid */
  .skills-grid {
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: var(--space-md);
  }

  .skill-icon {
    width: 48px;
    height: 48px;
  }

  /* Contact Section */
  .contact-links {
    flex-direction: column;
    gap: var(--space-lg);
  }

  .contact-icon {
    width: 48px;
    height: 48px;
  }

  /* Back to Top Button */
  .back-to-top {
    bottom: var(--space-md);
    right: var(--space-md);
    width: 48px;
    height: 48px;
  }

  .back-to-top svg {
    width: 20px;
    height: 20px;
  }

  /* Grid utilities for tablets */
  .grid-2,
  .grid-3,
  .grid-4 {
    grid-template-columns: 1fr;
  }
}

/* ===== MOBILE (480px and below) ===== */

@media (max-width: 480px) {
  
  /* Further reduce spacing on small phones */
  .section {
    padding: var(--space-2xl) var(--space-md);
  }

  .nav-logo {
    font-size: var(--font-size-xl);
  }

  .hero {
    padding: var(--space-md);
  }

  .hero-title {
    font-size: clamp(1.75rem, 10vw, 2.5rem);
    margin-bottom: var(--space-md);
  }

  .hero-subtitle {
    font-size: clamp(0.875rem, 5vw, 1.125rem);
    margin-bottom: var(--space-md);
  }

  .hero-description {
    font-size: var(--font-size-sm);
    margin-bottom: var(--space-lg);
  }

  .cta-buttons {
    gap: var(--space-sm);
  }

  .btn {
    padding: 0.75rem 1.5rem;
    font-size: var(--font-size-sm);
  }

  .section-title {
    font-size: clamp(1.5rem, 6vw, 2rem);
  }

  .section-description {
    font-size: var(--font-size-sm);
  }

  .about-images {
    grid-template-columns: 1fr;
    gap: var(--space-sm);
  }

  .about-text p {
    font-size: var(--font-size-sm);
    margin-bottom: var(--space-md);
  }

  .project-card {
    border-radius: var(--border-radius-lg);
  }

  .project-image-container {
    height: 180px;
  }

  .project-content {
    padding: var(--space-md);
  }

  .project-title {
    font-size: var(--font-size-lg);
  }

  .project-description {
    font-size: var(--font-size-sm);
  }

  .project-tags {
    gap: 0.375rem;
  }

  .tag {
    padding: 0.25rem 0.625rem;
    font-size: 0.75rem;
  }

  .project-links {
    flex-direction: column;
    gap: var(--space-sm);
  }

  .project-links .btn {
    width: 100%;
  }

  .skills-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-sm);
  }

  .skill-card {
    padding: var(--space-md) var(--space-sm);
  }

  .skill-icon {
    width: 40px;
    height: 40px;
    margin-bottom: var(--space-sm);
  }

  .skill-name {
    font-size: var(--font-size-sm);
  }

  .contact-text {
    font-size: var(--font-size-base);
  }

  .contact-icon {
    width: 40px;
    height: 40px;
  }

  .back-to-top {
    width: 44px;
    height: 44px;
  }
}

/* ===== LARGE TABLETS (769px to 1024px) ===== */

@media (min-width: 769px) and (max-width: 1024px) {
  
  .nav-container {
    padding: var(--space-md) var(--space-lg);
  }

  .section {
    padding: var(--space-4xl) var(--space-lg);
  }

  .about-content {
    gap: var(--space-3xl);
  }

  .projects-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .skills-grid {
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  }
}

/* ===== DESKTOP (1025px and above) ===== */

@media (min-width: 1025px) {
  
  /* Add extra spacing on large screens */
  .section {
    padding: var(--space-4xl) var(--space-2xl);
  }

  /* Limit content width for readability */
  .hero-description {
    max-width: 700px;
  }

  .section-description {
    max-width: 800px;
  }

  .contact-text {
    max-width: 700px;
  }
}

/* ===== EXTRA LARGE SCREENS (1536px and above) ===== */

@media (min-width: 1536px) {
  
  /* Scale up for very large screens */
  :root {
    font-size: 18px; /* Increases all rem-based sizes */
  }

  .container,
  .nav-container,
  .hero-content,
  .section {
    max-width: 1600px;
  }
}

/* ===== LANDSCAPE ORIENTATION ===== */

/**
 * Adjust heights for landscape orientation on mobile
 */
@media (max-height: 600px) and (orientation: landscape) {
  
  .hero {
    min-height: auto;
    padding: var(--space-3xl) var(--space-md);
  }

  .hero-title {
    margin-bottom: var(--space-sm);
  }

  .hero-subtitle {
    margin-bottom: var(--space-md);
  }

  .hero-description {
    margin-bottom: var(--space-md);
  }

  .section {
    padding: var(--space-2xl) var(--space-md);
  }
}

/* ===== PRINT STYLES ===== */

/**
 * Optimize layout for printing
 */
@media print {
  
  /* Hide interactive elements */
  .navbar,
  .back-to-top,
  .cta-buttons,
  .mobile-menu-toggle {
    display: none !important;
  }

  /* Remove backgrounds and shadows */
  * {
    background: white !important;
    color: black !important;
    box-shadow: none !important;
  }

  /* Ensure content fits on page */
  .section {
    page-break-inside: avoid;
  }

  /* Adjust spacing for print */
  .hero {
    min-height: auto;
    padding: 2rem;
  }

  .section {
    padding: 1rem;
  }

  /* Show URLs for links */
  a[href]::after {
    content: " (" attr(href) ")";
  }

  /* Don't show URLs for internal links */
  a[href^="#"]::after {
    content: "";
  }
}

/* ===== TOUCH DEVICE OPTIMIZATIONS ===== */

/**
 * Optimize for touch interactions
 */
@media (hover: none) and (pointer: coarse) {
  
  /* Increase touch target sizes */
  .btn {
    padding: 1rem 2rem;
    min-height: 44px; /* iOS minimum touch target */
  }

  .nav-links a {
    padding: var(--space-md) 0;
  }

  /* Remove hover effects that don't work on touch */
  .project-card:hover,
  .skill-card:hover,
  .about-image:hover {
    transform: none;
  }

  .project-card:hover .project-image {
    transform: none;
  }

  /* Make tap areas larger */
  .social-icon,
  .contact-icon {
    padding: var(--space-sm);
  }
}

/* ===== HIGH RESOLUTION DISPLAYS ===== */

/**
 * Optimize for retina/high-DPI screens
 */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
  
  /* Ensure crisp rendering */
  body {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
  }

  /* You can load higher resolution images here */
  /* Example: */
  /* .hero-background {
    background-image: url('path/to/high-res-image@2x.png');
  } */
}