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

/* ---------- Переменные ---------- */
:root {
    --bg-main: #FFFFFF;
    --bg-soft: #F5F9FC;
    --accent: #1A5276;
    --accent-dark: #0D2B42;
    --accent-coral: #C0392B;
    --ok: #27AE60;
    --warn: #F39C12;
    --danger: #E74C3C;
    --text-main: #2C3E50;
    --text-soft: #7F8C8D;
    --border: #E1E8EE;
    --shadow: 0 2px 8px rgba(26, 82, 118, 0.06);
}

/* ---------- Сброс и база ---------- */
*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
    margin: 0;
    font-family: 'Inter', 'Roboto', -apple-system, BlinkMacSystemFont, 'Segoe UI', Arial, sans-serif;
    font-size: 16px;
    line-height: 1.7;
    color: var(--text-main);
    background: var(--bg-main);
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, h6 {
    font-family: 'PT Serif', Georgia, 'Times New Roman', serif;
    color: var(--accent);
    line-height: 1.3;
    margin: 0 0 0.6em;
    font-weight: 600;
}

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;
    background: none;
}

a {
    color: var(--accent);
    text-decoration: none;
    transition: color .2s;
}
a:hover { color: var(--accent-coral); }

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

/* ---------- Контейнер ---------- */
.site-wrap {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.wrap {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

.page-main {
    flex: 1;
    padding: 32px 0 48px;
}

.page-main .wrap {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 32px;
}

.page-main.has-sidebar .wrap {
    grid-template-columns: minmax(0, 67%) minmax(0, 27%);
    gap: 6%;
}

.page-main.wide .wrap {
    grid-template-columns: minmax(0, 85%);
    justify-content: center;
}

@media (max-width: 960px) {
    .page-main.has-sidebar .wrap,
    .page-main.wide .wrap {
        grid-template-columns: minmax(0, 1fr);
    }
}

/* ---------- Шапка ---------- */
.site-header {
    background: var(--bg-main);
    border-bottom: 1px solid var(--border);
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    padding: 18px 0;
    flex-wrap: wrap;
}

.brand {
    display: flex;
    align-items: center;
    gap: 14px;
    text-decoration: none;
    color: var(--text-main);
    max-width: 70%;
}

.brand-logo {
    width: 54px;
    height: 54px;
    flex-shrink: 0;
    display: block;
}

.brand-text {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.brand-name {
    font-family: 'PT Serif', Georgia, serif;
    font-size: 1.3rem;
    font-weight: 600;
    color: var(--accent);
    line-height: 1.2;
}

.brand-tagline {
    font-size: 0.82rem;
    color: var(--text-soft);
    line-height: 1.4;
    margin-top: 4px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ---------- Навигация ---------- */
.primary-nav {
    display: flex;
    align-items: center;
}

.menu-toggle {
    display: none;
    background: none;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 8px 14px;
    cursor: pointer;
    color: var(--accent);
    font-size: 0.95rem;
}

.primary-nav ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.primary-nav li a {
    display: inline-block;
    padding: 8px 14px;
    color: var(--text-main);
    font-weight: 500;
    border-radius: 8px;
    position: relative;
}

.primary-nav li.current-menu-item > a,
.primary-nav li a:hover {
    color: var(--accent);
}

.primary-nav li.current-menu-item > a::after,
.primary-nav li a:hover::after {
    content: '';
    position: absolute;
    left: 14px;
    right: 14px;
    bottom: 2px;
    height: 2px;
    background: var(--accent);
    border-radius: 1px;
}

@media (max-width: 960px) {
    .menu-toggle { display: inline-block; }
    .primary-nav ul {
        display: none;
        flex-direction: column;
        gap: 0;
        width: 100%;
        padding: 12px 0;
        border-top: 1px solid var(--border);
        margin-top: 14px;
    }
    .primary-nav.is-open ul {
        display: flex;
    }
    .primary-nav li a {
        display: block;
        padding: 12px 4px;
        border-radius: 0;
    }
    .primary-nav li.current-menu-item > a::after,
    .primary-nav li a:hover::after {
        display: none;
    }
    .primary-nav {
        order: 3;
        width: 100%;
    }
}

/* ---------- Хлебные крошки ---------- */
.breadcrumbs {
    font-size: 0.88rem;
    color: var(--text-soft);
    margin: 0 0 20px;
    background: var(--bg-soft);
    padding: 10px 16px;
    border-radius: 10px;
}

.breadcrumbs a {
    color: var(--accent);
}

.breadcrumbs .sep {
    margin: 0 6px;
    color: var(--text-soft);
}

.breadcrumbs .current {
    color: var(--text-main);
}

/* ---------- Карточки записей ---------- */
.posts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 24px;
    margin: 0 0 36px;
}

.card {
    display: flex;
    flex-direction: column;
    background: var(--bg-main);
    border: 1px solid var(--border);
    border-radius: 14px;
    overflow: hidden;
    transition: transform .2s, box-shadow .2s;
}

.card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow);
}

.card-thumb {
    width: 100%;
    aspect-ratio: 16 / 10;
    object-fit: cover;
    display: block;
    background: var(--bg-soft);
}

.card-thumb-placeholder {
    width: 100%;
    aspect-ratio: 16 / 10;
    background: linear-gradient(135deg, #EAF2F8 0%, #D6EAF8 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent);
}

.card-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 18px 20px 20px;
}

.card-cat {
    display: inline-block;
    background: var(--accent);
    color: #fff;
    font-size: 0.72rem;
    padding: 3px 10px;
    border-radius: 40px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    margin-bottom: 10px;
    align-self: flex-start;
}

.card-title {
    font-size: 1.15rem;
    margin: 0 0 10px;
}

.card-title a {
    color: var(--text-main);
}

.card-title a:hover {
    color: var(--accent);
}

.card-excerpt {
    color: var(--text-soft);
    font-size: 0.93rem;
    line-height: 1.6;
    flex: 1;
}

.card-excerpt p {
    margin: 0 0 0.5em;
    background: none;
}

.card-meta {
    font-size: 0.8rem;
    color: var(--text-soft);
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
}

.card-more {
    display: inline-block;
    margin-top: 12px;
    color: var(--accent);
    font-weight: 500;
    border-bottom: 1px solid transparent;
    transition: border-color .2s;
}
.card-more:hover {
    border-bottom-color: var(--accent);
}

/* ---------- Пагинация ---------- */
.pagination {
    display: flex;
    justify-content: center;
    gap: 6px;
    margin: 32px 0 8px;
    flex-wrap: wrap;
}

.pagination a,
.pagination span {
    display: inline-block;
    min-width: 40px;
    padding: 8px 14px;
    text-align: center;
    border: 1px solid var(--border);
    border-radius: 10px;
    color: var(--accent);
    font-weight: 500;
    background: var(--bg-main);
}

.pagination a:hover {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}

.pagination .current {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}

/* ---------- Сайдбар ---------- */
.sidebar {
    min-width: 0;
}

.widget {
    background: var(--bg-soft);
    border-radius: 12px;
    padding: 20px 22px;
    margin-bottom: 24px;
}

.widget-title,
.widget h2,
.widget h3 {
    font-size: 1.05rem;
    margin: 0 0 14px;
    color: var(--accent);
    padding-bottom: 10px;
    border-bottom: 2px solid var(--accent);
    display: block;
}

.widget ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.widget li {
    padding: 6px 0;
    border-bottom: 1px solid var(--border);
}

.widget li:last-child { border-bottom: none; }

.widget a {
    color: var(--text-main);
}

.widget a:hover {
    color: var(--accent);
}

/* ---------- Одиночная запись и страница ---------- */
.post-single,
.page-single {
    background: var(--bg-main);
}

.entry-header {
    margin-bottom: 22px;
}

.entry-title {
    font-size: 2rem;
    margin: 0 0 12px;
}

.entry-meta {
    color: var(--text-soft);
    font-size: 0.9rem;
}

.entry-thumb {
    margin: 0 0 24px;
    border-radius: 14px;
    overflow: hidden;
}

.entry-thumb img {
    display: block;
    width: 100%;
    height: auto;
}

.entry-content {
    font-size: 1.02rem;
    line-height: 1.75;
}

.entry-content h2,
.entry-content h3 {
    margin-top: 1.6em;
}

.entry-content p {
    margin: 0 0 1.1em;
    background: none;
}

.entry-content ul,
.entry-content ol {
    margin: 0 0 1.1em;
    padding-left: 1.3em;
}

.entry-content li {
    margin-bottom: 0.4em;
}

.entry-content blockquote {
    border-left: 4px solid var(--accent);
    margin: 1.4em 0;
    padding: 10px 18px;
    background: var(--bg-soft);
    color: var(--text-main);
    border-radius: 0 10px 10px 0;
}

.entry-content a {
    border-bottom: 1px solid rgba(26, 82, 118, 0.3);
}
.entry-content a:hover {
    border-bottom-color: var(--accent-coral);
}

.entry-content img {
    border-radius: 12px;
    display: block;
    margin: 1em auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.2em 0;
    border: 1px solid var(--border);
}

table th,
table td {
    border: 1px solid var(--border);
    padding: 10px 14px;
    text-align: left;
}

table th {
    background: var(--bg-soft);
    color: var(--accent);
    font-weight: 600;
}

table tr:nth-child(even) td {
    background: rgba(245, 249, 252, 0.5);
}

/* ---------- Главная ---------- */
.home-section {
    margin-bottom: 48px;
}

.home-hero {
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent-dark) 100%);
    color: #fff;
    padding: 48px 40px;
    border-radius: 18px;
    margin-bottom: 40px;
}

.home-hero h1 {
    color: #fff;
    font-size: 2.3rem;
    max-width: 720px;
    margin-bottom: 16px;
}

.home-hero p {
    color: rgba(255,255,255,0.9);
    max-width: 720px;
    font-size: 1.08rem;
}

.feature-block {
    background: var(--bg-soft);
    border-radius: 16px;
    padding: 36px 32px;
    margin-bottom: 32px;
}

.feature-block h2 {
    margin-top: 0;
}

.feature-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
    margin-top: 24px;
}

.feature-item {
    background: var(--bg-main);
    padding: 20px;
    border-radius: 12px;
    border-left: 3px solid var(--accent);
}

.feature-item h3 {
    font-size: 1.1rem;
    margin-bottom: 8px;
}

.feature-item p {
    margin: 0;
    color: var(--text-soft);
    font-size: 0.95rem;
}

/* Виджет «Моё давление» */
.bp-check {
    background: linear-gradient(135deg, #EAF2F8 0%, #D6EAF8 100%);
    border-radius: 16px;
    padding: 28px 30px;
    margin-bottom: 32px;
}

.bp-check h2 {
    margin-top: 0;
}

.bp-form {
    display: flex;
    gap: 14px;
    flex-wrap: wrap;
    align-items: flex-end;
    margin-top: 16px;
}

.bp-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.bp-field label {
    font-size: 0.85rem;
    color: var(--text-main);
    font-weight: 500;
}

.bp-field input {
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 10px;
    font-size: 1rem;
    width: 110px;
    background: var(--bg-main);
    color: var(--text-main);
}

.bp-field input:focus {
    outline: none;
    border-color: var(--accent);
}

.btn {
    display: inline-block;
    padding: 11px 22px;
    border-radius: 12px;
    border: 1px solid var(--accent);
    background: var(--bg-main);
    color: var(--accent);
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    font-size: 1rem;
    transition: background .2s, color .2s;
}

.btn:hover {
    background: var(--accent);
    color: #fff;
}

.bp-result {
    margin-top: 18px;
    padding: 14px 18px;
    border-radius: 10px;
    background: var(--bg-main);
    display: none;
}

.bp-result.bp-ok { border-left: 4px solid var(--ok); color: var(--ok); display: block; }
.bp-result.bp-warn { border-left: 4px solid var(--warn); color: #B97209; display: block; }
.bp-result.bp-danger { border-left: 4px solid var(--danger); color: var(--danger); display: block; }

/* ---------- Поиск ---------- */
.search-form {
    display: flex;
    gap: 8px;
    margin: 16px 0;
}

.search-form input[type="search"] {
    flex: 1;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: 10px;
    font-size: 1rem;
    background: var(--bg-main);
    color: var(--text-main);
}

.search-form input[type="search"]:focus {
    outline: none;
    border-color: var(--accent);
}

.search-form button {
    padding: 10px 18px;
    border: none;
    background: var(--accent);
    color: #fff;
    border-radius: 10px;
    cursor: pointer;
    font-size: 0.95rem;
}

.search-form button:hover {
    background: var(--accent-dark);
}

/* ---------- Подвал ---------- */
.site-footer {
    background: var(--accent-dark);
    color: rgba(255,255,255,0.85);
    padding: 40px 0 20px;
    margin-top: 40px;
}

.footer-cols {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 32px;
    margin-bottom: 28px;
}

@media (max-width: 800px) {
    .footer-cols { grid-template-columns: 1fr; gap: 24px; }
}

.site-footer .widget {
    background: transparent;
    padding: 0;
    margin: 0;
}

.site-footer .widget-title,
.site-footer .widget h2,
.site-footer .widget h3 {
    color: #fff;
    border-bottom-color: rgba(255,255,255,0.25);
    padding-bottom: 10px;
}

.site-footer .widget a {
    color: rgba(255,255,255,0.85);
}

.site-footer .widget a:hover {
    color: #fff;
}

.site-footer .widget li {
    border-bottom-color: rgba(255,255,255,0.1);
}

.footer-bottom {
    border-top: 1px solid rgba(255,255,255,0.15);
    padding-top: 18px;
    font-size: 0.88rem;
    color: rgba(255,255,255,0.65);
    text-align: center;
}

/* ---------- Cookie-баннер ---------- */
.cookie-banner {
    position: fixed;
    left: 20px;
    right: 20px;
    bottom: 20px;
    background: var(--accent-dark);
    color: #fff;
    padding: 16px 20px;
    border-radius: 12px;
    display: flex;
    gap: 16px;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 6px 24px rgba(0,0,0,0.2);
    z-index: 9999;
    flex-wrap: wrap;
    max-width: 720px;
    margin: 0 auto;
}

.cookie-banner p {
    margin: 0;
    color: #fff;
    font-size: 0.92rem;
    flex: 1;
    background: none;
}

.cookie-banner button {
    background: #fff;
    color: var(--accent);
    border: none;
    padding: 10px 22px;
    border-radius: 10px;
    cursor: pointer;
    font-weight: 500;
    font-size: 0.95rem;
}

.cookie-banner button:hover {
    background: var(--bg-soft);
}

/* ---------- Комментарии ---------- */
.comments-area {
    margin-top: 40px;
    padding-top: 24px;
    border-top: 1px solid var(--border);
}

.comment-list {
    list-style: none;
    padding: 0;
    margin: 0 0 28px;
}

.comment-list li {
    background: var(--bg-soft);
    padding: 16px 20px;
    border-radius: 10px;
    margin-bottom: 12px;
}

.comment-list .children {
    list-style: none;
    padding-left: 20px;
    margin-top: 12px;
}

.comment-meta {
    font-size: 0.85rem;
    color: var(--text-soft);
    margin-bottom: 8px;
}

.comment-author {
    font-weight: 600;
    color: var(--text-main);
    margin-right: 6px;
}

.comment-form label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    font-size: 0.9rem;
}

.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: 10px;
    font-size: 1rem;
    font-family: inherit;
    background: var(--bg-main);
    color: var(--text-main);
    margin-bottom: 14px;
}

.comment-form textarea { min-height: 120px; }

.comment-form input:focus,
.comment-form textarea:focus {
    outline: none;
    border-color: var(--accent);
}

.comment-form .submit {
    background: var(--accent);
    color: #fff;
    border: none;
    padding: 11px 22px;
    border-radius: 12px;
    cursor: pointer;
    font-weight: 500;
}

.comment-form .submit:hover {
    background: var(--accent-dark);
}

/* ---------- 404 ---------- */
.error-404 {
    text-align: center;
    padding: 40px 20px;
}

.error-404 h1 {
    font-size: 4rem;
    color: var(--accent);
    margin-bottom: 12px;
}

/* ---------- Адаптив ---------- */
@media (max-width: 600px) {
    h1, .entry-title { font-size: 1.7rem; }
    h2 { font-size: 1.35rem; }
    .home-hero { padding: 32px 22px; }
    .home-hero h1 { font-size: 1.7rem; }
    .feature-block { padding: 24px 20px; }
    .brand-logo { width: 44px; height: 44px; }
    .brand-name { font-size: 1.1rem; }
    .brand-tagline { font-size: 0.75rem; }
    .wrap { padding: 0 14px; }
    .cookie-banner { flex-direction: column; align-items: stretch; text-align: center; }
}

/* ---------- Утилиты ---------- */
.screen-reader-text {
    position: absolute;
    left: -9999px;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

.sticky {
    background: var(--bg-soft);
    padding: 4px 10px;
    border-radius: 6px;
    display: inline-block;
    font-size: 0.8rem;
    color: var(--accent);
    margin-bottom: 8px;
}

.aligncenter { display: block; margin: 1em auto; }
.alignleft { float: left; margin: 0 1em 1em 0; }
.alignright { float: right; margin: 0 0 1em 1em; }
.clearfix::after { content: ''; display: table; clear: both; }
