/*
Theme Name: dds_r3medias.com
Author: Илья Тарасов
Description: Информационная тема о веб-разработке и продвижении: структура сайта, скорость, контент и аналитика.
Version: 1.1
Requires at least: 6.0
Requires PHP: 8.0
Text Domain: r3m
*/

/* =========================================================================
   Переменные и базовый сброс
   ========================================================================= */
:root {
    --ink:        #17222e;
    --ink-soft:   #47586a;
    --accent:     #1f6feb;
    --accent-dk:  #144a9e;
    --line:       #e0e6ee;
    --bg:         #ffffff;
    --bg-alt:     #f4f7fb;
    --deep:       #14202e;
    --deep-soft:  #223247;
    --radius:     12px;
    --shell:      1180px;
}

* { 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;
}

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

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

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

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

.skip-link {
    position: absolute;
    left: -9999px;
}
.skip-link:focus {
    left: 1rem; top: 1rem;
    z-index: 1000;
    background: var(--accent);
    color: #fff;
    padding: .5rem 1rem;
    border-radius: 6px;
}

/* =========================================================================
   Шапка
   ========================================================================= */
.site-header {
    border-bottom: 1px solid var(--line);
    background: var(--bg);
}
.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.5rem;
    padding: 1rem 0;
    flex-wrap: wrap;
}
.brand {
    display: flex;
    align-items: center;
    gap: .9rem;
    min-width: 0;
}
.brand-logo { display: block; }
.brand-text { min-width: 0; }
.brand-name {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--ink);
    display: block;
    line-height: 1.3;
}
.brand-name a { color: inherit; }
.brand-desc {
    font-size: .82rem;
    color: var(--ink-soft);
    display: block;
    margin-top: .15rem;
}

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

.main-nav ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    gap: 1.4rem;
    flex-wrap: wrap;
}
.main-nav a {
    color: var(--ink);
    font-weight: 500;
    padding: .3rem 0;
    display: inline-block;
}
.main-nav a:hover,
.main-nav .current-menu-item > a {
    color: var(--accent);
    text-decoration: none;
}

/* =========================================================================
   Каркас страницы
   ========================================================================= */
.site-main { padding: 2.5rem 0 3rem; }

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

.breadcrumbs {
    font-size: .86rem;
    color: var(--ink-soft);
    margin-bottom: 1.4rem;
}
.breadcrumbs a { color: var(--ink-soft); }
.breadcrumbs a:hover { color: var(--accent); }
.breadcrumbs .sep { margin: 0 .35rem; color: #aab6c4; }
.breadcrumbs span { color: var(--ink); }

/* =========================================================================
   Карточки записей
   ========================================================================= */
.card-list {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.6rem;
}
.card {
    display: flex;
    flex-direction: row;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    overflow: hidden;
    background: var(--bg);
    transition: box-shadow .18s ease, transform .18s ease;
}
.card:hover {
    box-shadow: 0 10px 28px rgba(20, 32, 46, .09);
    transform: translateY(-2px);
}
.card-thumb-wrap {
    flex: 0 0 240px;
    position: relative;
    overflow: hidden;
    background: var(--bg-alt);
}
.card-thumb-wrap a {
    display: block;
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
}
.card-thumb-wrap img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.card-body {
    flex: 1;
    min-width: 0;
    padding: 1.4rem 1.5rem;
    display: flex;
    flex-direction: column;
}
.card-meta {
    font-size: .8rem;
    color: var(--ink-soft);
    margin-bottom: .5rem;
}
.card-title {
    font-size: 1.2rem;
    margin: 0 0 .5rem;
}
.card-title a { color: var(--ink); }
.card-title a:hover { color: var(--accent); text-decoration: none; }
.card-excerpt {
    color: var(--ink-soft);
    font-size: .95rem;
    flex: 1;
}
.card-excerpt p { margin: 0 0 0.5em; background: none; }
.card-more {
    margin-top: .8rem;
    font-weight: 600;
    align-self: flex-start;
}

/* =========================================================================
   Пагинация
   ========================================================================= */
.pagination {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
    margin-top: 2.4rem;
}
.pagination .page-numbers {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 42px;
    height: 42px;
    padding: 0 .8rem;
    border: 1px solid var(--line);
    border-radius: 8px;
    color: var(--ink);
    font-weight: 500;
}
.pagination a.page-numbers:hover {
    border-color: var(--accent);
    color: var(--accent);
    text-decoration: none;
}
.pagination .page-numbers.current {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}
.pagination .page-numbers.dots {
    border: none;
    background: none;
}

/* =========================================================================
   Одиночная запись / страница
   ========================================================================= */
.entry-header { margin-bottom: 1.4rem; }
.entry-title { font-size: 2rem; margin: 0 0 .5rem; }
.entry-meta {
    font-size: .85rem;
    color: var(--ink-soft);
}
.entry-thumb {
    margin: 0 0 1.6rem;
    border-radius: var(--radius);
    overflow: hidden;
}
.entry-thumb img { width: 100%; display: block; }
.entry-content { font-size: 1.02rem; }
.entry-content img { border-radius: 8px; display: block; }
.entry-content h2 { margin-top: 1.8rem; }
.entry-content h3 { margin-top: 1.4rem; }
.entry-content ul, .entry-content ol { padding-left: 1.3rem; }
.entry-content blockquote {
    margin: 1.6rem 0;
    padding: 1.2rem 1.4rem;
    border-left: 4px solid var(--accent);
    background: var(--bg-alt);
    border-radius: 0 8px 8px 0;
    color: var(--ink);
}
.entry-content blockquote p:last-child { margin-bottom: 0; }

.entry-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.4rem 0;
}
.entry-content th,
.entry-content td {
    border: 1px solid var(--line);
    padding: .6rem .8rem;
    text-align: left;
}
.entry-content th { background: var(--bg-alt); }

.tag-links {
    margin-top: 1.8rem;
    font-size: .88rem;
    color: var(--ink-soft);
}
.tag-links a {
    display: inline-block;
    background: var(--bg-alt);
    padding: .2rem .6rem;
    border-radius: 6px;
    margin: 0 .3rem .3rem 0;
}

/* =========================================================================
   Сайдбар / виджеты
   ========================================================================= */
.sidebar { min-width: 0; }
.widget {
    margin-bottom: 2rem;
    padding: 1.3rem 1.4rem;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--bg);
}
.widget-title {
    font-size: 1.05rem;
    margin: 0 0 .9rem;
    padding-bottom: .5rem;
    border-bottom: 2px solid var(--accent);
    color: var(--ink);
}
.widget ul { list-style: none; margin: 0; padding: 0; }
.widget ul li {
    padding: .45rem 0;
    border-bottom: 1px solid var(--line);
    color: var(--ink);
}
.widget ul li:last-child { border-bottom: none; }
.widget a { color: var(--ink); }
.widget a:hover { color: var(--accent); }
.widget .post-date { color: var(--ink-soft); font-size: .8rem; }

/* =========================================================================
   Главная
   ========================================================================= */
.front-section { padding: 3rem 0; }
.front-section:nth-child(even) { background: var(--bg-alt); }
.section-head { max-width: 720px; margin-bottom: 1.8rem; }
.section-head .eyebrow {
    display: inline-block;
    font-size: .78rem;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--accent);
    font-weight: 700;
    margin-bottom: .5rem;
}
.section-head p { color: var(--ink-soft); margin: 0; }

/* Текст + иллюстрация */
.split {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 2.6rem;
    align-items: center;
}
.split.reverse .split-media { order: 2; }
.split-text p { color: var(--ink-soft); }
.split-text h2 { color: var(--ink); }
.split-media img,
.split-media svg {
    width: 100%;
    display: block;
    border-radius: var(--radius);
}

/* Сетка карточек-тем */
.feature-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 1.4rem;
}
.feature-card {
    padding: 1.6rem 1.4rem;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--bg);
    min-width: 0;
}
.feature-card .ic {
    width: 44px; height: 44px;
    display: flex; align-items: center; justify-content: center;
    background: var(--bg-alt);
    border-radius: 10px;
    color: var(--accent);
    margin-bottom: .9rem;
}
.feature-card h3 { font-size: 1.08rem; margin: 0 0 .4rem; }
.feature-card p { color: var(--ink-soft); font-size: .92rem; margin: 0; }

/* Шаги */
.steps {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1.6rem;
    counter-reset: step;
}
.step {
    position: relative;
    padding: 1.6rem 1.4rem;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--bg);
    min-width: 0;
}
.step .num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px; height: 38px;
    border-radius: 50%;
    background: var(--accent);
    color: #fff;
    font-weight: 700;
    margin-bottom: .8rem;
}
.step h3 { font-size: 1.05rem; margin: 0 0 .4rem; }
.step p { color: var(--ink-soft); font-size: .92rem; margin: 0; }

/* Последние записи на главной */
.latest-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1.6rem;
}
.mini-card {
    display: flex;
    flex-direction: column;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    overflow: hidden;
    background: var(--bg);
    min-width: 0;
}
.mini-thumb {
    aspect-ratio: 16 / 9;
    background: var(--bg-alt);
    overflow: hidden;
}
.mini-thumb img {
    width: 100%; height: 100%;
    object-fit: cover;
    display: block;
}
.mini-body {
    flex: 1;
    padding: 1.2rem 1.3rem;
    display: flex;
    flex-direction: column;
}
.mini-body h3 { font-size: 1.05rem; margin: 0 0 .4rem; }
.mini-body h3 a { color: var(--ink); }
.mini-body h3 a:hover { color: var(--accent); text-decoration: none; }
.mini-excerpt { color: var(--ink-soft); font-size: .9rem; flex: 1; }
.mini-excerpt p { margin: 0 0 .5em; background: none; }
.mini-date { font-size: .78rem; color: var(--ink-soft); margin-bottom: .35rem; }

/* CTA */
.cta {
    background: var(--deep);
    color: #eaf1fb;
    padding: 2.6rem 2.4rem;
    border-radius: var(--radius);
    text-align: center;
}
.cta h2 { color: #fff; }
.cta p { color: #b9c7d8; max-width: 620px; margin: 0 auto 1.4rem; }
.btn {
    display: inline-block;
    background: var(--accent);
    color: #fff;
    padding: .8rem 1.8rem;
    border-radius: 8px;
    font-weight: 600;
}
.btn:hover { background: var(--accent-dk); text-decoration: none; color: #fff; }
.btn-ghost {
    background: transparent;
    border: 1px solid var(--line);
    color: var(--ink);
}
.btn-ghost:hover { background: var(--bg-alt); color: var(--accent); }

/* =========================================================================
   Комментарии
   ========================================================================= */
.comments-area { margin-top: 2.6rem; }
.comments-title { font-size: 1.3rem; margin-bottom: 1.2rem; }
.comment-list { list-style: none; margin: 0; padding: 0; }
.comment-list ul.children { list-style: none; margin: 0 0 0 1.5rem; padding: 0; }
.comment-item { margin-bottom: 1.2rem; }
.comment-inner {
    padding: 1.1rem 1.3rem;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--bg);
}
.comment-meta {
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: .5rem;
    margin-bottom: .5rem;
    font-size: .85rem;
}
.comment-author { font-weight: 600; }
.comment-date { color: var(--ink-soft); }
.comment-await { color: #b8860b; font-size: .85rem; }
.comment-reply a {
    font-size: .85rem;
    font-weight: 600;
}
.comment-respond {
    margin-top: 1.6rem;
    padding: 1.4rem 1.5rem;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--bg-alt);
}
.comment-form input[type="text"],
.comment-form input[type="email"],
.comment-form input[type="url"],
.comment-form textarea {
    width: 100%;
    padding: .6rem .7rem;
    border: 1px solid var(--line);
    border-radius: 8px;
    font-family: inherit;
    font-size: .95rem;
    background: #fff;
}
.comment-form textarea { min-height: 120px; }
.comment-form p { margin-bottom: .9rem; }
.comment-form label { font-size: .88rem; display: block; margin-bottom: .3rem; }
.comment-form .submit,
.form-submit input[type="submit"] {
    background: var(--accent);
    color: #fff;
    border: none;
    padding: .7rem 1.6rem;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    font-size: .95rem;
}
.comment-form .submit:hover { background: var(--accent-dk); }

/* =========================================================================
   Форма поиска
   ========================================================================= */
.search-form {
    display: flex;
    gap: .5rem;
}
.search-form input[type="search"] {
    flex: 1;
    min-width: 0;
    padding: .6rem .8rem;
    border: 1px solid var(--line);
    border-radius: 8px;
    font-size: .95rem;
    font-family: inherit;
}
.search-form button {
    background: var(--accent);
    color: #fff;
    border: none;
    padding: .6rem 1.2rem;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
}
.search-form button:hover { background: var(--accent-dk); }

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

/* =========================================================================
   Подвал
   ========================================================================= */
.site-footer {
    background: var(--deep);
    color: #c7d3e2;
    padding: 3rem 0 1.4rem;
    margin-top: 2rem;
}
.footer-cols {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 2.2rem;
}
.site-footer .widget {
    background: transparent;
    border: none;
    padding: 0;
    margin: 0;
}
.site-footer .widget-title {
    color: #fff;
    border-bottom-color: var(--accent);
}
.site-footer .widget,
.site-footer .widget p,
.site-footer .widget li {
    color: #c7d3e2;
}
.site-footer .widget ul li { border-bottom-color: var(--deep-soft); }
.site-footer .widget a { color: #dbe6f2; }
.site-footer .widget a:hover { color: #fff; }
.site-footer .widget .post-date { color: #8fa3ba; }
.footer-bottom {
    margin-top: 2.4rem;
    padding-top: 1.4rem;
    border-top: 1px solid var(--deep-soft);
    font-size: .85rem;
    color: #8fa3ba;
    text-align: center;
}

/* =========================================================================
   Cookie-баннер
   ========================================================================= */
.cookie-banner[hidden] { display: none !important; }
.cookie-banner {
    position: fixed;
    left: 1rem; right: 1rem; bottom: 1rem;
    max-width: 760px;
    margin-inline: auto;
    background: var(--deep);
    color: #e7eef7;
    padding: 1.1rem 1.3rem;
    border-radius: var(--radius);
    box-shadow: 0 12px 40px rgba(0, 0, 0, .28);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.2rem;
    flex-wrap: wrap;
    z-index: 999;
}
.cookie-banner p { margin: 0; font-size: .9rem; color: #cdd9e7; }
.cookie-banner a { color: #fff; text-decoration: underline; }
.cookie-banner .cookie-accept {
    background: var(--accent);
    color: #fff;
    border: none;
    padding: .6rem 1.4rem;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
}
.cookie-banner .cookie-accept:hover { background: var(--accent-dk); }

/* =========================================================================
   Адаптив
   ========================================================================= */
@media (max-width: 960px) {
    .layout-with-sidebar { grid-template-columns: 1fr; gap: 2.5rem; }
    .feature-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .steps { grid-template-columns: 1fr; }
    .latest-grid { grid-template-columns: 1fr 1fr; }
    .footer-cols { grid-template-columns: 1fr 1fr; }
    .split { gap: 2rem; }
}

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

    .nav-toggle { display: inline-block; }
    .main-nav {
        flex-basis: 100%;
        display: none;
    }
    .main-nav.open { display: block; }
    .main-nav ul { flex-direction: column; gap: .2rem; }
    .main-nav li { border-bottom: 1px solid var(--line); }

    .front-section { padding: 2.2rem 0; }
    .split { grid-template-columns: 1fr; }
    .split.reverse .split-media { order: 0; }
    .feature-grid { grid-template-columns: 1fr; }
    .latest-grid { grid-template-columns: 1fr; }
    .footer-cols { grid-template-columns: 1fr; gap: 1.8rem; }

    .cta { padding: 2rem 1.4rem; }

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