/*
Theme Name: Packet Support Knowledgebase
Theme URI: https://packetafrica.com
Author: Edgar Odey
Author URI: https://packetafrica.com
Description: A premium, highly responsive, clean WordPress theme for the Packet Africa Knowledgebase, built using brand colors, Cormorant Garamond, and Jost typography.
Version: 1.0.0
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: packet-support-kb
*/

/* Imports & Fonts */
@import url('https://fonts.googleapis.com/css2?family=Cormorant+Garamond:ital,wght@0,300;0,400;0,500;0,600;0,700;1,300;1,400;1,500;1,600;1,700&family=Jost:wght@300;400;500;600;700&display=swap');

/* Core Color Tokens & Variables */
:root {
  --indigo: #15173d;
  --dark-purple: #982598;
  --pink: #e491c9;
  --coral: #f1e9e9;
  --white: #ffffff;
  
  --bg-plain: #ffffff;
  --bg-card: #ffffff;
  --text-dark: #15173d;
  --text-body: #374151;
  --text-muted: #6b7280;
  
  --border-color: rgba(0, 0, 0, 0.08);
  --border-radius: 12px;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.02), 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 4px 6px -1px rgba(21, 23, 61, 0.03), 0 2px 4px -1px rgba(21, 23, 61, 0.02);
  --shadow-lg: 0 10px 15px -3px rgba(21, 23, 61, 0.05), 0 4px 6px -2px rgba(21, 23, 61, 0.03);
  
  --font-serif: 'Cormorant Garamond', Georgia, serif;
  --font-sans: 'Jost', sans-serif;
  
  --transition-fast: 0.2s ease;
  --transition-normal: 0.3s ease;
}

/* Reset and Base Styles */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  background-color: var(--bg-plain);
  color: var(--text-body);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  color: inherit;
  text-decoration: none;
  transition: color var(--transition-fast), border-color var(--transition-fast);
}

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

h1, h2, h3, h4, h5, h6 {
  color: var(--text-dark);
  font-family: var(--font-serif);
  font-weight: 500;
  line-height: 1.25;
}

/* Layout Containers */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
  width: 100%;
}

.main-content {
  padding: 60px 0 80px 0;
  min-height: calc(100vh - 280px);
}

/* Header & Navigation Styles */
.site-header {
  background-color: var(--white);
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 1000;
  padding: 16px 0;
}

.header-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

/* Logo box with the dark square containing the letter P */
.brand-logo {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo-box {
  width: 38px;
  height: 38px;
  background-color: var(--indigo);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.logo-icon-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: 6px;
}

.logo-text {
  display: flex;
  flex-direction: column;
}

.logo-title {
  color: var(--text-dark);
  font-family: var(--font-serif);
  font-size: 21px;
  font-weight: 600;
  line-height: 1.1;
  letter-spacing: -0.2px;
}

.logo-tagline {
  color: var(--text-muted);
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 400;
  line-height: 1.2;
}

/* Navigation Links */
.header-nav {
  display: flex;
  align-items: center;
}

.nav-menu {
  display: flex;
  list-style: none;
  gap: 32px;
}

.nav-menu a {
  color: var(--text-body);
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 400;
  padding: 8px 0;
  position: relative;
}

.nav-menu a:hover {
  color: var(--text-dark);
}

.nav-menu li.current-menu-item a,
.nav-menu li.current_page_item a {
  color: var(--text-dark);
  font-weight: 500;
}

.nav-menu li.current-menu-item a::after,
.nav-menu li.current_page_item a::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 2px;
  background-color: var(--indigo);
  border-radius: 2px;
}

/* Search Bar (Rounded input with icon) */
.search-container {
  position: relative;
  max-width: 260px;
  width: 100%;
}

.search-input {
  width: 100%;
  padding: 10px 16px 10px 42px;
  border: 1px solid var(--border-color);
  border-radius: 20px;
  font-family: var(--font-sans);
  font-size: 13px;
  background-color: #fafafa;
  color: var(--text-dark);
  outline: none;
  transition: all var(--transition-fast);
}

.search-input:focus {
  background-color: var(--white);
  border-color: var(--indigo);
  box-shadow: 0 0 0 3px rgba(21, 23, 61, 0.08);
}

.search-icon {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  width: 15px;
  height: 15px;
  color: var(--text-muted);
  pointer-events: none;
  display: flex;
  align-items: center;
  justify-content: center;
}

.search-icon svg {
  width: 100%;
  height: 100%;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Ajax Live Search Dropdown */
.search-form {
  position: relative;
}

.ajax-search-results {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  background-color: var(--white);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  z-index: 1100;
  max-height: 320px;
  overflow-y: auto;
}

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

.search-result-item a {
  display: flex;
  flex-direction: column;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-color);
  transition: background-color var(--transition-fast);
}

.search-result-item:last-child a {
  border-bottom: none;
}

.search-result-item a:hover {
  background-color: var(--coral);
}

.search-result-title {
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 500;
  color: var(--text-dark);
  line-height: 1.4;
}

.search-result-category {
  font-family: var(--font-sans);
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--dark-purple);
  margin-top: 4px;
}

.search-loading,
.search-no-results,
.search-error {
  padding: 16px;
  font-family: var(--font-sans);
  font-size: 13.5px;
  color: var(--text-muted);
  text-align: center;
}

/* Mobile Menu Toggle */
.mobile-menu-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
}

.mobile-menu-toggle svg {
  width: 24px;
  height: 24px;
  stroke: var(--text-dark);
  stroke-width: 2;
}

/* Hero Section */
.hero-section {
  text-align: center;
  padding: 60px 0 40px 0;
}

.hero-badge {
  font-family: var(--font-sans);
  font-size: 11px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--text-muted);
  font-weight: 500;
  display: inline-block;
  margin-bottom: 8px;
}

.hero-title {
  font-size: 42px;
  font-weight: 400;
  letter-spacing: -0.5px;
  color: var(--text-dark);
}

/* Home Category Grid */
.category-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
  margin-top: 40px;
}

.category-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  padding: 32px;
  box-shadow: var(--shadow-sm);
  transition: transform var(--transition-normal), box-shadow var(--transition-normal);
  display: flex;
  flex-direction: column;
  height: 100%;
  text-align: left;
}

.category-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}

/* Folder Icon Containers - Customized Colors */
.folder-container {
  width: 38px;
  height: 38px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.folder-container svg {
  width: 20px;
  height: 20px;
}

/* Dynamic pastel folders */
.folder-theme-blue { background-color: #eff6ff; border: 1px solid #dbeafe; color: #2563eb; }
.folder-theme-red { background-color: #fef2f2; border: 1px solid #fee2e2; color: #dc2626; }
.folder-theme-green { background-color: #f0fdf4; border: 1px solid #dcfce7; color: #16a34a; }
.folder-theme-orange { background-color: #fff7ed; border: 1px solid #ffedd5; color: #ea580c; }
.folder-theme-grey { background-color: #f9fafb; border: 1px solid #f3f4f6; color: #4b5563; }
.folder-theme-yellow { background-color: #fefce8; border: 1px solid #fef9c3; color: #ca8a04; }
.folder-theme-indigo { background-color: #eef2ff; border: 1px solid #e0e7ff; color: #4f46e5; }
.folder-theme-purple { background-color: #faf5ff; border: 1px solid #f3e8ff; color: #9333ea; }
.folder-theme-pink { background-color: #fdf2f8; border: 1px solid #fce7f3; color: #db2777; }

.article-count {
  font-family: var(--font-sans);
  font-size: 10px;
  font-weight: 500;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 1px;
}

.card-title {
  font-size: 26px;
  font-weight: 400;
  margin-bottom: 20px;
  color: var(--text-dark);
}

.card-title a:hover {
  color: var(--dark-purple);
}

/* Card Articles List */
.card-articles {
  list-style: none;
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
  border-top: 1px solid rgba(0,0,0,0.04);
  padding-top: 20px;
}

.article-link-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 13.5px;
  color: #4b5563;
  line-height: 1.4;
}

.article-link-item svg {
  width: 15px;
  height: 15px;
  margin-top: 2px;
  flex-shrink: 0;
  color: var(--text-muted);
}

.article-link-item a {
  transition: color var(--transition-fast);
}

.article-link-item a:hover {
  color: var(--indigo);
}

.no-articles {
  font-size: 13px;
  color: var(--text-muted);
  font-style: italic;
}

/* Category Archive Template */
.archive-header {
  text-align: center;
  margin-bottom: 50px;
}

.breadcrumbs {
  font-family: var(--font-sans);
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.breadcrumbs a:hover {
  color: var(--text-dark);
}

.breadcrumbs span.separator {
  color: rgba(0,0,0,0.15);
}

.category-badge {
  font-family: var(--font-sans);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: #2563eb; /* Blue default category indicator */
  margin-bottom: 8px;
  display: inline-block;
}

.category-title {
  font-size: 48px;
  font-weight: 400;
  color: var(--text-dark);
  margin-bottom: 12px;
}

.category-meta {
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted);
  letter-spacing: 1.5px;
  text-transform: uppercase;
  border-top: 1px solid var(--border-color);
  display: inline-block;
  padding-top: 8px;
}

/* Article Lists */
.articles-list {
  display: flex;
  flex-direction: column;
  gap: 20px;
  max-width: 800px;
  margin: 0 auto;
}

.article-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  padding: 32px;
  transition: transform var(--transition-normal), box-shadow var(--transition-normal);
}

.article-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.article-title {
  font-size: 26px;
  font-weight: 400;
  margin-bottom: 12px;
}

.article-title a:hover {
  color: var(--dark-purple);
}

.article-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px;
  font-family: var(--font-sans);
  font-size: 12.5px;
  color: var(--text-muted);
  margin-bottom: 16px;
}

.meta-item {
  display: flex;
  align-items: center;
  gap: 6px;
}

.meta-item svg {
  width: 14px;
  height: 14px;
}

.article-excerpt {
  color: #4b5563;
  font-size: 14.5px;
  line-height: 1.6;
}

/* Single Post Template */
.single-header {
  text-align: center;
  margin-bottom: 40px;
}

.single-header .breadcrumbs {
  margin-bottom: 16px;
}

.single-title {
  font-size: 40px;
  font-weight: 400;
  margin-bottom: 16px;
  max-width: 900px;
  margin-left: auto;
  margin-right: auto;
}

.single-header .article-meta {
  justify-content: center;
}

.single-layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 48px;
  align-items: start;
}

/* Single Post with No TOC - Centered balanced layout eliminating empty right-side whitespace */
.single-layout.no-toc,
.single-layout:has(.sidebar-toc[style*="display: none"]) {
  display: block;
  max-width: 800px;
  margin-left: auto;
  margin-right: auto;
}

.single-layout.no-toc .sidebar-toc,
.single-layout:has(.sidebar-toc[style*="display: none"]) .sidebar-toc {
  display: none !important;
}

.single-layout.no-toc .article-body,
.single-layout:has(.sidebar-toc[style*="display: none"]) .article-body {
  width: 100%;
}

/* Sidebar Table of Contents */
.sidebar-toc {
  position: sticky;
  top: 100px;
  padding-bottom: 30px;
}

.toc-title {
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 16px;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 8px;
}

.toc-menu {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.toc-menu-item {
  font-family: var(--font-sans);
  font-size: 13px;
  line-height: 1.4;
  color: #6b7280;
  padding-left: 12px;
  border-left: 2px solid transparent;
  transition: all var(--transition-fast);
}

.toc-menu-item.active {
  color: #2563eb;
  border-left-color: #2563eb;
  font-weight: 500;
}

.toc-menu-item a:hover {
  color: var(--indigo);
}

/* Article Body Content styling */
.article-body {
  font-size: 16px;
  line-height: 1.75;
  color: #374151;
}

.article-body a,
.entry-content a {
  color: #2563eb;
  text-decoration: underline;
  text-decoration-color: rgba(37, 99, 235, 0.45);
  text-underline-offset: 3px;
  text-decoration-thickness: 1.5px;
  transition: color var(--transition-fast), text-decoration-color var(--transition-fast);
}

.article-body a:hover,
.entry-content a:hover {
  color: var(--dark-purple);
  text-decoration-color: var(--dark-purple);
}

.article-body h1 a,
.article-body h2 a,
.article-body h3 a,
.article-body h4 a,
.article-body h5 a,
.article-body h6 a {
  color: inherit;
  text-decoration: none;
}

.article-body h2 {
  font-size: 30px;
  margin-top: 40px;
  margin-bottom: 16px;
  font-weight: 400;
  scroll-margin-top: 110px; /* Offset for sticky header */
}

.article-body h3 {
  font-size: 24px;
  margin-top: 32px;
  margin-bottom: 12px;
  font-weight: 400;
  scroll-margin-top: 110px;
}

.article-body p {
  margin-bottom: 24px;
}

.article-body ul, .article-body ol {
  margin-bottom: 24px;
  padding-left: 24px;
}

.article-body li {
  margin-bottom: 8px;
}

.article-body blockquote {
  border-left: 4px solid var(--indigo);
  padding: 16px 24px;
  background-color: var(--coral);
  color: var(--text-dark);
  font-family: var(--font-serif);
  font-size: 18px;
  margin: 32px 0;
  border-radius: 0 8px 8px 0;
}

.article-body pre, .article-body code {
  font-family: monospace;
  background-color: #f3f4f6;
  border-radius: 6px;
}

.article-body code {
  padding: 2px 6px;
  font-size: 14px;
}

.article-body pre {
  padding: 16px 20px;
  overflow-x: auto;
  margin-bottom: 24px;
}

.article-body pre code {
  padding: 0;
  background-color: transparent;
  font-size: 13.5px;
}

/* Footer Section */
.site-footer {
  background-color: var(--white);
  border-top: 1px solid var(--border-color);
  padding: 60px 0 40px 0;
  font-size: 14px;
  color: var(--text-muted);
}

.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 48px;
  margin-bottom: 48px;
}

.footer-info {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.footer-logo-section {
  display: flex;
  align-items: center;
  gap: 10px;
}

.footer-logo-title {
  color: var(--text-dark);
  font-family: var(--font-serif);
  font-size: 18px;
  font-weight: 600;
}

.footer-logo-box {
  width: 28px;
  height: 28px;
  background-color: var(--indigo);
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.footer-logo-icon-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: 4px;
}

.footer-desc {
  font-size: 13px;
  line-height: 1.5;
  max-width: 320px;
}

.footer-nav-col h4 {
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--text-dark);
  margin-bottom: 20px;
}

.footer-links {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.footer-links a {
  color: var(--text-muted);
}

.footer-links a:hover {
  color: var(--text-dark);
}

.footer-bottom {
  border-top: 1px solid var(--border-color);
  padding-top: 30px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.copyright {
  font-size: 12px;
}

.social-links {
  display: flex;
  gap: 20px;
}

.social-links a {
  color: var(--text-muted);
}

.social-links a:hover {
  color: var(--text-dark);
}

/* Pagination */
.pagination {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-top: 40px;
}

.pagination .page-numbers {
  padding: 8px 16px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  font-size: 14px;
  font-family: var(--font-sans);
}

.pagination .page-numbers.current {
  background-color: var(--indigo);
  color: var(--white);
  border-color: var(--indigo);
}

.pagination a.page-numbers:hover {
  background-color: var(--coral);
  color: var(--text-dark);
}

/* Responsive Breakpoints */
@media (max-width: 1024px) {
  .category-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  .container {
    padding: 0 20px;
  }

  .main-content {
    padding: 32px 0 60px 0;
  }

  .breadcrumbs {
    margin-top: 12px;
    margin-bottom: 20px;
    flex-wrap: wrap;
    row-gap: 6px;
    padding: 0 4px;
  }

  .single-header {
    margin-top: 8px;
    margin-bottom: 32px;
    padding: 0 4px;
  }

  .single-title {
    font-size: 32px;
    line-height: 1.2;
  }

  .archive-header {
    margin-top: 8px;
    margin-bottom: 36px;
    padding: 0 4px;
  }

  .header-container {
    position: static;
    flex-wrap: wrap;
    gap: 12px;
  }
  
  .brand-logo {
    flex: 1;
    min-width: 0;
  }

  .logo-title {
    font-size: 17px;
  }
  
  .mobile-menu-toggle {
    display: block;
    order: 2;
  }
  
  .header-nav {
    display: none; /* Controlled by JS toggle */
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background-color: var(--white);
    border-bottom: 1px solid var(--border-color);
    padding: 24px;
    box-shadow: var(--shadow-md);
  }
  
  .header-nav.active {
    display: block;
  }
  
  .nav-menu {
    flex-direction: column;
    gap: 16px;
  }
  
  .search-container {
    max-width: 100%;
    width: 100%;
    order: 3;
    margin-top: 4px;
  }
  
  .category-grid {
    grid-template-columns: 1fr;
  }
  
  .single-layout,
  .single-layout.no-toc,
  .single-layout:has(.sidebar-toc[style*="display: none"]) {
    grid-template-columns: 1fr;
    max-width: 100%;
    margin-left: 0;
    margin-right: 0;
    padding: 0 4px;
    gap: 32px;
  }

  .article-body,
  .entry-content {
    width: 100%;
    box-sizing: border-box;
  }

  .article-body blockquote {
    padding: 14px 18px;
    margin: 24px 0;
    font-size: 16px;
  }
  
  .sidebar-toc {
    position: static;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border-color);
  }
  
  .footer-grid {
    grid-template-columns: 1fr;
    gap: 32px;
  }
  
  .footer-bottom {
    flex-direction: column;
    gap: 16px;
    text-align: center;
  }
  
  .hero-title {
    font-size: 32px;
  }
  
  .category-title {
    font-size: 36px;
  }
}

@media (max-width: 480px) {
  .container {
    padding: 0 20px;
  }

  .single-title {
    font-size: 28px;
  }

  .article-body {
    font-size: 15.5px;
    line-height: 1.7;
  }

  .article-body ul, .article-body ol {
    padding-left: 20px;
  }
}
