/*
Theme Name: dds_mapermis.com
Author: Артём Зиновьев
Description: Информационный портал о получении водительских прав, изучении ПДД и городской мобильности. Практические советы, разборы законодательства и безопасное передвижение по городу.
Version: 1.1
Requires at least: 6.0
Requires PHP: 8.0
Text Domain: mpm
*/

/* ============================================================ *
 *  Переменные и базовые стили
 * ============================================================ */
:root {
    --c-ink:      #16202b;
    --c-muted:    #5a6675;
    --c-line:     #e3e8ee;
    --c-bg:       #ffffff;
    --c-soft:     #f4f7fa;
    --c-brand:    #1f6f4f;
    --c-brand-dk: #16553c;
    --c-accent:   #e8a13b;
    --c-dark:     #16202b;
    --c-dark-2:   #1d2b38;
    --radius:     12px;
    --shell:      1180px;
}

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

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    font-family: "Segoe UI", "PT Sans", Tahoma, system-ui, sans-serif;
    color: var(--c-ink);
    background: var(--c-bg);
    line-height: 1.65;
    font-size: 17px;
    overflow-x: hidden;
}

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

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

a:hover {
    text-decoration: underline;
}

h1, h2, h3, h4 {
    line-height: 1.25;
    color: var(--c-ink);
    margin: 0 0 0.6em;
}

h1 { font-size: 2rem; }
h2 { font-size: 1.55rem; }
h3 { font-size: 1.2rem; }

p {
    margin: 0 0 1em;
}

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

/* ============================================================ *
 *  Шапка
 * ============================================================ */
.site-header {
    border-bottom: 1px solid var(--c-line);
    background: var(--c-bg);
}

.header-inner {
    display: flex;
    align-items: center;
    gap: 22px;
    padding: 16px 0;
    flex-wrap: wrap;
}

.brand {
    display: flex;
    align-items: center;
    gap: 14px;
    min-width: 0;
}

.brand-logo,
.brand-mark {
    flex: 0 0 auto;
    display: block;
}

.brand-text {
    min-width: 0;
}

.brand-name {
    font-size: 1.18rem;
    font-weight: 700;
    color: var(--c-ink);
    display: block;
    line-height: 1.3;
}

.brand-name a {
    color: inherit;
}

.brand-desc {
    font-size: 0.82rem;
    color: var(--c-muted);
    display: block;
    margin-top: 2px;
    max-width: 520px;
}

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

.main-nav {
    margin-left: auto;
}

.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: 8px;
    color: var(--c-ink);
    font-weight: 600;
    font-size: 0.98rem;
}

.main-nav a:hover {
    background: var(--c-soft);
    text-decoration: none;
    color: var(--c-brand);
}

.main-nav .current-menu-item > a {
    color: var(--c-brand);
}

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

.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;
}

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

/* ============================================================ *
 *  Хлебные крошки
 * ============================================================ */
.crumbs {
    font-size: 0.86rem;
    color: var(--c-muted);
    margin-bottom: 22px;
}

.crumbs a {
    color: var(--c-muted);
}

.crumbs a:hover {
    color: var(--c-brand);
}

.crumbs .sep {
    margin: 0 6px;
    color: var(--c-line);
}

/* ============================================================ *
 *  Карточки записей (A8, A10)
 * ============================================================ */
.card-list {
    display: grid;
    gap: 26px;
}

.card {
    display: flex;
    flex-direction: column;
    background: var(--c-bg);
    border: 1px solid var(--c-line);
    border-radius: var(--radius);
    overflow: hidden;
    transition: box-shadow 0.18s ease, transform 0.18s ease;
}

.card:hover {
    box-shadow: 0 10px 30px rgba(22, 32, 43, 0.09);
    transform: translateY(-2px);
}

.card-thumb {
    display: block;
    width: 100%;
    aspect-ratio: 16 / 9;
    object-fit: cover;
}

.card-thumb-ph {
    aspect-ratio: 16 / 9;
    background: linear-gradient(135deg, var(--c-brand) 0%, var(--c-brand-dk) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
}

.card-thumb-ph svg {
    width: 64px;
    height: 64px;
    opacity: 0.85;
}

.card-body {
    flex: 1;
    padding: 20px 22px 24px;
    display: flex;
    flex-direction: column;
}

.card-meta {
    font-size: 0.8rem;
    color: var(--c-muted);
    margin-bottom: 8px;
}

.card-title {
    font-size: 1.22rem;
    margin: 0 0 10px;
}

.card-title a {
    color: var(--c-ink);
}

.card-title a:hover {
    color: var(--c-brand);
}

.card-excerpt {
    color: var(--c-muted);
    font-size: 0.96rem;
    flex: 1;
}

.card-excerpt p {
    margin: 0 0 0.5em;
    background: none;
}

.card-more {
    align-self: flex-start;
    margin-top: 14px;
    font-weight: 600;
    color: var(--c-brand);
}

/* ============================================================ *
 *  Одиночная запись / страница
 * ============================================================ */
.entry {
    background: var(--c-bg);
}

.entry-header {
    margin-bottom: 22px;
}

.entry-title {
    font-size: 2.05rem;
}

.entry-meta {
    font-size: 0.86rem;
    color: var(--c-muted);
    margin-top: 6px;
}

.entry-thumb {
    width: 100%;
    border-radius: var(--radius);
    margin-bottom: 24px;
    display: block;
}

.entry-content {
    font-size: 1.04rem;
}

.entry-content img {
    border-radius: 10px;
    display: block;
}

.entry-content h2,
.entry-content h3 {
    margin-top: 1.5em;
}

.entry-content ul,
.entry-content ol {
    padding-left: 1.4em;
}

.entry-content blockquote {
    margin: 1.5em 0;
    padding: 14px 22px;
    border-left: 4px solid var(--c-brand);
    background: var(--c-soft);
    color: var(--c-ink);
    border-radius: 0 8px 8px 0;
}

.entry-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.5em 0;
}

.entry-content table,
.entry-content th,
.entry-content td {
    border: 1px solid var(--c-line);
}

.entry-content th,
.entry-content td {
    padding: 10px 14px;
    text-align: left;
}

.entry-content th {
    background: var(--c-soft);
}

.entry-tags {
    margin-top: 26px;
    font-size: 0.9rem;
}

.entry-tags a {
    display: inline-block;
    background: var(--c-soft);
    padding: 4px 12px;
    border-radius: 20px;
    margin: 0 6px 6px 0;
    color: var(--c-brand);
}

/* ============================================================ *
 *  Сайдбар + виджеты
 * ============================================================ */
.sidebar {
    min-width: 0;
}

.widget {
    margin-bottom: 30px;
}

.sidebar .widget {
    background: var(--c-soft);
    border: 1px solid var(--c-line);
    border-radius: var(--radius);
    padding: 20px 22px;
    color: var(--c-ink);
}

.sidebar .widget-title {
    font-size: 1.05rem;
    margin: 0 0 14px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--c-brand);
    color: var(--c-ink);
}

.sidebar .widget a {
    color: var(--c-brand-dk);
}

.sidebar .widget ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.sidebar .widget li {
    padding: 8px 0;
    border-bottom: 1px solid var(--c-line);
    color: var(--c-ink);
}

.sidebar .widget li:last-child {
    border-bottom: none;
}

.sidebar .widget .post-date {
    display: block;
    font-size: 0.78rem;
    color: var(--c-muted);
}

/* ============================================================ *
 *  Главная
 * ============================================================ */
.home-section {
    padding: 40px 0;
}

.home-section + .home-section {
    border-top: 1px solid var(--c-line);
}

.section-head {
    max-width: 720px;
    margin-bottom: 28px;
}

.section-kicker {
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--c-brand);
    margin-bottom: 8px;
}

/* Блок 1: текст + иллюстрация */
.split {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 44px;
    align-items: center;
}

.split-media img,
.split-media svg {
    width: 100%;
    border-radius: var(--radius);
    display: block;
}

.split.reverse .split-media {
    order: -1;
}

/* Блок 2: пошаговый */
.steps {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 22px;
    counter-reset: step;
}

.step {
    background: var(--c-soft);
    border-radius: var(--radius);
    padding: 26px 22px;
    position: relative;
}

.step::before {
    counter-increment: step;
    content: counter(step);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: var(--c-brand);
    color: #fff;
    font-weight: 700;
    font-size: 1.1rem;
    margin-bottom: 14px;
}

.step h3 {
    font-size: 1.08rem;
    margin-bottom: 8px;
}

.step p {
    margin: 0;
    color: var(--c-muted);
    font-size: 0.92rem;
}

/* Блок «последние записи» */
.latest-head {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 26px;
}

.latest-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 26px;
}

.latest-link {
    font-weight: 600;
}

/* Блок 3: сетка рубрик/тем */
.topic-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 22px;
}

.topic {
    border: 1px solid var(--c-line);
    border-radius: var(--radius);
    padding: 26px 24px;
    background: var(--c-bg);
}

.topic-ico {
    width: 48px;
    height: 48px;
    border-radius: 10px;
    background: var(--c-soft);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 16px;
}

.topic-ico svg {
    width: 26px;
    height: 26px;
}

.topic h3 {
    margin-bottom: 8px;
}

.topic p {
    margin: 0;
    color: var(--c-muted);
    font-size: 0.94rem;
}

/* Блок 4: CTA на тёмном фоне */
.cta {
    background: linear-gradient(135deg, var(--c-dark) 0%, var(--c-dark-2) 100%);
    border-radius: 18px;
    padding: 48px 44px;
    color: #f4f7fa;
    text-align: center;
}

.cta h2 {
    color: #fff;
}

.cta p {
    color: #c4cdd6;
    max-width: 620px;
    margin: 0 auto 24px;
}

.btn {
    display: inline-block;
    background: var(--c-accent);
    color: #16202b;
    font-weight: 700;
    padding: 13px 30px;
    border-radius: 10px;
    border: none;
    cursor: pointer;
}

.btn:hover {
    background: #d8901f;
    text-decoration: none;
    color: #16202b;
}

.btn-line {
    display: inline-block;
    border: 2px solid var(--c-brand);
    color: var(--c-brand);
    font-weight: 700;
    padding: 11px 26px;
    border-radius: 10px;
}

.btn-line:hover {
    background: var(--c-brand);
    color: #fff;
    text-decoration: none;
}

/* ============================================================ *
 *  Пагинация (D5)
 * ============================================================ */
.pager {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 40px;
    justify-content: center;
}

.pager .page-numbers {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 42px;
    height: 42px;
    padding: 0 14px;
    border: 1px solid var(--c-line);
    border-radius: 8px;
    color: var(--c-ink);
    font-weight: 600;
    background: var(--c-bg);
}

.pager a.page-numbers:hover {
    background: var(--c-soft);
    border-color: var(--c-brand);
    text-decoration: none;
}

.pager .page-numbers.current {
    background: var(--c-brand);
    border-color: var(--c-brand);
    color: #fff;
}

.pager .page-numbers.dots {
    border: none;
    background: none;
}

/* ============================================================ *
 *  Поиск
 * ============================================================ */
.search-form {
    display: flex;
    gap: 8px;
}

.search-form .search-field {
    flex: 1;
    min-width: 0;
    padding: 11px 14px;
    border: 1px solid var(--c-line);
    border-radius: 8px;
    font-size: 0.98rem;
}

.search-form .search-submit {
    padding: 11px 20px;
    background: var(--c-brand);
    color: #fff;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
}

.search-form .search-submit:hover {
    background: var(--c-brand-dk);
}

/* ============================================================ *
 *  Комментарии
 * ============================================================ */
.comments-area {
    margin-top: 48px;
    padding-top: 32px;
    border-top: 1px solid var(--c-line);
}

.comment-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.comment-list .children {
    list-style: none;
    margin: 0 0 0 28px;
    padding: 0;
}

.comment-inner {
    border: 1px solid var(--c-line);
    border-radius: var(--radius);
    padding: 18px 20px;
    margin-bottom: 18px;
}

.comment-head {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 8px;
    flex-wrap: wrap;
    gap: 8px;
}

.comment-author {
    font-weight: 700;
}

.comment-date {
    font-size: 0.8rem;
    color: var(--c-muted);
}

.comment-reply a {
    font-size: 0.86rem;
    font-weight: 600;
}

.comment-form {
    display: grid;
    gap: 14px;
    margin-top: 20px;
}

.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(--c-line);
    border-radius: 8px;
    font-family: inherit;
    font-size: 0.98rem;
}

.comment-form .form-submit input {
    background: var(--c-brand);
    color: #fff;
    border: none;
    padding: 12px 28px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
}

/* ============================================================ *
 *  Подвал (E2)
 * ============================================================ */
.site-footer {
    background: var(--c-dark);
    color: #c4cdd6;
    padding: 50px 0 0;
}

.footer-cols {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 40px;
    padding-bottom: 40px;
}

.footer-col {
    min-width: 0;
}

.site-footer .widget {
    margin-bottom: 0;
    color: #c4cdd6;
}

.site-footer .widget-title {
    color: #fff;
    font-size: 1.05rem;
    margin-bottom: 16px;
}

.site-footer .widget p {
    color: #c4cdd6;
    font-size: 0.92rem;
}

.site-footer .widget a {
    color: #e6edf3;
}

.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;
}

.site-footer .post-date {
    display: block;
    font-size: 0.78rem;
    color: #8b97a3;
}

.footer-bottom {
    border-top: 1px solid #2a3744;
    padding: 20px 0;
    text-align: center;
    font-size: 0.85rem;
    color: #8b97a3;
}

/* ============================================================ *
 *  Cookie-баннер (D6, A11)
 * ============================================================ */
.cookie-banner[hidden] {
    display: none !important;
}

.cookie-banner {
    position: fixed;
    left: 16px;
    right: 16px;
    bottom: 16px;
    z-index: 999;
    background: var(--c-dark);
    color: #e6edf3;
    border-radius: 12px;
    padding: 18px 22px;
    display: flex;
    align-items: center;
    gap: 18px;
    flex-wrap: wrap;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.3);
    max-width: 760px;
    margin-inline: auto;
}

.cookie-banner p {
    margin: 0;
    flex: 1;
    min-width: 220px;
    font-size: 0.9rem;
    color: #c4cdd6;
}

.cookie-banner a {
    color: var(--c-accent);
}

.cookie-banner .btn {
    padding: 10px 24px;
}

/* ============================================================ *
 *  404
 * ============================================================ */
.notfound {
    text-align: center;
    padding: 30px 0;
}

.notfound-code {
    font-size: 5rem;
    font-weight: 800;
    color: var(--c-brand);
    line-height: 1;
    margin-bottom: 10px;
}

.notfound .search-form {
    max-width: 460px;
    margin: 26px auto;
}

/* ============================================================ *
 *  Контактные данные (D7, D8 — без форм и телефона)
 * ============================================================ */
.contact-block {
    background: var(--c-soft);
    border-radius: var(--radius);
    padding: 24px 26px;
    margin: 24px 0;
}

.contact-block a {
    font-weight: 600;
}

.social-links {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 12px;
}

/* ============================================================ *
 *  Адаптив
 * ============================================================ */
@media (max-width: 960px) {
    .layout-with-sidebar {
        grid-template-columns: 1fr;
        gap: 36px;
    }

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

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

    .footer-cols {
        grid-template-columns: 1fr;
        gap: 30px;
    }
}

@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 {
        flex-basis: 100%;
        margin-left: 0;
        display: none;
    }

    .main-nav.is-open {
        display: block;
    }

    .main-nav ul {
        flex-direction: column;
        gap: 2px;
    }

    .split,
    .steps,
    .latest-grid,
    .topic-grid {
        grid-template-columns: 1fr;
    }

    .split.reverse .split-media {
        order: 0;
    }

    .layout-single .content-area {
        width: 100%;
    }

    .cta {
        padding: 34px 24px;
    }

    .cookie-banner {
        flex-direction: column;
        align-items: stretch;
        text-align: center;
    }
}
