/*
Theme Name: My Fresh Theme
Author: Aleksey + Qwen3.6-Plus
Version: 1.5
Description: Классическая тема, собранная вручную.
Text Domain: my-fresh-theme
*/

:root {
    --container-width: 1200px;
}
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; font-family: system-ui, -apple-system, sans-serif; line-height: 1.6; color: #222; background: #fff; }
img, svg { max-width: 100%; height: auto; }
a { color: #0066cc; text-decoration: none; transition: color 0.2s; }
a:hover { color: #004c99; }

/* Контейнеры */
.container, .site-layout, .site-header .container, .site-footer .container {
    max-width: var(--container-width); width: 100%; margin: 0 auto; padding: 0 1rem;
}
.site-header { background: #f8f9fa; padding: 1rem 0; border-bottom: 1px solid #e9ecef; }
.site-content { padding: 2rem 0; min-height: 60vh; }
.site-footer { background: #f8f9fa; padding: 1.5rem 0; text-align: center; margin-top: 2rem; }
.widget { margin-bottom: 1.5rem; }

/* Навигация */
.header-container { display: flex; justify-content: space-between; align-items: center; }
.menu-items { list-style: none; margin: 0; padding: 0; display: flex; gap: 20px; }
.menu-items li { position: relative; }
.menu-items li a { position: relative; padding: 10px 15px; display: block; color: #333; border-radius: 4px; transition: color 0.3s, background-color 0.3s; }
.menu-items li a:hover, .menu-items li.current-menu-item a { color: #0066cc; background-color: rgba(0,102,204,0.05); }
.menu-items li a::after { content: ''; position: absolute; bottom: 6px; left: 15px; right: 15px; height: 2px; background: #0066cc; transform: scaleX(0); transition: transform 0.3s; transform-origin: center; }
.menu-items li a:hover::after, .menu-items li.current-menu-item a::after { transform: scaleX(1); }

/* Выпадающее меню */
.menu-items .sub-menu { display: none; position: absolute; top: 100%; left: 0; min-width: 220px; background: #fff; box-shadow: 0 6px 16px rgba(0,0,0,0.12); border-radius: 8px; padding: 8px 0; z-index: 1000; border: 1px solid #e9ecef; }
.menu-items li:hover > .sub-menu { display: block; animation: menuFadeIn 0.2s ease forwards; }
.menu-items .sub-menu li a { padding: 10px 20px; border-bottom: 1px solid #f1f3f5; white-space: nowrap; }
.menu-items .sub-menu li:last-child a { border-bottom: none; }
.menu-items .sub-menu li a:hover { background: rgba(0,102,204,0.05); padding-left: 24px; }
.menu-item-has-children > a::after { content: ' ▾'; font-size: 0.7em; margin-left: 4px; opacity: 0.6; transition: transform 0.2s; }
.menu-item-has-children:hover > a::after { transform: rotate(180deg); content: ' ▴'; }
@keyframes menuFadeIn { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: translateY(0); } }

/* Бургер */
.burger-menu { display: none; background: none; border: none; cursor: pointer; padding: 10px; z-index: 100; }
.burger-menu span { display: block; width: 25px; height: 3px; background: #333; margin: 5px 0; transition: all 0.3s; }

/* Логотип */
.site-logo-block { width: 100%; background: #fff; padding: 2rem 1rem; text-align: center; border-bottom: 1px solid #e9ecef; }
.site-logo-block .custom-logo-link { display: inline-block; width: var(--logo-width, 400px); max-width: 100%; transition: opacity 0.3s; }
.site-logo-block .custom-logo-link:hover { opacity: 0.9; }
.site-logo-block .custom-logo { width: 100%; height: auto; display: block; object-fit: contain; }
.site-logo-block .site-title-text { margin: 0; font-size: clamp(1.8rem, 5vw, 3.5rem); font-weight: 700; }
.site-logo-block .site-title-text a { color: #222; }
.site-logo-block .site-description { margin: 0.75rem auto 0; font-size: clamp(0.9rem, 2vw, 1.1rem); color: #555; max-width: 800px; line-height: 1.5; }

/* Макет и сайдбары */
.site-layout { display: flex; flex-wrap: nowrap; gap: 2rem; max-width: var(--container-width); margin: 0 auto; padding: 2rem 1rem; align-items: flex-start; }
.sidebar-left  { display: var(--display-left,  none); flex: 0 0 var(--sidebar-left-w,  280px); max-width: var(--sidebar-left-w,  280px); order: 1; }
.content-area  { flex: 1 1 0; min-width: 0; max-width: var(--content-width, 700px); overflow-wrap: break-word; order: 2; }
.sidebar-right { display: var(--display-right, none); flex: 0 0 var(--sidebar-right-w, 280px); max-width: var(--sidebar-right-w, 280px); order: 3; }

.sidebar-left, .sidebar-right {
    position: -webkit-sticky; position: sticky; top: 2rem; align-self: flex-start;
    max-height: calc(100vh - 4rem); overflow-y: auto; scrollbar-width: thin;
}

/* Доступность и переполнение */
.skip-link:focus { position: fixed; top: 10px; left: 50%; transform: translateX(-50%); background: #222; color: #fff; padding: 8px 16px; z-index: 9999; border-radius: 4px; }
@media (min-width: 768px) { .skip-link { position: absolute; clip: rect(0,0,0,0); width: 1px; height: 1px; margin: -1px; overflow: hidden; } }
.entry-title, h1, h2, h3, h4 { overflow-wrap: break-word; word-break: break-word; hyphens: auto; max-width: 100%; }

/* Кнопка "Наверх" */
.back-to-top {
    position: fixed; bottom: 30px; right: 30px; width: 44px; height: 44px; background: #0066cc; color: #fff;
    border: none; border-radius: 50%; cursor: pointer; opacity: 0; visibility: hidden; transform: translateY(20px);
    transition: all 0.3s; z-index: 999; display: flex; align-items: center; justify-content: center; box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}
.back-to-top.visible { opacity: 1; visibility: visible; transform: translateY(0); }
.back-to-top:hover { background: #0052a3; transform: translateY(-3px); }

/* Адаптивность */
@media (max-width: 768px) {
    .site-layout, .header-container { flex-direction: column; }
    .burger-menu { display: block; }
    .menu-items { display: none; flex-direction: column; position: absolute; top: 100%; left: 0; width: 100%; background: #fff; box-shadow: 0 5px 10px rgba(0,0,0,0.1); padding: 10px 0; gap: 0; z-index: 99; }
    .menu-items.nav-active { display: flex; }
    .menu-items li a { padding: 15px 20px; border-radius: 0; }
    .menu-items li a::after { display: none; }
    .menu-item-has-children > a::after { content: ' +'; }
    .sub-menu { position: static; box-shadow: none; background: transparent; padding-left: 20px; border: none; }
    .sidebar-left, .sidebar-right { position: static; max-height: none; overflow: visible; align-self: auto; }
    .sidebar-left, .sidebar-right, .content-area { display: block !important; flex: 1 1 100% !important; max-width: 100% !important; order: unset !important; }
    .back-to-top { bottom: 20px; right: 20px; width: 40px; height: 40px; }
    .site-logo-block { padding: 1.5rem 0.5rem; }
}