/* Responsive CSS for Banki-tut.ru */

/* Large desktops (1200px and up) */
@media (min-width: 1200px) {
    .container {
        max-width: 1140px;
    }
}

/* Tablets (768px to 1199px) */
@media (max-width: 1199px) {
    .container {
        max-width: 960px;
        padding: 0 15px;
    }
    
    .hero__title {
        font-size: 2.5rem;
    }
    
    .articles-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .categories-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Mobile landscape (576px to 767px) */
@media (max-width: 767px) {
    .container {
        max-width: 100%;
        padding: 0 12px;
    }
    
    /* Header mobile styles */
    .header__inner {
        height: 60px;
    }
    
    .nav {
        position: fixed;
        top: 60px;
        left: 0;
        right: 0;
        background: white;
        box-shadow: var(--shadow-lg);
        transform: translateY(-100%);
        opacity: 0;
        visibility: hidden;
        transition: all 0.3s ease;
        z-index: 999;
    }
    
    .nav.active {
        transform: translateY(0);
        opacity: 1;
        visibility: visible;
    }
    
    .nav__list {
        flex-direction: column;
        padding: 1rem;
    }
    
    .nav__item {
        width: 100%;
    }
    
    .nav__link {
        display: block;
        padding: 1rem;
        border-bottom: 1px solid var(--border-color);
    }
    
    .nav__link.active {
        background-color: var(--bg-light);
    }
    
    .nav__link.active::after {
        display: none;
    }
    
    .menu-toggle {
        display: flex;
    }
    
    .menu-toggle.active span:nth-child(1) {
        transform: rotate(45deg) translate(5px, 5px);
    }
    
    .menu-toggle.active span:nth-child(2) {
        opacity: 0;
    }
    
    .menu-toggle.active span:nth-child(3) {
        transform: rotate(-45deg) translate(7px, -6px);
    }
    
    /* Hero section */
    .hero {
        padding: 60px 0;
    }
    
    .hero__title {
        font-size: 2rem;
    }
    
    .hero__description {
        font-size: 1.125rem;
    }
    
    .hero__actions {
        flex-direction: column;
        align-items: center;
    }
    
    .hero__actions .btn {
        width: 100%;
        max-width: 300px;
        margin-bottom: 1rem;
    }
    
    /* Articles grid */
    .articles-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }
    
    .article-card__title {
        font-size: 1.125rem;
    }
    
    .article-card__description {
        font-size: 0.875rem;
    }
    
    /* Categories grid */
    .categories-grid {
        grid-template-columns: 1fr;
    }
    
    /* Stats */
    .stats__grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .stat-card__value {
        font-size: 2rem;
    }
    
    /* Filters */
    .filters-panel {
        padding: 1.5rem;
    }
    
    .filters-panel__row {
        grid-template-columns: 1fr;
    }
    
    /* Pagination */
    .pagination {
        flex-wrap: wrap;
    }
    
    /* Footer */
    .footer__top {
        grid-template-columns: 1fr;
        gap: 2rem;
    }
    
    .footer__bottom {
        flex-direction: column;
        text-align: center;
        gap: 1rem;
    }
}

/* Mobile portrait (up to 575px) */
@media (max-width: 575px) {
    .hero__title {
        font-size: 1.75rem;
    }
    
    .section-title {
        font-size: 1.5rem;
    }
    
    .articles-grid {
        grid-template-columns: 1fr;
    }
    
    .stats__grid {
        grid-template-columns: 1fr;
    }
    
    .about-preview__features {
        grid-template-columns: 1fr;
    }
    
    .feature {
        justify-content: center;
    }
    
    .page-title {
        font-size: 1.75rem;
    }
    
    .filters-panel {
        padding: 1rem;
    }
    
    .search-input {
        font-size: 16px; /* Prevents zoom on iOS */
    }
    
    .btn {
        width: 100%;
        justify-content: center;
    }
    
    .cta-actions {
        flex-direction: column;
    }
    
    .cta-actions .btn {
        margin-bottom: 1rem;
    }
}

/* High DPI screens */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .logo img {
        image-rendering: -webkit-optimize-contrast;
        image-rendering: crisp-edges;
    }
}

/* Print styles */
@media print {
    .header,
    .footer,
    .menu-toggle,
    .hero__actions,
    .filters-panel,
    .share-buttons,
    .cta-actions {
        display: none !important;
    }
    
    body {
        font-size: 12pt;
        line-height: 1.5;
        color: #000;
        background: white;
    }
    
    .container {
        max-width: 100%;
        padding: 0;
    }
    
    a {
        color: #000;
        text-decoration: underline;
    }
    
    .article-card,
    .category-card {
        break-inside: avoid;
        box-shadow: none;
        border: 1px solid #ddd;
        margin-bottom: 1rem;
    }
    
    img {
        max-width: 100% !important;
        height: auto !important;
    }
}

/* Dark mode */
@media (prefers-color-scheme: dark) {
    :root {
        --text-primary: #e2e8f0;
        --text-secondary: #cbd5e0;
        --text-light: #a0aec0;
        --bg-light: #2d3748;
        --bg-white: #1a202c;
        --border-color: #4a5568;
    }
    
    .article-card,
    .category-card,
    .filters-panel {
        background-color: var(--bg-white);
    }
    
    .search-input,
    .filter-select {
        background-color: #4a5568;
        color: #e2e8f0;
        border-color: #718096;
    }
    
    .stat-card {
        background-color: #4a5568;
    }
}

/* Touch device optimizations */
@media (hover: none) and (pointer: coarse) {
    .btn,
    .nav__link,
    .article-card__link,
    .category-card {
        min-height: 44px; /* Apple recommendation for touch targets */
    }
    
    .menu-toggle {
        padding: 12px;
    }
    
    .search-input,
    .form-input,
    .form-textarea {
        font-size: 16px; /* Prevents zoom on iOS */
    }
    
    /* Increase spacing for touch */
    .article-card__meta,
    .category-card__stats {
        margin: 1rem 0;
    }
}