/*
Theme Name: webcam 1.2
Theme URI: https://example.com
Author: webcam
Description: webcam 1 theme with basic templates.
Version: 1.2
Text Domain: webcam-1
*/

:root {
    --page-padding: clamp(12px, 2vw, 40px);
    --layout-gap: clamp(16px, 2vw, 32px);

    --header-height: 68px;
    --wp-admin-bar-height: 0px;

    --sidebar-width: 300px;

    --header-bg: #111111;
    --footer-bg: #222222;
    --content-bg: #ffffff;
    --sidebar-bg: #f0f4ff;
    --text-color: #222222;
    --link-color: #0073aa;

    /* right = sidebar справа, left = sidebar слева */
    --flex-dir: row-reverse;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    width: 100%;
    overflow-x: hidden;
}

body {
    min-width: 0;
    margin: 0;
    overflow-x: hidden;
    background: #f5f5f5;
    color: var(--text-color);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
    font-size: 16px;
    line-height: 1.6;
}

a {
    color: var(--link-color);
    text-decoration: none;
}

a:hover,
a:focus {
    text-decoration: underline;
}

img,
picture,
video,
iframe,
embed,
object {
    display: block;
    max-width: 100%;
    height: auto;
}

/* =========================================================
   ФИКСИРОВАННАЯ ШАПКА
   ========================================================= */

.site-header {
    position: fixed;
    top: var(--wp-admin-bar-height);
    right: 0;
    left: 0;
    z-index: 1000;

    width: 100%;
    height: var(--header-height);
    padding: 0 var(--page-padding);

    background: var(--header-bg);
    color: #fff;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.22);
}

body.admin-bar {
    --wp-admin-bar-height: 32px;
}

.site-header a {
    color: #fff;
}

.site-header .header-inner {
    display: flex;
    align-items: center;
    gap: clamp(12px, 2vw, 28px);

    width: 100%;
    height: 100%;
    margin: 0;
}

/* Логотип / название сайта */

.site-branding {
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-width: 0;
}

.site-description {
    max-width: min(42vw, 460px);
    margin: 3px 0 0;

    overflow: hidden;

    color: rgba(255, 255, 255, 0.75);
    font-size: 12px;
    font-weight: 400;
    line-height: 1.2;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.site-branding-link {
    display: block;
    max-width: min(34vw, 340px);
    overflow: hidden;

    color: #fff;
    font-size: clamp(18px, 1.5vw, 24px);
    font-weight: 700;
    line-height: 1.2;
    text-decoration: none;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Основное меню шапки */

.header-navigation {
    flex: 1 1 auto;
    min-width: 0;
}

.header-navigation .header-menu,
.header-navigation ul {
    display: flex;
    align-items: center;
    gap: clamp(8px, 1.4vw, 22px);

    margin: 0;
    padding: 0;
    list-style: none;
}

.header-navigation li {
    margin: 0;
    padding: 0;
}

.header-navigation a {
    display: block;
    padding: 0.5rem 0;

    color: #fff;
    font-size: 0.95rem;
    text-decoration: none;
    white-space: nowrap;
}

.header-navigation a:hover,
.header-navigation a:focus {
    color: #fff;
    text-decoration: underline;
}

/* Кнопка открытия выдвижной панели */

.header-drawer-toggle {
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;

    width: 42px;
    height: 42px;
    margin-left: auto;
    padding: 0;

    cursor: pointer;
    border: 1px solid rgba(255, 255, 255, 0.45);
    border-radius: 6px;
    outline: none;
    background: transparent;
    color: #fff;
}

.header-drawer-toggle:hover,
.header-drawer-toggle:focus {
    background: rgba(255, 255, 255, 0.14);
}

.header-drawer-toggle-icon {
    font-size: 23px;
    line-height: 1;
}

/* =========================================================
   ВЫДВИЖНАЯ ПАНЕЛЬ ШАПКИ
   ========================================================= */

.header-drawer-overlay {
    position: fixed;
    inset: 0;
    z-index: 1100;

    opacity: 0;
    cursor: pointer;
    background: rgba(0, 0, 0, 0.55);
    transition: opacity 0.25s ease;
}

.header-drawer-overlay.is-open {
    opacity: 1;
}

.header-drawer {
    position: fixed;
    top: var(--wp-admin-bar-height);
    right: 0;
    z-index: 1200;

    display: flex;
    flex-direction: column;

    width: min(420px, 92vw);
    height: calc(100dvh - var(--wp-admin-bar-height));
    min-height: 0;
    overflow: hidden;

    transform: translateX(105%);
    transition: transform 0.25s ease;

    background: #fff;
    color: var(--text-color);
    box-shadow: -8px 0 28px rgba(0, 0, 0, 0.3);
}

.header-drawer.is-open {
    transform: translateX(0);
}

.header-drawer-head {
    display: flex;
    flex: 0 0 var(--header-height);
    align-items: center;
    justify-content: space-between;
    gap: 1rem;

    padding: 0 1rem;
    background: var(--header-bg);
    color: #fff;
}

.header-drawer-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;

    width: 38px;
    height: 38px;
    padding: 0;

    cursor: pointer;
    border: 0;
    border-radius: 5px;
    background: transparent;
    color: #fff;
    font-size: 32px;
    line-height: 1;
}

.header-drawer-close:hover,
.header-drawer-close:focus {
    background: rgba(255, 255, 255, 0.14);
}

.header-drawer-content {
    flex: 1 1 auto;
    min-height: 0;
    padding: 1.25rem;
    overflow-y: auto;
    overscroll-behavior: contain;
}

/* Отдельное меню выдвижной панели */

.header-drawer-navigation {
    margin-bottom: 1.5rem;
}

.header-drawer-menu {
    margin: 0;
    padding: 0;
    list-style: none;
}

.header-drawer-menu li {
    margin: 0;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

.header-drawer-menu li:first-child {
    border-top: 1px solid rgba(0, 0, 0, 0.1);
}

.header-drawer-menu a {
    display: block;
    padding: 0.85rem 0.25rem;

    color: var(--text-color);
    font-weight: 600;
    text-decoration: none;
}

.header-drawer-menu a:hover,
.header-drawer-menu a:focus {
    color: var(--link-color);
    text-decoration: none;
}

.header-drawer-menu .sub-menu {
    margin: 0 0 0.75rem 1rem;
    padding: 0;
    list-style: none;
}

.header-drawer-menu .sub-menu li {
    border: 0;
}

.header-drawer-menu .sub-menu a {
    padding: 0.5rem 0.25rem;
    font-size: 0.95rem;
    font-weight: 400;
}

.header-drawer-widgets {
    padding-top: 1.5rem;
    border-top: 1px solid rgba(0, 0, 0, 0.12);
}

/* Пока панель открыта — основная страница не прокручивается */

body.header-drawer-open {
    overflow: hidden;
}

/* =========================================================
   ОСНОВНАЯ ОБЛАСТЬ: КОНТЕНТ + БОКОВАЯ КОЛОНКА
   ========================================================= */

.site-container {
    display: flex;
    flex-direction: var(--flex-dir);
    align-items: flex-start;
    gap: var(--layout-gap);

    width: 100%;
    min-width: 0;
    margin: 0;

    /*
     * Верхний отступ компенсирует fixed header.
     * Контент визуально начинается ниже шапки,
     * но при прокрутке проходит под ней.
     */
    padding:
        calc(var(--header-height) + clamp(16px, 2vw, 32px))
        var(--page-padding)
        clamp(16px, 2vw, 32px);
}

.site-main {
    flex: 1 1 auto;
    min-width: 0;
    width: 100%;
    padding: clamp(18px, 2vw, 32px);
    overflow-wrap: anywhere;

    background: var(--content-bg);
    border-radius: 8px;
}

.site-sidebar {
    flex: 0 0 min(var(--sidebar-width), 30vw);
    width: min(var(--sidebar-width), 30vw);
    min-width: 0;
    padding: clamp(16px, 1.5vw, 24px);
    overflow-wrap: anywhere;

    background: var(--sidebar-bg);
    border-radius: 8px;
}

.sidebar-none .site-sidebar {
    display: none;
}

/* Отдельная зона виджетов после/внутри контента */

.site-content-widgets {
    width: 100%;
    min-width: 0;
    margin-top: clamp(24px, 3vw, 48px);
    padding-top: clamp(20px, 2vw, 32px);
    border-top: 1px solid rgba(0, 0, 0, 0.12);
}

/* =========================================================
   ОБЩИЕ СТИЛИ WORDPRESS-ВИДЖЕТОВ
   ========================================================= */

.widget-container {
    min-width: 0;
    margin: 0 0 1.5rem;
    overflow-wrap: anywhere;
}

.widget-container:last-child {
    margin-bottom: 0;
}

.widget-title {
    margin: 0 0 0.75rem;
    padding-bottom: 0.5rem;

    font-size: 1.05rem;
    line-height: 1.3;
    border-bottom: 1px solid rgba(0, 0, 0, 0.12);
}

.widget-container ul,
.widget-container ol {
    margin: 0;
    padding-left: 1.25rem;
}

.widget-container li {
    margin-bottom: 0.4rem;
}

.widget-container input,
.widget-container select,
.widget-container textarea,
.widget-container button {
    max-width: 100%;
}

.widget-container input[type="text"],
.widget-container input[type="search"],
.widget-container input[type="email"],
.widget-container input[type="url"],
.widget-container input[type="password"],
.widget-container textarea,
.widget-container select {
    width: 100%;
    padding: 0.6rem 0.7rem;
}

/*новое*/

/*
 * Глобальная зона виджетов:
 * выводится один раз из header.php,
 * после fixed header и перед .site-container.
 */
.site-top-widgets {
    width: 100%;
    margin: 0;
    padding:
        calc(var(--header-height) + clamp(16px, 2vw, 32px))
        var(--page-padding)
        0;
}

.site-top-widgets > .widget-container {
    width: 100%;
    margin: 0;
    padding: clamp(18px, 2vw, 28px);

    background: var(--content-bg);
    border-radius: 8px;
}

/*
 * Если внутри зоны несколько виджетов,
 * между ними будет нормальный отступ.
 */
.site-top-widgets > .widget-container + .widget-container {
    margin-top: 1rem;
}

/*
 * Когда есть верхняя виджетная зона,
 * основному контейнеру не нужен второй большой отступ
 * под fixed header.
 */
.site-top-widgets + .site-container {
    padding-top: clamp(16px, 2vw, 32px);
}

/*кастомайзер*/
/*
 * Виджеты под фиксированной шапкой.
 * Цвета задаются в: Настроить → Цветовое оформление.
 */
.site-top-widgets {
    color: var(--top-widgets-text);
}

.site-top-widgets > .widget-container {
    background: var(--top-widgets-bg);
    color: var(--top-widgets-text);
}

.site-top-widgets .widget-title,
.site-top-widgets h1,
.site-top-widgets h2,
.site-top-widgets h3,
.site-top-widgets h4,
.site-top-widgets h5,
.site-top-widgets h6,
.site-top-widgets p,
.site-top-widgets li,
.site-top-widgets span,
.site-top-widgets div {
    color: inherit;
}

.site-top-widgets a {
    color: var(--top-widgets-link);
}

.site-top-widgets a:hover,
.site-top-widgets a:focus {
    color: var(--top-widgets-link);
    text-decoration: underline;
}

.site-top-widgets .widget-title {
    border-bottom-color: color-mix(
        in srgb,
        var(--top-widgets-text) 22%,
        transparent
    );
}

@media (max-width: 800px) {
    .site-top-widgets {
        padding-top: calc(var(--header-height) + 16px);
    }

    .site-top-widgets > .widget-container {
        padding: 18px;
    }

    .site-top-widgets + .site-container {
        padding-top: 16px;
    }
}

@media (max-width: 560px) {
    .site-top-widgets > .widget-container {
        padding: 14px;
        border-radius: 6px;
    }
}

/* Таблицы и широкие блоки не должны ломать ширину экрана */

.site-main table,
.site-sidebar table,
.site-content-widgets table,
.footer-column table,
.header-drawer table {
    display: block;
    max-width: 100%;
    overflow-x: auto;
    border-collapse: collapse;
}

/* =========================================================
   ПОДВАЛ: 4 ВИДЖЕТНЫЕ КОЛОНКИ
   ========================================================= */

.site-footer {
    width: 100%;
    margin-top: 0;
    padding: clamp(24px, 3vw, 48px) var(--page-padding) 1.25rem;

    background: var(--footer-bg);
    color: #fff;
}

.footer-inner {
    width: 100%;
    margin: 0;
}

.footer-navigation {
    margin-bottom: clamp(20px, 2vw, 32px);
}

.footer-navigation ul {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1.25rem;

    margin: 0;
    padding: 0;
    list-style: none;
}

.footer-navigation a,
.footer-widget a {
    color: #fff;
}

.footer-widgets {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: clamp(16px, 2vw, 32px);

    width: 100%;
}

.footer-column {
    min-width: 0;
    overflow-wrap: anywhere;
}

.footer-widget .widget-title {
    color: #fff;
    border-bottom-color: rgba(255, 255, 255, 0.24);
}

.footer-widget ul,
.footer-widget ol {
    margin: 0;
    padding-left: 1.25rem;
}

.site-info {
    margin: clamp(24px, 3vw, 48px) 0 0;
    padding-top: 1rem;

    color: rgba(255, 255, 255, 0.9);
    text-align: center;
    border-top: 1px solid rgba(255, 255, 255, 0.2);
}

/* =========================================================
   АДАПТИВ
   ========================================================= */

/* Планшет: подвал становится двухколоночным */

@media (max-width: 1100px) {
    :root {
        --page-padding: 20px;
        --layout-gap: 20px;
    }

    .site-sidebar {
        flex-basis: min(var(--sidebar-width), 32vw);
        width: min(var(--sidebar-width), 32vw);
    }

    .footer-widgets {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

/*
 * WP Admin Bar:
 * до 782px его рабочая высота составляет 46px.
 */

@media screen and (max-width: 782px) {
    body.admin-bar {
        --wp-admin-bar-height: 46px;
    }
}

/* Узкий планшет / телефон: контент и сайдбар одна под другой */

@media (max-width: 800px) {
    :root {
        --header-height: 60px;
        --page-padding: 12px;
        --layout-gap: 16px;
    }

    .site-header .header-inner {
        gap: 10px;
    }

    .site-branding-link {
        max-width: 35vw;
        font-size: 17px;
    }

    /*
     * Главное меню остаётся в шапке,
     * но если пунктов много — прокручивается горизонтально.
     */
    .header-navigation {
        overflow-x: auto;
        scrollbar-width: none;
    }

    .header-navigation::-webkit-scrollbar {
        display: none;
    }

    .header-navigation .header-menu,
    .header-navigation ul {
        width: max-content;
        gap: 14px;
    }

    .header-navigation a {
        font-size: 0.9rem;
    }

    .header-drawer-toggle {
        width: 38px;
        height: 38px;
    }

    .header-drawer {
        width: min(420px, 100vw);
    }

    .site-container {
        flex-direction: column;
        align-items: stretch;
        padding-top: calc(var(--header-height) + 16px);
        padding-bottom: 16px;
    }

    .site-main,
    .site-sidebar {
        flex: 0 0 auto;
        width: 100%;
    }

    .site-main {
        padding: 18px;
    }

    .site-sidebar {
        padding: 18px;
    }
}

/* Телефон: подвал в одну колонку */

@media (max-width: 560px) {
    body {
        font-size: 15px;
    }

    .site-main,
    .site-sidebar {
        padding: 14px;
        border-radius: 6px;
    }

    .footer-widgets {
        grid-template-columns: minmax(0, 1fr);
        gap: 24px;
    }

    .footer-navigation ul {
        flex-direction: column;
        gap: 0.5rem;
    }
}

/*
 * На очень узких экранах WP Admin Bar имеет absolute-позиционирование.
 * Шапка снова прижимается к верху viewport.
 */

@media screen and (max-width: 600px) {
    body.admin-bar {
        --wp-admin-bar-height: 0px;
    }
}