/* ==========================================================================
   NimLearn - Core Design System & Stylesheet
   Tagline: "Learn. Explore. Understand."
   Categories: Artificial Intelligence, Computer Science, Psychology, History of World
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Theme Variables (Light Mode Default & Dark Mode Overrides)
   -------------------------------------------------------------------------- */
:root {
  /* Color Palette - Light Mode */
  --bg-primary: #f8fafc;
  --bg-surface: #ffffff;
  --bg-surface-elevated: #ffffff;
  --bg-subtle: #f1f5f9;
  --bg-header: rgba(255, 255, 255, 0.85);

  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #64748b;
  --text-inverse: #ffffff;

  --border-color: #e2e8f0;
  --border-subtle: #cbd5e1;

  /* Accent & Category Colors */
  --accent-primary: #2563eb;
  --accent-hover: #1d4ed8;
  --accent-light: #eff6ff;

  --category-ai: #2563eb;
  --category-cs: #0284c7;
  --category-psychology: #7c3aed;
  --category-history: #d97706;

  --badge-ai-bg: rgba(37, 99, 235, 0.1);
  --badge-cs-bg: rgba(2, 132, 199, 0.1);
  --badge-psychology-bg: rgba(124, 58, 237, 0.1);
  --badge-history-bg: rgba(217, 119, 6, 0.1);

  /* Shadows */
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.04);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.04);

  /* Radius & Transitions */
  --radius-sm: 0.375rem;
  --radius-md: 0.625rem;
  --radius-lg: 1rem;
  --radius-full: 9999px;

  --transition-fast: 0.15s ease;
  --transition-normal: 0.25s ease;
  --transition-slow: 0.4s ease;

  /* Layout */
  --container-max: 1200px;
  --header-height: 72px;
}

/* Dark Mode Overrides */
[data-theme="dark"] {
  --bg-primary: #0b1120;
  --bg-surface: #1e293b;
  --bg-surface-elevated: #334155;
  --bg-subtle: #0f172a;
  --bg-header: rgba(15, 23, 42, 0.88);

  --text-primary: #f8fafc;
  --text-secondary: #cbd5e1;
  --text-muted: #94a3b8;
  --text-inverse: #0f172a;

  --border-color: #334155;
  --border-subtle: #475569;

  --accent-primary: #38bdf8;
  --accent-hover: #7dd3fc;
  --accent-light: rgba(56, 189, 248, 0.12);

  --badge-ai-bg: rgba(56, 189, 248, 0.15);
  --badge-cs-bg: rgba(56, 189, 248, 0.15);
  --badge-psychology-bg: rgba(167, 139, 250, 0.15);
  --badge-history-bg: rgba(251, 191, 36, 0.15);

  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.4);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4), 0 2px 4px -2px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.5), 0 4px 6px -4px rgba(0, 0, 0, 0.4);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.6), 0 8px 10px -6px rgba(0, 0, 0, 0.5);
}

/* --------------------------------------------------------------------------
   2. Reset & Base Styles
   -------------------------------------------------------------------------- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

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

body {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Helvetica Neue', sans-serif;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: background-color var(--transition-normal), color var(--transition-normal);
  -webkit-font-smoothing: antialiased;
}

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

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

button, input, textarea {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
  border: none;
  background: none;
}

ul, ol {
  list-style: none;
}

/* --------------------------------------------------------------------------
   3. Container & Layout Helpers
   -------------------------------------------------------------------------- */
.container {
  width: 100%;
  max-width: var(--container-max);
  margin-left: auto;
  margin-right: auto;
  padding-left: 1.5rem;
  padding-right: 1.5rem;
}

main {
  flex: 1;
}

.section {
  padding-top: 4rem;
  padding-bottom: 4rem;
}

.section-subtle {
  background-color: var(--bg-subtle);
  border-top: 1px solid var(--border-color);
  border-bottom: 1px solid var(--border-color);
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-bottom: 2.5rem;
  flex-wrap: wrap;
  gap: 1rem;
}

.section-header-center {
  text-align: center;
  flex-direction: column;
  align-items: center;
}

.section-kicker {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent-primary);
  margin-bottom: 0.4rem;
}

.section-title {
  font-size: 2rem;
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: -0.02em;
  color: var(--text-primary);
}

.section-desc {
  font-size: 1.05rem;
  color: var(--text-secondary);
  margin-top: 0.5rem;
  max-width: 600px;
}

.view-all-link {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--accent-primary);
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.view-all-link:hover {
  color: var(--accent-hover);
  transform: translateX(3px);
}

/* --------------------------------------------------------------------------
   4. Header & Sticky Navigation
   -------------------------------------------------------------------------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--header-height);
  background-color: var(--bg-header);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-color);
  transition: background-color var(--transition-normal), border-color var(--transition-normal);
}

.nav-container {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.brand-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, #2563eb, #0284c7);
  color: #ffffff;
  font-weight: 900;
  font-size: 1.4rem;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 10px rgba(37, 99, 235, 0.3);
}

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

.brand-name {
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--text-primary);
  line-height: 1.1;
}

.brand-name span {
  color: var(--accent-primary);
}

.brand-tagline {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.02em;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 2rem;
}

.nav-link {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-secondary);
  position: relative;
  padding: 0.5rem 0;
}

.nav-link:hover, .nav-link.active {
  color: var(--accent-primary);
}

.nav-link.active::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 2px;
  background-color: var(--accent-primary);
  border-radius: var(--radius-full);
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.theme-toggle-btn, .search-trigger-btn {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  background-color: var(--bg-subtle);
  border: 1px solid var(--border-color);
  transition: all var(--transition-fast);
}

.theme-toggle-btn:hover, .search-trigger-btn:hover {
  color: var(--text-primary);
  background-color: var(--border-color);
  transform: translateY(-1px);
}

.mobile-menu-btn {
  display: none;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  align-items: center;
  justify-content: center;
  color: var(--text-primary);
  background-color: var(--bg-subtle);
  border: 1px solid var(--border-color);
}

/* --------------------------------------------------------------------------
   5. Buttons & Badges
   -------------------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.65rem 1.25rem;
  font-size: 0.95rem;
  font-weight: 700;
  border-radius: var(--radius-md);
  transition: all var(--transition-fast);
  text-align: center;
}

.btn-primary {
  background-color: var(--accent-primary);
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.25);
}

.btn-primary:hover {
  background-color: var(--accent-hover);
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(37, 99, 235, 0.35);
}

.btn-secondary {
  background-color: var(--bg-subtle);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
}

.btn-secondary:hover {
  background-color: var(--border-color);
  transform: translateY(-2px);
}

.btn-lg {
  padding: 0.85rem 1.75rem;
  font-size: 1.05rem;
  border-radius: var(--radius-lg);
}

.btn-sm {
  padding: 0.4rem 0.85rem;
  font-size: 0.85rem;
  border-radius: var(--radius-sm);
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.3rem 0.7rem;
  font-size: 0.78rem;
  font-weight: 700;
  border-radius: var(--radius-full);
  letter-spacing: 0.01em;
}

.badge-ai, .badge-artificial-intelligence {
  background-color: var(--badge-ai-bg);
  color: var(--category-ai);
}

.badge-cs, .badge-computer-science {
  background-color: var(--badge-cs-bg);
  color: var(--category-cs);
}

.badge-psychology {
  background-color: var(--badge-psychology-bg);
  color: var(--category-psychology);
}

.badge-history, .badge-history-of-world {
  background-color: var(--badge-history-bg);
  color: var(--category-history);
}

/* --------------------------------------------------------------------------
   6. Homepage Hero Section
   -------------------------------------------------------------------------- */
.hero {
  padding-top: 4.5rem;
  padding-bottom: 4.5rem;
  background: radial-gradient(circle at 50% 0%, var(--accent-light) 0%, transparent 60%);
  position: relative;
  overflow: hidden;
}

.hero-grid {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.hero-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0.9rem;
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-full);
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--accent-primary);
  margin-bottom: 1.25rem;
  box-shadow: var(--shadow-sm);
}

.hero-title {
  font-size: 3.25rem;
  font-weight: 900;
  line-height: 1.15;
  letter-spacing: -0.03em;
  color: var(--text-primary);
  margin-bottom: 1.25rem;
}

.hero-title span {
  background: linear-gradient(135deg, var(--accent-primary), #0284c7);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero-subtitle {
  font-size: 1.2rem;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 2rem;
  max-width: 680px;
  margin-left: auto;
  margin-right: auto;
}

.hero-buttons {
  display: flex;
  justify-content: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.hero-card-stack {
  position: relative;
}

.hero-orbit-card {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow-xl);
  transition: transform var(--transition-normal);
}

.hero-orbit-card:hover {
  transform: translateY(-4px);
}

.hero-card-main {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.hero-card-badge {
  font-size: 0.75rem;
  font-weight: 800;
  color: var(--category-ai);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.hero-card-float-1 {
  position: absolute;
  top: -2rem;
  left: -2rem;
  z-index: 3;
  padding: 0.85rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.85rem;
  background-color: var(--bg-surface-elevated);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-lg);
}

.hero-card-float-2 {
  position: absolute;
  bottom: -2rem;
  right: -1.5rem;
  z-index: 3;
  padding: 0.85rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.85rem;
  background-color: var(--bg-surface-elevated);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-lg);
}

/* --------------------------------------------------------------------------
   7. Four Categories Grid Section
   -------------------------------------------------------------------------- */
.category-cards-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.5rem;
}

.category-card {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: all var(--transition-normal);
  position: relative;
  overflow: hidden;
}

.category-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 4px;
  background: var(--category-color, var(--accent-primary));
}

.category-card:hover {
  transform: translateY(-6px);
  box-shadow: var(--shadow-lg);
  border-color: var(--border-subtle);
}

.category-card-icon {
  font-size: 2.25rem;
  margin-bottom: 1rem;
  width: 54px;
  height: 54px;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: var(--bg-subtle);
  border-radius: var(--radius-md);
}

.category-card-title {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
}

.category-card-desc {
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-bottom: 1.5rem;
  flex: 1;
}

.category-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 1rem;
  border-top: 1px solid var(--border-color);
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--category-color, var(--accent-primary));
}

/* Category Pill Navigation Strip */
.category-pill-list {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.category-pill {
  padding: 0.6rem 1.2rem;
  border-radius: var(--radius-full);
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  font-size: 0.9rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  transition: all var(--transition-fast);
}

.category-pill:hover, .category-pill.active {
  background-color: var(--accent-primary);
  color: #ffffff;
  border-color: var(--accent-primary);
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.25);
}

/* --------------------------------------------------------------------------
   8. Article Card & Grid System
   -------------------------------------------------------------------------- */
.article-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2rem;
}

.article-card {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: all var(--transition-normal);
}

.article-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: var(--border-subtle);
}

.article-card-thumb-link {
  position: relative;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background-color: var(--bg-subtle);
}

.article-card-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform var(--transition-slow);
}

.article-card:hover .article-card-thumb {
  transform: scale(1.05);
}

.article-card-category-overlay {
  position: absolute;
  top: 1rem;
  left: 1rem;
  z-index: 2;
}

.article-card-body {
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.article-card-meta {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 600;
  margin-bottom: 0.75rem;
}

.meta-dot {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background-color: var(--text-muted);
}

.article-card-title {
  font-size: 1.2rem;
  font-weight: 800;
  line-height: 1.35;
  margin-bottom: 0.65rem;
  color: var(--text-primary);
}

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

.article-card-excerpt {
  font-size: 0.92rem;
  color: var(--text-secondary);
  line-height: 1.55;
  margin-bottom: 1.5rem;
  flex: 1;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

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

.article-author-mini {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

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

.author-name-mini {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-primary);
}

.article-read-link {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--accent-primary);
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}

/* Featured Hero Article Card */
.featured-hero-card {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-md);
  margin-bottom: 3rem;
}

.featured-hero-media {
  position: relative;
  min-height: 340px;
  overflow: hidden;
  background-color: var(--bg-subtle);
}

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

.featured-hero-content {
  padding: 2.5rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 1rem;
}

.featured-hero-title {
  font-size: 1.85rem;
  font-weight: 900;
  line-height: 1.25;
  color: var(--text-primary);
}

.featured-hero-title a:hover {
  color: var(--accent-primary);
}

/* --------------------------------------------------------------------------
   9. Article Reader Page (Single Article View)
   -------------------------------------------------------------------------- */
.reading-progress-bar {
  position: fixed;
  top: 0;
  left: 0;
  height: 3px;
  background: linear-gradient(to right, #2563eb, #38bdf8);
  z-index: 101;
  width: 0%;
  transition: width 0.1s ease-out;
}

.article-single-view {
  max-width: 820px;
  margin: 0 auto;
  padding: 3rem 1.5rem 5rem 1.5rem;
}

.article-header {
  margin-bottom: 2.5rem;
}

.article-header-meta-top {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

.article-main-title {
  font-size: 2.85rem;
  font-weight: 900;
  line-height: 1.18;
  letter-spacing: -0.03em;
  color: var(--text-primary);
  margin-bottom: 1rem;
}

.article-subtitle {
  font-size: 1.3rem;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-bottom: 2rem;
}

.article-author-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 1.5rem;
  padding-bottom: 1.5rem;
  border-top: 1px solid var(--border-color);
  border-bottom: 1px solid var(--border-color);
  flex-wrap: wrap;
  gap: 1rem;
}

.article-author-profile {
  display: flex;
  align-items: center;
  gap: 1rem;
}

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

.article-author-name {
  font-size: 1rem;
  font-weight: 800;
  color: var(--text-primary);
  display: block;
}

.article-author-role {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.article-featured-media-wrapper {
  margin-bottom: 3rem;
  border-radius: var(--radius-lg);
  overflow: hidden;
  background-color: var(--bg-subtle);
  box-shadow: var(--shadow-md);
}

.article-featured-img {
  width: 100%;
  max-height: 480px;
  object-fit: cover;
}

.article-media-caption {
  padding: 0.75rem 1rem;
  font-size: 0.85rem;
  color: var(--text-muted);
  text-align: center;
  background-color: var(--bg-surface);
  border-top: 1px solid var(--border-color);
}

.article-body-wrapper {
  font-size: 1.125rem;
  line-height: 1.8;
  color: var(--text-primary);
}

.article-body-wrapper p {
  margin-bottom: 1.75rem;
}

.article-body-wrapper h2 {
  font-size: 1.75rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-top: 2.75rem;
  margin-bottom: 1rem;
  color: var(--text-primary);
}

.article-body-wrapper h3 {
  font-size: 1.35rem;
  font-weight: 700;
  margin-top: 2rem;
  margin-bottom: 0.75rem;
  color: var(--text-primary);
}

.article-lead {
  font-size: 1.25rem;
  font-weight: 500;
  line-height: 1.7;
  color: var(--text-secondary);
}

.callout-box {
  background-color: var(--bg-surface);
  border-left: 4px solid var(--accent-primary);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  margin: 2rem 0;
  box-shadow: var(--shadow-sm);
  display: flex;
  gap: 1rem;
}

.callout-icon {
  font-size: 1.5rem;
}

.callout-content h4 {
  font-size: 1.05rem;
  font-weight: 800;
  margin-bottom: 0.4rem;
}

.callout-content p {
  margin-bottom: 0;
  font-size: 0.98rem;
  color: var(--text-secondary);
}

.article-quote {
  margin: 2.5rem 0;
  padding-left: 1.5rem;
  border-left: 4px solid var(--accent-primary);
  font-size: 1.35rem;
  font-style: italic;
  font-weight: 600;
  color: var(--text-primary);
}

.article-tags-wrapper {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-top: 3rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border-color);
}

.article-tag-pill {
  padding: 0.35rem 0.8rem;
  border-radius: var(--radius-full);
  background-color: var(--bg-subtle);
  border: 1px solid var(--border-color);
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-secondary);
}

/* --------------------------------------------------------------------------
   10. Search Modal Dialog
   -------------------------------------------------------------------------- */
.search-modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(6px);
  z-index: 200;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 10vh;
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--transition-fast), visibility var(--transition-fast);
}

.search-modal-backdrop.active {
  opacity: 1;
  visibility: visible;
}

.search-modal {
  width: 100%;
  max-width: 650px;
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  overflow: hidden;
  transform: translateY(-20px);
  transition: transform var(--transition-fast);
}

.search-modal-backdrop.active .search-modal {
  transform: translateY(0);
}

.search-modal-header {
  padding: 1rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  border-bottom: 1px solid var(--border-color);
}

.search-modal-input {
  width: 100%;
  border: none;
  background: transparent;
  outline: none;
  font-size: 1.1rem;
  color: var(--text-primary);
}

.search-modal-results {
  max-height: 420px;
  overflow-y: auto;
  padding: 1rem;
}

.search-result-item {
  padding: 0.85rem 1rem;
  border-radius: var(--radius-md);
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  transition: background-color var(--transition-fast);
}

.search-result-item:hover {
  background-color: var(--bg-subtle);
}

.search-result-title {
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--text-primary);
}

.search-result-meta {
  font-size: 0.8rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.search-empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--text-muted);
}

.search-empty-icon {
  font-size: 2.5rem;
  margin-bottom: 0.5rem;
}

/* --------------------------------------------------------------------------
   11. Footer Styles
   -------------------------------------------------------------------------- */
.site-footer {
  background-color: #0f172a;
  color: #94a3b8;
  padding-top: 4rem;
  padding-bottom: 2rem;
  border-top: 1px solid #1e293b;
  margin-top: 4rem;
}

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

.footer-brand {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.footer-tagline {
  font-size: 0.9rem;
  font-weight: 700;
  color: #38bdf8;
  letter-spacing: 0.02em;
}

.footer-desc {
  font-size: 0.92rem;
  line-height: 1.6;
  max-width: 340px;
}

.footer-heading {
  color: #f8fafc;
  font-size: 1rem;
  font-weight: 800;
  margin-bottom: 1.25rem;
}

.footer-links {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.footer-link {
  font-size: 0.9rem;
  color: #94a3b8;
}

.footer-link:hover {
  color: #38bdf8;
}

.footer-bottom {
  border-top: 1px solid #1e293b;
  padding-top: 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.85rem;
  flex-wrap: wrap;
  gap: 1rem;
}

/* Toast Notifications */
.toast-container {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  z-index: 300;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.toast {
  background-color: var(--bg-surface-elevated);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  padding: 0.85rem 1.25rem;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-weight: 600;
  font-size: 0.9rem;
  opacity: 0;
  transform: translateY(10px);
  transition: all var(--transition-normal);
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

/* --------------------------------------------------------------------------
   Book Syllabus Layout Styles (Artificial Intelligence Book)
   -------------------------------------------------------------------------- */
.book-syllabus-wrapper {
  margin-top: 1rem;
}

.book-header-banner {
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.12), rgba(2, 132, 199, 0.06));
  border: 1px solid var(--border-color);
  border-left: 5px solid var(--category-ai);
  border-radius: var(--radius-lg);
  padding: 2rem;
  margin-bottom: 2.5rem;
}

.book-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0.85rem;
  background-color: var(--category-ai);
  color: #ffffff;
  font-size: 0.8rem;
  font-weight: 800;
  border-radius: var(--radius-full);
  letter-spacing: 0.03em;
  margin-bottom: 1rem;
}

.book-main-title {
  font-size: 2rem;
  font-weight: 900;
  margin-bottom: 0.5rem;
  color: var(--text-primary);
}

.book-main-tagline {
  font-size: 1.05rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

.book-stats-strip {
  display: flex;
  gap: 2rem;
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border-color);
  flex-wrap: wrap;
}

.book-stat-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-primary);
}

.book-parts-grid {
  display: flex;
  flex-direction: column;
  gap: 2.5rem;
}

.book-part-card {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  padding: 2rem;
  box-shadow: var(--shadow-sm);
  transition: transform var(--transition-normal), box-shadow var(--transition-normal);
}

.book-part-card:hover {
  box-shadow: var(--shadow-md);
}

.book-part-header {
  border-bottom: 2px solid var(--border-color);
  padding-bottom: 1rem;
  margin-bottom: 1.75rem;
}

.book-part-label {
  font-size: 0.85rem;
  font-weight: 900;
  color: var(--category-ai);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 0.25rem;
}

.book-part-title {
  font-size: 1.65rem;
  font-weight: 800;
  color: var(--text-primary);
}

.book-chapters-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.5rem;
}

.book-chapter-card {
  background-color: var(--bg-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
}

.book-chapter-num {
  font-size: 0.8rem;
  font-weight: 800;
  color: var(--text-muted);
  margin-bottom: 0.35rem;
  text-transform: uppercase;
}

.book-chapter-title {
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: 1rem;
  line-height: 1.35;
}

.book-topics-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.book-topic-item {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  font-size: 0.92rem;
  color: var(--text-secondary);
  padding: 0.4rem 0.6rem;
  border-radius: var(--radius-sm);
  transition: background-color var(--transition-fast);
  cursor: pointer;
}

.book-topic-item:hover {
  background-color: var(--bg-surface);
  color: var(--accent-primary);
}

.book-topic-bullet {
  color: var(--category-ai);
  font-weight: 900;
  font-size: 0.85rem;
  line-height: 1.4;
}

.book-topic-status {
  margin-left: auto;
  font-size: 0.72rem;
  padding: 0.15rem 0.45rem;
  border-radius: var(--radius-full);
  background-color: var(--border-color);
  color: var(--text-muted);
  font-weight: 700;
  white-space: nowrap;
}

.book-topic-status.has-content {
  background-color: rgba(37, 99, 235, 0.15);
  color: var(--category-ai);
}

/* Topic Reader Modal */
.topic-reader-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(6px);
  z-index: 1000;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 1.5rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-normal);
}

.topic-reader-modal.active {
  opacity: 1;
  pointer-events: auto;
}

.topic-modal-card {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  max-width: 800px;
  width: 100%;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-xl);
  overflow: hidden;
}

.topic-modal-header {
  padding: 1.5rem 2rem;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  background-color: var(--bg-subtle);
}

.topic-modal-body {
  padding: 2rem;
  overflow-y: auto;
  font-size: 1.05rem;
  line-height: 1.75;
  color: var(--text-primary);
}

.modal-close-btn {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-full);
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-secondary);
  transition: all var(--transition-fast);
}

.modal-close-btn:hover {
  background-color: var(--accent-primary);
  color: #ffffff;
}
