/* ============================================
   RESPONSIVE DESIGN
   ============================================ */

@media screen and (max-width: 1024px) {
    .container {
        padding: 0 1.5rem;
    }
    
    .nav-container {
        padding: 0 1.5rem;
    }
    
    .hero-content {
        grid-template-columns: 1fr;
        gap: 3rem;
        text-align: center;
        padding: 0 1.5rem;
    }
    
    .hero-name {
        font-size: 3rem;
    }
    
    .portfolio-grid {
        grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
        gap: 1.5rem;
    }
    
    .about-content {
        grid-template-columns: 1fr;
        gap: 3rem;
        text-align: center;
    }
    
    .contact-content {
        grid-template-columns: 1fr;
        gap: 3rem;
    }
    
    .footer-content {
        grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
        gap: 1.5rem;
    }
}

@media screen and (max-width: 768px) {
    .nav-menu {
        position: fixed;
        left: -100%;
        top: 80px;
        flex-direction: column;
        background: rgba(255, 255, 255, 0.98);
        width: 100%;
        text-align: center;
        transition: 0.3s;
        box-shadow: 0 10px 27px rgba(0, 0, 0, 0.05);
        backdrop-filter: blur(10px);
        padding: 2rem 0;
        gap: 1rem;
    }

    .nav-menu.active {
        left: 0;
    }

    .nav-toggle {
        display: flex;
    }

    .nav-toggle.active .bar:nth-child(2) {
        opacity: 0;
    }

    .nav-toggle.active .bar:nth-child(1) {
        transform: translateY(8px) rotate(45deg);
    }

    .nav-toggle.active .bar:nth-child(3) {
        transform: translateY(-8px) rotate(-45deg);
    }
    
    h1 { font-size: 2.5rem; }
    h2 { font-size: 2rem; }
    h3 { font-size: 1.5rem; }
    
    .section-title {
        font-size: 2rem;
    }
    
    .hero {
        min-height: 80vh;
        padding-top: 100px;
    }
    
    .scroll-indicator,
    .hero-scroll {
        display: none !important;
    }
    
    .hero-name {
        font-size: 2.5rem;
    }
    
    .hero-greeting {
        font-size: 1rem;
    }
    
    .hero-description {
        font-size: 1rem;
    }
    
    .hero-buttons {
        flex-direction: column;
        align-items: center;
        gap: 1rem;
    }
    
    .btn {
        padding: 0.7rem 1.5rem;
        font-size: 0.9rem;
        width: 100%;
        max-width: 250px;
    }
    
    .portfolio-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    
    .portfolio-card {
        height: 250px;
    }
    
    .contact-grid {
        grid-template-columns: 1fr;
        gap: 2rem;
    }
    
    .contact-item {
        padding: 1rem;
        margin-bottom: 1rem;
    }
    
    .contact-icon {
        width: 50px;
        height: 50px;
        margin-right: 1rem;
        font-size: 1.1rem;
    }
    
    .contact-form {
        padding: 1.5rem;
        margin-top: 1rem;
    }
    
    .social-links {
        justify-content: center;
    }
    
    .contact-form {
        padding: 1.5rem;
    }
    
    .privacy-content {
        flex-direction: column;
        text-align: center;
        gap: 1rem;
    }
    
    .privacy-buttons {
        justify-content: center;
        flex-wrap: wrap;
    }
    
    .skill-tags {
        justify-content: center;
    }
    
    section {
        padding: 3rem 0;
    }
    
    .section-header {
        margin-bottom: 2rem;
    }
}

@media screen and (max-width: 480px) {
    .container {
        padding: 0 1rem;
    }
    
    .nav-container {
        padding: 0 1rem;
        height: 70px;
    }
    
    .nav-logo h1 {
        font-size: 1.5rem;
    }
    
    .nav-subtitle {
        font-size: 0.8rem;
    }
    
    .nav-menu {
        top: 70px;
        padding: 1.5rem 0;
    }
    
    .hero {
        padding-top: 90px;
    }
    
    .scroll-indicator,
    .hero-scroll {
        display: none !important;
    }
    
    .hero-content {
        padding: 0 1rem;
    }
    
    .hero-name {
        font-size: 2rem;
    }
    
    .hero-description {
        font-size: 0.95rem;
    }
    
    .portfolio-card {
        height: 200px;
    }
    
    .card-content {
        padding: 1.5rem;
    }
    
    .card-content h3 {
        font-size: 1.5rem;
    }
    
    .contact-grid {
        gap: 1.5rem;
    }
    
    .contact-item {
        flex-direction: column;
        text-align: center;
        padding: 1.5rem 1rem;
    }
    
    .contact-icon {
        margin-right: 0;
        margin-bottom: 1rem;
    }
    
    .contact-form {
        padding: 1rem;
    }
    
    .form-group input,
    .form-group textarea {
        padding: 0.8rem;
        font-size: 0.9rem;
    }
    
    .footer-content {
        grid-template-columns: 1fr;
        text-align: center;
        gap: 2rem;
    }
    
    .btn-small {
        padding: 0.4rem 0.8rem;
        font-size: 0.8rem;
    }
}

@media screen and (max-width: 320px) {
    .hero-name {
        font-size: 1.8rem;
    }
    
    .section-title {
        font-size: 1.8rem;
    }
    
    .portfolio-card {
        height: 180px;
    }
    
    .hero-buttons {
        width: 100%;
    }
    
    .btn {
        width: 100%;
        max-width: none;
    }
}

/* ============================================
   LANDSCAPE ORIENTATION (Mobile)
   ============================================ */

@media screen and (max-height: 500px) and (orientation: landscape) {
    .nav-container {
        height: 60px;
        padding: 0 1rem;
    }
    
    .nav-logo h1 {
        font-size: 1.4rem;
    }
    
    .hero {
        min-height: 100vh;
        padding-top: 60px;
        padding-bottom: 1rem;
    }
    
    .hero-content {
        grid-template-columns: 1fr 1fr;
        gap: 1.5rem;
        align-items: center;
        max-height: calc(100vh - 120px);
    }
    
    .hero-text {
        padding: 0;
    }
    
    .hero-greeting {
        font-size: 1rem;
        margin-bottom: 0.3rem;
    }
    
    .hero-name {
        font-size: 2rem;
        line-height: 1.1;
        margin-bottom: 0.5rem;
    }
    
    .hero-title {
        font-size: 1.1rem;
        margin-bottom: 0.8rem;
    }
    
    .hero-description {
        font-size: 0.9rem;
        margin-bottom: 1rem;
        line-height: 1.4;
    }
    
    .hero-buttons {
        gap: 1rem;
        margin-bottom: 0;
    }
    
    .btn {
        padding: 0.6rem 1.2rem;
        font-size: 0.9rem;
    }
    
    .hero-image {
        max-height: 250px;
        display: flex;
        align-items: center;
    }
    
    .hero-image img {
        max-height: 100%;
        width: auto;
    }
    
    .scroll-indicator,
    .hero-scroll {
        display: none !important;
    }
    
    section {
        padding: 2rem 0;
    }
    
    .section-header {
        margin-bottom: 1.5rem;
    }
    
    .section-title {
        font-size: 1.8rem;
    }
    
    .portfolio-grid {
        grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
        gap: 1rem;
    }
    
    .portfolio-card {
        height: 150px;
    }
    
    .contact-grid {
        gap: 2rem;
        grid-template-columns: 1fr 1fr;
    }
    
    .contact-item {
        padding: 0.8rem;
    }
    
    .nav-menu {
        top: 60px;
        padding: 1rem 0;
        max-height: calc(100vh - 60px);
        overflow-y: auto;
    }
}

/* ============================================
   HIGH DPI DISPLAYS
   ============================================ */

@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .portfolio-card img,
    .portrait-img,
    .about-image img {
        image-rendering: -webkit-optimize-contrast;
        image-rendering: crisp-edges;
    }
}

/* ============================================
   ACCESSIBILITY & REDUCED MOTION
   ============================================ */

@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    .scroll-indicator {
        animation: none;
    }
    
    .hero-text,
    .hero-image {
        animation: none;
    }
}

/* ============================================
   PRINT STYLES
   ============================================ */

@media print {
    * {
        background: white !important;
        color: black !important;
        box-shadow: none !important;
    }
    
    .navbar,
    .user-preferences,
    .scroll-indicator,
    .nav-toggle {
        display: none !important;
    }
    
    .hero {
        padding-top: 0;
        min-height: auto;
    }
    
    .portfolio-card:hover {
        transform: none;
    }
    
    .card-overlay {
        opacity: 1;
        background: rgba(0, 0, 0, 0.3);
    }
    
    section {
        page-break-inside: avoid;
        padding: 2rem 0;
    }
}

/* ============================================
   HOVER STATES FOR TOUCH DEVICES
   ============================================ */

@media (hover: none) and (pointer: coarse) {
    .portfolio-card:hover {
        transform: none;
    }
    
    .portfolio-card .card-overlay {
        opacity: 1;
        background: rgba(0, 0, 0, 0.5);
    }
    
    .nav-link:hover::after {
        width: 0;
    }
    
    .nav-link.active::after {
        width: 100%;
    }
    
    .btn:hover {
        transform: none;
    }
    
    .contact-item:hover {
        transform: none;
    }
    
    .social-link:hover {
        transform: none;
    }
    
   
    .nav-label.nav-hover.touch-active .nav-hover-menu {
        opacity: 1 !important;
        visibility: visible !important;
        transform: translateX(0) translateY(0) scale(1) rotateY(0deg) !important;
        display: flex !important;
        animation: none !important;
    }
    
    .nav-label.nav-hover.touch-active .nav-hover-menu .nav-hover-item {
        opacity: 1 !important;
        transform: translateX(0) translateY(0) !important;
        animation: none !important;
        display: flex !important;
        visibility: visible !important;
    }
    
   
    .nav-label.nav-hover.touch-active .nav-hover-trigger {
        color: var(--accent-color) !important;
    }
}


@media (min-width: 701px) and (max-width: 1024px) and (hover: none) {
    .side-nav {
        overflow-y: auto !important;
        overflow-x: hidden !important;
        max-height: 100vh !important;
        height: 100vh !important;
        -webkit-overflow-scrolling: touch !important;
        padding-bottom: 2rem !important;
        display: flex !important;
        flex-direction: column !important;
    }
    
    .side-nav .nav-label {
        flex-shrink: 0 !important;
    }
    
    .nav-hover-menu {
        left: calc(100% + 10px) !important;
        min-width: 160px !important;
        padding: 1.2rem !important;
        border-radius: 16px !important;
        z-index: 99999 !important;
        position: fixed !important;
        top: auto !important;
    }
    
    .nav-hover-item {
        padding: 0.8rem 1rem !important;
        font-size: 0.9rem !important;
        z-index: 99999 !important;
        position: relative !important;
    }
    
    .side-nav {
        z-index: 99998 !important;
        position: relative !important;
        overflow: visible !important;
    }
    
    .nav-label.nav-hover {
        z-index: 99999 !important;
        position: relative !important;
        overflow: visible !important;
    }
    
    .nav-hover-trigger {
        min-height: 44px;
        display: flex;
        align-items: center;
        cursor: pointer;
        -webkit-tap-highlight-color: transparent;
    }
    
   
    .nav-label.nav-hover.touch-active .nav-hover-menu {
        opacity: 1 !important;
        visibility: visible !important;
        transform: translateX(0) translateY(0) scale(1) rotateY(0deg) !important;
        display: flex !important;
        flex-direction: column !important;
        z-index: 99999 !important;
        position: fixed !important;
        top: auto !important;
        overflow: visible !important;
    }
    
    .nav-label.nav-hover.touch-active .nav-hover-item {
        opacity: 1 !important;
        transform: translateX(0) translateY(0) !important;
        display: flex !important;
        visibility: visible !important;
        z-index: 99999 !important;
        position: relative !important;
    }
    
    
    .main-content {
        z-index: 1 !important;
        position: relative !important;
    }
    
   
    .main-content section {
        z-index: 1 !important;
        position: relative !important;
    }
    
    
    .side-nav.active ~ .main-content .footer,
    .side-nav:hover ~ .main-content .footer,
    body:has(.side-nav.active) .footer {
        margin-right: 120px !important;
        z-index: 1 !important;
    }
    
    /* Alternative: Always fix footer on tablets when side-nav is visible */
    .footer {
        margin-right: 120px !important;
        z-index: 1 !important;
    }
    
    .footer-content {
        margin-right: 0 !important;
    }
}


@media (pointer: coarse) {
    .touch-active .nav-hover-menu {
        opacity: 1 !important;
        visibility: visible !important;
        transform: translateX(0) translateY(0) scale(1) rotateY(0deg) !important;
        display: flex !important;
        flex-direction: column !important;
        pointer-events: auto !important;
    }
    
    .touch-active .nav-hover-item {
        opacity: 1 !important;
        transform: translateX(0) translateY(0) !important;
        display: flex !important;
        visibility: visible !important;
        pointer-events: auto !important;
    }
    
    
    .side-nav {
        overflow-y: auto !important;
        max-height: 100vh !important;
        -webkit-overflow-scrolling: touch !important;
        scroll-behavior: smooth !important;
    }
}
