/*
Theme Name: dds_toupielowther.com
Author: Илья Мартынов
Description: Образовательная платформа о современной кулинарии, где обучение строится на техкартах, прикладной нутрициологии и понимании химии пищи; сочетает редакционный контент, методические материалы и курсы.
Version: 1.1
Text Domain: dds_toup
*/

/* ==========================================================================
   Основа и переменные
   ========================================================================== */
:root {
    --ink: #1A1A1A;
    --cream: #FDF8F0;
    --terra: #C45B3C;
    --terra-light: #D77354;
    --avocado: #5E7B52;
    --avocado-light: #7A9668;
    --muted: #6b6b6b;
    --line: #e5ddd0;
    --paper: #fbf4e6;
    --warm-shadow: 0 4px 12px rgba(26, 26, 26, 0.08);
    --warm-shadow-hover: 0 8px 20px rgba(26, 26, 26, 0.12);
    --radius: 8px;
    --radius-sm: 4px;
    --maxw: 1200px;
    --content-wide: 85%;
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    font-family: "Inter", "Helvetica Neue", Arial, sans-serif;
    background-color: var(--cream);
    color: var(--ink);
    font-size: 16px;
    line-height: 1.65;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

/* Заголовки */
h1, h2, h3, h4, h5, h6 {
    font-family: "Playfair Display", "Georgia", serif;
    color: var(--ink);
    line-height: 1.25;
    margin: 1.2em 0 0.6em;
    font-weight: 700;
}

h1 { font-size: 2.4rem; }
h2 { font-size: 1.9rem; }
h3 { font-size: 1.45rem; }
h4 { font-size: 1.2rem; }

p {
    margin: 0 0 1.1em;
    /* фон не задаётся глобально */
}

a {
    color: var(--terra);
    text-decoration: none;
    border-bottom: 1px solid transparent;
    transition: border-color 0.2s ease, color 0.2s ease;
}

a:hover {
    color: var(--terra-light);
    border-bottom-color: var(--terra);
}

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

hr {
    border: 0;
    border-top: 1px solid var(--line);
    margin: 2em 0;
}

blockquote {
    margin: 1.5em 0;
    padding: 1em 1.5em;
    border-left: 4px solid var(--avocado);
    background: var(--paper);
    font-style: italic;
    border-radius: 0 var(--radius) var(--radius) 0;
}

code {
    font-family: "Courier New", monospace;
    background: var(--paper);
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 0.9em;
}

pre {
    background: var(--ink);
    color: var(--cream);
    padding: 1em;
    border-radius: var(--radius);
    overflow-x: auto;
}

pre code {
    background: transparent;
    color: inherit;
}

/* Таблицы */
table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.5em 0;
    border: 1px solid var(--line);
    background: #fff;
}

th, td {
    border: 1px solid var(--line);
    padding: 0.65em 0.9em;
    text-align: left;
}

th {
    background: var(--paper);
    font-weight: 600;
    color: var(--ink);
}

tbody tr:nth-child(even) {
    background: #fdfaf3;
}

/* ==========================================================================
   Контейнер и сетка
   ========================================================================== */
.wrap {
    max-width: var(--maxw);
    margin: 0 auto;
    padding: 0 24px;
}

.page-layout {
    display: flex;
    gap: 48px;
    padding: 36px 0 64px;
    align-items: flex-start;
}

.page-layout .primary {
    flex: 0 0 67%;
    max-width: 67%;
    min-width: 0;
}

.page-layout .secondary {
    flex: 0 0 27%;
    max-width: 27%;
    min-width: 0;
}

.page-layout.no-sidebar .primary {
    flex: 0 0 var(--content-wide);
    max-width: var(--content-wide);
    margin: 0 auto;
}

/* ==========================================================================
   Шапка
   ========================================================================== */
.site-header {
    background: var(--cream);
    border-bottom: 1px solid var(--line);
    padding: 18px 0;
}

.site-header .wrap {
    display: flex;
    align-items: center;
    gap: 32px;
    flex-wrap: wrap;
}

.brand {
    display: flex;
    align-items: center;
    gap: 14px;
    flex: 0 0 auto;
}

.brand-logo {
    width: 52px;
    height: 52px;
    display: block;
    border-radius: var(--radius-sm);
}

.brand-text {
    display: flex;
    flex-direction: column;
    max-width: 520px;
}

.brand-name {
    font-family: "Playfair Display", Georgia, serif;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--ink);
    line-height: 1.3;
    margin: 0;
    border: 0;
    display: inline-block;
}

.brand-name:hover {
    color: var(--terra);
    border-bottom-color: transparent;
}

.brand-desc {
    font-size: 0.78rem;
    color: var(--muted);
    line-height: 1.4;
    margin-top: 3px;
    max-width: 480px;
}

.primary-nav {
    margin-left: auto;
}

.primary-nav ul {
    display: flex;
    list-style: none;
    margin: 0;
    padding: 0;
    gap: 6px;
    flex-wrap: wrap;
}

.primary-nav li a {
    display: inline-block;
    padding: 8px 14px;
    color: var(--ink);
    border-bottom: 0;
    border-radius: var(--radius-sm);
    font-weight: 500;
    font-size: 0.95rem;
    transition: background 0.2s ease, color 0.2s ease;
}

.primary-nav li a:hover,
.primary-nav li.current-menu-item > a {
    background: var(--paper);
    color: var(--terra);
}

.menu-toggle {
    display: none;
    background: transparent;
    border: 1px solid var(--ink);
    border-radius: var(--radius-sm);
    padding: 8px 12px;
    cursor: pointer;
    font-size: 0.95rem;
    margin-left: auto;
}

/* ==========================================================================
   Кнопки
   ========================================================================== */
.btn,
button.btn,
.wp-block-button__link {
    display: inline-block;
    padding: 10px 20px;
    background: var(--terra);
    color: #fff;
    border: 0;
    border-top: 1.5px solid var(--terra-light);
    border-radius: var(--radius);
    font-family: inherit;
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    text-decoration: none;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.btn:hover,
button.btn:hover,
.wp-block-button__link:hover {
    transform: translateY(2px);
    box-shadow: var(--warm-shadow);
    color: #fff;
    border-bottom-color: transparent;
}

.btn-ghost {
    background: transparent;
    color: var(--ink);
    border: 1px solid var(--ink);
    border-top-width: 1.5px;
}

.btn-ghost:hover {
    color: var(--ink);
    background: var(--paper);
}

.btn-avocado {
    background: var(--avocado);
    border-top-color: var(--avocado-light);
}

/* ==========================================================================
   Хлебные крошки
   ========================================================================== */
.breadcrumbs {
    font-size: 0.88rem;
    color: var(--muted);
    margin: 16px 0 8px;
    line-height: 1.5;
}

.breadcrumbs a {
    color: var(--muted);
    border-bottom: 0;
}

.breadcrumbs a:hover {
    color: var(--terra);
}

.breadcrumbs .sep {
    margin: 0 8px;
    color: var(--line);
}

.breadcrumbs .current {
    color: var(--ink);
}

/* ==========================================================================
   Карточки записей
   ========================================================================== */
.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 28px;
    margin: 24px 0 32px;
}

.card {
    display: flex;
    flex-direction: column;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    overflow: hidden;
    transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.card:hover {
    box-shadow: var(--warm-shadow-hover);
    transform: translateY(-2px);
}

.card-thumb-wrap {
    width: 100%;
    overflow: hidden;
    background: var(--paper);
}

.card-thumb-wrap a {
    display: block;
    border: 0;
}

.card-thumb-wrap img {
    width: 100%;
    height: auto;
    aspect-ratio: 16 / 10;
    object-fit: cover;
    display: block;
    transition: transform 0.4s ease;
}

.card:hover .card-thumb-wrap img {
    transform: scale(1.03);
}

.card-body {
    flex: 1;
    padding: 18px 20px 20px;
    display: flex;
    flex-direction: column;
}

.card-meta {
    font-size: 0.78rem;
    color: var(--avocado);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-weight: 600;
}

.card-meta a {
    color: var(--avocado);
    border-bottom: 0;
}

.card-meta a:hover {
    color: var(--terra);
}

.card-title {
    font-family: "Playfair Display", Georgia, serif;
    font-size: 1.2rem;
    margin: 0 0 10px;
    line-height: 1.3;
}

.card-title a {
    color: var(--ink);
    border-bottom: 0;
}

.card-title a:hover {
    color: var(--terra);
}

.card-excerpt {
    color: #3a3a3a;
    font-size: 0.95rem;
    margin-bottom: 14px;
    flex: 1;
}

.card-excerpt p {
    margin: 0 0 0.5em;
    background: none;
}

.card-actions {
    margin-top: auto;
}

.card-actions .btn {
    padding: 7px 14px;
    font-size: 0.9rem;
}

/* ==========================================================================
   Записи, страницы
   ========================================================================== */
.entry {
    background: #fff;
    padding: 32px 36px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    margin-bottom: 32px;
}

.entry-meta {
    font-size: 0.85rem;
    color: var(--muted);
    margin-bottom: 18px;
}

.entry-meta a {
    color: var(--avocado);
    border-bottom: 0;
}

.entry-title {
    margin-top: 0;
    margin-bottom: 10px;
}

.entry-thumb {
    margin: 0 -36px 24px;
}

.entry-thumb img {
    width: 100%;
    height: auto;
    display: block;
    max-height: 420px;
    object-fit: cover;
}

.entry-content {
    font-size: 1.02rem;
}

.entry-content img {
    border-radius: var(--radius);
    margin: 1em 0;
}

/* ==========================================================================
   Сайдбар
   ========================================================================== */
.secondary .widget {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 18px 20px;
    margin-bottom: 24px;
}

.secondary .widget-title {
    font-family: "Playfair Display", Georgia, serif;
    font-size: 1.1rem;
    margin: 0 0 12px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--avocado);
    color: var(--ink);
}

.secondary .widget ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.secondary .widget li {
    padding: 6px 0;
    border-bottom: 1px dashed var(--line);
}

.secondary .widget li:last-child {
    border-bottom: 0;
}

.secondary .widget li a {
    color: var(--ink);
    border-bottom: 0;
    font-size: 0.95rem;
}

.secondary .widget li a:hover {
    color: var(--terra);
}

/* ==========================================================================
   Подвал
   ========================================================================== */
.site-footer {
    background: var(--ink);
    color: var(--cream);
    padding: 48px 0 24px;
    margin-top: 56px;
}

.site-footer .wrap {
    max-width: var(--maxw);
}

.footer-cols {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 36px;
    margin-bottom: 32px;
}

.footer-col .widget {
    margin-bottom: 20px;
}

.footer-col .widget-title {
    font-family: "Playfair Display", Georgia, serif;
    color: #fff;
    font-size: 1.05rem;
    margin: 0 0 14px;
    padding-bottom: 8px;
    border-bottom: 1px solid rgba(253, 248, 240, 0.2);
}

.footer-col ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.footer-col li {
    padding: 4px 0;
}

.footer-col a {
    color: var(--cream);
    border-bottom: 0;
    font-size: 0.92rem;
}

.footer-col a:hover {
    color: var(--terra-light);
}

.footer-col p {
    color: rgba(253, 248, 240, 0.82);
    font-size: 0.92rem;
    margin: 0 0 0.8em;
}

.site-footer-bottom {
    padding-top: 20px;
    border-top: 1px solid rgba(253, 248, 240, 0.15);
    text-align: center;
    font-size: 0.88rem;
    color: rgba(253, 248, 240, 0.7);
}

/* ==========================================================================
   Пагинация
   ========================================================================== */
.pagination {
    display: flex;
    justify-content: center;
    gap: 6px;
    margin: 32px 0 16px;
    flex-wrap: wrap;
    list-style: none;
    padding: 0;
}

.pagination .page-numbers {
    display: inline-block;
    padding: 8px 14px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    color: var(--ink);
    font-size: 0.95rem;
    text-decoration: none;
    border-bottom: 1px solid var(--line);
    transition: background 0.2s ease, color 0.2s ease;
}

.pagination .page-numbers:hover {
    background: var(--paper);
    color: var(--terra);
}

.pagination .page-numbers.current {
    background: var(--terra);
    color: #fff;
    border-color: var(--terra);
}

.pagination .dots {
    border-color: transparent;
    background: transparent;
}

/* ==========================================================================
   Главная страница
   ========================================================================== */
.hero {
    background: linear-gradient(135deg, var(--paper) 0%, var(--cream) 100%);
    padding: 64px 0;
    border-bottom: 1px solid var(--line);
}

.hero-inner {
    max-width: 800px;
}

.hero h1 {
    font-size: 2.8rem;
    margin-top: 0;
    margin-bottom: 18px;
}

.hero-lead {
    font-size: 1.1rem;
    color: #333;
    margin-bottom: 24px;
    line-height: 1.6;
}

.hero-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.section-block {
    padding: 56px 0;
    border-bottom: 1px solid var(--line);
}

.section-block:nth-child(even) {
    background: var(--paper);
}

.section-block .section-title {
    font-size: 2rem;
    margin: 0 0 10px;
}

.section-block .section-sub {
    color: var(--muted);
    margin-bottom: 32px;
    font-size: 1rem;
    max-width: 700px;
}

/* Тематический блок: техкарты */
.techcards {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
}

.techcard {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 24px;
    border-top: 3px solid var(--terra);
    transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.techcard:hover {
    box-shadow: var(--warm-shadow);
    transform: translateY(-2px);
}

.techcard-icon {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--paper);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 14px;
    color: var(--terra);
    font-weight: 700;
    font-size: 1.1rem;
}

.techcard h3 {
    margin-top: 0;
    font-size: 1.2rem;
}

.techcard p {
    margin: 0;
    font-size: 0.95rem;
    color: #444;
}

/* Тематический блок: химия (врезки) */
.chem-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
}

.chem-card {
    padding: 22px;
    border-radius: var(--radius);
    background: #fff;
    border-left: 4px solid var(--avocado);
}

.chem-card.ph { border-left-color: #8b7cb8; }
.chem-card.maillard { border-left-color: var(--terra); }
.chem-card.emulsion { border-left-color: var(--avocado); }

.chem-tag {
    font-size: 0.72rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--muted);
    font-weight: 600;
    margin-bottom: 8px;
    display: inline-block;
}

.chem-card h3 {
    margin: 4px 0 10px;
    font-size: 1.15rem;
}

.chem-card p {
    margin: 0;
    font-size: 0.92rem;
    color: #444;
}

/* Тематический блок: курс как временная шкала */
.timeline {
    position: relative;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 18px;
    counter-reset: step;
}

.timeline::before {
    content: "";
    position: absolute;
    top: 24px;
    left: 5%;
    right: 5%;
    height: 2px;
    background: var(--line);
    z-index: 0;
}

.timeline-step {
    position: relative;
    background: var(--cream);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 56px 18px 20px;
    text-align: center;
    z-index: 1;
    counter-increment: step;
}

.timeline-step::before {
    content: counter(step);
    position: absolute;
    top: 14px;
    left: 50%;
    transform: translateX(-50%);
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--terra);
    color: #fff;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.95rem;
}

.timeline-step h4 {
    margin: 0 0 6px;
    font-size: 1rem;
}

.timeline-step p {
    margin: 0;
    font-size: 0.85rem;
    color: var(--muted);
}

/* Последние записи секция */
.latest-section {
    padding: 56px 0;
    background: var(--cream);
}

/* ==========================================================================
   Формы, поиск
   ========================================================================== */
input[type="text"],
input[type="email"],
input[type="url"],
input[type="search"],
input[type="password"],
textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 0.95rem;
    background: #fff;
    color: var(--ink);
    transition: border-color 0.2s ease;
}

input[type="text"]:focus,
input[type="email"]:focus,
input[type="url"]:focus,
input[type="search"]:focus,
input[type="password"]:focus,
textarea:focus {
    border-color: var(--terra);
    outline: none;
}

.search-form {
    display: flex;
    gap: 8px;
    max-width: 480px;
    margin: 16px 0;
}

.search-form input[type="search"] {
    flex: 1;
}

.search-form button {
    padding: 10px 18px;
    background: var(--terra);
    color: #fff;
    border: 0;
    border-top: 1.5px solid var(--terra-light);
    border-radius: var(--radius);
    cursor: pointer;
    font-weight: 600;
    white-space: nowrap;
    transition: transform 0.15s ease;
}

.search-form button:hover {
    transform: translateY(2px);
    box-shadow: var(--warm-shadow);
}

/* ==========================================================================
   Комментарии
   ========================================================================== */
.comments-area {
    margin-top: 40px;
    background: #fff;
    padding: 28px 32px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
}

.comments-title {
    margin-top: 0;
}

.comment-list {
    list-style: none;
    padding: 0;
    margin: 0 0 24px;
}

.comment-body {
    padding: 14px 0;
    border-bottom: 1px solid var(--line);
}

.comment-author {
    font-weight: 600;
    margin-bottom: 4px;
}

.comment-meta {
    font-size: 0.8rem;
    color: var(--muted);
    margin-bottom: 10px;
}

.comment-list .children {
    list-style: none;
    padding-left: 24px;
    border-left: 2px solid var(--line);
    margin-top: 10px;
}

.comment-respond label {
    display: block;
    margin: 10px 0 4px;
    font-size: 0.9rem;
    font-weight: 500;
}

.comment-respond textarea {
    min-height: 120px;
    resize: vertical;
}

/* ==========================================================================
   404
   ========================================================================== */
.error-404 {
    text-align: center;
    padding: 48px 24px;
}

.error-404 .huge {
    font-size: 6rem;
    margin: 0;
    color: var(--terra);
    font-family: "Playfair Display", Georgia, serif;
    line-height: 1;
}

/* ==========================================================================
   Cookie-баннер
   ========================================================================== */
.cookie-banner {
    position: fixed;
    left: 16px;
    right: 16px;
    bottom: 16px;
    z-index: 999;
    background: var(--ink);
    color: var(--cream);
    padding: 16px 20px;
    border-radius: var(--radius);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
    display: flex;
    align-items: center;
    gap: 18px;
    max-width: 900px;
    margin: 0 auto;
}

.cookie-banner p {
    margin: 0;
    font-size: 0.9rem;
    flex: 1;
}

.cookie-banner button {
    padding: 8px 18px;
    background: var(--terra);
    color: #fff;
    border: 0;
    border-top: 1.5px solid var(--terra-light);
    border-radius: var(--radius);
    cursor: pointer;
    font-weight: 600;
    white-space: nowrap;
    transition: transform 0.15s ease;
    font-family: inherit;
}

.cookie-banner button:hover {
    transform: translateY(2px);
}

.cookie-banner.is-hidden {
    display: none;
}

/* ==========================================================================
   Утилиты
   ========================================================================== */
.alignleft { float: left; margin: 0 1.5em 1em 0; }
.alignright { float: right; margin: 0 0 1em 1.5em; }
.aligncenter { display: block; margin: 1em auto; }
.screen-reader-text {
    position: absolute !important;
    clip: rect(1px, 1px, 1px, 1px);
    height: 1px; width: 1px;
    overflow: hidden;
}

.sticky-post-label {
    display: inline-block;
    background: var(--avocado);
    color: #fff;
    padding: 2px 8px;
    border-radius: 3px;
    font-size: 0.72rem;
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

/* ==========================================================================
   Адаптив
   ========================================================================== */
@media (max-width: 960px) {
    h1 { font-size: 2rem; }
    .hero h1 { font-size: 2.2rem; }

    .page-layout {
        flex-direction: column;
        gap: 28px;
    }
    .page-layout .primary,
    .page-layout .secondary,
    .page-layout.no-sidebar .primary {
        flex: 1 1 auto;
        max-width: 100%;
    }

    .footer-cols {
        grid-template-columns: repeat(2, 1fr);
    }

    .techcards,
    .chem-row {
        grid-template-columns: repeat(2, 1fr);
    }

    .timeline {
        grid-template-columns: repeat(2, 1fr);
    }

    .timeline::before {
        display: none;
    }
}

@media (max-width: 600px) {
    body { font-size: 15px; }

    .wrap { padding: 0 16px; }

    h1 { font-size: 1.7rem; }
    .hero h1 { font-size: 1.9rem; }
    h2 { font-size: 1.5rem; }

    .hero { padding: 40px 0; }
    .section-block { padding: 40px 0; }

    .site-header .wrap {
        gap: 12px;
    }

    .brand-desc {
        display: none;
    }

    .primary-nav {
        order: 3;
        width: 100%;
        display: none;
    }

    .primary-nav.is-open {
        display: block;
    }

    .primary-nav ul {
        flex-direction: column;
        gap: 2px;
    }

    .primary-nav li a {
        display: block;
        padding: 10px 12px;
    }

    .menu-toggle {
        display: inline-block;
    }

    .cards-grid {
        grid-template-columns: 1fr;
    }

    .footer-cols {
        grid-template-columns: 1fr;
        gap: 24px;
    }

    .techcards,
    .chem-row {
        grid-template-columns: 1fr;
    }

    .timeline {
        grid-template-columns: 1fr;
    }

    .entry {
        padding: 22px 20px;
    }

    .entry-thumb {
        margin: 0 -20px 18px;
    }

    .cookie-banner {
        flex-direction: column;
        text-align: center;
        gap: 10px;
    }
}
