/*
Theme Name: BGNEWS24
Theme URI: https://bgnews24.com
Author: BGNEWS24
Description: Лека и бърза новинарска тема за BGNEWS24 — без jQuery, адаптивна, с тъмен режим.
Version: 1.1.1
Requires at least: 6.0
Requires PHP: 7.4
Text Domain: bgnews24
*/

:root {
  --bg: #f4f5f7;
  --surface: #ffffff;
  --ink: #111827;
  --ink-2: #374151;
  --muted: #6b7280;
  --line: #e5e7eb;
  --brand: #d90429;
  --brand-dark: #a1001c;
  --navy: #0b1b33;
  --navy-2: #13294b;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .08);
  --font: "Onest", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --serif: "Source Serif 4", Georgia, "Times New Roman", serif;
  --wrap: 1240px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0d1117; --surface: #161b22; --ink: #f0f3f6; --ink-2: #c9d1d9;
    --muted: #8b949e; --line: #262c36; --navy: #070e1a; --navy-2: #0f1d33;
    --shadow: 0 1px 2px rgba(0,0,0,.4);
  }
}
:root[data-theme="dark"] {
  --bg: #0d1117; --surface: #161b22; --ink: #f0f3f6; --ink-2: #c9d1d9;
  --muted: #8b949e; --line: #262c36; --navy: #070e1a; --navy-2: #0f1d33;
  --shadow: 0 1px 2px rgba(0,0,0,.4);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 16px/1.55 var(--font); -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
a:hover { color: var(--brand); }
img { max-width: 100%; height: auto; display: block; }
h1, h2, h3, h4 { line-height: 1.2; margin: 0; font-weight: 700; letter-spacing: -.01em; }
.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 16px; }
.screen-reader-text { position: absolute !important; clip: rect(1px,1px,1px,1px); width: 1px; height: 1px; overflow: hidden; }
.skip-link:focus { clip: auto; width: auto; height: auto; z-index: 999; background: #fff; padding: 8px 12px; left: 8px; top: 8px; }

/* ---------- Top bar ---------- */
.topbar { background: var(--navy); color: #cbd5e1; font-size: 13px; }
.topbar .wrap { display: flex; align-items: center; gap: 16px; height: 38px; }
.topbar__date { white-space: nowrap; text-transform: capitalize; }
.ticker { flex: 1; display: flex; align-items: center; gap: 10px; overflow: hidden; min-width: 0; }
.ticker__label { background: var(--brand); color: #fff; font-weight: 700; font-size: 11px; letter-spacing: .06em; text-transform: uppercase; padding: 3px 8px; border-radius: 4px; flex: none; }
.ticker__track { overflow: hidden; flex: 1; mask-image: linear-gradient(90deg, transparent, #000 3%, #000 97%, transparent); }
.ticker__list { display: inline-flex; gap: 36px; white-space: nowrap; animation: ticker 60s linear infinite; padding-left: 100%; }
.ticker__list a { color: #e2e8f0; }
.ticker__list a:hover { color: #fff; text-decoration: underline; }
.ticker:hover .ticker__list { animation-play-state: paused; }
@keyframes ticker { to { transform: translateX(-100%); } }
@media (prefers-reduced-motion: reduce) { .ticker__list { animation: none; padding-left: 0; } }

/* ---------- Header ---------- */
.site-header { background: var(--surface); border-bottom: 1px solid var(--line); }
.masthead { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding-top: 18px; padding-bottom: 18px; }
.logo { display: inline-flex; align-items: center; gap: 2px; font-weight: 800; font-size: 30px; letter-spacing: -.03em; line-height: 1; }
.logo__bg { background: var(--brand); color: #fff; padding: 4px 7px; border-radius: 6px; margin-right: 4px; }
.logo__news { color: var(--ink); }
.logo__24 { color: var(--brand); }
.logo:hover { color: inherit; }
.tagline { color: var(--muted); font-size: 14px; margin-top: 6px; }
.header-tools { display: flex; align-items: center; gap: 8px; }
.icon-btn { width: 40px; height: 40px; display: inline-grid; place-items: center; border-radius: 50%; border: 1px solid var(--line); background: var(--surface); color: var(--ink); cursor: pointer; }
.icon-btn:hover { border-color: var(--brand); color: var(--brand); }
.icon-btn svg { width: 18px; height: 18px; }

.mainnav { background: var(--surface); border-top: 1px solid var(--line); position: sticky; top: 0; z-index: 50; }
.mainnav.is-stuck { box-shadow: 0 2px 10px rgba(0,0,0,.08); }
.mainnav ul { list-style: none; margin: 0; padding: 0; display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; }
.mainnav ul::-webkit-scrollbar { display: none; }
.mainnav a { display: block; padding: 13px 14px; font-weight: 600; font-size: 15px; white-space: nowrap; border-bottom: 3px solid transparent; }
.mainnav .current-menu-item > a, .mainnav .current-cat > a, .mainnav a:hover { color: var(--brand); border-bottom-color: var(--brand); }

.searchbar { display: none; padding-top: 12px; padding-bottom: 16px; }
.searchbar.is-open { display: block; }
.search-form { display: flex; gap: 8px; }
.search-form input[type="search"] { flex: 1; min-width: 0; padding: 12px 14px; font: inherit; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); color: var(--ink); }
.search-form button { padding: 0 18px; border: 0; border-radius: 8px; background: var(--brand); color: #fff; font: 600 15px var(--font); cursor: pointer; }

/* ---------- Generic ---------- */
main { padding: 24px 0 48px; }
.section { margin-bottom: 36px; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; padding-bottom: 10px; border-bottom: 2px solid var(--ink); }
.section-head h2 { font-size: 22px; display: flex; align-items: center; gap: 10px; }
.section-head h2::before { content: ""; width: 6px; height: 22px; background: var(--brand); border-radius: 2px; }
.section-head a.more { font-size: 14px; font-weight: 600; color: var(--brand); }
.cat-label { display: inline-block; font-size: 12px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--brand); }
.cat-label--pill { background: var(--brand); color: #fff; padding: 4px 9px; border-radius: 4px; }
.meta { color: var(--muted); font-size: 13px; display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: center; }
.meta svg { width: 14px; height: 14px; vertical-align: -2px; margin-right: 3px; }

/* Thumbnails */
.thumb { position: relative; display: block; overflow: hidden; border-radius: var(--radius); background: var(--line); aspect-ratio: 16 / 9; }
.thumb img { width: 100%; height: 100%; object-fit: cover; transition: transform .4s ease; }
a:hover .thumb img, .thumb:hover img { transform: scale(1.04); }
.thumb--ph { display: grid; place-items: center; background: linear-gradient(135deg, var(--navy) 0%, var(--navy-2) 60%, var(--brand-dark) 140%); color: rgba(255,255,255,.9); }
.thumb--ph span { font-weight: 800; font-size: clamp(18px, 3vw, 28px); letter-spacing: -.02em; }
.thumb--ph span b { color: var(--brand); background: #fff; padding: 0 6px; border-radius: 4px; margin-right: 2px; }

/* Layout with sidebar */
.layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 32px; align-items: start; }
@media (max-width: 1000px) { .layout { grid-template-columns: minmax(0, 1fr); } }
.layout > *, .hero > *, .catblock > *, .grid > * { min-width: 0; }
html, body { overflow-x: clip; }

/* ---------- Hero ---------- */
.hero { display: grid; grid-template-columns: 1.6fr 1fr; gap: 20px; margin-bottom: 36px; }
.hero__main { position: relative; border-radius: var(--radius); overflow: hidden; min-height: 440px; display: block; background: var(--navy); }
.hero__main .thumb { position: absolute; inset: 0; aspect-ratio: auto; border-radius: 0; }
.hero__main::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(0,0,0,0) 35%, rgba(0,0,0,.85) 100%); }
.hero__body { position: absolute; left: 0; right: 0; bottom: 0; padding: 28px; z-index: 2; color: #fff; }
.hero__body h2 { font-size: clamp(24px, 3vw, 36px); margin: 10px 0 10px; color: #fff; }
.hero__body p { margin: 0 0 12px; color: #e5e7eb; max-width: 680px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.hero__body .meta { color: #d1d5db; }
.hero__main:hover h2 { text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 4px; }
.hero__side { display: grid; grid-template-rows: repeat(4, 1fr); gap: 14px; }
.mini { display: grid; grid-template-columns: 132px 1fr; gap: 14px; align-items: center; background: var(--surface); border-radius: var(--radius); padding: 10px; box-shadow: var(--shadow); }
.mini .thumb { aspect-ratio: 4 / 3; border-radius: 8px; }
.mini h3 { font-size: 15px; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; margin-top: 4px; }
@media (max-width: 900px) {
  .hero { grid-template-columns: 1fr; }
  .hero__main { min-height: 360px; }
  .hero__side { grid-template-rows: none; }
}
@media (max-width: 520px) {
  .hero__main { min-height: 0; }
  .hero__main .thumb { position: relative; aspect-ratio: 16 / 9; }
  .hero__main::after { display: none; }
  .hero__body { position: relative; padding: 16px 18px 18px; background: var(--navy); }
  .hero__body h2 { font-size: 22px; }
  .mini { grid-template-columns: 104px 1fr; }
}

/* ---------- Cards ---------- */
.grid { display: grid; gap: 22px; }
.grid--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (max-width: 900px) { .grid--3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 560px) { .grid--3, .grid--2 { grid-template-columns: 1fr; } }
.card { background: var(--surface); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); display: flex; flex-direction: column; }
.card .thumb { border-radius: 0; }
.card__body { padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.card h3 { font-size: 18px; line-height: 1.3; }
.card p { margin: 0; color: var(--ink-2); font-size: 14.5px; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.card .meta { margin-top: auto; }

/* List rows */
.rows { display: flex; flex-direction: column; gap: 0; background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); }
.row { display: grid; grid-template-columns: 240px 1fr; gap: 18px; padding: 16px; border-bottom: 1px solid var(--line); }
.row:last-child { border-bottom: 0; }
.row h3 { font-size: 20px; margin: 4px 0 8px; }
.row p { margin: 0 0 8px; color: var(--ink-2); font-size: 15px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
@media (max-width: 640px) {
  .row { grid-template-columns: 112px 1fr; gap: 12px; padding: 12px; }
  .row .thumb { aspect-ratio: 1; }
  .row h3 { font-size: 16px; margin: 2px 0 4px; }
  .row p { display: none; }
}

/* Category block: 1 big + list */
.catblock { display: grid; grid-template-columns: 1.2fr 1fr; gap: 20px; }
.catblock__list { display: flex; flex-direction: column; gap: 12px; }
.catblock__list a { display: grid; grid-template-columns: 96px 1fr; gap: 12px; align-items: center; }
.catblock__list .thumb { aspect-ratio: 4 / 3; border-radius: 8px; }
.catblock__list h4 { font-size: 15px; line-height: 1.3; font-weight: 600; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
@media (max-width: 760px) { .catblock { grid-template-columns: 1fr; } }

/* ---------- Sidebar ---------- */
.sidebar { display: flex; flex-direction: column; gap: 24px; position: sticky; top: 64px; }
.widget { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; }
.widget-title { font-size: 17px; margin: 0 0 12px; padding-bottom: 10px; border-bottom: 2px solid var(--brand); display: inline-block; }
.toplist { list-style: none; margin: 0; padding: 0; counter-reset: n; }
.toplist li { counter-increment: n; display: grid; grid-template-columns: 34px 1fr; gap: 10px; padding: 11px 0; border-bottom: 1px solid var(--line); }
.toplist li:last-child { border-bottom: 0; padding-bottom: 0; }
.toplist li::before { content: counter(n); font-weight: 800; font-size: 26px; line-height: 1; color: var(--brand); opacity: .9; }
.toplist a { font-weight: 600; font-size: 15px; line-height: 1.35; }
.toplist .meta { margin-top: 4px; }
.cats-list { list-style: none; margin: 0; padding: 0; }
.cats-list li { border-bottom: 1px solid var(--line); }
.cats-list li:last-child { border-bottom: 0; }
.cats-list a { display: flex; justify-content: space-between; padding: 10px 0; font-weight: 600; }
.cats-list span { color: var(--muted); font-weight: 400; font-size: 14px; }
.widget ul:not(.toplist):not(.cats-list) { margin: 0; padding-left: 18px; }

/* ---------- Archive header & pagination ---------- */
.archive-head { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 22px 24px; margin-bottom: 24px; border-left: 5px solid var(--brand); }
.archive-head h1 { font-size: 30px; }
.archive-head p { margin: 6px 0 0; color: var(--muted); }
.pagination { margin-top: 28px; }
.pagination .nav-links { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }
.pagination .page-numbers { min-width: 42px; height: 42px; padding: 0 12px; display: inline-grid; place-items: center; border-radius: 8px; background: var(--surface); box-shadow: var(--shadow); font-weight: 600; }
.pagination .page-numbers.current { background: var(--brand); color: #fff; }
.pagination .page-numbers.dots { background: transparent; box-shadow: none; }

/* ---------- Single ---------- */
.breadcrumbs { font-size: 13px; color: var(--muted); margin-bottom: 14px; display: flex; flex-wrap: wrap; gap: 6px; }
.breadcrumbs a:hover { color: var(--brand); }
.article { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 32px clamp(18px, 4vw, 44px) 36px; }
.article__title { font-size: clamp(26px, 3.6vw, 40px); line-height: 1.15; margin: 12px 0 14px; }
.article__lead { font-size: 19px; color: var(--ink-2); margin: 0 0 16px; line-height: 1.5; }
.article__meta { padding: 12px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); justify-content: space-between; }
.article__figure { margin: 22px 0 6px; }
.article__figure .thumb { border-radius: var(--radius); aspect-ratio: auto; max-height: 560px; }
.article__figure .thumb img { max-height: 560px; }
.article__figure figcaption { color: var(--muted); font-size: 13px; margin-top: 8px; }
.share { display: flex; gap: 8px; align-items: center; }
.share a, .share button { width: 34px; height: 34px; border-radius: 50%; display: inline-grid; place-items: center; color: #fff; border: 0; cursor: pointer; }
.share svg { width: 16px; height: 16px; fill: currentColor; }
.share .fb { background: #1877f2; } .share .x { background: #000; } .share .vb { background: #7360f2; } .share .cp { background: var(--muted); }
.share a:hover, .share button:hover { opacity: .85; color: #fff; }

.entry { font-family: var(--serif); font-size: 19px; line-height: 1.75; color: var(--ink); margin-top: 22px; overflow-wrap: anywhere; }
.entry > * { margin: 0 0 1.1em; }
.entry h2, .entry h3, .entry h4 { font-family: var(--font); margin: 1.6em 0 .6em; }
.entry h2 { font-size: 26px; } .entry h3 { font-size: 22px; }
.entry a { color: var(--brand); text-decoration: underline; text-underline-offset: 3px; }
.entry img { border-radius: 8px; margin: 1.2em auto; }
.entry figure { margin: 1.4em 0; }
.entry figcaption, .entry .wp-caption-text { font-family: var(--font); font-size: 14px; color: var(--muted); text-align: center; }
.entry blockquote { margin: 1.5em 0; padding: 4px 0 4px 20px; border-left: 4px solid var(--brand); font-style: italic; color: var(--ink-2); }
.entry iframe, .entry video { max-width: 100%; border-radius: 8px; }
.entry iframe[src*="youtube"], .entry iframe[src*="vimeo"] { width: 100%; height: auto; aspect-ratio: 16 / 9; }
.entry table { width: 100%; border-collapse: collapse; font-family: var(--font); font-size: 15px; display: block; overflow-x: auto; }
.entry td, .entry th { border: 1px solid var(--line); padding: 8px 10px; }
.entry u strong, .entry strong u { text-decoration: none; }
.entry p > u > strong, .entry p > strong > u { display: block; font-family: var(--font); font-size: 15px; font-weight: 600; background: var(--bg); border-left: 3px solid var(--brand); padding: 10px 14px; border-radius: 0 6px 6px 0; }
.entry .pvc_clear, .entry .pvc_stats, .entry img[src*="ajax-loader"] { display: none !important; }
.entry .addtoany_share_save_container { display: none; }

.tags { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 24px; }
.tags a { background: var(--bg); border: 1px solid var(--line); padding: 5px 12px; border-radius: 20px; font-size: 14px; }
.post-nav { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 28px; }
.post-nav a { background: var(--bg); border-radius: var(--radius); padding: 14px 16px; display: block; font-weight: 600; line-height: 1.35; }
.post-nav small { display: block; color: var(--muted); font-weight: 400; margin-bottom: 4px; }
.post-nav .next { text-align: right; }
@media (max-width: 600px) { .post-nav { grid-template-columns: 1fr; } .post-nav .next { text-align: left; } .entry { font-size: 18px; } }

/* ---------- Footer ---------- */
.site-footer { background: var(--navy); color: #cbd5e1; padding: 44px 0 0; margin-top: 24px; }
.footer-grid { display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 32px; }
.site-footer h4 { color: #fff; font-size: 16px; margin-bottom: 14px; }
.site-footer .logo__news { color: #fff; }
.site-footer p { margin: 12px 0 0; font-size: 14px; line-height: 1.6; }
.site-footer ul { list-style: none; margin: 0; padding: 0; }
.site-footer li { padding: 5px 0; font-size: 14px; }
.site-footer a:hover { color: #fff; }
.footer-bottom { border-top: 1px solid rgba(255,255,255,.1); margin-top: 36px; padding: 18px 0; font-size: 13px; display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
@media (max-width: 760px) { .footer-grid { grid-template-columns: 1fr; gap: 24px; } }

.to-top { position: fixed; right: 16px; bottom: 16px; width: 44px; height: 44px; border-radius: 50%; background: var(--brand); color: #fff; border: 0; display: grid; place-items: center; box-shadow: 0 4px 14px rgba(0,0,0,.2); opacity: 0; pointer-events: none; transition: opacity .2s; cursor: pointer; z-index: 60; }
.to-top.is-visible { opacity: 1; pointer-events: auto; }
.to-top svg { width: 20px; height: 20px; }

.notfound { text-align: center; padding: 60px 20px; background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); }
.notfound h1 { font-size: 72px; color: var(--brand); }
.notfound p { color: var(--muted); }
.notfound .search-form { max-width: 520px; margin: 20px auto 0; }

/* WP core */
.alignleft { float: left; margin: 0 1.2em 1em 0; }
.alignright { float: right; margin: 0 0 1em 1.2em; }
.aligncenter { margin-left: auto; margin-right: auto; }
.wp-caption { max-width: 100%; }
.sticky, .bypostauthor, .gallery-caption { }
@media (max-width: 600px) {
  .masthead { padding-top: 14px; padding-bottom: 14px; }
  .logo { font-size: 24px; }
  .tagline { display: none; }
  .topbar__date { display: none; }
  .section-head h2 { font-size: 19px; }
}

/* Text-only rows (articles without a picture) */
.row--text { grid-template-columns: 84px 1fr; }
.row__time { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; background: var(--bg); border-radius: 8px; height: 72px; border-left: 3px solid var(--brand); }
.row__time b { font-size: 20px; line-height: 1; }
.row__time span { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.row--text h3 { margin-top: 2px; }
@media (max-width: 640px) {
  .row--text { grid-template-columns: 64px 1fr; }
  .row__time { height: 60px; }
  .row__time b { font-size: 16px; }
  .row--text p { display: -webkit-box; }
}

/* Standard (not Bulgarian-cursive) Cyrillic glyphs for readability */
body, .entry { font-feature-settings: "locl" 0; }

/* Sources block at the end of AI-assisted articles */
.entry h2 + ul.bgn-sources { list-style: none; padding: 14px 16px; margin-top: .4em; background: var(--bg); border-radius: 8px; border-left: 3px solid var(--brand); font-family: var(--font); font-size: 15px; }
.entry ul.bgn-sources li { margin: 4px 0; }
.entry ul.bgn-sources a { text-decoration: none; }
