/*
Theme Name: dds_joomla5.ru
Author: Алексей Смирнов
Description: Мультитематический практический блог о веб-разработке: уроки по Joomla, WordPress, конструкторам сайтов и основам веб-технологий. Адаптивная информационная тема.
Version: 1.1
Text Domain: webcore
*/

/* ============================ Базовое ============================ */
:root {
    --bg: #f4f6fb;
    --surface: #ffffff;
    --ink: #1d2433;
    --muted: #5c6678;
    --primary: #1f3b73;
    --primary-d: #16284f;
    --accent: #1f9e8c;
    --accent-warm: #ef8a2b;
    --border: #e2e8f2;
    --footer-bg: #15223c;
    --footer-bg2: #101a30;
    --footer-ink: #c6d1e6;
    --footer-head: #ffffff;
    --footer-link: #9fd6cd;
    --radius: 14px;
    --shadow: 0 10px 30px rgba(20, 35, 70, 0.07);
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

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

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

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

h1, h2, h3, h4 { line-height: 1.25; color: var(--primary-d); margin: 0 0 0.5em; }
h1 { font-size: 2rem; }
h2 { font-size: 1.55rem; }
h3 { font-size: 1.2rem; }

p { margin: 0 0 1em; }

/* Глобальный p без фона — фон только на body и блоках */
p { background: none; }

/* ============================ Контейнер ============================ */
.shell {
    width: min(92%, 1180px);
    margin-inline: auto;
}

.site-content { padding: 36px 0 56px; }

/* ============================ Кнопки ============================ */
.btn {
    display: inline-block;
    background: var(--primary);
    color: #fff;
    padding: 12px 24px;
    border-radius: 10px;
    font-weight: 600;
    transition: background .2s ease;
}
.btn:hover { background: var(--primary-d); text-decoration: none; color: #fff; }
.btn-outline {
    background: transparent;
    color: var(--primary);
    border: 2px solid var(--primary);
    padding: 10px 22px;
}
.btn-outline:hover { background: var(--primary); color: #fff; }

/* ============================ Шапка ============================ */
.site-header {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
}
.header-inner {
    display: flex;
    align-items: center;
    gap: 24px;
    padding: 18px 0;
    flex-wrap: wrap;
}
.brand {
    display: flex;
    align-items: center;
    gap: 14px;
    min-width: 0;
    flex: 1;
}
.brand-link { display: inline-flex; flex: 0 0 auto; }
.brand-logo { display: block; width: 48px; height: 48px; }
.brand-logo:not(.brand-logo--mark) { width: auto; max-height: 56px; }
.brand-text { min-width: 0; display: flex; flex-direction: column; }
.brand-name {
    font-weight: 700;
    color: var(--primary-d);
    font-size: 1.05rem;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.brand-desc {
    color: var(--muted);
    font-size: 0.82rem;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Навигация (не липкая) */
.main-nav { flex: 0 0 auto; }
.nav-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}
.nav-list a {
    display: block;
    padding: 9px 14px;
    border-radius: 8px;
    color: var(--ink);
    font-weight: 600;
}
.nav-list a:hover { background: var(--bg); text-decoration: none; color: var(--primary); }
.nav-list .current-menu-item > a { color: var(--primary); background: var(--bg); }
.nav-list .sub-menu {
    list-style: none;
    margin: 6px 0 0;
    padding: 6px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
}

.nav-toggle {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    width: 44px;
    height: 40px;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 8px;
    cursor: pointer;
}
.nav-toggle span {
    display: block;
    height: 2px;
    width: 22px;
    margin: 0 auto;
    background: var(--primary-d);
}

/* ============================ Раскладки ============================ */
.layout-with-sidebar {
    display: grid;
    grid-template-columns: minmax(0, 2.45fr) minmax(0, 1fr);
    gap: 40px;
    align-items: start;
}
.layout-single { display: block; }
.content-area { min-width: 0; }

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

/* ============================ Заголовки страниц ============================ */
.page-head { margin-bottom: 26px; }
.page-title { margin: 0; }
.archive-desc { color: var(--muted); margin-top: 8px; }

/* ============================ Карточки записей ============================ */
.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr));
    gap: 26px;
}
.card {
    display: flex;
    flex-direction: column;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    min-width: 0;
}
.card-thumb-wrap {
    position: relative;
    overflow: hidden;
}
.card-thumb-wrap a { display: block; }
.card-thumb {
    display: block;
    width: 100%;
    height: auto;
    aspect-ratio: 16 / 9;
    object-fit: cover;
}
.card-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 20px 22px 22px;
}
.card-meta { font-size: 0.8rem; color: var(--muted); margin-bottom: 8px; }
.card-title { font-size: 1.2rem; margin: 0 0 10px; }
.card-title a { color: var(--primary-d); }
.card-title a:hover { color: var(--primary); }
.card-excerpt { color: var(--muted); margin-bottom: 14px; }
.card-excerpt p { margin: 0 0 0.5em; background: none; }
.card-more {
    margin-top: auto;
    font-weight: 600;
    color: var(--accent);
}

/* ============================ Запись / страница ============================ */
.post-single, .page-article {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 32px;
    box-shadow: var(--shadow);
}
.post-head { margin-bottom: 18px; }
.post-meta { color: var(--muted); font-size: 0.9rem; }
.post-meta .sep { margin: 0 4px; }
.post-cover { margin: 0 0 24px; border-radius: var(--radius); overflow: hidden; }
.post-cover img { display: block; width: 100%; height: auto; }
.post-content { font-size: 1.02rem; }
.post-content img { border-radius: 10px; }
.post-content h2, .post-content h3 { margin-top: 1.4em; }
.post-tags { margin-top: 26px; display: flex; flex-wrap: wrap; gap: 8px; }
.tag-link {
    background: var(--bg);
    border: 1px solid var(--border);
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
}
.page-links { margin-top: 18px; }

/* Таблицы в контенте */
.post-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.2em 0;
}
.post-content table, .post-content th, .post-content td {
    border: 1px solid var(--border);
}
.post-content th, .post-content td { padding: 10px 12px; text-align: left; }
.post-content th { background: var(--bg); }

/* ============================ Сайдбар (светлый фон → тёмный текст) ============================ */
.sidebar { min-width: 0; }
.sidebar .widget {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 22px;
    margin-bottom: 24px;
    box-shadow: var(--shadow);
    color: var(--ink);
}
.sidebar .widget-title {
    font-size: 1.05rem;
    margin: 0 0 14px;
    color: var(--primary-d);
    padding-bottom: 10px;
    border-bottom: 2px solid var(--accent);
}
.sidebar .widget ul { list-style: none; margin: 0; padding: 0; }
.sidebar .widget li { padding: 8px 0; border-bottom: 1px solid var(--border); }
.sidebar .widget li:last-child { border-bottom: 0; }
.sidebar .widget a { color: var(--primary); }
.sidebar .widget a:hover { color: var(--accent); }
.sidebar .widget,
.sidebar .widget .post-date { color: var(--ink); }
.sidebar .widget .rss-date,
.sidebar .widget .post-date { color: var(--muted); font-size: 0.82rem; }

/* ============================ Главная: блоки ============================ */
.home { display: flex; flex-direction: column; gap: 56px; }
.block { min-width: 0; }
.block-title { font-size: 1.7rem; margin-bottom: 22px; }

/* Блок 1: текст + иллюстрация */
.intro-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
    gap: 44px;
    align-items: center;
}
.intro-media img { display: block; width: 100%; height: auto; }
.intro-text .btn { margin-top: 8px; }

/* Блок 2: сетка карточек */
.topic-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr));
    gap: 22px;
}
.topic-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 26px 22px;
    box-shadow: var(--shadow);
    min-width: 0;
}
.topic-icon {
    display: inline-flex;
    width: 52px; height: 52px;
    align-items: center; justify-content: center;
    border-radius: 12px;
    background: rgba(31, 158, 140, 0.12);
    color: var(--accent);
    margin-bottom: 14px;
}
.topic-icon svg { width: 28px; height: 28px; }
.topic-card h3 { margin-bottom: 8px; }
.topic-card p { color: var(--muted); margin: 0; }

/* Блок «последние записи» */
.latest-more { margin-top: 28px; text-align: center; }

/* Блок 3: шаги */
.steps {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr));
    gap: 22px;
    counter-reset: none;
}
.step {
    display: flex;
    gap: 16px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 22px;
    box-shadow: var(--shadow);
    min-width: 0;
}
.step-num {
    flex: 0 0 auto;
    width: 42px; height: 42px;
    display: inline-flex; align-items: center; justify-content: center;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    font-weight: 700;
}
.step h3 { margin-bottom: 6px; }
.step p { color: var(--muted); margin: 0; }

/* Блок 4: FAQ */
.faq { display: flex; flex-direction: column; gap: 14px; }
.faq details {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 6px 22px;
    box-shadow: var(--shadow);
}
.faq summary {
    cursor: pointer;
    font-weight: 600;
    color: var(--primary-d);
    padding: 14px 0;
    list-style: none;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: '+'; float: right; color: var(--accent); font-size: 1.3rem; line-height: 1; }
.faq details[open] summary::after { content: '–'; }
.faq details p { color: var(--muted); margin: 0 0 16px; }

/* ============================ Пагинация (type => plain → .page-numbers) ============================ */
.pagination {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 36px;
    justify-content: center;
}
.pagination .page-numbers {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 42px;
    height: 42px;
    padding: 0 12px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--surface);
    color: var(--ink);
    font-weight: 600;
}
.pagination a.page-numbers:hover { background: var(--bg); text-decoration: none; color: var(--primary); }
.pagination .page-numbers.current {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}
.pagination .page-numbers.dots {
    border: none;
    background: transparent;
}

/* ============================ Поиск ============================ */
.search-form { display: flex; gap: 8px; max-width: 480px; }
.search-field {
    flex: 1;
    min-width: 0;
    padding: 11px 14px;
    border: 1px solid var(--border);
    border-radius: 10px;
    font-size: 1rem;
}
.search-submit {
    padding: 11px 20px;
    border: none;
    border-radius: 10px;
    background: var(--primary);
    color: #fff;
    font-weight: 600;
    cursor: pointer;
}
.search-submit:hover { background: var(--primary-d); }
.screen-reader-text {
    position: absolute;
    width: 1px; height: 1px;
    overflow: hidden;
    clip: rect(0,0,0,0);
}

/* ============================ Комментарии ============================ */
.comments-area {
    margin-top: 36px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 28px 32px;
    box-shadow: var(--shadow);
}
.comments-title { margin-bottom: 20px; }
.comment-list { list-style: none; margin: 0 0 24px; padding: 0; }
.comment-list ol { list-style: none; }
.comment-item { margin-bottom: 18px; }
.comment-body {
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 16px 18px;
}
.comment-meta { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; }
.comment-author { font-weight: 600; }
.comment-date { color: var(--muted); font-size: 0.82rem; }
.comment-await { color: var(--accent-warm); font-size: 0.85rem; }
.comment-reply { margin-top: 8px; font-size: 0.9rem; }
.comment-form label { display: block; font-weight: 600; margin-bottom: 4px; }
.comment-form input[type="text"],
.comment-form input[type="email"],
.comment-form input[type="url"],
.comment-form textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 1rem;
    margin-bottom: 14px;
}
.comment-form .submit {
    background: var(--primary);
    color: #fff;
    border: none;
    padding: 12px 26px;
    border-radius: 10px;
    font-weight: 600;
    cursor: pointer;
}

/* ============================ 404 ============================ */
.error-404 {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 40px;
    box-shadow: var(--shadow);
    text-align: center;
}
.error-404 .search-form { margin: 22px auto; }

/* ============================ Подвал (тёмный фон → светлый текст) ============================ */
.site-footer { background: var(--footer-bg); color: var(--footer-ink); margin-top: 40px; }
.footer-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr));
    gap: 36px;
    padding: 48px 0 36px;
}
.footer-col { min-width: 0; }
.site-footer .widget { color: var(--footer-ink); margin-bottom: 0; }
.site-footer .widget-title { color: var(--footer-head); font-size: 1.1rem; margin: 0 0 16px; }
.site-footer .widget p { color: var(--footer-ink); }
.site-footer .widget ul { list-style: none; margin: 0; padding: 0; }
.site-footer .widget li { padding: 7px 0; border-bottom: 1px solid rgba(255,255,255,0.08); }
.site-footer .widget li:last-child { border-bottom: 0; }
.site-footer .widget a { color: var(--footer-link); }
.site-footer .widget a:hover { color: #fff; }
.site-footer .post-date,
.site-footer .widget .rss-date { color: #95a3bd; font-size: 0.82rem; }

.footer-bottom { background: var(--footer-bg2); padding: 16px 0; }
.copyright { margin: 0; color: #93a1bb; font-size: 0.85rem; text-align: center; }

/* ============================ Cookie-баннер ============================ */
.cookie-banner[hidden] { display: none !important; }
.cookie-banner {
    position: fixed;
    left: 0; right: 0; bottom: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 18px;
    flex-wrap: wrap;
    padding: 16px 24px;
    background: rgba(16, 26, 48, 0.97);
    color: #e7edf8;
    box-shadow: 0 -6px 24px rgba(0,0,0,0.18);
}
.cookie-text { margin: 0; font-size: 0.9rem; max-width: 760px; }
.cookie-accept {
    background: var(--accent);
    color: #fff;
    border: none;
    padding: 11px 26px;
    border-radius: 10px;
    font-weight: 600;
    cursor: pointer;
    flex: 0 0 auto;
}
.cookie-accept:hover { background: #18897a; }

/* ============================ Адаптив ============================ */
@media (max-width: 960px) {
    .layout-with-sidebar { grid-template-columns: 1fr; }
    .intro-grid { grid-template-columns: 1fr; gap: 28px; }
    h1 { font-size: 1.7rem; }
    .block-title { font-size: 1.45rem; }
}

@media (max-width: 600px) {
    body { font-size: 16px; }
    .nav-toggle { display: flex; order: 3; }
    .main-nav {
        flex-basis: 100%;
        display: none;
    }
    .main-nav.is-open { display: block; }
    .nav-list { flex-direction: column; gap: 4px; }
    .header-inner { gap: 14px; }
    .site-content { padding: 24px 0 40px; }
    .post-single, .page-article, .comments-area { padding: 22px; }
    .cookie-banner { padding: 14px 16px; }
}
