/*
Theme Name: dds_dokafilms.ru
Author: Дмитрий Кольцов
Description: Информационная тема для научно-просветительского портала о документальном кино и науке.
Version: 1.1
Text Domain: dokafilms
*/

:root {
    --ink: #13243d;
    --ink-2: #1d3554;
    --teal: #5fb3a3;
    --teal-2: #2e7d72;
    --amber: #e0a458;
    --amber-dark: #c98a3c;
    --paper: #f4f1ea;
    --surface: #ffffff;
    --text: #1c2b3a;
    --muted: #5c6b7a;
    --mist: #cdd9e3;
    --border: #e0dccf;
    --maxw: 1180px;
    --radius: 14px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
    margin: 0;
    font-family: "Segoe UI", "Helvetica Neue", Arial, sans-serif;
    color: var(--text);
    background: var(--paper);
    line-height: 1.65;
    overflow-x: hidden;
}

h1, h2, h3, h4 {
    font-family: Georgia, "Times New Roman", serif;
    line-height: 1.25;
    color: var(--ink);
}

a { color: var(--teal-2); }
a:hover { color: var(--amber-dark); }

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

p { margin: 0 0 1em; }

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

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

.skip-link {
    position: absolute;
    left: -9999px;
    top: 0;
    background: var(--amber);
    color: var(--ink);
    padding: 8px 16px;
    z-index: 100;
}
.skip-link:focus { left: 8px; top: 8px; }

/* --- Кнопки --- */
.btn {
    display: inline-block;
    padding: 0.7em 1.5em;
    background: var(--teal-2);
    color: #fff;
    border: none;
    border-radius: 8px;
    font: inherit;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.2s;
}
.btn:hover { background: var(--ink-2); color: #fff; }
.btn-amber { background: var(--amber); color: var(--ink); }
.btn-amber:hover { background: var(--amber-dark); color: var(--ink); }

/* --- Шапка --- */
.site-header {
    background: var(--ink);
    color: #fff;
    padding: 16px 0;
}
.header-inner {
    display: flex;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
}
.brand {
    display: flex;
    align-items: center;
    gap: 14px;
    min-width: 0;
    flex: 1;
}
.brand-logo { display: block; border-radius: 10px; }
.brand-text { min-width: 0; }
.brand-name {
    display: block;
    font-family: Georgia, serif;
    font-size: 1.15rem;
    font-weight: 700;
    color: #fff;
    text-decoration: none;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}
.brand-desc {
    margin: 4px 0 0;
    font-size: 0.8rem;
    color: var(--mist);
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.primary-nav .menu {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}
.primary-nav a {
    display: block;
    padding: 8px 14px;
    color: #fff;
    text-decoration: none;
    border-radius: 6px;
    transition: background 0.2s;
}
.primary-nav a:hover,
.primary-nav .current-menu-item > a {
    background: var(--ink-2);
    color: var(--amber);
}

.nav-toggle {
    display: none;
    width: 44px; height: 40px;
    background: var(--ink-2);
    border: none;
    border-radius: 8px;
    cursor: pointer;
    position: relative;
}
.nav-toggle-bar,
.nav-toggle-bar::before,
.nav-toggle-bar::after {
    content: "";
    position: absolute;
    left: 11px;
    width: 22px; height: 2px;
    background: #fff;
}
.nav-toggle-bar { top: 19px; }
.nav-toggle-bar::before { top: -7px; }
.nav-toggle-bar::after { top: 7px; }

/* --- Основная область --- */
.site-main { padding: 28px 0 48px; }

.breadcrumbs {
    font-size: 0.85rem;
    color: var(--muted);
    margin-bottom: 22px;
}
.breadcrumbs a { color: var(--teal-2); text-decoration: none; }
.breadcrumbs a:hover { text-decoration: underline; }
.breadcrumbs .sep { margin: 0 6px; color: var(--mist); }

/* Раскладки */
.layout-with-sidebar {
    display: grid;
    grid-template-columns: 67% 27%;
    gap: 6%;
    align-items: start;
}
.layout-single .content-area {
    width: 85%;
    margin-left: auto;
    margin-right: auto;
}
.layout-with-sidebar .content-area { min-width: 0; }

.page-head { margin-bottom: 24px; }
.page-title { font-size: 2rem; margin: 0; }

/* --- Сетка карточек --- */
.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 26px;
}
.card {
    display: flex;
    flex-direction: column;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(19, 36, 61, 0.05);
}
.card-thumb-wrap {
    position: relative;
    overflow: hidden;
}
.card-thumb-wrap a { display: block; }
.card-thumb {
    display: block;
    width: 100%;
    aspect-ratio: 3 / 2;
    object-fit: cover;
}
.card-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 18px 20px 22px;
    min-width: 0;
}
.card-title { font-size: 1.2rem; margin: 0 0 8px; }
.card-title a { color: var(--ink); text-decoration: none; }
.card-title a:hover { color: var(--teal-2); }
.card-meta { font-size: 0.8rem; color: var(--muted); margin-bottom: 10px; }
.card-excerpt { color: var(--text); font-size: 0.95rem; }
.card-excerpt p { margin: 0 0 0.5em; background: none; }
.card-link {
    margin-top: auto;
    padding-top: 12px;
    font-weight: 600;
    color: var(--teal-2);
    text-decoration: none;
}
.card-link:hover { color: var(--amber-dark); }

.latest-more { text-align: center; margin-top: 32px; }

/* --- Hero --- */
.hero {
    position: relative;
    margin-bottom: 50px;
    border-radius: var(--radius);
    overflow: hidden;
}
.hero-bg {
    display: block;
    width: 100%;
    height: clamp(320px, 42vw, 480px);
    object-fit: cover;
}
.hero-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
}
.hero-content {
    width: min(86%, 720px);
    margin-left: clamp(20px, 6%, 80px);
    color: #fff;
}
.hero-title {
    color: #fff;
    font-size: clamp(1.5rem, 3.4vw, 2.4rem);
    margin: 0 0 14px;
    text-shadow: 0 2px 14px rgba(0, 0, 0, 0.4);
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.hero-lead {
    font-size: clamp(0.95rem, 1.4vw, 1.1rem);
    color: #eef2f6;
    text-shadow: 0 1px 8px rgba(0, 0, 0, 0.5);
    display: -webkit-box;
    -webkit-line-clamp: 4;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* --- Тематические блоки главной --- */
.block { margin: 0 0 56px; }
.block-title { font-size: clamp(1.5rem, 2.6vw, 2rem); margin: 0 0 24px; }
.block-title.centered { text-align: center; }

/* Блок 1: текст + иллюстрация */
.block-split {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
    align-items: center;
}
.block-split .split-text { min-width: 0; }
.block-split .split-media { min-width: 0; }
.block-split .split-media img {
    display: block;
    width: 100%;
    border-radius: var(--radius);
}

/* Блок 2: сетка карточек-фич */
.block-tinted {
    background: var(--ink);
    color: #eef2f6;
    border-radius: var(--radius);
    padding: 44px clamp(20px, 4%, 48px);
}
.block-tinted .block-title { color: #fff; }
.feature-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 22px;
}
.feature {
    background: var(--ink-2);
    border-radius: 10px;
    padding: 22px;
    min-width: 0;
    border-top: 3px solid var(--teal);
}
.feature h3 { color: var(--amber); margin: 0 0 8px; font-size: 1.15rem; }
.feature p { margin: 0; color: #d6dee7; font-size: 0.92rem; }

/* Блок latest */
.block-latest .muted { color: var(--muted); }

/* Блок 3: шаги */
.steps {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 26px;
    counter-reset: step;
}
.step {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 28px 24px 24px;
    position: relative;
    min-width: 0;
}
.step-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px; height: 44px;
    border-radius: 50%;
    background: var(--teal-2);
    color: #fff;
    font-weight: 700;
    font-size: 1.2rem;
    margin-bottom: 14px;
}
.step h3 { margin: 0 0 8px; font-size: 1.15rem; }
.step p { margin: 0; color: var(--muted); }

/* Блок 4: CTA */
.block-cta {
    background: linear-gradient(120deg, var(--teal-2), var(--ink-2));
    border-radius: var(--radius);
    padding: 50px clamp(20px, 5%, 60px);
    text-align: center;
    color: #fff;
}
.cta-inner { width: min(100%, 680px); margin-inline: auto; }
.block-cta .block-title { color: #fff; text-align: center; }
.block-cta p { color: #eef2f6; margin-bottom: 24px; }

/* --- Записи / страницы --- */
.single-post, .single-page {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: clamp(22px, 4%, 40px);
}
.entry-head { margin-bottom: 18px; }
.entry-title { font-size: clamp(1.6rem, 3vw, 2.2rem); margin: 0 0 10px; }
.entry-meta { font-size: 0.85rem; color: var(--muted); }
.entry-thumb { margin: 0 0 24px; }
.entry-thumb img { display: block; width: 100%; border-radius: 10px; }
.entry-content { min-width: 0; }
.entry-content img { border-radius: 8px; }
.entry-content h2 { margin-top: 1.5em; }
.entry-content pre {
    overflow-x: auto;
    background: var(--ink);
    color: #eef2f6;
    padding: 16px;
    border-radius: 8px;
}
.entry-tags { margin-top: 24px; font-size: 0.85rem; }
.entry-tags a {
    display: inline-block;
    background: var(--paper);
    border: 1px solid var(--border);
    padding: 3px 10px;
    border-radius: 20px;
    margin: 0 4px 4px 0;
    text-decoration: none;
}

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

/* --- Сайдбар --- */
.sidebar { min-width: 0; }
.sidebar .widget {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 24px;
    color: var(--text);
}
.sidebar .widget-title {
    font-size: 1.1rem;
    margin: 0 0 14px;
    color: var(--ink);
    border-bottom: 2px solid var(--teal);
    padding-bottom: 8px;
}
.sidebar .widget a { color: var(--teal-2); text-decoration: none; }
.sidebar .widget a:hover { color: var(--amber-dark); text-decoration: underline; }
.sidebar ul { list-style: none; margin: 0; padding: 0; }
.sidebar li { padding: 6px 0; border-bottom: 1px solid var(--border); }
.sidebar li:last-child { border-bottom: none; }
.sidebar .post-date { display: block; font-size: 0.78rem; color: var(--muted); }

/* --- Пагинация --- */
.pagination {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
    margin-top: 40px;
}
.pagination .page-numbers {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 42px;
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface);
    color: var(--ink);
    text-decoration: none;
    transition: background 0.2s, color 0.2s;
}
.pagination a.page-numbers:hover {
    background: var(--teal-2);
    color: #fff;
    border-color: var(--teal-2);
}
.pagination .page-numbers.current {
    background: var(--ink);
    color: #fff;
    border-color: var(--ink);
}
.pagination .page-numbers.dots {
    border: none;
    background: none;
}

/* Комментарии */
.comments-area {
    margin-top: 40px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: clamp(20px, 4%, 36px);
}
.comments-title { font-size: 1.4rem; margin: 0 0 20px; }
.comment-list { list-style: none; margin: 0 0 28px; padding: 0; }
.comment-list ol { list-style: none; padding-left: 24px; }
.comment-item { margin-bottom: 18px; }
.comment-inner {
    background: var(--paper);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 16px 18px;
}
.comment-meta { font-size: 0.82rem; color: var(--muted); margin-bottom: 8px; }
.comment-author { font-weight: 700; color: var(--ink); margin-right: 10px; }
.comment-reply { margin-top: 8px; font-size: 0.85rem; }
.comment-awaiting { color: var(--amber-dark); font-style: italic; }

.comment-form label { display: block; font-size: 0.85rem; margin-bottom: 4px; font-weight: 600; }
.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: 8px;
    font: inherit;
    margin-bottom: 14px;
    background: #fff;
}

/* Форма поиска */
.search-form {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin: 16px 0;
}
.search-field {
    flex: 1;
    min-width: 0;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font: inherit;
}
.search-submit {
    padding: 10px 18px;
    background: var(--teal-2);
    color: #fff;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font: inherit;
}
.search-submit:hover { background: var(--ink-2); }

/* 404 */
.error-404 {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: clamp(24px, 5%, 48px);
    text-align: center;
}
.error-home { margin-top: 20px; }

.muted { color: var(--muted); }
.centered { text-align: center; }

/* --- Подвал --- */
.site-footer {
    background: var(--ink);
    color: #d6dee7;
    margin-top: 40px;
}
.footer-cols {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 36px;
    padding: 48px 0 36px;
}
.footer-col { min-width: 0; }
.footer-col .widget { margin-bottom: 0; color: #d6dee7; }
.footer-col .widget-title {
    color: #fff;
    font-size: 1.1rem;
    margin: 0 0 14px;
    border-bottom: 2px solid var(--teal);
    padding-bottom: 8px;
}
.footer-col p { color: #d6dee7; }
.footer-col a { color: var(--teal); text-decoration: none; }
.footer-col a:hover { color: var(--amber); text-decoration: underline; }
.footer-col ul { list-style: none; margin: 0; padding: 0; }
.footer-col li { padding: 5px 0; }
.footer-col .post-date { display: block; font-size: 0.78rem; color: #9fb0bf; }

.footer-bottom {
    background: #0d1a2c;
    padding: 18px 0;
}
.copyright { margin: 0; font-size: 0.85rem; color: #9fb0bf; text-align: center; }

/* --- Cookie-баннер --- */
.cookie-banner[hidden] { display: none !important; }
.cookie-banner {
    position: fixed;
    left: 0; right: 0; bottom: 0;
    background: var(--ink);
    color: #eef2f6;
    z-index: 90;
    box-shadow: 0 -2px 16px rgba(0, 0, 0, 0.25);
    padding: 14px 0;
}
.cookie-inner {
    display: flex;
    align-items: center;
    gap: 18px;
    flex-wrap: wrap;
    justify-content: space-between;
}
.cookie-text { margin: 0; font-size: 0.9rem; flex: 1; min-width: 240px; }
.cookie-accept {
    padding: 10px 22px;
    background: var(--amber);
    color: var(--ink);
    border: none;
    border-radius: 8px;
    font: inherit;
    font-weight: 600;
    cursor: pointer;
}
.cookie-accept:hover { background: var(--amber-dark); }

/* --- Адаптив --- */
@media (max-width: 960px) {
    .layout-with-sidebar {
        grid-template-columns: 1fr;
        gap: 36px;
    }
    .block-split { grid-template-columns: 1fr; gap: 26px; }
    .footer-cols { grid-template-columns: 1fr; gap: 28px; }
}

@media (max-width: 600px) {
    .nav-toggle { display: block; }
    .primary-nav {
        flex-basis: 100%;
        display: none;
    }
    .primary-nav.is-open { display: block; }
    .primary-nav .menu { flex-direction: column; gap: 4px; }
    .layout-single .content-area { width: 100%; }
    .hero-content { width: 90%; margin-left: 5%; }
}
