:root {
    --bg: #faf8f4;
    --surface: #ffffff;
    --surface-alt: #f2eee6;
    --text: #1d2420;
    --muted: #5d6762;
    --border: #e4e0d7;
    --accent: #1f5c4a;
    --accent-soft: #e3efe9;
    --accent-text: #ffffff;
    --warm: #c8743a;
    --notice: #fdf0e3;
    --radius: 14px;
    --shadow: 0 1px 2px rgb(0 0 0 / .04), 0 6px 24px rgb(0 0 0 / .05);
    --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --font-serif: Georgia, "Times New Roman", serif;
    --max: 1160px;
    color-scheme: light;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #121614;
        --surface: #1a201d;
        --surface-alt: #161c19;
        --text: #e8ebe9;
        --muted: #9aa49f;
        --border: #2a322e;
        --accent: #5fb393;
        --accent-soft: #1d3029;
        --accent-text: #0d1311;
        --warm: #e09a63;
        --notice: #2e2418;
        --shadow: none;
        color-scheme: dark;
    }
}

*, *::before, *::after { box-sizing: border-box; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font: 17px/1.6 var(--font);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    -webkit-text-size-adjust: 100%;
}

main { flex: 1; }
a { color: var(--accent); text-underline-offset: 3px; text-decoration-thickness: 1px; }
img { max-width: 100%; height: auto; display: block; }
h1, h2, h3 { line-height: 1.2; letter-spacing: -.01em; }

.container { width: 100%; max-width: var(--max); margin: 0 auto; padding: 0 16px; }
@media (min-width: 720px) { .container { padding: 0 28px; } }

.muted { color: var(--muted); }
.small { font-size: .85rem; }
.eyebrow { margin: 0 0 6px; font-size: .78rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--warm); }
.lead { font-size: 1.15rem; color: var(--muted); }

/* Шапка */
.site-header { background: var(--surface); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 10; }
.header-inner { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 24px; padding-top: 12px; padding-bottom: 12px; }
.logo { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 1.1rem; color: var(--text); text-decoration: none; }
.logo svg { color: var(--accent); }
.main-nav { display: flex; flex-wrap: wrap; gap: 4px 18px; font-size: .95rem; }
.main-nav a { color: var(--muted); text-decoration: none; padding: 4px 0; border-bottom: 2px solid transparent; }
.main-nav a:hover, .main-nav a[aria-current="page"] { color: var(--text); border-bottom-color: var(--accent); }
.search { margin-left: auto; }
.search input { width: 220px; max-width: 100%; }
@media (max-width: 720px) {
    .site-header { position: static; }
    .search { margin-left: 0; width: 100%; }
    .search input { width: 100%; }
}

input, select {
    font: inherit; font-size: .95rem; color: var(--text); background: var(--bg);
    border: 1px solid var(--border); border-radius: 10px; padding: 8px 12px;
}

/* Кнопки и чипы */
.btn {
    display: inline-block; padding: 10px 18px; border: 0; border-radius: 10px; cursor: pointer;
    background: var(--accent); color: var(--accent-text); font: inherit; font-weight: 600; text-decoration: none;
}
.btn-ghost { background: transparent; color: var(--accent); border: 1px solid var(--border); }
.btn-small { padding: 7px 14px; font-size: .9rem; }
.is-disabled { opacity: .45; pointer-events: none; }
.chip {
    display: inline-block; padding: 3px 10px; border-radius: 999px; background: var(--accent-soft);
    color: var(--accent); font-size: .8rem; font-weight: 600; text-decoration: none; white-space: nowrap;
}
.chip-outline { background: transparent; border: 1px solid var(--border); color: var(--muted); }
.chip-row { display: flex; flex-wrap: wrap; gap: 8px; }

/* Секции */
.section { padding: 40px 0; }
.section-alt { background: var(--surface-alt); }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
.section-head h2 { margin: 0; font-size: 1.6rem; }
.page-head { padding: 40px 0 24px; }
.page-head h1 { font-size: clamp(1.9rem, 4vw, 2.6rem); margin: 0 0 8px; }
.page-head p { margin: 0; color: var(--muted); max-width: 680px; }
.breadcrumbs { font-size: .9rem; color: var(--muted); margin-bottom: 14px; }
.breadcrumbs a { color: var(--muted); }

/* Главная */
.hero { padding: 48px 0 24px; }
.hero-inner { display: grid; gap: 32px; align-items: center; }
@media (min-width: 900px) { .hero-inner { grid-template-columns: 1.1fr .9fr; } }
.hero h1 { font-size: clamp(2rem, 4.5vw, 3rem); margin: 0 0 14px; }
.actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 22px; }
.featured {
    display: flex; flex-direction: column; gap: 10px; padding: 14px; color: var(--text); text-decoration: none;
    background: var(--surface); border: 1px solid var(--border); border-radius: calc(var(--radius) + 4px); box-shadow: var(--shadow);
}
.featured .chip { align-self: flex-start; }
.featured strong { font-size: 1.3rem; line-height: 1.25; }
.featured:hover strong { color: var(--accent); }

/* Карточки */
.grid { display: grid; gap: 22px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr)); }
.card {
    display: flex; flex-direction: column; overflow: hidden;
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow);
}
.card .cover { border-radius: 0; }
.card-body { padding: 16px 18px 20px; }
.card h3 { margin: 10px 0 6px; font-size: 1.2rem; }
.card h3 a { color: var(--text); text-decoration: none; }
.card h3 a:hover { color: var(--accent); }
.card p { margin: 0; font-size: .95rem; }
.meta { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 10px; font-size: .88rem; color: var(--muted); }
.price { margin-top: 8px !important; font-weight: 700; font-size: 1.05rem !important; }

.cover {
    width: 100%; overflow: hidden; border-radius: var(--radius);
    background: linear-gradient(135deg, hsl(var(--h) 32% 82%), hsl(calc(var(--h) + 30) 38% 70%));
    color: hsl(var(--h) 40% 22%);
}
@media (prefers-color-scheme: dark) {
    .cover {
        background: linear-gradient(135deg, hsl(var(--h) 22% 22%), hsl(calc(var(--h) + 30) 26% 30%));
        color: hsl(var(--h) 40% 80%);
    }
}
.cover img, .cover svg { width: 100%; height: 100%; object-fit: cover; }

/* Статья */
.article { padding-bottom: 8px; }
.article-head { padding: 40px 0 20px; max-width: 820px; }
.article-head h1 { font-size: clamp(1.9rem, 4.2vw, 2.8rem); margin: 0 0 12px; }
.article-cover { margin-bottom: 32px; max-height: 520px; }
.article-layout { display: grid; gap: 32px; align-items: start; }
@media (min-width: 1000px) {
    .article-layout:has(.complex-box) { grid-template-columns: minmax(0, 1fr) 300px; }
    .article-layout .complex-box { position: sticky; top: 90px; }
}
.notice { margin: 24px 0 0; padding: 12px 16px; border-radius: 10px; background: var(--notice); }
.tags { margin-top: 32px; }

.complex-box {
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
    padding: 20px; box-shadow: var(--shadow);
}
.complex-box h2 { margin: 0 0 12px; font-size: 1.3rem; }
.complex-box h2 a { color: var(--text); }
.complex-box dl { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; margin: 0 0 16px; font-size: .93rem; }
.complex-box dt { color: var(--muted); }
.complex-box dd { margin: 0; font-weight: 600; }
.complex-box .eyebrow { margin-top: 16px; }
.features { margin: 0 0 16px; padding-left: 20px; font-size: .93rem; }
.complex-layout { display: grid; gap: 32px; align-items: start; }
@media (min-width: 1000px) { .complex-layout { grid-template-columns: minmax(0, 1fr) 340px; } }

.filters { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 28px; }

/* Текст статей (HTML из редактора) */
.prose { max-width: 720px; font-size: 1.08rem; overflow-wrap: break-word; }
.prose h2 { margin-top: 2em; font-size: 1.55rem; }
.prose h3 { margin-top: 1.6em; font-size: 1.25rem; }
.prose img { border-radius: var(--radius); margin: 1.5em 0; }
/* Подпись к фото: абзац курсивом сразу под картинкой. */
.prose p:has(> img:only-child) { margin-bottom: 0; }
.prose p:has(> img:only-child) img { margin-bottom: .5em; }
.prose p:has(> img:only-child) + p:has(> em:only-child) { margin-top: 0; font-size: .88rem; color: var(--muted); }
.prose blockquote {
    margin: 1.5em 0; padding: 4px 20px; border-left: 4px solid var(--warm);
    color: var(--muted); font-family: var(--font-serif); font-size: 1.12em;
}
.prose table { width: 100%; border-collapse: collapse; margin: 1.5em 0; font-size: .95rem; display: block; overflow-x: auto; }
.prose th, .prose td { padding: 10px 12px; border-bottom: 1px solid var(--border); text-align: left; }
.prose th { background: var(--accent-soft); }
.prose th p, .prose td p { margin: 0; }
.prose code { font-size: .9em; background: var(--accent-soft); padding: 1px 5px; border-radius: 5px; }
.prose pre { overflow-x: auto; padding: 14px; border-radius: 10px; background: var(--surface-alt); }
.prose hr { border: 0; border-top: 1px solid var(--border); margin: 2.5em 0; }
.prose .lead { font-size: 1.2em; }
.prose mark { background: #f8e3b5; padding: 0 3px; }
.prose [data-align="center"], .prose [style*="text-align: center"] { text-align: center; }

.pagination { display: flex; justify-content: center; align-items: center; flex-wrap: wrap; gap: 16px; margin-top: 36px; }

/* Подвал */
.site-footer { margin-top: 56px; padding: 32px 0; background: var(--surface); border-top: 1px solid var(--border); font-size: .92rem; }
.footer-inner { display: grid; gap: 24px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); }
.site-footer p { margin: 4px 0 0; }
.site-footer nav { display: flex; flex-direction: column; gap: 4px; }
.site-footer nav a { color: var(--muted); }
