/*
Theme Name: dds_shaggydwarf.com
Author: Алексей Громов
Description: Информационная образовательная тема для shaggydwarf.com — руководства, обучающие треки и интерактивные материалы. Адаптивная вёрстка, без сторонних плагинов.
Version: 1.1
Requires at least: 6.0
Requires PHP: 8.0
Text Domain: sdw
*/

/* ============================================================ *
 *  Переменные и сброс
 * ============================================================ */
:root {
    --ink:        #1d2433;
    --ink-soft:   #4a5468;
    --paper:      #f6f7fb;
    --card:       #ffffff;
    --line:       #e2e6f0;
    --brand:      #3f3d9e;
    --brand-2:    #5b59c9;
    --accent:     #e08a2b;
    --accent-2:   #f4a949;
    --deep:       #191a3a;
    --deep-soft:  #262a55;
    --on-deep:    #eef0fb;
    --on-deep-mut:#aeb4d8;
    --radius:     14px;
    --shell:      1180px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
    margin: 0;
    font-family: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
    color: var(--ink);
    background: var(--paper);
    line-height: 1.62;
    font-size: 17px;
    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.22;
    color: var(--ink);
    margin: 0 0 .5em;
    font-weight: 700;
}
h1 { font-size: clamp(1.8rem, 3.6vw, 2.6rem); }
h2 { font-size: clamp(1.45rem, 2.8vw, 2rem); }
h3 { font-size: 1.25rem; }

p { margin: 0 0 1em; }

/* ============================================================ *
 *  Контейнер ширины — в одном месте
 * ============================================================ */
.shell {
    width: min(92%, var(--shell));
    margin-inline: auto;
}

/* ============================================================ *
 *  Шапка
 * ============================================================ */
.site-header {
    background: var(--card);
    border-bottom: 1px solid var(--line);
}
.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: .85rem;
    min-width: 0;
}
.brand-logo, .brand-mark { flex: 0 0 auto; }
.brand-mark svg { display: block; }
.brand-text { min-width: 0; }
.brand-name {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--ink);
    display: block;
    line-height: 1.3;
    max-width: 42ch;
}
.brand-desc {
    font-size: .82rem;
    color: var(--ink-soft);
    display: block;
    max-width: 52ch;
}

.main-nav { min-width: 0; }
.menu-toggle {
    display: none;
    background: var(--brand);
    color: #fff;
    border: 0;
    border-radius: 9px;
    padding: .55rem .9rem;
    font-size: .95rem;
    cursor: pointer;
}
.main-nav ul {
    list-style: none;
    display: flex;
    gap: .4rem;
    margin: 0;
    padding: 0;
    flex-wrap: wrap;
}
.main-nav a {
    display: block;
    padding: .5rem .85rem;
    border-radius: 9px;
    color: var(--ink-soft);
    font-weight: 600;
    font-size: .96rem;
}
.main-nav a:hover { background: var(--paper); color: var(--brand); text-decoration: none; }
.main-nav .current-menu-item > a { color: var(--brand); background: #eef0fb; }

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

.layout-with-sidebar {
    display: grid;
    grid-template-columns: minmax(0, 67fr) minmax(0, 27fr);
    gap: 2.6rem;
    align-items: start;
}
.layout-single .content-area { width: 85%; margin-inline: auto; }
.content-area { min-width: 0; }

@media (max-width: 960px) {
    .layout-with-sidebar { grid-template-columns: 1fr; gap: 2rem; }
    .layout-single .content-area { width: 100%; }
}

/* ============================================================ *
 *  Хлебные крошки
 * ============================================================ */
.breadcrumbs {
    font-size: .88rem;
    color: var(--ink-soft);
    margin-bottom: 1.5rem;
    display: flex;
    flex-wrap: wrap;
    gap: .35rem;
    align-items: center;
}
.breadcrumbs a { color: var(--brand); }
.breadcrumbs .sep { color: #aab; }

/* ============================================================ *
 *  Карточки записей
 * ============================================================ */
.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 1.6rem;
}
.card {
    display: flex;
    flex-direction: column;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    overflow: hidden;
    transition: transform .15s ease, box-shadow .15s ease;
}
.card:hover { transform: translateY(-3px); box-shadow: 0 12px 30px rgba(25,26,58,.1); }
.card-thumb {
    display: block;
    aspect-ratio: 16 / 9;
    overflow: hidden;
}
.card-thumb img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.card-thumb-fallback {
    display: block;
    width: 100%;
    aspect-ratio: 16 / 9;
    background: linear-gradient(135deg, var(--brand), var(--brand-2));
}
.card-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 1.2rem 1.3rem 1.4rem;
}
.card-title { font-size: 1.18rem; margin: 0 0 .5rem; }
.card-title a { color: var(--ink); }
.card-title a:hover { color: var(--brand); text-decoration: none; }
.card-meta { font-size: .8rem; color: var(--ink-soft); margin-bottom: .65rem; }
.card-excerpt { color: var(--ink-soft); font-size: .95rem; }
.card-excerpt p { margin: 0 0 .5em; background: none; }
.card-more {
    margin-top: auto;
    padding-top: .9rem;
    font-weight: 700;
    color: var(--brand);
}

/* ============================================================ *
 *  Одиночная запись / страница
 * ============================================================ */
.entry {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 2rem 2.2rem 2.4rem;
}
.entry-header { margin-bottom: 1.3rem; }
.entry-meta { font-size: .85rem; color: var(--ink-soft); margin-top: .4rem; }
.entry-thumb { margin: 0 0 1.5rem; border-radius: 10px; overflow: hidden; }
.entry-thumb img { display: block; width: 100%; }
.entry-content { min-width: 0; }
.entry-content img { border-radius: 8px; }
.entry-content h2, .entry-content h3 { margin-top: 1.6em; }
.entry-content ul, .entry-content ol { padding-left: 1.3rem; }

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

.tag-links {
    margin-top: 1.6rem;
    font-size: .9rem;
    color: var(--ink-soft);
}
.tag-links a {
    display: inline-block;
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: 7px;
    padding: .2rem .6rem;
    margin: .2rem .25rem 0 0;
}

/* ============================================================ *
 *  Сайдбар (светлый фон → тёмный текст)
 * ============================================================ */
.sidebar { min-width: 0; }
.sidebar .widget {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 1.3rem 1.4rem;
    margin-bottom: 1.5rem;
}
.sidebar .widget-title {
    font-size: 1.05rem;
    color: var(--ink);
    margin: 0 0 .9rem;
    padding-bottom: .55rem;
    border-bottom: 2px solid var(--accent);
}
.sidebar .widget,
.sidebar .widget p,
.sidebar .widget li,
.sidebar .widget a { color: var(--ink); }
.sidebar .widget a { color: var(--brand); }
.sidebar .widget ul { list-style: none; margin: 0; padding: 0; }
.sidebar .widget li {
    padding: .5rem 0;
    border-bottom: 1px solid var(--line);
    font-size: .95rem;
}
.sidebar .widget li:last-child { border-bottom: 0; }
.sidebar .widget .post-date { color: var(--ink-soft); font-size: .82rem; }

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

/* ============================================================ *
 *  Главная — общие секции
 * ============================================================ */
.home-section { padding: 3rem 0; }
.home-section + .home-section { border-top: 1px solid var(--line); }
.section-head { max-width: 720px; margin-bottom: 1.8rem; }
.section-head .eyebrow {
    text-transform: uppercase;
    letter-spacing: .12em;
    font-size: .78rem;
    font-weight: 700;
    color: var(--accent);
    display: block;
    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: -1; }
.split-media img { display: block; width: 100%; border-radius: var(--radius); }
.split-text p { color: var(--ink-soft); }
.split-text .lead { font-size: 1.15rem; color: var(--ink); }

/* Блок: сетка фич */
.feature-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.4rem;
}
.feature {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 1.6rem 1.5rem;
    min-width: 0;
}
.feature-icon {
    width: 52px; height: 52px;
    display: flex; align-items: center; justify-content: center;
    background: #eef0fb;
    border-radius: 12px;
    margin-bottom: 1rem;
}
.feature-icon svg { display: block; }
.feature h3 { font-size: 1.12rem; margin-bottom: .4rem; }
.feature p { color: var(--ink-soft); font-size: .95rem; margin: 0; }

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

/* Блок: FAQ */
.faq { max-width: 820px; }
.faq-item {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 12px;
    margin-bottom: .85rem;
    overflow: hidden;
}
.faq-item summary {
    cursor: pointer;
    padding: 1.1rem 1.3rem;
    font-weight: 700;
    color: var(--ink);
    list-style: none;
    display: flex;
    justify-content: space-between;
    gap: 1rem;
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after { content: '+'; color: var(--accent); font-size: 1.4rem; line-height: 1; }
.faq-item[open] summary::after { content: '−'; }
.faq-item .faq-body { padding: 0 1.3rem 1.2rem; color: var(--ink-soft); }
.faq-item .faq-body p { margin: 0; }

/* Латест записи на главной */
.latest-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 1rem;
    margin-bottom: 1.8rem;
    flex-wrap: wrap;
}
.latest-head a { font-weight: 700; }

/* ============================================================ *
 *  Подвал (тёмный фон → светлый текст)
 * ============================================================ */
.site-footer {
    background: var(--deep);
    color: var(--on-deep);
    margin-top: 2rem;
}
.footer-cols {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 2rem;
    padding: 3rem 0 2.2rem;
}
.footer-cols .widget { min-width: 0; }
.footer-cols .widget-title {
    color: #fff;
    font-size: 1.05rem;
    margin: 0 0 1rem;
    padding-bottom: .5rem;
    border-bottom: 2px solid var(--accent);
    display: inline-block;
}
.footer-cols .widget,
.footer-cols .widget p,
.footer-cols .widget li,
.footer-cols .widget span { color: var(--on-deep-mut); }
.footer-cols .widget a { color: var(--on-deep); }
.footer-cols .widget a:hover { color: var(--accent-2); text-decoration: none; }
.footer-cols .widget ul { list-style: none; margin: 0; padding: 0; }
.footer-cols .widget li { padding: .4rem 0; border-bottom: 1px solid rgba(255,255,255,.08); }
.footer-cols .widget li:last-child { border-bottom: 0; }
.footer-cols .widget .post-date { color: var(--on-deep-mut); font-size: .8rem; }

.footer-bottom {
    border-top: 1px solid rgba(255,255,255,.1);
    padding: 1.3rem 0;
    font-size: .88rem;
    color: var(--on-deep-mut);
    text-align: center;
}

/* ============================================================ *
 *  Поиск
 * ============================================================ */
.search-form {
    display: flex;
    gap: .5rem;
}
.search-form .search-field {
    flex: 1;
    min-width: 0;
    padding: .65rem .85rem;
    border: 1px solid var(--line);
    border-radius: 10px;
    font-size: .95rem;
    background: #fff;
    color: var(--ink);
}
.search-form .search-submit {
    border: 0;
    background: var(--brand);
    color: #fff;
    border-radius: 10px;
    padding: 0 1.1rem;
    font-weight: 600;
    cursor: pointer;
}
.search-form .search-submit:hover { background: var(--brand-2); }

/* ============================================================ *
 *  Комментарии
 * ============================================================ */
.comments-area {
    margin-top: 2.4rem;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 1.8rem 2rem 2rem;
}
.comment-list { list-style: none; margin: 0; padding: 0; }
.comment-list .children { list-style: none; margin: 0 0 0 1.6rem; padding: 0; }
.comment-item { margin-bottom: 1.3rem; }
.comment-inner {
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 1rem 1.2rem;
}
.comment-meta { display: flex; gap: .8rem; align-items: baseline; flex-wrap: wrap; margin-bottom: .5rem; }
.comment-author { font-weight: 700; }
.comment-date { font-size: .8rem; color: var(--ink-soft); }
.comment-awaiting { color: var(--accent); font-size: .85rem; }
.comment-respond {
    margin-top: 1.8rem;
    border-top: 1px solid var(--line);
    padding-top: 1.5rem;
}
.comment-form input[type="text"],
.comment-form input[type="email"],
.comment-form input[type="url"],
.comment-form textarea {
    width: 100%;
    padding: .65rem .8rem;
    border: 1px solid var(--line);
    border-radius: 9px;
    font-family: inherit;
    font-size: .95rem;
    margin-top: .3rem;
    background: #fff;
    color: var(--ink);
}
.comment-form p { margin-bottom: 1rem; }
.comment-form .submit {
    background: var(--brand);
    color: #fff;
    border: 0;
    border-radius: 10px;
    padding: .7rem 1.4rem;
    font-weight: 600;
    cursor: pointer;
}

/* ============================================================ *
 *  404
 * ============================================================ */
.error-404 {
    text-align: center;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 3rem 2rem;
}
.error-404 .code { font-size: 4.5rem; font-weight: 800; color: var(--brand); line-height: 1; }
.error-404 .search-form { max-width: 440px; margin: 1.6rem auto 0; }

.btn {
    display: inline-block;
    background: var(--brand);
    color: #fff;
    border-radius: 10px;
    padding: .7rem 1.4rem;
    font-weight: 700;
}
.btn:hover { background: var(--brand-2); color: #fff; text-decoration: none; }
.btn-accent { background: var(--accent); }
.btn-accent:hover { background: var(--accent-2); }

/* ============================================================ *
 *  CTA-секция
 * ============================================================ */
.cta {
    background: linear-gradient(135deg, var(--brand), var(--deep-soft));
    border-radius: var(--radius);
    padding: 2.6rem 2.4rem;
    color: #fff;
    text-align: center;
}
.cta h2 { color: #fff; }
.cta p { color: rgba(255,255,255,.85); max-width: 560px; margin: 0 auto 1.4rem; }

/* ============================================================ *
 *  Cookie-баннер
 * ============================================================ */
.cookie-banner[hidden] { display: none !important; }
.cookie-banner {
    position: fixed;
    left: 0; right: 0; bottom: 0;
    z-index: 999;
    background: var(--deep);
    color: var(--on-deep);
    padding: 1rem 0;
    box-shadow: 0 -6px 24px rgba(0,0,0,.18);
}
.cookie-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.2rem;
    flex-wrap: wrap;
}
.cookie-banner p { margin: 0; font-size: .9rem; color: var(--on-deep-mut); }
.cookie-banner a { color: var(--accent-2); }
.cookie-accept {
    background: var(--accent);
    color: #1d1300;
    border: 0;
    border-radius: 10px;
    padding: .6rem 1.4rem;
    font-weight: 700;
    cursor: pointer;
    flex: 0 0 auto;
}
.cookie-accept:hover { background: var(--accent-2); }

/* ============================================================ *
 *  Адаптив
 * ============================================================ */
@media (max-width: 960px) {
    .split { grid-template-columns: 1fr; gap: 1.6rem; }
    .split.reverse .split-media { order: 0; }
}

@media (max-width: 600px) {
    body { font-size: 16px; }
    .menu-toggle { display: block; }
    .main-nav ul {
        display: none;
        flex-direction: column;
        width: 100%;
        margin-top: .6rem;
        gap: .15rem;
    }
    .main-nav.is-open ul { display: flex; }
    .main-nav a { padding: .7rem .85rem; }
    .header-inner { gap: .8rem; }
    .entry { padding: 1.4rem 1.3rem 1.6rem; }
    .home-section { padding: 2.2rem 0; }
    .latest-head { align-items: flex-start; }
}
