/*
Theme Name: Pulse News
Description: Легка новинна тема без конструкторів: три колонки, картки, стрічка «Останні новини», плашка «Топтема», темний режим. Кольори та блоки головної — «Зовнішній вигляд → Налаштувати».
Version: 1.1.3
Requires at least: 6.2
Requires PHP: 7.4
License: GPLv2 or later
Text Domain: nf
*/

:root {
	--radius: 10px;
	--gap: 20px;
	--accent-dark: color-mix(in srgb, var(--accent) 82%, #000);
	--accent-soft: color-mix(in srgb, var(--accent) 12%, transparent);
	--line: color-mix(in srgb, var(--text) 10%, transparent);
}
:root[data-theme="dark"] {
	--bg: #111314;
	--card: #1b1e20;
	--text: #e8eaea;
	--muted: #9aa0a3;
	--header-bg: #16191b;
	--footer-bg: #0b0c0d;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.5 var(--font); }
body.lock { overflow: hidden; }
a { color: inherit; text-decoration: none; }
a:hover { color: var(--accent); }
img { max-width: 100%; height: auto; display: block; }
h1, h2, h3 { text-wrap: balance; }
.container { width: 100%; max-width: 1360px; margin: 0 auto; padding: 0 20px; }
.skip { position: absolute; left: -9999px; }
.skip:focus { left: 10px; top: 10px; z-index: 200; background: var(--card); padding: 8px 12px; }
.screen-reader-text { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.i { flex: none; }

/* ---------- Шапка ---------- */
.site-header { position: sticky; top: 0; z-index: 50; background: var(--header-bg); transition: box-shadow .2s; }
.admin-bar .site-header { top: 32px; }
.site-header.scrolled { box-shadow: 0 2px 14px rgba(0, 0, 0, .08); }
.header-row { display: flex; align-items: center; gap: 18px; height: 64px; }
.logo { position: relative; display: flex; align-items: center; height: 100%; }
.logo::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: var(--accent); border-radius: 3px 3px 0 0; }
.logo img { max-height: 42px; width: auto; }
.site-name { font-weight: 800; font-size: 22px; letter-spacing: -.02em; line-height: 1.1; }
.main-nav { flex: 1; min-width: 0; }
.main-nav .menu { display: flex; gap: 24px; list-style: none; margin: 0; padding: 0; font-weight: 600; font-size: 15px; white-space: nowrap; overflow: hidden; }
.main-nav .current-menu-item > a, .main-nav .current-cat > a { color: var(--accent); }
.header-tools { display: flex; gap: 4px; margin-left: auto; }
.header-tools { align-items: center; }
.btn-head { padding: 9px 18px; font-size: 14px; margin-right: 6px; white-space: nowrap; }
.topbar { display: block; background: var(--text); color: var(--card); font-size: 13px; font-weight: 600; }
.topbar .container { display: flex; align-items: center; justify-content: center; gap: 10px; min-height: 34px; text-align: center; }
.topbar .i { width: 18px; height: 18px; flex: none; transition: transform .2s; }
.topbar:hover { color: var(--card); background: var(--accent); }
.topbar:hover .i { transform: translateX(4px); }
.icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; border: 0; border-radius: 50%; background: transparent; color: var(--text); cursor: pointer; }
.icon-btn:hover { background: var(--accent-soft); color: var(--accent); }
.header-tools .icon-btn { color: var(--accent); }
.searchbox { display: none; border-top: 1px solid var(--line); padding: 14px 0; background: var(--header-bg); }
.searchbox.is-open { display: block; }
.search-form { display: flex; gap: 8px; }
.search-form input { flex: 1; min-width: 0; height: 46px; padding: 0 14px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); color: var(--text); font: inherit; }
.search-form input:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.search-form button { display: inline-flex; align-items: center; gap: 6px; height: 46px; padding: 0 18px; border: 0; border-radius: var(--radius); background: var(--accent); color: #fff; font: inherit; font-weight: 700; cursor: pointer; }

/* ---------- Бургер-меню ---------- */
.drawer { position: fixed; inset: 0; z-index: 100; background: rgba(0, 0, 0, .45); opacity: 0; visibility: hidden; transition: .2s; }
.drawer.is-open { opacity: 1; visibility: visible; }
.drawer-panel { position: absolute; top: 0; bottom: 0; left: 0; width: min(360px, 88vw); background: var(--card); padding: 20px 22px; overflow: auto; transform: translateX(-100%); transition: transform .25s; }
.drawer.is-open .drawer-panel { transform: none; }
.drawer-close { position: absolute; right: 12px; top: 12px; }
.drawer-logo { margin: 6px 0 22px; }
.drawer-logo img { max-height: 40px; width: auto; }
.drawer-menu { list-style: none; margin: 0 0 20px; padding: 0; font-weight: 700; font-size: 18px; }
.drawer-menu > li { border-bottom: 1px solid var(--line); }
.drawer-menu a { display: block; padding: 12px 0; }
.drawer-menu .sub-menu, .drawer-menu .children { list-style: none; padding: 0 0 8px 14px; margin: 0; font-weight: 500; font-size: 15px; }
.drawer-menu .sub-menu a { padding: 6px 0; }
.drawer .socials a { background: var(--accent-soft); color: var(--accent); }

/* ---------- Топтема ---------- */
.topic { display: flex; gap: 10px; align-items: center; justify-content: center; margin: 18px 0 0; padding: 13px 18px; border-radius: var(--radius); background: var(--accent); color: #fff; font-weight: 700; font-size: 14px; text-align: center; }
.topic b { text-transform: uppercase; letter-spacing: .05em; opacity: .9; white-space: nowrap; }
.topic:hover { color: #fff; background: var(--accent-dark); }

/* ---------- Сетка ---------- */
.site-main { padding: 20px 0 48px; }
.layout-3 { display: grid; grid-template-columns: 250px minmax(0, 1fr) 300px; gap: var(--gap); align-items: start; }
.layout-2 { display: grid; grid-template-columns: minmax(0, 1fr) 330px; gap: var(--gap); align-items: start; }
.col-main, .col-left, .col-right { display: grid; gap: var(--gap); min-width: 0; }
.col-main > *, .col-left > *, .col-right > * { min-width: 0; }
.box { background: var(--card); border-radius: var(--radius); padding: 20px; }
.meta, time { color: var(--muted); font-size: 13px; }

/* ---------- Главный материал ---------- */
.hero { position: relative; padding: 0; overflow: hidden; aspect-ratio: 16 / 9; min-height: 320px; background: #1d1d1d; }
.hero-img { position: absolute; inset: 0; }
.hero-img img, .hero-img .noimg { width: 100%; height: 100%; object-fit: cover; }
.hero-img::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(0, 0, 0, 0) 30%, rgba(0, 0, 0, .85)); }
.hero-badge { position: absolute; left: 18px; top: 18px; z-index: 2; }
.hero-body { position: absolute; left: 0; right: 0; bottom: 0; padding: 24px; color: #fff; z-index: 2; }
.hero-body time { color: rgba(255, 255, 255, .85); }
.hero-title { margin: 6px 0 16px; font-size: clamp(22px, 2.3vw, 32px); line-height: 1.2; font-weight: 800; }
.hero-title a:hover { color: #fff; text-decoration: underline; text-decoration-thickness: 2px; }
.badge { display: inline-block; padding: 4px 10px; border-radius: 6px; background: var(--accent); color: #fff; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; line-height: 1.3; }
.badge:hover { color: #fff; background: var(--accent-dark); }

/* ---------- Поделиться ---------- */
.share { display: flex; gap: 8px; flex-wrap: wrap; }
.share a, .share button { display: inline-flex; align-items: center; justify-content: center; width: 38px; height: 38px; border-radius: 50%; border: 0; background: #fff; color: var(--accent); cursor: pointer; box-shadow: 0 1px 3px rgba(0, 0, 0, .14); }
.share .i { width: 18px; height: 18px; }
.share a:hover, .share button:hover { background: var(--accent); color: #fff; }
.share-copy.ok { background: #22a06b !important; color: #fff !important; }

/* ---------- Блоки рубрик ---------- */
.block-title { margin: 0 0 16px; font-size: 28px; line-height: 1.15; font-weight: 800; text-transform: uppercase; letter-spacing: -.01em; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 22px 18px; }
.card { min-width: 0; }
.card-img { display: block; aspect-ratio: 16 / 10; overflow: hidden; border-radius: 8px; background: var(--line); }
.card-img img, .noimg { width: 100%; height: 100%; object-fit: cover; transition: transform .35s; }
.card:hover .card-img img { transform: scale(1.04); }
.noimg { display: block; min-height: 100%; background: linear-gradient(135deg, color-mix(in srgb, var(--accent) 35%, var(--card)), color-mix(in srgb, var(--accent) 8%, var(--card))); }
.card-body { padding-top: 10px; }
.card-title { margin: 4px 0 0; font-size: 16px; line-height: 1.35; font-weight: 700; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 13px 22px; border-radius: var(--radius); background: var(--accent); color: #fff; font-weight: 700; font-size: 15px; border: 0; cursor: pointer; }
.btn:hover { background: var(--accent-dark); color: #fff; }
.btn-block { display: flex; width: 100%; margin-top: 20px; }

/* ---------- Лента и популярное ---------- */
.feed-title, .widget-title { margin: 0 0 14px; font-size: 15px; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; }
.feed-list { list-style: none; margin: 0; padding: 0; }
.feed-item { padding: 12px 0; border-bottom: 1px solid var(--line); }
.feed-item:first-child { padding-top: 0; }
.feed-img { display: block; aspect-ratio: 16 / 10; overflow: hidden; border-radius: 8px; margin-bottom: 8px; }
.feed-img img { width: 100%; height: 100%; object-fit: cover; }
.feed-link { display: block; font-size: 15px; line-height: 1.35; font-weight: 500; margin-top: 2px; }
.feed-item.with-img .feed-link { font-weight: 700; font-size: 16px; }
.popular-list { list-style: none; counter-reset: p; margin: 0; padding: 0; }
.popular-list li { counter-increment: p; display: grid; grid-template-columns: 28px 1fr; gap: 8px; padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 14px; font-weight: 600; line-height: 1.35; }
.popular-list li::before { content: counter(p); font-size: 22px; font-weight: 800; color: var(--accent); line-height: 1; }

/* ---------- Архив ---------- */
.page-title { margin: 0 0 8px; font-size: clamp(26px, 3vw, 34px); line-height: 1.15; font-weight: 800; }
.archive-desc { color: var(--muted); margin-bottom: 8px; }
.archive-grid { margin-top: 20px; }
.navigation.pagination { margin-top: 28px; }
.nav-links { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; }
.page-numbers { display: inline-flex; min-width: 42px; height: 42px; align-items: center; justify-content: center; padding: 0 10px; border-radius: var(--radius); background: var(--bg); font-weight: 700; }
.page-numbers.current, a.page-numbers:hover { background: var(--accent); color: #fff; }
.crumbs { font-size: 13px; color: var(--muted); margin-bottom: 14px; }
.crumbs span { margin: 0 4px; opacity: .6; }
.notfound { text-align: center; padding: 50px 20px; }
.nf-404 { font-size: 96px; font-weight: 800; color: var(--accent); margin: 0; line-height: 1; }
.notfound .search-form { max-width: 520px; margin: 20px auto; }

/* ---------- Статья ---------- */
.entry { padding: 28px; }
.entry-title { margin: 12px 0 12px; font-size: clamp(26px, 3vw, 38px); line-height: 1.18; font-weight: 800; letter-spacing: -.01em; }
.entry-meta { display: flex; flex-wrap: wrap; gap: 16px; align-items: center; color: var(--muted); font-size: 14px; }
.entry-author { display: inline-flex; align-items: center; gap: 5px; font-weight: 600; color: var(--text); }
.entry-author .i { width: 16px; height: 16px; color: var(--muted); }
.entry-author a:hover { color: var(--accent); }
.views { display: inline-flex; gap: 5px; align-items: center; }
.views .i { width: 16px; height: 16px; }
.lead { font-size: 19px; font-weight: 600; line-height: 1.45; margin: 18px 0 0; }
.entry-image { margin: 22px 0; }
.entry-image img { width: 100%; border-radius: 8px; }
figcaption { font-size: 13px; color: var(--muted); margin-top: 6px; }
.entry-content { font-size: 18px; line-height: 1.7; overflow-wrap: anywhere; }
.entry-content > *:first-child { margin-top: 0; }
.entry-content a { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }
.entry-content h2 { font-size: 26px; line-height: 1.25; margin: 1.6em 0 .6em; }
.entry-content h3 { font-size: 21px; line-height: 1.3; margin: 1.4em 0 .5em; }
.entry-content blockquote { margin: 1.5em 0; padding: 4px 0 4px 20px; border-left: 4px solid var(--accent); font-size: 20px; font-style: italic; }
.entry-content img, .entry-content iframe, .entry-content video { max-width: 100%; border-radius: 6px; }
.entry-content iframe[src*="youtube"], .entry-content .wp-block-embed iframe { width: 100%; height: auto; aspect-ratio: 16 / 9; }
.entry-content figure { margin: 1.5em 0; }
.entry-content table { width: 100%; border-collapse: collapse; font-size: 16px; }
.entry-content td, .entry-content th { border: 1px solid var(--line); padding: 8px; }
.entry-footer { margin-top: 28px; padding-top: 18px; border-top: 1px solid var(--line); display: grid; gap: 14px; }
.tags { display: flex; flex-wrap: wrap; gap: 8px; }
.tags a { padding: 4px 12px; border-radius: 20px; background: var(--accent-soft); font-size: 13px; font-weight: 600; }
.entry-footer .share a, .entry-footer .share button { box-shadow: none; background: var(--accent-soft); }
.related .block-title { font-size: 22px; }
.comment-list { padding-left: 20px; }
.comment-form input:not([type="submit"]):not([type="checkbox"]), .comment-form textarea { width: 100%; padding: 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); color: var(--text); font: inherit; }

/* ---------- Виджеты ---------- */
.widget ul { list-style: none; margin: 0; padding: 0; }
.widget li { padding: 7px 0; border-bottom: 1px solid var(--line); }
.widget select, .widget input { max-width: 100%; }
.widget_search form, .wp-block-search__inside-wrapper { display: flex; gap: 6px; }
.widget_search input[type="search"], .wp-block-search__input { flex: 1; min-width: 0; height: 40px; padding: 0 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); color: var(--text); font: inherit; }
.widget_search button, .widget_search input[type="submit"], .wp-block-search__button { height: 40px; padding: 0 12px; border: 0; border-radius: 8px; background: var(--accent); color: #fff; font-weight: 700; cursor: pointer; }
.widget h2, .wp-block-heading { font-size: 15px; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; margin: 0 0 12px; }
.wp-block-latest-posts a, .wp-block-latest-comments a { font-weight: 600; }
.home-middle { display: grid; gap: var(--gap); }

/* ---------- Подвал ---------- */
.site-footer { background: var(--footer-bg); color: #d6d6d6; padding: 44px 0 22px; font-size: 14px; }
.site-footer a:hover { color: var(--accent); }
.footer-grid { display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 32px; }
.site-footer .site-name { color: #fff; font-size: 24px; }
.footer-about p { max-width: 420px; color: #b9b9b9; }
.menu-footer { list-style: none; margin: 0; padding: 0; columns: 2; column-gap: 20px; }
.menu-footer li { padding: 4px 0; break-inside: avoid; }
.contacts { list-style: none; margin: 0 0 12px; padding: 0; }
.contacts li { display: flex; gap: 10px; align-items: center; padding: 5px 0; }
.contacts .i { width: 18px; height: 18px; color: var(--accent); }
.socials { display: flex; gap: 8px; margin-top: 16px; }
.socials a { display: inline-flex; width: 38px; height: 38px; border-radius: 50%; align-items: center; justify-content: center; background: rgba(255, 255, 255, .09); }
.socials a:hover { background: var(--accent); color: #fff; }
.copyright { margin-top: 32px; padding-top: 16px; border-top: 1px solid rgba(255, 255, 255, .12); color: #9a9a9a; font-size: 13px; }
.site-footer .widget-title { color: #fff; }

/* Ліва колонка («Популярне») їде за прокруткою */
@media (min-width: 1201px) {
	.col-left { position: sticky; top: calc(64px + var(--gap)); max-height: calc(100vh - 64px - 2 * var(--gap)); overflow-y: auto; scrollbar-width: thin; }
	.admin-bar .col-left { top: calc(96px + var(--gap)); max-height: calc(100vh - 96px - 2 * var(--gap)); }
}

/* ---------- Адаптив ---------- */
@media (max-width: 1200px) {
	.layout-3 { grid-template-columns: minmax(0, 1fr) 300px; }
	.col-left { grid-column: 1 / -1; order: 3; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
}
@media (max-width: 900px) {
	.btn-head { display: none; }
	.layout-3, .layout-2 { grid-template-columns: minmax(0, 1fr); }
	.col-right { order: 2; }
	.main-nav { display: none; }
	.grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
	.footer-grid { grid-template-columns: 1fr; }
}
@media (max-width: 782px) { .admin-bar .site-header { top: 46px; } }
@media (max-width: 600px) {
	.container { padding: 0 12px; }
	.admin-bar .site-header { top: 0; }
	.header-row { height: 56px; gap: 8px; }
	.grid-3 { grid-template-columns: minmax(0, 1fr); }
	.box { padding: 16px; }
	.entry { padding: 18px; }
	.hero { aspect-ratio: 1 / 1; }
	.cat-block .grid-3 { gap: 14px; }
	.cat-block .card:not(:first-child) { display: grid; grid-template-columns: 116px minmax(0, 1fr); gap: 12px; align-items: start; }
	.cat-block .card:not(:first-child) .card-img { aspect-ratio: 4 / 3; }
	.cat-block .card:not(:first-child) .card-body { padding-top: 0; }
	.cat-block .card:not(:first-child) .card-title { font-size: 15px; }
	.block-title { font-size: 22px; }
	.entry-content { font-size: 17px; }
	.topic { justify-content: flex-start; text-align: left; }
}
