/*
Theme Name: Qalem News
Theme URI: https://qalem.news
Author: Qalem Team
Description: قالب أخبار عربي RTL احترافي
Version: 2.0.0
Requires at least: 6.0
Requires PHP: 7.4
Text Domain: qalem
Tags: rtl-language-support, news, magazine, blog, custom-logo, custom-menu, featured-images, footer-widgets, translation-ready
License: GPL-2.0-or-later
*/

/* ================================================================
   VARIABLES
================================================================ */
:root {
  --red:       #e63946;
  --red-h:     #c1121f;
  --navy:      #1d3557;
  --amber:     #f4a261;

  --bg:        #f4f6fb;
  --card:      #ffffff;
  --text:      #1a1a2e;
  --muted:     #64748b;
  --border:    #e2e8f0;
  --topbar-bg: #0f172a;

  --font:      'Cairo', system-ui, sans-serif;

  --radius-sm: 6px;
  --radius:    10px;
  --radius-lg: 14px;

  --shadow-sm: 0 1px 4px rgba(0,0,0,.06);
  --shadow:    0 3px 16px rgba(0,0,0,.09);
  --shadow-lg: 0 8px 36px rgba(0,0,0,.14);

  --trans: .2s ease;

  --container: 1260px;
  --sidebar-w: 300px;
  --header-h:  64px;
}

[data-theme="dark"] {
  --bg:     #0f172a;
  --card:   #1e293b;
  --text:   #e2e8f0;
  --muted:  #94a3b8;
  --border: #334155;
}

/* ================================================================
   RESET
================================================================ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.75;
  direction: rtl;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; transition: color var(--trans); }
img { max-width: 100%; height: auto; display: block; }
ul, ol { list-style: none; }
button { cursor: pointer; background: none; border: none; font: inherit; }
input, textarea, select { font: inherit; }
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font);
  font-weight: 700;
  line-height: 1.3;
  color: var(--text);
}

/* ================================================================
   LAYOUT
================================================================ */
.wrap {
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 20px;
  width: 100%;
}

.site-wrap {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

#main-content { flex: 1; }

/* Two-column page layout */
.page-grid {
  display: grid;
  grid-template-columns: 1fr var(--sidebar-w);
  gap: 28px;
  padding: 28px 0;
  align-items: start;
}
.main-col { min-width: 0; }
.side-col  { min-width: 0; }

/* Posts grid */
.posts-grid {
  display: grid;
  gap: 22px;
  width: 100%;
}
.posts-grid.g1 { grid-template-columns: 1fr; }
.posts-grid.g2 { grid-template-columns: repeat(2, 1fr); }
.posts-grid.g3 { grid-template-columns: repeat(3, 1fr); }
.posts-grid.g4 { grid-template-columns: repeat(4, 1fr); }

/* ================================================================
   TOPBAR
================================================================ */
.topbar {
  background: var(--topbar-bg);
  color: rgba(255,255,255,.5);
  height: 36px;
  font-size: 12.5px;
}
.topbar .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
  gap: 12px;
}
.topbar-date {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  color: rgba(255,255,255,.45);
}
.social-links {
  display: flex;
  align-items: center;
  gap: 4px;
}
.social-links a {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 4px;
  background: rgba(255,255,255,.06);
  color: rgba(255,255,255,.45);
  font-size: 12px;
  transition: all var(--trans);
}
.social-links a:hover {
  background: var(--red);
  color: #fff;
}

/* ================================================================
   BREAKING NEWS
================================================================ */
.breaking-bar {
  background: #fff;
  border-bottom: 1px solid var(--border);
  height: 36px;
  overflow: hidden;
}
[data-theme="dark"] .breaking-bar { background: var(--card); }
.breaking-bar .wrap {
  display: flex;
  align-items: stretch;
  height: 100%;
}
.breaking-tag {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 0 14px;
  background: var(--red);
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .07em;
  white-space: nowrap;
  flex-shrink: 0;
}
.ticker-box {
  flex: 1;
  overflow: hidden;
  display: flex;
  align-items: center;
}
.ticker-inner {
  display: flex;
  white-space: nowrap;
  animation: ticker 60s linear infinite;
}
.ticker-inner:hover { animation-play-state: paused; }
@keyframes ticker {
  0%   { transform: translateX(60%); }
  100% { transform: translateX(-100%); }
}
.ticker-item {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 0 18px;
  font-size: 13.5px;
  color: var(--text);
  transition: color var(--trans);
}
.ticker-item:hover { color: var(--red); }
.ticker-dot { color: var(--red); font-size: 7px; }

/* ================================================================
   HEADER
================================================================ */
.site-header {
  background: var(--card);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--trans), transform var(--trans);
}
.site-header.scrolled { box-shadow: var(--shadow); }
.site-header.hidden   { transform: translateY(-100%); }

.header-inner {
  display: flex;
  align-items: center;
  height: var(--header-h);
  gap: 16px;
}

/* Logo */
.site-logo { flex-shrink: 0; }
.site-logo a {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
}
.site-logo img { max-height: 44px; width: auto; }
.logo-name {
  display: block;
  font-size: 22px;
  font-weight: 900;
  color: var(--text);
  line-height: 1.1;
}
.logo-desc {
  display: block;
  font-size: 11px;
  font-weight: 400;
  color: var(--muted);
}

.header-ad {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Action buttons */
.header-actions {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-shrink: 0;
}
.hbtn {
  width: 38px;
  height: 38px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 15px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--trans);
}
.hbtn:hover {
  background: var(--red);
  border-color: var(--red);
  color: #fff;
}
.hbtn-menu {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  padding: 8px;
}
.bar {
  display: block;
  width: 20px;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
  transition: all var(--trans);
}
.icon-sun { display: none; }
[data-theme="dark"] .icon-moon { display: none; }
[data-theme="dark"] .icon-sun  { display: block; }

/* ================================================================
   MAIN NAVIGATION
================================================================ */
.main-nav-bar {
  background: var(--navy);
}
.main-nav {
  display: flex;
  list-style: none;
  min-height: 44px;
  align-items: stretch;
}
.main-nav > li { position: relative; }
.main-nav > li > a {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 0 15px;
  height: 44px;
  color: rgba(255,255,255,.78);
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  white-space: nowrap;
  transition: all var(--trans);
}
.main-nav > li > a:hover,
.main-nav > li.current-menu-item > a,
.main-nav > li.current-menu-ancestor > a {
  color: #fff;
  background: rgba(255,255,255,.1);
}
.nav-arrow {
  font-size: 9px;
  opacity: .5;
  transition: transform var(--trans);
}
.main-nav > li:hover .nav-arrow { transform: rotate(180deg); }

/* Dropdown */
.sub-menu {
  position: absolute;
  top: 100%;
  right: 0;
  min-width: 200px;
  background: var(--card);
  border: 1px solid var(--border);
  border-top: 3px solid var(--red);
  border-radius: 0 0 var(--radius) var(--radius);
  box-shadow: var(--shadow-lg);
  opacity: 0;
  visibility: hidden;
  transform: translateY(8px);
  transition: all var(--trans);
  z-index: 200;
  overflow: hidden;
}
.main-nav > li:hover .sub-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}
.sub-menu li a {
  display: block;
  padding: 10px 16px;
  font-size: 13.5px;
  color: var(--text);
  border-bottom: 1px solid var(--border);
  transition: all var(--trans);
}
.sub-menu li:last-child a { border-bottom: none; }
.sub-menu li a:hover {
  background: var(--bg);
  color: var(--red);
}

/* ================================================================
   MOBILE NAVIGATION
================================================================ */
.mob-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.6);
  backdrop-filter: blur(3px);
  z-index: 300;
  opacity: 0;
  visibility: hidden;
  transition: all var(--trans);
}
.mob-overlay.on { opacity: 1; visibility: visible; }

.mob-nav {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 285px;
  background: var(--navy);
  z-index: 400;
  transform: translateX(100%);
  transition: transform .3s ease;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}
.mob-nav.on { transform: translateX(0); }
body.nav-open { overflow: hidden; }

.mob-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  background: rgba(0,0,0,.2);
  flex-shrink: 0;
}
.mob-logo { color: #fff; font-size: 18px; font-weight: 900; }
.mob-close {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: rgba(255,255,255,.1);
  color: rgba(255,255,255,.8);
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--trans);
}
.mob-close:hover { background: var(--red); color: #fff; }

.mob-menu { flex: 1; padding: 8px 0; list-style: none; }
.mob-menu li { border-bottom: 1px solid rgba(255,255,255,.07); }
.mob-menu li a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 13px 16px;
  color: rgba(255,255,255,.82);
  font-size: 15px;
  font-weight: 500;
  transition: all var(--trans);
}
.mob-menu li a:hover { color: #fff; background: rgba(255,255,255,.07); }
.mob-menu .sub-menu {
  display: none;
  position: static;
  background: rgba(0,0,0,.2);
  border: none;
  border-radius: 0;
  box-shadow: none;
  opacity: 1;
  visibility: visible;
  transform: none;
}
.mob-menu .sub-menu li a {
  padding-right: 28px;
  font-size: 14px;
  color: rgba(255,255,255,.6);
  border-color: rgba(255,255,255,.05);
}
.mob-menu li.sub-open > .sub-menu { display: block; }

.mob-foot {
  padding: 16px;
  border-top: 1px solid rgba(255,255,255,.1);
  flex-shrink: 0;
}
.mob-foot .social-links a {
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.12);
  color: rgba(255,255,255,.55);
}

/* ================================================================
   SEARCH OVERLAY
================================================================ */
.search-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.95);
  z-index: 500;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 12vh;
  opacity: 0;
  visibility: hidden;
  transition: all var(--trans);
}
.search-overlay.on { opacity: 1; visibility: visible; }

.search-box {
  width: 100%;
  max-width: 660px;
  padding: 0 20px;
  position: relative;
}
.search-close {
  position: absolute;
  top: -52px;
  left: 20px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(255,255,255,.1);
  color: rgba(255,255,255,.7);
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--trans);
}
.search-close:hover { background: var(--red); color: #fff; }
.search-form {
  display: flex;
  align-items: center;
  border-bottom: 2px solid rgba(255,255,255,.2);
}
.search-form:focus-within { border-color: var(--red); }
.search-input {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  color: #fff;
  font-size: 24px;
  font-family: var(--font);
  padding: 12px 0;
  caret-color: var(--red);
}
.search-input::placeholder { color: rgba(255,255,255,.25); }
.search-go { color: var(--red); font-size: 20px; padding: 8px; }
.search-go:hover { opacity: .7; }

#sresults { margin-top: 12px; max-height: 340px; overflow-y: auto; border-radius: 8px; }
.s-result {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px;
  color: rgba(255,255,255,.85);
  border-radius: 8px;
  transition: background var(--trans);
}
.s-result:hover { background: rgba(255,255,255,.07); color: #fff; }
.s-result img { width: 56px; height: 42px; object-fit: cover; border-radius: 5px; flex-shrink: 0; }
.s-result-title { font-size: 14px; font-weight: 600; }
.s-result-cat   { font-size: 11px; color: var(--red); }
.s-no-result { color: rgba(255,255,255,.4); text-align: center; padding: 24px; font-size: 14px; }

/* ================================================================
   BREADCRUMBS
================================================================ */
.breadcrumbs {
  padding: 12px 0;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  color: var(--muted);
}
.breadcrumbs a { color: var(--muted); transition: color var(--trans); }
.breadcrumbs a:hover { color: var(--red); }
.breadcrumbs .sep { margin: 0 4px; font-size: 9px; }

/* ================================================================
   SECTION HEADING
================================================================ */
.sec-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 2px solid var(--border);
  position: relative;
}
.sec-head::after {
  content: '';
  position: absolute;
  bottom: -2px;
  right: 0;
  width: 50px;
  height: 2px;
  background: var(--red);
  border-radius: 2px;
}
.sec-head h2 { font-size: 19px; font-weight: 900; margin: 0; }
.see-all {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 13px;
  font-weight: 700;
  color: var(--red);
  white-space: nowrap;
  transition: gap var(--trans);
}
.see-all:hover { gap: 7px; }

/* ================================================================
   CARDS
================================================================ */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform var(--trans), box-shadow var(--trans);
}
.card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}

/* Thumbnail */
.card-thumb {
  position: relative;
  overflow: hidden;
  background: var(--navy);
  flex-shrink: 0;
}
.card-thumb a { display: block; height: 100%; }
.card-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform .6s ease;
}
.card:hover .card-thumb img { transform: scale(1.05); }

/* Fallback when no image */
.no-img {
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, #1d3557, #2a4a7a);
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(255,255,255,.15);
  font-size: 32px;
}

/* Category Badge */
.cat-badge {
  display: inline-block;
  background: var(--red);
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .06em;
  padding: 3px 10px;
  border-radius: 99px;
  margin-bottom: 8px;
  transition: opacity var(--trans);
}
.cat-badge:hover { color: #fff; opacity: .85; }

/* Card Body */
.card-body {
  padding: 14px;
  flex: 1;
  display: flex;
  flex-direction: column;
}
.card-title {
  font-size: 15px;
  font-weight: 700;
  line-height: 1.45;
  margin-bottom: 6px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.card-title a { color: var(--text); transition: color var(--trans); }
.card-title a:hover { color: var(--red); }
.card-excerpt {
  font-size: 13.5px;
  color: var(--muted);
  line-height: 1.6;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 10px;
  flex: 1;
}

/* Post meta */
.post-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  font-size: 12px;
  color: var(--muted);
  margin-top: auto;
  padding-top: 8px;
}
.post-meta span { display: flex; align-items: center; gap: 3px; }
.post-meta a    { color: var(--muted); font-weight: 600; transition: color var(--trans); }
.post-meta a:hover { color: var(--red); }

/* ── Overlay Card ── */
.card-overlay {
  position: relative;
  border: none;
  background: transparent;
}
.card-overlay .card-thumb {
  aspect-ratio: unset;
  height: 260px;
}
.card-overlay .card-body {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(to top, rgba(0,0,0,.92) 0%, rgba(0,0,0,.5) 60%, transparent 100%);
  color: #fff;
  padding: 42px 14px 14px;
  border-radius: 0;
}
.card-overlay .card-title { -webkit-line-clamp: 2; }
.card-overlay .card-title a     { color: #fff; }
.card-overlay .card-title a:hover { color: var(--amber); }
.card-overlay .post-meta {
  color: rgba(255,255,255,.65);
  border-top: 1px solid rgba(255,255,255,.15);
}
.card-overlay .post-meta a { color: rgba(255,255,255,.65); }
.card-overlay:hover { transform: translateY(-4px); }

/* ── Horizontal Card ── */
.card-h { flex-direction: row; }
.card-thumb-h {
  width: 180px;
  height: auto;
  min-height: 130px;
  flex-shrink: 0;
}

/* ── Mini Card (widgets) ── */
.mini-card {
  display: flex;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  align-items: flex-start;
}
.mini-card:last-child { border-bottom: none; }
.mini-thumb {
  width: 70px;
  height: 54px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  flex-shrink: 0;
  background: var(--navy);
}
.mini-thumb img { width: 100%; height: 100%; object-fit: cover; }
.mini-body { flex: 1; min-width: 0; }
.mini-title {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.4;
  margin-bottom: 4px;
  transition: color var(--trans);
}
.mini-title:hover { color: var(--red); }
.mini-date {
  font-size: 12px;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 3px;
}

/* ================================================================
   HERO SLIDER
================================================================ */
.hero-slider { position: relative; overflow: hidden; background: var(--topbar-bg); }
.slides-wrap { display: flex; will-change: transform; transition: transform .55s ease; }
.slide { min-width: 100%; height: 480px; position: relative; overflow: hidden; flex-shrink: 0; }
.slide-bg { position: absolute; inset: 0; background-size: cover; background-position: center; transition: transform 8s ease; }
.slide.active .slide-bg { transform: scale(1.05); }
.slide-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(0,0,0,.9) 0%, rgba(0,0,0,.25) 55%, rgba(0,0,0,.05) 100%);
}
.slide-content {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 48px 28px 24px;
  z-index: 2;
}
.slide-title { font-size: clamp(18px, 3vw, 28px); color: #fff; line-height: 1.3; margin-bottom: 10px; }
.slide-title a { color: #fff; }
.slide-title a:hover { color: var(--amber); }
.slide-meta { display: flex; gap: 14px; font-size: 12px; color: rgba(255,255,255,.6); }
.slide-meta span { display: flex; align-items: center; gap: 4px; }

.sl-prev, .sl-next {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: rgba(255,255,255,.12);
  backdrop-filter: blur(6px);
  border: 1px solid rgba(255,255,255,.2);
  color: #fff;
  font-size: 15px;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 5;
  transition: all var(--trans);
}
.sl-prev:hover, .sl-next:hover { background: var(--red); border-color: var(--red); }
.sl-prev { right: 18px; }
.sl-next { left: 18px; }

.sl-dots { position: absolute; bottom: 18px; left: 50%; transform: translateX(-50%); display: flex; gap: 6px; z-index: 5; }
.dot { width: 7px; height: 7px; border-radius: 99px; background: rgba(255,255,255,.4); border: none; cursor: pointer; padding: 0; transition: all .2s; }
.dot.active { background: #fff; width: 22px; }

/* ================================================================
   PAGINATION
================================================================ */
.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 5px;
  padding: 28px 0;
  flex-wrap: wrap;
}
.pagination a,
.pagination span {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-width: 38px;
  height: 38px;
  padding: 0 10px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  background: var(--card);
  transition: all var(--trans);
  text-decoration: none;
}
.pagination a:hover,
.pagination span.current {
  background: var(--red);
  border-color: var(--red);
  color: #fff;
}
.pagination span.dots { background: transparent; border: none; cursor: default; }

/* ================================================================
   SIDEBAR & WIDGETS
================================================================ */
.sidebar {
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.widget {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.widget-title {
  font-size: 12.5px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: .06em;
  padding: 11px 14px;
  margin: 0;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 7px;
}
[data-theme="dark"] .widget-title { background: rgba(255,255,255,.04); }
.widget-title::before {
  content: '';
  display: block;
  width: 3px;
  height: 16px;
  background: var(--red);
  border-radius: 99px;
  flex-shrink: 0;
}

/* Widget body — padding container for all widget content */
.widget > *:not(.widget-title) { padding: 12px 14px; }
.widget .mini-card { padding: 8px 0; margin: 0; }
.widget .mini-card:first-child { padding-top: 0; }
.widget .mini-card:last-child  { border-bottom: none; }
.widget ul { list-style: none; }
.widget ul li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}
.widget ul li:last-child { border-bottom: none; }
.widget ul li a { color: var(--text); transition: color var(--trans); flex: 1; }
.widget ul li a:hover { color: var(--red); }
.cat-count {
  background: var(--bg);
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 99px;
  flex-shrink: 0;
}

/* Ranked list */
.rank-list { display: flex; flex-direction: column; }
.rank-item { display: flex; align-items: flex-start; gap: 10px; padding: 11px 0; border-bottom: 1px solid var(--border); }
.rank-item:last-child { border-bottom: none; }
.rank-n {
  font-size: 22px;
  font-weight: 900;
  color: var(--border);
  line-height: 1;
  min-width: 30px;
  text-align: center;
  flex-shrink: 0;
}
.rank-body { flex: 1; min-width: 0; }
.rank-link {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.4;
  margin-bottom: 3px;
  transition: color var(--trans);
}
.rank-link:hover { color: var(--red); }
.rank-views { font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 3px; }

/* Category list */
.cat-list { list-style: none; }
.cat-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 0;
  border-bottom: 1px solid var(--border);
}
.cat-list li:last-child { border-bottom: none; }
.cat-list li a { font-size: 14px; color: var(--text); flex: 1; transition: color var(--trans); }
.cat-list li a:hover { color: var(--red); }

/* ================================================================
   ARCHIVE BANNER
================================================================ */
.arch-banner {
  background: var(--navy);
  color: #fff;
  padding: 26px;
  border-radius: var(--radius);
  margin-bottom: 22px;
  text-align: center;
}
.arch-icon { font-size: 32px; opacity: .5; margin-bottom: 10px; }
.arch-banner h1 { color: #fff; font-size: clamp(20px, 3vw, 26px); margin-bottom: 5px; }
.arch-banner p  { color: rgba(255,255,255,.65); font-size: 14px; }

.arch-author {
  display: flex;
  align-items: center;
  gap: 18px;
  text-align: right;
}
.arch-author img { width: 72px; height: 72px; border-radius: 50%; object-fit: cover; flex-shrink: 0; border: 3px solid rgba(255,255,255,.25); }

/* ================================================================
   SINGLE POST
================================================================ */
.single-hd { margin-bottom: 18px; }
.single-title { font-size: clamp(20px, 4vw, 30px); line-height: 1.3; margin-bottom: 12px; }
.single-lead {
  font-size: 16px;
  color: var(--muted);
  line-height: 1.7;
  padding: 12px 16px;
  border-right: 4px solid var(--red);
  background: var(--bg);
  border-radius: 0 var(--radius) var(--radius) 0;
  margin-bottom: 18px;
}
[data-theme="dark"] .single-lead { background: rgba(255,255,255,.04); }

/* Featured image — constrained, not full width */
.feat-img {
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 22px;
  box-shadow: var(--shadow);
  max-height: 480px;
}
.feat-img img {
  width: 100%;
  max-height: 480px;
  object-fit: cover;
  display: block;
}
.feat-caption { font-size: 12px; color: var(--muted); text-align: center; margin-top: 6px; font-style: italic; }

/* Article content */
.entry-content {
  font-size: 16.5px;
  line-height: 1.9;
  color: var(--text);
}
.entry-content > * + * { margin-top: 16px; }
.entry-content h2 { font-size: 20px; padding-bottom: 8px; border-bottom: 2px solid var(--border); margin-top: 32px; }
.entry-content h3 { font-size: 17px; margin-top: 26px; }
.entry-content h4 { font-size: 16px; margin-top: 20px; }
.entry-content a  { color: var(--red); text-decoration: underline; }
.entry-content img { border-radius: var(--radius-sm); max-width: 100%; height: auto; }
.entry-content ul  { list-style: disc; padding-right: 22px; }
.entry-content ol  { list-style: decimal; padding-right: 22px; }
.entry-content li  { margin-bottom: 5px; }
.entry-content blockquote {
  border-right: 4px solid var(--red);
  padding: 12px 18px;
  background: var(--bg);
  border-radius: 0 var(--radius) var(--radius) 0;
  font-style: italic;
  font-size: 17px;
  color: var(--muted);
}
[data-theme="dark"] .entry-content blockquote { background: rgba(255,255,255,.04); }
.entry-content pre {
  background: #1e293b;
  color: #e2e8f0;
  padding: 18px;
  border-radius: var(--radius);
  overflow-x: auto;
  font-size: 14px;
  direction: ltr;
  text-align: left;
}
.entry-content code { background: var(--bg); padding: 2px 6px; border-radius: 4px; font-size: 14px; }
.entry-content table { width: 100%; border-collapse: collapse; }
.entry-content table th, .entry-content table td { border: 1px solid var(--border); padding: 9px 13px; text-align: right; }
.entry-content table th { background: var(--bg); font-weight: 700; }
.alignleft  { float: right; margin-left: 18px; margin-bottom: 8px; }
.alignright { float: left;  margin-right: 18px; margin-bottom: 8px; }
.aligncenter { margin: 0 auto; display: block; }

/* Post tags */
.post-tags { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-bottom: 18px; }
.post-tags > span { font-size: 13px; font-weight: 700; color: var(--muted); }
.tag-link {
  background: var(--bg);
  color: var(--muted);
  border: 1px solid var(--border);
  padding: 3px 11px;
  border-radius: 99px;
  font-size: 13px;
  transition: all var(--trans);
}
.tag-link:hover { background: var(--red); color: #fff; border-color: var(--red); }

/* Share bar */
.share-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; margin-bottom: 18px; }
.share-label { font-size: 13px; font-weight: 700; color: var(--muted); white-space: nowrap; }
.share-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 13px;
  border-radius: 99px;
  font-size: 13px;
  font-weight: 700;
  color: #fff;
  transition: all var(--trans);
}
.share-btn:hover { opacity: .88; transform: translateY(-2px); }
.share-fb { background: #1877f2; }
.share-tw { background: #000; }
.share-wa { background: #25d366; }
.share-tg { background: #0088cc; }
.share-cp { background: var(--muted); }

/* Shortlink */
.shortlink-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 9px 13px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}
[data-theme="dark"] .shortlink-bar { background: rgba(255,255,255,.04); }
.sl-label { font-size: 13px; font-weight: 700; color: var(--muted); white-space: nowrap; }
.sl-url { flex: 1; font-size: 13px; color: var(--red); font-family: monospace; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.copy-btn {
  background: var(--red);
  color: #fff;
  padding: 4px 12px;
  border-radius: 99px;
  font-size: 12px;
  font-weight: 700;
  transition: background var(--trans);
  flex-shrink: 0;
}
.copy-btn:hover { background: var(--red-h); }

/* Views */
.views-bar { display: flex; align-items: center; gap: 5px; font-size: 14px; color: var(--muted); margin-bottom: 18px; }
.views-bar strong { color: var(--text); font-weight: 700; }

/* Author box */
.author-box {
  display: flex;
  gap: 14px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  margin: 26px 0;
  align-items: flex-start;
}
[data-theme="dark"] .author-box { background: rgba(255,255,255,.04); }
.author-box img { width: 70px; height: 70px; border-radius: 50%; object-fit: cover; flex-shrink: 0; border: 3px solid var(--border); }
.author-info { flex: 1; }
.author-name { font-size: 16px; font-weight: 800; margin-bottom: 4px; }
.author-name a { color: var(--text); transition: color var(--trans); }
.author-name a:hover { color: var(--red); }
.author-bio  { font-size: 13.5px; color: var(--muted); line-height: 1.65; margin-bottom: 7px; }
.author-link { font-size: 13px; font-weight: 700; color: var(--red); display: inline-flex; align-items: center; gap: 4px; transition: gap var(--trans); }
.author-link:hover { gap: 7px; }

/* Post navigation */
.post-nav { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 22px 0; }
.pnav-btn {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 13px 14px;
  background: var(--card);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  transition: all var(--trans);
  color: var(--text);
}
.pnav-btn:hover { border-color: var(--red); transform: translateY(-2px); box-shadow: var(--shadow); color: var(--text); }
.pnav-dir { font-size: 11px; font-weight: 700; color: var(--red); text-transform: uppercase; letter-spacing: .04em; display: flex; align-items: center; gap: 3px; }
.pnav-title { font-size: 13.5px; font-weight: 600; line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* Related posts */
.related-section { margin: 26px 0; }
.related-title { font-size: 18px; margin-bottom: 16px; padding-bottom: 9px; border-bottom: 3px solid var(--red); display: inline-block; padding-left: 24px; }

/* ================================================================
   COMMENTS
================================================================ */
.comments-area { margin-top: 32px; padding-top: 22px; border-top: 2px solid var(--border); }
.comments-title { font-size: 19px; margin-bottom: 20px; }
.comments-list  { list-style: none; }
.comments-list .children { list-style: none; padding-right: 30px; }
.comment-item   { margin-bottom: 14px; }
.comment-wrap   { display: flex; gap: 11px; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; }
.comment-avatar img { border-radius: 50%; }
.comment-main   { flex: 1; min-width: 0; }
.comment-head   { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 7px; }
.comment-author { font-size: 14px; font-weight: 700; }
.comment-date   { font-size: 12px; color: var(--muted); }
.comment-text p { font-size: 14px; margin-bottom: 6px; }
.comment-text p:last-child { margin-bottom: 0; }
.comment-reply-link { font-size: 12px; font-weight: 700; color: var(--red); display: inline-flex; align-items: center; gap: 3px; margin-top: 7px; }

#respond {
  margin-top: 24px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
}
[data-theme="dark"] #respond { background: rgba(255,255,255,.03); }
#respond h3 { font-size: 17px; margin-bottom: 16px; }
.comment-form p { margin-bottom: 12px; }
.comment-form label { display: block; font-size: 13px; font-weight: 700; margin-bottom: 4px; }
.comment-form input[type="text"],
.comment-form input[type="email"],
.comment-form input[type="url"],
.comment-form textarea {
  width: 100%;
  padding: 9px 13px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--card);
  color: var(--text);
  font-size: 14px;
  font-family: var(--font);
  outline: none;
  transition: border-color var(--trans);
}
.comment-form input:focus, .comment-form textarea:focus {
  border-color: var(--red);
  box-shadow: 0 0 0 3px rgba(230,57,70,.1);
}
.comment-form textarea { min-height: 110px; resize: vertical; }
.comment-form input[type="submit"] {
  background: var(--red);
  color: #fff;
  border: none;
  padding: 10px 26px;
  border-radius: 99px;
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
  font-family: var(--font);
  transition: all var(--trans);
}
.comment-form input[type="submit"]:hover { background: var(--red-h); transform: translateY(-2px); }

/* ================================================================
   SEARCH / 404
================================================================ */
.search-title { font-size: 21px; margin-bottom: 5px; }
.search-title span { color: var(--red); }
.search-count { font-size: 13px; color: var(--muted); display: block; margin-bottom: 12px; }
.no-posts { text-align: center; padding: 44px 20px; color: var(--muted); }
.no-posts i { font-size: 38px; color: var(--border); display: block; margin-bottom: 14px; }
.no-posts h2 { font-size: 19px; color: var(--text); margin-bottom: 9px; }
.page-404 { text-align: center; padding: 52px 20px; }
.err-404 { font-size: 100px; font-weight: 900; color: var(--red); opacity: .12; line-height: 1; letter-spacing: -.05em; }
.page-404 h1 { font-size: 24px; margin-bottom: 8px; margin-top: -8px; }
.page-404 p  { color: var(--muted); margin-bottom: 20px; }

/* ================================================================
   FOOTER
================================================================ */
.site-footer { background: #0f172a; color: rgba(255,255,255,.5); }
.foot-widgets { padding: 44px 0; border-bottom: 1px solid rgba(255,255,255,.07); }
.foot-grid {
  display: grid;
  gap: 28px;
  grid-template-columns: repeat(4, 1fr);
}
.foot-grid.fc3 { grid-template-columns: repeat(3, 1fr); }
.foot-grid.fc2 { grid-template-columns: repeat(2, 1fr); }
.foot-col-title { font-size: 13px; font-weight: 900; text-transform: uppercase; letter-spacing: .07em; color: #fff; padding-bottom: 11px; border-bottom: 2px solid var(--red); margin-bottom: 16px; }
.foot-col p { font-size: 14px; line-height: 1.75; color: rgba(255,255,255,.5); }
.foot-col ul { list-style: none; }
.foot-col ul li { padding: 7px 0; border-bottom: 1px solid rgba(255,255,255,.07); font-size: 14px; }
.foot-col ul li:last-child { border-bottom: none; }
.foot-col ul li a { color: rgba(255,255,255,.55); transition: color var(--trans); }
.foot-col ul li a:hover { color: #fff; }
.foot-col .widget { background: transparent; border: none; box-shadow: none; }
.foot-col .widget-title { background: transparent; border: none; border-bottom: 2px solid var(--red); color: #fff; padding: 0 0 11px; margin-bottom: 16px; font-size: 13px; }
.foot-col .widget-title::before { display: none; }
.foot-col .mini-card .mini-title { color: rgba(255,255,255,.7); }
.foot-col .mini-card .mini-title:hover { color: #fff; }
.foot-col .mini-card .mini-date { color: rgba(255,255,255,.35); }
.foot-col .mini-card { border-color: rgba(255,255,255,.07); }
.foot-col .rank-link { color: rgba(255,255,255,.7); }
.foot-col .rank-link:hover { color: #fff; }
.foot-col .rank-views, .foot-col .rank-n { color: rgba(255,255,255,.25); }

.foot-bottom { padding: 14px 0; background: rgba(0,0,0,.3); }
.foot-bottom .wrap { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px; }
.copyright { font-size: 13px; color: rgba(255,255,255,.35); }
.copyright a { color: rgba(255,255,255,.35); transition: color var(--trans); }
.copyright a:hover { color: #fff; }
.foot-menu { display: flex; gap: 16px; list-style: none; }
.foot-menu li a { color: rgba(255,255,255,.4); font-size: 13px; transition: color var(--trans); }
.foot-menu li a:hover { color: #fff; }

/* ================================================================
   UTILITIES
================================================================ */
.reading-bar { position: fixed; top: 0; left: 0; right: 0; height: 3px; z-index: 9999; pointer-events: none; }
.reading-fill { height: 100%; width: 0%; background: linear-gradient(90deg, var(--red), var(--amber)); transition: width .1s linear; }

.back-top {
  position: fixed;
  bottom: 26px;
  left: 26px;
  width: 42px;
  height: 42px;
  background: var(--red);
  color: #fff;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(14px);
  transition: all var(--trans);
  z-index: 99;
  box-shadow: var(--shadow-lg);
}
.back-top.on { opacity: 1; visibility: visible; transform: translateY(0); }
.back-top:hover { background: var(--red-h); transform: translateY(-3px); }

.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(54px);
  background: #1e293b;
  color: #fff;
  padding: 9px 20px;
  border-radius: 99px;
  font-size: 13px;
  z-index: 9999;
  transition: transform var(--trans);
  box-shadow: var(--shadow-lg);
  white-space: nowrap;
  pointer-events: none;
}
.toast.on { transform: translateX(-50%) translateY(0); }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--red);
  color: #fff;
  padding: 9px 22px;
  border-radius: 99px;
  font-size: 14px;
  font-weight: 800;
  transition: all var(--trans);
}
.btn:hover { background: var(--red-h); transform: translateY(-2px); color: #fff; }

/* ================================================================
   RESPONSIVE
================================================================ */
@media (max-width: 1100px) {
  :root { --sidebar-w: 270px; }
  .foot-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 900px) {
  .page-grid {
    grid-template-columns: 1fr;
  }
  .side-col { order: 2; }
  .posts-grid.g4 { grid-template-columns: repeat(2, 1fr); }
  .slide { height: 380px; }
}

@media (max-width: 640px) {
  :root { --header-h: 56px; }
  .main-nav-bar { display: none; }
  .hbtn-menu    { display: flex !important; }
  .header-ad    { display: none; }
  .posts-grid.g3 { grid-template-columns: repeat(2, 1fr); }
  .posts-grid.g2 { grid-template-columns: 1fr; }
  .card-h { flex-direction: column; }
  .card-thumb-h { width: 100%; min-height: unset; height: auto; aspect-ratio: 16/9; }
  .post-nav { grid-template-columns: 1fr; }
  .slide { height: 260px; }
  .slide-title { font-size: 17px; }
  .author-box { flex-direction: column; }
  .arch-author { flex-direction: column; text-align: center; }
  .foot-grid, .foot-grid.fc3, .foot-grid.fc2 { grid-template-columns: 1fr; }
  .foot-bottom .wrap { flex-direction: column; text-align: center; }
  .share-btn span { display: none; }
}

@media (max-width: 420px) {
  .posts-grid.g3, .posts-grid.g4 { grid-template-columns: 1fr; }
}

@media print {
  .topbar, .breaking-bar, .site-header, .main-nav-bar, .mob-nav,
  .side-col, .site-footer, .share-bar, .post-nav, .back-top,
  .reading-bar, .search-overlay { display: none !important; }
  .page-grid { grid-template-columns: 1fr !important; }
}
