/*
Theme Name: dds_vpishis.rf
Author: Родион Макаров
Description: Информационная тема о поступлении в магистратуру и инженерном образовании: учебный план, практика, научный руководитель, документы и карьерная цель.
Version: 1.1
Requires at least: 6.0
Requires PHP: 8.0
Text Domain: magistra
*/

/* ============================================================ *
 *  Переменные
 * ============================================================ */
:root {
    --ink: #16233a;
    --muted: #566379;
    --brand: #1f3a5f;
    --brand-2: #2c5f7c;
    --accent: #c07f26;
    --accent-soft: #e9c17a;
    --bg: #f5f8fc;
    --surface: #ffffff;
    --line: #d8e1ee;
    --footer-bg: #16233a;
    --footer-ink: #d5deec;
    --footer-muted: #9bacc6;
    --radius: 12px;
    --shadow: 0 6px 22px rgba(22, 35, 58, 0.07);
}

/* ============================================================ *
 *  База
 * ============================================================ */
*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

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(--brand-2); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3, h4 { color: var(--ink); line-height: 1.25; font-weight: 700; }

p { margin: 0 0 1em; }

.shell {
    width: min(92%, 1180px);
    margin-inline: auto;
}

.screen-reader-text {
    position: absolute;
    width: 1px; height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}

.skip-link {
    position: absolute;
    left: -999px;
    top: 0;
    background: var(--brand);
    color: #fff;
    padding: 8px 14px;
    z-index: 1000;
}
.skip-link:focus { left: 8px; top: 8px; }

/* ============================================================ *
 *  Кнопки
 * ============================================================ */
.btn {
    display: inline-block;
    padding: 0.7em 1.5em;
    border-radius: 8px;
    font-weight: 600;
    line-height: 1.2;
    cursor: pointer;
    border: 2px solid transparent;
    transition: background .18s, color .18s, border-color .18s;
}
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-2); color: #fff; }
.btn-outline { background: transparent; color: var(--brand); border-color: var(--brand); }
.btn-outline:hover { background: var(--brand); color: #fff; }
.btn-light { background: var(--accent-soft); color: #3a2b0c; }
.btn-light:hover { background: #f0d091; color: #3a2b0c; }

/* ============================================================ *
 *  Шапка
 * ============================================================ */
.site-header {
    background: var(--surface);
    border-bottom: 1px solid var(--line);
}
.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.2rem;
    padding: 0.9rem 0;
    flex-wrap: wrap;
}
.brand-link {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    min-width: 0;
}
.brand-link:hover { text-decoration: none; }
.brand-logo { max-height: 56px; width: auto; display: block; }
.brand-mark { flex: 0 0 auto; display: block; }
.brand-text { display: flex; flex-direction: column; min-width: 0; }
.site-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--brand);
    line-height: 1.25;
}
.site-desc {
    font-size: 0.8rem;
    color: var(--muted);
    line-height: 1.35;
    margin-top: 2px;
}

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

.nav-list {
    list-style: none;
    margin: 0; padding: 0;
    display: flex;
    gap: 1.4rem;
    flex-wrap: wrap;
}
.nav-list a {
    color: var(--ink);
    font-weight: 600;
    font-size: 0.98rem;
    padding: 0.3em 0;
    display: inline-block;
}
.nav-list a:hover { color: var(--brand-2); text-decoration: none; }
.nav-list .current-menu-item > a { color: var(--brand); border-bottom: 2px solid var(--accent-soft); }

/* ============================================================ *
 *  Макеты страниц
 * ============================================================ */
.site-main { display: block; }
.page-shell { padding: 1.6rem 0 3rem; }

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

.page-title {
    font-size: 1.9rem;
    margin: 0 0 1.2rem;
}

/* ============================================================ *
 *  Хлебные крошки
 * ============================================================ */
.breadcrumbs {
    font-size: 0.86rem;
    color: var(--muted);
    margin-bottom: 1.2rem;
}
.breadcrumbs a { color: var(--brand-2); }
.breadcrumbs .sep { margin: 0 0.35em; color: #a9b6c9; }

/* ============================================================ *
 *  Карточки записей (A8, A10)
 * ============================================================ */
.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.6rem;
}
.list-grid { grid-template-columns: 1fr; }

.card {
    display: flex;
    flex-direction: column;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    min-width: 0;
}
.card-thumb-wrap {
    display: block;
    overflow: hidden;
}
.card-thumb-wrap a { display: block; }
.card-thumb-wrap img {
    width: 100%;
    height: auto;
    aspect-ratio: 16 / 9;
    object-fit: cover;
    display: block;
}
.card-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 1.2rem 1.3rem 1.3rem;
    min-width: 0;
}
.card-title {
    font-size: 1.2rem;
    margin: 0 0 0.5rem;
}
.card-title a { color: var(--ink); }
.card-title a:hover { color: var(--brand-2); text-decoration: none; }
.card-meta {
    font-size: 0.8rem;
    color: var(--muted);
    margin-bottom: 0.7rem;
}
.card-meta a { color: var(--muted); }
.card-excerpt { color: var(--ink); }
.card-excerpt p { margin: 0 0 0.5em; background: none; }
.card-more {
    margin-top: auto;
    padding-top: 0.6rem;
    font-weight: 600;
    color: var(--brand-2);
}

/* Список статей (одна колонка) — горизонтальные карточки на десктопе */
.list-grid .card { flex-direction: row; }
.list-grid .card-thumb-wrap {
    flex: 0 0 280px;
    position: relative;
}
.list-grid .card-thumb-wrap a {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
}
.list-grid .card-thumb-wrap img {
    width: 100%;
    height: 100%;
    aspect-ratio: auto;
    object-fit: cover;
    display: block;
}

/* ============================================================ *
 *  Главная — секции
 * ============================================================ */
.front-wrap { padding-bottom: 2rem; }
.front-section { padding: 3rem 0; }
.front-section:nth-child(even) { background: #eef3fa; }
.section-heading {
    font-size: 1.7rem;
    margin: 0 0 0.5rem;
    text-align: center;
}
.section-lead {
    text-align: center;
    color: var(--muted);
    max-width: 620px;
    margin: 0 auto 2rem;
}

/* Блок 1: текст + иллюстрация */
.fs-intro-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
    gap: 2.6rem;
    align-items: center;
}
.fs-title { font-size: 2.1rem; margin: 0 0 1rem; }
.fs-intro-text .btn { margin-top: 0.6rem; }
.fs-intro-media img {
    width: 100%;
    height: auto;
    border-radius: var(--radius);
    display: block;
    justify-self: center;
}

/* Блок 2: шаги */
.steps-list {
    list-style: none;
    margin: 0; padding: 0;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.5rem;
}
.step-item {
    display: flex;
    gap: 1rem;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 1.4rem 1.4rem;
    min-width: 0;
}
.step-num {
    flex: 0 0 auto;
    width: 40px; height: 40px;
    border-radius: 50%;
    background: var(--brand);
    color: #fff;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
}
.step-body { min-width: 0; }
.step-body h3 { font-size: 1.12rem; margin: 0.2rem 0 0.4rem; }
.step-body p { margin: 0; color: var(--muted); font-size: 0.95rem; }

/* Блок 3: сетка тем */
.topics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
    gap: 1.5rem;
}
.topic-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 1.6rem 1.5rem;
    box-shadow: var(--shadow);
    min-width: 0;
}
.topic-icon { color: var(--brand-2); display: inline-flex; margin-bottom: 0.7rem; }
.topic-card h3 { font-size: 1.15rem; margin: 0 0 0.5rem; }
.topic-card p { margin: 0; color: var(--muted); font-size: 0.95rem; }

/* Блок 4: CTA */
.fs-cta {
    background: var(--brand);
    color: #fff;
    border-radius: 16px;
    padding: 2.6rem 2.4rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.6rem;
    flex-wrap: wrap;
}
.fs-cta-text { min-width: 0; }
.fs-cta h2 { color: #fff; font-size: 1.6rem; margin: 0 0 0.5rem; }
.fs-cta p { margin: 0; color: #d5deec; }

/* Последние записи на главной */
.fs-latest .cards-grid { margin-top: 0.5rem; }
.empty-note { text-align: center; color: var(--muted); }

/* ============================================================ *
 *  Сайдбар и виджеты
 * ============================================================ */
.sidebar { min-width: 0; }
.widget {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 1.3rem 1.4rem;
    margin-bottom: 1.6rem;
    color: var(--ink);
}
.widget-title {
    font-size: 1.1rem;
    margin: 0 0 0.9rem;
    color: var(--brand);
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--accent-soft);
}
.widget ul { list-style: none; margin: 0; padding: 0; }
.widget li { padding: 0.4rem 0; border-bottom: 1px solid var(--line); }
.widget li:last-child { border-bottom: none; }
.widget a { color: var(--brand-2); }
.widget a:hover { color: var(--brand); }
.sidebar .widget .post-date { color: var(--muted); font-size: 0.82rem; }

/* ============================================================ *
 *  Записи и страницы
 * ============================================================ */
.single-title { font-size: 2rem; margin: 0 0 0.6rem; }
.single-meta { color: var(--muted); font-size: 0.88rem; margin-bottom: 1.4rem; }
.single-meta a { color: var(--muted); }
.single-thumb { margin-bottom: 1.6rem; }
.single-thumb img { width: 100%; border-radius: var(--radius); display: block; }
.entry-content { font-size: 1.05rem; }
.entry-content h2 { font-size: 1.5rem; margin: 1.8rem 0 0.7rem; }
.entry-content h3 { font-size: 1.25rem; margin: 1.4rem 0 0.6rem; }
.entry-content img { border-radius: 10px; height: auto; }
.entry-content ul, .entry-content ol { padding-left: 1.4rem; }
.entry-content blockquote {
    margin: 1.4rem 0;
    padding: 1.2rem 1.4rem;
    background: #eef3fa;
    border-left: 4px solid var(--accent-soft);
    border-radius: 8px;
    color: var(--ink);
}
.entry-content blockquote p:last-child { margin-bottom: 0; }
.entry-content a { text-decoration: underline; }

.entry-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.4rem 0;
}
.entry-content table, .entry-content th, .entry-content td {
    border: 1px solid var(--line);
}
.entry-content th, .entry-content td { padding: 0.6rem 0.8rem; text-align: left; }
.entry-content th { background: #eef3fa; }

.single-tags { margin-top: 1.6rem; font-size: 0.9rem; color: var(--muted); }
.tags-label { font-weight: 600; }
.page-links { margin-top: 1.4rem; font-weight: 600; }

/* ============================================================ *
 *  Пагинация (D5, type=plain → .page-numbers)
 * ============================================================ */
.pagination {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-top: 2.2rem;
}
.pagination .page-numbers {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    padding: 0.45em 0.75em;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    color: var(--ink);
    font-weight: 600;
    line-height: 1;
}
.pagination a.page-numbers:hover { background: #eef3fa; text-decoration: none; }
.pagination .page-numbers.current {
    background: var(--brand);
    color: #fff;
    border-color: var(--brand);
}
.pagination .page-numbers.dots {
    border: none;
    background: transparent;
}

/* ============================================================ *
 *  Форма поиска
 * ============================================================ */
.search-form {
    display: flex;
    gap: 0.5rem;
    margin: 1.2rem 0;
    max-width: 460px;
}
.search-field {
    flex: 1;
    min-width: 0;
    padding: 0.6em 0.9em;
    border: 1px solid var(--line);
    border-radius: 8px;
    font-size: 1rem;
}
.search-submit {
    padding: 0.6em 1.2em;
    border: none;
    border-radius: 8px;
    background: var(--brand);
    color: #fff;
    font-weight: 600;
    cursor: pointer;
}
.search-submit:hover { background: var(--brand-2); }

/* ============================================================ *
 *  Комментарии
 * ============================================================ */
.comments-area { margin-top: 2.6rem; }
.comments-title { font-size: 1.4rem; margin-bottom: 1.2rem; }
.comment-list { list-style: none; margin: 0 0 2rem; padding: 0; }
.comment-list ol.children { list-style: none; padding-left: 1.6rem; }
.comment-body {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 1.1rem 1.3rem;
    margin-bottom: 1rem;
}
.comment-meta { display: flex; gap: 1rem; align-items: baseline; margin-bottom: 0.4rem; }
.comment-author { font-weight: 700; }
.comment-date { color: var(--muted); font-size: 0.82rem; }
.comment-reply a { font-size: 0.88rem; font-weight: 600; }
.comment-awaiting { color: var(--accent); font-size: 0.9rem; }

.comment-form { max-width: 640px; }
.comment-form p { margin-bottom: 0.9rem; }
.comment-form label { display: block; font-weight: 600; margin-bottom: 0.3rem; }
.comment-form input[type="text"],
.comment-form input[type="email"],
.comment-form input[type="url"],
.comment-form textarea {
    width: 100%;
    padding: 0.6em 0.8em;
    border: 1px solid var(--line);
    border-radius: 8px;
    font-size: 1rem;
    font-family: inherit;
}
.comment-form .submit {
    background: var(--brand);
    color: #fff;
    border: none;
    padding: 0.7em 1.6em;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
}

/* ============================================================ *
 *  404
 * ============================================================ */
.error-404 .back-home { display: flex; gap: 0.8rem; flex-wrap: wrap; margin-top: 1.4rem; }

/* ============================================================ *
 *  Подвал (тёмный фон → светлый текст виджетов)
 * ============================================================ */
.site-footer { background: var(--footer-bg); color: var(--footer-ink); margin-top: 2rem; }
.footer-cols {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 2rem;
    padding: 2.8rem 0;
}
.footer-col { min-width: 0; }
.site-footer .widget {
    background: transparent;
    border: none;
    padding: 0;
    margin: 0;
    color: var(--footer-ink);
}
.site-footer .widget-title {
    color: #fff;
    border-bottom-color: rgba(233, 193, 122, 0.5);
}
.site-footer .widget a { color: var(--footer-ink); }
.site-footer .widget a:hover { color: #fff; }
.site-footer .widget li { border-bottom-color: rgba(255, 255, 255, 0.12); }
.site-footer .widget .post-date,
.site-footer .widget .rss-date { color: var(--footer-muted); }

.footer-bottom {
    border-top: 1px solid rgba(255, 255, 255, 0.12);
    padding: 1.2rem 0;
}
.copyright { margin: 0; font-size: 0.86rem; color: var(--footer-muted); }

/* ============================================================ *
 *  Cookie-баннер (A11 — правило [hidden] раньше основного блока)
 * ============================================================ */
.cookie-banner[hidden] { display: none !important; }

.cookie-banner {
    position: fixed;
    left: 0; right: 0; bottom: 0;
    z-index: 900;
    background: #12203a;
    color: #e8eef8;
    padding: 1rem 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1.2rem;
    flex-wrap: wrap;
    box-shadow: 0 -4px 18px rgba(0, 0, 0, 0.18);
}
.cookie-text { margin: 0; font-size: 0.9rem; max-width: 820px; }
.cookie-accept {
    flex: 0 0 auto;
    background: var(--accent-soft);
    color: #3a2b0c;
    border: none;
    padding: 0.6em 1.5em;
    border-radius: 8px;
    font-weight: 700;
    cursor: pointer;
}
.cookie-accept:hover { background: #f0d091; }

/* ============================================================ *
 *  Адаптив
 * ============================================================ */
@media (max-width: 960px) {
    .layout-with-sidebar { grid-template-columns: 1fr; gap: 2rem; }
    .footer-cols { grid-template-columns: 1fr 1fr; }
    .fs-intro-grid { grid-template-columns: 1fr; }
    .fs-intro-media { order: -1; }
}

@media (max-width: 600px) {
    body { font-size: 16px; }

    .nav-toggle { display: flex; }
    .site-nav {
        flex-basis: 100%;
        display: none;
    }
    .site-nav.is-open { display: block; }
    .nav-list { flex-direction: column; gap: 0.2rem; padding-top: 0.6rem; }
    .nav-list li { border-bottom: 1px solid var(--line); }

    .layout-single { width: 100%; }
    .front-section { padding: 2.2rem 0; }
    .section-heading { font-size: 1.4rem; }
    .fs-title { font-size: 1.6rem; }

    /* Карточки списка → вертикальные на мобильном (A10) */
    .list-grid .card { flex-direction: column; }
    .list-grid .card-thumb-wrap {
        flex: none;
        width: 100%;
        position: static;
    }
    .list-grid .card-thumb-wrap a { position: static; }
    .list-grid .card-thumb-wrap img {
        width: 100%;
        height: auto;
        aspect-ratio: 16 / 9;
    }

    .fs-cta { padding: 1.8rem 1.5rem; }
    .fs-cta h2 { font-size: 1.35rem; }
    .footer-cols { grid-template-columns: 1fr; gap: 1.6rem; padding: 2.2rem 0; }
    .cookie-banner { flex-direction: column; align-items: stretch; text-align: center; }
    .cookie-accept { align-self: center; }
}
