/*
Theme Name: dds_zhang-dragon.com
Author: Лунвэнь Чжан
Version: 1.1
Text Domain: zhangdragon
Description: Контентный русскоязычный проект на стыке науки, академической среды и инженерно-технологического развития.
*/

/* ===== 0. Reset & base ===== */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
    margin: 0;
    font-family: "Inter", "PT Serif", "Times New Roman", Georgia, serif;
    font-size: 17px;
    line-height: 1.65;
    color: #1A1D24;
    background-color: #F9F8F6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}
img { max-width: 100%; height: auto; }
a { color: #C4A262; text-decoration: none; transition: color .2s ease; }
a:hover { color: #9E7B48; text-decoration: underline; }

h1, h2, h3, h4, h5, h6 {
    font-family: "Playfair Display", "PT Serif", Georgia, serif;
    color: #1A1D24;
    line-height: 1.25;
    margin: 1.6em 0 .6em;
    font-weight: 600;
    letter-spacing: -0.01em;
}
h1 { font-size: 2.25rem; }
h2 { font-size: 1.75rem; }
h3 { font-size: 1.375rem; }
h4 { font-size: 1.175rem; }

p { margin: 0 0 1em; }

blockquote {
    margin: 1.5em 0;
    padding: .8em 1.2em;
    border-left: 4px solid #C4A262;
    background: #EFF2F5;
    line-height: 1.8;
    font-style: italic;
    color: #1A1D24;
}

code, pre, .formula {
    font-family: "JetBrains Mono", "Consolas", monospace;
    background: #EFF2F5;
    border: 1px solid #dfe4ea;
    border-radius: 2px;
    padding: 2px 6px;
    font-size: .92em;
    color: #1A1D24;
}
pre { padding: 12px 14px; overflow-x: auto; }
pre code { border: 0; background: transparent; padding: 0; }
.formula { display: inline-block; padding: 2px 8px; }

hr { border: 0; border-top: 1px solid #e3e1dd; margin: 2em 0; }

table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.2em 0;
    border: 1px solid #d6dae0;
}
th, td {
    border: 1px solid #d6dae0;
    padding: 8px 12px;
    text-align: left;
    vertical-align: top;
}
th { background: #EFF2F5; font-weight: 600; }

/* ===== 1. Layout ===== */
.wrap { max-width: 1200px; margin: 0 auto; padding: 0 22px; }
.site-main { padding: 40px 0 60px; }
.has-sidebar { display: flex; gap: 40px; align-items: flex-start; }
.has-sidebar .content-col { flex: 0 0 67%; min-width: 0; }
.has-sidebar .sidebar-col { flex: 0 0 27%; }
.no-sidebar .content-col { width: 85%; margin: 0 auto; }

@media (max-width: 960px) {
    .has-sidebar { flex-direction: column; }
    .has-sidebar .content-col,
    .has-sidebar .sidebar-col,
    .no-sidebar .content-col { width: 100%; flex: 1 1 auto; }
}

/* ===== 2. Header ===== */
.site-header {
    background: #F9F8F6;
    border-bottom: 1px solid #e3e1dd;
    padding: 22px 0;
}
.header-inner {
    display: flex;
    align-items: center;
    gap: 26px;
    flex-wrap: wrap;
}
.brand-block {
    display: flex;
    align-items: center;
    gap: 14px;
    flex: 1 1 auto;
    min-width: 0;
}
.brand-logo, .brand-logo-fallback {
    width: 52px;
    height: 52px;
    flex-shrink: 0;
    display: block;
    border-radius: 2px;
}
.brand-logo-fallback { background: #1A1D24; padding: 8px; }
.brand-text { min-width: 0; }
.brand-name {
    font-family: "Playfair Display", "PT Serif", Georgia, serif;
    font-size: 1.05rem;
    font-weight: 600;
    color: #1A1D24;
    line-height: 1.3;
    margin: 0;
    display: block;
    text-decoration: none;
}
.brand-name:hover { color: #1A1D24; text-decoration: none; }
.brand-desc {
    font-size: .78rem;
    color: #5B6778;
    margin: 3px 0 0;
    line-height: 1.4;
    max-width: 520px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Header nav */
.primary-nav { flex: 0 0 auto; }
.primary-nav ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
}
.primary-nav li a {
    display: inline-block;
    padding: 8px 14px;
    color: #1A1D24;
    font-size: .95rem;
    border-bottom: 1px solid transparent;
    transition: border-color .2s ease, color .2s ease;
}
.primary-nav li a:hover,
.primary-nav li.current-menu-item a {
    color: #C4A262;
    border-bottom-color: #C4A262;
    text-decoration: none;
}

/* Burger */
.nav-toggle {
    display: none;
    width: 38px;
    height: 38px;
    border: 1px solid #1A1D24;
    background: transparent;
    cursor: pointer;
    padding: 0;
    position: relative;
}
.nav-toggle span {
    display: block;
    position: absolute;
    left: 8px;
    right: 8px;
    height: 1.5px;
    background: #1A1D24;
    transition: transform .25s ease, opacity .2s ease, top .25s ease;
}
.nav-toggle span:nth-child(1) { top: 12px; }
.nav-toggle span:nth-child(2) { top: 18px; }
.nav-toggle span:nth-child(3) { top: 24px; }
.nav-toggle.is-open span:nth-child(1) { top: 18px; transform: rotate(45deg); }
.nav-toggle.is-open span:nth-child(2) { opacity: 0; }
.nav-toggle.is-open span:nth-child(3) { top: 18px; transform: rotate(-45deg); }

@media (max-width: 960px) {
    .nav-toggle { display: inline-block; }
    .primary-nav { flex-basis: 100%; display: none; }
    .primary-nav.is-open { display: block; }
    .primary-nav ul { flex-direction: column; gap: 0; }
    .primary-nav li a {
        padding: 10px 2px;
        border-bottom: 1px solid #e3e1dd;
        display: block;
    }
}

/* ===== 3. Contrast toggle ===== */
.contrast-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border: 1px solid #1A1D24;
    background: transparent;
    cursor: pointer;
    color: #1A1D24;
    transition: background .2s ease, color .2s ease;
}
.contrast-toggle:hover { background: #1A1D24; color: #F9F8F6; }
.contrast-toggle svg { width: 18px; height: 18px; }

body.contrast-mode { background: #ffffff; color: #000000; }
body.contrast-mode h1,
body.contrast-mode h2,
body.contrast-mode h3,
body.contrast-mode h4,
body.contrast-mode h5,
body.contrast-mode h6,
body.contrast-mode a,
body.contrast-mode .brand-name,
body.contrast-mode .brand-desc { color: #000000; }
body.contrast-mode .card,
body.contrast-mode .widget,
body.contrast-mode blockquote,
body.contrast-mode code,
body.contrast-mode pre,
body.contrast-mode th { background: #ffffff; border-color: #000000; color: #000000; }

/* ===== 4. Breadcrumbs / trajectory ===== */
.trajectory {
    background: #EFF2F5;
    border-top: 1px solid #e3e1dd;
    border-bottom: 1px solid #e3e1dd;
    padding: 14px 0;
    font-size: .9rem;
    color: #5B6778;
}
.trajectory-inner {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
}
.trajectory-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #C4A262;
    display: inline-block;
    margin-right: 8px;
}
.trajectory-arrow { color: #C4A262; margin: 0 4px; }
.trajectory a { color: #5B6778; }
.trajectory a:hover { color: #1A1D24; }
.trajectory-current { color: #1A1D24; font-weight: 600; }

/* ===== 5. Buttons ===== */
.btn, .btn-primary {
    display: inline-block;
    padding: 10px 22px;
    font-size: .95rem;
    color: #1A1D24;
    background: transparent;
    border: 1px solid #1A1D24;
    border-radius: 2px;
    cursor: pointer;
    transition: background .2s ease, color .2s ease;
    text-align: center;
    line-height: 1.3;
}
.btn:hover, .btn-primary:hover {
    background: #1A1D24;
    color: #F9F8F6;
    text-decoration: none;
}
.btn-secondary {
    display: inline-block;
    padding: 4px 12px;
    background: rgba(239, 242, 245, .7);
    border: 0;
    border-radius: 12px;
    font-size: .8rem;
    color: #5B6778;
    transition: background .2s ease;
}
.btn-secondary:hover { background: rgba(196, 162, 98, .15); text-decoration: none; color: #1A1D24; }

/* ===== 6. Post cards ===== */
.posts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 26px;
    margin: 20px 0 40px;
}
.card {
    background: #ffffff;
    border: 1px solid #e3e1dd;
    border-radius: 2px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: border-color .2s ease, transform .2s ease;
}
.card:hover { border-color: #C4A262; transform: translateY(-2px); }

.card-thumb { display: block; overflow: hidden; }
.card-thumb img {
    width: 100%;
    height: auto;
    aspect-ratio: 16 / 9;
    object-fit: cover;
    display: block;
    transition: transform .35s ease;
}
.card:hover .card-thumb img { transform: scale(1.04); }

.card-body { padding: 18px 20px 22px; flex: 1; display: flex; flex-direction: column; }
.card-cat {
    display: inline-block;
    font-size: .72rem;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: #5B6778;
    margin-bottom: 8px;
}
.card-cat.cat-science { color: #2A4B7C; }
.card-cat.cat-engineering { color: #B45D42; }
.card-cat.cat-academia { color: #6A8E6E; }
.card-cat.cat-navigation { color: #343A40; }
.card-title {
    font-size: 1.15rem;
    margin: 0 0 10px;
    line-height: 1.35;
}
.card-title a { color: #1A1D24; }
.card-title a:hover { color: #C4A262; text-decoration: none; }
.card-excerpt {
    font-size: .92rem;
    color: #5B6778;
    line-height: 1.55;
    margin-bottom: 14px;
    flex: 1;
}
.card-excerpt p { margin: 0 0 0.5em; background: none; }
.card-meta {
    font-size: .78rem;
    color: #5B6778;
    margin-bottom: 14px;
}
.card-meta span + span::before { content: " · "; margin: 0 4px; }

/* Horizontal card variant */
.card-row {
    display: flex;
    flex-direction: row;
    align-items: stretch;
}
.card-row .card-thumb-wrap {
    flex: 0 0 280px;
    position: relative;
    overflow: hidden;
}
.card-row .card-thumb-wrap a {
    display: block;
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
}
.card-row .card-thumb-wrap img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.card-row .card-body { flex: 1; }

@media (max-width: 600px) {
    .card-row { flex-direction: column; }
    .card-row .card-thumb-wrap {
        flex: none;
        width: 100%;
        position: static;
    }
    .card-row .card-thumb-wrap a { position: static; }
    .card-row .card-thumb-wrap img {
        width: 100%;
        height: auto;
        aspect-ratio: 16 / 9;
    }
}

/* ===== 7. Single post ===== */
.single-post-header {
    margin-bottom: 26px;
    padding-bottom: 22px;
    border-bottom: 1px solid #e3e1dd;
}
.single-post-title { font-size: 2.1rem; margin: 0 0 16px; }
.post-structured-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 16px;
    font-size: .85rem;
    color: #5B6778;
    margin-top: 10px;
}
.post-meta-field {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.post-meta-field strong { color: #1A1D24; font-weight: 600; }
.badge-level {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 12px;
    font-size: .75rem;
    background: rgba(196, 162, 98, .15);
    color: #9E7B48;
    font-weight: 600;
}
.post-content { font-size: 1.02rem; line-height: 1.75; }
.post-content img { border-radius: 2px; }

.author-profile {
    margin-top: 40px;
    padding: 26px;
    border: 1px solid #e3e1dd;
    background: #ffffff;
    display: flex;
    flex-wrap: wrap;
    gap: 24px;
    align-items: center;
}
.author-profile-stats {
    display: flex;
    gap: 30px;
    flex: 1 1 auto;
}
.author-stat { text-align: center; }
.author-stat-num {
    display: block;
    font-family: "Playfair Display", Georgia, serif;
    font-size: 1.5rem;
    color: #1A1D24;
    font-weight: 600;
}
.author-stat-label {
    font-size: .78rem;
    color: #5B6778;
    text-transform: uppercase;
    letter-spacing: .06em;
}
.author-profile-name { font-size: 1.1rem; margin: 0; color: #1A1D24; }
.author-profile-subscribe {
    padding: 8px 18px;
    border: 1px solid #C4A262;
    color: #C4A262;
    background: transparent;
    font-size: .9rem;
    transition: background .2s ease, color .2s ease;
}
.author-profile-subscribe:hover {
    background: #C4A262;
    color: #F9F8F6;
    text-decoration: none;
}

.related-trajectories {
    margin-top: 40px;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
}
.trajectory-card {
    padding: 18px;
    border: 1px solid #e3e1dd;
    border-left: 3px solid #C4A262;
    background: #ffffff;
    font-size: .92rem;
}
.trajectory-card-label {
    display: block;
    font-size: .75rem;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: #5B6778;
    margin-bottom: 6px;
}
.trajectory-card a { color: #1A1D24; font-weight: 600; }
.trajectory-card a:hover { color: #C4A262; }

/* TOC */
.toc-sidebar {
    position: sticky;
    top: 20px;
    font-size: .9rem;
}
.toc-sidebar-title {
    font-size: .78rem;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: #5B6778;
    margin-bottom: 10px;
}
.toc-sidebar ul {
    list-style: none;
    padding: 0 0 0 12px;
    margin: 0;
    border-left: 1px solid #d6dae0;
}
.toc-sidebar ul ul { padding-left: 14px; margin-top: 4px; }
.toc-sidebar li { margin: 6px 0; }
.toc-sidebar a { color: #5B6778; }
.toc-sidebar a:hover { color: #1A1D24; }

/* ===== 8. Sidebar & widgets ===== */
.sidebar-col .widget {
    background: #ffffff;
    border: 1px solid #e3e1dd;
    padding: 18px 20px;
    margin-bottom: 22px;
}
.widget-title {
    font-size: .82rem;
    text-transform: uppercase;
    letter-spacing: .1em;
    color: #5B6778;
    margin: 0 0 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid #e3e1dd;
    font-weight: 600;
}
.widget ul { list-style: none; margin: 0; padding: 0; }
.widget li { padding: 6px 0; border-bottom: 1px dashed #e3e1dd; }
.widget li:last-child { border-bottom: 0; }
.widget a { color: #1A1D24; }
.widget a:hover { color: #C4A262; }

/* ===== 9. Footer ===== */
.site-footer {
    background: #1A1D24;
    color: #cfd3da;
    padding: 40px 0 20px;
    margin-top: 60px;
}
.footer-dashboard {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 34px;
    margin-bottom: 30px;
}
@media (max-width: 800px) { .footer-dashboard { grid-template-columns: 1fr; gap: 24px; } }
.footer-col .widget { background: transparent; border: 0; padding: 0; margin: 0; }
.footer-col .widget-title { color: #C4A262; border-bottom-color: #33383f; }
.footer-col .widget li { border-bottom-color: #33383f; }
.footer-col a { color: #cfd3da; }
.footer-col a:hover { color: #C4A262; }
.footer-col p { color: #cfd3da; margin: 0 0 .6em; }
.site-copyright {
    text-align: center;
    padding-top: 20px;
    border-top: 1px solid #33383f;
    font-size: .82rem;
    color: #8a919c;
}

/* ===== 10. Pagination ===== */
.pagination-wrap {
    margin: 34px 0 10px;
    text-align: center;
}
.pagination-wrap .page-numbers {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 38px;
    height: 38px;
    padding: 0 10px;
    margin: 0 3px;
    color: #1A1D24;
    border-bottom: 1px solid #d6dae0;
    font-size: .95rem;
    transition: border-color .2s ease, color .2s ease;
}
.pagination-wrap .page-numbers:hover {
    color: #C4A262;
    border-bottom-color: #C4A262;
    text-decoration: none;
}
.pagination-wrap .page-numbers.current {
    color: #1A1D24;
    border-bottom: 2px solid #C4A262;
    font-weight: 600;
}
.pagination-wrap .page-numbers.dots { border: 0; }

/* ===== 11. Front page ===== */
.hero-block {
    padding: 50px 0 30px;
    border-bottom: 1px solid #e3e1dd;
    margin-bottom: 40px;
}
.hero-eyebrow {
    font-size: .8rem;
    text-transform: uppercase;
    letter-spacing: .1em;
    color: #C4A262;
    margin-bottom: 8px;
}
.hero-title {
    font-size: 2.5rem;
    margin: 0 0 14px;
    line-height: 1.2;
    max-width: 820px;
}
.hero-sub {
    font-size: 1.05rem;
    color: #5B6778;
    max-width: 720px;
    margin: 0 0 20px;
}

.theme-block { margin: 50px 0; }
.theme-block-head { margin-bottom: 22px; display: flex; align-items: baseline; justify-content: space-between; gap: 18px; flex-wrap: wrap; }
.theme-block-title { font-size: 1.5rem; margin: 0; }
.theme-block-kicker {
    font-size: .78rem;
    text-transform: uppercase;
    letter-spacing: .1em;
    color: #5B6778;
}
.theme-block-lead { color: #5B6778; max-width: 780px; margin: 0 0 22px; }

.tracks-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
    gap: 22px;
}
.track-card {
    padding: 24px;
    background: #ffffff;
    border: 1px solid #e3e1dd;
    border-top: 3px solid #C4A262;
}
.track-card h3 { margin: 0 0 8px; font-size: 1.1rem; }
.track-card p { color: #5B6778; font-size: .92rem; margin: 0; }

.steps-block { counter-reset: step; display: grid; gap: 18px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.step-item {
    padding: 20px 20px 20px 58px;
    background: #EFF2F5;
    position: relative;
}
.step-item::before {
    counter-increment: step;
    content: counter(step, decimal-leading-zero);
    position: absolute;
    left: 18px;
    top: 18px;
    font-family: "Playfair Display", Georgia, serif;
    font-size: 1.3rem;
    color: #C4A262;
    font-weight: 600;
}
.step-item h3 { margin: 0 0 6px; font-size: 1.02rem; }
.step-item p { margin: 0; font-size: .9rem; color: #5B6778; }

.cats-row {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
}
.cat-chip {
    padding: 8px 16px;
    border: 1px solid #d6dae0;
    background: #ffffff;
    font-size: .9rem;
    color: #1A1D24;
    transition: border-color .2s ease, color .2s ease;
}
.cat-chip:hover { border-color: #C4A262; color: #C4A262; text-decoration: none; }

.closing-block {
    margin: 50px 0 10px;
    padding: 34px;
    background: #EFF2F5;
    border-left: 4px solid #C4A262;
}
.closing-block h2 { margin-top: 0; }
.closing-block p { color: #5B6778; font-size: 1rem; margin-bottom: 0; }

/* ===== 12. Comments ===== */
.comments-area { margin-top: 44px; }
.comments-title {
    font-size: 1.2rem;
    margin: 0 0 18px;
    padding-bottom: 10px;
    border-bottom: 1px solid #e3e1dd;
}
.comment-list { list-style: none; padding: 0; margin: 0; }
.comment-list li { margin-bottom: 22px; padding: 16px 18px; border: 1px solid #e3e1dd; background: #ffffff; }
.comment-list .children { list-style: none; margin-top: 18px; padding-left: 20px; border-left: 2px solid #EFF2F5; }
.comment-author { font-weight: 600; }
.comment-metadata { font-size: .82rem; color: #5B6778; margin-bottom: 6px; }

.comment-form label { display: block; margin: 10px 0 4px; font-size: .9rem; }
.comment-form input[type="text"],
.comment-form input[type="email"],
.comment-form input[type="url"],
.comment-form textarea,
.search-form input[type="search"] {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #d6dae0;
    background: #ffffff;
    font-size: .95rem;
    font-family: inherit;
    color: #1A1D24;
}
.comment-form textarea { min-height: 120px; resize: vertical; }
.comment-form input:focus,
.comment-form textarea:focus,
.search-form input:focus { outline: 0; border-color: #C4A262; }

/* ===== 13. Search form ===== */
.search-form { display: flex; gap: 8px; margin-bottom: 16px; }
.search-form input[type="search"] { flex: 1; }
.search-form button { white-space: nowrap; }

/* ===== 14. Cookie banner ===== */
.cookie-banner {
    position: fixed;
    left: 16px;
    right: 16px;
    bottom: 16px;
    z-index: 999;
    background: #1A1D24;
    color: #F9F8F6;
    padding: 16px 22px;
    display: none;
    align-items: center;
    gap: 18px;
    box-shadow: 0 6px 24px rgba(0,0,0,.14);
    border-radius: 2px;
    flex-wrap: wrap;
}
.cookie-banner.is-visible { display: flex; }
.cookie-banner p { margin: 0; font-size: .88rem; flex: 1 1 auto; color: #F9F8F6; }
.cookie-banner-accept {
    padding: 8px 20px;
    background: #C4A262;
    color: #1A1D24;
    border: 0;
    cursor: pointer;
    font-size: .88rem;
    transition: background .2s ease;
}
.cookie-banner-accept:hover { background: #9E7B48; color: #F9F8F6; }

/* ===== 15. 404 ===== */
.error-404 {
    text-align: center;
    padding: 50px 20px;
}
.error-404 h1 {
    font-size: 3.5rem;
    margin: 0 0 10px;
}
.error-404 p { color: #5B6778; margin-bottom: 20px; }

/* ===== 16. Utility ===== */
.screen-reader-text {
    position: absolute;
    width: 1px; height: 1px;
    overflow: hidden;
    clip: rect(1px, 1px, 1px, 1px);
    white-space: nowrap;
}
.alignleft { float: left; margin: 5px 20px 10px 0; }
.alignright { float: right; margin: 5px 0 10px 20px; }
.aligncenter { display: block; margin: 10px auto; }

/* ===== 17. Trajectory slider (single) ===== */
.traj-slider {
    background: #EFF2F5;
    padding: 18px 22px;
    margin: 0 0 30px;
    overflow: hidden;
}
.traj-slider-track {
    display: flex;
    gap: 18px;
    overflow-x: auto;
    scrollbar-width: thin;
    padding-bottom: 6px;
}
.traj-slider-item {
    flex: 0 0 auto;
    font-size: .85rem;
    color: #5B6778;
    padding: 6px 14px;
    border: 1px solid #d6dae0;
    background: #ffffff;
    white-space: nowrap;
}
.traj-slider-item.current {
    border-color: #C4A262;
    color: #1A1D24;
    font-weight: 600;
}
.traj-slider-item.current::before {
    content: "●";
    color: #C4A262;
    margin-right: 6px;
}
