/*
Theme Name: dds_i-r-v.ru
Author: Дмитрий Ковалёв
Description: Многотематический сайт о доме и вдохновении: рубрики «Ремонт», «Дизайн», «Декор», «DIY», «Умный дом».
Version: 1.1
Text Domain: irv
*/

/* ============================ Базовые переменные ============================ */
:root {
    --bg: #faf7f2;
    --surface: #ffffff;
    --text: #2b2926;
    --muted: #6f6a62;
    --accent: #bf5a36;
    --accent-dark: #9d4527;
    --dark: #27332e;
    --dark-text: #e8e3da;
    --dark-muted: #a9b0a6;
    --line: #e4ddd1;
    --line-dark: #3c4842;
    --radius: 12px;
    --shell: min(92%, 1180px);
    --content: min(92%, 1280px);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

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

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

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

h1, h2, h3, h4 {
    font-family: Georgia, "Times New Roman", serif;
    line-height: 1.25;
    color: var(--text);
    margin: 0 0 .6em;
}
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;
}

/* ============================ Кнопки ============================ */
.btn {
    display: inline-block;
    background: var(--accent);
    color: #fff;
    padding: .72em 1.5em;
    border-radius: 8px;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: background .2s ease;
}
.btn:hover { background: var(--accent-dark); color: #fff; text-decoration: none; }
.btn-ghost {
    background: transparent;
    color: var(--accent);
    border: 1.5px solid var(--accent);
}
.btn-ghost:hover { background: var(--accent); color: #fff; }

/* ============================ Шапка ============================ */
.site-header {
    background: var(--surface);
    border-bottom: 1px solid var(--line);
}
.header-inner {
    display: flex;
    align-items: center;
    gap: 1.4rem;
    padding: 1rem 0;
    flex-wrap: wrap;
}
.brand {
    display: flex;
    align-items: center;
    gap: .85rem;
    min-width: 0;
}
.brand-logo, .brand-logo svg { display: block; width: 54px; height: 54px; }
.brand-text { min-width: 0; }
.brand-name {
    font-family: Georgia, serif;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text);
    line-height: 1.2;
    display: block;
}
.brand-name a { color: inherit; text-decoration: none; }
.brand-desc {
    font-size: .82rem;
    color: var(--muted);
    line-height: 1.35;
    margin-top: .15rem;
    max-width: 520px;
}

.main-nav { margin-left: auto; }
.nav-toggle {
    display: none;
    background: none;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: .5em .7em;
    cursor: pointer;
    font-size: 1rem;
    color: var(--text);
}
.main-nav ul {
    list-style: none;
    display: flex;
    gap: .35rem;
    margin: 0;
    padding: 0;
    flex-wrap: wrap;
}
.main-nav a {
    display: block;
    padding: .5em .85em;
    color: var(--text);
    border-radius: 7px;
    font-weight: 600;
    font-size: .98rem;
}
.main-nav a:hover { background: var(--bg); color: var(--accent); text-decoration: none; }
.main-nav .current-menu-item > a { color: var(--accent); }

/* ============================ Раскладка ============================ */
.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 .content-area { width: 100%; }

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

/* Без сайдбара — узкая колонка чтения 85% от контейнера */
.is-wide .content-area {
    width: 85%;
    margin-inline: auto;
}

/* ============================ Хлебные крошки ============================ */
.breadcrumbs {
    font-size: .88rem;
    color: var(--muted);
    margin: 0 0 1.4rem;
}
.breadcrumbs a { color: var(--muted); }
.breadcrumbs a:hover { color: var(--accent); }
.breadcrumbs .sep { margin: 0 .35em; color: var(--line); }
.breadcrumbs > span:last-child { color: var(--text); }

/* ============================ Карточки записей ============================ */
.cards-list { display: grid; gap: 1.6rem; }

.card {
    display: flex;
    flex-direction: column;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    overflow: hidden;
}
.card-thumb-wrap {
    display: block;
    overflow: hidden;
}
.card-thumb-wrap img,
.card-thumb-placeholder {
    display: block;
    width: 100%;
    aspect-ratio: 16 / 9;
    object-fit: cover;
}
.card-body {
    flex: 1;
    padding: 1.2rem 1.3rem 1.4rem;
    min-width: 0;
}
.card-meta {
    font-size: .8rem;
    color: var(--muted);
    margin-bottom: .4rem;
}
.card-title { font-size: 1.25rem; margin: 0 0 .5rem; }
.card-title a { color: var(--text); }
.card-title a:hover { color: var(--accent); text-decoration: none; }
.card-excerpt { color: var(--muted); font-size: .96rem; }
.card-excerpt p { margin: 0 0 0.5em; background: none; }
.card-more {
    display: inline-block;
    margin-top: .5rem;
    font-weight: 600;
    font-size: .92rem;
}

/* Горизонтальные карточки в ленте блога */
.cards-list.cards-row .card { flex-direction: row; }
.cards-list.cards-row .card-thumb-wrap {
    flex: 0 0 300px;
    position: relative;
}
.cards-list.cards-row .card-thumb-wrap a {
    display: block;
    position: absolute;
    inset: 0;
}
.cards-list.cards-row .card-thumb-wrap img {
    width: 100%;
    height: 100%;
    aspect-ratio: auto;
    object-fit: cover;
}

/* ============================ Контент записи/страницы ============================ */
.entry {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 1.8rem 2rem 2.2rem;
}
.entry-title { font-size: 2rem; }
.entry-meta { font-size: .88rem; color: var(--muted); margin-bottom: 1.2rem; }
.entry-content img { border-radius: 8px; }
.entry-content h2 { margin-top: 1.6rem; }
.entry-content blockquote {
    margin: 1.4rem 0;
    padding: 1.1rem 1.4rem;
    background: var(--bg);
    border-left: 4px solid var(--accent);
    border-radius: 0 8px 8px 0;
    color: var(--text);
}
.entry-content blockquote p:last-child { margin-bottom: 0; }
.featured-image { margin: 0 0 1.4rem; border-radius: 8px; overflow: hidden; }
.featured-image img { display: block; width: 100%; }

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

/* ============================ Сайдбар / виджеты ============================ */
.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;
    color: var(--text);
}
.widget-title {
    font-size: 1.1rem;
    margin: 0 0 .9rem;
    padding-bottom: .55rem;
    border-bottom: 2px solid var(--accent);
    color: var(--text);
}
.widget ul { list-style: none; margin: 0; padding: 0; }
.widget li { padding: .4em 0; border-bottom: 1px solid var(--line); }
.widget li:last-child { border-bottom: none; }
.widget a { color: var(--text); }
.widget a:hover { color: var(--accent); }
.widget .post-date { display: block; font-size: .8rem; color: var(--muted); }

/* ============================ Пагинация ============================ */
.pagination {
    display: flex;
    flex-wrap: wrap;
    gap: .4rem;
    margin-top: 2rem;
    justify-content: center;
}
.pagination .page-numbers {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 42px;
    height: 42px;
    padding: 0 .7em;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    color: var(--text);
    font-weight: 600;
}
.pagination a.page-numbers:hover {
    border-color: var(--accent);
    color: var(--accent);
    text-decoration: none;
}
.pagination .page-numbers.current {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}
.pagination .page-numbers.dots {
    border: none;
    background: none;
}

/* ============================ Подвал ============================ */
.site-footer {
    background: var(--dark);
    color: var(--dark-text);
    padding: 2.8rem 0 1.6rem;
    margin-top: 2rem;
}
.footer-cols {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 2rem;
}
.site-footer .widget {
    background: transparent;
    border: none;
    padding: 0;
    margin: 0;
    color: var(--dark-text);
}
.site-footer .widget-title {
    color: #fff;
    border-bottom-color: var(--accent);
}
.site-footer .widget a { color: var(--dark-text); }
.site-footer .widget a:hover { color: #fff; }
.site-footer .widget li { border-bottom-color: var(--line-dark); }
.site-footer .widget .post-date { color: var(--dark-muted); }
.site-footer p { color: var(--dark-text); }
.footer-bottom {
    border-top: 1px solid var(--line-dark);
    margin-top: 2.2rem;
    padding-top: 1.3rem;
    font-size: .88rem;
    color: var(--dark-muted);
    text-align: center;
}

/* ============================ Cookie-баннер ============================ */
.cookie-banner[hidden] { display: none !important; }
.cookie-banner {
    position: fixed;
    left: 0; right: 0; bottom: 0;
    z-index: 999;
    background: var(--dark);
    color: var(--dark-text);
    padding: 1rem 0;
    box-shadow: 0 -2px 14px rgba(0,0,0,.18);
}
.cookie-inner {
    display: flex;
    align-items: center;
    gap: 1.2rem;
    flex-wrap: wrap;
}
.cookie-inner p { margin: 0; flex: 1; min-width: 220px; font-size: .92rem; }
.cookie-inner .btn { white-space: nowrap; }

/* ============================ Поиск ============================ */
.search-form { display: flex; gap: .5rem; }
.search-form input[type="search"] {
    flex: 1;
    min-width: 0;
    padding: .65em .9em;
    border: 1px solid var(--line);
    border-radius: 8px;
    font-size: 1rem;
    background: var(--surface);
    color: var(--text);
}
.search-form button {
    padding: .65em 1.2em;
    border: none;
    border-radius: 8px;
    background: var(--accent);
    color: #fff;
    cursor: pointer;
    font-weight: 600;
}
.search-form button:hover { background: var(--accent-dark); }

/* ============================ Комментарии ============================ */
.comments-area { margin-top: 2rem; }
.comment-list { list-style: none; margin: 0; padding: 0; }
.comment-list ul.children { list-style: none; margin: 0 0 0 1.4rem; padding: 0; }
.comment-item { margin-bottom: 1.2rem; }
.comment-body {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 1rem 1.2rem;
}
.comment-meta { font-size: .85rem; color: var(--muted); margin-bottom: .5rem; display: flex; gap: .8rem; flex-wrap: wrap; }
.comment-author { font-weight: 700; color: var(--text); }
.comment-respond {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 1.4rem 1.6rem;
    margin-top: 1.6rem;
}
.comment-form label { display: block; font-weight: 600; margin-bottom: .3rem; }
.comment-form input[type="text"],
.comment-form input[type="email"],
.comment-form input[type="url"],
.comment-form textarea {
    width: 100%;
    padding: .6em .8em;
    border: 1px solid var(--line);
    border-radius: 8px;
    font-size: 1rem;
    margin-bottom: 1rem;
    background: var(--surface);
    color: var(--text);
}

/* ============================ Утилиты / архив ============================ */
.screen-reader-text {
    position: absolute !important;
    width: 1px; height: 1px;
    padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0,0,0,0);
    white-space: nowrap; border: 0;
}
.archive-head { margin-bottom: 1.6rem; }
.archive-head h1 { margin-bottom: .4rem; }
.archive-desc { color: var(--muted); }
.entry-tags { margin-top: 1.4rem; font-size: .9rem; color: var(--muted); }
.page-links { margin-top: 1.2rem; font-weight: 600; }

/* ============================ Главная: секции ============================ */
.front-section { padding: 2.6rem 0; }
.front-section + .front-section { border-top: 1px solid var(--line); }
.section-head { text-align: center; max-width: 640px; margin: 0 auto 1.8rem; }
.section-head p { color: var(--muted); margin: 0; }

/* Текст + иллюстрация */
.fs-split {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 2.4rem;
    align-items: center;
}
.fs-split.reverse .fs-split-media { order: 2; }
.fs-split-media img { display: block; width: 100%; border-radius: var(--radius); }
.fs-split-text h2 { font-size: 1.9rem; }
.fs-split-text .lead { color: var(--muted); }

/* Сетка рубрик */
.rubric-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.4rem;
}
.rubric-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 1.5rem 1.4rem;
    text-align: center;
    min-width: 0;
    transition: transform .2s ease, border-color .2s ease;
}
.rubric-card:hover { transform: translateY(-3px); border-color: var(--accent); }
.rubric-icon { width: 56px; height: 56px; margin: 0 auto .9rem; display: block; }
.rubric-card h3 { margin: 0 0 .5rem; }
.rubric-card p { color: var(--muted); font-size: .92rem; margin: 0; }

/* Галерея / мозаика */
.gallery-mosaic {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    grid-auto-rows: 150px;
    gap: 1rem;
}
.gallery-mosaic figure { margin: 0; overflow: hidden; border-radius: 10px; }
.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; }

/* CTA */
.fs-cta-inner {
    background: var(--dark);
    color: var(--dark-text);
    border-radius: 16px;
    padding: 2.6rem 2.4rem;
    text-align: center;
}
.fs-cta-inner h2 { color: #fff; }
.fs-cta-inner p { color: var(--dark-muted); max-width: 560px; margin: 0 auto 1.4rem; }

/* Последние записи на главной */
.latest-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1.6rem;
}

/* ============================ 404 ============================ */
.error-404 {
    text-align: center;
    padding: 2rem 0 3rem;
}
.error-404 .big { font-size: 5rem; color: var(--accent); margin: 0; font-family: Georgia, serif; }
.error-404 .search-form { max-width: 420px; margin: 1.6rem auto 1.4rem; }

/* ============================ Адаптив ============================ */
@media (max-width: 960px) {
    .layout-with-sidebar { grid-template-columns: 1fr; }
    .is-wide .content-area { width: 100%; }
    .latest-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .gallery-mosaic { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

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

    .nav-toggle { display: inline-block; }
    .main-nav { margin-left: auto; position: relative; }
    .main-nav ul {
        display: none;
        position: absolute;
        right: 0;
        top: calc(100% + .5rem);
        background: var(--surface);
        border: 1px solid var(--line);
        border-radius: 10px;
        padding: .5rem;
        flex-direction: column;
        min-width: 200px;
        box-shadow: 0 8px 24px rgba(0,0,0,.1);
        z-index: 50;
    }
    .main-nav.open ul { display: flex; }
    .main-nav a { padding: .6em .8em; }

    .footer-cols { grid-template-columns: 1fr; gap: 1.6rem; }
    .latest-grid { grid-template-columns: 1fr; }

    .fs-split { grid-template-columns: 1fr; }
    .fs-split.reverse .fs-split-media { order: 0; }

    .gallery-mosaic { grid-template-columns: repeat(2, minmax(0, 1fr)); grid-auto-rows: 120px; }
    .gallery-mosaic .g-tall { grid-row: span 1; }

    .fs-cta-inner { padding: 1.8rem 1.4rem; }

    /* Горизонтальные карточки → вертикальные */
    .cards-list.cards-row .card { flex-direction: column; }
    .cards-list.cards-row .card-thumb-wrap {
        flex: none;
        width: 100%;
        position: static;
    }
    .cards-list.cards-row .card-thumb-wrap a { position: static; }
    .cards-list.cards-row .card-thumb-wrap img {
        width: 100%;
        height: auto;
        aspect-ratio: 16 / 9;
    }

    .entry { padding: 1.3rem 1.2rem 1.6rem; }
}
