/**
 * Дополнительные адаптивные стили
 *
 * @package ChPKol_Theme
 * @since 1.0.0
 */

/* ============================================
   ПЛАНШЕТЫ (768px - 1024px)
   ============================================ */

@media (max-width: 1024px) {
    .container {
        padding: 0 1.5rem;
    }
    
    .news-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .footer-content {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* ============================================
   МОБИЛЬНОЕ МЕНЮ (до 1024px)
   ============================================ */

@media (max-width: 1024px) {
    /* Подменю в мобильном меню — аккордеон */
    .sidebar-navigation .primary-menu .sub-menu {
        position: static;
        opacity: 1;
        visibility: visible;
        transform: none;
        box-shadow: none;
        background-color: var(--bg-light);
        border: none;
        margin: 0;
        padding: 0;
        min-width: auto;
        max-width: none;
        display: none;
        overflow: hidden;
        border-radius: 0;
    }

    .sidebar-navigation .primary-menu .menu-item-has-children.is-open > .sub-menu {
        display: block;
        padding-left: 0.5rem;
    }

    .sidebar-navigation .primary-menu .sub-menu a {
        padding: 0.75rem 1.25rem 0.75rem 2rem;
        font-size: 0.875rem;
    }

    .sidebar-navigation .primary-menu .menu-item-has-children > a::after {
        transition: transform 0.25s ease;
    }

    .sidebar-navigation .primary-menu .menu-item-has-children.is-open > a::after {
        transform: rotate(90deg);
    }
}

/* ============================================
   МОБИЛЬНЫЕ УСТРОЙСТВА (до 768px)
   ============================================ */

@media (max-width: 768px) {
    :root {
        --header-height: 60px;
        --spacing-xl: 2rem;
    }
    
    /* Шапка */
    .header-top {
        font-size: 0.75rem;
        padding: 0.25rem 0;
    }
    
    .header-top .container {
        flex-direction: column;
        gap: 0.25rem;
        text-align: center;
    }
    
    .header-main {
        padding: 0.75rem 0;
    }
    
    .header-main .container {
        flex-wrap: wrap;
    }
    
    .site-branding {
        flex: 1;
        min-width: 0;
    }
    
    .custom-logo {
        max-height: 50px;
    }
    
    .site-title {
        font-size: 1.125rem;
    }
    
    .header-search {
        order: 3;
        width: 100%;
        margin-top: 0.5rem;
    }
    
    /* Контент */
    .content-area {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    
    .site-main {
        padding: 1.5rem 0;
    }
    
    .content-block {
        padding: 1rem;
    }
    
    /* Новости */
    .news-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .news-item img {
        height: 180px;
    }
    
    /* Баннер */
    .hero-banner {
        margin-bottom: 1.5rem;
    }
    
    .hero-content {
        padding: 1rem;
    }
    
    .hero-content h1 {
        font-size: 1.5rem;
    }
    
    /* Сайдбар */
    .sidebar {
        margin-top: 1.5rem;
        padding: 1rem;
    }
    
    /* Подвал */
    .footer-content {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    
    .footer-menu {
        flex-direction: column;
        align-items: flex-start;
    }
    
    /* Кнопки */
    .btn {
        width: 100%;
        text-align: center;
    }
    
    /* Типографика */
    h1 { font-size: 1.75rem; }
    h2 { font-size: 1.5rem; }
    h3 { font-size: 1.25rem; }
    h4 { font-size: 1.125rem; }
}

/* ============================================
   МАЛЕНЬКИЕ МОБИЛЬНЫЕ (до 480px)
   ============================================ */

@media (max-width: 480px) {
    :root {
        --spacing-md: 1rem;
        --spacing-lg: 1.5rem;
    }
    
    .container {
        padding: 0 1rem;
    }
    
    .site-title {
        font-size: 1rem;
    }
    
    .custom-logo {
        max-height: 40px;
    }
    
    .content-block {
        padding: 0.75rem;
    }
    
    .news-item img {
        height: 150px;
    }
    
    .hero-content h1 {
        font-size: 1.25rem;
    }
    
    .btn {
        padding: 0.625rem 1rem;
        font-size: 0.875rem;
    }
    
    h1 { font-size: 1.5rem; }
    h2 { font-size: 1.25rem; }
    h3 { font-size: 1.125rem; }
}

/* ============================================
   БОЛЬШИЕ ЭКРАНЫ (более 1400px)
   ============================================ */

@media (min-width: 1400px) {
    :root {
        --container-width: 1400px;
    }
    
    .news-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* ============================================
   ВЕРСИЯ ДЛЯ СЛАБОВИДЯЩИХ
   ============================================ */

body.accessibility-mode {
    font-size: 18px !important;
    line-height: 1.8 !important;
}

body.accessibility-mode h1,
body.accessibility-mode h2,
body.accessibility-mode h3,
body.accessibility-mode h4,
body.accessibility-mode h5,
body.accessibility-mode h6 {
    font-size: 1.5em !important;
    font-weight: bold !important;
    margin-bottom: 1em !important;
}

body.accessibility-mode a {
    text-decoration: underline;
    font-weight: 600;
}

body.accessibility-mode .btn {
    font-size: 1.125rem;
    padding: 1rem 1.5rem;
}

/* ============================================
   ПЕЧАТЬ
   ============================================ */

@media print {
    .site-header,
    .main-navigation,
    .sidebar,
    .site-footer,
    .menu-toggle,
    .btn {
        display: none;
    }
    
    .content-area {
        grid-template-columns: 1fr;
    }
    
    .site-main {
        padding: 0;
    }
    
    a {
        color: #000;
        text-decoration: underline;
    }
    
    a[href]:after {
        content: " (" attr(href) ")";
        font-size: 0.8em;
        color: #666;
    }
}

/* ============================================
   ЛАНДСКЕЙП ОРИЕНТАЦИЯ (мобильные)
   ============================================ */

@media (max-width: 768px) and (orientation: landscape) {
    .header-main {
        padding: 0.5rem 0;
    }
    
    .custom-logo {
        max-height: 45px;
    }
    
    .site-title {
        font-size: 1rem;
    }
}

/* ============================================
   ВЫСОКИЕ ЭКРАНЫ (DPI)
   ============================================ */

@media (-webkit-min-device-pixel-ratio: 2),
       (min-resolution: 192dpi) {
    /* Оптимизация для Retina дисплеев */
    .custom-logo,
    img {
        image-rendering: -webkit-optimize-contrast;
        image-rendering: crisp-edges;
    }
}
