/*
Theme Name: dds_thebattlemasters.com
Author: Артём Зорин
Description: Информационная тема для проекта о домашнем ремонте своими руками и саморазвитии. Практические руководства и материалы о внутренних изменениях.
Version: 1.1
Requires at least: 6.0
Requires PHP: 8.0
Text Domain: tbm
*/

/* ============ Базовые переменные ============ */
:root {
    --ink: #211d17;
    --paper: #f3efe6;
    --paper-2: #e9e3d6;
    --card-bg: #fbf9f3;
    --rust: #b75d35;
    --rust-dark: #964627;
    --blue: #2c4456;
    --muted: #6f675a;
    --line: #d8d0c0;
    --dark: #1b1814;
    --dark-soft: #2a2620;
    --on-dark: #e7e0d2;
    --on-dark-muted: #a89f8d;
    --shell: min(92%, 1180px);
    --radius: 4px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
    margin: 0;
    overflow-x: hidden;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    font-size: 17px;
    line-height: 1.7;
    color: var(--ink);
    background-color: var(--paper);
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 {
    font-family: Georgia, "Times New Roman", serif;
    line-height: 1.25;
    color: var(--ink);
    margin: 0 0 0.5em;
    font-weight: 700;
}

h1 { font-size: 2.1rem; }
h2 { font-size: 1.65rem; }
h3 { font-size: 1.25rem; }

p { margin: 0 0 1.1em; }

a { color: var(--rust-dark); text-decoration: none; }
a:hover { color: var(--rust); text-decoration: underline; }

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

.shell { width: var(--shell); margin-inline: auto; }

/* ============ Шапка ============ */
.site-header {
    background: var(--paper);
    border-bottom: 3px solid var(--ink);
}
.header-inner {
    display: flex;
    align-items: center;
    gap: 28px;
    padding: 22px 0;
    flex-wrap: wrap;
}
.brand {
    display: flex;
    align-items: center;
    gap: 16px;
    min-width: 0;
    flex: 1 1 320px;
}
.brand-logo, .brand-mark { flex: 0 0 auto; }
.brand-mark svg { display: block; width: 52px; height: 52px; }
.brand-logo { max-height: 60px; width: auto; }
.brand-text { min-width: 0; }
.brand-name {
    font-family: Georgia, serif;
    font-weight: 700;
    font-size: 1.15rem;
    line-height: 1.2;
    color: var(--ink);
    display: block;
    max-width: 46ch;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.brand-name a { color: inherit; }
.brand-name a:hover { color: var(--rust); text-decoration: none; }
.brand-desc {
    font-size: 0.82rem;
    color: var(--muted);
    margin: 3px 0 0;
    max-width: 60ch;
    line-height: 1.45;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Навигация */
.main-nav { flex: 0 0 auto; }
.nav-toggle {
    display: none;
    background: var(--ink);
    color: var(--paper);
    border: none;
    padding: 9px 14px;
    border-radius: var(--radius);
    font-size: 0.95rem;
    cursor: pointer;
}
.main-nav ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}
.main-nav a {
    display: block;
    padding: 8px 14px;
    color: var(--ink);
    font-weight: 600;
    font-size: 0.96rem;
    border-radius: var(--radius);
    border: 1px solid transparent;
}
.main-nav a:hover {
    text-decoration: none;
    border-color: var(--line);
    background: var(--paper-2);
    color: var(--rust-dark);
}
.main-nav .current-menu-item > a {
    background: var(--ink);
    color: var(--paper);
}

/* ============ Хлебные крошки ============ */
.breadcrumbs {
    width: var(--shell);
    margin: 18px auto 0;
    font-size: 0.85rem;
    color: var(--muted);
}
.breadcrumbs a { color: var(--rust-dark); }
.breadcrumbs .sep { margin: 0 6px; color: var(--line); }
.breadcrumbs span { color: var(--ink); }

/* ============ Каркас контента ============ */
.site-main { padding: 30px 0 56px; }

.layout-with-sidebar,
.layout-single {
    width: var(--shell);
    margin-inline: auto;
}
.layout-with-sidebar {
    display: grid;
    grid-template-columns: minmax(0, 67fr) minmax(0, 27fr);
    gap: 6%;
    align-items: start;
}
.layout-single { display: block; }
.layout-single .content-area {
    max-width: 920px;
    margin-left: auto;
    margin-right: auto;
}
.content-area { min-width: 0; }

/* Узкая раскладка для главной — 85% */
.front-wrap { width: 85%; margin-inline: auto; max-width: 1180px; }

/* ============ Сайдбар ============ */
.sidebar { min-width: 0; }
.widget {
    background: var(--card-bg);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 24px;
}
.widget-title,
.widget h2, .widget h3 {
    font-size: 1.05rem;
    margin: 0 0 14px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--rust);
    color: var(--ink);
}
.sidebar .widget,
.sidebar .widget a,
.sidebar .widget li,
.sidebar .widget .post-date { color: var(--ink); }
.widget ul { list-style: none; margin: 0; padding: 0; }
.widget li { padding: 8px 0; border-bottom: 1px solid var(--line); line-height: 1.4; }
.widget li:last-child { border-bottom: none; }
.widget a { color: var(--ink); font-weight: 600; }
.widget a:hover { color: var(--rust-dark); }
.widget .post-date { display: block; font-size: 0.78rem; color: var(--muted); margin-top: 3px; }
.sidebar .widget .post-date { color: var(--muted); }

/* ============ Карточки записей ============ */
.cards-list { display: grid; gap: 26px; }
.card {
    display: flex;
    flex-direction: column;
    background: var(--card-bg);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    overflow: hidden;
}
.card-thumb-wrap {
    display: block;
    overflow: hidden;
    background: var(--paper-2);
}
.card-thumb-wrap img {
    width: 100%;
    height: auto;
    aspect-ratio: 16 / 9;
    object-fit: cover;
    display: block;
    transition: transform .4s ease;
}
.card:hover .card-thumb-wrap img { transform: scale(1.04); }
.card-body {
    flex: 1;
    padding: 22px 24px 24px;
    display: flex;
    flex-direction: column;
}
.card-title { font-size: 1.3rem; margin: 0 0 8px; }
.card-title a { color: var(--ink); }
.card-title a:hover { color: var(--rust-dark); text-decoration: none; }
.card-meta { font-size: 0.8rem; color: var(--muted); margin-bottom: 12px; }
.card-meta a { color: var(--muted); }
.card-excerpt { color: #4a4339; }
.card-excerpt p { margin: 0 0 0.5em; background: none; }
.card-more {
    align-self: flex-start;
    margin-top: 14px;
    padding: 9px 18px;
    background: var(--ink);
    color: var(--paper);
    border-radius: var(--radius);
    font-weight: 600;
    font-size: 0.9rem;
}
.card-more:hover { background: var(--rust-dark); color: #fff; text-decoration: none; }

/* Горизонтальная карточка (на широких лентах) */
@media (min-width: 760px) {
    .cards-list .card {
        flex-direction: row;
    }
    .cards-list .card-thumb-wrap {
        flex: 0 0 300px;
        position: relative;
    }
    .cards-list .card-thumb-wrap a {
        display: block;
        position: absolute;
        top: 0; left: 0; right: 0; bottom: 0;
    }
    .cards-list .card-thumb-wrap img {
        width: 100%;
        height: 100%;
        aspect-ratio: auto;
        object-fit: cover;
        display: block;
    }
}

/* ============ Одиночная запись / страница ============ */
.entry {
    background: var(--card-bg);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 34px 38px;
}
.entry-header { margin-bottom: 22px; border-bottom: 1px solid var(--line); padding-bottom: 18px; }
.entry-title { font-size: 2rem; margin: 0 0 10px; }
.entry-meta { font-size: 0.85rem; color: var(--muted); }
.entry-thumb { margin: 0 0 24px; border-radius: var(--radius); overflow: hidden; }
.entry-thumb img { width: 100%; display: block; }
.entry-content { line-height: 1.8; }
.entry-content img { border-radius: var(--radius); display: block; height: auto; }
.entry-content h2 { margin-top: 1.5em; }
.entry-content ul, .entry-content ol { padding-left: 1.4em; }
.entry-content blockquote {
    margin: 1.4em 0;
    padding: 6px 22px;
    border-left: 4px solid var(--rust);
    background: var(--paper-2);
    font-style: italic;
}

/* Таблицы */
.entry-content table { border-collapse: collapse; width: 100%; margin: 1.4em 0; }
.entry-content table, .entry-content th, .entry-content td { border: 1px solid var(--ink); }
.entry-content th, .entry-content td { padding: 10px 12px; text-align: left; }
.entry-content th { background: var(--paper-2); }

/* ============ Главная ============ */
.section { padding: 52px 0; }
.section + .section { border-top: 1px solid var(--line); }
.section-head { margin-bottom: 30px; }
.section-kicker {
    display: inline-block;
    font-size: 0.78rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--rust-dark);
    font-weight: 700;
    margin-bottom: 8px;
}
.section-title { font-size: 1.9rem; margin: 0; }
.section-lead { color: var(--muted); max-width: 60ch; margin-top: 10px; }

/* Hero */
.hero {
    background: var(--dark);
    color: var(--on-dark);
    padding: 70px 0;
    position: relative;
    overflow: hidden;
}
.hero::before {
    content: "";
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(255,255,255,0.05) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255,255,255,0.05) 1px, transparent 1px);
    background-size: 32px 32px;
    pointer-events: none;
}
.hero-inner { position: relative; max-width: 760px; }
.hero h1 { color: #fff; font-size: 2.5rem; margin-bottom: 16px; }
.hero p { color: var(--on-dark); font-size: 1.12rem; margin-bottom: 26px; }
.hero .btn-primary,
.btn-primary {
    display: inline-block;
    padding: 13px 26px;
    background: var(--rust);
    color: #fff;
    font-weight: 700;
    border-radius: var(--radius);
    border: none;
}
.btn-primary:hover { background: var(--rust-dark); color: #fff; text-decoration: none; }

/* Текст + иллюстрация */
.media-row { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1fr); gap: 44px; align-items: center; }
.media-row.reverse .media-text { order: 2; }
.media-row .media-figure img { width: 100%; border-radius: var(--radius); display: block; }
.media-text p { color: #4a4339; }

/* Сетка фактов / преимуществ */
.facts-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 22px; }
.fact-card {
    background: var(--card-bg);
    border: 1px solid var(--line);
    border-top: 4px solid var(--rust);
    border-radius: var(--radius);
    padding: 26px 24px;
    min-width: 0;
}
.fact-num { font-family: Georgia, serif; font-size: 2.3rem; font-weight: 700; color: var(--rust-dark); line-height: 1; }
.fact-card h3 { margin: 12px 0 8px; font-size: 1.1rem; }
.fact-card p { margin: 0; font-size: 0.95rem; color: var(--muted); }

/* Шаги */
.steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 24px; counter-reset: step; }
.step {
    background: var(--paper-2);
    border-radius: var(--radius);
    padding: 28px 24px 24px;
    position: relative;
    min-width: 0;
}
.step::before {
    counter-increment: step;
    content: counter(step);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 42px; height: 42px;
    background: var(--ink);
    color: var(--paper);
    font-family: Georgia, serif;
    font-weight: 700;
    font-size: 1.2rem;
    border-radius: 50%;
    margin-bottom: 14px;
}
.step h3 { font-size: 1.1rem; margin: 0 0 8px; }
.step p { margin: 0; font-size: 0.95rem; color: var(--muted); }

/* FAQ */
.faq-list { max-width: 820px; }
.faq-item {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--card-bg);
    margin-bottom: 14px;
    overflow: hidden;
}
.faq-item summary {
    cursor: pointer;
    padding: 18px 22px;
    font-weight: 700;
    font-family: Georgia, serif;
    font-size: 1.08rem;
    list-style: none;
    display: flex;
    justify-content: space-between;
    gap: 16px;
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after { content: "+"; color: var(--rust-dark); font-size: 1.4rem; line-height: 1; }
.faq-item[open] summary::after { content: "–"; }
.faq-item .faq-body { padding: 0 22px 18px; color: #4a4339; }
.faq-item .faq-body p { margin: 0; }

/* Цитата */
.pull-quote {
    background: var(--blue);
    color: #eef2f5;
    border-radius: var(--radius);
    padding: 50px 44px;
    text-align: center;
}
.pull-quote blockquote {
    margin: 0 auto;
    max-width: 760px;
    font-family: Georgia, serif;
    font-size: 1.55rem;
    line-height: 1.4;
    font-style: italic;
}
.pull-quote cite { display: block; margin-top: 18px; font-size: 0.95rem; font-style: normal; color: #b9c6cf; }

/* Галерея */
.gallery-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; }
.gallery-grid figure { margin: 0; border-radius: var(--radius); overflow: hidden; }
.gallery-grid img { width: 100%; height: 100%; aspect-ratio: 4/3; object-fit: cover; display: block; }

/* Последние записи (главная) */
.latest-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 26px; }
.latest-grid .card { flex-direction: column; }
.latest-grid .card-thumb-wrap { position: static; }
.latest-grid .card-thumb-wrap img { aspect-ratio: 16/9; height: auto; }

/* CTA */
.cta-band {
    background: var(--ink);
    color: var(--on-dark);
    border-radius: var(--radius);
    padding: 46px 40px;
    text-align: center;
}
.cta-band h2 { color: #fff; }
.cta-band p { color: var(--on-dark); max-width: 60ch; margin: 0 auto 24px; }

/* ============ Пагинация ============ */
.pagination {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
    margin-top: 38px;
}
.pagination .page-numbers {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 42px;
    height: 42px;
    padding: 0 14px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--card-bg);
    color: var(--ink);
    font-weight: 600;
}
.pagination a.page-numbers:hover { background: var(--paper-2); color: var(--rust-dark); text-decoration: none; }
.pagination .page-numbers.current { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.pagination .page-numbers.dots { border: none; background: none; }

/* ============ Поиск ============ */
.search-form { display: flex; gap: 8px; }
.search-form input[type="search"] {
    flex: 1;
    min-width: 0;
    padding: 11px 14px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: #fff;
    font-size: 1rem;
}
.search-form button {
    padding: 11px 20px;
    background: var(--ink);
    color: var(--paper);
    border: none;
    border-radius: var(--radius);
    font-weight: 600;
    cursor: pointer;
}
.search-form button:hover { background: var(--rust-dark); }

/* ============ 404 ============ */
.error-404 { text-align: center; padding: 40px 0; }
.error-404 .big { font-family: Georgia, serif; font-size: 5rem; color: var(--rust); line-height: 1; margin: 0; }
.error-404 .search-form { max-width: 460px; margin: 24px auto 0; }

/* ============ Комментарии ============ */
.comments-area { margin-top: 36px; }
.comments-area .comment-list { list-style: none; margin: 0; padding: 0; }
.comments-area .comment-list li { margin-bottom: 18px; }
.comments-area .comment-body {
    background: var(--card-bg);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 16px 20px;
}
.comments-area .comment-author { font-weight: 700; }
.comments-area .comment-metadata { font-size: 0.8rem; color: var(--muted); }
.comments-area .children { list-style: none; margin: 16px 0 0 26px; padding: 0; }
.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: var(--radius);
    font-size: 1rem;
    margin-top: 4px;
}
.comment-form p { margin-bottom: 14px; }
.comment-form .submit {
    background: var(--ink);
    color: var(--paper);
    border: none;
    padding: 11px 24px;
    border-radius: var(--radius);
    font-weight: 600;
    cursor: pointer;
}

/* ============ Подвал ============ */
.site-footer { background: var(--dark); color: var(--on-dark); padding: 50px 0 0; margin-top: auto; }
.footer-cols {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 36px;
    padding-bottom: 36px;
}
.footer-col { min-width: 0; }
.footer-col .widget { background: none; border: none; padding: 0; margin: 0; }
.footer-col .widget-title,
.footer-col .widget h2,
.footer-col .widget h3 {
    color: #fff;
    border-bottom-color: var(--rust);
}
.footer-col, .footer-col p, .footer-col li { color: var(--on-dark); }
.footer-col .widget a { color: var(--on-dark); font-weight: 500; }
.footer-col .widget a:hover { color: #fff; }
.footer-col .widget li { border-bottom: 1px solid rgba(255,255,255,0.12); }
.footer-col .widget .post-date { color: var(--on-dark-muted); }
.footer-contacts a { color: var(--on-dark); }
.footer-social { display: flex; gap: 12px; margin-top: 14px; }
.footer-social a {
    display: inline-flex;
    width: 38px; height: 38px;
    align-items: center; justify-content: center;
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: var(--radius);
    color: var(--on-dark);
}
.footer-social a:hover { background: var(--rust); border-color: var(--rust); color: #fff; }
.site-copyright {
    border-top: 1px solid rgba(255,255,255,0.14);
    padding: 20px 0;
    font-size: 0.85rem;
    color: var(--on-dark-muted);
    text-align: center;
}

/* ============ Cookie-баннер ============ */
.cookie-banner[hidden] { display: none !important; }
.cookie-banner {
    position: fixed;
    left: 0; right: 0; bottom: 0;
    z-index: 999;
    background: var(--ink);
    color: var(--on-dark);
    padding: 16px 0;
    box-shadow: 0 -4px 18px rgba(0,0,0,0.25);
}
.cookie-inner {
    display: flex;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
    justify-content: space-between;
}
.cookie-inner p { margin: 0; font-size: 0.9rem; flex: 1 1 300px; }
.cookie-inner a { color: #e7b894; }
.cookie-accept {
    flex: 0 0 auto;
    background: var(--rust);
    color: #fff;
    border: none;
    padding: 11px 24px;
    border-radius: var(--radius);
    font-weight: 700;
    cursor: pointer;
}
.cookie-accept:hover { background: var(--rust-dark); }

/* ============ Адаптив ============ */
@media (max-width: 960px) {
    .layout-with-sidebar { grid-template-columns: 1fr; gap: 36px; }
    .media-row { grid-template-columns: 1fr; gap: 26px; }
    .media-row.reverse .media-text { order: 0; }
    .hero h1 { font-size: 2rem; }
    .front-wrap { width: 90%; }
}

@media (max-width: 760px) {
    .cards-list .card { flex-direction: column; }
    .cards-list .card-thumb-wrap { flex: none; width: 100%; position: static; }
    .cards-list .card-thumb-wrap a { position: static; }
    .cards-list .card-thumb-wrap img { width: 100%; height: auto; aspect-ratio: 16/9; }
}

@media (max-width: 600px) {
    body { font-size: 16px; }
    .nav-toggle { display: block; }
    .main-nav { flex: 1 1 100%; }
    .main-nav ul {
        display: none;
        flex-direction: column;
        gap: 4px;
        margin-top: 14px;
    }
    .main-nav ul.open { display: flex; }
    .main-nav a { border: 1px solid var(--line); }
    .entry { padding: 24px 20px; }
    .hero { padding: 50px 0; }
    .hero h1 { font-size: 1.7rem; }
    .pull-quote { padding: 34px 22px; }
    .pull-quote blockquote { font-size: 1.25rem; }
    .section { padding: 40px 0; }
}
