/*
Theme Name: dds_scalpel-practicum.ru
Author: Алексей Новиков
Description: Информационно-образовательная тема о научных методах реабилитации после хирургических вмешательств.
Version: 1.1
Requires at least: 6.0
Requires PHP: 8.0
Text Domain: scpract
*/

/* ====================================================================
   Переменные и базовый сброс
   ==================================================================== */
:root {
    --bg: #f3f8f7;
    --surface: #ffffff;
    --primary: #0f6b6b;
    --primary-dark: #0b5252;
    --accent: #2a9d8f;
    --accent-soft: #e3f3ef;
    --ink: #1c2a2a;
    --muted: #56696a;
    --line: #d7e6e3;
    --footer-bg: #0b2b2b;
    --footer-ink: #d2e7e2;
    --footer-muted: #8fb6af;
    --sidebar-bg: #ffffff;
    --shadow: 0 2px 14px rgba(15, 107, 107, 0.08);
    --radius: 12px;
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

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

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

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

a:hover {
    text-decoration: underline;
}

h1, h2, h3, h4 {
    line-height: 1.25;
    color: var(--ink);
    margin: 0 0 0.6em;
}

h1 { font-size: 2rem; }
h2 { font-size: 1.55rem; }
h3 { font-size: 1.2rem; }

p {
    margin: 0 0 1.1em;
}

/* ====================================================================
   Контейнер ширины (единый источник — A12.7)
   ==================================================================== */
.shell {
    width: min(92%, 1180px);
    margin-inline: auto;
}

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

.header-top {
    display: flex;
    align-items: center;
    gap: 18px;
    padding: 18px 0;
    flex-wrap: wrap;
}

.site-branding {
    display: flex;
    align-items: center;
    gap: 14px;
    min-width: 0;
    flex: 1;
}

.brand-logo,
.brand-mark {
    flex: 0 0 auto;
    display: block;
    border-radius: 10px;
}

.brand-text {
    min-width: 0;
}

.site-title {
    font-size: 1.05rem;
    font-weight: 700;
    margin: 0;
    line-height: 1.3;
    color: var(--ink);
}

.site-title a {
    color: inherit;
}

.site-description {
    font-size: 0.83rem;
    color: var(--muted);
    margin: 4px 0 0;
    line-height: 1.4;
}

/* Навигация (не липкая) */
.main-nav {
    background: var(--primary);
}

.nav-inner {
    display: flex;
    align-items: center;
}

.nav-toggle {
    display: none;
    background: none;
    border: 0;
    color: #fff;
    font-size: 1rem;
    padding: 14px 0;
    cursor: pointer;
    align-items: center;
    gap: 8px;
}

.nav-toggle .bars {
    display: inline-block;
    width: 22px;
    height: 2px;
    background: #fff;
    position: relative;
}

.nav-toggle .bars::before,
.nav-toggle .bars::after {
    content: "";
    position: absolute;
    left: 0;
    width: 22px;
    height: 2px;
    background: #fff;
}

.nav-toggle .bars::before { top: -7px; }
.nav-toggle .bars::after { top: 7px; }

.main-nav ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
}

.main-nav li {
    margin: 0;
}

.main-nav a {
    display: block;
    color: #fff;
    padding: 14px 18px;
    font-weight: 600;
    font-size: 0.97rem;
}

.main-nav a:hover {
    background: var(--primary-dark);
    text-decoration: none;
}

/* ====================================================================
   Раскладки
   ==================================================================== */
.site-main {
    padding: 32px 0 48px;
}

.layout-with-sidebar {
    display: grid;
    grid-template-columns: 67% 27%;
    gap: 6%;
    align-items: start;
}

.layout-single .content-area,
.layout-narrow {
    width: 85%;
    margin-left: auto;
    margin-right: auto;
}

.content-area {
    min-width: 0;
}

/* ====================================================================
   Хлебные крошки
   ==================================================================== */
.breadcrumbs {
    font-size: 0.86rem;
    color: var(--muted);
    margin-bottom: 22px;
    line-height: 1.6;
}

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

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

/* ====================================================================
   Слайдер (hero) — главная
   ==================================================================== */
.hero-slider {
    position: relative;
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    margin-bottom: 40px;
    background: #0c4a4a;
}

.slides {
    position: relative;
}

.slide {
    display: none;
    position: relative;
}

.slide.is-active {
    display: block;
}

.slide img {
    display: block;
    width: 100%;
    height: 100%;
    aspect-ratio: 16 / 7;
    object-fit: cover;
}

.slide-caption {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 28px 32px;
    background: linear-gradient(to top, rgba(7, 38, 38, 0.85), rgba(7, 38, 38, 0));
    color: #fff;
}

.slide-caption h2 {
    color: #fff;
    margin: 0 0 6px;
    font-size: 1.45rem;
}

.slide-caption p {
    margin: 0;
    color: #e1f1ed;
    max-width: 640px;
}

.slider-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.85);
    border: 0;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    font-size: 1.3rem;
    color: var(--primary-dark);
    cursor: pointer;
    z-index: 2;
    line-height: 1;
}

.slider-btn:hover { background: #fff; }
.slider-prev { left: 14px; }
.slider-next { right: 14px; }

.slider-dots {
    position: absolute;
    bottom: 14px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 8px;
    z-index: 2;
}

.slider-dots button {
    width: 11px;
    height: 11px;
    border-radius: 50%;
    border: 0;
    background: rgba(255, 255, 255, 0.5);
    cursor: pointer;
    padding: 0;
}

.slider-dots button.is-active {
    background: #fff;
}

/* ====================================================================
   Тематические секции главной
   ==================================================================== */
.home-section {
    margin-bottom: 46px;
}

.home-section .section-head {
    margin-bottom: 22px;
}

.home-section .section-head h2 {
    margin-bottom: 6px;
}

.home-section .section-head p {
    color: var(--muted);
    margin: 0;
}

.feature-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 22px;
}

.feature {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow);
    min-width: 0;
}

.feature .feature-icon {
    width: 52px;
    height: 52px;
    margin-bottom: 14px;
    display: block;
}

.feature h3 {
    margin-bottom: 8px;
}

.feature p {
    color: var(--muted);
    margin: 0;
    font-size: 0.96rem;
}

.steps-band {
    background: var(--accent-soft);
    border-radius: var(--radius);
    padding: 30px;
}

.steps-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 24px;
}

.step {
    min-width: 0;
}

.step .step-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    font-weight: 700;
    margin-bottom: 12px;
}

.step h3 {
    margin-bottom: 6px;
    font-size: 1.08rem;
}

.step p {
    color: var(--muted);
    margin: 0;
    font-size: 0.95rem;
}

.section-illustration {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    align-items: center;
}

.section-illustration .illu-media {
    min-width: 0;
}

.section-illustration img {
    width: 100%;
    border-radius: var(--radius);
    display: block;
    box-shadow: var(--shadow);
}

.section-illustration .illu-text {
    min-width: 0;
}

.section-illustration ul {
    margin: 14px 0 0;
    padding-left: 20px;
    color: var(--muted);
}

.section-illustration li {
    margin-bottom: 8px;
}

/* Лента последних записей на главной */
.home-latest .posts-row {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 24px;
}

/* ====================================================================
   Карточки записей (A8, A10)
   ==================================================================== */
.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 {
    display: block;
    overflow: hidden;
}

.card-thumb img {
    display: block;
    width: 100%;
    aspect-ratio: 16 / 9;
    object-fit: cover;
}

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

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

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

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

.card-meta {
    font-size: 0.82rem;
    color: var(--muted);
    margin-bottom: 10px;
}

.card-excerpt {
    color: var(--muted);
    font-size: 0.96rem;
    margin-bottom: 14px;
}

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

.card-more {
    margin-top: auto;
    align-self: flex-start;
    font-weight: 600;
    color: var(--primary);
}

/* Горизонтальная карточка (список блога / архивы) — A10 */
.card-row {
    flex-direction: row;
}

.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;
}

.post-list {
    display: flex;
    flex-direction: column;
    gap: 22px;
    margin-bottom: 30px;
}

/* ====================================================================
   Одиночная запись / страница
   ==================================================================== */
.entry {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 30px;
    box-shadow: var(--shadow);
    margin-bottom: 28px;
}

.entry-header h1 {
    margin-bottom: 10px;
}

.entry-meta {
    font-size: 0.85rem;
    color: var(--muted);
    margin-bottom: 18px;
}

.entry-thumb {
    margin: 0 0 22px;
}

.entry-thumb img {
    width: 100%;
    border-radius: var(--radius);
    display: block;
}

.entry-content {
    min-width: 0;
}

.entry-content img {
    height: auto;
    border-radius: 8px;
}

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

.entry-content ul,
.entry-content ol {
    padding-left: 22px;
}

.entry-content blockquote {
    margin: 1.4em 0;
    padding: 14px 20px;
    border-left: 4px solid var(--accent);
    background: var(--accent-soft);
    color: var(--ink);
}

/* Таблицы */
.entry-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.4em 0;
    border: 1px solid var(--line);
}

.entry-content th,
.entry-content td {
    border: 1px solid var(--line);
    padding: 10px 12px;
    text-align: left;
}

.entry-content th {
    background: var(--accent-soft);
}

.tags-line {
    margin-top: 22px;
    font-size: 0.88rem;
    color: var(--muted);
}

.tags-line a {
    display: inline-block;
    margin: 0 6px 6px 0;
    padding: 3px 10px;
    background: var(--accent-soft);
    border-radius: 20px;
    color: var(--primary-dark);
}

/* ====================================================================
   Сайдбар и виджеты
   ==================================================================== */
.sidebar {
    min-width: 0;
}

.widget {
    background: var(--sidebar-bg);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 22px;
    margin-bottom: 24px;
    box-shadow: var(--shadow);
    color: var(--ink);
}

.widget,
.widget a,
.widget li,
.widget .post-date {
    color: var(--ink);
}

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

.widget-title {
    font-size: 1.1rem;
    margin: 0 0 14px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--accent-soft);
    color: var(--ink);
}

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

.widget li {
    padding: 8px 0;
    border-bottom: 1px dashed var(--line);
}

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

.widget .post-date {
    display: block;
    font-size: 0.78rem;
    color: var(--muted);
}

/* ====================================================================
   Пагинация (D5 — type=plain → .page-numbers)
   ==================================================================== */
.pager {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
    margin: 30px 0 10px;
}

.pager .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: 8px;
    background: var(--surface);
    color: var(--primary-dark);
    font-weight: 600;
    text-decoration: none;
}

.pager a.page-numbers:hover {
    background: var(--accent-soft);
    text-decoration: none;
}

.pager .page-numbers.current {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}

.pager .page-numbers.dots {
    border: 0;
    background: none;
}

/* ====================================================================
   Формы поиска и комментарии
   ==================================================================== */
.search-form {
    display: flex;
    gap: 8px;
}

.search-form input[type="search"] {
    flex: 1;
    min-width: 0;
    padding: 11px 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    font-size: 0.95rem;
}

.search-form button {
    padding: 11px 18px;
    border: 0;
    border-radius: 8px;
    background: var(--primary);
    color: #fff;
    cursor: pointer;
    font-weight: 600;
}

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

.comments-area {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 30px;
    box-shadow: var(--shadow);
}

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

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

.comment-item {
    margin-bottom: 18px;
}

.comment-body {
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 16px 18px;
}

.comment-meta {
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 6px;
    font-size: 0.85rem;
    margin-bottom: 8px;
}

.comment-author {
    font-weight: 700;
}

.comment-date {
    color: var(--muted);
}

.comment-form label {
    display: block;
    margin-bottom: 4px;
    font-weight: 600;
    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(--line);
    border-radius: 8px;
    font-size: 0.95rem;
    margin-bottom: 14px;
    font-family: inherit;
}

.comment-form .submit {
    padding: 11px 22px;
    background: var(--primary);
    color: #fff;
    border: 0;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
}

/* ====================================================================
   Страница контактов / статичные контакты
   ==================================================================== */
.contact-block {
    margin-top: 16px;
}

.contact-block a {
    font-weight: 600;
}

.social-links {
    list-style: none;
    padding: 0;
    margin: 14px 0 0;
    display: flex;
    gap: 14px;
    flex-wrap: wrap;
}

.social-links a {
    display: inline-block;
    padding: 8px 16px;
    border: 1px solid var(--line);
    border-radius: 20px;
}

/* ====================================================================
   404
   ==================================================================== */
.error-404 {
    text-align: center;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 50px 30px;
    box-shadow: var(--shadow);
}

.error-404 .big {
    font-size: 4rem;
    color: var(--accent);
    margin: 0;
}

.error-404 .search-form {
    max-width: 460px;
    margin: 22px auto 0;
}

/* ====================================================================
   Подвал
   ==================================================================== */
.site-footer {
    background: var(--footer-bg);
    color: var(--footer-ink);
    padding: 44px 0 0;
    margin-top: 40px;
}

.footer-cols {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 30px;
}

.footer-cols .widget {
    background: transparent;
    border: 0;
    box-shadow: none;
    padding: 0;
    color: var(--footer-ink);
}

.footer-cols .widget,
.footer-cols .widget li,
.footer-cols .widget p {
    color: var(--footer-ink);
}

.footer-cols .widget a {
    color: var(--footer-ink);
}

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

.footer-cols .widget-title {
    color: #fff;
    border-bottom-color: rgba(255, 255, 255, 0.18);
}

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

.footer-cols .widget .post-date {
    color: var(--footer-muted);
}

.site-credits {
    border-top: 1px solid rgba(255, 255, 255, 0.14);
    margin-top: 36px;
    padding: 20px 0;
    font-size: 0.85rem;
    color: var(--footer-muted);
    text-align: center;
}

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

.cookie-banner {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 999;
    background: #07292a;
    color: #e6f4f0;
    padding: 16px 0;
    box-shadow: 0 -2px 14px rgba(0, 0, 0, 0.2);
}

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

.cookie-inner p {
    margin: 0;
    font-size: 0.9rem;
    flex: 1;
    min-width: 240px;
}

.cookie-inner a {
    color: #9be7d8;
}

.cookie-accept {
    padding: 10px 22px;
    background: var(--accent);
    color: #06302b;
    border: 0;
    border-radius: 8px;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
}

.cookie-accept:hover {
    background: #36b3a3;
}

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

    .layout-single .content-area,
    .layout-narrow {
        width: 100%;
    }

    .feature-grid,
    .steps-grid,
    .home-latest .posts-row {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .section-illustration {
        grid-template-columns: 1fr;
    }
}

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

    h1 { font-size: 1.6rem; }
    h2 { font-size: 1.3rem; }

    .nav-toggle {
        display: inline-flex;
    }

    .main-nav ul {
        display: none;
        flex-direction: column;
        width: 100%;
    }

    .main-nav ul.is-open {
        display: flex;
    }

    .main-nav a {
        border-top: 1px solid var(--primary-dark);
    }

    .feature-grid,
    .steps-grid,
    .home-latest .posts-row,
    .footer-cols {
        grid-template-columns: 1fr;
    }

    /* A10 — сброс абсолютного позиционирования горизонтальных карточек */
    .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;
    }

    .slide-caption {
        padding: 16px 18px;
        position: static;
        background: #0c4a4a;
    }

    .slide-caption h2 { font-size: 1.15rem; }
}
