/* =============================================================================
   Responsive Design - Mobile First Approach
   ============================================================================= */

/* Extra Small Devices (phones, 600px and down) */
@media only screen and (max-width: 600px) {
  :root {
    --font-size-5xl: 2rem;
    --font-size-4xl: 1.75rem;
    --font-size-3xl: 1.5rem;
    --spacing-4xl: 3rem;
    --spacing-3xl: 2rem;
  }

  .container {
    padding: 0 var(--spacing-md);
  }

  /* Navigation */
  .nav-menu {
    position: fixed;
    top: 70px;
    left: -100%;
    width: 100%;
    height: calc(100vh - 70px);
    background: var(--bg-primary);
    flex-direction: column;
    justify-content: flex-start;
    padding-top: var(--spacing-2xl);
    transition: left var(--transition-normal);
    box-shadow: var(--shadow-lg);
  }

  .nav-menu.active {
    left: 0;
  }

  .nav-list {
    flex-direction: column;
    gap: var(--spacing-lg);
    align-items: center;
  }

  .nav-link {
    font-size: var(--font-size-lg);
    padding: var(--spacing-md);
  }

  .mobile-menu-toggle {
    display: flex;
  }

  .mobile-menu-toggle.active span:nth-child(1) {
    transform: rotate(-45deg) translate(-5px, 6px);
  }

  .mobile-menu-toggle.active span:nth-child(2) {
    opacity: 0;
  }

  .mobile-menu-toggle.active span:nth-child(3) {
    transform: rotate(45deg) translate(-5px, -6px);
  }

  /* Hero Section */
  .hero-content {
    grid-template-columns: 1fr;
    gap: var(--spacing-2xl);
    text-align: center;
  }

  .hero-title {
    font-size: var(--font-size-3xl);
    line-height: 1.3;
    word-wrap: break-word;
    overflow-wrap: break-word;
    max-width: 100%;
  }

  .hero-text {
    order: 2;
  }

  .hero-image {
    order: 1;
  }

  .hero-image .image-container {
    width: 250px;
    height: 250px;
  }

  .hero-buttons {
    justify-content: center;
  }

  .btn {
    padding: var(--spacing-md) var(--spacing-lg);
    font-size: var(--font-size-sm);
  }

  /* About Section */
  .about-content {
    grid-template-columns: 1fr;
    gap: var(--spacing-2xl);
  }

  .about-stats {
    grid-template-columns: 1fr;
    gap: var(--spacing-md);
  }

  /* Skills Section */
  .skills-content {
    grid-template-columns: 1fr;
    gap: var(--spacing-lg);
  }

  .skills-category {
    padding: var(--spacing-lg);
  }

  .skill-item {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--spacing-sm);
  }

  .skill-progress {
    width: 100%;
  }

  /* Projects Section */
  .projects-grid {
    grid-template-columns: 1fr;
    gap: var(--spacing-lg);
  }

  .project-filters {
    flex-direction: column;
    align-items: center;
    gap: var(--spacing-sm);
  }

  /* Experience Section */
  .timeline::before {
    left: 20px;
  }

  .timeline-item {
    flex-direction: column;
    padding-left: 50px;
  }

  .timeline-item:nth-child(odd),
  .timeline-item:nth-child(even) {
    flex-direction: column;
  }

  .timeline-item:nth-child(odd) .timeline-content,
  .timeline-item:nth-child(even) .timeline-content {
    text-align: left;
    margin-left: 0;
    margin-right: 0;
  }

  .timeline-icon {
    left: 20px;
    transform: translateX(-50%);
  }

  /* Testimonials */
  .testimonial-text::before,
  .testimonial-text::after {
    display: none;
  }

  .testimonial-author {
    flex-direction: column;
    gap: var(--spacing-sm);
  }

  /* Contact Section */
  .contact-content {
    grid-template-columns: 1fr;
    gap: var(--spacing-2xl);
  }

  .contact-item {
    flex-direction: column;
    text-align: center;
    gap: var(--spacing-md);
  }

  .social-links {
    justify-content: center;
  }

  /* Footer */
  .footer-content {
    grid-template-columns: 1fr;
    gap: var(--spacing-lg);
    text-align: center;
  }
}

/* Very Small Devices (phones in portrait, 480px and down) */
@media only screen and (max-width: 480px) {
  .hero-title {
    font-size: var(--font-size-2xl);
    line-height: 1.4;
    padding: 0 var(--spacing-sm);
  }

  .hero-subtitle {
    font-size: var(--font-size-lg);
    min-height: 50px;
  }

  .hero-description {
    font-size: var(--font-size-base);
  }

  .container {
    padding: 0 var(--spacing-sm);
  }
}

/* Small Devices (portrait tablets and large phones, 600px and up) */
@media only screen and (min-width: 600px) and (max-width: 768px) {
  .hero-content {
    grid-template-columns: 1fr;
    gap: var(--spacing-3xl);
    text-align: center;
  }

  .hero-title {
    font-size: var(--font-size-4xl);
    line-height: 1.25;
    word-wrap: break-word;
    overflow-wrap: break-word;
  }

  .about-content {
    grid-template-columns: 1fr;
    gap: var(--spacing-3xl);
  }

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

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

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

  .contact-content {
    grid-template-columns: 1fr;
    gap: var(--spacing-3xl);
  }

  .timeline::before {
    left: 30px;
  }

  .timeline-item {
    padding-left: 80px;
  }

  .timeline-icon {
    left: 30px;
  }

  .timeline-item:nth-child(odd),
  .timeline-item:nth-child(even) {
    flex-direction: column;
  }

  .timeline-item:nth-child(odd) .timeline-content,
  .timeline-item:nth-child(even) .timeline-content {
    text-align: left;
    margin-left: 0;
    margin-right: 0;
  }
}

/* Medium Devices (landscape tablets, 768px and up) */
@media only screen and (min-width: 768px) and (max-width: 992px) {
  .nav-list {
    gap: var(--spacing-lg);
  }

  .hero-content {
    gap: var(--spacing-3xl);
  }

  .hero-image .image-container {
    width: 280px;
    height: 280px;
  }

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

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

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

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

/* Large Devices (laptops/desktops, 992px and up) */
@media only screen and (min-width: 992px) and (max-width: 1200px) {
  .container {
    max-width: 960px;
  }

  .hero-image .image-container {
    width: 320px;
    height: 320px;
  }

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

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

/* Extra Large Devices (large laptops and desktops, 1200px and up) */
@media only screen and (min-width: 1200px) {
  .container {
    max-width: 1200px;
  }

  .hero-title {
    font-size: var(--font-size-6xl);
  }

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

/* Ultra Wide Screens (1400px and up) */
@media only screen and (min-width: 1400px) {
  .container {
    max-width: 1320px;
  }

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

/* Landscape Orientation Adjustments */
@media only screen and (max-height: 500px) and (orientation: landscape) {
  .hero {
    min-height: auto;
    padding: var(--spacing-4xl) 0;
  }

  .hero-content {
    grid-template-columns: 1fr 1fr;
    gap: var(--spacing-2xl);
  }

  .hero-image .image-container {
    width: 200px;
    height: 200px;
  }

  .scroll-indicator {
    display: none;
  }
}

/* High DPI Displays */
@media only screen and (-webkit-min-device-pixel-ratio: 2),
  only screen and (min--moz-device-pixel-ratio: 2),
  only screen and (-o-min-device-pixel-ratio: 2/1),
  only screen and (min-device-pixel-ratio: 2),
  only screen and (min-resolution: 192dpi),
  only screen and (min-resolution: 2dppx) {
  .project-image img,
  .about-image img,
  .hero-image img {
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
  }
}

/* Print Styles */
@media print {
  * {
    background: transparent !important;
    color: black !important;
    box-shadow: none !important;
    text-shadow: none !important;
  }

  .navbar,
  .scroll-indicator,
  .btn,
  .social-links,
  .contact-form,
  .slider-controls {
    display: none !important;
  }

  .hero,
  .about,
  .skills,
  .experience {
    page-break-inside: avoid;
  }

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

  a[href^="http"]:after {
    content: " (" attr(href) ")";
  }

  .container {
    max-width: none;
    margin: 0;
    padding: 0;
  }

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

  h1,
  h2,
  h3 {
    page-break-after: avoid;
  }
}

/* Accessibility Improvements */
@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;
  }

  .hero-particles {
    animation: none;
  }

  .scroll-arrow {
    animation: none;
  }

  .cursor {
    animation: none;
  }
}

/* High Contrast Mode */
@media (prefers-contrast: high) {
  :root {
    --primary-color: #0000ff;
    --text-primary: #000000;
    --text-secondary: #000000;
    --bg-primary: #ffffff;
    --bg-secondary: #ffffff;
    --bg-card: #ffffff;
    --shadow-md: 0 0 0 2px #000000;
    --shadow-lg: 0 0 0 3px #000000;
  }

  .btn-outline {
    border-width: 3px;
  }

  .nav-link::after {
    height: 3px;
  }
}

/* Focus Styles for Better Accessibility */
*:focus {
  outline: 2px solid var(--primary-color);
  outline-offset: 2px;
}

.btn:focus,
.nav-link:focus,
.social-link:focus {
  outline: 3px solid var(--primary-color);
  outline-offset: 3px;
}

/* Skip Link for Screen Readers */
.skip-link {
  position: absolute;
  top: -40px;
  left: 6px;
  background: var(--primary-color);
  color: white;
  padding: 8px;
  text-decoration: none;
  border-radius: 4px;
  z-index: 1000;
}

.skip-link:focus {
  top: 6px;
}

/* Loading States */
.loading-skeleton {
  background: linear-gradient(
    90deg,
    var(--bg-tertiary) 25%,
    var(--bg-secondary) 50%,
    var(--bg-tertiary) 75%
  );
  background-size: 200% 100%;
  animation: loading 1.5s infinite;
}

@keyframes loading {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

/* Utility Classes for Responsive Design */
.d-none {
  display: none !important;
}
.d-block {
  display: block !important;
}
.d-inline {
  display: inline !important;
}
.d-inline-block {
  display: inline-block !important;
}
.d-flex {
  display: flex !important;
}
.d-grid {
  display: grid !important;
}

@media (max-width: 575px) {
  .d-xs-none {
    display: none !important;
  }
  .d-xs-block {
    display: block !important;
  }
  .d-xs-flex {
    display: flex !important;
  }
}

@media (min-width: 576px) and (max-width: 767px) {
  .d-sm-none {
    display: none !important;
  }
  .d-sm-block {
    display: block !important;
  }
  .d-sm-flex {
    display: flex !important;
  }
}

@media (min-width: 768px) and (max-width: 991px) {
  .d-md-none {
    display: none !important;
  }
  .d-md-block {
    display: block !important;
  }
  .d-md-flex {
    display: flex !important;
  }
}

@media (min-width: 992px) and (max-width: 1199px) {
  .d-lg-none {
    display: none !important;
  }
  .d-lg-block {
    display: block !important;
  }
  .d-lg-flex {
    display: flex !important;
  }
}

@media (min-width: 1200px) {
  .d-xl-none {
    display: none !important;
  }
  .d-xl-block {
    display: block !important;
  }
  .d-xl-flex {
    display: flex !important;
  }
}
