/*
Theme Name: dds_roudlotulmuhtadin02.com
Author: Чижов Кирилл
Description: Тематическое оформление для информационного ресурса о религиозном образовании.
Version: 1.1
Text Domain: dds_roudlotulmuhtadin02
*/

/* === Подключаемые шрифты загружаются через wp_enqueue_style в functions.php === */

/* ---------- Сброс и базис ---------- */
*,
*::before,
*::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
    margin: 0;
    font-family: 'Merriweather', Georgia, 'Times New Roman', serif;
    font-size: 17px;
    line-height: 1.7;
    color: #2C2418;
    background-color: #F5F2EB;
    background-image:
        radial-gradient(circle at 18% 22%, rgba(196,154,60,0.04) 0, transparent 38%),
        radial-gradient(circle at 82% 78%, rgba(181,91,66,0.04) 0, transparent 42%);
    background-attachment: fixed;
}

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

a {
    color: #9B7B3C;
    text-decoration: none;
    transition: color 0.2s ease, border-color 0.2s ease;
}
a:hover { color: #B55B42; }

p { margin: 0 0 1em; }

h1, h2, h3, h4, h5, h6 {
    font-family: 'Rubik', 'Helvetica Neue', Arial, sans-serif;
    font-weight: 600;
    line-height: 1.25;
    color: #2C2418;
    margin: 1.4em 0 0.6em;
    letter-spacing: 0.01em;
}
h1 { font-size: 2.1rem; color: #9B7B3C; }
h2 { font-size: 1.55rem; }
h3 { font-size: 1.25rem; }

blockquote {
    margin: 1.4em 0;
    padding: 1em 1.4em;
    border-left: 4px solid #C49A3C;
    background: #D9E0DD;
    color: #3E4A44;
    font-style: italic;
}
blockquote p:last-child { margin-bottom: 0; }

code, pre {
    font-family: 'JetBrains Mono', Consolas, monospace;
    font-size: 0.92em;
    background: #ece6d6;
    color: #2C2418;
    border-radius: 4px;
}
code { padding: 1px 5px; }
pre { padding: 0.9em 1.1em; overflow: auto; }

table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.2em 0;
    border: 1px solid #c8b986;
    background: #fffdf7;
}
th, td {
    border: 1px solid #c8b986;
    padding: 0.55em 0.8em;
    text-align: left;
    vertical-align: top;
}
th { background: #ece6d6; color: #2C2418; }

hr { border: none; border-top: 1px dashed #C49A3C; margin: 2em 0; }

::selection { background: #C49A3C; color: #2C2418; }

/* ---------- Контейнер и каркас страницы ---------- */
.page-frame {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
}

.layout-grid {
    display: grid;
    grid-template-columns: 67% 27%;
    gap: 6%;
    margin: 36px 0 60px;
}
.layout-grid.no-aside { grid-template-columns: 85%; justify-content: center; gap: 0; }
.layout-grid.full     { grid-template-columns: 85%; justify-content: center; gap: 0; }

.main-area > article + article { margin-top: 36px; }

/* ---------- Шапка ---------- */
.site-header {
    background: linear-gradient(180deg, #faf6e9 0%, #f3ecd6 100%);
    border-bottom: 1px solid #d8c887;
    padding: 14px 0;
}
.site-header-inner {
    display: flex;
    align-items: center;
    gap: 22px;
    flex-wrap: wrap;
}
.brand {
    display: flex;
    align-items: center;
    gap: 14px;
    text-decoration: none;
}
.brand-logo {
    width: 56px;
    height: 56px;
    border-radius: 8px;
    background: #fffdf7;
    border: 1px solid #d8c887;
    padding: 6px;
    display: block;
}
.brand-text { display: flex; flex-direction: column; }
.brand-name {
    font-family: 'Rubik', sans-serif;
    font-weight: 600;
    color: #9B7B3C;
    font-size: 1.18rem;
    line-height: 1.2;
}
.brand-tag {
    font-size: 0.86rem;
    color: #3E4A44;
    line-height: 1.3;
    margin-top: 2px;
}

.primary-nav { margin-left: auto; }
.fan-menu {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    gap: 4px;
}
.fan-menu li a {
    display: inline-block;
    padding: 8px 14px;
    border-radius: 6px;
    color: #2C2418;
    font-family: 'Rubik', sans-serif;
    font-size: 0.97rem;
    transition: transform 0.25s ease, background 0.25s ease, color 0.25s ease;
}
.fan-menu li a:hover {
    background: #C49A3C;
    color: #2C2418;
}
/* Эффект "веера" — соседние пункты слегка разъезжаются */
.fan-menu:hover li:not(:hover) { transform: translateX(0); }
.fan-menu li:hover { transform: translateY(-1px); }
.fan-menu li:hover + li { transform: translateX(4px); }
.fan-menu li:has(+ li:hover) { transform: translateX(-4px); }

.menu-toggle {
    display: none;
    background: transparent;
    border: 1px solid #C49A3C;
    color: #2C2418;
    padding: 8px 14px;
    border-radius: 6px;
    cursor: pointer;
    font-family: 'Rubik', sans-serif;
}

/* ---------- Хлебные крошки ---------- */
.crumbs {
    margin: 22px 0 0;
    font-size: 0.92rem;
    color: #3E4A44;
}
.crumbs a { color: #9B7B3C; }
.crumbs a:hover { color: #B55B42; }
.crumbs .sep { margin: 0 6px; color: #C49A3C; }

/* ---------- Кнопки ---------- */
.btn {
    display: inline-block;
    padding: 10px 22px;
    border-radius: 6px;
    background: #C49A3C;
    color: #2C2418;
    font-family: 'Rubik', sans-serif;
    font-weight: 500;
    font-size: 0.97rem;
    border: 1px solid transparent;
    cursor: pointer;
    transition: all 0.22s ease;
    text-align: center;
}
.btn:hover {
    background: #3E4A44;
    color: #f0e2bf;
    border-bottom: 1px solid #C49A3C;
    padding-bottom: 9px;
}
.btn-ghost {
    background: transparent;
    color: #C49A3C;
    border: 1px solid #C49A3C;
}
.btn-ghost:hover {
    background: transparent;
    color: #B55B42;
    border-color: #B55B42;
}

/* ---------- Карточки записей ---------- */
.card {
    display: flex;
    flex-direction: column;
    background: #fffdf7;
    border: 1px solid #d8c887;
    border-radius: 8px;
    overflow: hidden;
    transition: box-shadow 0.25s ease, transform 0.25s ease;
}
.card:hover {
    box-shadow: 0 8px 22px rgba(60,40,12,0.08);
    transform: translateY(-2px);
}

.card-thumb-wrap {
    width: 100%;
    overflow: hidden;
    background: #ece6d6;
}
.card-thumb-wrap a {
    display: block;
}
.card-thumb-wrap img {
    width: 100%;
    aspect-ratio: 16 / 9;
    object-fit: cover;
    display: block;
}

.card-body {
    flex: 1;
    padding: 18px 20px 20px;
    display: flex;
    flex-direction: column;
}
.card-title {
    font-size: 1.18rem;
    margin: 0 0 6px;
    line-height: 1.3;
}
.card-title a { color: #2C2418; }
.card-title a:hover { color: #B55B42; }

.discipline-tag {
    display: inline-block;
    padding: 3px 12px;
    border-radius: 999px;
    background: rgba(181,91,66,0.10);
    color: #B55B42;
    font-size: 0.78rem;
    font-family: 'Rubik', sans-serif;
    letter-spacing: 0.02em;
    margin-bottom: 10px;
}

.card-excerpt {
    color: #3E4A44;
    font-size: 0.97rem;
    margin-bottom: 12px;
}
.card-excerpt p { margin: 0 0 0.5em; background: none; }

.card-foot {
    margin-top: auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

/* Лента "ступенькой" на главной */
.ladder {
    display: grid;
    grid-template-columns: 1fr;
    gap: 24px;
    margin: 28px 0 8px;
}
.ladder .card { width: 100%; }
.ladder .step-wide { width: 100%; }
.ladder .step-narrow {
    width: 78%;
    margin-left: auto;
}
@media (max-width: 600px) {
    .ladder .step-narrow { width: 100%; margin-left: 0; }
}

/* Горизонтальная карточка (используется на странице блога / архивах) */
.card-row {
    flex-direction: row;
}
.card-row .card-thumb-wrap {
    flex: 0 0 280px;
    position: relative;
    overflow: hidden;
    background: #ece6d6;
}
.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;
    aspect-ratio: auto;
}

@media (max-width: 600px) {
    .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;
    }
}

/* ---------- Сайдбар ---------- */
.aside-area {
    position: relative;
}
.aside-area::before {
    content: '';
    display: block;
    height: 8px;
    margin-bottom: 16px;
    background: repeating-linear-gradient(
        90deg,
        #C49A3C 0 8px,
        transparent 8px 14px,
        #B55B42 14px 18px,
        transparent 18px 24px
    );
    border-radius: 3px;
    opacity: 0.7;
}
.aside-widget {
    background: #fffdf7;
    border: 1px solid #d8c887;
    border-radius: 8px;
    padding: 16px 18px;
    margin-bottom: 22px;
}
.aside-widget .widget-title,
.aside-widget h2 {
    margin: 0 0 12px;
    font-size: 1.05rem;
    color: #9B7B3C;
    border-bottom: 1px dashed #C49A3C;
    padding-bottom: 6px;
}
.aside-widget ul {
    list-style: none;
    padding: 0;
    margin: 0;
}
.aside-widget li {
    padding: 6px 0;
    border-bottom: 1px dotted #e0d3a6;
}
.aside-widget li:last-child { border-bottom: none; }

/* Цитатник наставников */
.mentor-quote {
    background: #fffdf7;
    border: 1px solid #d8c887;
    border-radius: 8px;
    padding: 18px;
    margin-bottom: 22px;
    border-left: 4px solid #C49A3C;
}
.mentor-quote .quote-text {
    font-style: italic;
    color: #3E4A44;
    margin-bottom: 10px;
    font-size: 0.97rem;
}
.mentor-quote .quote-author {
    color: #B55B42;
    font-family: 'Rubik', sans-serif;
    font-size: 0.86rem;
    text-align: right;
}
.mentor-quote .quote-link {
    display: inline-block;
    margin-top: 8px;
    font-size: 0.86rem;
}

/* ---------- Тематические блоки на главной ---------- */
.topic-block {
    background: #fffdf7;
    border: 1px solid #d8c887;
    border-radius: 10px;
    padding: 28px 30px;
    margin: 28px 0;
}
.topic-block h2 {
    margin-top: 0;
    color: #9B7B3C;
    border-bottom: 1px dashed #C49A3C;
    padding-bottom: 8px;
}
.topic-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 18px;
    margin-top: 18px;
}
.topic-col {
    background: #faf6e9;
    border: 1px solid #e6d8a8;
    border-radius: 6px;
    padding: 16px 18px;
    position: relative;
}
.topic-col h3 {
    margin: 0 0 8px;
    font-size: 1.05rem;
    color: #B55B42;
    padding-bottom: 4px;
    border-bottom: 1px dotted #C49A3C;
}
.topic-col p { font-size: 0.94rem; margin: 0; color: #3E4A44; }

@media (max-width: 760px) {
    .topic-grid { grid-template-columns: 1fr; }
}

/* ---------- Подвал ---------- */
.site-footer {
    margin-top: 48px;
    background: #2C2418;
    color: #e8dcb6;
    padding: 36px 0 18px;
    position: relative;
}
.site-footer::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 6px;
    background: repeating-linear-gradient(
        90deg,
        #C49A3C 0 12px,
        transparent 12px 22px,
        #B55B42 22px 28px,
        transparent 28px 40px
    );
    opacity: 0.85;
}
.footer-cols {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 36px;
}
.footer-col h2,
.footer-col .widget-title {
    color: #C49A3C;
    font-size: 1.02rem;
    margin: 0 0 12px;
    padding-bottom: 6px;
    border-bottom: 1px dashed rgba(196,154,60,0.4);
}
.footer-col a { color: #e8dcb6; }
.footer-col a:hover { color: #C49A3C; }
.footer-col ul { list-style: none; padding: 0; margin: 0; }
.footer-col li { padding: 4px 0; }

.copyright {
    margin-top: 26px;
    padding-top: 16px;
    border-top: 1px solid rgba(196,154,60,0.25);
    font-size: 0.88rem;
    color: #c8b986;
    text-align: center;
}

/* ---------- Запись и страница ---------- */
.entry-header {
    margin-bottom: 18px;
}
.entry-title { margin: 0 0 6px; }
.entry-meta { color: #3E4A44; font-size: 0.9rem; }
.entry-meta .discipline-tag { margin: 0; }

.entry-content img { border-radius: 6px; }
.entry-content > * + * { margin-top: 1em; }

.post-thumb {
    width: 100%;
    border-radius: 8px;
    margin: 0 0 20px;
    aspect-ratio: 16 / 8;
    object-fit: cover;
}

/* ---------- Пагинация ---------- */
.pager {
    margin: 36px 0 12px;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    justify-content: center;
}
.pager a,
.pager span {
    display: inline-block;
    padding: 8px 14px;
    border-radius: 6px;
    background: #fffdf7;
    border: 1px solid #d8c887;
    color: #2C2418;
    font-family: 'Rubik', sans-serif;
    font-size: 0.95rem;
}
.pager a:hover { background: #C49A3C; color: #2C2418; }
.pager .current {
    background: #C49A3C;
    color: #2C2418;
    border-color: #C49A3C;
    font-weight: 600;
}

/* ---------- Поиск ---------- */
.search-form {
    display: flex;
    gap: 8px;
    align-items: stretch;
    margin: 16px 0;
}
.search-form input[type="search"] {
    flex: 1;
    padding: 9px 12px;
    border: 1px solid #d8c887;
    border-radius: 6px;
    background: #fffdf7;
    font-family: inherit;
    font-size: 0.98rem;
    color: #2C2418;
}
.search-form input[type="search"]:focus {
    outline: none;
    border-color: #C49A3C;
    box-shadow: 0 0 0 3px rgba(196,154,60,0.18);
}
.search-form button { white-space: nowrap; }

/* ---------- Комментарии ---------- */
.comments-area {
    margin-top: 36px;
    padding-top: 24px;
    border-top: 1px dashed #C49A3C;
}
.comments-area h2,
.comments-area h3 {
    color: #9B7B3C;
}
.comment-list { list-style: none; padding: 0; margin: 0 0 24px; }
.comment-list .children { list-style: none; padding-left: 24px; margin-top: 14px; }
.comment-body {
    background: #fffdf7;
    border: 1px solid #d8c887;
    border-radius: 8px;
    padding: 14px 16px;
    margin-bottom: 14px;
}
.comment-meta {
    font-size: 0.86rem;
    color: #3E4A44;
    margin-bottom: 6px;
}
.comment-author { color: #B55B42; font-weight: 600; }

.comment-form label { display: block; margin: 10px 0 4px; font-size: 0.92rem; color: #3E4A44; }
.comment-form input[type="text"],
.comment-form input[type="email"],
.comment-form input[type="url"],
.comment-form textarea {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid #d8c887;
    border-radius: 6px;
    background: #fffdf7;
    font-family: inherit;
    font-size: 0.98rem;
    color: #2C2418;
}
.comment-form textarea { min-height: 130px; resize: vertical; }
.comment-form .submit { margin-top: 12px; }

/* ---------- 404 ---------- */
.error-404 {
    text-align: center;
    padding: 40px 20px;
}
.error-404 .big {
    font-family: 'Rubik', sans-serif;
    font-size: 5rem;
    color: #C49A3C;
    line-height: 1;
    margin: 0 0 8px;
}

/* ---------- Cookie-баннер ---------- */
/* ВАЖНО: правило для [hidden] идёт ДО основных стилей */
.cookie-banner[hidden] { display: none !important; }

.cookie-banner {
    position: fixed;
    bottom: 16px;
    left: 16px;
    right: 16px;
    z-index: 9999;
    background: #2C2418;
    color: #e8dcb6;
    padding: 14px 18px;
    border-radius: 8px;
    border: 1px solid #C49A3C;
    box-shadow: 0 8px 30px rgba(0,0,0,0.25);
    display: flex;
    align-items: center;
    gap: 18px;
    flex-wrap: wrap;
}
.cookie-banner p {
    margin: 0;
    flex: 1;
    font-size: 0.93rem;
    min-width: 200px;
    background: none;
}
.cookie-banner a { color: #C49A3C; }
.cookie-banner button {
    background: #C49A3C;
    color: #2C2418;
    border: none;
    padding: 8px 18px;
    border-radius: 6px;
    cursor: pointer;
    font-family: 'Rubik', sans-serif;
    font-size: 0.94rem;
    transition: background 0.22s ease, color 0.22s ease;
}
.cookie-banner button:hover {
    background: #3E4A44;
    color: #f0e2bf;
}

/* ---------- Режим спокойного чтения ---------- */
.calm-toggle {
    position: fixed;
    bottom: 76px;
    right: 16px;
    z-index: 998;
    background: #fffdf7;
    border: 1px solid #C49A3C;
    color: #2C2418;
    padding: 7px 14px;
    border-radius: 18px;
    font-family: 'Rubik', sans-serif;
    font-size: 0.86rem;
    cursor: pointer;
    box-shadow: 0 3px 10px rgba(60,40,12,0.12);
}
.calm-toggle:hover { background: #C49A3C; }

body.calm-mode .aside-area,
body.calm-mode .site-header .primary-nav,
body.calm-mode .topic-block,
body.calm-mode .ladder {
    display: none !important;
}
body.calm-mode .layout-grid {
    grid-template-columns: 80%;
    justify-content: center;
}
body.calm-mode .entry-content {
    border: 1px solid #C49A3C;
    border-radius: 8px;
    padding: 28px;
    background: #fffdf7;
}

/* ---------- Адаптив ---------- */
@media (max-width: 960px) {
    .layout-grid { grid-template-columns: 1fr; gap: 28px; }
    .layout-grid.no-aside, .layout-grid.full { grid-template-columns: 1fr; }
    .footer-cols { grid-template-columns: 1fr; gap: 22px; }
    .topic-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 720px) {
    .menu-toggle { display: inline-block; margin-left: auto; }
    .primary-nav { width: 100%; order: 5; }
    .fan-menu {
        flex-direction: column;
        gap: 0;
        background: #faf6e9;
        border-radius: 6px;
        padding: 6px 0;
        margin-top: 10px;
    }
    .primary-nav[data-open="false"] .fan-menu { display: none; }
    .fan-menu li { border-bottom: 1px dotted #d8c887; }
    .fan-menu li:last-child { border-bottom: none; }
    .fan-menu li a { display: block; padding: 10px 14px; }
}

@media (max-width: 600px) {
    body { font-size: 16px; }
    h1 { font-size: 1.7rem; }
    h2 { font-size: 1.35rem; }
    .topic-block { padding: 20px 18px; }
    .topic-grid { grid-template-columns: 1fr; }
    .page-frame { padding: 0 16px; }
}
