/*
Theme Name: dds_terramelodia.ru
Theme URI: https://terramelodia.ru/
Author: Алексей Мельников
Author URI: https://terramelodia.ru/
Description: Редакционно-образовательный портал о музыкальной культуре, истории жанров, этнической музыке и базовых основах музыкального образования с акцентом на понятные разборы стилей и их культурного происхождения.
Version: 1.1
Requires at least: 6.0
Tested up to: 6.5
Requires PHP: 7.4
Text Domain: dds_terramelodia
*/

/* ============ Базовые переменные ============ */
:root {
    --bg: #F9F6F0;
    --ink: #2C2418;
    --ink-soft: #5a4e3c;
    --terra: #C26A4A;
    --clay: #A55132;
    --ochre: #E6B87D;
    --block: #EFECE4;
    --line: #d8d1c1;
    --paper: #fffdf8;
    --shadow: 0 2px 10px rgba(44, 36, 24, 0.08);
    --shadow-lift: 0 10px 26px rgba(44, 36, 24, 0.14);
    --radius: 10px;
    --serif: "Cormorant Garamond", "PT Serif", "Times New Roman", serif;
    --sans: "Inter", "Helvetica Neue", "Segoe UI", Arial, sans-serif;
}

/* ============ Сброс ============ */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font-family: var(--sans);
    font-size: 17px;
    line-height: 1.65;
    -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; height: auto; }
a { color: var(--terra); text-decoration: none; transition: color .2s ease; }
a:hover { color: var(--clay); text-decoration: underline; }

h1, h2, h3, h4, h5, h6 {
    font-family: var(--serif);
    color: var(--ink);
    line-height: 1.25;
    margin: 0 0 0.6em;
    font-weight: 600;
}
h1 { font-size: 2.2rem; }
h2 { font-size: 1.7rem; }
h3 { font-size: 1.35rem; }
h4 { font-size: 1.15rem; }

p { margin: 0 0 1em; }

ul, ol { padding-left: 1.3em; }
blockquote {
    margin: 1.5em 0;
    padding: 1em 1.4em;
    border-left: 3px solid var(--ochre);
    background: var(--block);
    font-family: var(--serif);
    font-style: italic;
    color: var(--ink-soft);
    position: relative;
}
blockquote::before {
    content: "♪";
    position: absolute;
    top: 0.4em;
    right: 0.8em;
    color: var(--ochre);
    font-size: 1.6em;
    opacity: 0.7;
}

code, pre {
    font-family: "Menlo", "Consolas", monospace;
    background: var(--block);
    border-radius: 4px;
}
code { padding: 0.1em 0.4em; }
pre { padding: 1em; overflow-x: auto; }

table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.2em 0;
    border: 1px solid var(--line);
    background: var(--paper);
}
th, td {
    border: 1px solid var(--line);
    padding: 0.6em 0.9em;
    text-align: left;
}
th { background: var(--block); font-family: var(--serif); }

/* ============ Контейнеры ============ */
.wrap {
    max-width: 1180px;
    margin: 0 auto;
    padding: 0 22px;
}
.site-main {
    padding: 40px 0 60px;
}
.content-wide { width: 85%; margin: 0 auto; }
.content-with-side { display: grid; grid-template-columns: 67% 27%; gap: 6%; }

/* ============ Шапка ============ */
.page-head {
    background: var(--paper);
    border-bottom: 1px solid var(--line);
    padding: 16px 0 0;
}
.masthead {
    display: flex;
    align-items: center;
    gap: 20px;
    padding-bottom: 14px;
}
.brand {
    display: flex;
    align-items: center;
    gap: 14px;
    text-decoration: none;
    color: inherit;
}
.brand:hover { text-decoration: none; }
.brand-logo {
    width: 54px;
    height: 54px;
    object-fit: contain;
    flex-shrink: 0;
}
.brand-svg {
    width: 54px;
    height: 54px;
    flex-shrink: 0;
}
.brand-text {
    min-width: 0;
}
.brand-title {
    font-family: var(--serif);
    font-size: 1.35rem;
    font-weight: 600;
    color: var(--ink);
    line-height: 1.1;
    display: block;
}
.brand-tag {
    font-size: 0.78rem;
    color: var(--ink-soft);
    line-height: 1.35;
    margin-top: 4px;
    max-width: 640px;
}

/* Ленточная навигация */
.ribbon-nav {
    background: linear-gradient(90deg, rgba(194,106,74,0.05), rgba(230,184,125,0.08), rgba(194,106,74,0.05));
    border-top: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
}
.ribbon-nav ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 0;
}
.ribbon-nav li {
    position: relative;
}
.ribbon-nav a {
    display: inline-block;
    padding: 14px 22px;
    color: var(--ink);
    font-size: 0.95rem;
    letter-spacing: 0.02em;
    border-bottom: 2px solid transparent;
    transition: background .2s, border-color .2s, color .2s;
}
.ribbon-nav a:hover,
.ribbon-nav .current-menu-item a,
.ribbon-nav .current_page_item a {
    color: var(--terra);
    border-bottom-color: var(--terra);
    background: rgba(194,106,74,0.08);
    text-decoration: none;
}
.ribbon-nav li + li { border-left: 1px dashed var(--line); }

.nav-toggle {
    display: none;
    background: none;
    border: 1px solid var(--line);
    color: var(--ink);
    padding: 8px 14px;
    font-size: 0.95rem;
    cursor: pointer;
    border-radius: 6px;
    margin: 10px 0;
}

/* ============ Главная ============ */
.hero-section {
    background: linear-gradient(180deg, var(--paper), var(--block));
    padding: 60px 0;
    text-align: center;
    border-bottom: 1px solid var(--line);
}
.hero-title {
    font-size: 2.6rem;
    max-width: 860px;
    margin: 0 auto 0.5em;
    font-family: var(--serif);
}
.hero-lead {
    max-width: 720px;
    margin: 0 auto 1.5em;
    color: var(--ink-soft);
    font-size: 1.05rem;
}

.feature-block {
    padding: 56px 0;
    border-bottom: 1px dashed var(--line);
}
.feature-block:nth-child(even) {
    background: var(--block);
}
.feature-head {
    text-align: center;
    margin-bottom: 36px;
}
.feature-head h2 {
    font-size: 1.9rem;
    margin: 0 0 0.3em;
}
.feature-head p {
    color: var(--ink-soft);
    max-width: 680px;
    margin: 0 auto;
}

.grid-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 26px;
}
.grid-2 {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 26px;
}

.genre-score {
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 26px 22px;
    position: relative;
    box-shadow: var(--shadow);
    transition: transform .25s, box-shadow .25s;
}
.genre-score:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lift);
}
.genre-score::before {
    content: "";
    position: absolute;
    top: 12px; right: 14px; left: 14px;
    height: 2px;
    background: repeating-linear-gradient(90deg, var(--ochre) 0 2px, transparent 2px 10px);
    opacity: 0.6;
}
.genre-score h3 {
    font-size: 1.4rem;
    margin-top: 18px;
}
.genre-origin {
    display: inline-block;
    background: rgba(230,184,125,0.25);
    color: var(--clay);
    font-size: 0.82rem;
    padding: 3px 10px;
    border-radius: 20px;
    margin-bottom: 10px;
    font-family: var(--serif);
}
.genre-key {
    color: var(--ink-soft);
    font-size: 0.98rem;
}

.compare-pair {
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow);
}
.compare-pair h3 {
    font-size: 1.15rem;
    color: var(--terra);
    border-bottom: 1px solid var(--line);
    padding-bottom: 8px;
}
.mock-player {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px;
    margin: 12px 0;
    background: var(--block);
    border-radius: 8px;
}
.mock-player-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 2px solid var(--terra);
    background: transparent;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .2s;
    flex-shrink: 0;
}
.mock-player-btn:hover { background: rgba(194,106,74,0.15); }
.mock-player-btn::before {
    content: "";
    width: 0; height: 0;
    border-left: 10px solid var(--terra);
    border-top: 6px solid transparent;
    border-bottom: 6px solid transparent;
    margin-left: 3px;
}
.mock-wave {
    flex: 1;
    height: 28px;
    background: repeating-linear-gradient(90deg, var(--terra) 0 2px, transparent 2px 5px);
    opacity: 0.55;
    border-radius: 4px;
}

.step-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 22px;
    counter-reset: step;
}
.step-item {
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 22px 20px;
    position: relative;
    counter-increment: step;
}
.step-item::before {
    content: counter(step, decimal-leading-zero);
    font-family: var(--serif);
    font-size: 2rem;
    color: var(--ochre);
    display: block;
    margin-bottom: 8px;
}
.step-item h4 {
    font-size: 1.1rem;
    margin-bottom: 6px;
}
.step-item p {
    font-size: 0.92rem;
    color: var(--ink-soft);
    margin: 0;
}

.tradition-map {
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 36px;
    display: flex;
    flex-direction: column;
    gap: 24px;
    align-items: center;
}
.tradition-map svg {
    width: 100%;
    max-width: 720px;
    height: auto;
}
.tradition-map-legend {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    justify-content: center;
    font-size: 0.9rem;
    color: var(--ink-soft);
}
.tradition-map-legend span {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.tradition-map-legend span::before {
    content: "";
    width: 10px; height: 10px;
    border-radius: 50%;
    background: var(--terra);
    display: inline-block;
}

/* ============ Кнопки ============ */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 11px 22px;
    background: var(--terra);
    color: #fff;
    border: 0;
    border-radius: 10px;
    font-size: 0.95rem;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(194,106,74,0.3);
    transition: background .25s, box-shadow .25s, transform .1s;
}
.btn:hover {
    background: var(--clay);
    color: #fff;
    text-decoration: none;
    box-shadow: 0 4px 12px rgba(165,81,50,0.35);
}
.btn:active { transform: translateY(1px); }
.btn::after {
    content: "→";
    font-size: 1.05em;
}
.btn-ghost {
    background: transparent;
    color: var(--terra);
    box-shadow: none;
    border-bottom: 2px solid var(--terra);
    border-radius: 0;
    padding: 8px 4px;
}
.btn-ghost:hover {
    background: rgba(194,106,74,0.1);
    color: var(--terra);
    box-shadow: none;
}

/* ============ Карточки записей (список) ============ */
.post-list {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 22px;
    margin-bottom: 36px;
}
.post-list > .card { height: 100%; }

.card {
    display: flex;
    flex-direction: column;
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: box-shadow .25s;
}
.card:hover { box-shadow: var(--shadow-lift); }

.card-thumb-wrap {
    width: 100%;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    background: var(--block);
}
.card-thumb-wrap a {
    display: block;
    width: 100%;
    height: 100%;
}
.card-thumb-wrap img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.card-body {
    display: flex;
    flex-direction: column;
    flex: 1;
    padding: 22px 26px;
    min-width: 0;
}
.card-meta {
    font-size: 0.82rem;
    color: var(--ink-soft);
    margin-bottom: 8px;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}
.card-meta a { color: var(--terra); }
.card-title {
    font-size: 1.35rem;
    margin: 0 0 10px;
    font-family: var(--serif);
}
.card-title a { color: var(--ink); }
.card-title a:hover { color: var(--terra); text-decoration: none; }
.card-excerpt {
    color: var(--ink-soft);
    font-size: 0.97rem;
    flex: 1;
}
.card-excerpt p {
    margin: 0 0 0.5em;
    background: none;
}
.card-excerpt p:last-child { margin-bottom: 0; }
.card-actions {
    margin-top: 14px;
}

/* Без миниатюры — карточка без thumb-wrap */
.card.no-thumb .card-body { width: 100%; }

/* ============ Одиночная запись / страница ============ */
.single-head {
    margin-bottom: 24px;
}
.single-title {
    font-size: 2.1rem;
    margin-bottom: 0.3em;
}
.single-meta {
    color: var(--ink-soft);
    font-size: 0.9rem;
}
.entry-content > * + * { margin-top: 1em; }
.entry-content img {
    border-radius: var(--radius);
    margin: 1em 0;
}
.entry-content h2 { margin-top: 1.4em; }
.entry-content h3 { margin-top: 1.2em; }
.post-thumb-main {
    border-radius: var(--radius);
    overflow: hidden;
    margin: 0 0 24px;
}
.post-thumb-main img {
    width: 100%;
    height: auto;
    display: block;
}
.post-tags {
    margin: 30px 0 0;
    padding-top: 20px;
    border-top: 1px solid var(--line);
    font-size: 0.9rem;
}
.post-tags a {
    display: inline-block;
    margin-right: 8px;
    padding: 3px 10px;
    background: var(--block);
    border-radius: 14px;
    color: var(--terra);
    font-size: 0.85rem;
}
.post-tags a:hover {
    background: var(--terra);
    color: #fff;
    text-decoration: none;
}

/* ============ Сайдбар ============ */
.sidebar {
    font-size: 0.95rem;
}
.widget {
    margin-bottom: 32px;
    padding-bottom: 20px;
    border-bottom: 1px dashed var(--line);
}
.widget:last-child { border-bottom: 0; }
.widget-title {
    font-family: var(--serif);
    font-size: 1.15rem;
    color: var(--terra);
    margin-bottom: 0.7em;
    padding-bottom: 0.3em;
    border-bottom: 2px solid var(--ochre);
}
.widget ul {
    list-style: none;
    padding: 0;
    margin: 0;
}
.widget li {
    padding: 6px 0;
    border-bottom: 1px dotted var(--line);
}
.widget li:last-child { border-bottom: 0; }
.widget li a { color: var(--ink); }
.widget li a:hover { color: var(--terra); text-decoration: none; }

/* ============ Хлебные крошки ============ */
.crumbs {
    font-size: 0.87rem;
    color: var(--ink-soft);
    margin-bottom: 22px;
    padding-bottom: 10px;
    border-bottom: 1px dashed var(--line);
}
.crumbs a { color: var(--terra); }
.crumbs .sep {
    margin: 0 6px;
    color: var(--ochre);
}

/* ============ Пагинация ============ */
.pager {
    margin: 40px 0 0;
    display: flex;
    gap: 6px;
    justify-content: center;
    flex-wrap: wrap;
}
.pager a, .pager span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    height: 40px;
    padding: 0 12px;
    border: 1px solid var(--line);
    background: var(--paper);
    color: var(--ink);
    border-radius: 6px;
    font-size: 0.92rem;
    text-decoration: none;
}
.pager a:hover {
    background: rgba(194,106,74,0.12);
    border-color: var(--terra);
    color: var(--terra);
    text-decoration: none;
}
.pager .current {
    background: var(--terra);
    border-color: var(--terra);
    color: #fff;
    font-weight: 600;
}

/* ============ Подвал ============ */
.page-foot {
    background: var(--ink);
    color: #cfc6b5;
    padding: 56px 0 24px;
    margin-top: 60px;
    font-size: 0.93rem;
    position: relative;
}
.page-foot::before {
    content: "";
    display: block;
    position: absolute;
    top: 0; left: 50%;
    transform: translateX(-50%);
    width: 60%;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--ochre), transparent);
}
.page-foot a { color: var(--ochre); }
.page-foot a:hover { color: #fff; }
.foot-cols {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 40px;
    margin-bottom: 36px;
}
.foot-col .widget-title {
    color: var(--ochre);
    border-bottom-color: rgba(230,184,125,0.3);
    font-size: 1.05rem;
}
.foot-col .widget { border-bottom: 0; margin-bottom: 0; padding-bottom: 0; }
.foot-col ul { list-style: none; padding: 0; margin: 0; }
.foot-col li { padding: 4px 0; border: 0; }
.foot-col li a { color: #cfc6b5; }
.foot-col li a:hover { color: var(--ochre); text-decoration: none; }

.copyright {
    text-align: center;
    padding-top: 22px;
    border-top: 1px solid rgba(255,255,255,0.08);
    color: #8e8775;
    font-size: 0.86rem;
    font-family: var(--serif);
    letter-spacing: 0.03em;
}

/* ============ Комментарии ============ */
.comments-area {
    margin-top: 40px;
    padding-top: 30px;
    border-top: 1px solid var(--line);
}
.comments-title {
    font-size: 1.4rem;
    margin-bottom: 20px;
}
.comment-list {
    list-style: none;
    padding: 0;
    margin: 0 0 30px;
}
.comment-body {
    padding: 18px 20px;
    background: var(--block);
    border-radius: var(--radius);
    margin-bottom: 16px;
}
.comment-meta {
    font-size: 0.85rem;
    color: var(--ink-soft);
    margin-bottom: 8px;
}
.comment-author { font-weight: 600; color: var(--ink); }
.comment .children {
    list-style: none;
    padding-left: 24px;
    margin-top: 14px;
}
.comment-form label {
    display: block;
    margin-bottom: 4px;
    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: 6px;
    background: var(--paper);
    font-family: inherit;
    font-size: 0.95rem;
    margin-bottom: 14px;
}
.comment-form textarea { min-height: 120px; resize: vertical; }
.comment-form input:focus, .comment-form textarea:focus {
    outline: 0;
    border-color: var(--terra);
    box-shadow: 0 0 0 3px rgba(194,106,74,0.15);
}
.comment-form .submit {
    background: var(--terra);
    color: #fff;
    border: 0;
    padding: 10px 24px;
    border-radius: 10px;
    font-size: 0.95rem;
    cursor: pointer;
}
.comment-form .submit:hover { background: var(--clay); }

/* ============ Форма поиска ============ */
.search-form {
    display: flex;
    gap: 8px;
    max-width: 520px;
}
.search-form input[type=search] {
    flex: 1;
    padding: 10px 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--paper);
    font-size: 0.95rem;
    font-family: inherit;
}
.search-form input[type=search]:focus {
    outline: 0;
    border-color: var(--terra);
}
.search-form button {
    background: var(--terra);
    color: #fff;
    border: 0;
    padding: 10px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.95rem;
}
.search-form button:hover { background: var(--clay); }

/* ============ 404 ============ */
.not-found {
    text-align: center;
    padding: 60px 20px;
}
.not-found .big {
    font-size: 5rem;
    font-family: var(--serif);
    color: var(--ochre);
    margin: 0;
    line-height: 1;
}

/* ============ Cookie-баннер ============ */
.cookie-bar {
    position: fixed;
    bottom: 18px;
    left: 18px;
    right: 18px;
    max-width: 680px;
    margin: 0 auto;
    background: var(--ink);
    color: #e7dfcd;
    padding: 14px 20px;
    border-radius: var(--radius);
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    display: flex;
    align-items: center;
    gap: 16px;
    z-index: 9999;
    font-size: 0.9rem;
}
.cookie-bar.is-hidden { display: none; }
.cookie-bar span { flex: 1; }
.cookie-bar button {
    background: var(--ochre);
    color: var(--ink);
    border: 0;
    padding: 8px 18px;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    flex-shrink: 0;
}
.cookie-bar button:hover { background: #f2cc98; }

/* ============ Адаптив ============ */
@media (max-width: 960px) {
    h1 { font-size: 1.9rem; }
    .hero-title { font-size: 2rem; }
    .content-with-side {
        grid-template-columns: 1fr;
        gap: 40px;
    }
    .grid-3, .step-row {
        grid-template-columns: repeat(2, 1fr);
    }
    .foot-cols {
        grid-template-columns: 1fr;
        gap: 28px;
    }
}

@media (max-width: 600px) {
    body { font-size: 16px; }
    .hero-section { padding: 40px 0; }
    .hero-title { font-size: 1.7rem; }
    .grid-3, .grid-2, .step-row, .post-list {
        grid-template-columns: 1fr;
    }
    .feature-block { padding: 36px 0; }
    .content-wide { width: 100%; }

    .masthead { flex-wrap: wrap; gap: 14px; }
    .ribbon-nav ul { flex-direction: column; }
    .ribbon-nav li + li { border-left: 0; border-top: 1px dashed var(--line); }
    .ribbon-nav a { padding: 12px 18px; }
    .ribbon-nav.is-closed ul { display: none; }
    .nav-toggle { display: inline-block; }

    .cookie-bar {
        flex-direction: column;
        align-items: stretch;
        text-align: center;
    }
}
