/* Responsive Design Styles */

/* Mobile First Approach - Base styles are for mobile */

/* Small devices (landscape phones, 576px and up) */
@media (min-width: 576px) {
    .container {
        padding: 0 var(--space-xl);
    }
    
    .hero-title {
        font-size: var(--font-size-4xl);
    }
    
    .form-group {
        flex-direction: row;
    }
}

/* Medium devices (tablets, 768px and up) */
@media (min-width: 768px) {
    .nav-container {
        padding: 0 var(--space-2xl);
    }
    
    .main-content {
        padding: var(--space-3xl) var(--space-2xl);
    }
    
    .hero-title {
        font-size: var(--font-size-5xl);
    }
    
    .bento-grid {
        gap: var(--space-2xl);
    }
    
    .science-section .bento-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .stories-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .features-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* Large devices (desktops, 992px and up) */
@media (min-width: 992px) {
    .hero-title {
        font-size: var(--font-size-5xl);
        line-height: 1.1;
    }
    
    .stories-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .features-grid {
        grid-template-columns: repeat(4, 1fr);
    }
    
    .bento-card {
        padding: var(--space-2xl);
    }
    
    .hero-card {
        padding: var(--space-3xl) var(--space-2xl);
    }
}

/* Extra large devices (large desktops, 1200px and up) */
@media (min-width: 1200px) {
    .stories-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .features-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* Mobile-specific styles (up to 767px) */
@media (max-width: 767px) {
    /* Header adjustments */
    .nav-container {
        padding: 0 var(--space-md);
    }
    
    .logo h1 {
        font-size: var(--font-size-lg);
    }
    
    .language-switcher {
        gap: var(--space-xs);
    }
    
    .lang-btn {
        padding: var(--space-xs) var(--space-sm);
        font-size: var(--font-size-xs);
    }
    
    /* Main content adjustments */
    .main-content {
        padding: var(--space-xl) var(--space-md);
    }
    
    /* Hero section mobile */
    .hero-section {
        margin-bottom: var(--space-2xl);
    }
    
    .hero-title {
        font-size: var(--font-size-3xl);
        line-height: 1.2;
        margin-bottom: var(--space-md);
    }
    
    .hero-subtitle {
        font-size: var(--font-size-lg);
        margin-bottom: var(--space-xl);
    }
    
    /* Bento grid mobile */
    .bento-grid {
        grid-template-columns: 1fr;
        gap: var(--space-lg);
        padding: var(--space-lg) 0;
    }
    
    .bento-card {
        padding: var(--space-lg);
    }
    
    .hero-card {
        padding: var(--space-xl);
    }
    
    /* Section headers mobile */
    .section-header {
        margin-bottom: var(--space-xl);
    }
    
    .section-title {
        font-size: var(--font-size-2xl);
    }
    
    /* Form mobile */
    .form-group {
        flex-direction: column;
        gap: var(--space-md);
    }
    
    .email-input {
        width: 100%;
    }
    
    .cta-button {
        width: 100%;
        padding: var(--space-md);
        font-size: var(--font-size-base);
    }
    
    /* Story cards mobile */
    .story-card {
        padding: var(--space-lg);
    }
    
    .story-quote {
        font-size: var(--font-size-sm);
        padding: 0 var(--space-sm);
    }
    
    /* Feature cards mobile */
    .feature-card {
        padding: var(--space-md);
    }
    
    .feature-icon {
        font-size: var(--font-size-xl);
    }
    
    /* CTA section mobile */
    .cta-card {
        padding: var(--space-xl);
    }
    
    .cta-title {
        font-size: var(--font-size-xl);
    }
    
    .cta-benefits {
        margin-bottom: var(--space-xl);
    }
}

/* Very small devices (portrait phones, less than 576px) */
@media (max-width: 575px) {
    .main-content {
        padding: var(--space-lg) var(--space-sm);
    }
    
    .hero-title {
        font-size: var(--font-size-2xl);
    }
    
    .hero-subtitle {
        font-size: var(--font-size-base);
    }
    
    .bento-card {
        padding: var(--space-md);
    }
    
    .hero-card {
        padding: var(--space-lg);
    }
    
    .section-title {
        font-size: var(--font-size-xl);
    }
    
    .principle-icon {
        font-size: var(--font-size-2xl);
    }
    
    .story-avatar {
        width: 70px;
        height: 70px;
    }
    
    .cta-card {
        padding: var(--space-lg);
    }
}

/* Landscape orientation adjustments */
@media (orientation: landscape) and (max-height: 600px) {
    .hero-section {
        margin-bottom: var(--space-xl);
    }
    
    .hero-title {
        font-size: var(--font-size-3xl);
        margin-bottom: var(--space-sm);
    }
    
    .hero-subtitle {
        font-size: var(--font-size-base);
        margin-bottom: var(--space-lg);
    }
    
    .section-header {
        margin-bottom: var(--space-lg);
    }
    
    .bento-grid {
        padding: var(--space-md) 0;
    }
}

/* Touch device optimizations */
@media (hover: none) and (pointer: coarse) {
    /* Increase touch targets */
    .lang-btn {
        min-height: 44px;
        min-width: 44px;
    }
    
    .cta-button {
        min-height: 48px;
        padding: var(--space-md) var(--space-lg);
    }
    
    .email-input {
        min-height: 48px;
        font-size: 16px; /* Prevents zoom on iOS */
    }
    
    /* Remove hover effects on touch devices */
    .bento-card:hover {
        transform: none;
        box-shadow: var(--shadow-bento);
    }
    
    .cta-button.primary:hover {
        transform: none;
        box-shadow: var(--shadow-md);
    }
    
    /* Add touch-friendly active states */
    .bento-card:active {
        transform: scale(0.98);
    }
    
    .cta-button:active {
        transform: scale(0.95);
    }
    
    .lang-btn:active {
        transform: scale(0.95);
    }
}

/* High DPI displays */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    /* Optimize for retina displays */
    .bento-card {
        border-width: 0.5px;
    }
    
    .hero-card {
        border-width: 1px;
    }
    
    .cta-card {
        border-width: 1px;
    }
}

/* Reduced motion preferences */
@media (prefers-reduced-motion: reduce) {
    .bento-card {
        transition: none;
    }
    
    .bento-card:hover {
        transform: none;
    }
    
    .cta-button {
        transition: none;
    }
    
    .cta-button.primary:hover {
        transform: none;
    }
    
    .loading-spinner {
        animation: none;
    }
    
    .bento-card.fade-in {
        animation: none;
        opacity: 1;
        transform: none;
    }
}

/* Print styles */
@media print {
    .header {
        position: static;
        box-shadow: none;
        border-bottom: 1px solid var(--border-dark);
    }
    
    .language-switcher {
        display: none;
    }
    
    .main-content {
        padding: var(--space-lg) 0;
    }
    
    .bento-grid {
        display: block;
    }
    
    .bento-card {
        margin-bottom: var(--space-lg);
        break-inside: avoid;
        box-shadow: none;
        border: 1px solid var(--border-medium);
    }
    
    .hero-card {
        border: 2px solid var(--border-dark);
    }
    
    .email-form {
        display: none;
    }
    
    .footer {
        margin-top: var(--space-lg);
    }
}

/* Container queries (future-proofing) */
@supports (container-type: inline-size) {
    .bento-grid {
        container-type: inline-size;
    }
    
    @container (max-width: 600px) {
        .bento-card {
            padding: var(--space-md);
        }
    }
    
    @container (min-width: 800px) {
        .stories-grid {
            grid-template-columns: repeat(2, 1fr);
        }
    }
    
    @container (min-width: 1200px) {
        .features-grid {
            grid-template-columns: repeat(4, 1fr);
        }
    }
}

/* Accessibility improvements for different screen sizes */
@media (max-width: 767px) {
    /* Ensure sufficient color contrast on small screens */
    .text-muted {
        color: var(--text-secondary);
    }
    
    /* Increase line height for better readability */
    p {
        line-height: 1.7;
    }
    
    /* Ensure buttons are large enough for touch */
    button {
        min-height: 44px;
    }
}

/* Dark mode responsive adjustments */
@media (prefers-color-scheme: dark) {
    @media (max-width: 767px) {
        .bento-card {
            border-color: var(--border-medium);
        }
        
        .hero-card,
        .cta-card {
            border-color: var(--border-dark);
        }
    }
}