/*
Theme Name: QalamBlog
Theme URI: https://qalamblog.com
Author: QalamBlog Team
Author URI: https://qalamblog.com
Description: A professional, fast, SEO-optimized blog theme with homepage full-width layout, sidebar on single posts and archive pages. Fully responsive with dark mode support.
Version: 2.0.0
Requires at least: 6.0
Tested up to: 6.5
Requires PHP: 7.4
License: GNU General Public License v2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Text Domain: qalamblog
Tags: blog, two-columns, right-sidebar, full-width-template, custom-menu, featured-images, threaded-comments, translation-ready, rtl-language-support
*/

/* ============================================
   CSS CUSTOM PROPERTIES
============================================ */
:root {
  --primary: #1a1a2e;
  --primary-light: #16213e;
  --accent: #f59e0b;
  --accent-dark: #d97706;
  --accent-light: #fef3c7;
  --text-primary: #1f2937;
  --text-secondary: #6b7280;
  --text-muted: #9ca3af;
  --bg-primary: #ffffff;
  --bg-secondary: #f9fafb;
  --bg-tertiary: #f3f4f6;
  --border-color: #e5e7eb;
  --border-hover: #d1d5db;
  --sidebar-width: 300px;
  --container-max: 1200px;
  --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
  --font-serif: Georgia, 'Times New Roman', Times, serif;
  --font-mono: 'Courier New', Courier, monospace;
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.08);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.1);
  --transition: 0.2s ease;
}

/* Dark Mode */
@media (prefers-color-scheme: dark) {
  :root {
    --text-primary: #f3f4f6;
    --text-secondary: #9ca3af;
    --text-muted: #6b7280;
    --bg-primary: #111827;
    --bg-secondary: #1f2937;
    --bg-tertiary: #374151;
    --border-color: #374151;
    --border-hover: #4b5563;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.3);
    --shadow-md: 0 4px 16px rgba(0,0,0,0.3);
  }
}

/* ============================================
   RESET & BASE
============================================ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-serif);
  font-size: 1.0625rem;
  line-height: 1.75;
  color: var(--text-primary);
  background: var(--bg-secondary);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--primary); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--accent); }

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

ul, ol { padding-left: 1.5rem; }

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-sans);
  font-weight: 700;
  line-height: 1.3;
  color: var(--text-primary);
}

p { margin-bottom: 1.25rem; }

/* ============================================
   UTILITY CLASSES
============================================ */
.container {
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 0 20px;
}

.screen-reader-text {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(1px,1px,1px,1px);
  white-space: nowrap;
}

.btn {
  display: inline-block;
  font-family: var(--font-sans);
  font-size: 0.875rem;
  font-weight: 600;
  padding: 10px 22px;
  border-radius: var(--radius-sm);
  border: none;
  cursor: pointer;
  transition: all var(--transition);
  text-decoration: none;
  line-height: 1;
}

.btn-primary { background: var(--accent); color: var(--primary); }
.btn-primary:hover { background: var(--accent-dark); color: var(--primary); transform: translateY(-1px); box-shadow: var(--shadow-md); }
.btn-outline { background: transparent; color: var(--text-primary); border: 1.5px solid var(--border-color); }
.btn-outline:hover { border-color: var(--accent); color: var(--accent); }

/* ============================================
   HEADER
============================================ */
#masthead {
  background: var(--primary);
  position: sticky;
  top: 0;
  z-index: 1000;
  box-shadow: 0 2px 20px rgba(0,0,0,0.2);
}

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

/* Logo */
.site-branding .site-title {
  font-family: var(--font-sans);
  font-size: 1.5rem;
  font-weight: 800;
  margin: 0;
  line-height: 1;
}

.site-branding .site-title a {
  color: #fff;
  letter-spacing: -0.5px;
}

.site-branding .site-title a span { color: var(--accent); }

.site-branding .site-description {
  font-family: var(--font-sans);
  font-size: 0.7rem;
  color: rgba(255,255,255,0.4);
  margin: 0;
  letter-spacing: 1px;
  text-transform: uppercase;
}

/* Navigation */
#primary-navigation { display: flex; align-items: center; gap: 20px; }

.nav-menu {
  display: flex;
  list-style: none;
  padding: 0;
  margin: 0;
  gap: 4px;
}

.nav-menu li { position: relative; }

.nav-menu a {
  font-family: var(--font-sans);
  font-size: 0.8125rem;
  font-weight: 500;
  color: rgba(255,255,255,0.75);
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  transition: all var(--transition);
  display: block;
}

.nav-menu a:hover,
.nav-menu .current-menu-item > a,
.nav-menu .current-menu-ancestor > a {
  color: var(--accent);
  background: rgba(255,255,255,0.08);
}

/* Dropdown */
.nav-menu .sub-menu {
  position: absolute;
  top: 100%;
  left: 0;
  background: var(--primary);
  min-width: 200px;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  padding: 8px 0;
  list-style: none;
  opacity: 0;
  visibility: hidden;
  transform: translateY(8px);
  transition: all var(--transition);
  z-index: 100;
}

.nav-menu li:hover > .sub-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.nav-menu .sub-menu a {
  border-radius: 0;
  padding: 8px 16px;
  font-size: 0.8125rem;
}

/* Header search */
.header-search { position: relative; }

.header-search-toggle {
  background: none;
  border: none;
  color: rgba(255,255,255,0.6);
  cursor: pointer;
  padding: 8px;
  font-size: 1.1rem;
  transition: color var(--transition);
  display: flex;
  align-items: center;
}

.header-search-toggle:hover { color: var(--accent); }

.header-search-form {
  position: absolute;
  right: 0;
  top: calc(100% + 10px);
  background: var(--bg-primary);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  padding: 12px;
  display: none;
  width: 280px;
}

.header-search-form.active { display: block; }

.header-search-form input {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-sm);
  font-family: var(--font-sans);
  font-size: 0.875rem;
  color: var(--text-primary);
  background: var(--bg-primary);
  outline: none;
}

.header-search-form input:focus { border-color: var(--accent); }

/* Mobile menu toggle */
.menu-toggle {
  display: none;
  background: none;
  border: 1.5px solid rgba(255,255,255,0.3);
  color: #fff;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 1.1rem;
}

/* ============================================
   HERO / FEATURED POST (Homepage)
============================================ */
.hero-section {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 60%, #0f3460 100%);
  padding: 60px 0;
  margin-bottom: 48px;
  position: relative;
  overflow: hidden;
}

.hero-section::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at 70% 50%, rgba(245,158,11,0.08) 0%, transparent 60%);
}

.hero-inner {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 48px;
  align-items: center;
}

.hero-content { }

.hero-cat-tag {
  display: inline-block;
  font-family: var(--font-sans);
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: var(--accent);
  margin-bottom: 14px;
}

.hero-title {
  font-size: clamp(1.5rem, 3vw, 2.25rem);
  font-weight: 800;
  color: #fff;
  margin-bottom: 16px;
  line-height: 1.25;
}

.hero-title a { color: #fff; }
.hero-title a:hover { color: var(--accent); }

.hero-excerpt {
  font-family: var(--font-sans);
  font-size: 0.9375rem;
  color: rgba(255,255,255,0.7);
  line-height: 1.7;
  margin-bottom: 24px;
}

.hero-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  font-family: var(--font-sans);
  font-size: 0.8125rem;
  color: rgba(255,255,255,0.5);
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.hero-meta .author-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid rgba(255,255,255,0.2);
}

.hero-meta .author-name { color: rgba(255,255,255,0.8); font-weight: 500; }
.hero-meta .sep { opacity: 0.4; }

.hero-image {
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-lg);
  aspect-ratio: 16/10;
}

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

.hero-image-placeholder {
  width: 100%;
  height: 100%;
  background: rgba(255,255,255,0.05);
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(255,255,255,0.2);
  font-family: var(--font-sans);
  font-size: 0.875rem;
  aspect-ratio: 16/10;
}

/* ============================================
   HOMEPAGE FULL WIDTH (NO SIDEBAR)
============================================ */
.page-template-home .site-main,
body.home .site-main {
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 0 20px;
}

/* Section headings */
.section-heading {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 28px;
}

.section-heading h2 {
  font-family: var(--font-sans);
  font-size: 1.0625rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--text-secondary);
  white-space: nowrap;
}

.section-heading::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border-color);
}

/* Posts Grid - 3 columns on homepage */
.posts-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
  margin-bottom: 48px;
}

/* Posts List - 2 columns on homepage */
.posts-list-2col {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 24px;
  margin-bottom: 48px;
}

/* ============================================
   POST CARD
============================================ */
.post-card {
  background: var(--bg-primary);
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--border-color);
  transition: all var(--transition);
  display: flex;
  flex-direction: column;
}

.post-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
  border-color: var(--border-hover);
}

.post-card-thumbnail {
  aspect-ratio: 16/9;
  overflow: hidden;
  position: relative;
  background: var(--bg-tertiary);
}

.post-card-thumbnail img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s ease;
}

.post-card:hover .post-card-thumbnail img { transform: scale(1.04); }

.post-card-thumbnail .no-thumb {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  color: var(--text-muted);
  background: linear-gradient(135deg, var(--bg-tertiary), var(--border-color));
}

.post-card-body {
  padding: 20px;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.post-category-link {
  font-family: var(--font-sans);
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--accent);
  margin-bottom: 8px;
  display: block;
}

.post-card-title {
  font-size: 1.0625rem;
  font-weight: 700;
  margin-bottom: 10px;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.post-card-title a { color: var(--text-primary); }
.post-card-title a:hover { color: var(--accent-dark); }

.post-card-excerpt {
  font-family: var(--font-sans);
  font-size: 0.875rem;
  color: var(--text-secondary);
  line-height: 1.65;
  margin-bottom: 16px;
  flex: 1;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.post-card-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-sans);
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: auto;
  padding-top: 14px;
  border-top: 1px solid var(--border-color);
  flex-wrap: wrap;
}

.post-card-meta .author-thumb {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  object-fit: cover;
}

.post-card-meta .read-time { margin-left: auto; }

/* Horizontal post card (archive) */
.post-card-horizontal {
  flex-direction: row;
  align-items: stretch;
}

.post-card-horizontal .post-card-thumbnail {
  width: 200px;
  flex-shrink: 0;
  aspect-ratio: auto;
}

.post-card-horizontal .post-card-body { padding: 16px 20px; }

/* ============================================
   NEWSLETTER SECTION
============================================ */
.newsletter-section {
  background: var(--accent-light);
  border: 1px solid rgba(245,158,11,0.3);
  border-radius: var(--radius-lg);
  padding: 36px 40px;
  margin-bottom: 48px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 32px;
  align-items: center;
}

.newsletter-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: #92400e;
  margin-bottom: 6px;
}

.newsletter-desc {
  font-family: var(--font-sans);
  font-size: 0.875rem;
  color: #78350f;
  opacity: 0.8;
}

.newsletter-form { display: flex; gap: 8px; }

.newsletter-form input {
  padding: 11px 16px;
  border: 1.5px solid rgba(245,158,11,0.4);
  border-radius: var(--radius-sm);
  font-family: var(--font-sans);
  font-size: 0.875rem;
  background: #fff;
  color: var(--text-primary);
  width: 260px;
  outline: none;
}

.newsletter-form input:focus { border-color: var(--accent); }

/* ============================================
   LAYOUT: CONTENT + SIDEBAR
============================================ */
.content-sidebar-wrap {
  display: grid;
  grid-template-columns: 1fr var(--sidebar-width);
  gap: 36px;
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 40px 20px;
}

.site-main { min-width: 0; }

/* ============================================
   SINGLE POST
============================================ */
.single-post-header { margin-bottom: 28px; }

.post-breadcrumb {
  font-family: var(--font-sans);
  font-size: 0.8125rem;
  color: var(--text-muted);
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.post-breadcrumb a { color: var(--text-secondary); }
.post-breadcrumb a:hover { color: var(--accent); }
.post-breadcrumb .sep { color: var(--border-color); }

.single-post-category {
  display: inline-block;
  font-family: var(--font-sans);
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: #92400e;
  background: var(--accent-light);
  padding: 4px 12px;
  border-radius: 20px;
  margin-bottom: 14px;
}

.single-post-title {
  font-size: clamp(1.5rem, 4vw, 2rem);
  font-weight: 800;
  line-height: 1.25;
  margin-bottom: 20px;
  color: var(--text-primary);
}

.single-post-meta {
  display: flex;
  align-items: center;
  gap: 14px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 28px;
  font-family: var(--font-sans);
  font-size: 0.875rem;
  color: var(--text-secondary);
  flex-wrap: wrap;
}

.post-author-info {
  display: flex;
  align-items: center;
  gap: 10px;
}

.post-author-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--border-color);
}

.post-author-name { font-weight: 600; color: var(--text-primary); }
.post-author-role { font-size: 0.75rem; color: var(--text-muted); }

.post-meta-actions {
  margin-left: auto;
  display: flex;
  gap: 8px;
}

.post-meta-btn {
  font-family: var(--font-sans);
  font-size: 0.75rem;
  padding: 5px 12px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  background: var(--bg-primary);
  cursor: pointer;
  transition: all var(--transition);
}

.post-meta-btn:hover { border-color: var(--accent); color: var(--accent); }

/* Featured Image */
.single-featured-image {
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: 32px;
  aspect-ratio: 16/8;
}

.single-featured-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Table of Contents */
.toc-box {
  background: var(--bg-secondary);
  border-left: 4px solid var(--accent);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  padding: 18px 20px;
  margin: 28px 0;
}

.toc-title {
  font-family: var(--font-sans);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.toc-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.toc-list li { margin-bottom: 6px; }

.toc-list a {
  font-family: var(--font-sans);
  font-size: 0.875rem;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.toc-list a::before {
  content: '';
  width: 4px;
  height: 4px;
  background: var(--accent);
  border-radius: 50%;
  flex-shrink: 0;
}

.toc-list a:hover { color: var(--accent); }

/* Post Content */
.entry-content {
  font-size: 1.0625rem;
  line-height: 1.8;
  color: var(--text-primary);
}

.entry-content h2 {
  font-size: 1.5rem;
  margin: 36px 0 16px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border-color);
}

.entry-content h3 { font-size: 1.25rem; margin: 28px 0 12px; }
.entry-content h4 { font-size: 1.0625rem; margin: 20px 0 10px; }

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

.entry-content a { color: var(--accent-dark); text-decoration: underline; text-decoration-thickness: 1px; }
.entry-content a:hover { color: var(--primary); }

.entry-content blockquote {
  margin: 28px 0;
  padding: 20px 24px;
  background: var(--bg-secondary);
  border-left: 4px solid var(--accent);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  font-style: italic;
  color: var(--text-secondary);
}

.entry-content blockquote p:last-child { margin-bottom: 0; }

.entry-content code {
  font-family: var(--font-mono);
  font-size: 0.875em;
  background: var(--bg-tertiary);
  color: #e53e3e;
  padding: 2px 6px;
  border-radius: var(--radius-sm);
}

.entry-content pre {
  background: #1e1e2e;
  color: #cdd6f4;
  padding: 20px;
  border-radius: var(--radius-md);
  overflow-x: auto;
  margin: 24px 0;
  font-family: var(--font-mono);
  font-size: 0.875rem;
  line-height: 1.6;
}

.entry-content pre code { background: none; color: inherit; padding: 0; }

.entry-content img { border-radius: var(--radius-md); margin: 20px 0; }

.entry-content ul, .entry-content ol { margin-bottom: 1.4rem; }
.entry-content li { margin-bottom: 6px; }

.entry-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 24px 0;
  font-family: var(--font-sans);
  font-size: 0.9375rem;
}

.entry-content th {
  background: var(--primary);
  color: #fff;
  padding: 10px 14px;
  text-align: left;
  font-size: 0.8125rem;
}

.entry-content td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-color);
}

.entry-content tr:nth-child(even) td { background: var(--bg-secondary); }

/* Share Buttons */
.post-share-section {
  margin: 36px 0;
  padding-top: 24px;
  border-top: 1px solid var(--border-color);
}

.share-title {
  font-family: var(--font-sans);
  font-size: 0.8125rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.share-buttons { display: flex; gap: 8px; flex-wrap: wrap; }

.share-btn {
  font-family: var(--font-sans);
  font-size: 0.8125rem;
  font-weight: 500;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  border: none;
  cursor: pointer;
  transition: all var(--transition);
  display: flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
}

.share-btn-facebook { background: #1877f2; color: #fff; }
.share-btn-twitter { background: #000; color: #fff; }
.share-btn-whatsapp { background: #25d366; color: #fff; }
.share-btn-copy { background: var(--bg-secondary); color: var(--text-primary); border: 1px solid var(--border-color); }
.share-btn:hover { opacity: 0.9; transform: translateY(-1px); }

/* Post Tags */
.post-tags-section {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 28px;
}

.tags-label {
  font-family: var(--font-sans);
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.tag-link {
  font-family: var(--font-sans);
  font-size: 0.75rem;
  padding: 4px 12px;
  border: 1px solid var(--border-color);
  border-radius: 20px;
  color: var(--text-secondary);
  transition: all var(--transition);
}

.tag-link:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-light); }

/* Author Box */
.author-box {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin: 36px 0;
  display: flex;
  gap: 20px;
  align-items: flex-start;
}

.author-box-avatar {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  border: 3px solid var(--border-color);
}

.author-box-name {
  font-size: 1.0625rem;
  font-weight: 700;
  margin-bottom: 4px;
}

.author-box-bio {
  font-family: var(--font-sans);
  font-size: 0.875rem;
  color: var(--text-secondary);
  line-height: 1.65;
  margin-bottom: 10px;
}

.author-box-link {
  font-family: var(--font-sans);
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--accent-dark);
}

/* Related Posts */
.related-posts-section { margin: 36px 0; }

.related-posts-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
}

/* ============================================
   COMMENTS
============================================ */
.comments-area {
  margin-top: 48px;
  padding-top: 36px;
  border-top: 1px solid var(--border-color);
}

.comments-title {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 24px;
}

.comment-list { list-style: none; padding: 0; }

.comment {
  padding: 20px 0;
  border-bottom: 1px solid var(--border-color);
}

.comment-author-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  float: left;
  margin-right: 14px;
}

.comment-meta {
  font-family: var(--font-sans);
  font-size: 0.875rem;
}

.comment-author-name { font-weight: 600; color: var(--text-primary); }
.comment-date { color: var(--text-muted); font-size: 0.75rem; }

.comment-body {
  font-family: var(--font-sans);
  font-size: 0.9375rem;
  color: var(--text-secondary);
  line-height: 1.65;
  clear: both;
  padding-top: 8px;
}

.comment-reply-link {
  font-family: var(--font-sans);
  font-size: 0.8125rem;
  color: var(--accent-dark);
  font-weight: 500;
}

/* Comment Form */
.comment-respond {
  margin-top: 36px;
  background: var(--bg-secondary);
  border-radius: var(--radius-lg);
  padding: 28px;
  border: 1px solid var(--border-color);
}

.comment-reply-title { font-size: 1.125rem; margin-bottom: 20px; }

.comment-form label {
  font-family: var(--font-sans);
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-secondary);
  display: block;
  margin-bottom: 6px;
}

.comment-form input,
.comment-form textarea {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-sm);
  font-family: var(--font-sans);
  font-size: 0.9375rem;
  color: var(--text-primary);
  background: var(--bg-primary);
  transition: border-color var(--transition);
  margin-bottom: 16px;
  outline: none;
}

.comment-form input:focus,
.comment-form textarea:focus { border-color: var(--accent); }

.comment-form textarea { min-height: 140px; resize: vertical; line-height: 1.6; }

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

/* ============================================
   SIDEBAR
============================================ */
.sidebar { min-width: 0; }

.widget {
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 20px;
  margin-bottom: 24px;
}

.widget-title {
  font-family: var(--font-sans);
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: var(--text-muted);
  padding-bottom: 12px;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--border-color);
}

/* Search Widget */
.widget-search form {
  display: flex;
  gap: 6px;
}

.widget-search input {
  flex: 1;
  padding: 9px 12px;
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-sm);
  font-family: var(--font-sans);
  font-size: 0.875rem;
  color: var(--text-primary);
  background: var(--bg-secondary);
  outline: none;
  transition: border-color var(--transition);
}

.widget-search input:focus { border-color: var(--accent); }

.widget-search button {
  background: var(--primary);
  color: #fff;
  border: none;
  padding: 9px 14px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.875rem;
  transition: background var(--transition);
}

.widget-search button:hover { background: var(--accent); color: var(--primary); }

/* Recent Posts Widget */
.recent-posts-list { list-style: none; padding: 0; margin: 0; }

.recent-post-item {
  display: flex;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border-color);
  align-items: flex-start;
}

.recent-post-item:last-child { border-bottom: none; padding-bottom: 0; }

.recent-post-thumb {
  width: 60px;
  height: 50px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  flex-shrink: 0;
  background: var(--bg-tertiary);
}

.recent-post-no-thumb {
  width: 60px;
  height: 50px;
  border-radius: var(--radius-sm);
  background: var(--bg-tertiary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  flex-shrink: 0;
}

.recent-post-title {
  font-family: var(--font-sans);
  font-size: 0.8125rem;
  font-weight: 600;
  line-height: 1.4;
  color: var(--text-primary);
  display: block;
  margin-bottom: 4px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.recent-post-title:hover { color: var(--accent-dark); }
.recent-post-date { font-family: var(--font-sans); font-size: 0.6875rem; color: var(--text-muted); }

/* Categories Widget */
.categories-list { list-style: none; padding: 0; margin: 0; }

.category-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid var(--border-color);
}

.category-item:last-child { border-bottom: none; }

.category-item a {
  font-family: var(--font-sans);
  font-size: 0.875rem;
  color: var(--text-primary);
}

.category-item a:hover { color: var(--accent); }

.cat-count {
  font-family: var(--font-sans);
  font-size: 0.6875rem;
  color: var(--text-muted);
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  padding: 2px 8px;
  border-radius: 20px;
}

/* Tags Widget */
.tags-cloud { display: flex; flex-wrap: wrap; gap: 6px; }

.tag-cloud-link {
  font-family: var(--font-sans);
  font-size: 0.75rem !important;
  padding: 4px 10px;
  border: 1px solid var(--border-color);
  border-radius: 20px;
  color: var(--text-secondary);
  transition: all var(--transition);
}

.tag-cloud-link:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-light);
}

/* Newsletter Widget */
.newsletter-widget {
  background: var(--primary);
  border-color: var(--primary);
}

.newsletter-widget .widget-title { color: var(--accent); border-color: rgba(255,255,255,0.1); }

.newsletter-widget p {
  font-family: var(--font-sans);
  font-size: 0.875rem;
  color: rgba(255,255,255,0.6);
  margin-bottom: 14px;
  line-height: 1.6;
}

.newsletter-widget input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: var(--radius-sm);
  background: rgba(255,255,255,0.08);
  color: #fff;
  font-family: var(--font-sans);
  font-size: 0.875rem;
  margin-bottom: 8px;
  outline: none;
}

.newsletter-widget input::placeholder { color: rgba(255,255,255,0.35); }
.newsletter-widget input:focus { border-color: var(--accent); }

.newsletter-widget button {
  width: 100%;
  background: var(--accent);
  color: var(--primary);
  border: none;
  padding: 10px;
  border-radius: var(--radius-sm);
  font-family: var(--font-sans);
  font-size: 0.875rem;
  font-weight: 700;
  cursor: pointer;
  transition: background var(--transition);
}

.newsletter-widget button:hover { background: var(--accent-dark); }

/* Sticky sidebar */
.sidebar-sticky { position: sticky; top: 80px; }

/* ============================================
   ARCHIVE / BLOG PAGE
============================================ */
.archive-header {
  background: var(--primary);
  padding: 40px 0;
  margin-bottom: 0;
  color: #fff;
}

.archive-header .container { }
.archive-tag { font-family: var(--font-sans); font-size: 0.6875rem; font-weight: 700; letter-spacing: 2px; text-transform: uppercase; color: var(--accent); margin-bottom: 8px; }
.archive-title { font-size: 1.75rem; font-weight: 800; margin-bottom: 6px; }
.archive-description { font-family: var(--font-sans); font-size: 0.9375rem; color: rgba(255,255,255,0.6); }
.archive-count { font-family: var(--font-sans); font-size: 0.8125rem; color: rgba(255,255,255,0.4); margin-top: 6px; }

/* Filter bar */
.filter-bar {
  background: var(--bg-primary);
  border-bottom: 1px solid var(--border-color);
  padding: 12px 0;
  margin-bottom: 0;
  position: sticky;
  top: 64px;
  z-index: 100;
}

.filter-bar-inner {
  display: flex;
  align-items: center;
  gap: 12px;
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 0 20px;
}

.filter-label {
  font-family: var(--font-sans);
  font-size: 0.8125rem;
  color: var(--text-muted);
  white-space: nowrap;
}

.filter-links { display: flex; gap: 6px; flex-wrap: wrap; }

.filter-link {
  font-family: var(--font-sans);
  font-size: 0.8125rem;
  padding: 5px 14px;
  border-radius: 20px;
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  transition: all var(--transition);
}

.filter-link:hover, .filter-link.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

/* Post list items */
.posts-list { display: flex; flex-direction: column; gap: 20px; }

/* Pagination */
.pagination-wrap {
  display: flex;
  justify-content: center;
  gap: 6px;
  margin: 36px 0;
  flex-wrap: wrap;
}

.page-numbers {
  font-family: var(--font-sans);
  font-size: 0.875rem;
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  transition: all var(--transition);
}

.page-numbers:hover { border-color: var(--accent); color: var(--accent); }
.page-numbers.current { background: var(--primary); color: #fff; border-color: var(--primary); }
.page-numbers.dots { border: none; cursor: default; }
.page-numbers.prev, .page-numbers.next { width: auto; padding: 0 14px; }

/* ============================================
   FOOTER
============================================ */
#colophon {
  background: var(--primary);
  color: rgba(255,255,255,0.6);
  margin-top: 60px;
}

.footer-widgets {
  padding: 48px 0 36px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

.footer-widgets-grid {
  display: grid;
  grid-template-columns: 1.8fr 1fr 1fr 1fr;
  gap: 40px;
}

.footer-widget-title {
  font-family: var(--font-sans);
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: rgba(255,255,255,0.4);
  margin-bottom: 16px;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

.footer-logo {
  font-family: var(--font-sans);
  font-size: 1.375rem;
  font-weight: 800;
  color: #fff;
  margin-bottom: 12px;
  display: block;
}

.footer-logo span { color: var(--accent); }

.footer-desc {
  font-family: var(--font-sans);
  font-size: 0.875rem;
  line-height: 1.7;
  color: rgba(255,255,255,0.45);
  margin-bottom: 20px;
}

.footer-social { display: flex; gap: 8px; }

.social-link {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(255,255,255,0.5);
  font-size: 0.875rem;
  transition: all var(--transition);
}

.social-link:hover { background: var(--accent); border-color: var(--accent); color: var(--primary); }

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

.footer-links-list li { margin-bottom: 8px; }

.footer-links-list a {
  font-family: var(--font-sans);
  font-size: 0.875rem;
  color: rgba(255,255,255,0.45);
  display: flex;
  align-items: center;
  gap: 6px;
  transition: color var(--transition);
}

.footer-links-list a::before { content: '›'; color: var(--accent); }
.footer-links-list a:hover { color: var(--accent); }

.footer-recent-item {
  display: flex;
  gap: 10px;
  margin-bottom: 12px;
  align-items: flex-start;
}

.footer-recent-thumb {
  width: 48px;
  height: 42px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  flex-shrink: 0;
  background: rgba(255,255,255,0.05);
}

.footer-recent-title {
  font-family: var(--font-sans);
  font-size: 0.8125rem;
  color: rgba(255,255,255,0.6);
  line-height: 1.4;
  display: block;
  margin-bottom: 3px;
}

.footer-recent-title:hover { color: var(--accent); }
.footer-recent-date { font-size: 0.6875rem; color: rgba(255,255,255,0.3); font-family: var(--font-sans); }

.footer-bottom {
  padding: 18px 0;
}

.footer-bottom-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  font-family: var(--font-sans);
  font-size: 0.8125rem;
  flex-wrap: wrap;
}

.footer-bottom-links { display: flex; gap: 16px; }
.footer-bottom-links a { color: rgba(255,255,255,0.4); }
.footer-bottom-links a:hover { color: var(--accent); }

/* ============================================
   BACK TO TOP
============================================ */
.back-to-top {
  position: fixed;
  bottom: 28px;
  right: 28px;
  width: 42px;
  height: 42px;
  background: var(--primary);
  color: #fff;
  border: 2px solid rgba(255,255,255,0.15);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition);
  z-index: 999;
  box-shadow: var(--shadow-md);
}

.back-to-top.visible { opacity: 1; visibility: visible; }
.back-to-top:hover { background: var(--accent); border-color: var(--accent); color: var(--primary); transform: translateY(-2px); }

/* ============================================
   READING PROGRESS BAR
============================================ */
.reading-progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 3px;
  background: var(--accent);
  z-index: 9999;
  transition: width 0.1s linear;
  width: 0%;
}

/* ============================================
   404 PAGE
============================================ */
.error-404 { text-align: center; padding: 80px 20px; }
.error-404 .error-code { font-size: 6rem; font-weight: 800; color: var(--border-color); line-height: 1; margin-bottom: 16px; }
.error-404 h1 { font-size: 1.5rem; margin-bottom: 12px; }
.error-404 p { font-family: var(--font-sans); color: var(--text-secondary); max-width: 400px; margin: 0 auto 28px; }

/* ============================================
   SEARCH RESULTS
============================================ */
.search-header {
  background: var(--bg-secondary);
  padding: 32px 0;
  margin-bottom: 0;
  border-bottom: 1px solid var(--border-color);
}

.search-title { font-size: 1.25rem; margin-bottom: 4px; }
.search-term { color: var(--accent-dark); }

/* ============================================
   RESPONSIVE
============================================ */
@media (max-width: 1024px) {
  :root { --sidebar-width: 260px; }
  .footer-widgets-grid { grid-template-columns: 1fr 1fr; }
  .hero-inner { grid-template-columns: 1fr; gap: 28px; }
  .hero-image { max-height: 280px; }
  .posts-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
  .content-sidebar-wrap { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .posts-grid { grid-template-columns: 1fr; }
  .posts-list-2col { grid-template-columns: 1fr; }
  .newsletter-section { grid-template-columns: 1fr; }
  .newsletter-form { flex-direction: column; }
  .newsletter-form input { width: 100%; }
  .post-card-horizontal { flex-direction: column; }
  .post-card-horizontal .post-card-thumbnail { width: 100%; aspect-ratio: 16/9; }
  .related-posts-grid { grid-template-columns: 1fr; }
  .form-row { grid-template-columns: 1fr; }
  .footer-widgets-grid { grid-template-columns: 1fr; }
  .footer-bottom-inner { flex-direction: column; text-align: center; }
  .nav-menu { display: none; }
  .nav-menu.open { display: flex; flex-direction: column; position: absolute; top: 64px; left: 0; right: 0; background: var(--primary); padding: 16px; z-index: 999; gap: 0; }
  .menu-toggle { display: flex; align-items: center; }
  .nav-menu .sub-menu { position: static; opacity: 1; visibility: visible; transform: none; box-shadow: none; padding-left: 16px; display: none; }
  .nav-menu li.open .sub-menu { display: block; }
  .author-box { flex-direction: column; }
  .single-post-title { font-size: 1.5rem; }
  .hero-title { font-size: 1.375rem; }
}

@media (max-width: 480px) {
  .share-buttons { flex-direction: column; }
  .share-btn { justify-content: center; }
  .post-meta-actions { display: none; }
  .single-post-meta { gap: 8px; }
  .filter-links { display: none; }
}

/* ============================================
   BOX STYLES
   Shortcode: [box type="info" title="Note"]Text[/box]
   Types: info | warning | tip | success | danger | note
   OR add CSS class to Gutenberg block: box-info etc.
============================================ */

/* Base box */
.box-style,
.entry-content .box-info,
.entry-content .box-warning,
.entry-content .box-tip,
.entry-content .box-success,
.entry-content .box-danger,
.entry-content .box-note {
    border-radius: var(--radius-md);
    margin: 28px 0;
    font-family: var(--font-sans);
    font-size: 0.9375rem;
    line-height: 1.7;
    overflow: hidden;
    border: 1px solid;
}

/* Box header (icon + title row) */
.box-style .box-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    font-size: 0.8125rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    border-bottom: 1px solid rgba(0,0,0,0.06);
}

.box-style .box-icon { font-size: 1rem; line-height: 1; }

/* Box body */
.box-style .box-body,
.entry-content .box-info,
.entry-content .box-warning,
.entry-content .box-tip,
.entry-content .box-success,
.entry-content .box-danger,
.entry-content .box-note {
    padding: 14px 18px;
}

.box-style .box-body p:last-child { margin-bottom: 0; }

/* INFO — Blue */
.box-style.box-info,
.entry-content .box-info {
    background: #eff6ff;
    border-color: #bfdbfe;
    color: #1e3a5f;
}
.box-style.box-info .box-header { background: #dbeafe; color: #1d4ed8; }

/* WARNING — Amber */
.box-style.box-warning,
.entry-content .box-warning {
    background: #fffbeb;
    border-color: #fde68a;
    color: #78350f;
}
.box-style.box-warning .box-header { background: #fef3c7; color: #92400e; }

/* TIP — Teal */
.box-style.box-tip,
.entry-content .box-tip {
    background: #f0fdfa;
    border-color: #99f6e4;
    color: #134e4a;
}
.box-style.box-tip .box-header { background: #ccfbf1; color: #0f766e; }

/* SUCCESS — Green */
.box-style.box-success,
.entry-content .box-success {
    background: #f0fdf4;
    border-color: #bbf7d0;
    color: #14532d;
}
.box-style.box-success .box-header { background: #dcfce7; color: #15803d; }

/* DANGER — Red */
.box-style.box-danger,
.entry-content .box-danger {
    background: #fef2f2;
    border-color: #fecaca;
    color: #7f1d1d;
}
.box-style.box-danger .box-header { background: #fee2e2; color: #b91c1c; }

/* NOTE — Gray */
.box-style.box-note,
.entry-content .box-note {
    background: var(--bg-secondary);
    border-color: var(--border-color);
    color: var(--text-secondary);
}
.box-style.box-note .box-header { background: var(--bg-tertiary); color: var(--text-primary); }

/* Dark mode */
@media (prefers-color-scheme: dark) {
    .box-style.box-info,
    .entry-content .box-info    { background: rgba(30,58,95,0.25); border-color: #1d4ed8; color: #93c5fd; }
    .box-style.box-info .box-header { background: rgba(30,58,95,0.4); color: #60a5fa; }

    .box-style.box-warning,
    .entry-content .box-warning { background: rgba(120,53,15,0.2); border-color: #d97706; color: #fcd34d; }
    .box-style.box-warning .box-header { background: rgba(120,53,15,0.35); color: #fbbf24; }

    .box-style.box-tip,
    .entry-content .box-tip     { background: rgba(19,78,74,0.2); border-color: #0f766e; color: #5eead4; }
    .box-style.box-tip .box-header { background: rgba(19,78,74,0.35); color: #2dd4bf; }

    .box-style.box-success,
    .entry-content .box-success { background: rgba(20,83,45,0.2); border-color: #15803d; color: #86efac; }
    .box-style.box-success .box-header { background: rgba(20,83,45,0.35); color: #4ade80; }

    .box-style.box-danger,
    .entry-content .box-danger  { background: rgba(127,29,29,0.2); border-color: #b91c1c; color: #fca5a5; }
    .box-style.box-danger .box-header { background: rgba(127,29,29,0.35); color: #f87171; }

    .box-style.box-note,
    .entry-content .box-note    { background: var(--bg-tertiary); border-color: var(--border-hover); }
    .box-style.box-note .box-header { background: var(--bg-tertiary); }
}

/* ============================================
   FULL WIDTH PAGE — fix when no sidebar
============================================ */
.page-template-full-width .content-sidebar-wrap,
.page-template-page-templates-full-width .content-sidebar-wrap {
    grid-template-columns: 1fr;
    max-width: 860px;
    margin: 0 auto;
}

/* Print styles */
@media print {
  #masthead, .sidebar, #colophon, .post-share-section, .comments-area, .back-to-top, .reading-progress { display: none; }
  .content-sidebar-wrap { grid-template-columns: 1fr; }
  .entry-content { font-size: 12pt; line-height: 1.6; }
}
