/*
Theme Name: dds_sripilmo.com
Author: Дмитрий Захаров
Description: Информационная тема об умной автоматизации и технологиях для роста бизнеса.
Version: 1.1
Text Domain: optimo
Requires at least: 6.0
Requires PHP: 8.0
*/

/* ============================================================ *
 *  Переменные
 * ============================================================ */
:root {
    --ink: #1a1f2b;
    --muted: #5c6573;
    --bg: #ffffff;
    --soft: #f4f6fb;
    --line: #e3e8f2;
    --brand: #2b59ff;
    --brand-dark: #1f44cc;
    --accent: #08c2a8;
    --dark: #11151f;
    --dark-soft: #1b2030;
    --dark-text: #c7ceda;
    --radius: 14px;
    --shell: min(92%, 1180px);
}

/* ============================================================ *
 *  База
 * ============================================================ */
*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

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

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

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

h1, h2, h3, h4 { line-height: 1.25; color: var(--ink); margin: 0 0 0.6em; }
h1 { font-size: 2.1rem; }
h2 { font-size: 1.6rem; }
h3 { font-size: 1.25rem; }

p { margin: 0 0 1.1em; }

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

.btn {
    display: inline-block;
    padding: 0.7em 1.5em;
    background: var(--brand);
    color: #fff;
    border-radius: 999px;
    font-weight: 600;
    transition: background 0.18s ease;
}
.btn:hover { background: var(--brand-dark); text-decoration: none; }
.btn-ghost {
    background: transparent;
    color: var(--brand);
    border: 1.5px solid var(--brand);
}
.btn-ghost:hover { background: var(--brand); color: #fff; }

/* ============================================================ *
 *  Шапка
 * ============================================================ */
.site-header {
    border-bottom: 1px solid var(--line);
    background: #fff;
}
.header-inner {
    display: flex;
    align-items: center;
    gap: 22px;
    padding: 18px 0;
    flex-wrap: wrap;
}
.brand {
    display: flex;
    align-items: center;
    gap: 14px;
    min-width: 0;
    flex: 1;
}
.brand-logo { display: block; max-height: 56px; width: auto; }
.brand-text { min-width: 0; }
.brand-name {
    display: block;
    font-weight: 700;
    font-size: 1.02rem;
    color: var(--ink);
    line-height: 1.3;
}
.brand-desc {
    display: block;
    font-size: 0.82rem;
    color: var(--muted);
    margin-top: 2px;
}

.nav-toggle {
    display: none;
    background: var(--soft);
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 9px 12px;
    cursor: pointer;
    font-size: 1rem;
    color: var(--ink);
}

.main-nav ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}
.main-nav a {
    display: block;
    padding: 9px 14px;
    border-radius: 9px;
    color: var(--ink);
    font-weight: 500;
}
.main-nav a:hover { background: var(--soft); text-decoration: none; }
.main-nav .current-menu-item > a { color: var(--brand); }

/* ============================================================ *
 *  Раскладка контента
 * ============================================================ */
.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 .content-area { width: 85%; margin-inline: auto; }
.layout-single .content-area.narrow { width: 85%; margin-inline: auto; }

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

/* ============================================================ *
 *  Хлебные крошки
 * ============================================================ */
.breadcrumbs {
    font-size: 0.85rem;
    color: var(--muted);
    margin: 0 0 22px;
}
.breadcrumbs a { color: var(--muted); }
.breadcrumbs a:hover { color: var(--brand); }
.breadcrumbs .sep { margin: 0 6px; color: #b6bfd0; }

/* ============================================================ *
 *  Карточки записей
 * ============================================================ */
.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr));
    gap: 26px;
}

.card {
    display: flex;
    flex-direction: column;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    overflow: hidden;
    transition: transform 0.18s ease, box-shadow 0.18s ease;
}
.card:hover {
    transform: translateY(-3px);
    box-shadow: 0 14px 30px rgba(27, 41, 92, 0.10);
}
.card-thumb {
    display: block;
    aspect-ratio: 16 / 9;
    overflow: hidden;
}
.card-thumb img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.card-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 20px 22px 24px;
    min-width: 0;
}
.card-title { font-size: 1.18rem; margin: 0 0 8px; }
.card-title a { color: var(--ink); }
.card-title a:hover { color: var(--brand); text-decoration: none; }
.card-meta {
    font-size: 0.8rem;
    color: var(--muted);
    margin-bottom: 10px;
}
.card-excerpt { color: var(--muted); font-size: 0.95rem; }
.card-excerpt p { margin: 0 0 0.5em; background: none; }
.card-more {
    margin-top: auto;
    padding-top: 14px;
    font-weight: 600;
    font-size: 0.92rem;
}

/* Горизонтальная карточка (лента статей) */
.post-list { display: flex; flex-direction: column; gap: 24px; }
.card-row {
    display: flex;
    flex-direction: row;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    overflow: hidden;
}
.card-row .card-thumb-wrap {
    flex: 0 0 300px;
    position: relative;
    overflow: hidden;
}
.card-row .card-thumb-wrap a {
    display: block;
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
}
.card-row .card-thumb-wrap img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.card-row .card-body { padding: 24px 28px; }

/* ============================================================ *
 *  Одиночная запись / страница
 * ============================================================ */
.entry {
    background: #fff;
}
.entry-header { margin-bottom: 18px; }
.entry-title { font-size: 2rem; margin-bottom: 10px; }
.entry-meta { color: var(--muted); font-size: 0.88rem; }
.entry-thumb {
    margin: 0 0 24px;
    border-radius: var(--radius);
    overflow: hidden;
}
.entry-thumb img { display: block; width: 100%; height: auto; }
.entry-content { font-size: 1.04rem; }
.entry-content img { border-radius: 10px; display: block; }
.entry-content h2 { margin-top: 1.4em; }
.entry-content ul, .entry-content ol { padding-left: 1.4em; }
.entry-content blockquote {
    margin: 1.4em 0;
    padding: 14px 22px;
    border-left: 4px solid var(--brand);
    background: var(--soft);
    border-radius: 0 10px 10px 0;
}

/* Таблицы */
.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(--line);
}
.entry-content th, .entry-content td { padding: 10px 14px; text-align: left; }
.entry-content th { background: var(--soft); }

/* ============================================================ *
 *  Сайдбар и виджеты (контраст: светлый фон → тёмный текст)
 * ============================================================ */
.sidebar { min-width: 0; }
.sidebar .widget {
    background: var(--soft);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 22px 22px 24px;
    margin-bottom: 24px;
    color: var(--ink);
}
.sidebar .widget-title {
    font-size: 1.05rem;
    margin: 0 0 14px;
    color: var(--ink);
}
.sidebar .widget ul { list-style: none; margin: 0; padding: 0; }
.sidebar .widget li {
    padding: 9px 0;
    border-bottom: 1px solid var(--line);
}
.sidebar .widget li:last-child { border-bottom: none; }
.sidebar .widget a { color: var(--ink); }
.sidebar .widget a:hover { color: var(--brand); }
.sidebar .widget .post-date { color: var(--muted); font-size: 0.8rem; }

/* ============================================================ *
 *  Главная — секции
 * ============================================================ */
.home-section { padding: 50px 0; }
.home-section.alt { background: var(--soft); }
.section-head { text-align: center; max-width: 720px; margin: 0 auto 36px; }
.section-head h2 { font-size: 1.9rem; }
.section-head p { color: var(--muted); }

/* Блок: текст + иллюстрация */
.split {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 44px;
    align-items: center;
}
.split.reverse .split-media { order: 2; }
.split-media img, .split-media svg {
    display: block;
    width: 100%;
    height: auto;
    border-radius: var(--radius);
}
.split-text h2 { font-size: 1.8rem; }
.split-text .lead { font-size: 1.08rem; }

/* Блок: сетка преимуществ */
.feature-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr));
    gap: 24px;
}
.feature {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 26px 24px;
    min-width: 0;
}
.feature .icon {
    width: 48px; height: 48px;
    display: flex; align-items: center; justify-content: center;
    background: rgba(43, 89, 255, 0.10);
    border-radius: 12px;
    margin-bottom: 14px;
}
.feature .icon svg { width: 26px; height: 26px; }
.feature h3 { font-size: 1.12rem; }
.feature p { color: var(--muted); font-size: 0.95rem; margin: 0; }

/* Блок: шаги */
.steps {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 230px), 1fr));
    gap: 26px;
    counter-reset: step;
}
.step {
    min-width: 0;
    padding-top: 8px;
}
.step .num {
    width: 44px; height: 44px;
    display: flex; align-items: center; justify-content: center;
    border-radius: 50%;
    background: var(--brand);
    color: #fff;
    font-weight: 700;
    font-size: 1.1rem;
    margin-bottom: 14px;
}
.step h3 { font-size: 1.1rem; }
.step p { color: var(--muted); font-size: 0.95rem; margin: 0; }

/* Блок: FAQ */
.faq { max-width: 820px; margin: 0 auto; }
.faq details {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 4px 22px;
    margin-bottom: 14px;
}
.faq summary {
    cursor: pointer;
    font-weight: 600;
    padding: 16px 0;
    list-style: none;
    position: relative;
    padding-right: 28px;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after {
    content: "+";
    position: absolute;
    right: 0; top: 14px;
    font-size: 1.4rem;
    color: var(--brand);
}
.faq details[open] summary::after { content: "−"; }
.faq details p { color: var(--muted); margin: 0 0 16px; }

/* Блок: последние записи на главной */
.home-latest .cards-grid { margin-top: 8px; }
.home-latest .more-link { text-align: center; margin-top: 34px; }

/* CTA */
.cta-box {
    background: linear-gradient(135deg, var(--brand) 0%, #6d4bff 100%);
    color: #fff;
    border-radius: 20px;
    padding: 46px 40px;
    text-align: center;
}
.cta-box h2 { color: #fff; }
.cta-box p { color: rgba(255,255,255,0.9); max-width: 600px; margin: 0 auto 24px; }
.cta-box .btn { background: #fff; color: var(--brand); }
.cta-box .btn:hover { background: #eef2ff; }

/* ============================================================ *
 *  Пагинация (type => plain, стили на .page-numbers)
 * ============================================================ */
.pagination {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
    margin-top: 40px;
}
.pagination .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: 10px;
    color: var(--ink);
    font-weight: 600;
    background: #fff;
}
.pagination a.page-numbers:hover {
    border-color: var(--brand);
    color: var(--brand);
    text-decoration: none;
}
.pagination .page-numbers.current {
    background: var(--brand);
    border-color: var(--brand);
    color: #fff;
}
.pagination .page-numbers.dots {
    border: none;
    background: none;
}

/* ============================================================ *
 *  Подвал (тёмный фон → светлый текст виджетов)
 * ============================================================ */
.site-footer {
    background: var(--dark);
    color: var(--dark-text);
    padding: 50px 0 0;
}
.footer-cols {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr));
    gap: 36px;
    padding-bottom: 40px;
}
.footer-cols .widget { min-width: 0; color: var(--dark-text); }
.footer-cols .widget-title {
    color: #fff;
    font-size: 1.05rem;
    margin-bottom: 16px;
}
.footer-cols .widget p { color: var(--dark-text); }
.footer-cols .widget ul { list-style: none; margin: 0; padding: 0; }
.footer-cols .widget li { padding: 7px 0; }
.footer-cols .widget a { color: var(--dark-text); }
.footer-cols .widget a:hover { color: #fff; }
.footer-bottom {
    border-top: 1px solid var(--dark-soft);
    padding: 22px 0;
    font-size: 0.85rem;
    color: #8b93a5;
    text-align: center;
}

/* ============================================================ *
 *  Форма поиска
 * ============================================================ */
.search-form {
    display: flex;
    gap: 8px;
}
.search-form .search-field {
    flex: 1;
    min-width: 0;
    padding: 11px 14px;
    border: 1px solid var(--line);
    border-radius: 10px;
    font-size: 0.95rem;
}
.search-form .search-submit {
    padding: 11px 18px;
    border: none;
    background: var(--brand);
    color: #fff;
    border-radius: 10px;
    font-weight: 600;
    cursor: pointer;
}
.search-form .search-submit:hover { background: var(--brand-dark); }

/* ============================================================ *
 *  Комментарии
 * ============================================================ */
.comments-area { margin-top: 44px; }
.comments-title { font-size: 1.4rem; }
.comment-list { list-style: none; margin: 0; padding: 0; }
.comment-list .children { list-style: none; margin: 0 0 0 28px; padding: 0; }
.comment-body {
    background: var(--soft);
    border-radius: 12px;
    padding: 18px 20px;
    margin-bottom: 16px;
}
.comment-meta { display: flex; gap: 12px; font-size: 0.85rem; margin-bottom: 8px; }
.comment-author { font-weight: 700; }
.comment-date { color: var(--muted); }
.comment-form input[type="text"],
.comment-form input[type="email"],
.comment-form input[type="url"],
.comment-form textarea {
    width: 100%;
    padding: 11px 14px;
    border: 1px solid var(--line);
    border-radius: 10px;
    font-family: inherit;
    font-size: 0.96rem;
}
.comment-form .submit {
    padding: 11px 22px;
    border: none;
    background: var(--brand);
    color: #fff;
    border-radius: 999px;
    font-weight: 600;
    cursor: pointer;
}

/* ============================================================ *
 *  404
 * ============================================================ */
.error-404 { text-align: center; padding: 40px 0; }
.error-404 .code { font-size: 5rem; font-weight: 800; color: var(--brand); line-height: 1; }
.error-404 .search-form { max-width: 460px; margin: 26px auto 0; }

/* ============================================================ *
 *  Cookie-баннер — правило [hidden] ДО основных стилей (A11)
 * ============================================================ */
.cookie-banner[hidden] { display: none !important; }

.cookie-banner {
    position: fixed;
    left: 16px; right: 16px; bottom: 16px;
    z-index: 9999;
    display: flex;
    align-items: center;
    gap: 18px;
    flex-wrap: wrap;
    background: var(--dark);
    color: var(--dark-text);
    padding: 16px 22px;
    border-radius: 14px;
    box-shadow: 0 14px 40px rgba(0, 0, 0, 0.28);
    max-width: 880px;
    margin-inline: auto;
}
.cookie-banner p { margin: 0; flex: 1; min-width: 200px; font-size: 0.9rem; }
.cookie-banner a { color: #fff; text-decoration: underline; }
.cookie-banner .cookie-accept {
    padding: 10px 22px;
    border: none;
    background: var(--brand);
    color: #fff;
    border-radius: 999px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
}
.cookie-banner .cookie-accept:hover { background: var(--brand-dark); }

/* ============================================================ *
 *  Адаптив
 * ============================================================ */
@media (max-width: 960px) {
    .layout-with-sidebar { grid-template-columns: 1fr; gap: 32px; }
    .layout-single .content-area,
    .layout-single .content-area.narrow { width: 100%; }
    .split { grid-template-columns: 1fr; gap: 28px; }
    .split.reverse .split-media { order: 0; }
    h1, .entry-title { font-size: 1.7rem; }
}

@media (max-width: 600px) {
    body { font-size: 16px; }
    .nav-toggle { display: block; }
    .main-nav {
        flex-basis: 100%;
        display: none;
    }
    .main-nav.open { display: block; }
    .main-nav ul { flex-direction: column; gap: 2px; }

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