/*
Theme Name: KhabarPress News Portal
Theme URI: https://example.com/khabarpress
Author: Senior WordPress Architect
Author URI: https://example.com
Description: A modern, ultra-lightweight, and lightning-fast WordPress theme built specifically for news portals, online magazines, and editorial publishers. Features pure HTML5/CSS3, optimized Google AdSense monetization slots, breaking news ticker, lead story hero block, 3-column category grids, and sticky sidebar.
Version: 1.0.0
Requires at least: 6.0
Tested up to: 6.7
Requires PHP: 7.4
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: khabarpress
Tags: news, magazine, blog, custom-header, custom-menu, featured-images, full-width-template, sticky-post, theme-options, translation-ready, two-columns, grid-layout
*/

:root {
  --kp-primary: #dc2626;         /* Crimson Red for breaking / accents */
  --kp-primary-hover: #b91c1c;
  --kp-secondary: #1d4ed8;       /* Royal Blue for tags / links */
  --kp-dark: #0f172a;            /* Deep slate black for high contrast */
  --kp-body: #1e293b;            /* Crisp text color */
  --kp-muted: #64748b;           /* Metadata text */
  --kp-light-bg: #f8fafc;        /* Secondary backgrounds */
  --kp-border: #e2e8f0;          /* Subtle clean borders */
  --kp-card-bg: #ffffff;
  --kp-max-width: 1240px;
  --kp-font-sans: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Noto Sans Bengali", sans-serif;
  --kp-font-serif: 'Merriweather', Georgia, serif;
  --kp-shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.05);
  --kp-shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.08);
  --kp-radius: 4px;
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
}

body {
  font-family: var(--kp-font-sans);
  background-color: #ffffff;
  color: var(--kp-body);
  line-height: 1.6;
}

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

a {
  color: inherit;
  text-decoration: none;
  transition: color 0.2s ease;
}

a:hover {
  color: var(--kp-primary);
}

ul, ol {
  list-style: none;
}

.kp-container {
  max-width: var(--kp-max-width);
  margin-left: auto;
  margin-right: auto;
  padding-left: 1rem;
  padding-right: 1rem;
}

/* Strategic Ad Placement Containers */
.kp-ad-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background-color: var(--kp-light-bg);
  border: 1px dashed #cbd5e1;
  border-radius: var(--kp-radius);
  position: relative;
  text-align: center;
  overflow: hidden;
  margin: 1rem 0;
}

.kp-ad-label {
  font-size: 0.625rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #94a3b8;
  margin-bottom: 0.25rem;
  display: block;
}

/* Slot 1: Header Leaderboard (728x90) */
.kp-ad-slot-header {
  width: 728px;
  height: 90px;
  max-width: 100%;
  margin: 0;
  flex-shrink: 0;
}

/* Slot 2: Mid-Feed Banner */
.kp-ad-slot-feed {
  width: 100%;
  min-height: 120px;
  padding: 1.5rem 1rem;
  margin: 2rem 0;
  background: #f1f5f9;
}

/* Slot 3: Sidebar Medium Rectangle */
.kp-ad-slot-sidebar {
  width: 100%;
  min-height: 250px;
  margin-bottom: 1.5rem;
}

.kp-ad-sticky,
.kp-sidebar-ad-wrap {
  position: static !important; /* Strictly static to prevent hanging and allow natural smooth scroll */
  margin: 1.5rem 0;
}

/* Slot 4: In-Content Ads */
.kp-ad-slot-incontent-1,
.kp-ad-slot-incontent-2 {
  margin: 2rem auto;
  padding: 1rem;
  width: 100%;
  max-width: 650px;
  min-height: 100px;
  background: #f8fafc;
  border-left: 3px solid var(--kp-primary);
}

/* Slot 5: Bottom Footer Banner */
.kp-ad-slot-footer {
  width: 100%;
  max-width: 970px;
  min-height: 90px;
  margin: 2.5rem auto 1rem auto;
}

/* Top Bar & Ticker */
.kp-topbar {
  background-color: var(--kp-dark);
  color: #94a3b8;
  font-size: 0.8125rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  height: 38px;
  line-height: 38px;
  overflow: hidden;
}

.kp-topbar-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 38px;
  padding: 0;
}

.kp-topbar-date {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.kp-edition-pill {
  margin-left: 8px;
  background: rgba(255, 255, 255, 0.12);
  padding: 2px 8px;
  border-radius: 3px;
  font-size: 0.72rem;
  color: #f1f5f9;
}

.kp-topbar-links {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.8125rem;
}

.kp-topbar-links a {
  color: #cbd5e1;
  font-weight: 500;
  transition: color 0.2s;
}

.kp-topbar-links a:hover {
  color: #ffffff;
}

.kp-sep {
  color: #475569;
  font-size: 0.75rem;
}

.kp-breaking-ticker {
  background-color: #fff1f2;
  border-top: 1px solid #ffe4e6;
  border-bottom: 1px solid #fecdd3;
  display: flex;
  align-items: center;
  overflow: hidden;
  font-size: 0.875rem;
}

.kp-ticker-badge {
  background-color: var(--kp-primary);
  color: #ffffff;
  padding: 0.5rem 1rem;
  font-weight: 700;
  font-size: 0.8125rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.kp-ticker-badge::before {
  content: "";
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: #ffffff;
  animation: kp-pulse 1.2s infinite;
}

@keyframes kp-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.8); }
}

.kp-ticker-content {
  flex-grow: 1;
  padding: 0.5rem 1rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.kp-ticker-item {
  color: var(--kp-dark);
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.kp-ticker-item:hover {
  color: var(--kp-primary);
}

/* Header & Clean Proportional Branding */
.kp-header-main {
  padding: 1.25rem 0;
  border-bottom: 1px solid var(--kp-border);
  background: #ffffff;
}

.kp-header-grid {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  flex-direction: row;
}

.kp-site-branding {
  order: 1 !important;
  flex: 0 1 auto;
  max-width: 340px;
  text-align: left;
}

.kp-header-ad-wrap {
  order: 2 !important;
  flex: 0 0 auto;
  margin-left: auto;
}

/* Constrain any uploaded custom logo so it can NEVER be giant or displace the ad */
.kp-site-branding img,
.custom-logo,
.custom-logo-link img,
.kp-custom-logo-wrap img {
  max-height: 48px !important;
  max-width: 240px !important;
  width: auto !important;
  height: auto !important;
  object-fit: contain !important;
  display: inline-block !important;
}

.kp-site-title {
  font-size: 2.25rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--kp-dark);
  margin: 0;
  line-height: 1.1;
  text-transform: uppercase;
  font-family: var(--kp-font-serif);
}

.kp-site-title a {
  color: var(--kp-dark);
}

.kp-site-title span {
  color: var(--kp-primary);
}

.kp-site-description {
  font-size: 0.75rem;
  color: var(--kp-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-top: 0.35rem;
  font-family: var(--kp-font-sans);
  font-weight: 500;
}

/* Navigation Menu & Enhanced Search Bar */
.kp-nav-bar {
  background-color: var(--kp-dark);
  border-bottom: 2px solid var(--kp-primary);
  position: relative;
  z-index: 40;
}

.kp-nav-container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: relative;
  min-height: 48px;
}

.kp-menu-wrapper {
  display: flex;
  align-items: center;
  flex: 1 1 auto;
}

.kp-primary-menu {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  margin: 0;
  padding: 0;
  list-style: none;
}

.kp-primary-menu > li > a {
  display: block;
  padding: 0.85rem 0.95rem;
  color: #f1f5f9;
  font-weight: 600;
  font-size: 0.9375rem;
  border-bottom: 3px solid transparent;
  transition: all 0.2s;
  white-space: nowrap;
}

.kp-primary-menu > li > a:hover,
.kp-primary-menu > li.current-menu-item > a,
.kp-primary-menu > li.current_page_item > a {
  background-color: rgba(255, 255, 255, 0.06);
  border-bottom-color: var(--kp-primary);
  color: #ffffff;
}

/* Enhanced Search Bar */
.kp-nav-actions {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  margin-left: 1rem;
}

.kp-search-box-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.kp-search-input {
  background: #1e293b;
  color: #f8fafc;
  border: 1px solid #334155;
  border-radius: 20px;
  padding: 0.4rem 2rem 0.4rem 0.85rem;
  font-size: 0.8125rem;
  width: 175px;
  transition: all 0.3s ease;
  outline: none;
}

.kp-search-input:focus {
  width: 215px;
  border-color: var(--kp-primary);
  background: #0f172a;
}

.kp-search-btn {
  position: absolute;
  right: 8px;
  background: none;
  border: none;
  color: #94a3b8;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2px;
}

.kp-search-btn:hover {
  color: #ffffff;
}

.kp-mobile-toggle {
  display: none;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: var(--kp-radius);
  color: #ffffff;
  padding: 0.4rem 0.75rem;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
}

/* Homepage Lead Section */
.kp-home-lead-section {
  padding: 1.75rem 0 1rem 0;
}

.kp-lead-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 1.5rem;
}

.kp-lead-article {
  position: relative;
  border-radius: var(--kp-radius);
  overflow: hidden;
  box-shadow: var(--kp-shadow-sm);
  background: var(--kp-card-bg);
}

.kp-lead-image-wrap {
  position: relative;
  overflow: hidden;
  height: 380px;
  background-color: #0f172a;
}

.kp-lead-image-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s ease;
}

.kp-lead-article:hover .kp-lead-image-wrap img {
  transform: scale(1.03);
}

.kp-badge {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  color: #ffffff;
  background-color: var(--kp-primary);
  border-radius: 2px;
  letter-spacing: 0.04em;
  margin-bottom: 0.5rem;
}

.kp-badge-blue {
  background-color: var(--kp-secondary);
}

.kp-lead-title {
  font-size: 1.875rem;
  font-weight: 800;
  line-height: 1.2;
  color: var(--kp-dark);
  margin-bottom: 0.65rem;
}

.kp-lead-excerpt {
  color: var(--kp-muted);
  font-size: 0.9375rem;
  line-height: 1.55;
  margin-bottom: 0.75rem;
}

.kp-post-meta {
  font-size: 0.75rem;
  color: var(--kp-muted);
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.kp-sublead-list {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.kp-sublead-card {
  display: flex;
  gap: 1rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--kp-border);
}

.kp-sublead-thumb {
  width: 110px;
  height: 80px;
  flex-shrink: 0;
  border-radius: var(--kp-radius);
  overflow: hidden;
}

.kp-sublead-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* 2-Column Portal Wrapper */
.kp-main-wrapper {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 2rem;
  margin-top: 1.5rem;
  margin-bottom: 3rem;
}

.kp-section-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 2px solid var(--kp-dark);
  margin-bottom: 1.25rem;
  padding-bottom: 0.35rem;
}

.kp-section-title {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--kp-dark);
  position: relative;
  text-transform: uppercase;
}

.kp-section-title::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -0.45rem;
  width: 45px;
  height: 3px;
  background-color: var(--kp-primary);
}

.kp-category-grid-3col {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.25rem;
  margin-bottom: 2.25rem;
}

.kp-news-card-img {
  height: 160px;
  width: 100%;
  border-radius: var(--kp-radius);
  overflow: hidden;
  margin-bottom: 0.65rem;
}

.kp-news-card-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s;
}

.kp-news-card:hover .kp-news-card-img img {
  transform: scale(1.04);
}

.kp-news-card-title {
  font-size: 0.9375rem;
  font-weight: 700;
  line-height: 1.35;
  color: var(--kp-dark);
  margin-bottom: 0.35rem;
}

.kp-split-category-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  margin-bottom: 2rem;
}

/* Sidebar Widgets */
.kp-sidebar {
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.kp-widget {
  background: #ffffff;
  border-top: 3px solid var(--kp-dark);
  padding-top: 1rem;
}

.kp-widget-title {
  font-size: 1.125rem;
  font-weight: 800;
  color: var(--kp-dark);
  margin-bottom: 1rem;
  text-transform: uppercase;
}

.kp-trending-item {
  display: flex;
  align-items: flex-start;
  gap: 0.85rem;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--kp-border);
}

.kp-trending-num {
  font-size: 1.5rem;
  font-weight: 900;
  color: #cbd5e1;
  line-height: 1;
  min-width: 28px;
}

.kp-trending-item:nth-child(1) .kp-trending-num {
  color: var(--kp-primary);
}

.kp-trending-title {
  font-size: 0.875rem;
  font-weight: 700;
  line-height: 1.35;
  color: var(--kp-dark);
}

/* Single Article */
.kp-article-title {
  font-size: 2.25rem;
  font-weight: 800;
  line-height: 1.25;
  color: var(--kp-dark);
  margin: 0.75rem 0 1rem 0;
}

.kp-author-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 0;
  border-top: 1px solid var(--kp-border);
  border-bottom: 1px solid var(--kp-border);
  margin-bottom: 1.5rem;
}

.kp-author-info {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.kp-author-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  object-fit: cover;
}

.kp-share-buttons {
  display: flex;
  gap: 0.5rem;
}

.kp-share-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.35rem 0.65rem;
  border-radius: var(--kp-radius);
  color: #ffffff;
}

.kp-share-fb { background-color: #1877f2; }
.kp-share-tw { background-color: #0f172a; }
.kp-share-wa { background-color: #25d366; }

.kp-entry-content {
  font-family: var(--kp-font-serif);
  font-size: 1.125rem;
  line-height: 1.85;
  color: #334155;
}

.kp-entry-content p {
  margin-bottom: 1.5rem;
}

.kp-author-box {
  display: flex;
  gap: 1.25rem;
  padding: 1.5rem;
  background-color: var(--kp-light-bg);
  border-radius: var(--kp-radius);
  margin: 2.5rem 0;
}

.kp-author-box-img {
  width: 70px;
  height: 70px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* Footer */
.kp-site-footer {
  background-color: var(--kp-dark);
  color: #94a3b8;
  padding-top: 3rem;
  margin-top: 3rem;
}

.kp-footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1.5fr;
  gap: 2rem;
  padding-bottom: 3rem;
}

.kp-footer-col h3 {
  color: #ffffff;
  font-size: 1rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 1.25rem;
  position: relative;
  padding-bottom: 0.5rem;
}

.kp-footer-col h3::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  width: 30px;
  height: 2px;
  background-color: var(--kp-primary);
}

.kp-footer-links li {
  margin-bottom: 0.6rem;
  font-size: 0.875rem;
}

.kp-footer-links a {
  color: #cbd5e1;
}

.kp-footer-links a:hover {
  color: #ffffff;
  padding-left: 4px;
}

.kp-footer-bottom {
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  padding: 1.5rem 0;
  font-size: 0.8125rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* Responsive Media Queries */
@media (max-width: 1024px) {
  .kp-main-wrapper {
    grid-template-columns: 1fr;
  }
  .kp-lead-grid {
    grid-template-columns: 1fr;
  }
  .kp-footer-grid {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 860px) {
  .kp-header-grid {
    flex-direction: column !important;
    align-items: center !important;
    text-align: center !important;
    gap: 1rem !important;
  }
  .kp-site-branding {
    order: 1 !important; /* Branding is strictly on TOP */
    width: 100% !important;
    max-width: 100% !important;
    text-align: center !important;
    margin: 0 auto !important;
  }
  .kp-header-ad-wrap {
    order: 2 !important; /* Ad is strictly BELOW branding */
    width: 100% !important;
    display: flex !important;
    justify-content: center !important;
    margin: 0.5rem auto 0 auto !important;
    overflow-x: auto;
  }
  .kp-mobile-toggle {
    display: inline-flex !important;
    align-items: center;
    gap: 0.4rem;
  }
  .kp-menu-wrapper {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background-color: var(--kp-dark);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.4);
    z-index: 100;
  }
  .kp-menu-wrapper.is-open {
    display: block !important;
  }
  .kp-primary-menu {
    flex-direction: column !important;
    width: 100% !important;
    padding: 0.5rem 0 !important;
  }
  .kp-primary-menu > li {
    width: 100%;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  }
  .kp-primary-menu > li > a {
    padding: 0.8rem 1.25rem !important;
    width: 100%;
    display: block;
  }
  .kp-category-grid-3col,
  .kp-split-category-row {
    grid-template-columns: 1fr;
  }
  .kp-article-title {
    font-size: 1.625rem;
  }
}

