/*
Theme Name: dds_subnotes.ru
Author: Артём Березин
Description: Информационная тема для проекта Subnotes о персональном управлении здоровьем через технологические экосистемы.
Version: 1.1
Requires at least: 6.0
Requires PHP: 8.0
Text Domain: subnotes
*/

/* ===== Переменные ===== */
:root {
    --bg: #f4f7f8;
    --surface: #ffffff;
    --ink: #16242c;
    --ink-soft: #4a5d67;
    --line: #dce6ea;
    --brand: #0e7c72;
    --brand-deep: #0a5a52;
    --brand-soft: #e3f1ef;
    --accent: #e0763c;
    --footer-bg: #112229;
    --footer-ink: #c4d6dd;
    --footer-head: #ffffff;
    --footer-line: #2a3d45;
    --radius: 14px;
    --radius-sm: 9px;
    --shell: min(92%, 1180px);
    --shadow: 0 6px 24px rgba(16, 40, 48, 0.07);
}

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

html { scroll-behavior: smooth; }

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

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

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

h1, h2, h3, h4 {
    line-height: 1.25;
    color: var(--ink);
    margin: 0 0 0.5em;
    font-weight: 700;
}
h1 { font-size: 2.05rem; }
h2 { font-size: 1.6rem; }
h3 { font-size: 1.25rem; }

p { margin: 0 0 1.1em; }

/* Глобально у p нет фона — фон только на body и конкретных блоках */

/* ===== Контейнер ширины (единственный источник) ===== */
.shell {
    width: var(--shell);
    margin-inline: auto;
}

/* ===== Шапка ===== */
.site-header {
    background: var(--surface);
    border-bottom: 1px solid var(--line);
}
.header-inner {
    display: flex;
    align-items: center;
    gap: 22px;
    padding: 18px 0;
    flex-wrap: wrap;
}
.branding {
    display: flex;
    align-items: center;
    gap: 14px;
    min-width: 0;
}
.brand-logo,
.brand-logo svg {
    width: 52px;
    height: 52px;
    display: block;
    flex: 0 0 auto;
}
.brand-text { min-width: 0; }
.site-title {
    font-size: 1.12rem;
    font-weight: 700;
    margin: 0;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.site-title a { color: var(--ink); }
.site-desc {
    margin: 4px 0 0;
    font-size: 0.84rem;
    color: var(--ink-soft);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ===== Навигация ===== */
.nav-toggle {
    margin-left: auto;
    display: none;
    background: var(--brand);
    color: #fff;
    border: none;
    border-radius: var(--radius-sm);
    padding: 10px 14px;
    font-size: 0.95rem;
    cursor: pointer;
}
.main-nav {
    margin-left: auto;
}
.main-nav ul {
    list-style: none;
    display: flex;
    gap: 6px;
    margin: 0;
    padding: 0;
    flex-wrap: wrap;
}
.main-nav a {
    display: block;
    padding: 9px 14px;
    border-radius: var(--radius-sm);
    color: var(--ink);
    font-weight: 600;
    font-size: 0.97rem;
}
.main-nav a:hover {
    background: var(--brand-soft);
    color: var(--brand-deep);
    text-decoration: none;
}
.main-nav .current-menu-item > a {
    background: var(--brand);
    color: #fff;
}

/* ===== Layout страниц ===== */
.site-main { padding: 32px 0 48px; }

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

@media (max-width: 960px) {
    .layout-with-sidebar { grid-template-columns: 1fr; gap: 30px; }
    .layout-single .content-area { width: 100%; }
}

/* ===== Хлебные крошки ===== */
.breadcrumbs {
    font-size: 0.86rem;
    color: var(--ink-soft);
    margin-bottom: 22px;
}
.breadcrumbs a { color: var(--brand-deep); }
.breadcrumbs .sep { margin: 0 6px; color: #9bb0b9; }

/* ===== Карточки записей ===== */
.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 24px;
}
.card {
    display: flex;
    flex-direction: column;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
}
.card-thumb {
    display: block;
    aspect-ratio: 16 / 9;
    overflow: hidden;
}
.card-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.card-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 18px 20px 20px;
    min-width: 0;
}
.card-title {
    font-size: 1.15rem;
    margin: 0 0 8px;
}
.card-title a { color: var(--ink); }
.card-title a:hover { color: var(--brand-deep); }
.card-meta {
    font-size: 0.8rem;
    color: var(--ink-soft);
    margin-bottom: 10px;
}
.card-excerpt {
    color: var(--ink-soft);
    font-size: 0.95rem;
    margin-bottom: 16px;
}
.card-excerpt p {
    margin: 0 0 0.5em;
    background: none;
}
.card-more {
    margin-top: auto;
    align-self: flex-start;
    font-weight: 600;
    color: var(--brand-deep);
}
.card-more::after { content: " →"; }

/* ===== Список записей (архивы/блог) ===== */
.posts-list { display: grid; gap: 24px; }

/* ===== Кнопки ===== */
.btn {
    display: inline-block;
    background: var(--brand);
    color: #fff;
    padding: 12px 22px;
    border-radius: var(--radius-sm);
    font-weight: 600;
    border: none;
    cursor: pointer;
}
.btn:hover { background: var(--brand-deep); color: #fff; text-decoration: none; }
.btn-ghost {
    background: transparent;
    color: var(--brand-deep);
    border: 1.5px solid var(--brand);
}
.btn-ghost:hover { background: var(--brand-soft); color: var(--brand-deep); }

/* ===== Главная: секции ===== */
.home-section { padding: 22px 0; }
.section-head {
    max-width: 720px;
    margin-bottom: 26px;
}
.section-head .eyebrow {
    display: inline-block;
    font-size: 0.78rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--brand);
    font-weight: 700;
    margin-bottom: 8px;
}

/* Блок: текст + иллюстрация */
.split {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 40px;
    align-items: center;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 36px;
    box-shadow: var(--shadow);
}
.split.reverse .split-media { order: -1; }
.split-media img,
.split-media svg {
    width: 100%;
    height: auto;
    display: block;
    border-radius: var(--radius-sm);
}
@media (max-width: 800px) {
    .split { grid-template-columns: 1fr; gap: 26px; padding: 26px; }
    .split.reverse .split-media { order: 0; }
}

/* Блок: сетка направлений */
.feature-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 22px;
}
.feature {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 26px 24px;
    min-width: 0;
}
.feature .ic {
    width: 46px;
    height: 46px;
    display: block;
    margin-bottom: 14px;
    color: var(--brand);
}
.feature h3 { font-size: 1.1rem; }
.feature p { margin: 0; color: var(--ink-soft); font-size: 0.95rem; }

/* Блок: шаги */
.steps {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 22px;
    counter-reset: step;
}
.step {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 26px 24px;
    position: relative;
    min-width: 0;
}
.step::before {
    counter-increment: step;
    content: counter(step);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--brand);
    color: #fff;
    font-weight: 700;
    margin-bottom: 14px;
}
.step h3 { font-size: 1.08rem; }
.step p { margin: 0; color: var(--ink-soft); font-size: 0.95rem; }

/* Блок: FAQ */
.faq { display: grid; gap: 14px; }
.faq details {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    padding: 4px 20px;
}
.faq summary {
    cursor: pointer;
    font-weight: 600;
    padding: 14px 0;
    list-style: none;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after {
    content: "+";
    float: right;
    color: var(--brand);
    font-size: 1.3rem;
    line-height: 1;
}
.faq details[open] summary::after { content: "–"; }
.faq details p { margin: 0 0 14px; color: var(--ink-soft); }

/* Последние записи на главной */
.latest-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 24px;
}

/* ===== Запись и страница ===== */
.entry {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 32px;
    box-shadow: var(--shadow);
    min-width: 0;
}
.entry-title { font-size: 2rem; }
.entry-meta {
    font-size: 0.85rem;
    color: var(--ink-soft);
    margin-bottom: 18px;
}
.entry-thumb {
    margin: 0 0 22px;
    border-radius: var(--radius-sm);
    overflow: hidden;
}
.entry-thumb img { width: 100%; height: auto; display: block; }
.entry-content { min-width: 0; }
.entry-content img { border-radius: var(--radius-sm); }
.entry-content h2 { margin-top: 1.4em; }
.entry-content ul, .entry-content ol { padding-left: 1.3em; }
.entry-content blockquote {
    margin: 1.4em 0;
    padding: 14px 22px;
    border-left: 4px solid var(--brand);
    background: var(--brand-soft);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}
.entry-content pre {
    background: #14222a;
    color: #e7eef0;
    padding: 16px;
    border-radius: var(--radius-sm);
    overflow-x: auto;
    min-width: 0;
}

/* Таблицы */
.entry-content table {
    border-collapse: collapse;
    width: 100%;
    margin: 1.2em 0;
}
.entry-content table,
.entry-content th,
.entry-content td {
    border: 1px solid var(--line);
}
.entry-content th,
.entry-content td {
    padding: 10px 12px;
    text-align: left;
}
.entry-content th { background: var(--brand-soft); }

.tags-line { margin-top: 24px; font-size: 0.9rem; color: var(--ink-soft); }
.tags-line a {
    display: inline-block;
    background: var(--brand-soft);
    color: var(--brand-deep);
    padding: 3px 11px;
    border-radius: 20px;
    margin: 0 6px 6px 0;
}

/* ===== Сайдбар ===== */
.sidebar { min-width: 0; }
.sidebar .widget {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 22px;
    margin-bottom: 24px;
    color: var(--ink);
}
.sidebar .widget-title {
    font-size: 1.05rem;
    margin: 0 0 14px;
    color: var(--ink);
    padding-bottom: 10px;
    border-bottom: 2px solid var(--brand-soft);
}
.sidebar .widget a { color: var(--brand-deep); }
.sidebar .widget ul { list-style: none; margin: 0; padding: 0; }
.sidebar .widget li {
    padding: 8px 0;
    border-bottom: 1px solid var(--line);
    color: var(--ink);
}
.sidebar .widget li:last-child { border-bottom: none; }
.sidebar .widget .post-date {
    display: block;
    font-size: 0.78rem;
    color: var(--ink-soft);
}

/* ===== Комментарии ===== */
.comments-area {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 28px 32px;
    margin-top: 28px;
    box-shadow: var(--shadow);
}
.comment-list { list-style: none; margin: 0; padding: 0; }
.comment-list .children { list-style: none; margin: 0 0 0 26px; padding: 0; }
.comment-item { margin: 0 0 18px; }
.comment-inner {
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    padding: 16px 18px;
}
.comment-head {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 8px;
}
.comment-author { font-weight: 700; }
.comment-date { font-size: 0.8rem; color: var(--ink-soft); }
.comment-await { font-size: 0.85rem; color: var(--accent); }

.comment-form input[type="text"],
.comment-form input[type="email"],
.comment-form input[type="url"],
.comment-form textarea {
    width: 100%;
    padding: 11px 13px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 1rem;
    background: #fff;
}
.comment-form textarea { min-height: 130px; }
.comment-form label { display: block; margin-bottom: 5px; font-size: 0.9rem; }
.comment-form p { margin-bottom: 14px; }

/* ===== Форма поиска ===== */
.search-form {
    display: flex;
    gap: 8px;
}
.search-form .search-field {
    flex: 1;
    min-width: 0;
    padding: 11px 13px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    font-size: 1rem;
    background: #fff;
}
.search-form .search-submit {
    background: var(--brand);
    color: #fff;
    border: none;
    border-radius: var(--radius-sm);
    padding: 0 18px;
    cursor: pointer;
    font-weight: 600;
}
.search-form .search-submit:hover { background: var(--brand-deep); }

/* ===== Пагинация (type => plain ↔ .page-numbers) ===== */
.pagination {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 34px;
    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(--line);
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--ink);
    font-weight: 600;
    text-decoration: none;
}
.pagination a.page-numbers:hover {
    border-color: var(--brand);
    color: var(--brand-deep);
}
.pagination .page-numbers.current {
    background: var(--brand);
    border-color: var(--brand);
    color: #fff;
}
.pagination .page-numbers.dots {
    border: none;
    background: none;
}

/* ===== 404 ===== */
.error-404 {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 44px 36px;
    text-align: center;
    box-shadow: var(--shadow);
    min-width: 0;
}
.error-404 .code {
    font-size: 4rem;
    font-weight: 800;
    color: var(--brand);
    line-height: 1;
    margin-bottom: 10px;
}
.error-404 .search-form { max-width: 460px; margin: 22px auto 0; }

/* ===== Подвал ===== */
.site-footer {
    background: var(--footer-bg);
    color: var(--footer-ink);
    padding: 48px 0 0;
    margin-top: 40px;
}
.footer-cols {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 34px;
    padding-bottom: 36px;
}
@media (max-width: 800px) {
    .footer-cols { grid-template-columns: 1fr; gap: 26px; }
}
.site-footer .widget { min-width: 0; }
.site-footer .widget-title {
    color: var(--footer-head);
    font-size: 1.05rem;
    margin: 0 0 14px;
}
.site-footer .widget,
.site-footer .widget p,
.site-footer .widget li {
    color: var(--footer-ink);
}
.site-footer .widget a { color: #fff; }
.site-footer .widget a:hover { color: var(--brand-soft); }
.site-footer .widget ul { list-style: none; margin: 0; padding: 0; }
.site-footer .widget li {
    padding: 7px 0;
    border-bottom: 1px solid var(--footer-line);
}
.site-footer .widget li:last-child { border-bottom: none; }
.site-footer .post-date { color: #9fb6bf; font-size: 0.8rem; display: block; }

.site-copyright {
    border-top: 1px solid var(--footer-line);
    padding: 20px 0;
    font-size: 0.85rem;
    color: #9fb6bf;
}

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

.cookie-banner {
    position: fixed;
    left: 16px;
    right: 16px;
    bottom: 16px;
    z-index: 999;
    background: #14222a;
    color: #e8eff1;
    border-radius: var(--radius);
    padding: 16px 20px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: center;
    gap: 18px;
    flex-wrap: wrap;
    max-width: 760px;
    margin-inline: auto;
}
.cookie-banner p { margin: 0; flex: 1; min-width: 220px; font-size: 0.9rem; }
.cookie-banner a { color: #8fe0d6; }
.cookie-banner .btn { white-space: nowrap; }

/* ===== Адаптив навигации ===== */
@media (max-width: 720px) {
    .nav-toggle { display: inline-block; }
    .main-nav {
        flex-basis: 100%;
        margin-left: 0;
        display: none;
    }
    .main-nav.is-open { display: block; }
    .main-nav ul { flex-direction: column; gap: 4px; }
    .main-nav a { padding: 11px 14px; }
    h1, .entry-title { font-size: 1.6rem; }
    .split, .entry { padding: 22px; }
}
