/* --- Responsive Design --- */

/* Tablets & Mid-size Displays */
@media (max-width: 1024px) {
    section {
        padding: 4rem 6%;
    }

    .header {
        padding: 1.2rem 6%;
    }

    .hero-container {
        gap: 2rem;
    }

    .hero-text h1 {
        font-size: 2.5rem;
    }

    .hero-img {
        width: 270px;
        height: 270px;
    }

    .projects-container {
        grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
        gap: 2rem;
    }

    .skills-container {
        grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
        gap: 1.5rem;
    }

    .about-container {
        grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
        gap: 1.5rem;
    }
}

/* Small Tablets & Large Phones */
@media (max-width: 768px) {
    section {
        padding: 3.5rem 5%;
    }

    .header {
        padding: 1rem 5%;
    }

    .navbar ul {
        gap: 1rem;
    }

    .navbar a {
        font-size: 0.9rem;
    }

    .hero {
        padding-top: 6rem;
        min-height: auto;
        padding-bottom: 3rem;
    }

    .hero-container {
        flex-direction: column-reverse;
        text-align: center;
        gap: 2.5rem;
    }

    .hero-description {
        display: flex;
        flex-direction: column;
        align-items: center;
        width: 100%;
    }

    .hero-buttons {
        justify-content: center;
        width: 100%;
        flex-wrap: wrap;
    }

    .hero-img {
        width: 220px;
        height: 220px;
    }

    .hero-text h1 {
        font-size: 2.2rem;
    }

    .hero-text h3 {
        font-size: 1.2rem;
    }

    .projects-container,
    .contact-container {
        grid-template-columns: 1fr;
    }

    .about-container {
        grid-template-columns: 1fr;
        max-width: 500px;
        margin: 0 auto;
    }

    .skills-container {
        grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    }

    /* Mobile Menu */
    .hamburger {
        display: block;
        order: 2;
    }

    .theme-toggle {
        order: 3;
    }

    .navbar {
        position: fixed;
        top: 0;
        right: -100%;
        width: 75%;
        max-width: 320px;
        height: 100vh;
        background: var(--bg-main);
        backdrop-filter: blur(15px);
        display: flex;
        justify-content: center;
        align-items: center;
        transition: right 0.4s ease;
        border-left: 1px solid var(--border-color);
        box-shadow: -10px 0 30px rgba(0, 0, 0, 0.5);
        padding: 2rem;
    }

    .navbar.active {
        right: 0;
    }

    .navbar ul {
        flex-direction: column;
        align-items: center;
        gap: 2.5rem;
    }

    .navbar a {
        font-size: 1.2rem;
    }

    .navbar a::after {
        bottom: -6px;
    }

    /* Contact Section */
    .contact-container {
        gap: 2rem;
    }

    .contact-item {
        padding: 1rem 1.2rem;
    }

    .contact-form {
        padding: 1.5rem;
    }

    /* Footer */
    .footer {
        padding: 2rem 5% 1.5rem 5%;
    }

    .social-links {
        flex-wrap: wrap;
        gap: 1rem;
    }

    .social-links a {
        font-size: 0.9rem;
        padding: 0.3rem 0.8rem;
    }

    /* Scroll to Top */
    .scroll-top-btn {
        bottom: 1.5rem;
        right: 1.5rem;
        width: 45px;
        height: 45px;
        font-size: 1rem;
    }

    /* Section Titles */
    .section-title {
        font-size: 1.8rem;
    }

    .projects-subtitle,
    .contact-subtitle {
        font-size: 0.95rem;
    }
}

/* Small Mobile Phones */
@media (max-width: 480px) {
    .logo {
        font-size: 1.4rem;
    }

    .header {
        padding: 0.8rem 4%;
    }

    section {
        padding: 2.5rem 4%;
    }

    .hero {
        padding-top: 5rem;
    }

    .hero-text h1 {
        font-size: 1.8rem;
    }

    .hero-text h3 {
        font-size: 1rem;
    }

    .hero-img {
        width: 180px;
        height: 180px;
    }

    .hero-buttons {
        flex-direction: column;
        gap: 0.8rem;
        width: 100%;
        max-width: 300px;
    }

    .btn {
        width: 100%;
        justify-content: center;
        padding: 0.6rem 1.2rem;
        font-size: 0.85rem;
    }

    .greeting {
        font-size: 1rem;
    }

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

    .availability,
    .location {
        font-size: 0.85rem;
    }

    .project-buttons {
        flex-direction: column;
        gap: 0.6rem;
    }

    .live-demo-button,
    .github-button {
        text-align: center;
        justify-content: center;
        width: 100%;
        padding: 0.5rem 0.8rem;
        font-size: 0.8rem;
    }

    .contact-item {
        flex-direction: column;
        text-align: center;
        gap: 0.8rem;
        padding: 1rem;
    }

    .contact-item .icon {
        font-size: 1.3rem;
    }

    .contact-details h3 {
        font-size: 0.9rem;
    }

    .contact-details p {
        font-size: 0.85rem;
    }

    .form-group input,
    .form-group textarea {
        padding: 0.6rem;
        font-size: 0.9rem;
    }

    .form-group label {
        font-size: 0.85rem;
    }

    .skills-container {
        grid-template-columns: 1fr 1fr;
        gap: 1rem;
    }

    .skills-card {
        padding: 1.2rem;
    }

    .skills-card h3 {
        font-size: 1rem;
    }

    .skills-card ul li {
        font-size: 0.8rem;
        padding: 0.4rem 0.6rem;
    }

    .project-card .project-content {
        padding: 1rem;
    }

    .project-content h3 {
        font-size: 1.1rem;
    }

    .project-content p {
        font-size: 0.85rem;
    }

    .tech-stack span {
        font-size: 0.7rem;
        padding: 0.2rem 0.5rem;
    }

    .project-img-wrapper {
        height: 160px;
    }

    .about-card {
        padding: 1.5rem;
    }

    .about-card h3 {
        font-size: 1.1rem;
    }

    .card-icon {
        font-size: 1.5rem;
    }

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

    .footer-content h2 {
        font-size: 1.4rem;
    }

    .footer-content p {
        font-size: 0.85rem;
    }

    .social-links {
        flex-direction: column;
        gap: 0.8rem;
        align-items: center;
    }

    .social-links a {
        font-size: 0.85rem;
    }

    .scroll-top-btn {
        bottom: 1rem;
        right: 1rem;
        width: 40px;
        height: 40px;
        font-size: 0.9rem;
    }

    .navbar {
        width: 85%;
        max-width: 280px;
    }

    .navbar a {
        font-size: 1.1rem;
    }

    .submit-btn {
        font-size: 0.9rem;
        padding: 0.6rem;
    }

    .error-message {
        font-size: 0.75rem;
    }
}

/* Very Small Phones (320px and below) */
@media (max-width: 360px) {
    .hero-img {
        width: 150px;
        height: 150px;
    }

    .hero-text h1 {
        font-size: 1.5rem;
    }

    .skills-container {
        grid-template-columns: 1fr;
        gap: 0.8rem;
    }

    .logo {
        font-size: 1.2rem;
    }

    .header {
        padding: 0.6rem 3%;
    }

    section {
        padding: 2rem 3%;
    }

    .btn {
        font-size: 0.8rem;
        padding: 0.5rem 1rem;
    }

    .project-img-wrapper {
        height: 140px;
    }
}

/* --- Print Styles --- */
@media print {
    .header {
        position: static;
        background: none !important;
        backdrop-filter: none !important;
        box-shadow: none !important;
    }
    
    .hero {
        min-height: auto;
        padding-top: 2rem;
        padding-bottom: 2rem;
    }
    
    .btn,
    .scroll-top-btn,
    .theme-toggle,
    .hamburger,
    .social-links,
    #loader {
        display: none !important;
    }
    
    .project-card {
        break-inside: avoid;
        page-break-inside: avoid;
        border: 1px solid #ccc;
        box-shadow: none !important;
    }
    
    .project-card:hover {
        transform: none !important;
    }
    
    section {
        padding: 2rem 5%;
    }
    
    .about-card,
    .skills-card,
    .contact-item,
    .contact-form {
        border: 1px solid #ccc;
        box-shadow: none !important;
    }
    
    .footer {
        background: none !important;
        border-top: 1px solid #ccc;
    }
    
    .project-img-wrapper img {
        transform: none !important;
    }
}

/* --- Dark Mode Mobile Specific Fixes --- */
@media (max-width: 768px) {
    [data-theme="light"] .navbar {
        background: var(--bg-main);
    }
    
    [data-theme="light"] .navbar.active {
        background: rgba(240, 244, 248, 0.98);
    }
    
    [data-theme="light"] .navbar a {
        color: var(--text-main);
    }
}

/* --- Accessibility: Reduced Motion --- */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
    
    .hero-img:hover,
    .project-card:hover .project-img-wrapper img {
        transform: none !important;
    }
    
    .project-card:hover {
        transform: none !important;
    }
}

/* --- Landscape Mode for Mobile --- */
@media (max-height: 500px) and (orientation: landscape) {
    .hero {
        min-height: auto;
        padding-top: 5rem;
        padding-bottom: 2rem;
    }
    
    .hero-container {
        flex-direction: row;
        gap: 2rem;
    }
    
    .hero-img {
        width: 150px;
        height: 150px;
    }
    
    .hero-text h1 {
        font-size: 1.8rem;
    }
    
    .hero-text h3 {
        font-size: 1rem;
    }
    
    .navbar {
        height: 100vh;
    }
    
    .about-container,
    .skills-container {
        grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    }
}