/* Enhanced Responsive Styles for Yandex Cloud Research */

/* Mobile-first responsive enhancements */
@media (max-width: 640px) {
    /* Hero section mobile optimization */
    .hero-title {
        font-size: 2rem;
        line-height: 1.2;
    }
    
    .hero-subtitle {
        font-size: 1.125rem;
        line-height: 1.5;
    }
    
    /* Card spacing adjustments */
    .card-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    /* Architecture diagrams mobile */
    .architecture-diagram {
        padding: 1rem;
        font-size: 0.75rem;
    }
    
    .architecture-diagram .grid-cols-3 {
        grid-template-columns: 1fr;
        gap: 0.5rem;
    }
    
    /* Timeline mobile adjustments */
    .timeline-mobile {
        padding-left: 0;
    }
    
    .timeline-mobile .timeline-item {
        margin-left: 1rem;
        border-left: 2px solid #e5e7eb;
        padding-left: 1rem;
    }
    
    /* Navigation mobile improvements */
    .nav-mobile-spacing {
        padding-top: 6rem; /* Account for fixed navbar */
    }
    
    /* Text size adjustments */
    .mobile-text-adjust h2 {
        font-size: 1.875rem;
    }
    
    .mobile-text-adjust h3 {
        font-size: 1.5rem;
    }
    
    /* Chart mobile optimization */
    .chart-container {
        height: 300px !important;
        margin: 1rem 0;
    }
}

/* Tablet optimizations */
@media (min-width: 641px) and (max-width: 1024px) {
    /* Grid adjustments for tablet */
    .tablet-grid-2 {
        grid-template-columns: repeat(2, 1fr);
    }
    
    /* Font size scaling */
    .tablet-text-scale h1 {
        font-size: 3rem;
    }
    
    .tablet-text-scale h2 {
        font-size: 2.25rem;
    }
    
    /* Architecture diagram tablet */
    .architecture-diagram .grid-cols-3 {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Touch device enhancements */
@media (hover: none) and (pointer: coarse) {
    /* Larger touch targets */
    .touch-target {
        min-height: 44px;
        min-width: 44px;
    }
    
    /* Remove hover effects on touch devices */
    .card-hover:hover {
        transform: none;
        box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    }
    
    /* Enhanced button padding for touch */
    button, .btn {
        padding: 12px 24px;
    }
}

/* High DPI display optimizations */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    /* Sharper text rendering */
    body {
        -webkit-font-smoothing: antialiased;
        -moz-osx-font-smoothing: grayscale;
    }
    
    /* Icon improvements */
    .fas, .far, .fab {
        -webkit-transform: translateZ(0);
        transform: translateZ(0);
    }
}

/* Print styles */
@media print {
    /* Hide navigation and interactive elements */
    nav, .nav-sticky, .mobile-menu, button {
        display: none !important;
    }
    
    /* Expand all sections */
    .hidden {
        display: block !important;
    }
    
    /* Print-friendly colors */
    .gradient-bg {
        background: #f3f4f6 !important;
        color: #000 !important;
    }
    
    /* Page breaks */
    section {
        page-break-inside: avoid;
        page-break-after: auto;
    }
    
    .card-hover {
        box-shadow: none !important;
        border: 1px solid #e5e7eb;
    }
    
    /* Chart adjustments for print */
    canvas {
        max-width: 100% !important;
        height: auto !important;
    }
}

/* Accessibility enhancements */
@media (prefers-reduced-motion: reduce) {
    /* Disable animations for users who prefer reduced motion */
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    .section-animation {
        animation: none !important;
        opacity: 1 !important;
        transform: none !important;
    }
}

/* Focus indicators for keyboard navigation */
@media (any-hover: none) {
    /* Enhanced focus styles for keyboard users */
    button:focus,
    a:focus,
    input:focus {
        outline: 3px solid #3b82f6;
        outline-offset: 2px;
    }
}

/* Dark mode support (future enhancement) */
@media (prefers-color-scheme: dark) {
    .dark-mode-auto {
        --bg-primary: #1f2937;
        --bg-secondary: #111827;
        --text-primary: #f9fafb;
        --text-secondary: #d1d5db;
    }
}

/* Landscape mobile specific */
@media screen and (max-height: 500px) and (orientation: landscape) {
    .hero-section {
        padding: 2rem 0;
    }
    
    .hero-title {
        font-size: 2.5rem;
    }
    
    .section-padding {
        padding: 3rem 0;
    }
}

/* Very small screens */
@media (max-width: 320px) {
    .container {
        padding-left: 1rem;
        padding-right: 1rem;
    }
    
    .text-responsive {
        font-size: 0.875rem;
    }
    
    .card-padding-small {
        padding: 1rem;
    }
}

/* Large desktop optimizations */
@media (min-width: 1920px) {
    .max-w-7xl {
        max-width: 90rem;
    }
    
    .desktop-large-text h1 {
        font-size: 5rem;
    }
    
    .desktop-large-text h2 {
        font-size: 3.5rem;
    }
}

/* Animation classes for enhanced interactivity */
.fade-in {
    opacity: 0;
    animation: fadeIn 0.6s ease forwards;
}

.slide-up {
    transform: translateY(30px);
    opacity: 0;
    animation: slideUp 0.8s ease forwards;
}

.scale-in {
    transform: scale(0.95);
    opacity: 0;
    animation: scaleIn 0.5s ease forwards;
}

@keyframes fadeIn {
    to {
        opacity: 1;
    }
}

@keyframes slideUp {
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes scaleIn {
    to {
        transform: scale(1);
        opacity: 1;
    }
}

/* Loading states */
.loading {
    position: relative;
    overflow: hidden;
}

.loading::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.6), transparent);
    animation: loading 1.5s infinite;
}

@keyframes loading {
    0% {
        left: -100%;
    }
    100% {
        left: 100%;
    }
}

/* Tooltip styles */
.tooltip {
    position: relative;
    cursor: help;
}

.tooltip:hover::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: #1f2937;
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 0.375rem;
    font-size: 0.875rem;
    white-space: nowrap;
    z-index: 10;
}

/* Progress bar animations */
.progress-bar {
    width: 0%;
    transition: width 1s ease-in-out;
}

.progress-animate {
    animation: progressFill 2s ease-in-out forwards;
}

@keyframes progressFill {
    from {
        width: 0%;
    }
    to {
        width: var(--progress-width, 100%);
    }
}

/* Enhanced hover states */
.hover-lift {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.hover-lift:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
}

/* Content spacing utilities */
.content-spacing > * + * {
    margin-top: 1.5rem;
}

.content-spacing-sm > * + * {
    margin-top: 1rem;
}

.content-spacing-lg > * + * {
    margin-top: 2rem;
}

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

.responsive-heading {
    font-size: clamp(1.5rem, 4vw, 2.5rem);
    line-height: 1.2;
}

.responsive-title {
    font-size: clamp(2rem, 6vw, 4rem);
    line-height: 1.1;
}