/*
Theme Name: dds_sammutcode.com
Author: Алексей Смирнов
Description: Образовательная тема для сайта о разработке и программировании.
Version: 1.1
Requires at least: 6.0
Requires PHP: 8.0
Text Domain: sammut
*/

/* ===== Базовые переменные ===== */
:root {
    --ink: #1a1f29;
    --ink-soft: #4a5160;
    --paper: #f6f7fb;
    --surface: #ffffff;
    --line: #e3e6ee;
    --accent: #4f46e5;
    --accent-dark: #3a32b8;
    --accent-soft: #eef0fe;
    --code-bg: #161b27;
    --code-ink: #d7dcea;
    --terminal: #34d399;
    --radius: 14px;
    --shell: min(92%, 1180px);
}

/* ===== Сброс / основа ===== */
* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
    margin: 0;
    font-family: "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    color: var(--ink);
    background: var(--paper);
    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 { color: var(--accent-dark); text-decoration: underline; }

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

p { margin: 0 0 1.1em; }

code, pre {
    font-family: "JetBrains Mono", "Fira Code", Consolas, monospace;
}
:not(pre) > code {
    background: var(--accent-soft);
    color: var(--accent-dark);
    padding: 0.1em 0.4em;
    border-radius: 6px;
    font-size: 0.9em;
}
pre {
    background: var(--code-bg);
    color: var(--code-ink);
    padding: 1.1em 1.3em;
    border-radius: var(--radius);
    overflow-x: auto;
    line-height: 1.55;
}

/* ===== Обёртка ширины (один источник, A12.7) ===== */
.shell {
    width: var(--shell);
    margin-inline: auto;
}

/* ===== Шапка ===== */
.site-header {
    background: var(--surface);
    border-bottom: 1px solid var(--line);
}
.site-header .shell {
    display: flex;
    align-items: center;
    gap: 28px;
    padding: 18px 0;
    flex-wrap: wrap;
}
.brand {
    display: flex;
    align-items: center;
    gap: 14px;
    min-width: 0;
    flex: 1 1 320px;
}
.brand-logo, .brand-figure { flex: 0 0 auto; display: block; }
.brand-figure svg { display: block; }
.brand-text { min-width: 0; }
.brand-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--ink);
    display: block;
    line-height: 1.3;
}
.brand-title a { color: inherit; }
.brand-title a:hover { color: var(--accent); text-decoration: none; }
.brand-desc {
    font-size: 0.82rem;
    color: var(--ink-soft);
    margin: 4px 0 0;
    display: block;
}

.main-nav { flex: 0 0 auto; }
.main-nav ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}
.main-nav a {
    display: block;
    padding: 8px 14px;
    border-radius: 9px;
    color: var(--ink);
    font-weight: 600;
    font-size: 0.95rem;
}
.main-nav a:hover {
    background: var(--accent-soft);
    color: var(--accent-dark);
    text-decoration: none;
}
.main-nav .current-menu-item > a {
    background: var(--accent);
    color: #fff;
}

.nav-toggle {
    display: none;
    background: var(--accent-soft);
    color: var(--accent-dark);
    border: 0;
    border-radius: 9px;
    padding: 9px 14px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
}

/* ===== Хлебные крошки ===== */
.breadcrumbs {
    width: var(--shell);
    margin: 18px auto 0;
    font-size: 0.85rem;
    color: var(--ink-soft);
}
.breadcrumbs a { color: var(--accent); }
.breadcrumbs .sep { margin: 0 6px; color: #aeb4c4; }

/* ===== Раскладки ===== */
.site-main { padding: 30px 0 50px; }

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

/* ===== Сайдбар ===== */
.sidebar {
    min-width: 0;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 22px;
}
.sidebar .widget { margin-bottom: 26px; }
.sidebar .widget:last-child { margin-bottom: 0; }
.sidebar .widget-title {
    font-size: 1.05rem;
    margin: 0 0 14px;
    color: var(--ink);
    padding-bottom: 8px;
    border-bottom: 2px solid var(--accent);
    display: inline-block;
}
.sidebar ul { list-style: none; margin: 0; padding: 0; }
.sidebar li { margin: 0 0 10px; }
.sidebar a { color: var(--ink); }
.sidebar a:hover { color: var(--accent); }
.sidebar .post-date { display: block; font-size: 0.78rem; color: var(--ink-soft); }

/* ===== Карточки записей ===== */
.card-list {
    display: grid;
    grid-template-columns: 1fr;
    gap: 22px;
}
.card {
    display: flex;
    flex-direction: column;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    overflow: hidden;
    transition: box-shadow .18s ease, transform .18s ease;
}
.card:hover { box-shadow: 0 12px 30px rgba(26,31,41,.10); transform: translateY(-2px); }

.card-row { flex-direction: row; }
.card-thumb-wrap {
    flex: 0 0 280px;
    position: relative;
    overflow: hidden;
}
.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-thumb-plain { display: block; }
.card-thumb-plain img {
    width: 100%;
    aspect-ratio: 16 / 9;
    object-fit: cover;
    display: block;
}
.card-body {
    flex: 1;
    min-width: 0;
    padding: 22px 24px;
    display: flex;
    flex-direction: column;
}
.card-title { font-size: 1.25rem; margin: 0 0 8px; }
.card-title a { color: var(--ink); }
.card-title a:hover { color: var(--accent); text-decoration: none; }
.card-meta {
    font-size: 0.8rem;
    color: var(--ink-soft);
    margin: 0 0 12px;
}
.card-excerpt { color: var(--ink-soft); }
.card-excerpt p { margin: 0 0 0.5em; background: none; }
.card-more {
    margin-top: auto;
    align-self: flex-start;
    padding-top: 12px;
    font-weight: 600;
    color: var(--accent);
}
.card-more:hover { color: var(--accent-dark); }

/* ===== Запись / страница ===== */
.entry {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 32px 36px;
}
.entry-title { font-size: 2rem; }
.entry-meta { font-size: 0.85rem; color: var(--ink-soft); margin-bottom: 22px; }
.entry-thumb { border-radius: var(--radius); overflow: hidden; margin-bottom: 24px; }
.entry-thumb img { width: 100%; display: block; }
.entry-content img { border-radius: 10px; display: block; }
.entry-content h2 { margin-top: 1.4em; }
.entry-content ul, .entry-content ol { padding-left: 1.3em; }
.entry-content blockquote {
    margin: 1.4em 0;
    padding: 14px 22px;
    border-left: 4px solid var(--accent);
    background: var(--accent-soft);
    border-radius: 0 10px 10px 0;
    color: var(--ink);
}

table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.4em 0;
}
table, th, td { border: 1px solid var(--line); }
th, td { padding: 10px 12px; text-align: left; }
th { background: var(--accent-soft); }

/* ===== Пагинация (type=plain → .page-numbers) ===== */
.pagination {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 34px;
    justify-content: center;
}
.pagination .page-numbers {
    display: inline-block;
    min-width: 42px;
    text-align: center;
    padding: 9px 14px;
    border: 1px solid var(--line);
    border-radius: 9px;
    background: var(--surface);
    color: var(--ink);
    font-weight: 600;
}
.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: 0;
    background: none;
}

/* ===== Главная ===== */
.home-wrap { width: 85%; margin-inline: auto; }
.section { margin: 0 0 56px; }
.section-head { margin-bottom: 26px; }
.section-head h2 { margin-bottom: 6px; }
.section-head .lead { color: var(--ink-soft); margin: 0; max-width: 60ch; }

/* Блок 1: текст + иллюстрация */
.split {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 44px;
    align-items: center;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 20px;
    padding: 40px;
}
.split.reverse .split-media { order: -1; }
.split-media img { width: 100%; display: block; border-radius: 14px; }
.split-text h2 { margin-top: 0; }

/* Блок 2: сетка карточек-направлений */
.feature-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 22px;
}
.feature {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 26px;
    min-width: 0;
}
.feature-ico {
    width: 52px; height: 52px;
    display: flex; align-items: center; justify-content: center;
    border-radius: 12px;
    background: var(--accent-soft);
    margin-bottom: 16px;
}
.feature-ico svg { width: 28px; height: 28px; }
.feature h3 { margin: 0 0 8px; font-size: 1.15rem; }
.feature p { margin: 0; color: var(--ink-soft); font-size: 0.95rem; }

/* Блок «последние записи» на главной */
.home-posts {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 22px;
}

/* Блок 3: пошаговый */
.steps {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 20px;
    counter-reset: step;
}
.step {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 24px;
    position: relative;
    min-width: 0;
}
.step::before {
    counter-increment: step;
    content: counter(step);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px; height: 40px;
    border-radius: 50%;
    background: var(--accent);
    color: #fff;
    font-weight: 700;
    margin-bottom: 14px;
}
.step h3 { font-size: 1.08rem; margin: 0 0 6px; }
.step p { margin: 0; color: var(--ink-soft); font-size: 0.93rem; }

/* Блок 4: FAQ */
.faq { display: flex; flex-direction: column; gap: 12px; }
.faq details {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 4px 22px;
}
.faq summary {
    cursor: pointer;
    font-weight: 600;
    padding: 16px 0;
    list-style: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after {
    content: "+";
    font-size: 1.4rem;
    color: var(--accent);
    line-height: 1;
}
.faq details[open] summary::after { content: "–"; }
.faq details > p {
    margin: 0 0 16px;
    color: var(--ink-soft);
}

/* ===== Поиск ===== */
.search-form { display: flex; gap: 8px; }
.search-form input[type="search"] {
    flex: 1;
    min-width: 0;
    padding: 10px 14px;
    border: 1px solid var(--line);
    border-radius: 9px;
    font-size: 0.95rem;
}
.search-form button {
    padding: 10px 18px;
    border: 0;
    border-radius: 9px;
    background: var(--accent);
    color: #fff;
    font-weight: 600;
    cursor: pointer;
}
.search-form button:hover { background: var(--accent-dark); }

/* ===== Комментарии ===== */
.comments-area { margin-top: 36px; }
.comment-list { list-style: none; padding: 0; }
.comment-list .comment { margin-bottom: 22px; }
.comment-body {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 18px 22px;
}
.comment-author { font-weight: 600; }
.comment-metadata { font-size: 0.78rem; color: var(--ink-soft); }
.comment-form input[type="text"],
.comment-form input[type="email"],
.comment-form input[type="url"],
.comment-form textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--line);
    border-radius: 9px;
    margin-top: 6px;
    font-family: inherit;
    font-size: 0.95rem;
}
.comment-form p { margin-bottom: 14px; }
.comment-form .submit {
    background: var(--accent);
    color: #fff;
    border: 0;
    border-radius: 9px;
    padding: 11px 22px;
    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(--accent);
    line-height: 1;
}
.error-404 .search-form { max-width: 460px; margin: 24px auto 0; }

/* ===== Подвал ===== */
.site-footer {
    background: var(--code-bg);
    color: #c2c8d8;
    margin-top: 40px;
}
.footer-cols {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 36px;
    padding: 48px 0 36px;
}
.footer-col { min-width: 0; }
.footer-col .widget-title {
    color: #fff;
    font-size: 1.05rem;
    margin: 0 0 16px;
}
.footer-col, .footer-col p, .footer-col li { color: #c2c8d8; }
.footer-col a { color: #aeb8ff; }
.footer-col a:hover { color: #fff; }
.footer-col ul { list-style: none; margin: 0; padding: 0; }
.footer-col li { margin: 0 0 10px; }
.footer-col .post-date { display: block; font-size: 0.78rem; color: #8b93a8; }
.footer-contacts a { word-break: break-word; }
.footer-social { display: flex; gap: 14px; margin-top: 12px; }
.footer-social a { color: #aeb8ff; }

.site-copy {
    border-top: 1px solid rgba(255,255,255,.08);
    padding: 20px 0;
    font-size: 0.85rem;
    color: #8b93a8;
}

/* ===== Cookie-баннер ===== */
.cookie-banner[hidden] { display: none !important; }
.cookie-banner {
    position: fixed;
    left: 16px; right: 16px; bottom: 16px;
    z-index: 999;
    background: var(--ink);
    color: #f1f3fa;
    border-radius: var(--radius);
    padding: 16px 20px;
    display: flex;
    align-items: center;
    gap: 18px;
    flex-wrap: wrap;
    box-shadow: 0 14px 40px rgba(0,0,0,.3);
}
.cookie-banner p { margin: 0; flex: 1; min-width: 220px; font-size: 0.9rem; }
.cookie-banner a { color: #aeb8ff; }
.cookie-accept {
    background: var(--accent);
    color: #fff;
    border: 0;
    border-radius: 9px;
    padding: 10px 22px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
}
.cookie-accept:hover { background: var(--accent-dark); }

/* ===== Адаптив ===== */
@media (max-width: 960px) {
    .layout-with-sidebar { grid-template-columns: 1fr; }
    .feature-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .steps { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .home-posts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .split { grid-template-columns: 1fr; padding: 30px; }
    .split.reverse .split-media { order: 0; }
}

@media (max-width: 600px) {
    body { font-size: 16px; }
    h1 { font-size: 1.7rem; }
    h2 { font-size: 1.45rem; }
    .main-nav { display: none; flex-basis: 100%; }
    .main-nav.open { display: block; }
    .main-nav ul { flex-direction: column; }
    .nav-toggle { display: block; }
    .feature-grid, .steps, .home-posts { grid-template-columns: 1fr; }
    .home-wrap, .layout-single { width: 92%; }
    .layout-single { width: 92%; }
    .entry { padding: 24px 20px; }

    .card-row { 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;
    }
}
