/*
Theme Name: dds_machinmachines.com
Author: Валерия Котова
Description: Информационная тема для материалов о культурных центрах: форматы событий, резиденции, участники, подготовка площадки и работа с аудиторией.
Version: 1.1
Requires at least: 6.0
Requires PHP: 8.0
Text Domain: kulthub
*/

/* ============================================================= *
 * Переменные и сброс
 * ============================================================= */
:root {
    --bg: #f4efe4;
    --surface: #fbf8f1;
    --ink: #241f19;
    --muted: #6c6357;
    --primary: #1c3a46;
    --primary-dark: #142932;
    --accent: #c25a37;
    --accent-soft: #e9d6c4;
    --line: #ddd3c1;
    --footer-bg: #17282f;
    --footer-ink: #d9e2e3;
    --footer-muted: #9fb0b2;
    --radius: 12px;
    --shell: min(92%, 1180px);
    --font: "PT Serif", Georgia, "Times New Roman", serif;
    --sans: "Segoe UI", "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font-family: var(--font);
    font-size: 18px;
    line-height: 1.7;
    overflow-x: hidden;
}

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

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

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

p { margin: 0 0 1.1em; }

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

.skip-link {
    position: absolute;
    left: -9999px;
}
.skip-link:focus {
    left: 1rem;
    top: 1rem;
    background: var(--primary);
    color: #fff;
    padding: 0.6rem 1rem;
    z-index: 100;
    border-radius: 6px;
}

/* ============================================================= *
 * Шапка
 * ============================================================= */
.site-header {
    background: var(--surface);
    border-bottom: 1px solid var(--line);
}
.header-inner {
    display: flex;
    align-items: center;
    gap: 1.4rem;
    padding: 1.1rem 0;
    flex-wrap: wrap;
}
.brand {
    display: flex;
    align-items: center;
    gap: 0.9rem;
    min-width: 0;
}
.brand-logo,
.brand-mark {
    flex: 0 0 auto;
    display: block;
}
.brand-mark { width: 52px; height: 52px; }
.brand-text { min-width: 0; }
.brand-name {
    font-family: var(--sans);
    font-weight: 700;
    font-size: 1.15rem;
    color: var(--ink);
    line-height: 1.2;
    display: block;
}
.brand-name a { color: inherit; }
.brand-name a:hover { text-decoration: none; color: var(--accent); }
.brand-desc {
    display: block;
    font-size: 0.82rem;
    color: var(--muted);
    font-family: var(--sans);
    margin-top: 0.2rem;
    max-width: 46ch;
}

.main-nav {
    margin-left: auto;
    min-width: 0;
}
.nav-toggle {
    display: none;
    background: var(--primary);
    color: #fff;
    border: 0;
    font-family: var(--sans);
    font-size: 0.95rem;
    padding: 0.55rem 1rem;
    border-radius: 8px;
    cursor: pointer;
}
.menu {
    list-style: none;
    display: flex;
    gap: 0.4rem;
    margin: 0;
    padding: 0;
    flex-wrap: wrap;
}
.menu a {
    display: block;
    font-family: var(--sans);
    font-size: 0.98rem;
    color: var(--ink);
    padding: 0.5rem 0.85rem;
    border-radius: 8px;
}
.menu a:hover { background: var(--accent-soft); text-decoration: none; }
.menu .current-menu-item > a { background: var(--primary); color: #fff; }

/* ============================================================= *
 * Раскладки
 * ============================================================= */
.site-main { padding: 2.2rem 0 3rem; }

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

/* ============================================================= *
 * Хлебные крошки
 * ============================================================= */
.crumbs {
    font-family: var(--sans);
    font-size: 0.85rem;
    color: var(--muted);
    margin-bottom: 1.4rem;
}
.crumbs a { color: var(--primary); }
.crumbs .sep { margin: 0 0.35rem; color: var(--line); }

/* ============================================================= *
 * Карточки записей
 * ============================================================= */
.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr));
    gap: 1.6rem;
}
.card {
    display: flex;
    flex-direction: column;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    overflow: hidden;
    min-width: 0;
}
.card-thumb {
    display: block;
    aspect-ratio: 16 / 10;
    overflow: hidden;
}
.card-thumb img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.card-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 1.2rem 1.3rem 1.4rem;
}
.card-title {
    font-size: 1.2rem;
    margin: 0 0 0.5rem;
}
.card-title a { color: var(--ink); }
.card-title a:hover { color: var(--accent); text-decoration: none; }
.card-meta {
    font-family: var(--sans);
    font-size: 0.8rem;
    color: var(--muted);
    margin-bottom: 0.7rem;
}
.card-excerpt {
    color: var(--ink);
    font-size: 0.98rem;
}
.card-excerpt p { margin: 0 0 0.5em; background: none; }
.card-more {
    margin-top: auto;
    align-self: flex-start;
    font-family: var(--sans);
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--accent);
    padding-top: 0.6rem;
}

/* ============================================================= *
 * Одиночная запись / страница
 * ============================================================= */
.entry {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 2rem 2.2rem 2.4rem;
}
.entry-header { margin-bottom: 1.4rem; }
.entry-title { font-size: 2rem; }
.entry-meta {
    font-family: var(--sans);
    font-size: 0.85rem;
    color: var(--muted);
}
.entry-thumb {
    margin: 0 0 1.6rem;
    border-radius: var(--radius);
    overflow: hidden;
}
.entry-thumb img { display: block; width: 100%; height: auto; }
.entry-content p { margin: 0 0 1.15em; }
.entry-content h2 { margin-top: 1.6em; }
.entry-content img { border-radius: 8px; }
.entry-content ul, .entry-content ol { margin: 0 0 1.15em 1.3em; }
.entry-content blockquote {
    margin: 1.4em 0;
    padding: 1.2rem 1.4rem;
    background: var(--accent-soft);
    border-left: 4px solid var(--accent);
    border-radius: 8px;
}
.entry-content blockquote p:last-child { margin-bottom: 0; }

.entry-footer {
    margin-top: 1.6rem;
    padding-top: 1.2rem;
    border-top: 1px solid var(--line);
    font-family: var(--sans);
    font-size: 0.85rem;
    color: var(--muted);
}
.entry-footer a { color: var(--primary); }

/* Таблицы в контенте */
.entry-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 0 0 1.3em;
}
.entry-content table,
.entry-content th,
.entry-content td {
    border: 1px solid var(--line);
}
.entry-content th,
.entry-content td { padding: 0.6rem 0.8rem; text-align: left; }
.entry-content th { background: var(--accent-soft); }

/* ============================================================= *
 * Сайдбар / виджеты
 * ============================================================= */
.sidebar { min-width: 0; }
.widget {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 1.3rem 1.4rem;
    margin-bottom: 1.6rem;
    font-size: 0.96rem;
}
.widget-title {
    font-size: 1.05rem;
    margin: 0 0 0.9rem;
    color: var(--ink);
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--accent);
    display: inline-block;
}
.sidebar .widget,
.sidebar .widget p,
.sidebar .widget li { color: var(--ink); }
.widget ul { list-style: none; margin: 0; padding: 0; }
.widget li { padding: 0.4rem 0; border-bottom: 1px solid var(--line); }
.widget li:last-child { border-bottom: 0; }
.sidebar .widget a { color: var(--primary); }
.sidebar .widget a:hover { color: var(--accent); }
.widget .post-date { font-family: var(--sans); font-size: 0.78rem; color: var(--muted); display: block; }

/* ============================================================= *
 * Главная
 * ============================================================= */
.home-main { padding: 0 0 3rem; }
.front-section { padding: 3rem 0; }
.front-section + .front-section { border-top: 1px solid var(--line); }
.section-label {
    font-family: var(--sans);
    text-transform: uppercase;
    letter-spacing: 0.14em;
    font-size: 0.78rem;
    color: var(--accent);
    font-weight: 700;
    margin-bottom: 0.5rem;
}
.section-title { font-size: 1.9rem; margin-bottom: 1.4rem; }

/* Hero: текст + иллюстрация */
.hero {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: #f4efe4;
    padding: 3.4rem 0;
}
.hero-inner {
    display: grid;
    grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
    gap: 2.6rem;
    align-items: center;
}
.hero-text { min-width: 0; }
.hero-text h1 { color: #fff; font-size: 2.4rem; margin-bottom: 0.7rem; }
.hero-text p { color: #d7e0e1; font-size: 1.08rem; }
.hero-actions { margin-top: 1.4rem; display: flex; gap: 0.8rem; flex-wrap: wrap; }
.hero-media { min-width: 0; }
.hero-media img {
    display: block;
    width: 100%;
    border-radius: var(--radius);
    aspect-ratio: 4 / 3;
    object-fit: cover;
}

.btn {
    display: inline-block;
    font-family: var(--sans);
    font-weight: 600;
    font-size: 0.98rem;
    padding: 0.7rem 1.4rem;
    border-radius: 8px;
    cursor: pointer;
    border: 2px solid transparent;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: #a9482a; text-decoration: none; }
.btn-ghost { background: transparent; color: #fff; border-color: rgba(255,255,255,0.5); }
.btn-ghost:hover { background: rgba(255,255,255,0.12); text-decoration: none; }

/* Текст + иллюстрация (внутри контента) */
.split {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 2.4rem;
    align-items: center;
}
.split.reverse .split-media { order: -1; }
.split-media img {
    display: block;
    width: 100%;
    border-radius: var(--radius);
    aspect-ratio: 4 / 3;
    object-fit: cover;
}
.split-text { min-width: 0; }

/* Сетка направлений */
.feature-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr));
    gap: 1.4rem;
}
.feature {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 1.6rem 1.5rem;
    min-width: 0;
}
.feature-icon {
    width: 46px;
    height: 46px;
    display: block;
    margin-bottom: 0.9rem;
    color: var(--accent);
}
.feature h3 { font-size: 1.12rem; margin-bottom: 0.4rem; }
.feature p { margin: 0; font-size: 0.95rem; color: var(--muted); }

/* Шаги */
.steps {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr));
    gap: 1.6rem;
    counter-reset: step;
}
.step {
    position: relative;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 1.6rem 1.5rem 1.5rem;
    min-width: 0;
}
.step-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    font-family: var(--sans);
    font-weight: 700;
    font-size: 1.1rem;
    margin-bottom: 0.9rem;
}
.step h3 { font-size: 1.1rem; margin-bottom: 0.4rem; }
.step p { margin: 0; font-size: 0.95rem; color: var(--muted); }

/* Галерея / мозаика */
.gallery-mosaic {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    grid-auto-rows: 180px;
    gap: 1rem;
}
.gallery-mosaic figure {
    margin: 0;
    border-radius: var(--radius);
    overflow: hidden;
    position: relative;
}
.gallery-mosaic img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.gallery-mosaic .g-wide { grid-column: span 2; }
.gallery-mosaic .g-tall { grid-row: span 2; }
.gallery-mosaic figcaption {
    position: absolute;
    left: 0; right: 0; bottom: 0;
    background: linear-gradient(transparent, rgba(20,32,38,0.82));
    color: #fff;
    font-family: var(--sans);
    font-size: 0.82rem;
    padding: 1.2rem 0.9rem 0.7rem;
}

/* CTA */
.cta {
    background: var(--primary);
    color: #fff;
    border-radius: var(--radius);
    padding: 2.6rem 2.4rem;
    text-align: center;
}
.cta h2 { color: #fff; }
.cta p { color: #d7e0e1; max-width: 60ch; margin-inline: auto; }
.cta .hero-actions { justify-content: center; }

/* Блок последних записей на главной */
.latest-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 1.4rem;
}
.latest-head .btn-link {
    font-family: var(--sans);
    font-weight: 600;
    color: var(--accent);
    font-size: 0.95rem;
}

/* ============================================================= *
 * Пагинация
 * ============================================================= */
.pager {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin: 2.4rem 0 0;
}
.pager .page-numbers {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;
    height: 44px;
    padding: 0 0.6rem;
    border: 1px solid var(--line);
    border-radius: 8px;
    font-family: var(--sans);
    font-size: 0.95rem;
    color: var(--primary);
    background: var(--surface);
}
.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-color: transparent;
    background: transparent;
}

/* ============================================================= *
 * Комментарии
 * ============================================================= */
.comments-area {
    margin-top: 2.2rem;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 1.8rem 2rem;
}
.comment-list { list-style: none; margin: 0; padding: 0; }
.comment-list .children { list-style: none; margin: 1rem 0 0 1.4rem; padding: 0; }
.comment-item { margin-bottom: 1.2rem; }
.comment-body { border-bottom: 1px solid var(--line); padding-bottom: 1rem; }
.comment-head {
    display: flex;
    gap: 0.8rem;
    align-items: baseline;
    flex-wrap: wrap;
    margin-bottom: 0.4rem;
}
.comment-author { font-family: var(--sans); font-weight: 700; }
.comment-date { font-family: var(--sans); font-size: 0.8rem; color: var(--muted); }
.comment-await { font-size: 0.85rem; color: var(--accent); }
.comment-reply a { font-family: var(--sans); font-size: 0.85rem; font-weight: 600; }

.comment-respond {
    margin-top: 1.6rem;
}
.comment-form-comment textarea,
.comment-form input[type="text"],
.comment-form input[type="email"],
.comment-form input[type="url"] {
    width: 100%;
    padding: 0.6rem 0.8rem;
    border: 1px solid var(--line);
    border-radius: 8px;
    font-family: inherit;
    font-size: 1rem;
    background: #fff;
}
.comment-form-comment textarea { min-height: 130px; resize: vertical; }
.comment-form p { margin-bottom: 0.9rem; }
.form-submit .submit {
    background: var(--accent);
    color: #fff;
    border: 0;
    padding: 0.7rem 1.5rem;
    border-radius: 8px;
    font-family: var(--sans);
    font-weight: 600;
    cursor: pointer;
}

/* ============================================================= *
 * Форма поиска
 * ============================================================= */
.search-form {
    display: flex;
    gap: 0.5rem;
}
.search-form .search-field {
    flex: 1;
    min-width: 0;
    padding: 0.6rem 0.8rem;
    border: 1px solid var(--line);
    border-radius: 8px;
    font-size: 1rem;
    background: #fff;
}
.search-form .search-submit {
    background: var(--primary);
    color: #fff;
    border: 0;
    padding: 0.6rem 1.2rem;
    border-radius: 8px;
    font-family: var(--sans);
    cursor: pointer;
}

/* ============================================================= *
 * 404
 * ============================================================= */
.error-404 {
    text-align: center;
    padding: 2rem 0 1rem;
}
.error-404 .code {
    font-family: var(--sans);
    font-size: 5rem;
    font-weight: 800;
    color: var(--accent);
    line-height: 1;
}
.error-404 .search-form { max-width: 460px; margin: 1.6rem auto 0; }

/* ============================================================= *
 * Контакты (статичные)
 * ============================================================= */
.contact-block {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    margin-top: 1rem;
}
.contact-item {
    background: var(--accent-soft);
    border-radius: 8px;
    padding: 0.7rem 1.1rem;
    font-family: var(--sans);
    font-size: 0.95rem;
}

/* ============================================================= *
 * Подвал
 * ============================================================= */
.site-footer {
    background: var(--footer-bg);
    color: var(--footer-ink);
    padding: 2.8rem 0 1.4rem;
}
.footer-cols {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 2rem;
}
.site-footer .widget {
    background: transparent;
    border: 0;
    padding: 0;
    margin: 0;
    color: var(--footer-ink);
}
.site-footer .widget-title {
    color: #fff;
    border-bottom-color: var(--accent);
}
.site-footer .widget p,
.site-footer .widget li,
.site-footer .widget { color: var(--footer-ink); }
.site-footer .widget a { color: #fff; }
.site-footer .widget a:hover { color: var(--accent-soft); }
.site-footer .widget li { border-bottom-color: rgba(255,255,255,0.12); }
.site-footer .widget .post-date { color: var(--footer-muted); }

.footer-bottom {
    margin-top: 2.2rem;
    padding-top: 1.2rem;
    border-top: 1px solid rgba(255,255,255,0.14);
    font-family: var(--sans);
    font-size: 0.85rem;
    color: var(--footer-muted);
    text-align: center;
}

/* ============================================================= *
 * Cookie-баннер (правило [hidden] — до основных стилей)
 * ============================================================= */
.cookie-banner[hidden] { display: none !important; }
.cookie-banner {
    position: fixed;
    left: 1rem;
    right: 1rem;
    bottom: 1rem;
    z-index: 90;
    background: var(--primary-dark);
    color: #eef2f2;
    border-radius: var(--radius);
    padding: 1.1rem 1.4rem;
    display: flex;
    align-items: center;
    gap: 1.2rem;
    flex-wrap: wrap;
    box-shadow: 0 10px 30px rgba(0,0,0,0.28);
    max-width: 720px;
    margin-inline: auto;
    font-family: var(--sans);
    font-size: 0.9rem;
}
.cookie-banner p { margin: 0; flex: 1; min-width: 220px; }
.cookie-banner a { color: var(--accent-soft); }
.cookie-accept {
    background: var(--accent);
    color: #fff;
    border: 0;
    padding: 0.6rem 1.4rem;
    border-radius: 8px;
    font-family: var(--sans);
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
}

/* ============================================================= *
 * Адаптив
 * ============================================================= */
@media (max-width: 960px) {
    .layout-with-sidebar { grid-template-columns: minmax(0, 1fr); }
    .hero-inner { grid-template-columns: minmax(0, 1fr); }
    .hero-media { order: -1; }
    .split { grid-template-columns: minmax(0, 1fr); }
    .split.reverse .split-media { order: 0; }
    .gallery-mosaic { grid-template-columns: repeat(2, minmax(0, 1fr)); grid-auto-rows: 160px; }
    .footer-cols { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
}

@media (max-width: 600px) {
    body { font-size: 17px; }
    h1 { font-size: 1.7rem; }
    .hero-text h1 { font-size: 1.9rem; }
    .layout-single .content-area { width: 100%; }
    .main-nav { margin-left: auto; width: auto; }
    .nav-toggle { display: inline-block; }
    .menu {
        display: none;
        flex-direction: column;
        width: 100%;
        margin-top: 0.7rem;
        background: var(--surface);
        border: 1px solid var(--line);
        border-radius: 8px;
        padding: 0.5rem;
    }
    .main-nav.open .menu { display: flex; }
    .main-nav { width: 100%; }
    .gallery-mosaic { grid-template-columns: minmax(0, 1fr); grid-auto-rows: 200px; }
    .gallery-mosaic .g-wide,
    .gallery-mosaic .g-tall { grid-column: auto; grid-row: auto; }
    .footer-cols { grid-template-columns: minmax(0, 1fr); }
    .entry { padding: 1.4rem 1.3rem 1.6rem; }
    .cta { padding: 2rem 1.4rem; }
    .front-section { padding: 2.2rem 0; }
    .cookie-banner { flex-direction: column; align-items: stretch; text-align: center; }
}
