/*
Theme Name: dds_chembus.ru
Author: Елена Демидова
Description: Информационная тема для экспертно-методической платформы учителей химии и естествознания. Адаптивная вёрстка, без сторонних плагинов.
Version: 1.1
Text Domain: chembus
*/

/* ---------------------------------------------------------------
   Переменные и база
---------------------------------------------------------------- */
:root {
    --maxw: 1180px;
    --ink: #18302f;
    --muted: #4f6664;
    --primary: #0f4c5c;
    --primary-2: #13697f;
    --accent: #c97a16;
    --accent-soft: #fbf1df;
    --bg: #ffffff;
    --soft: #eef5f4;
    --soft-2: #e2efec;
    --line: #d6e4e2;
    --footer-bg: #0a3742;
    --footer-ink: #cfe3e0;
    --footer-line: #1d5260;
    --radius: 14px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
    margin: 0;
    font-family: -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    color: var(--ink);
    background: var(--bg);
    line-height: 1.65;
    font-size: 17px;
    overflow-x: hidden;
}

h1, h2, h3, h4 {
    line-height: 1.25;
    color: var(--primary);
    margin: 0 0 0.6em;
    font-weight: 700;
}
h1 { font-size: 2.05rem; }
h2 { font-size: 1.6rem; }
h3 { font-size: 1.2rem; }

p { margin: 0 0 1em; }

a { color: var(--primary-2); text-decoration: none; }
a:hover { text-decoration: underline; }

img { max-width: 100%; height: auto; }

.shell {
    width: min(92%, var(--maxw));
    margin-inline: auto;
}

.btn {
    display: inline-block;
    background: var(--accent);
    color: #fff;
    padding: 0.7em 1.4em;
    border-radius: 999px;
    font-weight: 600;
    transition: background .2s;
}
.btn:hover { background: #a8630f; text-decoration: none; color: #fff; }

.btn-ghost {
    display: inline-block;
    border: 2px solid var(--primary);
    color: var(--primary);
    padding: 0.6em 1.3em;
    border-radius: 999px;
    font-weight: 600;
}
.btn-ghost:hover { background: var(--primary); color: #fff; text-decoration: none; }

/* ---------------------------------------------------------------
   Шапка
---------------------------------------------------------------- */
.site-header {
    background: var(--bg);
    border-bottom: 1px solid var(--line);
    padding: 18px 0;
}
.header-inner {
    display: flex;
    align-items: center;
    gap: 22px;
    flex-wrap: wrap;
}
.brand {
    display: flex;
    align-items: center;
    gap: 14px;
    min-width: 0;
    flex: 1;
}
.brand-logo, .brand-mark { flex: 0 0 auto; }
.brand-mark svg { display: block; width: 52px; height: 52px; }
.brand-text { min-width: 0; }
.brand-name {
    font-size: 1.02rem;
    font-weight: 700;
    color: var(--primary);
    line-height: 1.3;
    display: block;
    max-width: 640px;
}
.brand-name a { color: inherit; }
.brand-desc {
    font-size: 0.82rem;
    color: var(--muted);
    margin: 4px 0 0;
    max-width: 640px;
}

.main-nav { width: 100%; }
.main-nav ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 6px 22px;
}
.main-nav a {
    color: var(--ink);
    font-weight: 600;
    padding: 6px 2px;
    display: inline-block;
}
.main-nav a:hover { color: var(--accent); text-decoration: none; }
.main-nav .current-menu-item > a { color: var(--accent); }

.nav-toggle {
    display: none;
    background: var(--soft);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 8px 12px;
    font-weight: 600;
    color: var(--primary);
    cursor: pointer;
}

/* ---------------------------------------------------------------
   Каркас страниц
---------------------------------------------------------------- */
.site-main { padding: 34px 0 50px; }

.layout-with-sidebar {
    display: grid;
    grid-template-columns: minmax(0, 67fr) minmax(0, 27fr);
    gap: 40px;
    align-items: start;
}
.layout-single {
    display: block;
    width: 85%;
    margin-left: auto;
    margin-right: auto;
}
@media (max-width: 960px) {
    .layout-with-sidebar { grid-template-columns: 1fr; gap: 30px; }
    .layout-single { width: 100%; }
}

.content-area { min-width: 0; }

/* ---------------------------------------------------------------
   Хлебные крошки
---------------------------------------------------------------- */
.crumbs {
    font-size: 0.86rem;
    color: var(--muted);
    margin: 0 0 22px;
}
.crumbs a { color: var(--primary-2); }
.crumbs .sep { margin: 0 6px; color: var(--line); }

/* ---------------------------------------------------------------
   Карточки записей
---------------------------------------------------------------- */
.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr));
    gap: 26px;
}
.card {
    display: flex;
    flex-direction: column;
    background: var(--bg);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    overflow: hidden;
    min-width: 0;
}
.card-thumb {
    display: block;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    background: var(--soft);
}
.card-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.card-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 18px 20px 22px;
}
.card-title { font-size: 1.18rem; margin: 0 0 8px; }
.card-title a { color: var(--primary); }
.card-meta { font-size: 0.8rem; color: var(--muted); margin: 0 0 10px; }
.card-excerpt { color: var(--ink); }
.card-excerpt p { margin: 0 0 0.5em; background: none; }
.card-more { margin-top: auto; padding-top: 12px; }
.card-more a { font-weight: 600; }

/* Список записей в одну колонку (архив/поиск) */
.post-list { display: flex; flex-direction: column; gap: 22px; }
.post-list .card { flex-direction: row; }
.post-list .card-thumb-wrap {
    flex: 0 0 240px;
    position: relative;
    overflow: hidden;
}
.post-list .card-thumb-wrap a {
    display: block;
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
}
.post-list .card-thumb-wrap img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
@media (max-width: 600px) {
    .post-list .card { flex-direction: column; }
    .post-list .card-thumb-wrap {
        flex: none;
        width: 100%;
        position: static;
    }
    .post-list .card-thumb-wrap a { position: static; }
    .post-list .card-thumb-wrap img {
        width: 100%;
        height: auto;
        aspect-ratio: 16 / 9;
    }
}

/* ---------------------------------------------------------------
   Одиночная запись / страница
---------------------------------------------------------------- */
.entry-header { margin-bottom: 18px; }
.entry-title { margin: 0 0 8px; }
.entry-meta { font-size: 0.85rem; color: var(--muted); }
.entry-thumb {
    margin: 0 0 22px;
    border-radius: var(--radius);
    overflow: hidden;
}
.entry-thumb img { width: 100%; display: block; }
.entry-content { font-size: 1.05rem; }
.entry-content img { border-radius: 10px; }
.entry-content h2, .entry-content h3 { margin-top: 1.4em; }
.entry-content ul, .entry-content ol { padding-left: 1.4em; }
.entry-content blockquote {
    margin: 1.4em 0;
    padding: 0.6em 1.2em;
    border-left: 4px solid var(--accent);
    background: var(--soft);
    color: var(--ink);
}

table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.2em 0;
}
table, th, td { border: 1px solid var(--line); }
th, td { padding: 10px 12px; text-align: left; }
th { background: var(--soft); }

/* ---------------------------------------------------------------
   Сайдбар / виджеты
---------------------------------------------------------------- */
.sidebar { min-width: 0; }
.sidebar .widget {
    background: var(--soft);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 18px 20px;
    margin-bottom: 24px;
    color: var(--ink);
}
.sidebar .widget-title {
    font-size: 1.05rem;
    margin: 0 0 12px;
    color: var(--primary);
}
.sidebar .widget a { color: var(--primary-2); }
.sidebar .widget ul { list-style: none; margin: 0; padding: 0; }
.sidebar .widget li {
    padding: 7px 0;
    border-bottom: 1px solid var(--line);
    font-size: 0.95rem;
}
.sidebar .widget li:last-child { border-bottom: none; }
.sidebar .widget .post-date { color: var(--muted); font-size: 0.8rem; }

/* ---------------------------------------------------------------
   Форма поиска
---------------------------------------------------------------- */
.search-form {
    display: flex;
    gap: 8px;
    min-width: 0;
}
.search-form .search-field {
    flex: 1;
    min-width: 0;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    font: inherit;
}
.search-form .search-submit {
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 10px 16px;
    font-weight: 600;
    cursor: pointer;
}
.search-form .search-submit:hover { background: var(--primary-2); }

/* ---------------------------------------------------------------
   Пагинация (type => plain → .page-numbers)
---------------------------------------------------------------- */
.pager {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 36px 0 0;
}
.pager .page-numbers {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 42px;
    height: 42px;
    padding: 0 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    color: var(--primary);
    font-weight: 600;
    background: var(--bg);
}
.pager a.page-numbers:hover { background: var(--soft); text-decoration: none; }
.pager .page-numbers.current {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}
.pager .page-numbers.dots {
    border: none;
    background: none;
}

/* ---------------------------------------------------------------
   Главная страница
---------------------------------------------------------------- */
.home-section { padding: 18px 0; margin-bottom: 18px; }
.section-head { margin-bottom: 22px; }
.section-head h2 { margin-bottom: 6px; }
.section-head p { color: var(--muted); margin: 0; }

/* Блок: текст + иллюстрация */
.feature {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 38px;
    align-items: center;
    background: var(--soft);
    border-radius: 20px;
    padding: 34px 38px;
}
.feature.reverse .feature-media { order: 2; }
.feature-media img { width: 100%; display: block; border-radius: 14px; }
.feature-body h2 { margin-top: 0; }
@media (max-width: 760px) {
    .feature { grid-template-columns: 1fr; gap: 24px; padding: 26px; }
    .feature.reverse .feature-media { order: 0; }
}

/* Блок: сетка карточек-направлений */
.tiles {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr));
    gap: 22px;
}
.tile {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 24px 22px;
    background: var(--bg);
    min-width: 0;
}
.tile .tile-ico {
    width: 46px; height: 46px;
    display: flex; align-items: center; justify-content: center;
    background: var(--accent-soft);
    border-radius: 12px;
    margin-bottom: 14px;
}
.tile .tile-ico svg { width: 26px; height: 26px; display: block; }
.tile h3 { margin: 0 0 8px; }
.tile p { margin: 0; color: var(--muted); font-size: 0.96rem; }

/* Блок: пошаговый */
.steps {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr));
    gap: 22px;
    counter-reset: step;
}
.step {
    position: relative;
    padding: 26px 22px 22px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--bg);
    min-width: 0;
}
.step::before {
    counter-increment: step;
    content: counter(step);
    display: inline-flex;
    align-items: center; justify-content: center;
    width: 38px; height: 38px;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    font-weight: 700;
    margin-bottom: 12px;
}
.step h3 { margin: 0 0 6px; font-size: 1.08rem; }
.step p { margin: 0; color: var(--muted); font-size: 0.95rem; }

/* Блок: FAQ аккордеон */
.faq { display: flex; flex-direction: column; gap: 12px; }
.faq details {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--bg);
    overflow: hidden;
}
.faq summary {
    cursor: pointer;
    padding: 16px 20px;
    font-weight: 600;
    color: var(--primary);
    list-style: none;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after {
    content: '+';
    float: right;
    color: var(--accent);
    font-size: 1.3rem;
    line-height: 1;
}
.faq details[open] summary::after { content: '−'; }
.faq .faq-body { padding: 0 20px 18px; color: var(--ink); }
.faq .faq-body p { margin: 0; }

/* Блок: последние записи (заголовок секции) */
.latest-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 22px;
}

/* ---------------------------------------------------------------
   Комментарии
---------------------------------------------------------------- */
.comments-area { margin-top: 40px; }
.comment-list { list-style: none; margin: 0; padding: 0; }
.comment-list .children { list-style: none; margin: 0 0 0 24px; padding: 0; }
.comment-item { margin: 0 0 18px; }
.comment-inner {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 16px 18px;
    background: var(--bg);
}
.comment-head {
    display: flex;
    gap: 12px;
    align-items: baseline;
    flex-wrap: wrap;
    margin-bottom: 6px;
}
.comment-author { font-weight: 700; color: var(--primary); }
.comment-date { font-size: 0.8rem; color: var(--muted); }
.comment-await { font-size: 0.85rem; color: var(--accent); }
.comment-reply a { font-weight: 600; font-size: 0.9rem; }
.comment-respond {
    margin-top: 26px;
    padding: 22px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--soft);
}
.comment-form input[type="text"],
.comment-form input[type="email"],
.comment-form input[type="url"],
.comment-form textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    font: inherit;
    margin-bottom: 12px;
}
.comment-form .submit {
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: 999px;
    padding: 10px 22px;
    font-weight: 600;
    cursor: pointer;
}

/* ---------------------------------------------------------------
   Контакты (статичные)
---------------------------------------------------------------- */
.contact-block { display: flex; flex-wrap: wrap; gap: 14px; margin: 18px 0; }
.contact-block a { font-weight: 600; }

/* ---------------------------------------------------------------
   Подвал
---------------------------------------------------------------- */
.site-footer {
    background: var(--footer-bg);
    color: var(--footer-ink);
    padding: 48px 0 22px;
    margin-top: 30px;
}
.footer-cols {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 230px), 1fr));
    gap: 32px;
}
.site-footer .widget { color: var(--footer-ink); min-width: 0; }
.site-footer .widget-title {
    color: #fff;
    font-size: 1.05rem;
    margin: 0 0 14px;
}
.site-footer .widget a { color: #ffd9a3; }
.site-footer .widget a:hover { color: #fff; }
.site-footer .widget ul { list-style: none; margin: 0; padding: 0; }
.site-footer .widget li {
    padding: 6px 0;
    border-bottom: 1px solid var(--footer-line);
}
.site-footer .widget li:last-child { border-bottom: none; }
.site-footer .widget .post-date { color: #9fc3bd; font-size: 0.8rem; }
.footer-copy {
    margin-top: 34px;
    padding-top: 18px;
    border-top: 1px solid var(--footer-line);
    font-size: 0.85rem;
    color: #9fc3bd;
}

/* ---------------------------------------------------------------
   Cookie-баннер (правило [hidden] — до основного блока)
---------------------------------------------------------------- */
.cookie-banner[hidden] { display: none !important; }
.cookie-banner {
    position: fixed;
    left: 0; right: 0; bottom: 0;
    z-index: 999;
    background: var(--primary);
    color: #fff;
    padding: 16px 0;
}
.cookie-inner {
    display: flex;
    align-items: center;
    gap: 18px;
    flex-wrap: wrap;
    justify-content: space-between;
}
.cookie-inner p { margin: 0; font-size: 0.92rem; min-width: 0; flex: 1; }
.cookie-inner a { color: #ffd9a3; }
.cookie-accept {
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: 999px;
    padding: 10px 24px;
    font-weight: 600;
    cursor: pointer;
    flex: 0 0 auto;
}
.cookie-accept:hover { background: #a8630f; }

/* ---------------------------------------------------------------
   404
---------------------------------------------------------------- */
.error-404 { text-align: center; padding: 30px 0; }
.error-404 .big { font-size: 4rem; color: var(--accent); margin: 0; }

/* ---------------------------------------------------------------
   Адаптив навигации
---------------------------------------------------------------- */
@media (max-width: 760px) {
    .nav-toggle { display: inline-block; }
    .main-nav ul {
        display: none;
        flex-direction: column;
        gap: 0;
        margin-top: 12px;
    }
    .main-nav.is-open ul { display: flex; }
    .main-nav li { border-bottom: 1px solid var(--line); }
    .main-nav a { padding: 10px 0; display: block; }
}
