/*
Theme Name: dds_sevmialc.ru
Author: Анна Горелова
Description: Информационно-обзорный медицинский портал в эстетике японского минимализма (wabi-sabi): асимметрия, воздух, тактильная утончённость. Достоверные образовательные статьи, сравнения и независимые обзоры.
Version: 1.1
Requires at least: 6.0
Requires PHP: 8.0
Text Domain: sevmialc
*/

/* ==========================================================================
   Переменные
   ========================================================================== */
:root {
    --bg: #FAF9F6;
    --bg-alt: #F2EFE9;
    --text: #2C2A29;
    --accent: #B8543A;
    --accent2: #6F8C7B;
    --muted: #8C8883;
    --border: #E5DFD8;
    --shell: min(92%, 1180px);
    --head-font: "Futura", "Century Gothic", "Segoe UI", "Roboto", system-ui, sans-serif;
    --body-font: "Segoe UI", "Roboto", "Helvetica Neue", Arial, sans-serif;
}

/* ==========================================================================
   Сброс и базовые стили
   ========================================================================== */
*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
    margin: 0;
    background-color: var(--bg);
    /* Тонкая текстура "washi paper" — неравномерные линии низкого контраста */
    background-image:
        repeating-linear-gradient(90deg, rgba(44,42,41,0.018) 0 1px, transparent 1px 34px),
        repeating-linear-gradient(0deg, rgba(44,42,41,0.014) 0 1px, transparent 1px 41px);
    color: var(--text);
    font-family: var(--body-font);
    font-size: 17px;
    line-height: 1.75;
    letter-spacing: 0.015em;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

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

a { color: var(--text); text-decoration: none; }

.shell {
    width: var(--shell);
    margin-inline: auto;
}

/* ==========================================================================
   Типографика
   ========================================================================== */
h1, h2, h3, h4 {
    font-family: var(--head-font);
    color: var(--text);
    line-height: 1.15;
    font-weight: 600;
    letter-spacing: -0.01em;
    margin: 0 0 0.6em;
}

h1 {
    font-size: 3.8rem;
    font-stretch: condensed;
    letter-spacing: -0.03em;
}

h2 { font-size: 2.1rem; }
h3 { font-size: 1.4rem; }
h4 { font-size: 1.15rem; }

p { margin: 0 0 1.15em; }

/* Заголовок секции: тонкая линия строго над текстом, по ширине текста, слева */
.section-title {
    display: inline-block;
    border-top: 1px solid var(--accent);
    padding-top: 0.7rem;
    margin: 0 0 1.6rem;
}

/* Асимметрия: левый паддинг больше правого — авторская подпись */
.prose { padding-left: 1.1rem; padding-right: 0; }

/* "Капля достоверности" — квадратная точка шалфея в конце тезиса */
.prose > p:last-child::after,
.thesis::after {
    content: "\25A0";
    color: var(--accent2);
    font-size: 0.6em;
    margin-left: 0.5em;
    vertical-align: 0.15em;
}

/* Цитаты — вертикальная линия терракоты, выступающая за текст */
blockquote {
    margin: 1.8rem 0 1.8rem -1.2rem;
    padding: 0.2rem 0 0.2rem 1.6rem;
    border-left: 3px solid var(--accent);
    font-family: var(--head-font);
    font-weight: 300;
    font-size: 1.25rem;
    color: var(--text);
}

/* ==========================================================================
   Кнопки и ссылки
   ========================================================================== */
.btn {
    display: inline-block;
    padding: 0.7rem 1.6rem;
    border: 1px solid var(--accent);
    border-radius: 2px;
    background: transparent;
    color: var(--accent);
    font-family: var(--head-font);
    font-weight: 600;
    letter-spacing: 0.02em;
    cursor: pointer;
    transition: background-color .25s ease, color .25s ease;
}
.btn:hover, .btn:focus { background: var(--accent); color: #fff; }

.btn-solid {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}
.btn-solid:hover, .btn-solid:focus { background: #9d4531; border-color: #9d4531; }

/* Текстовая ссылка — подчёркивание "вырастает" из центра */
.text-link {
    position: relative;
    color: var(--text);
    transition: color .2s ease;
}
.text-link::after {
    content: "";
    position: absolute;
    left: 0; right: 0; bottom: -2px;
    height: 1px;
    background: var(--accent);
    transform: scaleX(0);
    transition: transform .28s ease;
}
.text-link:hover { color: var(--accent); }
.text-link:hover::after { transform: scaleX(1); }

/* Ссылки внутри контента записей */
.entry-content a { color: var(--accent); border-bottom: 1px solid transparent; transition: border-color .2s ease; }
.entry-content a:hover { border-bottom-color: var(--accent); }

/* ==========================================================================
   Шапка
   ========================================================================== */
.site-header {
    background: var(--bg);
    padding: 1.6rem 0 1.3rem;
    border-bottom: 1px solid var(--border);
}
.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 2rem;
    flex-wrap: wrap;
}
.branding { display: flex; align-items: center; gap: 1rem; min-width: 0; }
.branding .brand-logo, .branding .logo-fallback { flex: 0 0 auto; display: block; }
.branding .logo-fallback svg { display: block; }
.brand-text { min-width: 0; }
.site-title {
    font-family: var(--head-font);
    font-size: 1.05rem;
    font-weight: 600;
    line-height: 1.3;
    margin: 0;
    max-width: 46ch;
}
.site-title a { color: var(--text); }
.site-desc {
    margin: 0.3rem 0 0;
    font-size: 0.82rem;
    color: var(--muted);
    max-width: 54ch;
    line-height: 1.5;
}

/* Навигация — не липкая */
.main-nav ul {
    list-style: none;
    display: flex;
    gap: 1.6rem;
    margin: 0;
    padding: 0;
    flex-wrap: wrap;
}
.main-nav a {
    position: relative;
    font-family: var(--head-font);
    font-weight: 600;
    font-size: 0.98rem;
    color: var(--text);
    padding-bottom: 3px;
}
.main-nav a::after {
    content: "";
    position: absolute;
    left: 0; right: 0; bottom: 0;
    height: 1px;
    background: var(--accent);
    transform: scaleX(0);
    transition: transform .28s ease;
}
.main-nav a:hover { color: var(--accent); }
.main-nav a:hover::after { transform: scaleX(1); }
.current-menu-item > a { color: var(--accent); }

.nav-toggle {
    display: none;
    background: none;
    border: 1px solid var(--border);
    border-radius: 2px;
    padding: 0.5rem 0.7rem;
    cursor: pointer;
    font-size: 1.1rem;
    color: var(--text);
}

/* ==========================================================================
   Раскладка контента
   ========================================================================== */
.site-main { padding: 3rem 0 4rem; }

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

.breadcrumbs {
    font-size: 0.85rem;
    color: var(--muted);
    margin-bottom: 1.8rem;
}
.breadcrumbs a { color: var(--muted); }
.breadcrumbs a:hover { color: var(--accent); }
.breadcrumbs .sep { margin: 0 0.35rem; color: var(--border); }

/* ==========================================================================
   Сайдбар
   ========================================================================== */
.sidebar { background: transparent; padding-left: 0.4rem; }
.sidebar .widget { margin-bottom: 2.4rem; }
.widget-title {
    font-size: 1.05rem;
    margin: 0 0 1rem;
    padding-top: 0.6rem;
    border-top: 1px solid var(--accent);
    display: inline-block;
    color: var(--text);
}
.sidebar .widget, .sidebar .widget a { color: var(--text); }
.sidebar ul { list-style: none; margin: 0; padding: 0; }
.sidebar li { padding: 0.5rem 0; border-bottom: 1px solid var(--border); font-size: 0.95rem; }
.sidebar li:last-child { border-bottom: none; }
.sidebar a:hover { color: var(--accent); }

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

.card {
    display: flex;
    flex-direction: column;
    border: 1px solid var(--border);
    border-radius: 0;
    background: var(--bg);
    overflow: hidden;
    transition: border-color .25s ease;
}
.card:hover { border-color: var(--accent2); }

.card-thumb-wrap { position: relative; overflow: hidden; }
.card-thumb-wrap a { display: block; }
.card-thumb-wrap img {
    width: 100%;
    height: auto;
    aspect-ratio: 16 / 10;
    object-fit: cover;
    display: block;
}
.card-thumb-wrap::after {
    content: "";
    position: absolute;
    inset: 0;
    background: rgba(44,42,41,0);
    transition: background-color .25s ease;
    pointer-events: none;
}
.card:hover .card-thumb-wrap::after { background: rgba(44,42,41,0.12); }

.card-body { flex: 1; padding: 1.4rem 1.5rem 1.6rem; display: flex; flex-direction: column; }
.card-title { font-size: 1.2rem; margin: 0 0 0.5rem; }
.card-title a { color: var(--text); }
.card-title a:hover { color: var(--accent); }
.card-meta { font-size: 0.8rem; color: var(--muted); margin-bottom: 0.7rem; }
.card-excerpt { color: var(--text); font-size: 0.95rem; margin-bottom: 1.1rem; }
.card-excerpt p { margin: 0 0 0.5em; background: none; }
.card-more { margin-top: auto; }
.card-more a {
    font-family: var(--head-font);
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--accent);
}
.card-more a:hover { text-decoration: underline; }

/* ==========================================================================
   Пагинация (D5)
   ========================================================================== */
.pagination {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 2.6rem;
}
.pagination .page-numbers {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 42px;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: 2px;
    font-family: var(--head-font);
    font-weight: 600;
    color: var(--text);
    transition: background-color .2s ease, color .2s ease, border-color .2s ease;
}
.pagination a.page-numbers:hover { border-color: var(--accent); color: var(--accent); }
.pagination .page-numbers.current { background: var(--accent); border-color: var(--accent); color: #fff; }
.pagination .page-numbers.dots { border: none; }

/* ==========================================================================
   Записи / контент
   ========================================================================== */
.entry-header { margin-bottom: 1.6rem; }
.entry-title { font-size: 2.6rem; margin-bottom: 0.6rem; }
.entry-meta { font-size: 0.85rem; color: var(--muted); }
.entry-content { padding-left: 1.1rem; }
.entry-content img { border-radius: 0; margin: 1.4rem 0; }
.entry-content h2, .entry-content h3 { margin-top: 1.8rem; }
.entry-thumb { margin-bottom: 1.8rem; }
.entry-thumb img { width: 100%; object-fit: cover; display: block; aspect-ratio: 21 / 9; }

/* Таблицы */
.entry-content table { width: 100%; border-collapse: collapse; margin: 1.5rem 0; }
.entry-content table, .entry-content th, .entry-content td { border: 1px solid var(--border); }
.entry-content th, .entry-content td { padding: 0.7rem 0.9rem; text-align: left; }
.entry-content th { background: var(--bg-alt); font-family: var(--head-font); }

/* ==========================================================================
   Главная страница
   ========================================================================== */
.front-section { padding: 4.5rem 0; }
.front-section.alt-bg { background: var(--bg-alt); }
.front-shell {
    width: var(--shell);
    margin-inline: auto;
}

/* --- Блок 1 — Герой --- */
.fs-hero { padding: 5rem 0 4.5rem; position: relative; overflow: hidden; }
.fs-hero::before {
    content: "";
    position: absolute;
    top: -80px; right: -60px;
    width: 380px; height: 380px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 200 200'%3E%3Cpath fill='%23B8543A' d='M100 20c22 0 30 18 30 40 0 18 10 22 20 34 12 14 18 30 6 46-12 16-34 12-56 12s-44 4-56-12c-12-16-6-32 6-46 10-12 20-16 20-34 0-22 8-40 30-40z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-size: contain;
    opacity: 0.035;
    pointer-events: none;
}
.fs-hero-inner {
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
    gap: 4rem;
    align-items: center;
}
.fs-hero-content h2 {
    font-size: 3.4rem;
    font-stretch: condensed;
    letter-spacing: -0.025em;
    line-height: 1.08;
    margin-bottom: 1.2rem;
}
.fs-hero-content p {
    color: var(--muted);
    max-width: 44ch;
    font-size: 1.05rem;
}
.fs-hero-content .thesis {
    color: var(--text);
    font-weight: 500;
    margin-top: 0.6rem;
}
.fs-hero-visual {
    display: flex;
    justify-content: center;
}
.fs-hero-visual svg {
    width: 100%;
    max-width: 360px;
    height: auto;
    display: block;
}
.pulse-line {
    stroke-dasharray: 600;
    stroke-dashoffset: 600;
    animation: drawPulse 2.4s ease-out 0.5s forwards;
}
@keyframes drawPulse {
    to { stroke-dashoffset: 0; }
}

/* --- Блок 2 — Направления (3 колонки) --- */
.fs-rubrics .rubric-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 2rem;
}
.rubric-card {
    display: block;
    padding: 2rem 1.6rem 2.2rem;
    color: var(--text);
    border: 1px solid var(--border);
    background: var(--bg);
    transition: border-color .25s ease, box-shadow .25s ease;
}
.rubric-card:hover {
    border-color: var(--accent2);
    box-shadow: 0 4px 20px rgba(111, 140, 123, 0.1);
}
.rubric-icon-wrap {
    width: 56px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-alt);
    border-radius: 50%;
    margin-bottom: 1.2rem;
}
.rubric-card .rubric-icon { width: 32px; height: 32px; display: block; }
.rubric-card h3 { margin-bottom: 0.5rem; font-size: 1.25rem; }
.rubric-card p { color: var(--muted); font-size: 0.92rem; margin: 0; line-height: 1.6; }

/* --- Блок 3 — Цитата --- */
.fs-quote { position: relative; padding: 5rem 0; }
.fs-quote .quote-wrap {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 1.5rem;
    max-width: 680px;
}
.fs-quote .quote-line {
    width: 48px;
    height: 3px;
    background: var(--accent);
    flex-shrink: 0;
}
.fs-quote .quote-text {
    font-family: var(--head-font);
    font-weight: 300;
    font-size: 2.2rem;
    line-height: 1.35;
    margin: 0;
    color: var(--text);
}

/* --- Блок 4 — Разделы (плашки 2×2) --- */
.fs-topics .topic-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1.2rem;
}
.topic-tile {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.8rem 2rem;
    border: 1px solid var(--border);
    color: var(--text);
    font-family: var(--head-font);
    font-size: 1.35rem;
    font-weight: 600;
    transition: background-color .25s ease, color .25s ease, border-color .25s ease;
}
.topic-tile:hover { background: var(--accent); color: #fff; border-color: var(--accent); }
.topic-tile .topic-arrow {
    font-size: 1.1rem;
    opacity: 0;
    transform: translateX(-6px);
    transition: opacity .25s ease, transform .25s ease;
}
.topic-tile:hover .topic-arrow { opacity: 1; transform: translateX(0); }

/* Секция последних записей на главной */
.fs-latest .cards-list { grid-template-columns: repeat(3, minmax(0, 1fr)); }

/* ==========================================================================
   Подвал
   ========================================================================== */
.site-footer {
    background: var(--bg-alt);
    padding: 3.4rem 0 1.8rem;
    margin-top: 2rem;
    color: var(--text);
}
.footer-cols {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 2.5rem;
}
.footer-cols .widget-title { color: var(--text); }
.footer-cols .widget, .footer-cols .widget a, .footer-cols .widget p, .footer-cols .widget li { color: var(--text); }
.footer-cols ul { list-style: none; margin: 0; padding: 0; }
.footer-cols li { padding: 0.35rem 0; }
.footer-cols a:hover { color: var(--accent); }
.site-copyright {
    margin-top: 2.6rem;
    padding-top: 1.4rem;
    border-top: 1px solid var(--border);
    font-size: 0.82rem;
    color: var(--muted);
    text-align: center;
}

/* ==========================================================================
   Формы (поиск, комментарии)
   ========================================================================== */
.search-form { display: flex; gap: 0.5rem; }
.search-form input[type="search"] {
    flex: 1;
    padding: 0.6rem 0.8rem;
    border: 1px solid var(--border);
    border-radius: 2px;
    background: var(--bg);
    color: var(--text);
    font-family: var(--body-font);
    min-width: 0;
}
.search-form button {
    padding: 0.6rem 1.1rem;
    border: 1px solid var(--accent);
    border-radius: 2px;
    background: transparent;
    color: var(--accent);
    font-family: var(--head-font);
    font-weight: 600;
    cursor: pointer;
    transition: background-color .2s ease, color .2s ease;
}
.search-form button:hover { background: var(--accent); color: #fff; }

.comments-area { margin-top: 3rem; padding-top: 1.5rem; border-top: 1px solid var(--border); }
.comments-title { margin-bottom: 1.5rem; }
.comment-list { list-style: none; margin: 0 0 2rem; padding: 0; }
.comment-list ul.children { list-style: none; margin: 0 0 0 1.6rem; padding: 0; }
.comment-body { padding: 1.1rem 0; border-bottom: 1px solid var(--border); }
.comment-meta { font-size: 0.85rem; color: var(--muted); margin-bottom: 0.5rem; display: flex; gap: 1rem; }
.comment-author { font-weight: 600; color: var(--text); }
.comment-reply a { color: var(--accent); font-size: 0.85rem; }

.comment-respond { margin-top: 1.5rem; }
.comment-form input[type="text"],
.comment-form input[type="email"],
.comment-form input[type="url"],
.comment-form textarea {
    width: 100%;
    padding: 0.6rem 0.8rem;
    border: 1px solid var(--border);
    border-radius: 2px;
    background: var(--bg);
    color: var(--text);
    font-family: var(--body-font);
    margin-bottom: 1rem;
}
.comment-form .submit {
    padding: 0.7rem 1.6rem;
    border: 1px solid var(--accent);
    border-radius: 2px;
    background: transparent;
    color: var(--accent);
    font-family: var(--head-font);
    font-weight: 600;
    cursor: pointer;
    transition: background-color .2s ease, color .2s ease;
}
.comment-form .submit:hover { background: var(--accent); color: #fff; }

/* ==========================================================================
   404
   ========================================================================== */
.error-404 { text-align: left; padding-left: 1.1rem; }
.error-404 h1 { font-size: 5rem; color: var(--accent); }

/* ==========================================================================
   Контактный блок (статичный, без форм и телефона)
   ========================================================================== */
.contact-block a { color: var(--accent); }

/* ==========================================================================
   Cookie-баннер (D6, A11)
   ========================================================================== */
.cookie-banner[hidden] { display: none !important; }
.cookie-banner {
    position: fixed;
    left: 0; right: 0; bottom: 0;
    z-index: 999;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.5rem;
    flex-wrap: wrap;
    padding: 1rem 1.5rem;
    background: var(--text);
    color: #FAF9F6;
    font-size: 0.9rem;
}
.cookie-banner p { margin: 0; max-width: 70ch; }
.cookie-banner a { color: #fff; text-decoration: underline; }
.cookie-banner .cookie-accept {
    padding: 0.55rem 1.4rem;
    border: 1px solid #FAF9F6;
    border-radius: 2px;
    background: transparent;
    color: #FAF9F6;
    font-family: var(--head-font);
    font-weight: 600;
    cursor: pointer;
    transition: background-color .2s ease, color .2s ease;
    white-space: nowrap;
}
.cookie-banner .cookie-accept:hover { background: #FAF9F6; color: var(--text); }

/* ==========================================================================
   Адаптив
   ========================================================================== */
@media (max-width: 960px) {
    h1 { font-size: 3rem; }
    .layout-with-sidebar { grid-template-columns: 1fr; gap: 2.5rem; }
    .layout-single .content-area { width: 100%; }
    .fs-hero-inner { grid-template-columns: 1fr; gap: 2.5rem; }
    .fs-hero-visual { max-width: 320px; }
    .fs-rubrics .rubric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .fs-latest .cards-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 600px) {
    body { font-size: 16px; }
    h1 { font-size: 2.4rem; }
    .entry-title { font-size: 2rem; }
    .fs-hero-content h2 { font-size: 2.4rem; }
    .main-nav { width: 100%; }
    .main-nav ul {
        display: none;
        flex-direction: column;
        gap: 0.4rem;
        margin-top: 1rem;
    }
    .main-nav.open ul { display: flex; }
    .nav-toggle { display: inline-block; }
    .header-inner { align-items: flex-start; }
    .cards-list,
    .fs-latest .cards-list,
    .fs-rubrics .rubric-grid,
    .fs-topics .topic-grid { grid-template-columns: 1fr; }
    .footer-cols { grid-template-columns: 1fr; gap: 1.8rem; }
    .fs-quote .quote-text { font-size: 1.6rem; }
    .fs-quote { padding: 3.5rem 0; }
    .front-section { padding: 3rem 0; }
    .fs-hero { padding: 3rem 0; }
    .topic-tile { padding: 1.4rem 1.6rem; font-size: 1.15rem; }
    .topic-tile .topic-arrow { opacity: 1; transform: translateX(0); }
}
