/* Responsive CSS Enhancements */

/* Mobile-first approach with enhanced responsiveness */

/* Base mobile styles (already included in main CSS) */
@media (max-width: 767px) {
    /* Header improvements */
    .header-nav {
        flex-direction: column;
        gap: 1rem;
        margin-bottom: 2rem;
    }
    
    .nav-menu {
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: rgba(0, 13, 255, 0.95);
        backdrop-filter: blur(10px);
        flex-direction: column;
        padding: 1rem;
        border-radius: 0.5rem;
        margin-top: 1rem;
        box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
        z-index: 1000;
    }
    
    .nav-menu li {
        width: 100%;
    }
    
    .nav-menu a {
        display: block;
        padding: 0.75rem;
        text-align: center;
        border-radius: 0.25rem;
        margin-bottom: 0.5rem;
    }
    
    /* Hero section mobile */
    .hero-title {
        font-size: 2rem;
        line-height: 1.1;
    }
    
    .hero-subtitle {
        font-size: 1.125rem;
    }
    
    .cta-button {
        padding: 1rem 2rem;
        font-size: 1.125rem;
        width: 100%;
        max-width: 300px;
    }
    
    /* Resume paper mobile */
    .resume-paper {
        transform: rotate(0deg);
        padding: 1.5rem;
        margin: 0 1rem;
    }
    
    .resume-paper > div:first-child {
        flex-direction: column;
        text-align: center;
        gap: 1rem;
    }
    
    .resume-paper > div:last-child {
        grid-template-columns: 1fr;
        gap: 2rem;
    }
    
    /* Template cards mobile */
    .template-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    
    /* Features grid mobile */
    .features-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    
    /* Testimonials mobile */
    .testimonials-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    
    /* CTA section mobile */
    .cta-buttons {
        flex-direction: column;
        width: 100%;
        max-width: 300px;
        margin: 0 auto;
    }
    
    .cta-buttons a {
        width: 100%;
        text-align: center;
    }
    
    /* Donation section mobile */
    .donation-card {
        margin: 0 1rem;
    }
    
    .donation-qr-small {
        max-width: 120px;
    }
    
    /* Footer mobile */
    .footer-grid {
        grid-template-columns: 1fr;
        gap: 2rem;
        text-align: center;
    }
    
    .footer-bottom {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }
    
    /* Popup mobile */
    .donation-popup-content {
        margin: 1rem;
        padding: 1.5rem;
        max-width: calc(100vw - 2rem);
    }
    
    .donation-qr-code {
        max-width: 200px;
    }
    
    /* Touch targets */
    button,
    a,
    input,
    select,
    textarea {
        min-height: 44px;
        min-width: 44px;
    }
    
    /* Improved text readability */
    body {
        font-size: 16px;
        line-height: 1.6;
    }
    
    h1 {
        font-size: 2rem;
    }
    
    h2 {
        font-size: 1.75rem;
    }
    
    h3 {
        font-size: 1.5rem;
    }
    
    h4 {
        font-size: 1.25rem;
    }
}

/* Tablet styles */
@media (min-width: 768px) and (max-width: 1023px) {
    .container {
        padding: 0 2rem;
    }
    
    .hero-title {
        font-size: 2.5rem;
    }
    
    .hero-subtitle {
        font-size: 1.375rem;
    }
    
    .template-grid,
    .features-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .testimonials-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .resume-paper > div:last-child {
        grid-template-columns: 1fr 1fr;
    }
}

/* Large desktop styles */
@media (min-width: 1024px) {
    .container {
        max-width: 1200px;
    }
    
    .hero-title {
        font-size: 3.5rem;
    }
    
    .hero-subtitle {
        font-size: 1.5rem;
    }
    
    .template-grid,
    .features-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .testimonials-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* Extra large screens */
@media (min-width: 1440px) {
    .container {
        max-width: 1400px;
    }
    
    .hero-title {
        font-size: 4rem;
    }
}

/* High DPI displays */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    /* Ensure crisp images and icons */
    img {
        image-rendering: -webkit-optimize-contrast;
        image-rendering: crisp-edges;
    }
}

/* Landscape orientation on mobile */
@media (max-width: 767px) and (orientation: landscape) {
    .hero-section {
        margin-bottom: 2rem;
    }
    
    .hero-title {
        font-size: 1.75rem;
    }
    
    .hero-subtitle {
        font-size: 1rem;
    }
    
    .resume-paper {
        display: none; /* Hide on landscape mobile to save space */
    }
}

/* Print styles */
@media print {
    .donation-popup,
    .mobile-menu-btn,
    .cta-button,
    button {
        display: none !important;
    }
    
    body {
        font-size: 12pt;
        line-height: 1.4;
        color: #000;
        background: #fff;
    }
    
    .gradient-bg {
        background: #000 !important;
        color: #fff !important;
    }
    
    a {
        color: #000 !important;
        text-decoration: underline !important;
    }
}

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

/* High contrast mode */
@media (prefers-contrast: high) {
    .btn {
        border: 2px solid currentColor !important;
    }
    
    .nav-menu a:hover,
    .nav-menu a:focus {
        border: 2px solid currentColor !important;
    }
    
    .resume-paper {
        border: 2px solid #000;
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    /* Keep the current design as it already works well in dark environments */
    /* The gradient backgrounds and white text provide good contrast */
}

/* Focus management for keyboard navigation */
.focus-visible {
    outline: 2px solid #fbbf24 !important;
    outline-offset: 2px !important;
}

/* Improved hover states for touch devices */
@media (hover: hover) {
    .template-card:hover {
        transform: translateY(-5px);
        box-shadow: 0 15px 30px rgba(0, 0, 255, 0.2);
    }
    
    .btn:hover {
        transform: translateY(-2px);
    }
}

/* Touch device optimizations */
@media (hover: none) {
    .template-card:active {
        transform: scale(0.98);
    }
    
    .btn:active {
        transform: scale(0.98);
    }
}

/* Container queries support (progressive enhancement) */
@supports (container-type: inline-size) {
    .container {
        container-type: inline-size;
    }
    
    @container (max-width: 600px) {
        .template-grid {
            grid-template-columns: 1fr;
        }
    }
    
    @container (min-width: 601px) and (max-width: 900px) {
        .template-grid {
            grid-template-columns: repeat(2, 1fr);
        }
    }
    
    @container (min-width: 901px) {
        .template-grid {
            grid-template-columns: repeat(3, 1fr);
        }
    }
}

/* Utility classes for responsive design */
.mobile-only {
    display: block;
}

.desktop-only {
    display: none;
}

@media (min-width: 768px) {
    .mobile-only {
        display: none;
    }
    
    .desktop-only {
        display: block;
    }
}

/* Flexible grid system */
.grid-responsive {
    display: grid;
    gap: 1rem;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
}

@media (min-width: 768px) {
    .grid-responsive {
        gap: 2rem;
        grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    }
}

/* Responsive typography scale */
.text-responsive {
    font-size: clamp(1rem, 2.5vw, 1.25rem);
}

.heading-responsive {
    font-size: clamp(1.5rem, 4vw, 3rem);
}

/* Safe area insets for devices with notches */
@supports (padding: max(0px)) {
    .container {
        padding-left: max(1rem, env(safe-area-inset-left));
        padding-right: max(1rem, env(safe-area-inset-right));
    }
    
    header {
        padding-top: max(2rem, env(safe-area-inset-top));
    }
}

/* Improved form controls for mobile */
input,
select,
textarea {
    font-size: 16px; /* Prevents zoom on iOS */
    border-radius: 0.5rem;
    border: 2px solid #d1d5db;
    padding: 0.75rem;
    transition: border-color 0.3s;
}

input:focus,
select:focus,
textarea:focus {
    border-color: #3b82f6;
    outline: none;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* Responsive images */
img {
    max-width: 100%;
    height: auto;
}

/* Flexible video embeds */
.video-responsive {
    position: relative;
    padding-bottom: 56.25%; /* 16:9 aspect ratio */
    height: 0;
    overflow: hidden;
}

.video-responsive iframe,
.video-responsive object,
.video-responsive embed {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

