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

/* ==========================================
   Extra Large Devices (1400px and up)
   ========================================== */
@media (min-width: 1400px) {
  .container {
    max-width: 1400px;
  }
  
  .section-title {
    font-size: 3.5rem;
  }
  
  .greeting {
    font-size: 4rem;
  }
  
  .roles {
    font-size: 3rem;
  }
}

/* ==========================================
   Large Devices (1024px to 1199px)
   ========================================== */
@media (max-width: 1199px) {
  .container {
    max-width: 1024px;
  }
  
  .nav-container {
    padding: 1rem 1.5rem;
  }
  
  .nav-menu {
    gap: 1.5rem;
  }
  
  .about-content {
    gap: 3rem;
  }
  
  .skills-grid {
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  }
  
  .projects-grid {
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  }
}

/* ==========================================
   Medium Devices (768px to 1023px) - Tablets
   ========================================== */
@media (max-width: 1023px) {
  html {
    font-size: 15px;
  }
  
  .container {
    padding: 0 1.5rem;
  }
  
  section {
    padding: 80px 0;
  }
  
  /* Navigation */
  .nav-menu {
    position: fixed;
    top: 70px;
    right: -100%;
    width: 300px;
    height: calc(100vh - 70px);
    background: var(--nav-bg);
    backdrop-filter: blur(10px);
    flex-direction: column;
    padding: 2rem;
    gap: 1rem;
    transition: right 0.3s ease;
    box-shadow: -5px 0 15px rgba(0, 0, 0, 0.3);
    z-index: 999;
  }
  
  .nav-menu.active {
    right: 0;
  }
  
  .hamburger {
    display: flex;
  }
  
  /* Hero Section */
  .greeting {
    font-size: 2.5rem;
  }
  
  .roles {
    font-size: 2rem;
    min-height: 60px;
  }
  
  .hero-subtitle {
    font-size: 1rem;
  }
  
  .cta-buttons {
    flex-direction: column;
    gap: 1rem;
  }
  
  .btn {
    width: 100%;
    max-width: 300px;
  }
  
  /* About Section */
  .about-content {
    grid-template-columns: 1fr;
    gap: 2rem;
  }
  
  .about-image {
    max-width: 300px;
    margin: 0 auto;
  }
  
  .about-text {
    text-align: center;
  }
  
  .interest-tags {
    justify-content: center;
  }
  
  /* Skills Section */
  .skills-grid {
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1.5rem;
  }
  
  .circular-progress {
    width: 120px;
    height: 120px;
  }
  
  /* Education Timeline */
  .timeline {
    max-width: 600px;
  }
  
  .timeline-line {
    left: 30px;
  }
  
  .timeline-item {
    grid-template-columns: 1fr;
    margin: 2rem 0 2rem 60px;
  }
  
  .timeline-item:nth-child(odd) .timeline-card,
  .timeline-item:nth-child(even) .timeline-card {
    grid-column: 1;
  }
  
  .timeline-dot {
    left: 30px;
  }
  
  /* Projects Section */
  .projects-grid {
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 2rem;
  }
  
  .project-image {
    height: 200px;
  }
  
  /* GitHub Stats */
  .stats-grid {
    grid-template-columns: 1fr;
  }
  
  /* Certifications */
  .certifications-grid {
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
  }
  
  .certification-card {
    height: 320px;
  }
  
  /* Contact Section */
  .contact-content {
    grid-template-columns: 1fr;
    gap: 2rem;
  }
  
  .contact-info {
    flex-direction: row;
    flex-wrap: wrap;
  }
  
  .info-card {
    flex: 1 1 200px;
  }
  
  /* Footer */
  .footer-content {
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
  }
}

/* ==========================================
   Small Devices (480px to 767px) - Mobile
   ========================================== */
@media (max-width: 767px) {
  html {
    font-size: 14px;
  }
  
  .container {
    padding: 0 1rem;
  }
  
  section {
    padding: 60px 0;
  }
  
  /* Navigation */
  .nav-container {
    padding: 0.8rem 1rem;
  }
  
  .nav-logo a {
    font-size: 1.5rem;
  }
  
  .nav-menu {
    width: 250px;
    top: 60px;
    height: calc(100vh - 60px);
    padding: 1.5rem;
  }
  
  /* Hero Section */
  .hero-section {
    min-height: 100vh;
    padding-top: 60px;
  }
  
  .hero-content {
    padding: 1rem;
  }
  
  .greeting {
    font-size: 2rem;
  }
  
  .roles {
    font-size: 1.5rem;
    min-height: 50px;
  }
  
  .hero-subtitle {
    font-size: 0.9rem;
    margin-bottom: 2rem;
  }
  
  .cta-buttons {
    gap: 0.8rem;
  }
  
  .btn {
    padding: 0.7rem 1.5rem;
    font-size: 0.9rem;
  }
  
  .social-links {
    gap: 1rem;
  }
  
  .social-links a {
    width: 45px;
    height: 45px;
    font-size: 1.1rem;
  }
  
  .scroll-indicator {
    display: none;
  }
  
  /* Section Titles */
  .section-title {
    font-size: 2rem;
  }
  
  .section-subtitle {
    font-size: 1rem;
  }
  
  /* About Section */
  .about-image {
    max-width: 250px;
  }
  
  .about-text h3 {
    font-size: 1.5rem;
  }
  
  .glass-card {
    padding: 1.5rem;
  }
  
  .interest-tags {
    gap: 0.7rem;
  }
  
  .tag {
    padding: 0.4rem 0.8rem;
    font-size: 0.85rem;
  }
  
  /* Skills Section */
  .skills-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
  }
  
  .skill-card {
    padding: 1.5rem 1rem;
  }
  
  .skill-icon {
    font-size: 2.5rem;
  }
  
  .skill-name {
    font-size: 1rem;
  }
  
  .circular-progress {
    width: 100px;
    height: 100px;
  }
  
  .progress-number {
    font-size: 1.2rem;
  }
  
  /* Education Timeline */
  .timeline {
    max-width: 100%;
  }
  
  .timeline-line {
    left: 20px;
  }
  
  .timeline-item {
    margin: 1.5rem 0 1.5rem 50px;
  }
  
  .timeline-dot {
    left: 20px;
    width: 16px;
    height: 16px;
  }
  
  .timeline-icon {
    width: 50px;
    height: 50px;
    font-size: 1.2rem;
  }
  
  .timeline-card h3 {
    font-size: 1.2rem;
  }
  
  .timeline-card h4 {
    font-size: 1rem;
  }
  
  /* Projects Section */
  .project-filters {
    gap: 0.7rem;
  }
  
  .filter-btn {
    padding: 0.5rem 1.2rem;
    font-size: 0.9rem;
  }
  
  .projects-grid {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }
  
  .project-image {
    height: 180px;
  }
  
  .project-content {
    padding: 1.2rem;
  }
  
  .project-content h3 {
    font-size: 1.2rem;
  }
  
  .project-links {
    flex-direction: column;
    gap: 0.7rem;
  }
  
  .project-link {
    padding: 0.5rem 1.2rem;
    font-size: 0.9rem;
  }
  
  /* GitHub Stats */
  .stats-grid {
    gap: 1.5rem;
  }
  
  .stat-card {
    padding: 1rem;
  }
  
  /* Certifications */
  .certifications-grid {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }
  
  .certification-card {
    height: 280px;
  }
  
  .cert-front,
  .cert-back {
    padding: 1.5rem;
  }
  
  .cert-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
  }
  
  .certification-card h3 {
    font-size: 1.1rem;
  }
  
  /* Currently Learning */
  .learning-item {
    padding: 1.5rem;
  }
  
  .learning-header h3 {
    font-size: 1.1rem;
  }
  
  .learning-percent {
    font-size: 1rem;
  }
  
  /* Competitive Programming */
  .cp-grid {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }
  
  .cp-card {
    padding: 2rem;
  }
  
  .cp-logo {
    width: 70px;
    height: 70px;
    font-size: 2rem;
  }
  
  .cp-card h3 {
    font-size: 1.3rem;
  }
  
  .stat-value {
    font-size: 1.3rem;
  }
  
  /* Fun Facts */
  .facts-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
  }
  
  .fact-card {
    padding: 1.5rem;
  }
  
  .fact-icon {
    font-size: 2.5rem;
    margin-bottom: 1rem;
  }
  
  .fact-card h3 {
    font-size: 2rem;
  }
  
  .fact-card p {
    font-size: 0.9rem;
  }
  
  /* Contact Section */
  .contact-info {
    flex-direction: column;
    gap: 1rem;
  }
  
  .contact-form {
    padding: 1.5rem;
  }
  
  .form-group {
    margin-bottom: 1.5rem;
  }
  
  /* Footer */
  .footer {
    padding: 3rem 0 1.5rem;
  }
  
  .footer-content {
    grid-template-columns: 1fr;
    gap: 2rem;
    text-align: center;
  }
  
  .footer-section h3 {
    font-size: 1.3rem;
  }
  
  .footer-section h4 {
    font-size: 1.1rem;
  }
  
  .footer .social-links {
    justify-content: center;
  }
  
  .back-to-top {
    width: 45px;
    height: 45px;
    bottom: 20px;
    right: 20px;
  }
}

/* ==========================================
   Extra Small Devices (up to 479px)
   ========================================== */
@media (max-width: 479px) {
  html {
    font-size: 13px;
  }
  
  /* Navigation */
  .nav-menu {
    width: 100%;
    right: -100%;
  }
  
  /* Hero Section */
  .greeting {
    font-size: 1.8rem;
  }
  
  .roles {
    font-size: 1.3rem;
  }
  
  .cta-buttons {
    width: 100%;
  }
  
  .btn {
    width: 100%;
    max-width: none;
  }
  
  /* Skills Section */
  .skills-grid {
    grid-template-columns: 1fr;
  }
  
  /* Projects Section */
  .project-filters {
    flex-direction: column;
    width: 100%;
  }
  
  .filter-btn {
    width: 100%;
  }
  
  /* Fun Facts */
  .facts-grid {
    grid-template-columns: 1fr;
  }
  
  /* Reduce animations on very small screens */
  .skill-card:hover,
  .project-card:hover,
  .fact-card:hover {
    transform: none;
  }
}

/* ==========================================
   Landscape Orientation (Mobile)
   ========================================== */
@media (max-width: 767px) and (orientation: landscape) {
  .hero-section {
    min-height: auto;
    padding: 100px 0 60px;
  }
  
  .greeting {
    font-size: 1.8rem;
  }
  
  .roles {
    font-size: 1.4rem;
  }
  
  .hero-subtitle {
    margin-bottom: 1.5rem;
  }
  
  .cta-buttons {
    flex-direction: row;
    justify-content: center;
  }
}

/* ==========================================
   Print Styles
   ========================================== */
@media print {
  * {
    background: white !important;
    color: black !important;
    box-shadow: none !important;
    text-shadow: none !important;
  }
  
  #navbar,
  .hamburger,
  .theme-toggle,
  .back-to-top,
  #preloader,
  #particles-js,
  .scroll-indicator {
    display: none !important;
  }
  
  a {
    text-decoration: underline;
  }
  
  a[href]::after {
    content: " (" attr(href) ")";
  }
  
  .container {
    max-width: 100%;
  }
  
  section {
    page-break-inside: avoid;
    padding: 20px 0;
  }
}

/* ==========================================
   High DPI / Retina Displays
   ========================================== */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
  /* Optimize images and graphics for retina displays */
  .profile-photo img,
  .project-image img,
  .stat-card img {
    image-rendering: -webkit-optimize-contrast;
  }
}

/* ==========================================
   Dark Mode System Preference
   ========================================== */
@media (prefers-color-scheme: dark) {
  /* Already using dark mode as default */
}

@media (prefers-color-scheme: light) {
  /* User can toggle manually */
}

/* ==========================================
   Reduced Motion Preference
   ========================================== */
@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;
  }
  
  #particles-js {
    display: none;
  }
}

/* ==========================================
   Touch Device Optimizations
   ========================================== */
@media (hover: none) and (pointer: coarse) {
  /* Remove hover effects on touch devices */
  .btn:hover,
  .nav-link:hover,
  .social-links a:hover,
  .skill-card:hover,
  .project-card:hover,
  .fact-card:hover {
    transform: none;
  }
  
  /* Increase touch target sizes */
  .btn,
  .filter-btn,
  .nav-link,
  .social-links a {
    min-height: 44px;
    min-width: 44px;
  }
  
  /* Disable parallax on touch devices */
  .parallax-layer {
    transform: none !important;
  }
}

/* ==========================================
   High Contrast Mode
   ========================================== */
@media (prefers-contrast: high) {
  * {
    border-color: currentColor !important;
  }
  
  .glass-card {
    background: var(--bg-secondary) !important;
    border: 2px solid currentColor !important;
  }
}

/* ==========================================
   Container Queries (Modern Browsers)
   ========================================== */
@container (max-width: 700px) {
  .skill-card {
    padding: 1rem;
  }
}
