/*
Theme Name: Modern Media Light v4 TOP (UA)
Theme URI: https://example.com/
Author: Custom Dev
Description: Українськомовна оптимізована медіа-тема v4 TOP для WordPress: без виходу тексту за межі екрана, керування вікнами та блоками, налаштування соцмереж, пошук, червоні посилання, NewsArticle Schema JSON-LD та безпека для Google AdSense.
Version: 4.0.0
Text Domain: modern-media
*/

:root {
  --bg-page: #ffffff;
  --bg-surface: #f6f7f9;
  --bg-soft-red: #fff5f5;
  --text-main: #16181d;
  --text-muted: #555b66;
  --link-color: #c81e1e;
  --link-hover: #9b1c1c;
  --accent: #0057b7;
  --accent-hover: #004494;
  --accent-secondary: #ffd700;
  --border-color: #e2e6ec;
  --container-width: 1180px;
  --article-max-width: 100%;
  --radius: 8px;
  --body-line-height: var(--body-line-height);
  --heading-letter-spacing: -0.02em;
  --card-title-size: 1.12rem;
  --h1-article-size: clamp(1.5rem, 4.6vw, 2.25rem);
  --feed-cols: 2;
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
  --font-heading: var(--font-sans);
}

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

html {
  font-size: 16px;
  scroll-behavior: smooth;
  overflow-x: hidden;
  max-width: 100%;
}

body {
  margin: 0;
  font-family: var(--font-sans);
  background-color: var(--bg-page);
  color: var(--text-main);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
  max-width: 100%;
  word-wrap: break-word;
  overflow-wrap: anywhere;
}

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

/* Червоні посилання за замовчуванням */
a {
  color: var(--link-color);
  text-decoration: none;
  transition: color 0.15s ease, background-color 0.15s ease, border-color 0.15s ease;
}

a:hover {
  color: var(--link-hover);
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* Заголовки, бренд та навігація зберігають чітку редакційну ієрархію */
.site-title a,
.primary-nav a,
.hero-main-title a,
.hero-side-title a,
.news-card-title a,
.popular-list a,
.footer-brand,
.footer-nav a {
  color: var(--text-main);
  text-decoration: none;
}

.hero-main-title a:hover,
.hero-side-title a:hover,
.news-card-title a:hover,
.popular-list a:hover {
  color: var(--link-color);
}

.site-footer a {
  color: #d1d5db;
}

.site-footer a:hover {
  color: #ffffff;
}

.container {
  width: 100%;
  max-width: var(--container-width);
  margin: 0 auto;
  padding: 0 14px;
}

/* Compact Header */
.site-header {
  background: #ffffff;
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 100;
  width: 100%;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 52px;
  gap: 10px;
}

.site-branding {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 1;
}

.site-title {
  margin: 0;
  font-size: 1.18rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.15;
  white-space: nowrap;
}

.site-title a {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.brand-badge {
  display: inline-block;
  width: 7px;
  height: 18px;
  background: linear-gradient(180deg, var(--accent) 50%, var(--accent-secondary) 50%);
  border-radius: 2px;
  flex-shrink: 0;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.primary-nav ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  align-items: center;
  gap: 14px;
}

.primary-nav a {
  font-weight: 600;
  font-size: 0.88rem;
  padding: 6px 0;
  white-space: nowrap;
}

.primary-nav a:hover,
.primary-nav .current-menu-item > a {
  color: var(--link-color);
}

/* Search Form */
.search-form {
  display: flex;
  align-items: center;
  gap: 5px;
  width: 100%;
}

.search-form .search-input {
  height: 33px;
  padding: 0 10px;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  font-size: 0.85rem;
  color: var(--text-main);
  background: var(--bg-surface);
  min-width: 0;
  flex: 1;
}

.search-form .search-input:focus {
  outline: none;
  border-color: var(--link-color);
  background: #ffffff;
}

.search-form .search-submit {
  height: 33px;
  padding: 0 11px;
  border: none;
  border-radius: 6px;
  background: var(--link-color);
  color: #ffffff;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  flex-shrink: 0;
}

.search-form .search-submit:hover {
  background: var(--link-hover);
}

.header-search .search-input {
  width: 155px;
}

.menu-toggle {
  display: none;
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  padding: 4px 8px;
  font-size: 1.1rem;
  cursor: pointer;
  color: var(--text-main);
  line-height: 1.15;
  flex-shrink: 0;
}

/* Social Links Bar */
.social-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.social-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 0.82rem;
  font-weight: 700;
  color: #ffffff !important;
  text-decoration: none !important;
  line-height: 1.25;
  transition: background-color 0.15s ease, transform 0.15s ease;
}

.social-btn:hover,
.social-btn:focus-visible {
  transform: translateY(-1px);
  outline: 2px solid var(--text-main);
  outline-offset: 1px;
}

.social-telegram { background: #006699; }
.social-telegram:hover { background: #004d73; }
.social-viber    { background: #5946d2; }
.social-viber:hover    { background: #4332ad; }
.social-facebook { background: #155ec4; }
.social-facebook:hover { background: #104899; }
.social-youtube  { background: #b91c1c; }
.social-youtube:hover  { background: #991b1b; }
.social-tiktok   { background: #111827; }
.social-tiktok:hover   { background: #000000; }
.social-x        { background: #1f2937; }
.social-x:hover        { background: #030712; }

.social-bar-strip {
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-color);
  padding: 7px 0;
}

.social-bar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 0.82rem;
}

/* AdSense Safe Slots (CLS prevention) */
.ad-slot {
  margin: 14px auto;
  text-align: center;
  overflow: hidden;
  clear: both;
  max-width: 100%;
}

.ad-slot-header {
  min-height: 60px;
  max-width: 970px;
}

.ad-slot-infeed {
  min-height: 90px;
  margin: 16px 0;
}

/* Front Page Hero Grid - Compact Hierarchy */
.hero-section {
  padding: 14px 0 8px;
}

.hero-grid {
  display: grid;
  grid-template-columns: 1.25fr 1fr;
  gap: 16px;
}

.hero-main-card {
  background: var(--bg-surface);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border-color);
}

.hero-main-thumb {
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: #e9ecef;
}

.hero-main-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.hero-main-body {
  padding: 12px 14px;
}

.cat-pill {
  display: inline-block;
  background: var(--accent);
  color: #ffffff !important;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 2px 7px;
  border-radius: 4px;
  margin-bottom: 6px;
  text-decoration: none !important;
}

.cat-pill:hover {
  background: var(--accent-hover);
}

.hero-main-title {
  margin: 0 0 6px;
  font-size: 1.24rem;
  line-height: 1.24;
  font-weight: 800;
}

.hero-main-excerpt {
  margin: 0 0 8px;
  color: var(--text-muted);
  font-size: 0.86rem;
  line-height: 1.42;
}

.post-meta {
  font-size: 0.76rem;
  color: var(--text-muted);
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.hero-side-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.hero-side-card {
  display: grid;
  grid-template-columns: 104px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border-color);
}

.hero-side-card:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.hero-side-thumb {
  aspect-ratio: 16 / 10;
  border-radius: 6px;
  overflow: hidden;
  background: #e9ecef;
}

.hero-side-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.hero-side-title {
  margin: 2px 0 4px;
  font-size: 0.9rem;
  line-height: 1.26;
  font-weight: 700;
}

/* Main Content + Sidebar Layout */
.main-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 290px;
  gap: 22px;
  padding: 16px 0 32px;
}

.main-layout.no-sidebar {
  grid-template-columns: minmax(0, 1fr);
}

.main-layout.no-sidebar .news-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.section-heading {
  font-size: 1.1rem;
  font-weight: 800;
  margin: 0 0 12px;
  padding-bottom: 7px;
  border-bottom: 2px solid var(--text-main);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.section-heading span.accent-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  background: var(--link-color);
  border-radius: 50%;
  margin-right: 7px;
  flex-shrink: 0;
}

/* News Feed Cards - Compact */
.news-grid {
  display: grid;
  grid-template-columns: repeat(var(--feed-cols), minmax(0, 1fr));
  gap: 14px;
}

.news-card {
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.news-card-thumb {
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: #e9ecef;
}

.news-card-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.news-card-body {
  padding: 11px 13px;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.news-card-title {
  margin: 2px 0 6px;
  font-size: 0.96rem;
  line-height: 1.26;
  font-weight: 700;
}

.news-card-excerpt {
  margin: 0 0 8px;
  font-size: 0.83rem;
  line-height: 1.4;
  color: var(--text-muted);
  flex: 1;
}

/* Sidebar - Compact */
.sidebar-widget {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 12px 14px;
  margin-bottom: 14px;
}

.widget-title {
  margin: 0 0 9px;
  font-size: 0.88rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.popular-list {
  list-style: none;
  margin: 0;
  padding: 0;
  counter-reset: pop-counter;
}

.popular-list li {
  counter-increment: pop-counter;
  display: flex;
  gap: 8px;
  padding: 7px 0;
  border-bottom: 1px solid var(--border-color);
}

.popular-list li:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.popular-list li::before {
  content: counter(pop-counter);
  font-weight: 800;
  font-size: 0.95rem;
  color: var(--link-color);
  min-width: 15px;
  line-height: 1.25;
  flex-shrink: 0;
}

.popular-list a {
  font-size: 0.85rem;
  font-weight: 600;
  line-height: 1.3;
}

/* Tags Cloud / Pills Styles */
.tags-box {
  margin: 14px 0;
  padding: 11px 13px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
}

.tags-box-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 7px;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 0.03em;
}

.tags-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tag-pill {
  display: inline-block;
  background: #ffffff;
  border: 1px solid var(--border-color);
  color: var(--link-color) !important;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
  line-height: 1.3;
  text-decoration: none !important;
}

.tag-pill:hover {
  background: var(--bg-soft-red);
  border-color: var(--link-color);
  color: var(--link-hover) !important;
}

/* Single Article Page - Compact Editorial Hierarchy & Strict Bounds */
.single-article-wrap {
  padding: 12px 0 36px;
  width: 100%;
  overflow-x: clip;
}

.article-header {
  width: 100%;
  max-width: 820px;
  margin: 0 auto 14px;
}

.breadcrumbs {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-bottom: 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  align-items: center;
}

.breadcrumbs a {
  color: var(--link-color);
  font-weight: 500;
}

.article-title {
  margin: 4px 0 8px;
  font-size: var(--h1-article-size);
  line-height: 1.2;
  font-weight: 800;
  letter-spacing: var(--heading-letter-spacing);
}

.article-lead {
  font-size: 0.96rem;
  line-height: 1.45;
  color: #2c3038;
  font-weight: 500;
  margin: 0 0 10px;
}

.article-meta-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 0;
  border-top: 1px solid var(--border-color);
  border-bottom: 1px solid var(--border-color);
  font-size: 0.78rem;
  color: var(--text-muted);
}

.article-featured-image {
  width: 100%;
  max-width: 860px;
  margin: 0 auto 16px;
}

.article-featured-image img {
  width: 100%;
  border-radius: var(--radius);
  aspect-ratio: 16 / 9;
  object-fit: cover;
}

.image-caption {
  font-size: 0.76rem;
  color: var(--text-muted);
  margin-top: 5px;
  text-align: right;
}

.article-body-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 290px;
  gap: 24px;
  max-width: 1100px;
  margin: 0 auto;
}

.article-body-grid.no-sidebar {
  grid-template-columns: minmax(0, 1fr);
  max-width: 820px;
}

.entry-content {
  width: 100%;
  max-width: 100%;
  font-size: 0.96rem;
  line-height: 1.56;
  color: #1c1f24;
  overflow-x: clip;
}

.entry-content p {
  margin: 0 0 0.95em;
}

.entry-content a {
  color: var(--link-color);
  font-weight: 600;
  text-decoration: underline;
  text-decoration-color: rgba(200, 30, 30, 0.35);
  text-underline-offset: 2px;
}

.entry-content a:hover {
  color: var(--link-hover);
  text-decoration-color: var(--link-hover);
}

.entry-content h2 {
  font-size: 1.16rem;
  font-weight: 800;
  margin: 1.2em 0 0.45em;
  line-height: 1.25;
}

.entry-content h3 {
  font-size: 1.02rem;
  font-weight: 700;
  margin: 1.1em 0 0.4em;
  line-height: 1.28;
}

.entry-content blockquote {
  margin: 1.1em 0;
  padding: 10px 14px;
  background: var(--bg-surface);
  border-left: 3px solid var(--link-color);
  border-radius: 0 var(--radius) var(--radius) 0;
  font-style: italic;
  font-size: 0.94rem;
}

.entry-content ul,
.entry-content ol {
  margin: 0 0 1em;
  padding-left: 1.25em;
}

.entry-content li {
  margin-bottom: 0.35em;
}

/* Related Posts */
.related-section {
  max-width: 1100px;
  margin: 26px auto 0;
  padding-top: 18px;
  border-top: 2px solid var(--border-color);
}

.related-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

/* Pagination */
.pagination {
  margin-top: 20px;
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.pagination .page-numbers {
  padding: 6px 11px;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--text-main);
  text-decoration: none;
}

.pagination .page-numbers:hover {
  border-color: var(--link-color);
  color: var(--link-color);
}

.pagination .page-numbers.current {
  background: var(--link-color);
  color: #ffffff;
  border-color: var(--link-color);
}

/* Compact Footer */
.site-footer {
  background: #14161a;
  color: #d1d5db;
  padding: 24px 0 16px;
  margin-top: 28px;
  width: 100%;
}

.footer-grid {
  display: grid;
  grid-template-columns: 1.5fr 1fr 1fr;
  gap: 20px;
  padding-bottom: 18px;
  border-bottom: 1px solid #2a2e37;
}

.footer-brand {
  font-size: 1.12rem;
  font-weight: 800;
  color: #ffffff !important;
  margin: 0 0 6px;
}

.footer-desc {
  font-size: 0.82rem;
  color: #9ca3af;
  margin: 0 0 10px;
  max-width: 360px;
}

.footer-nav ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.footer-nav li {
  margin-bottom: 5px;
  font-size: 0.84rem;
}

.footer-bottom {
  padding-top: 12px;
  font-size: 0.76rem;
  color: #9ca3af;
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}

/* Responsive */
@media (max-width: 992px) {
  .hero-grid,
  .main-layout,
  .article-body-grid,
  .main-layout.no-sidebar .news-grid {
    grid-template-columns: minmax(0, 1fr);
  }
  .related-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 768px) {
  .container {
    padding: 0 12px;
  }
  .menu-toggle {
    display: block;
  }
  .header-search {
    display: none;
  }
  .primary-nav {
    display: none;
    position: absolute;
    top: 52px;
    left: 0;
    right: 0;
    background: #ffffff;
    border-bottom: 1px solid var(--border-color);
    padding: 12px;
    z-index: 120;
  }
  .primary-nav.is-open {
    display: block;
  }
  .primary-nav ul {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
  .news-grid,
  .related-grid,
  .footer-grid {
    grid-template-columns: minmax(0, 1fr);
  }
  .hero-side-card {
    grid-template-columns: 96px minmax(0, 1fr);
  }
}

h1, h2, h3, h4, .site-title, .section-heading, .hero-main-title, .hero-side-title, .news-card-title, .article-title {
  font-family: var(--font-heading);
}
.news-card-title { font-size: var(--card-title-size); }
.article-body-grid.no-sidebar { max-width: var(--article-max-width); }
.news-card, .hero-main-card, .hero-side-card, .sidebar-widget, .tags-box,
.search-input, .search-submit, .cat-pill, .tag-pill, .social-btn, .pagination .page-numbers {
  border-radius: var(--radius);
}


.breaking-ticker {
  background: #fff5f5;
  border-bottom: 1px solid #fecaca;
  padding: 6px 0;
  font-size: 0.84rem;
}
.breaking-ticker-inner {
  display: flex;
  align-items: center;
  gap: 10px;
  overflow: hidden;
}
.breaking-badge {
  background: var(--link-color);
  color: #ffffff;
  font-weight: 800;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 2px 8px;
  border-radius: 4px;
  white-space: nowrap;
  flex-shrink: 0;
}
.breaking-link {
  color: var(--text-main);
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.breaking-link:hover {
  color: var(--link-color);
  text-decoration: underline;
}
.live-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: #b91c1c;
  color: #ffffff;
  font-size: 0.7rem;
  font-weight: 800;
  text-transform: uppercase;
  padding: 2px 7px;
  border-radius: 4px;
  letter-spacing: 0.04em;
  margin-left: 8px;
  vertical-align: middle;
}
.reading-time-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--text-muted);
  font-size: 0.8rem;
  font-weight: 600;
}


/* v4.3 TOP News Portal, Ad Slots & Recommendation Readiness */
.entry-content {
  font-size: var(--article-body-size, 1.06rem);
  line-height: var(--body-line-height, 1.65);
}
.entry-content p {
  margin-top: 0;
  margin-bottom: 1.05em;
}
.entry-content h2 {
  font-size: clamp(1.25rem, 2.5vw, 1.6rem);
  line-height: 1.25;
  margin: 1.4em 0 0.6em;
  letter-spacing: var(--heading-letter-spacing, -0.02em);
}
.entry-content h3 {
  font-size: clamp(1.1rem, 2vw, 1.32rem);
  line-height: 1.3;
  margin: 1.25em 0 0.5em;
}
.ad-slot {
  margin: 14px 0;
  text-align: center;
  clear: both;
  min-height: 0;
}
.ad-slot-header {
  margin: 10px auto 6px;
}
.ad-slot-infeed {
  margin: 18px auto;
}
.site-sidebar.is-sticky-sidebar {
  position: sticky;
  top: 66px;
  align-self: start;
}
.discover-meta-strip {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  font-size: 0.82rem;
  color: var(--text-muted);
}



