/*
Theme Name: Babooshka News
Description: Новостная тема в стиле новостного портала. Классические шаблоны, скруглённые изображения.
Version: 1.0.0
Text Domain: babooshka-news
*/

:root {
    --red: #d3141b;
    --red-dark: #a90f15;
    --ink: #1a1d24;
    --muted: #6b7280;
    --line: #e5e7eb;
    --bg: #f2f3f5;
    --card: #ffffff;
    --r-lg: 20px;   /* большие изображения и блоки */
    --r-md: 14px;   /* картинки в списках */
    --r-sm: 10px;
    --shadow: 0 1px 2px rgba(20, 24, 36, .05), 0 8px 24px rgba(20, 24, 36, .05);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font: 16px/1.6 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
img { display: block; max-width: 100%; height: auto; }
a { color: inherit; text-decoration: none; }
a:hover { color: var(--red); }
a:focus-visible, button:focus-visible, input:focus-visible { outline: 3px solid rgba(211, 20, 27, .45); outline-offset: 2px; }
h1, h2, h3 { line-height: 1.25; margin: 0; }

.container { max-width: 1200px; margin: 0 auto; padding: 0 20px; }
.screen-reader-text {
    position: absolute !important; width: 1px; height: 1px; overflow: hidden;
    clip: rect(1px, 1px, 1px, 1px); white-space: nowrap;
}
.screen-reader-text:focus { position: fixed !important; top: 8px; left: 8px; width: auto; height: auto; clip: auto; background: #fff; padding: 8px 14px; z-index: 999; border-radius: 8px; }

/* ---------- Шапка ---------- */
.topbar { background: var(--ink); color: #c7cbd3; font-size: 13px; }
.topbar-inner { display: flex; justify-content: space-between; gap: 16px; padding-top: 7px; padding-bottom: 7px; }
.topbar-desc { opacity: .8; text-align: right; }
.topbar-inner span:first-child::first-letter { text-transform: uppercase; }

.site-header { background: var(--card); }
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding-top: 18px; padding-bottom: 18px; }
.logo-text { font-size: 34px; font-weight: 900; letter-spacing: -.03em; color: var(--red); line-height: 1; }
.logo-text:hover { color: var(--red-dark); }
.custom-logo { max-height: 60px; width: auto; }

.header-search { display: flex; align-items: center; background: var(--bg); border-radius: 999px; padding: 4px 4px 4px 18px; width: 100%; max-width: 340px; }
.header-search input { flex: 1; min-width: 0; border: 0; background: transparent; font: inherit; font-size: 15px; padding: 8px 0; color: var(--ink); }
.header-search input:focus-visible { outline: none; }
.header-search:focus-within { box-shadow: 0 0 0 3px rgba(211, 20, 27, .3); }
.header-search button { flex: none; width: 38px; height: 38px; border: 0; border-radius: 50%; background: var(--red); color: #fff; cursor: pointer; display: grid; place-items: center; }
.header-search button:hover { background: var(--red-dark); }

/* ---------- Меню ---------- */
.site-nav { background: var(--card); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 50; }
.nav-list, .nav-list ul { list-style: none; margin: 0; padding: 0; }
.nav-list { display: flex; flex-wrap: wrap; gap: 4px; }
.nav-list a { display: block; padding: 14px 14px; font-weight: 600; font-size: 15px; border-bottom: 3px solid transparent; }
.nav-list a:hover { color: var(--red); }
.nav-list .current-menu-item > a,
.nav-list .current-cat > a,
.nav-list .current-menu-ancestor > a { color: var(--red); border-bottom-color: var(--red); }
.nav-toggle { display: none; width: 100%; padding: 14px 0; background: none; border: 0; font: inherit; font-weight: 700; text-align: left; cursor: pointer; }
.nav-toggle::after { content: "▾"; margin-left: 8px; }

/* ---------- Главный блок ---------- */
.hero { display: grid; grid-template-columns: 1.5fr 1fr; gap: 16px; margin: 24px 0 8px; }
.hero-card { position: relative; display: block; overflow: hidden; border-radius: var(--r-lg); background: #2a2f3a; isolation: isolate; min-height: 220px; }
.hero-card img, .hero-card .thumb-ph { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transition: transform .5s ease; }
.hero-card:hover img { transform: scale(1.04); }
.hero-card::after { content: ""; position: absolute; inset: 0; background: linear-gradient(to top, rgba(10, 12, 18, .85) 0%, rgba(10, 12, 18, .1) 65%); z-index: 0; }
.hero-body { position: absolute; left: 0; right: 0; bottom: 0; z-index: 1; padding: 18px 20px 20px; color: #fff; display: flex; flex-direction: column; align-items: flex-start; gap: 8px; }
.hero-title { font-weight: 800; font-size: 16px; line-height: 1.3; }
.hero-card:hover { color: #fff; }
.hero-main { min-height: 460px; }
.hero-main .hero-title { font-size: clamp(22px, 2.6vw, 32px); letter-spacing: -.01em; }
.hero-meta { font-size: 13px; opacity: .8; }
.hero-side { display: grid; grid-template-columns: 1fr 1fr; grid-auto-rows: 1fr; gap: 16px; }

/* ---------- Каркас страницы ---------- */
.content-layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 28px; margin: 24px 0 48px; align-items: start; }
.sidebar { position: sticky; top: 64px; }

.section-title, .archive-title { font-size: 26px; font-weight: 800; letter-spacing: -.01em; margin-bottom: 18px; }
.archive-header { margin-bottom: 20px; }
.archive-header .archive-title { margin-bottom: 8px; }
.archive-desc { color: var(--muted); max-width: 70ch; }
.archive-desc p { margin: 0; }
.empty { background: var(--card); padding: 28px; border-radius: var(--r-lg); color: var(--muted); }

/* ---------- Рубрика-плашка ---------- */
.cat-label { display: inline-block; background: var(--red); color: #fff; font-size: 12px; font-weight: 700; padding: 3px 11px; border-radius: 999px; line-height: 1.5; }
a.cat-label:hover { background: var(--red-dark); color: #fff; }

/* ---------- Список новостей ---------- */
.news-item { display: grid; grid-template-columns: 280px minmax(0, 1fr); gap: 20px; background: var(--card); border-radius: var(--r-lg); padding: 14px; margin-bottom: 16px; box-shadow: var(--shadow); }
.news-thumb, .card-thumb, .popular-thumb { position: relative; display: block; overflow: hidden; background: #dfe2e8; }
.news-thumb { border-radius: var(--r-md); aspect-ratio: 16 / 10; }
.news-thumb img, .card-thumb img, .popular-thumb img { width: 100%; height: 100%; object-fit: cover; transition: transform .45s ease; }
.news-thumb:hover img, .card-thumb:hover img { transform: scale(1.05); }
.thumb-ph { display: block; width: 100%; height: 100%; background: linear-gradient(135deg, #e3e6ec, #cfd3dc); }

.news-body { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; padding: 4px 6px 4px 0; min-width: 0; }
.news-title { font-size: 21px; font-weight: 800; letter-spacing: -.01em; }
.news-excerpt { color: #444a57; font-size: 15px; }
.news-excerpt p { margin: 0; }
.news-meta { margin-top: auto; color: var(--muted); font-size: 13px; }

/* ---------- Вертикальные карточки ---------- */
.card-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.card { background: var(--card); border-radius: var(--r-lg); padding: 12px 12px 16px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 10px; }
.card-thumb { border-radius: var(--r-md); aspect-ratio: 16 / 10; }
.card-title { font-size: 16px; font-weight: 700; padding: 0 4px; }
.card .news-meta { padding: 0 4px; margin-top: 0; }

/* ---------- Сайдбар ---------- */
.widget { background: var(--card); border-radius: var(--r-lg); padding: 20px; margin-bottom: 20px; box-shadow: var(--shadow); }
.widget-title { font-size: 18px; font-weight: 800; margin-bottom: 14px; padding-left: 12px; border-left: 4px solid var(--red); line-height: 1.1; }
.popular-list, .cat-list { list-style: none; margin: 0; padding: 0; }
.popular-list li + li { margin-top: 14px; }
.popular-item { display: flex; gap: 12px; align-items: center; }
.popular-thumb { flex: none; width: 76px; height: 76px; border-radius: var(--r-sm); }
.popular-text { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.popular-title { font-weight: 700; font-size: 15px; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.popular-date { color: var(--muted); font-size: 12px; }
.cat-list li { display: flex; justify-content: space-between; gap: 8px; padding: 9px 0; border-bottom: 1px solid var(--line); color: var(--muted); font-size: 13px; }
.cat-list li:last-child { border-bottom: 0; }
.cat-list a { color: var(--ink); font-weight: 600; font-size: 15px; }
.cat-list a:hover { color: var(--red); }

/* ---------- Пагинация ---------- */
.pagination { margin-top: 24px; }
.pagination .nav-links { display: flex; flex-wrap: wrap; gap: 8px; }
.pagination .page-numbers { min-width: 42px; height: 42px; padding: 0 14px; display: grid; place-items: center; background: var(--card); border-radius: 999px; font-weight: 700; box-shadow: var(--shadow); }
.pagination a.page-numbers:hover { background: var(--ink); color: #fff; }
.pagination .page-numbers.current { background: var(--red); color: #fff; }
.pagination .dots { background: transparent; box-shadow: none; }

/* ---------- Страница записи ---------- */
.single-card { background: var(--card); border-radius: var(--r-lg); padding: 32px; box-shadow: var(--shadow); }
.single-header { display: flex; flex-direction: column; align-items: flex-start; gap: 12px; margin-bottom: 20px; }
.single-title { font-size: clamp(26px, 3.4vw, 40px); font-weight: 900; letter-spacing: -.02em; }
.single-meta { display: flex; flex-wrap: wrap; gap: 16px; color: var(--muted); font-size: 14px; }
.single-thumb { margin: 0 0 24px; }
.single-thumb img { width: 100%; border-radius: var(--r-lg); }
.single-thumb figcaption, .entry-content figcaption, .wp-caption-text { color: var(--muted); font-size: 13px; margin-top: 8px; }

.entry-content { font-size: 18px; line-height: 1.75; max-width: 72ch; }
.entry-content > *:first-child { margin-top: 0; }
.entry-content p { margin: 0 0 1.1em; }
.entry-content h2 { font-size: 26px; margin: 1.6em 0 .6em; }
.entry-content h3 { font-size: 21px; margin: 1.4em 0 .5em; }
.entry-content a { color: var(--red); text-decoration: underline; text-underline-offset: 3px; }
.entry-content img, .entry-content video, .entry-content iframe { border-radius: var(--r-lg); }
.entry-content figure { margin: 1.4em 0; }
.entry-content img { margin-left: auto; margin-right: auto; }
.entry-content blockquote { margin: 1.4em 0; padding: 4px 0 4px 20px; border-left: 4px solid var(--red); font-size: 20px; font-weight: 600; }
.entry-content ul, .entry-content ol { padding-left: 1.3em; }
.entry-content .alignleft { float: left; margin: 0 1.2em 1em 0; }
.entry-content .alignright { float: right; margin: 0 0 1em 1.2em; }
.entry-content .aligncenter { margin-left: auto; margin-right: auto; }
.entry-content::after { content: ""; display: block; clear: both; }

.single-tags { margin-top: 24px; display: flex; flex-wrap: wrap; gap: 8px; }
.single-tags a { background: var(--bg); padding: 6px 14px; border-radius: 999px; font-size: 14px; font-weight: 600; }
.single-tags a:hover { background: var(--red); color: #fff; }
.related { margin-top: 32px; }

/* ---------- 404 ---------- */
.error-404 { margin: 40px 0 60px; }
.error-card { max-width: 640px; margin: 0 auto; display: flex; flex-direction: column; gap: 18px; align-items: flex-start; }
.error-card p { margin: 0; color: var(--muted); }
.error-card .header-search { max-width: none; }
.btn { display: inline-block; background: var(--red); color: #fff; font-weight: 700; padding: 12px 24px; border-radius: 999px; }
.btn:hover { background: var(--red-dark); color: #fff; }

/* ---------- Подвал ---------- */
.site-footer { background: var(--ink); color: #c7cbd3; padding: 32px 0; margin-top: 24px; }
.footer-inner { display: flex; justify-content: space-between; gap: 24px; flex-wrap: wrap; align-items: flex-start; }
.site-footer .logo-text { color: #fff; font-size: 28px; }
.footer-copy { margin: 10px 0 0; font-size: 13px; max-width: 46ch; }
.footer-list { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px 20px; font-size: 14px; }
.footer-list a:hover { color: #fff; text-decoration: underline; }

/* ---------- Адаптив ---------- */
@media (max-width: 960px) {
    .content-layout { grid-template-columns: 1fr; }
    .sidebar { position: static; }
    .hero { grid-template-columns: 1fr; }
    .hero-main { min-height: 380px; }
    .card-grid { grid-template-columns: repeat(2, 1fr); }
    .topbar-desc { display: none; }
}

@media (max-width: 720px) {
    .header-inner { flex-direction: column; align-items: stretch; gap: 14px; padding-top: 14px; padding-bottom: 14px; }
    .header-search { max-width: none; }
    .nav-toggle { display: block; }
    .nav-list { display: none; flex-direction: column; gap: 0; padding-bottom: 8px; }
    .site-nav.is-open .nav-list { display: flex; }
    .nav-list a { padding: 11px 0; border-bottom: 1px solid var(--line); }
    .hero-side { grid-template-columns: 1fr; grid-auto-rows: 200px; }
    .news-item { grid-template-columns: 1fr; gap: 14px; }
    .news-body { padding: 0 4px 4px; }
    .news-title { font-size: 19px; }
    .single-card { padding: 20px 16px; }
    .entry-content { font-size: 17px; }
    .card-grid { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
    * { transition: none !important; }
}
