/* ===== RESPONSIVE OPTIMIZATIONS ===== */

/* Extra Large Devices (1400px and up) */
@media (min-width: 1400px) {
    .container {
        max-width: 1320px;
    }
    
    .hero-title {
        font-size: 5.5rem;
    }
    
    .section-title {
        font-size: 3.5rem;
    }
    
    .skill-card {
        padding: 2.5rem;
    }
    
    .portfolio-image {
        height: 300px;
    }
}

/* Large Devices (1200px and up) */
@media (min-width: 1200px) and (max-width: 1399px) {
    .hero-title {
        font-size: 4.5rem;
    }
    
    .section-title {
        font-size: 3rem;
    }
    
    .avatar-img {
        width: 280px;
        height: 280px;
    }
}

/* Medium Devices (992px and up) */
@media (min-width: 992px) and (max-width: 1199px) {
    .hero-title {
        font-size: 4rem;
    }
    
    .section-title {
        font-size: 2.8rem;
    }
    
    .skill-card {
        padding: 1.8rem;
    }
    
    .portfolio-image {
        height: 220px;
    }
    
    .contact-form {
        padding: 2.5rem;
    }
}

/* Small Devices (768px and up) */
@media (min-width: 768px) and (max-width: 991px) {
    .hero-title {
        font-size: 3.5rem;
    }
    
    .section-title {
        font-size: 2.5rem;
    }
    
    .hero-subtitle {
        font-size: 1.3rem;
    }
    
    .avatar-img {
        width: 220px;
        height: 220px;
    }
    
    .skill-card {
        padding: 1.5rem;
        margin-bottom: 1.5rem;
    }
    
    .portfolio-image {
        height: 200px;
    }
    
    .contact-form {
        padding: 2rem;
    }
    
    .social-link {
        width: 50px;
        height: 50px;
        font-size: 1.3rem;
    }
    
    .navbar-brand {
        font-size: 1.6rem;
    }
}

/* Extra Small Devices (576px and up) */
@media (min-width: 576px) and (max-width: 767px) {
    .hero-title {
        font-size: 3rem;
    }
    
    .section-title {
        font-size: 2.2rem;
    }
    
    .hero-subtitle {
        font-size: 1.2rem;
        letter-spacing: 1px;
    }
    
    .avatar-img {
        width: 200px;
        height: 200px;
    }
    
    .skill-card {
        padding: 1.3rem;
        margin-bottom: 1rem;
    }
    
    .skill-icon {
        font-size: 2.5rem;
    }
    
    .portfolio-image {
        height: 180px;
    }
    
    .contact-form {
        padding: 1.5rem;
    }
    
    .hero-buttons .btn {
        padding: 0.8rem 1.5rem;
        font-size: 0.9rem;
        margin: 0.3rem;
    }
    
    .stat-number {
        font-size: 2rem;
    }
    
    .social-link {
        width: 45px;
        height: 45px;
        font-size: 1.2rem;
    }
}

/* Extra Small Devices (less than 576px) */
@media (max-width: 575px) {
    .hero-title {
        font-size: 2.5rem;
        line-height: 1.2;
    }
    
    .section-title {
        font-size: 2rem;
    }
    
    .hero-subtitle {
        font-size: 1rem;
        letter-spacing: 0.5px;
    }
    
    .avatar-img {
        width: 180px;
        height: 180px;
    }
    
    .skill-card {
        padding: 1rem;
        margin-bottom: 1rem;
    }
    
    .skill-icon {
        font-size: 2rem;
    }
    
    .skill-name {
        font-size: 1.1rem;
    }
    
    .portfolio-image {
        height: 160px;
    }
    
    .contact-form {
        padding: 1rem;
    }
    
    .hero-buttons .btn {
        display: block;
        width: 100%;
        margin: 0.5rem 0;
        padding: 1rem;
        font-size: 0.9rem;
    }
    
    .stat-number {
        font-size: 1.8rem;
    }
    
    .stat-label {
        font-size: 0.8rem;
    }
    
    .social-link {
        width: 40px;
        height: 40px;
        font-size: 1rem;
    }
    
    .navbar-brand {
        font-size: 1.4rem;
    }
    
    .section-subtitle {
        font-size: 1rem;
    }
    
    .skills-category-title {
        font-size: 1.5rem;
    }
    
    .portfolio-content {
        padding: 1rem;
    }
    
    .portfolio-content h4 {
        font-size: 1.2rem;
    }
    
    .portfolio-content p {
        font-size: 0.9rem;
    }
}

/* Ultra Small Devices (less than 400px) */
@media (max-width: 399px) {
    .hero-title {
        font-size: 2rem;
    }
    
    .section-title {
        font-size: 1.8rem;
    }
    
    .avatar-img {
        width: 150px;
        height: 150px;
    }
    
    .skill-card {
        padding: 0.8rem;
    }
    
    .contact-form {
        padding: 0.8rem;
    }
    
    .navbar-brand {
        font-size: 1.2rem;
    }
    
    .hero-buttons .btn {
        padding: 0.8rem;
        font-size: 0.8rem;
    }
    
    .social-link {
        width: 35px;
        height: 35px;
        font-size: 0.9rem;
    }
}

/* Landscape Orientation Optimizations */
@media (orientation: landscape) and (max-height: 600px) {
    .hero-section {
        min-height: 100vh;
        padding: 2rem 0;
    }
    
    .hero-title {
        font-size: 3rem;
        margin-bottom: 0.5rem;
    }
    
    .hero-subtitle {
        margin-bottom: 2rem;
    }
    
    .hero-buttons .btn {
        padding: 0.6rem 1.2rem;
        margin: 0.2rem;
    }
    
    .scroll-indicator {
        display: none;
    }
}

/* High DPI Displays */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .avatar-img {
        image-rendering: -webkit-optimize-contrast;
        image-rendering: crisp-edges;
    }
    
    .portfolio-image img {
        image-rendering: -webkit-optimize-contrast;
        image-rendering: crisp-edges;
    }
}

/* Touch Device Optimizations */
@media (hover: none) and (pointer: coarse) {
    .skill-card:hover,
    .portfolio-item:hover,
    .social-link:hover {
        transform: none;
    }
    
    .skill-card:active,
    .portfolio-item:active,
    .social-link:active {
        transform: scale(0.95);
    }
    
    .magnetic:hover {
        transform: none;
    }
    
    .btn:hover {
        transform: none;
    }
    
    .btn:active {
        transform: scale(0.95);
    }
    
    /* Increase touch targets */
    .nav-link {
        padding: 1rem !important;
    }
    
    .social-link {
        min-width: 44px;
        min-height: 44px;
    }
    
    .btn {
        min-height: 44px;
    }
}

/* Reduced Motion Preferences */
@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-bg,
    .matrix-bg,
    .cyber-grid,
    .liquid-bg {
        display: none;
    }
    
    .glitch,
    .neon,
    .float,
    .pulse {
        animation: none !important;
    }
}

/* Dark Mode Support */
@media (prefers-color-scheme: light) {
    :root {
        --dark-bg: #f8f9fa;
        --darker-bg: #e9ecef;
        --light-text: #212529;
        --gray-text: #6c757d;
    }
    
    body {
        background: var(--dark-bg);
        color: var(--light-text);
    }
    
    .navbar {
        background: rgba(248, 249, 250, 0.95);
    }
    
    .skill-card,
    .portfolio-item,
    .contact-form {
        background: rgba(255, 255, 255, 0.9);
        border-color: rgba(0, 212, 255, 0.3);
    }
}

/* Print Styles */
@media print {
    .navbar,
    .particles-bg,
    .matrix-bg,
    .cyber-grid,
    .liquid-bg,
    .scroll-indicator,
    .hero-buttons {
        display: none !important;
    }
    
    .hero-section {
        min-height: auto;
        padding: 2rem 0;
    }
    
    .section-title {
        color: #000 !important;
    }
    
    .skill-card,
    .portfolio-item {
        break-inside: avoid;
        border: 1px solid #ccc;
    }
    
    a {
        text-decoration: underline;
    }
    
    a[href^="http"]:after {
        content: " (" attr(href) ")";
    }
}

/* Container Queries (Future-proofing) */
@container (max-width: 400px) {
    .skill-card {
        padding: 0.5rem;
    }
    
    .skill-icon {
        font-size: 1.5rem;
    }
}

/* Focus Styles for Accessibility */
.btn:focus,
.nav-link:focus,
.social-link:focus,
.form-control:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

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

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

/* Loading State Optimizations */
.loading .skill-card,
.loading .portfolio-item {
    opacity: 0.5;
    pointer-events: none;
}

/* Performance Optimizations */
.will-change-transform {
    will-change: transform;
}

.will-change-opacity {
    will-change: opacity;
}

/* GPU Acceleration */
.gpu-accelerated {
    transform: translateZ(0);
    backface-visibility: hidden;
    perspective: 1000;
}

/* Smooth Scrolling Fallback */
@supports not (scroll-behavior: smooth) {
    html {
        scroll-behavior: auto;
    }
}

/* Grid Layout Fallback */
@supports not (display: grid) {
    .portfolio-grid {
        display: flex;
        flex-wrap: wrap;
    }
    
    .portfolio-grid > div {
        flex: 1 1 300px;
    }
}
