/*
Theme Name: dds_daf27.ru
Author: Денис Озеров
Description: Информационная тема для издания о российском учёте, налогах и финансах для малого бизнеса, самозанятых и бухгалтеров.
Version: 1.1
Requires at least: 6.0
Requires PHP: 8.0
Text Domain: dds_daf27
*/

/* ==================================================================
   Переменные и базовые стили
   ================================================================== */
:root {
    --bg: #f4f6f8;
    --surface: #ffffff;
    --ink: #1c2530;
    --muted: #5b6775;
    --accent: #1d5e7c;
    --accent-dark: #143f55;
    --accent-soft: #e8f0f4;
    --line: #e2e7ec;
    --footer-bg: #16202b;
    --footer-ink: #c7d0da;
    --footer-head: #ffffff;
    --radius: 10px;
    --shell: min(92%, 1180px);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

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

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

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

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

p { margin: 0 0 1em; }

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

.btn {
    display: inline-block;
    background: var(--accent);
    color: #fff;
    padding: 0.7em 1.5em;
    border-radius: 8px;
    font-weight: 600;
    transition: background .18s ease;
}
.btn:hover { background: var(--accent-dark); color: #fff; text-decoration: none; }

.btn-light {
    background: #fff;
    color: var(--accent-dark);
}
.btn-light:hover { background: var(--accent-soft); color: var(--accent-dark); }

/* ==================================================================
   Шапка
   ================================================================== */
.site-header {
    background: var(--surface);
    border-bottom: 1px solid var(--line);
}
.header-inner {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    flex-wrap: wrap;
    padding: 1.1rem 0;
}
.branding {
    display: flex;
    align-items: center;
    gap: 0.9rem;
    min-width: 0;
}
.branding .brand-logo { display: block; height: 52px; width: auto; }
.brand-text { min-width: 0; }
.site-title {
    font-size: 1.15rem;
    font-weight: 700;
    margin: 0;
    line-height: 1.2;
}
.site-title a { color: var(--ink); }
.site-title a:hover { color: var(--accent); text-decoration: none; }
.site-desc {
    font-size: 0.82rem;
    color: var(--muted);
    margin: 0.2rem 0 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.main-nav { margin-left: auto; }
.nav-toggle {
    display: none;
    background: none;
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 0.5rem 0.7rem;
    font-size: 1rem;
    cursor: pointer;
    color: var(--ink);
}
.main-nav ul {
    list-style: none;
    display: flex;
    gap: 0.4rem;
    margin: 0;
    padding: 0;
    flex-wrap: wrap;
}
.main-nav a {
    display: block;
    padding: 0.5rem 0.85rem;
    color: var(--ink);
    border-radius: 6px;
    font-weight: 500;
}
.main-nav a:hover,
.main-nav .current-menu-item > a {
    background: var(--accent-soft);
    color: var(--accent-dark);
    text-decoration: none;
}

/* ==================================================================
   Хлебные крошки
   ================================================================== */
.breadcrumbs {
    font-size: 0.85rem;
    color: var(--muted);
    padding: 1rem 0 0.2rem;
}
.breadcrumbs a { color: var(--accent); }
.breadcrumbs .sep { margin: 0 0.35rem; color: #9aa6b2; }

/* ==================================================================
   Раскладки
   ================================================================== */
.site-main { padding: 1.5rem 0 3rem; }

.layout-with-sidebar {
    display: grid;
    grid-template-columns: minmax(0, 67%) minmax(0, 27%);
    gap: 3%;
    align-items: start;
}
.layout-single .content-area,
.front-wrap { width: 100%; }

.layout-single {
    display: block;
}
.layout-single .content-area {
    width: 85%;
    margin-inline: auto;
}

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

.sidebar { min-width: 0; }

/* ==================================================================
   Виджеты — боковая колонка
   ================================================================== */
.sidebar .widget {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 1.3rem 1.4rem;
    margin-bottom: 1.5rem;
    color: var(--ink);
}
.sidebar .widget-title {
    font-size: 1.05rem;
    margin: 0 0 0.9rem;
    color: var(--ink);
    border-bottom: 2px solid var(--accent-soft);
    padding-bottom: 0.5rem;
}
.sidebar .widget ul { list-style: none; margin: 0; padding: 0; }
.sidebar .widget li {
    padding: 0.45rem 0;
    border-bottom: 1px solid var(--line);
}
.sidebar .widget li:last-child { border-bottom: none; }
.sidebar .widget a { color: var(--accent); }
.sidebar .widget a:hover { color: var(--accent-dark); }
.sidebar .widget .post-date { color: var(--muted); font-size: 0.8rem; }

/* ==================================================================
   Карточки записей (A8, A10)
   ================================================================== */
.cards { display: grid; gap: 1.5rem; }

.card {
    display: flex;
    flex-direction: column;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    overflow: hidden;
}
.card-thumb-wrap {
    flex: 0 0 auto;
    position: relative;
    overflow: hidden;
    aspect-ratio: 16 / 9;
}
.card-thumb-wrap a { display: block; height: 100%; }
.card-thumb-wrap img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.card-thumb-fallback {
    width: 100%;
    height: 100%;
    display: block;
    background: linear-gradient(135deg, var(--accent-soft), #d7e6ed);
}
.card-body {
    flex: 1;
    padding: 1.2rem 1.3rem 1.4rem;
    display: flex;
    flex-direction: column;
    min-width: 0;
}
.card-title { font-size: 1.2rem; margin: 0 0 0.5rem; }
.card-title a { color: var(--ink); }
.card-title a:hover { color: var(--accent); text-decoration: none; }
.card-meta { font-size: 0.8rem; color: var(--muted); margin-bottom: 0.6rem; }
.card-excerpt { color: var(--ink); }
.card-excerpt p { margin: 0 0 0.5em; background: none; }
.card-more {
    margin-top: auto;
    padding-top: 0.7rem;
    font-weight: 600;
}

/* Горизонтальная карточка для ленты блога */
.card-row { flex-direction: row; }
.card-row .card-thumb-wrap {
    flex: 0 0 280px;
    aspect-ratio: auto;
    position: relative;
}
.card-row .card-thumb-wrap a {
    display: block;
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    height: auto;
}
.card-row .card-thumb-wrap img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* ==================================================================
   Одиночная запись / страница
   ================================================================== */
.entry {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 1.8rem 2rem;
}
.entry-header { margin-bottom: 1.2rem; }
.entry-title { font-size: 2rem; margin: 0 0 0.5rem; }
.entry-meta { font-size: 0.85rem; color: var(--muted); }
.entry-thumb { margin: 0 0 1.5rem; border-radius: var(--radius); overflow: hidden; }
.entry-thumb img { width: 100%; display: block; }
.entry-content { min-width: 0; }
.entry-content img { border-radius: 8px; height: auto; }
.entry-content h2 { margin-top: 1.6rem; }
.entry-content ul, .entry-content ol { padding-left: 1.4rem; }
.entry-content blockquote {
    margin: 1.4rem 0;
    padding: 1rem 1.4rem;
    background: var(--accent-soft);
    border-left: 4px solid var(--accent);
    border-radius: 6px;
}
.entry-content blockquote p:last-child { margin-bottom: 0; }
.entry-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.4rem 0;
}
.entry-content table th,
.entry-content table td {
    border: 1px solid var(--line);
    padding: 0.6rem 0.8rem;
    text-align: left;
}
.entry-content table th { background: var(--accent-soft); }

.post-tags { margin-top: 1.5rem; font-size: 0.85rem; color: var(--muted); }
.post-tags a {
    display: inline-block;
    background: var(--accent-soft);
    color: var(--accent-dark);
    padding: 0.2rem 0.7rem;
    border-radius: 20px;
    margin: 0.2rem 0.2rem 0 0;
}

/* ==================================================================
   Пагинация (D5)
   ================================================================== */
.pagination {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin: 2rem 0 0;
    justify-content: center;
}
.pagination .page-numbers {
    display: inline-block;
    padding: 0.5rem 0.85rem;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: var(--surface);
    color: var(--ink);
    font-weight: 500;
    line-height: 1;
}
.pagination a.page-numbers:hover {
    background: var(--accent-soft);
    color: var(--accent-dark);
    text-decoration: none;
}
.pagination .page-numbers.current {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}
.pagination .page-numbers.dots {
    border: none;
    background: none;
}

/* ==================================================================
   Главная — общие
   ================================================================== */
.front-wrap { width: 85%; margin-inline: auto; padding: 2rem 0 3rem; }
.front-section { padding: 2.6rem 0; }
.section-head { margin-bottom: 1.6rem; }
.section-head h2 { margin-bottom: 0.4rem; }
.section-head .lead { color: var(--muted); margin: 0; max-width: 720px; }

/* Блок: текст + иллюстрация */
.fs-split {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 2.5rem;
    align-items: center;
}
.fs-split.reverse .fs-split-media { order: -1; }
.fs-split-media img { width: 100%; display: block; border-radius: var(--radius); }
.fs-split-text { min-width: 0; }
.fs-split-text h2 { margin-bottom: 0.7rem; }

/* Блок: сетка карточек-рубрик */
.fs-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.4rem;
}
.fs-tile {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 1.6rem 1.5rem;
    min-width: 0;
}
.fs-tile .tile-ico {
    width: 46px; height: 46px;
    display: flex; align-items: center; justify-content: center;
    background: var(--accent-soft);
    border-radius: 10px;
    margin-bottom: 0.9rem;
}
.fs-tile h3 { font-size: 1.1rem; margin-bottom: 0.4rem; }
.fs-tile p { margin: 0; color: var(--muted); font-size: 0.95rem; }

/* Блок: шаги */
.fs-steps {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.4rem;
    counter-reset: step;
}
.fs-step {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 1.6rem 1.5rem 1.5rem;
    position: relative;
    min-width: 0;
}
.fs-step .step-num {
    width: 40px; height: 40px;
    display: flex; align-items: center; justify-content: center;
    background: var(--accent);
    color: #fff;
    font-weight: 700;
    border-radius: 50%;
    margin-bottom: 0.9rem;
}
.fs-step h3 { font-size: 1.08rem; margin-bottom: 0.4rem; }
.fs-step p { margin: 0; color: var(--muted); font-size: 0.95rem; }

/* Блок: CTA (A14) */
.fs-cta {
    background: var(--accent-dark);
    color: #fff;
    border-radius: 14px;
    padding: 2.8rem 2.4rem;
    text-align: center;
}
.fs-cta h2 { color: #fff; margin-bottom: 0.6rem; }
.fs-cta p { color: #d6e3ea; max-width: 640px; margin: 0 auto 1.4rem; }

/* Блок последних записей на главной */
.front-latest .cards {
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

/* ==================================================================
   Подвал
   ================================================================== */
.site-footer {
    background: var(--footer-bg);
    color: var(--footer-ink);
    padding: 2.8rem 0 1.4rem;
}
.footer-cols {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 2rem;
}
.footer-cols .widget { min-width: 0; color: var(--footer-ink); }
.footer-cols .widget-title {
    color: var(--footer-head);
    font-size: 1.05rem;
    margin: 0 0 0.9rem;
}
.footer-cols .widget p { color: var(--footer-ink); }
.footer-cols .widget a { color: #9ec6da; }
.footer-cols .widget a:hover { color: #fff; }
.footer-cols .widget ul { list-style: none; margin: 0; padding: 0; }
.footer-cols .widget li { padding: 0.35rem 0; }
.site-copy {
    text-align: center;
    margin-top: 2.2rem;
    padding-top: 1.3rem;
    border-top: 1px solid rgba(255,255,255,0.12);
    font-size: 0.82rem;
    color: #8b97a4;
}

/* ==================================================================
   Поиск, комментарии
   ================================================================== */
.search-form {
    display: flex;
    gap: 0.5rem;
    max-width: 480px;
}
.search-form .search-field {
    flex: 1;
    min-width: 0;
    padding: 0.6rem 0.85rem;
    border: 1px solid var(--line);
    border-radius: 7px;
    font-size: 1rem;
}
.search-form .search-submit {
    background: var(--accent);
    color: #fff;
    border: none;
    padding: 0.6rem 1.2rem;
    border-radius: 7px;
    cursor: pointer;
    font-weight: 600;
}
.search-form .search-submit:hover { background: var(--accent-dark); }

.comments-area {
    margin-top: 2rem;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 1.6rem 1.8rem;
}
.comment-list { list-style: none; margin: 0; padding: 0; }
.comment-list .children { list-style: none; margin: 0 0 0 1.5rem; padding: 0; }
.comment-item { margin-bottom: 1.2rem; }
.comment-inner {
    background: var(--bg);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 1rem 1.2rem;
}
.comment-head {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 0.5rem;
}
.comment-author { font-weight: 600; }
.comment-date { font-size: 0.8rem; color: var(--muted); }
.comment-reply { margin-top: 0.5rem; font-size: 0.85rem; }
.comment-respond {
    margin-top: 1.6rem;
}
.comment-form label { display: block; font-size: 0.9rem; margin-bottom: 0.3rem; }
.comment-form input[type="text"],
.comment-form input[type="email"],
.comment-form input[type="url"],
.comment-form textarea {
    width: 100%;
    padding: 0.6rem 0.8rem;
    border: 1px solid var(--line);
    border-radius: 7px;
    font-size: 1rem;
    margin-bottom: 1rem;
    font-family: inherit;
}
.comment-form .submit {
    background: var(--accent);
    color: #fff;
    border: none;
    padding: 0.65rem 1.5rem;
    border-radius: 7px;
    cursor: pointer;
    font-weight: 600;
}

/* ==================================================================
   404
   ================================================================== */
.error-404 {
    text-align: center;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 3rem 2rem;
}
.error-404 .code { font-size: 4rem; font-weight: 800; color: var(--accent); margin: 0; }
.error-404 .search-form { margin: 1.5rem auto; }

/* ==================================================================
   Cookie-баннер (A11, D6)
   ================================================================== */
.cookie-banner[hidden] { display: none !important; }
.cookie-banner {
    position: fixed;
    left: 0; right: 0; bottom: 0;
    z-index: 999;
    background: var(--footer-bg);
    color: var(--footer-ink);
    padding: 1rem 0;
    box-shadow: 0 -2px 12px rgba(0,0,0,0.18);
}
.cookie-inner {
    display: flex;
    align-items: center;
    gap: 1.2rem;
    flex-wrap: wrap;
    justify-content: space-between;
}
.cookie-inner p { margin: 0; font-size: 0.9rem; min-width: 0; flex: 1; }
.cookie-inner a { color: #9ec6da; }
.cookie-accept {
    background: var(--accent);
    color: #fff;
    border: none;
    padding: 0.6rem 1.5rem;
    border-radius: 7px;
    cursor: pointer;
    font-weight: 600;
    white-space: nowrap;
}
.cookie-accept:hover { background: var(--accent-dark); }

/* ==================================================================
   Адаптив
   ================================================================== */
@media (max-width: 960px) {
    .layout-with-sidebar {
        grid-template-columns: 1fr;
        gap: 2rem;
    }
    .layout-single .content-area,
    .front-wrap { width: 100%; }
    .fs-split { grid-template-columns: 1fr; gap: 1.6rem; }
    .fs-split.reverse .fs-split-media { order: 0; }
}

@media (max-width: 600px) {
    body { font-size: 16px; }
    h1, .entry-title { font-size: 1.6rem; }
    h2 { font-size: 1.35rem; }

    .nav-toggle { display: block; }
    .main-nav { margin-left: auto; position: relative; }
    .main-nav ul {
        display: none;
        position: absolute;
        right: 0;
        top: calc(100% + 0.5rem);
        background: var(--surface);
        border: 1px solid var(--line);
        border-radius: var(--radius);
        flex-direction: column;
        min-width: 220px;
        padding: 0.5rem;
        box-shadow: 0 8px 24px rgba(0,0,0,0.12);
        z-index: 50;
    }
    .main-nav.open ul { display: flex; }

    .entry { padding: 1.4rem 1.2rem; }
    .fs-cta { padding: 2rem 1.4rem; }

    .card-row { flex-direction: column; }
    .card-row .card-thumb-wrap {
        flex: none;
        width: 100%;
        position: static;
        aspect-ratio: 16 / 9;
    }
    .card-row .card-thumb-wrap a { position: static; }
    .card-row .card-thumb-wrap img {
        width: 100%;
        height: auto;
        aspect-ratio: 16 / 9;
    }
}
