/*
Theme Name: Sam-Theme5
Description: A custom theme for CSE tutorial 
Author: Sam
Version: 17.0
*/

/* ═══════════════════════════════════════════════════════════
   IMPORTS — Google Fonts
═══════════════════════════════════════════════════════════ */
@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&family=JetBrains+Mono:wght@400;500;600&family=Lora:ital,wght@0,400;0,600;1,400&display=swap');

/* ═══════════════════════════════════════════════════════════
   CSS CUSTOM PROPERTIES
═══════════════════════════════════════════════════════════ */
:root {
  /* Brand */
  --brand-green:       #16a34a;
  --brand-green-dark:  #15803d;
  --brand-green-glow:  rgba(22,163,74,0.18);
  --brand-green-light: #dcfce7;

  /* Surfaces */
  --bg-page:           #f8fafc;
  --bg-surface:        #ffffff;
  --bg-surface-2:      #f1f5f9;
  --bg-surface-3:      #e2e8f0;

  /* Text */
  --text-primary:      #0f172a;
  --text-secondary:    #334155;
  --text-muted:        #64748b;

  /* Borders */
  --border-light:      #e2e8f0;
  --border-medium:     #cbd5e1;

  /* Shadows */
  --shadow-xs:  0 1px 2px rgba(0,0,0,.05);
  --shadow-sm:  0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.06);
  --shadow-md:  0 4px 6px rgba(0,0,0,.07), 0 2px 4px rgba(0,0,0,.06);
  --shadow-lg:  0 10px 15px rgba(0,0,0,.08), 0 4px 6px rgba(0,0,0,.06);
  --shadow-xl:  0 20px 25px rgba(0,0,0,.1), 0 10px 10px rgba(0,0,0,.06);

  /* Typography */
  --font-display: 'Plus Jakarta Sans', system-ui, sans-serif;
  --font-body:    'Lora', Georgia, serif;
  --font-ui:      'Plus Jakarta Sans', system-ui, sans-serif;
  --font-mono:    'JetBrains Mono', 'Courier New', monospace;

  /* Radius */
  --radius-sm:  5px;
  --radius-md:  10px;
  --radius-lg:  16px;
  --radius-xl:  24px;

  /* Transitions */
  --ease:       cubic-bezier(.16,1,.3,1);
  --transition: 0.22s var(--ease);

  /* Layout */
  --header-h:   68px;
  --sidebar-w:  290px;
  --content-max: 1360px;
}

/* ═══════════════════════════════════════════════════════════
   RESET / BASE
═══════════════════════════════════════════════════════════ */
*, *::before, *::after { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-ui);
  line-height: 1.65;
  color: var(--text-primary);
  background: var(--bg-page);
  margin: 0; padding: 0;
  -webkit-font-smoothing: antialiased;
}

/* ═══════════════════════════════════════════════════════════
   HEADER
═══════════════════════════════════════════════════════════ */
.site-header {
  background: linear-gradient(135deg, #15803d 0%, #16a34a 50%, #22c55e 100%);
  color: white;
  height: var(--header-h);
  position: sticky;
  top: 0;
  z-index: 1000;
  box-shadow: 0 2px 20px rgba(21,128,61,.35);
  border-bottom: 1px solid rgba(255,255,255,.12);
}

.header-container {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
  gap: 20px;
}

/* Branding */
.site-branding {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.site-logo img {
  max-height: 44px;
  width: auto;
  display: block;
  filter: drop-shadow(0 1px 3px rgba(0,0,0,.2));
}

.site-title {
  margin: 0;
  font-size: 1.45rem;
  font-weight: 800;
  font-family: var(--font-display);
  letter-spacing: -0.02em;
}

.site-title a {
  color: white;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 8px;
}

.site-title a::before {
  content: '</>';
  font-family: var(--font-mono);
  font-size: 0.8em;
  opacity: 0.75;
  background: rgba(255,255,255,.15);
  padding: 2px 7px;
  border-radius: 5px;
  font-weight: 600;
}

/* Navigation */
.main-navigation {
  display: flex;
  align-items: center;
  position: relative;
}

#primary-menu {
  display: flex;
  align-items: center;
  list-style: none;
  margin: 0; padding: 0;
  gap: 2px;
}

#primary-menu > li > a {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 8px 16px;
  border-radius: 8px;
  color: rgba(255,255,255,.92);
  font-weight: 600;
  font-size: 0.92rem;
  text-decoration: none;
  white-space: nowrap;
  transition: background var(--transition), color var(--transition);
}

#primary-menu > li > a:hover,
#primary-menu > li.current-menu-item > a {
  background: rgba(255,255,255,.2);
  color: white;
}

/* Menu toggle (mobile) */
.menu-toggle {
  display: none;
  background: rgba(255,255,255,.15);
  border: 1px solid rgba(255,255,255,.25);
  color: white;
  font-size: 1.1rem;
  cursor: pointer;
  padding: 8px 12px;
  border-radius: 8px;
  transition: background var(--transition);
}

.menu-toggle:hover { background: rgba(255,255,255,.25); }

.hamburger-icon {
  display: block;
  width: 22px;
  height: 2.5px;
  background: white;
  position: relative;
  border-radius: 2px;
}
.hamburger-icon::before,
.hamburger-icon::after {
  content: '';
  position: absolute;
  width: 22px; height: 2.5px;
  background: white;
  left: 0;
  border-radius: 2px;
  transition: transform .22s ease;
}
.hamburger-icon::before { top: -7px; }
.hamburger-icon::after  { top: 7px; }

.menu-toggle[aria-expanded="true"] .hamburger-icon { background: transparent; }
.menu-toggle[aria-expanded="true"] .hamburger-icon::before { transform: rotate(45deg); top: 0; }
.menu-toggle[aria-expanded="true"] .hamburger-icon::after  { transform: rotate(-45deg); top: 0; }

/* Nav arrow */
.nav-arrow {
  font-size: 0.68em;
  opacity: 0.75;
  transition: transform .2s ease;
}

/* ═══════════════════════════════════════════════════════════
   COURSES DROPDOWN
═══════════════════════════════════════════════════════════ */
.has-courses-dropdown { position: relative; }

.courses-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 10px);
  left: 0;
  min-width: 230px;
  background: white;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  list-style: none;
  padding: 8px;
  margin: 0;
  z-index: 2000;
  animation: dropdownFade .18s var(--ease);
}

@keyframes dropdownFade {
  from { opacity:0; transform: translateY(-8px) scale(.97); }
  to   { opacity:1; transform: translateY(0) scale(1); }
}

.has-courses-dropdown.dropdown-open .courses-dropdown { display: block; }
.has-courses-dropdown.dropdown-open .nav-arrow        { transform: rotate(180deg); }

.courses-dropdown li a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  color: var(--text-secondary);
  font-size: 0.9rem;
  font-weight: 500;
  text-decoration: none;
  border-radius: var(--radius-md);
  transition: background var(--transition), color var(--transition);
}

.courses-dropdown li a::before {
  content: '▸';
  font-size: .75em;
  color: var(--brand-green);
  opacity: 0;
  transition: opacity .15s ease;
}

.courses-dropdown li a:hover {
  background: var(--brand-green-light);
  color: var(--brand-green-dark);
}

.courses-dropdown li a:hover::before { opacity: 1; }

.courses-dropdown li.current-cat a {
  background: var(--brand-green-light);
  color: var(--brand-green-dark);
  font-weight: 600;
}

/* ═══════════════════════════════════════════════════════════
   PAGE LAYOUT
═══════════════════════════════════════════════════════════ */
.site-content {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 28px 24px;
}

/* ═══════════════════════════════════════════════════════════
   HOMEPAGE
═══════════════════════════════════════════════════════════ */
.home-container {
  max-width: var(--content-max);
  margin: 0 auto;
}

/* Hero Search */
.search-container {
  background: linear-gradient(135deg, #0f172a 0%, #1e3a5f 50%, #15803d 100%);
  border-radius: var(--radius-xl);
  padding: 60px 40px;
  text-align: center;
  margin-bottom: 40px;
  position: relative;
  overflow: hidden;
}

.search-container::before {
  content: '';
  position: absolute;
  inset: 0;
  background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.03'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}

.search-container h2 {
  color: white;
  font-family: var(--font-display);
  font-size: clamp(1.5rem, 3vw, 2.2rem);
  font-weight: 800;
  margin: 0 0 8px;
  letter-spacing: -0.03em;
  position: relative;
}

.search-container p {
  color: rgba(255,255,255,.65);
  margin: 0 0 28px;
  font-size: 1rem;
  position: relative;
}

.search-form-row {
  display: flex;
  gap: 0;
  max-width: 560px;
  margin: 0 auto;
  position: relative;
}

.search-field {
  flex: 1;
  padding: 14px 20px;
  border: 2px solid transparent;
  border-right: none;
  border-radius: var(--radius-lg) 0 0 var(--radius-lg);
  font-size: 1rem;
  font-family: var(--font-ui);
  background: rgba(255,255,255,.95);
  color: var(--text-primary);
  outline: none;
  transition: border-color .2s;
}

.search-field:focus {
  border-color: #22c55e;
  background: white;
}

.search-field::placeholder { color: var(--text-muted); }

.search-submit {
  padding: 14px 24px;
  background: linear-gradient(135deg, #16a34a, #22c55e);
  color: white;
  border: none;
  border-radius: 0 var(--radius-lg) var(--radius-lg) 0;
  font-size: 0.95rem;
  font-weight: 700;
  font-family: var(--font-ui);
  cursor: pointer;
  white-space: nowrap;
  transition: opacity .2s;
}

.search-submit:hover { opacity: .9; }

/* Section headings */
.section-heading {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.02em;
  margin: 0 0 24px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.section-heading::after {
  content: '';
  flex: 1;
  height: 2px;
  background: linear-gradient(90deg, var(--border-light), transparent);
  border-radius: 1px;
}

/* Category boxes */
.course-categories { margin-bottom: 48px; }

.category-boxes {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
  margin-top: 0;
}

.category-box {
  background: white;
  border: 1.5px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 24px 20px;
  transition: all var(--transition);
  position: relative;
  overflow: hidden;
}

.category-box::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--brand-green), #22c55e);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform var(--transition);
}

.category-box:hover {
  border-color: var(--brand-green);
  box-shadow: var(--shadow-lg), 0 0 0 4px var(--brand-green-glow);
  transform: translateY(-3px);
}

.category-box:hover::before { transform: scaleX(1); }

.category-box a {
  text-decoration: none;
  color: var(--text-primary);
  display: block;
}

.category-box h3 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1rem;
  margin: 0 0 6px;
  color: var(--text-primary);
  transition: color var(--transition);
}

.category-box:hover h3 { color: var(--brand-green-dark); }

.category-box p {
  margin: 0;
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.5;
}

/* Recent courses grid */
.recent-courses { margin-bottom: 48px; }

.course-topics {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
}

.course-topic {
  background: white;
  border: 1.5px solid var(--border-light);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: all var(--transition);
}

.course-topic:hover {
  box-shadow: var(--shadow-lg);
  border-color: var(--border-medium);
  transform: translateY(-4px);
}

.course-topic a {
  text-decoration: none;
  color: var(--text-primary);
  display: block;
}

.course-topic .topic-image {
  height: 160px;
  overflow: hidden;
  background: linear-gradient(135deg, var(--bg-surface-2), var(--bg-surface-3));
}

.course-topic .topic-image img {
  width: 100%; height: 100%;
  object-fit: cover;
  transition: transform .4s var(--ease);
}

.course-topic:hover .topic-image img { transform: scale(1.06); }

.course-topic h3 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1rem;
  padding: 16px 16px 6px;
  margin: 0;
}

.course-topic p,
.course-topic .wp-post-image + * {
  padding: 0 16px 16px;
  color: var(--text-muted);
  font-size: 0.875rem;
}

/* ═══════════════════════════════════════════════════════════
   COURSE ARCHIVE / TAXONOMY
═══════════════════════════════════════════════════════════ */
.course-archive,
.course-category-full {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 28px 24px;
}

.course-intro {
  background: white;
  border: 1.5px solid var(--border-light);
  border-left: 4px solid var(--brand-green);
  border-radius: var(--radius-md);
  padding: 20px 24px;
  margin-bottom: 32px;
  color: var(--text-secondary);
  font-size: 0.97rem;
  line-height: 1.7;
}

.course-topics-grid h2 {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.4rem;
  color: var(--text-primary);
  margin-bottom: 24px;
  padding-bottom: 12px;
  border-bottom: 2px solid var(--border-light);
  letter-spacing: -0.02em;
}

/* Topic card grid */
.topics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 24px;
}

.topic-card {
  background: white;
  border: 1.5px solid var(--border-light);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: all var(--transition);
  display: flex;
  flex-direction: column;
  height: 100%;
  box-shadow: var(--shadow-xs);
}

.topic-card:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow-xl);
  border-color: var(--brand-green);
}

.topic-card a {
  text-decoration: none;
  color: inherit;
  display: flex;
  flex-direction: column;
  height: 100%;
}

.topic-image {
  height: 185px;
  overflow: hidden;
  background: linear-gradient(135deg, #f0fdf4, #dcfce7);
  position: relative;
}

.topic-image img {
  width: 100%; height: 100%;
  object-fit: cover;
  transition: transform .45s var(--ease);
}

.topic-card:hover .topic-image img { transform: scale(1.06); }

.topic-content {
  display: flex;
  flex-direction: column;
  flex-grow: 1;
  position: relative;
}

.topic-card h3 {
  padding: 18px 20px 8px;
  margin: 0;
  font-family: var(--font-display);
  color: var(--text-primary);
  font-size: 1rem;
  font-weight: 700;
  transition: color var(--transition);
  letter-spacing: -0.01em;
}

.topic-card:hover h3 { color: var(--brand-green-dark); }

.topic-excerpt {
  padding: 0 20px 64px;
  color: var(--text-muted);
  font-size: 0.875rem;
  flex-grow: 1;
  line-height: 1.6;
}

.topic-excerpt p { margin: 0; }

.read-more-btn {
  display: block;
  background: var(--bg-surface-2);
  color: var(--brand-green-dark);
  font-weight: 700;
  font-family: var(--font-ui);
  font-size: 0.82rem;
  letter-spacing: 0.04em;
  text-align: center;
  padding: 12px;
  transition: all var(--transition);
  position: absolute;
  bottom: 0; left: 0; right: 0;
  border-top: 1.5px solid var(--border-light);
}

.topic-card:hover .read-more-btn {
  background: var(--brand-green);
  color: white;
  border-top-color: transparent;
}

/* ═══════════════════════════════════════════════════════════
   COURSE CONTENT PAGE
═══════════════════════════════════════════════════════════ */
.course-container {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 28px 24px;
}

.course-content {
  max-width: 860px;
  margin: 0 auto;
}

/* ═══════════════════════════════════════════════════════════
   MAIN CONTENT (blog / single)
═══════════════════════════════════════════════════════════ */
.main-content {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 28px 24px;
}

.post {
  background: white;
  border: 1.5px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 28px 32px;
  margin-bottom: 24px;
  transition: box-shadow var(--transition);
}

.post:hover { box-shadow: var(--shadow-md); }

.post h2 {
  font-family: var(--font-display);
  font-size: 1.3rem;
  font-weight: 700;
  margin: 0 0 12px;
  letter-spacing: -0.02em;
}

.post h2 a {
  color: var(--text-primary);
  text-decoration: none;
  transition: color var(--transition);
}

.post h2 a:hover { color: var(--brand-green); }

.post .excerpt { color: var(--text-secondary); font-size: 0.97rem; }

.read-more {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--brand-green-dark);
  font-weight: 600;
  font-size: 0.9rem;
  text-decoration: none;
  margin-top: 14px;
  transition: gap var(--transition);
}

.read-more:hover { gap: 10px; }

/* ═══════════════════════════════════════════════════════════
   SIDEBAR TOGGLE BUTTON
═══════════════════════════════════════════════════════════ */
.sidebar-toggle {
  background: var(--brand-green);
  color: white;
  border: none;
  padding: 10px 18px;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 700;
  font-family: var(--font-ui);
  margin-bottom: 24px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  transition: all var(--transition);
}

.sidebar-toggle:hover {
  background: var(--brand-green-dark);
  box-shadow: var(--shadow-md);
}

/* ═══════════════════════════════════════════════════════════
   SLIDING SIDEBAR
═══════════════════════════════════════════════════════════ */
.sliding-sidebar {
  position: fixed;
  top: 0;
  left: -310px;
  width: var(--sidebar-w);
  height: 100%;
  background: white;
  overflow-y: auto;
  transition: left .3s var(--ease);
  z-index: 1000;
  box-shadow: var(--shadow-xl);
  border-right: 1.5px solid var(--border-light);
}

.sliding-sidebar.open { left: 0; }

.sidebar-close {
  display: block;
  width: 100%;
  text-align: right;
  padding: 14px 18px;
  background: var(--bg-surface-2);
  border: none;
  border-bottom: 1.5px solid var(--border-light);
  font-size: 1rem;
  cursor: pointer;
  font-weight: 700;
  color: var(--text-muted);
  transition: background var(--transition), color var(--transition);
  font-family: var(--font-ui);
}

.sidebar-close:hover {
  background: var(--bg-surface-3);
  color: var(--text-primary);
}

body.sidebar-open::before {
  content: '';
  position: fixed;
  inset: 0;
  background: rgba(15,23,42,.5);
  z-index: 999;
  backdrop-filter: blur(2px);
}

/* ═══════════════════════════════════════════════════════════
   SIDEBAR NAV (accordion)
═══════════════════════════════════════════════════════════ */
.sidebar-nav { padding: 8px 0 48px; }

.sidebar-subject {
  border-bottom: 1.5px solid var(--border-light);
}

.sidebar-subject-header {
  display: flex;
  align-items: center;
}

.sidebar-subject-link {
  flex: 1;
  display: block;
  padding: 13px 16px;
  color: var(--text-primary);
  font-weight: 700;
  font-size: 0.9rem;
  text-decoration: none;
  font-family: var(--font-display);
  transition: color var(--transition);
}

.sidebar-subject-link:hover,
.sidebar-subject.open > .sidebar-subject-header > .sidebar-subject-link {
  color: var(--brand-green);
}

.sidebar-toggle-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 13px 14px;
  color: var(--text-muted);
  font-size: 0.82rem;
  transition: color var(--transition);
  line-height: 1;
}

.sidebar-toggle-btn:hover { color: var(--brand-green); }

.toggle-arrow {
  display: inline-block;
  transition: transform .22s ease;
}

.sidebar-subject.open .toggle-arrow { transform: rotate(90deg); }

.sidebar-topic-list {
  list-style: none;
  padding: 4px 0 8px;
  margin: 0;
  background: var(--bg-surface-2);
  border-top: 1px solid var(--border-light);
}

.sidebar-topic-item a {
  display: block;
  padding: 8px 16px 8px 28px;
  color: var(--text-secondary);
  font-size: 0.855rem;
  text-decoration: none;
  border-left: 3px solid transparent;
  transition: all .15s ease;
  font-family: var(--font-ui);
  line-height: 1.4;
}

.sidebar-topic-item a:hover {
  color: var(--brand-green-dark);
  background: var(--brand-green-light);
  border-left-color: var(--brand-green);
}

.sidebar-topic-item.current-topic a {
  color: var(--brand-green-dark);
  font-weight: 700;
  background: var(--brand-green-light);
  border-left-color: var(--brand-green);
}

/* Module toggle */
.sidebar-module { border-bottom: 1px solid var(--border-light); }

.module-toggle-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: none;
  border: none;
  cursor: pointer;
  padding: 11px 16px;
  color: var(--text-secondary);
  font-size: 0.875rem;
  font-weight: 600;
  font-family: var(--font-display);
  text-align: left;
  transition: color var(--transition), background var(--transition);
}

.module-toggle-btn:hover {
  color: var(--brand-green-dark);
  background: var(--bg-surface-2);
}

.module-toggle-btn .toggle-arrow {
  font-size: .8em;
  color: var(--text-muted);
}

.module-topic-list {
  list-style: none;
  padding: 4px 0 8px;
  margin: 0;
  background: var(--bg-surface-2);
  border-top: 1px solid var(--border-light);
}

/* ═══════════════════════════════════════════════════════════
   TOPIC NAVIGATION (prev/next)
═══════════════════════════════════════════════════════════ */
.topic-navigation {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-top: 48px;
  padding-top: 24px;
  border-top: 2px solid var(--border-light);
}

.prev-topic, .next-topic {
  flex: 1;
  background: white;
  border: 1.5px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 14px 18px;
  transition: all var(--transition);
}

.prev-topic:hover, .next-topic:hover {
  border-color: var(--brand-green);
  box-shadow: var(--shadow-sm), 0 0 0 3px var(--brand-green-glow);
}

.next-topic { text-align: right; }

.prev-topic a, .next-topic a {
  text-decoration: none;
  color: var(--brand-green-dark);
  font-weight: 600;
  font-size: 0.9rem;
}

/* ═══════════════════════════════════════════════════════════
   PAGINATION
═══════════════════════════════════════════════════════════ */
.pagination { margin-top: 32px; text-align: center; }

.page-numbers {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px; height: 38px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border-light);
  color: var(--text-secondary);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.9rem;
  margin: 0 3px;
  transition: all var(--transition);
}

.page-numbers:hover { border-color: var(--brand-green); color: var(--brand-green); }
.page-numbers.current { background: var(--brand-green); border-color: var(--brand-green); color: white; }

/* ═══════════════════════════════════════════════════════════
   404 PAGE
═══════════════════════════════════════════════════════════ */
.error-404 {
  max-width: 600px;
  margin: 80px auto;
  text-align: center;
  padding: 0 24px;
}

.error-404 h1 {
  font-family: var(--font-display);
  font-size: clamp(2rem, 5vw, 3rem);
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.04em;
  margin-bottom: 16px;
}

.error-404 p { color: var(--text-muted); font-size: 1.05rem; }

/* ═══════════════════════════════════════════════════════════
   FOOTER
═══════════════════════════════════════════════════════════ */
.site-footer {
  background: #0f172a;
  color: #94a3b8;
  padding: 32px 0;
  margin-top: 64px;
  border-top: 3px solid var(--brand-green);
}

.footer-content {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
}

.footer-content p { margin: 0; font-size: 0.9rem; }

.footer-content a {
  color: #22c55e;
  text-decoration: none;
  transition: color var(--transition);
}

.footer-content a:hover { color: #4ade80; }

.footer-content nav ul {
  list-style: none;
  margin: 0; padding: 0;
  display: flex; gap: 20px;
}

.footer-content nav ul li a {
  color: #94a3b8;
  font-size: 0.9rem;
  font-weight: 500;
}

.footer-content nav ul li a:hover { color: white; }

/* ═══════════════════════════════════════════════════════════
   POST META
═══════════════════════════════════════════════════════════ */
.post-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-bottom: 20px;
  padding-bottom: 20px;
  border-bottom: 1.5px solid var(--border-light);
}

.post-meta span { display: flex; align-items: center; gap: 5px; }

.post-featured-image, .course-featured-image {
  margin: 0 0 28px;
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-md);
}

.post-featured-image img, .course-featured-image img {
  width: 100%; height: auto; display: block;
}

/* ═══════════════════════════════════════════════════════════
   DARK MODE — SHELL
═══════════════════════════════════════════════════════════ */
[data-theme="dark"] {
  --bg-page:      #0b0f1a;
  --bg-surface:   #111827;
  --bg-surface-2: #1a2234;
  --bg-surface-3: #243048;
  --text-primary:   #f1f5f9;
  --text-secondary: #cbd5e1;
  --text-muted:     #64748b;
  --border-light:   #1e2d45;
  --border-medium:  #2a3f5f;
  --shadow-xs:  0 1px 2px rgba(0,0,0,.4);
  --shadow-sm:  0 1px 3px rgba(0,0,0,.5), 0 1px 2px rgba(0,0,0,.4);
  --shadow-md:  0 4px 6px rgba(0,0,0,.5), 0 2px 4px rgba(0,0,0,.4);
  --shadow-lg:  0 10px 15px rgba(0,0,0,.55), 0 4px 6px rgba(0,0,0,.4);
  --shadow-xl:  0 20px 25px rgba(0,0,0,.6), 0 10px 10px rgba(0,0,0,.4);
}

[data-theme="dark"] body { background: var(--bg-page); color: var(--text-primary); }

[data-theme="dark"] .site-header {
  background: linear-gradient(135deg, #0d2218 0%, #0f2e1a 50%, #1a3d26 100%);
  box-shadow: 0 2px 20px rgba(0,0,0,.6);
}

[data-theme="dark"] .courses-dropdown {
  background: var(--bg-surface);
  border-color: var(--border-light);
  box-shadow: 0 20px 40px rgba(0,0,0,.6);
}

[data-theme="dark"] .courses-dropdown li a { color: var(--text-secondary); }
[data-theme="dark"] .courses-dropdown li a:hover { background: #1a3d26; color: #4ade80; }
[data-theme="dark"] .courses-dropdown li.current-cat a { background: #1a3d26; color: #4ade80; }

[data-theme="dark"] .search-container {
  background: linear-gradient(135deg, #060c16 0%, #0a1929 50%, #0d2a1a 100%);
}

[data-theme="dark"] .search-field { background: rgba(255,255,255,.08); color: var(--text-primary); }
[data-theme="dark"] .search-field::placeholder { color: var(--text-muted); }

[data-theme="dark"] .category-box { background: var(--bg-surface); border-color: var(--border-light); }
[data-theme="dark"] .category-box a { color: var(--text-primary); }
[data-theme="dark"] .category-box:hover { border-color: var(--brand-green); }

[data-theme="dark"] .course-intro { background: var(--bg-surface); color: var(--text-secondary); border-color: var(--border-light); }

[data-theme="dark"] .topic-card { background: var(--bg-surface); border-color: var(--border-light); }
[data-theme="dark"] .topic-card h3 { color: var(--text-primary); }
[data-theme="dark"] .topic-card:hover h3 { color: #4ade80; }
[data-theme="dark"] .topic-card:hover { border-color: #16a34a; }
[data-theme="dark"] .read-more-btn { background: var(--bg-surface-2); color: #4ade80; border-top-color: var(--border-light); }
[data-theme="dark"] .topic-card:hover .read-more-btn { background: var(--brand-green); color: white; }
[data-theme="dark"] .topic-excerpt { color: var(--text-muted); }

[data-theme="dark"] .post { background: var(--bg-surface); border-color: var(--border-light); }
[data-theme="dark"] .post h2 a { color: var(--text-primary); }
[data-theme="dark"] .post h2 a:hover { color: #4ade80; }

[data-theme="dark"] .sliding-sidebar { background: var(--bg-surface); border-right-color: var(--border-light); }
[data-theme="dark"] .sidebar-close { background: var(--bg-surface-2); color: var(--text-muted); border-bottom-color: var(--border-light); }
[data-theme="dark"] .sidebar-close:hover { background: var(--bg-surface-3); color: var(--text-primary); }
[data-theme="dark"] .sidebar-subject { border-bottom-color: var(--border-light); }
[data-theme="dark"] .sidebar-subject-link { color: var(--text-primary); }
[data-theme="dark"] .sidebar-subject-link:hover,
[data-theme="dark"] .sidebar-subject.open > .sidebar-subject-header > .sidebar-subject-link { color: #4ade80; }
[data-theme="dark"] .sidebar-toggle-btn { color: var(--text-muted); }
[data-theme="dark"] .sidebar-toggle-btn:hover { color: #4ade80; }
[data-theme="dark"] .sidebar-topic-list { background: var(--bg-surface-2); border-top-color: var(--border-light); }
[data-theme="dark"] .sidebar-topic-item a { color: var(--text-muted); border-left-color: transparent; }
[data-theme="dark"] .sidebar-topic-item a:hover { color: #4ade80; background: #0d2218; border-left-color: #4ade80; }
[data-theme="dark"] .sidebar-topic-item.current-topic a { color: #4ade80; background: #0d2218; border-left-color: #4ade80; font-weight: 700; }

[data-theme="dark"] .module-toggle-btn { color: var(--text-secondary); }
[data-theme="dark"] .module-toggle-btn:hover { background: var(--bg-surface-2); color: #4ade80; }
[data-theme="dark"] .module-topic-list { background: var(--bg-surface-2); border-top-color: var(--border-light); }

[data-theme="dark"] .prev-topic, [data-theme="dark"] .next-topic { background: var(--bg-surface); border-color: var(--border-light); }
[data-theme="dark"] .prev-topic a, [data-theme="dark"] .next-topic a { color: #4ade80; }
[data-theme="dark"] .prev-topic:hover, [data-theme="dark"] .next-topic:hover { border-color: #16a34a; }

[data-theme="dark"] .site-footer { background: #06090f; border-top-color: #16a34a; }
[data-theme="dark"] .post-meta { border-bottom-color: var(--border-light); }
[data-theme="dark"] .topic-navigation { border-top-color: var(--border-light); }

[data-theme="dark"] .home-container h2 { color: var(--text-primary); }
[data-theme="dark"] .course-topics-grid h2 { color: var(--text-primary); }
[data-theme="dark"] .course-topics-grid h2:after { background: var(--brand-green); }
[data-theme="dark"] .course-topic { background: var(--bg-surface); border-color: var(--border-light); }
[data-theme="dark"] .course-topic a { color: var(--text-primary); }
[data-theme="dark"] body.sidebar-open::before { background: rgba(0,0,0,.7); }

/* ═══════════════════════════════════════════════════════════
   RESPONSIVE
═══════════════════════════════════════════════════════════ */
@media (max-width: 1024px) {
  .sliding-sidebar { width: 270px; left: -280px; }
}

@media (min-width: 1024px) {
  .sidebar-toggle {
    position: fixed;
    left: 0;
    padding: 10px 14px;
    margin: 0;
    z-index: 1001;
    border-radius: 0 var(--radius-md) var(--radius-md) 0;
  }

  body.sidebar-open .sidebar-toggle { display: none; }
  body.sidebar-open::before { display: none; }

  body.sidebar-open .course-container,
  body.sidebar-open .course-category-full,
  body.sidebar-open .course-archive,
  body.sidebar-open .site-content {
    padding-left: 310px;
    transition: padding-left .3s var(--ease);
  }

  .sliding-sidebar {
    height: 100vh;
    overflow-y: auto;
    position: fixed;
    top: 0;
    left: -300px;
    transition: left .3s var(--ease);
  }

  .sliding-sidebar.open { left: 0; }
}

@media (max-width: 768px) {
  :root { --header-h: 60px; }

  .site-title { font-size: 1.2rem; }
  .site-title a::before { display: none; }
  .site-logo img { max-height: 36px; }
  .header-container { padding: 0 16px; }

  .menu-toggle { display: block; }

  .main-navigation ul#primary-menu {
    display: none;
    flex-direction: column;
    position: fixed;
    top: 0; right: -100%;
    width: 100%; max-width: 300px;
    height: 100vh;
    background: #15803d;
    transition: right .3s var(--ease);
    z-index: 1000;
    padding-top: 60px;
    overflow-y: auto;
  }

  .main-navigation ul#primary-menu.toggled {
    display: flex;
    right: 0;
  }

  #primary-menu > li { width: 100%; }
  #primary-menu > li > a {
    border-radius: 0;
    padding: 15px 22px;
    font-size: 1rem;
    width: 100%;
  }

  .courses-dropdown {
    position: static;
    box-shadow: none;
    border: none;
    border-radius: 0;
    background: #0f5f30;
    animation: none;
    padding: 4px 0;
  }

  .courses-dropdown li a {
    color: rgba(255,255,255,.8);
    padding: 11px 22px 11px 36px;
  }

  .courses-dropdown li a:hover { background: rgba(255,255,255,.08); color: white; }

  .has-courses-dropdown .courses-dropdown { display: none; }
  .has-courses-dropdown.dropdown-open .courses-dropdown { display: block; }

  .search-container { padding: 36px 20px; border-radius: var(--radius-lg); }
  .search-form-row { flex-direction: column; gap: 8px; }
  .search-field { border-radius: var(--radius-md); border-right: 2px solid transparent; }
  .search-submit { border-radius: var(--radius-md); }
  .search-field:focus { border-right-color: #22c55e; }

  .category-boxes { grid-template-columns: 1fr 1fr; }
  .topics-grid { grid-template-columns: 1fr; }

  .topic-navigation { flex-direction: column; }
  .next-topic { text-align: left; }

  .sidebar-toggle { width: auto; border-radius: var(--radius-md); }

  .footer-content { flex-direction: column; text-align: center; }
  .footer-content nav ul { justify-content: center; flex-wrap: wrap; gap: 12px; }

  .post { padding: 20px; }
}

@media (max-width: 480px) {
  .site-content { padding: 16px; }
  .category-boxes { grid-template-columns: 1fr; }
  .header-container { flex-wrap: nowrap; }
}

/* ═══════════════════════════════════════════════════════════
   MOBILE NAV DARK MODE
═══════════════════════════════════════════════════════════ */
@media (max-width: 768px) {
  [data-theme="dark"] .courses-dropdown { background: #0a1f14; }
  [data-theme="dark"] .courses-dropdown li a { color: rgba(255,255,255,.7); }
  [data-theme="dark"] .courses-dropdown li a:hover { background: rgba(255,255,255,.05); color: white; }
}