/*
Theme Name: dds_lovessfat.ru
Theme URI: https://lovessfat.ru/
Author: Светлана Фатеева
Author URI: https://lovessfat.ru/
Description: Научно-популярный портал, объединяющий экспертные статьи, обзоры исследований и практические руководства по социальной психологии, кросс-культурной коммуникации и цифровой безопасности.
Version: 1.1
Requires at least: 6.0
Tested up to: 6.5
Requires PHP: 8.0
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: lovessfat
*/

/* ---------- Базовые переменные и сброс ---------- */
:root {
    --color-deep:    #0B2B44;
    --color-paper:   #F4F2ED;
    --color-bg:      #FFFFFF;
    --color-terra:   #C45C4A;
    --color-gold:    #C9A87C;
    --color-text:    #1C2A33;
    --color-muted:   #56646E;
    --color-line:    #E2DED5;
    --shell-w:       1180px;

    --font-head: 'IBM Plex Serif', Georgia, 'Times New Roman', serif;
    --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-mono: 'JetBrains Mono', 'Courier New', monospace;
}

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

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

body {
    margin: 0;
    font-family: var(--font-body);
    font-size: 18px;
    line-height: 1.6;
    color: var(--color-text);
    background: var(--color-bg);
    overflow-x: hidden;
}

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

a {
    color: var(--color-terra);
    text-decoration: none;
    border-bottom: 1px solid transparent;
    transition: border-color .15s ease, color .15s ease;
}
a:hover { border-bottom-color: var(--color-terra); }

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-head);
    font-weight: 600;
    color: var(--color-deep);
    line-height: 1.25;
    margin: 1.4em 0 .6em;
}
h1 { font-size: 2.1rem; }
h2 { font-size: 1.65rem; }
h3 { font-size: 1.3rem; }
h4 { font-size: 1.1rem; }

p { margin: 0 0 1em; }

code, pre, kbd, tt, samp {
    font-family: var(--font-mono);
    font-size: .95em;
    background: var(--color-paper);
    padding: .15em .35em;
    border-radius: 3px;
    color: var(--color-deep);
}
pre {
    padding: 1em;
    overflow-x: auto;
    border-left: 3px solid var(--color-gold);
}
pre code { background: transparent; padding: 0; }

blockquote {
    margin: 1.4em 0;
    padding: .8em 1.2em;
    border-left: 3px solid var(--color-gold);
    background: var(--color-paper);
    color: var(--color-deep);
    font-style: italic;
}
blockquote p:last-child { margin-bottom: 0; }

table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.4em 0;
    border: 1px solid var(--color-line);
}
th, td {
    border: 1px solid var(--color-line);
    padding: .55em .8em;
    text-align: left;
    vertical-align: top;
}
th {
    background: var(--color-paper);
    font-family: var(--font-head);
    color: var(--color-deep);
}

ul, ol { padding-left: 1.4em; margin: 0 0 1em; }
li { margin-bottom: .35em; }

hr {
    border: 0;
    border-top: 1px solid var(--color-line);
    margin: 2em 0;
}

::selection { background: var(--color-gold); color: var(--color-deep); }

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

.skip-link {
    position: absolute;
    left: -9999px;
    top: auto;
    width: 1px;
    height: 1px;
    overflow: hidden;
}
.skip-link:focus {
    left: 6px;
    top: 6px;
    width: auto;
    height: auto;
    padding: .5em 1em;
    background: var(--color-deep);
    color: #fff;
    z-index: 9999;
}

/* ---------- Шапка ---------- */
.site-head {
    background: var(--color-bg);
    border-bottom: 1px solid var(--color-line);
    padding: 1.2em 0;
}
.site-head .shell {
    display: flex;
    align-items: center;
    gap: 1.5em;
    min-width: 0;
}
.brand {
    display: flex;
    align-items: center;
    gap: .9em;
    border: none;
    flex: 0 0 auto;
}
.brand:hover { border: none; }
.brand-logo {
    width: 52px;
    height: 52px;
    flex: 0 0 52px;
    display: block;
}
.brand-text {
    display: flex;
    flex-direction: column;
    min-width: 0;
}
.brand-title {
    font-family: var(--font-head);
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--color-deep);
    line-height: 1.25;
    margin: 0;
    /* Сайт — научно-популярный, длинное название обрезаем визуально */
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    max-width: 360px;
}
.brand-tagline {
    font-size: .82rem;
    color: var(--color-muted);
    line-height: 1.3;
    margin-top: .15em;
    max-width: 360px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ---------- Навигация ---------- */
.head-nav {
    margin-left: auto;
    min-width: 0;
}
.head-nav ul {
    list-style: none;
    display: flex;
    gap: 1.6em;
    margin: 0;
    padding: 0;
}
.head-nav a {
    color: var(--color-deep);
    font-weight: 500;
    border-bottom: none;
    padding: .25em 0;
    position: relative;
}
.head-nav a::after {
    content: '';
    position: absolute;
    left: 0; right: 0;
    bottom: -2px;
    height: 2px;
    background: var(--color-terra);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform .2s ease;
}
.head-nav a:hover::after,
.head-nav .current-menu-item > a::after {
    transform: scaleX(1);
}

/* Гамбургер для мобилки */
.nav-toggle {
    display: none;
    background: transparent;
    border: 1px solid var(--color-deep);
    color: var(--color-deep);
    width: 42px;
    height: 42px;
    border-radius: 4px;
    cursor: pointer;
    font-family: var(--font-head);
    font-weight: 600;
    font-size: 1.1rem;
    margin-left: auto;
    align-items: center;
    justify-content: center;
}
.nav-toggle:hover { background: var(--color-deep); color: #fff; }
.nav-toggle[hidden] { display: none !important; }

/* ---------- Хлебные крошки ---------- */
.breadcrumbs {
    font-size: .88rem;
    color: var(--color-muted);
    padding: 1em 0;
    border-bottom: 1px solid var(--color-line);
}
.breadcrumbs a {
    color: var(--color-muted);
    border-bottom: none;
}
.breadcrumbs a:hover { color: var(--color-terra); }
.breadcrumbs .sep { margin: 0 .35em; color: var(--color-gold); }
.breadcrumbs span { color: var(--color-deep); }

/* ---------- Раскладка основной зоны ---------- */
.page-wrap { padding: 2em 0 3em; }

/* С сайдбаром: контент 67%, сайдбар 27% */
.layout-with-aside {
    display: grid;
    grid-template-columns: minmax(0, 67fr) minmax(0, 27fr);
    gap: 6%;
}
.layout-with-aside .main-content { min-width: 0; }

/* Без сайдбара: контент 85% */
.layout-no-aside .main-content {
    width: 85%;
    margin-inline: auto;
    min-width: 0;
}

/* ---------- Карточки записей ---------- */
.cards { margin: 0; padding: 0; list-style: none; }

.card {
    display: flex;
    flex-direction: column;
    background: var(--color-bg);
    border: 1px solid var(--color-line);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 1.5em;
    min-width: 0;
}

/* Горизонтальная карточка: миниатюра слева, текст справа */
.card-row {
    flex-direction: row;
    align-items: stretch;
}

.card-thumb-wrap {
    flex: 0 0 280px;
    position: relative;
    overflow: hidden;
    background: var(--color-paper);
}
.card-thumb-wrap a {
    display: block;
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    border: none;
}
.card-thumb-wrap a:hover { border: none; }
.card-thumb-wrap img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.card-body {
    flex: 1;
    padding: 1.4em 1.6em;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

/* Маркер категории — цветная линия слева от заголовка */
.card-title {
    font-family: var(--font-head);
    font-size: 1.25rem;
    line-height: 1.3;
    margin: 0 0 .5em;
    padding-left: 14px;
    border-left: 4px solid var(--color-deep);
}
.card-title a {
    color: var(--color-deep);
    border-bottom: none;
}
.card-title a:hover { color: var(--color-terra); }

/* Цветовая дифференциация по рубрикам */
.cat-social-psychology   .card-title { border-left-color: var(--color-terra); }
.cat-cross-cultural      .card-title { border-left-color: var(--color-gold); }
.cat-digital-security    .card-title { border-left-color: var(--color-deep); }

.card-meta {
    font-size: .82rem;
    color: var(--color-muted);
    font-family: var(--font-mono);
    margin-bottom: .8em;
}
.card-meta .sep { margin: 0 .4em; opacity: .5; }

.card-excerpt {
    color: var(--color-text);
    margin-bottom: 1em;
    flex: 1;
}
.card-excerpt p {
    margin: 0 0 .5em;
    background: none;
}

.card-more {
    align-self: flex-start;
    font-weight: 500;
    color: var(--color-terra);
    font-size: .92rem;
    border-bottom: 1px solid var(--color-terra);
    padding-bottom: 2px;
}
.card-more:hover { color: var(--color-deep); border-bottom-color: var(--color-deep); }

/* ---------- Сайдбар ---------- */
.aside {
    min-width: 0;
}
.widget {
    background: var(--color-paper);
    padding: 1.2em 1.3em;
    margin-bottom: 1.5em;
    border-left: 3px solid var(--color-gold);
}
.widget-title {
    font-family: var(--font-head);
    font-size: 1.05rem;
    margin: 0 0 .8em;
    color: var(--color-deep);
}
.widget ul { list-style: none; padding: 0; margin: 0; }
.widget li {
    padding: .45em 0;
    border-bottom: 1px solid var(--color-line);
    color: var(--color-text);
}
.widget li:last-child { border-bottom: none; }
.widget a {
    color: var(--color-deep);
    border-bottom: none;
}
.widget a:hover { color: var(--color-terra); }
.widget .post-date,
.widget .rss-date {
    display: block;
    font-family: var(--font-mono);
    font-size: .78rem;
    color: var(--color-muted);
    margin-top: .2em;
}

/* ---------- Одиночная запись / страница ---------- */
.entry {
    background: transparent;
}
.entry-title {
    font-size: 2.2rem;
    margin: 0 0 .4em;
    color: var(--color-deep);
}
.entry-meta {
    font-family: var(--font-mono);
    font-size: .85rem;
    color: var(--color-muted);
    margin-bottom: 1.5em;
    padding-bottom: 1em;
    border-bottom: 1px solid var(--color-line);
}
.entry-meta .sep { margin: 0 .5em; opacity: .5; }

.entry-thumb {
    margin: 0 0 1.5em;
}
.entry-thumb img {
    width: 100%;
    height: auto;
    display: block;
    border-radius: 4px;
}

.entry-content > * { max-width: 100%; }
.entry-content h2 { margin-top: 1.6em; }
.entry-content h3 { margin-top: 1.4em; }
.entry-content img { border-radius: 4px; }

.entry-footer {
    margin-top: 2em;
    padding-top: 1.2em;
    border-top: 1px solid var(--color-line);
    font-size: .9rem;
    color: var(--color-muted);
}
.entry-footer a { color: var(--color-deep); }

/* ---------- Тематические блоки на главной ---------- */
.topic-block {
    padding: 2.5em 2em;
    background: var(--color-paper);
    margin: 2em 0;
    border-left: 4px solid var(--color-gold);
}
.topic-block:nth-of-type(even) {
    border-left-color: var(--color-terra);
}
.topic-block h2 {
    margin-top: 0;
    font-size: 1.5rem;
}
.topic-block .topic-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.5em;
    margin-top: 1.5em;
}
.topic-block .topic-item {
    background: var(--color-bg);
    padding: 1.2em;
    border-top: 3px solid var(--color-deep);
    min-width: 0;
}
.topic-block .topic-item h3 {
    margin-top: 0;
    font-size: 1.05rem;
}
.topic-block .topic-item p:last-child { margin-bottom: 0; }

.front-feed {
    margin: 2.5em 0;
}
.front-feed h2 {
    border-bottom: 1px solid var(--color-line);
    padding-bottom: .4em;
    margin-bottom: 1em;
}

/* ---------- Пагинация ---------- */
.pagination {
    margin: 2em 0 1em;
    text-align: center;
}
.pagination .page-numbers {
    display: inline-block;
    padding: .5em .85em;
    margin: 0 .15em;
    border: 1px solid var(--color-line);
    color: var(--color-deep);
    border-bottom: 1px solid var(--color-line);
    font-family: var(--font-mono);
    font-size: .9rem;
    border-radius: 3px;
}
.pagination .page-numbers:hover {
    background: var(--color-deep);
    color: #fff;
    border-color: var(--color-deep);
}
.pagination .current {
    background: var(--color-terra);
    color: #fff;
    border-color: var(--color-terra);
}

/* ---------- Подвал ---------- */
.site-foot {
    background: var(--color-deep);
    color: #DCE3EA;
    padding: 2.5em 0 1.5em;
    margin-top: 3em;
    font-size: .94rem;
}
.foot-cols {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 2em;
    margin-bottom: 1.5em;
}
.foot-col { min-width: 0; }

/* Виджеты в футере — светлый текст на тёмном фоне */
.site-foot .widget {
    background: transparent;
    padding: 0;
    border-left: none;
    margin-bottom: 0;
    color: #DCE3EA;
}
.site-foot .widget-title {
    color: #fff;
    font-size: 1rem;
    margin-bottom: .9em;
    padding-bottom: .5em;
    border-bottom: 1px solid rgba(255,255,255,.15);
}
.site-foot .widget li {
    border-bottom-color: rgba(255,255,255,.08);
    color: #DCE3EA;
}
.site-foot .widget a {
    color: #DCE3EA;
    border-bottom: none;
}
.site-foot .widget a:hover { color: var(--color-gold); }
.site-foot .widget .post-date,
.site-foot .widget .rss-date {
    color: #8FA0B0;
}

.foot-copy {
    text-align: center;
    padding-top: 1.5em;
    border-top: 1px solid rgba(255,255,255,.12);
    color: #8FA0B0;
    font-family: var(--font-mono);
    font-size: .82rem;
}

/* ---------- Форма поиска ---------- */
.search-form {
    display: flex;
    gap: .5em;
    margin: 1em 0;
}
.search-form .search-field {
    flex: 1;
    padding: .6em .8em;
    border: 1px solid var(--color-line);
    border-radius: 3px;
    font-family: var(--font-body);
    font-size: .95rem;
    min-width: 0;
}
.search-form .search-field:focus {
    outline: none;
    border-color: var(--color-deep);
}
.search-form .search-submit {
    padding: .6em 1.2em;
    background: transparent;
    border: 1px solid var(--color-deep);
    color: var(--color-deep);
    cursor: pointer;
    border-radius: 4px;
    font-family: var(--font-head);
    font-weight: 500;
    transition: background .15s, color .15s;
}
.search-form .search-submit:hover {
    background: var(--color-terra);
    border-color: var(--color-terra);
    color: #fff;
}

/* ---------- Комментарии ---------- */
.comments-area {
    margin-top: 2.5em;
    padding-top: 1.5em;
    border-top: 1px solid var(--color-line);
}
.comments-title {
    font-size: 1.3rem;
    margin-bottom: 1em;
}
.comment-list {
    list-style: none;
    padding: 0;
    margin: 0 0 2em;
}
.comment-list li {
    padding: 1em 0;
    border-bottom: 1px solid var(--color-line);
}
.comment-list .children {
    list-style: none;
    padding-left: 1.5em;
    margin-top: .8em;
    border-left: 2px solid var(--color-line);
}
.comment-author {
    font-family: var(--font-head);
    font-weight: 600;
    color: var(--color-deep);
}
.comment-meta {
    font-size: .82rem;
    color: var(--color-muted);
    font-family: var(--font-mono);
    margin-bottom: .5em;
}
.comment-content p:last-child { margin-bottom: .3em; }

.comment-form {
    background: var(--color-paper);
    padding: 1.5em;
    border-left: 3px solid var(--color-gold);
}
.comment-form p { margin-bottom: 1em; }
.comment-form label {
    display: block;
    font-weight: 500;
    margin-bottom: .3em;
    color: var(--color-deep);
}
.comment-form input[type="text"],
.comment-form input[type="email"],
.comment-form input[type="url"],
.comment-form textarea {
    width: 100%;
    padding: .55em .8em;
    border: 1px solid var(--color-line);
    border-radius: 3px;
    font-family: var(--font-body);
    font-size: .95rem;
    background: #fff;
}
.comment-form input:focus,
.comment-form textarea:focus {
    outline: none;
    border-color: var(--color-deep);
}
.comment-form .submit {
    padding: .65em 1.4em;
    background: transparent;
    border: 1px solid var(--color-terra);
    color: var(--color-terra);
    cursor: pointer;
    border-radius: 4px;
    font-family: var(--font-head);
    font-weight: 500;
    font-size: .95rem;
    transition: background .15s, color .15s;
}
.comment-form .submit:hover {
    background: var(--color-terra);
    color: #fff;
}

/* ---------- 404 ---------- */
.notfound {
    text-align: center;
    padding: 3em 0;
}
.notfound h1 {
    font-size: 4rem;
    color: var(--color-gold);
    margin-bottom: .3em;
}
.notfound p { font-size: 1.1rem; color: var(--color-muted); }

/* ---------- Cookie-баннер ---------- */
.cookie-banner[hidden] { display: none !important; }

.cookie-banner {
    position: fixed;
    left: 1em;
    right: 1em;
    bottom: 1em;
    background: var(--color-deep);
    color: #fff;
    padding: 1em 1.3em;
    border-radius: 4px;
    box-shadow: 0 4px 24px rgba(0,0,0,.18);
    z-index: 1000;
    display: flex;
    align-items: center;
    gap: 1.2em;
    font-size: .92rem;
    max-width: 720px;
    margin-inline: auto;
}
.cookie-banner p {
    margin: 0;
    flex: 1;
    min-width: 0;
}
.cookie-banner a {
    color: var(--color-gold);
    border-bottom: 1px solid var(--color-gold);
}
.cookie-banner button {
    padding: .55em 1.2em;
    background: transparent;
    border: 1px solid var(--color-gold);
    color: var(--color-gold);
    cursor: pointer;
    border-radius: 4px;
    font-family: var(--font-head);
    font-size: .9rem;
    flex: 0 0 auto;
    transition: background .15s, color .15s;
}
.cookie-banner button:hover {
    background: var(--color-gold);
    color: var(--color-deep);
}

/* ---------- Адаптив ---------- */
@media (max-width: 960px) {
    .layout-with-aside {
        grid-template-columns: 1fr;
        gap: 2em;
    }
    .layout-no-aside .main-content { width: 100%; }
    .foot-cols {
        grid-template-columns: 1fr 1fr;
    }
    .brand-title { font-size: 1.05rem; }
    .head-nav ul { gap: 1.1em; }
    .head-nav a { font-size: .95rem; }
}

@media (max-width: 600px) {
    body { font-size: 17px; }
    h1 { font-size: 1.7rem; }
    h2 { font-size: 1.35rem; }
    h3 { font-size: 1.15rem; }
    .entry-title { font-size: 1.55rem; }

    .site-head .shell { flex-wrap: wrap; }
    .nav-toggle { display: flex; }
    .head-nav {
        order: 3;
        width: 100%;
        margin-left: 0;
        display: none;
    }
    .head-nav.is-open { display: block; }
    .head-nav ul {
        flex-direction: column;
        gap: 0;
        padding: 1em 0 0;
        border-top: 1px solid var(--color-line);
        margin-top: 1em;
    }
    .head-nav li { padding: .6em 0; border-bottom: 1px solid var(--color-line); }
    .head-nav li:last-child { border-bottom: none; }

    .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;
    }
    .card-body { padding: 1.2em 1.2em 1.4em; }
    .card-title { font-size: 1.1rem; }

    .topic-block { padding: 1.5em 1.2em; }
    .foot-cols { grid-template-columns: 1fr; gap: 1.5em; }
    .cookie-banner {
        flex-direction: column;
        align-items: stretch;
        text-align: center;
        left: .8em;
        right: .8em;
    }
}
