/* Prudologia — публичная часть (M5).
   Современная светлая тема, «водная» палитра (глубокий бирюзовый акцент).
   CSP-ready: только внешний CSS, без inline. Системный шрифт-стек. */

:root {
    --bg:           #f7faf9;
    --surface:      #ffffff;
    --ink:          #15242b;
    --ink-soft:     #4a5b62;
    --muted:        #7d8b91;
    --line:         #e3eae8;
    --accent:       #0e8f86;   /* бирюзово-зелёный, «пруд» */
    --accent-dark:  #0a6f68;
    --accent-soft:  #e3f4f1;
    --warn:         #b4541a;
    --radius:       14px;
    --radius-sm:    9px;
    --shadow:       0 1px 2px rgba(21,36,43,.05), 0 8px 24px rgba(21,36,43,.06);
    --shadow-hover: 0 4px 10px rgba(21,36,43,.08), 0 16px 40px rgba(21,36,43,.10);
    --wrap:         1120px;
    --wrap-narrow:  760px;
    --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
}

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

html { -webkit-text-size-adjust: 100%; }

body.site {
    margin: 0;
    font-family: var(--font);
    font-size: 17px;
    line-height: 1.65;
    color: var(--ink);
    background: var(--bg);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

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

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

.wrap { width: 100%; max-width: var(--wrap); margin: 0 auto; padding: 0 20px; }
.wrap--narrow { max-width: var(--wrap-narrow); }

.site-main { flex: 1 0 auto; padding: 32px 0 64px; }

.muted { color: var(--muted); }

/* ---------- Header ---------- */
.site-header {
    position: sticky; top: 0; z-index: 50;
    background: rgba(255,255,255,.92);
    backdrop-filter: saturate(150%) blur(8px);
    border-bottom: 1px solid var(--line);
}
.site-header__inner {
    display: flex; align-items: center; gap: 20px;
    min-height: 68px; flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: 12px; color: var(--ink); }
.brand:hover { text-decoration: none; }
.brand__mark {
    width: 30px; height: 30px; border-radius: 50%; flex: none;
    background: radial-gradient(circle at 30% 30%, #3fc9bc, var(--accent) 60%, var(--accent-dark));
    box-shadow: inset 0 0 0 3px rgba(255,255,255,.6);
}
.brand__text { display: flex; flex-direction: column; line-height: 1.15; }
.brand__name { font-weight: 700; font-size: 1.2rem; letter-spacing: -.01em; }
.brand__tagline { font-size: .8rem; color: var(--muted); }

.site-nav { display: flex; align-items: center; gap: 6px; margin-left: auto; flex-wrap: wrap; }
.site-nav__link {
    color: var(--ink-soft); padding: 8px 12px; border-radius: var(--radius-sm);
    font-weight: 500; font-size: .98rem;
}
.site-nav__link:hover { background: var(--accent-soft); color: var(--accent-dark); text-decoration: none; }
.site-nav__link--muted { color: var(--muted); }

.site-search { display: flex; align-items: center; margin-left: 6px; }
.site-search__input {
    border: 1px solid var(--line); background: var(--surface);
    border-radius: 999px 0 0 999px; padding: 8px 14px; font: inherit; font-size: .92rem;
    width: 150px; outline: none;
}
.site-search__input:focus { border-color: var(--accent); }
.site-search__btn {
    border: 1px solid var(--accent); background: var(--accent); color: #fff;
    border-radius: 0 999px 999px 0; padding: 8px 14px; cursor: pointer; font: inherit;
}
.site-search__btn:hover { background: var(--accent-dark); }

/* Бургер (мобильный) — CSS-only через скрытый чекбокс, без JS */
.nav-burger { display: none; flex-direction: column; gap: 5px; cursor: pointer; padding: 8px; margin-left: auto; }
.nav-burger span { width: 24px; height: 2px; background: var(--ink); border-radius: 2px; }

/* ---------- Hero ---------- */
.hero {
    background: linear-gradient(160deg, var(--accent-soft), #f7faf9 70%);
    border-bottom: 1px solid var(--line);
    padding: 56px 0 48px; margin: -32px 0 8px;
}
.hero__title { font-size: clamp(2rem, 5vw, 3rem); margin: 0 0 .3em; letter-spacing: -.02em; }
.hero__lead { font-size: 1.2rem; color: var(--ink-soft); max-width: 640px; margin: 0; }

/* ---------- Headings / sections ---------- */
.section-title { font-size: 1.5rem; margin: 8px 0 20px; letter-spacing: -.01em; }
.page-head { margin: 8px 0 28px; }
.page-head__title { font-size: clamp(1.7rem, 4vw, 2.4rem); margin: .2em 0; letter-spacing: -.02em; }
.page-head__intro { font-size: 1.1rem; color: var(--ink-soft); max-width: 720px; }

/* ---------- Cards grid ---------- */
.cards {
    display: grid; gap: 22px;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
}
.cards--related { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }

.card {
    background: var(--surface); border: 1px solid var(--line);
    border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow);
    transition: transform .15s ease, box-shadow .15s ease;
}
.card:hover { transform: translateY(-3px); box-shadow: var(--shadow-hover); }
.card__link { color: inherit; display: block; height: 100%; }
.card__link:hover { text-decoration: none; }
.card__media { aspect-ratio: 16 / 9; background: var(--accent-soft); overflow: hidden; }
.card__media img { width: 100%; height: 100%; object-fit: cover; }
.card__media--empty {
    background: linear-gradient(135deg, var(--accent-soft), #eef6f4);
}
.card__body { padding: 16px 18px 20px; }
.card__meta { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; flex-wrap: wrap; }
.card__cat { font-size: .82rem; color: var(--muted); }
.card__title { font-size: 1.18rem; margin: 0 0 8px; line-height: 1.3; letter-spacing: -.01em; }
.card__excerpt { color: var(--ink-soft); font-size: .96rem; margin: 0 0 12px; }
.card__date { font-size: .82rem; color: var(--muted); }

/* ---------- Badges ---------- */
.badge {
    display: inline-block; padding: 3px 10px; border-radius: 999px;
    font-size: .76rem; font-weight: 600; letter-spacing: .01em;
    background: var(--accent-soft); color: var(--accent-dark);
}
.badge--guide  { background: #e7f0ff; color: #1f5fbf; }
.badge--term   { background: #f0ecff; color: #6a45c2; }
.badge--qa     { background: #fdeede; color: #b4711a; }
.badge--news   { background: #ffe9ec; color: #c23a52; }
.badge--article{ background: var(--accent-soft); color: var(--accent-dark); }

/* ---------- Chips (subcategories) ---------- */
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 28px; }
.chip {
    background: var(--surface); border: 1px solid var(--line);
    border-radius: 999px; padding: 6px 14px; font-size: .92rem; color: var(--ink-soft);
}
.chip:hover { border-color: var(--accent); color: var(--accent-dark); text-decoration: none; }

/* ---------- Breadcrumbs ---------- */
.breadcrumbs { font-size: .88rem; color: var(--muted); margin: 0 0 18px; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.breadcrumbs a { color: var(--ink-soft); }
.breadcrumbs__sep { color: var(--line); }
.breadcrumbs__current { color: var(--muted); }

/* ---------- Entry (single content / page) ---------- */
.entry { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 36px clamp(20px, 5vw, 48px); box-shadow: var(--shadow); }
.entry__head { margin-bottom: 24px; }
.entry__meta { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: .9rem; margin-bottom: 14px; }
.entry__title { font-size: clamp(1.8rem, 4.5vw, 2.6rem); line-height: 1.2; margin: 0 0 .4em; letter-spacing: -.02em; }
.entry__lead { font-size: 1.2rem; color: var(--ink-soft); margin: 0; }
.entry__short-answer {
    font-size: 1.2rem; color: var(--ink); background: var(--accent-soft);
    border-left: 4px solid var(--accent); border-radius: var(--radius-sm);
    padding: 14px 18px; margin: 0;
}
.entry__chip { display: inline-block; font-size: .9rem; color: var(--accent-dark); background: var(--accent-soft); border-radius: 999px; padding: 4px 12px; margin-top: 12px; }
.entry__cover { margin: 0 0 28px; }
.entry__cover img { width: 100%; border-radius: var(--radius); }
.entry__cover figcaption { font-size: .85rem; color: var(--muted); margin-top: 8px; text-align: center; }

/* ---------- Prose (body_html, Purifier-cleaned) ---------- */
.prose { font-size: 1.08rem; line-height: 1.75; color: var(--ink); }
.prose > :first-child { margin-top: 0; }
.prose h2 { font-size: 1.5rem; margin: 1.8em 0 .6em; letter-spacing: -.01em; }
.prose h3 { font-size: 1.25rem; margin: 1.5em 0 .5em; }
.prose h4 { font-size: 1.08rem; margin: 1.3em 0 .4em; }
.prose p { margin: 0 0 1.1em; }
.prose ul, .prose ol { margin: 0 0 1.1em; padding-left: 1.4em; }
.prose li { margin: .3em 0; }
.prose a { text-decoration: underline; }
.prose img { border-radius: var(--radius-sm); margin: 1.2em 0; }
.prose figure { margin: 1.4em 0; }
.prose figcaption { font-size: .85rem; color: var(--muted); text-align: center; margin-top: 6px; }
.prose blockquote {
    margin: 1.4em 0; padding: 4px 20px; border-left: 4px solid var(--accent);
    color: var(--ink-soft); font-style: italic; background: var(--accent-soft);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}
.prose pre { background: #0f2027; color: #e6f1f0; padding: 16px 18px; border-radius: var(--radius-sm); overflow: auto; font-size: .92rem; }
.prose code { background: var(--accent-soft); color: var(--accent-dark); padding: .12em .4em; border-radius: 5px; font-size: .92em; }
.prose pre code { background: none; color: inherit; padding: 0; }
.prose table { width: 100%; border-collapse: collapse; margin: 1.4em 0; font-size: .96rem; }
.prose th, .prose td { border: 1px solid var(--line); padding: 9px 12px; text-align: left; }
.prose th { background: var(--bg); font-weight: 600; }
.prose hr { border: none; border-top: 1px solid var(--line); margin: 2em 0; }

/* ---------- FAQ ---------- */
.faq { margin-top: 40px; }
.faq__item { border: 1px solid var(--line); border-radius: var(--radius-sm); margin-bottom: 10px; background: var(--bg); overflow: hidden; }
.faq__q { cursor: pointer; padding: 14px 18px; font-weight: 600; list-style: none; }
.faq__q::-webkit-details-marker { display: none; }
.faq__q::before { content: "+"; color: var(--accent); font-weight: 700; margin-right: 10px; }
.faq__item[open] .faq__q::before { content: "−"; }
.faq__a { padding: 0 18px 16px; color: var(--ink-soft); }

/* ---------- Related ---------- */
.related { margin-top: 48px; }

/* ---------- Pagination ---------- */
.pagination { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; justify-content: center; margin: 40px 0 0; }
.pagination__link {
    min-width: 40px; text-align: center; padding: 8px 12px; border-radius: var(--radius-sm);
    border: 1px solid var(--line); background: var(--surface); color: var(--ink-soft); font-size: .95rem;
}
.pagination__link:hover { border-color: var(--accent); color: var(--accent-dark); text-decoration: none; }
.pagination__link.is-current { background: var(--accent); border-color: var(--accent); color: #fff; }
.pagination__gap { color: var(--muted); padding: 0 4px; }

/* ---------- Search form ---------- */
.search-form { display: flex; gap: 8px; margin-top: 16px; max-width: 560px; }
.search-form__input { flex: 1; border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 12px 16px; font: inherit; }
.search-form__input:focus { outline: none; border-color: var(--accent); }
.search-summary { margin: 0 0 18px; }

/* ---------- Buttons ---------- */
.btn {
    display: inline-block; background: var(--accent); color: #fff; border: 1px solid var(--accent);
    border-radius: var(--radius-sm); padding: 11px 22px; font: inherit; font-weight: 600; cursor: pointer;
}
.btn:hover { background: var(--accent-dark); border-color: var(--accent-dark); text-decoration: none; }

/* ---------- Empty / status ---------- */
.empty-state {
    background: var(--surface); border: 1px dashed var(--line); border-radius: var(--radius);
    padding: 40px 24px; text-align: center; color: var(--muted); font-size: 1.05rem;
}
.status-page { text-align: center; padding: 64px 16px; }
.status-page__code { font-size: 4rem; font-weight: 800; color: var(--accent); margin: 0; line-height: 1; letter-spacing: -.03em; }
.status-page__title { font-size: 1.8rem; margin: .3em 0; }
.status-page__text { color: var(--ink-soft); max-width: 480px; margin: 0 auto 24px; }
.site--status .site-main { display: flex; align-items: center; }

/* ---------- Footer ---------- */
.site-footer { flex-shrink: 0; background: #0f2027; color: #cdd9d8; padding: 40px 0; margin-top: 40px; }
.site-footer__inner { display: flex; flex-wrap: wrap; gap: 32px; }
.site-footer__col { display: flex; flex-direction: column; gap: 8px; min-width: 160px; }
.site-footer__col .brand__name { color: #fff; font-size: 1.15rem; }
.site-footer a { color: #9fd3cd; }
.site-footer a:hover { color: #fff; }
.site-footer .muted { color: #7d8f8d; }

/* ---------- Responsive ---------- */
@media (max-width: 860px) {
    .nav-burger { display: flex; }
    .site-nav {
        display: none; width: 100%; flex-direction: column; align-items: stretch;
        gap: 2px; padding: 8px 0 12px; margin-left: 0;
    }
    .nav-toggle:checked ~ .site-nav { display: flex; }
    .site-search { margin: 8px 0 0; }
    .site-search__input { width: 100%; }
    .site-search { flex: 1; }
}
