/* ==========================================================================
   Top AI Tools — Pro Theme & Readability Design System (2026)
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Theme Variables & Color Palettes
   -------------------------------------------------------------------------- */
:root {
  /* Light Mode Palette */
  --bg: #f8fafc;
  --bg-subtle: #f1f5f9;
  --surface: #ffffff;
  --surface-hover: #f8fafc;
  --surface-card: #ffffff;
  --border: #e2e8f0;
  --border-subtle: #f1f5f9;
  --border-focus: #6366f1;
  
  --text: #0f172a;
  --text-secondary: #334155;
  --text-muted: #64748b;
  --text-light: #94a3b8;
  
  --accent: #6366f1;
  --accent-hover: #4f46e5;
  --accent-soft: #eef2ff;
  --accent-soft-hover: #e0e7ff;
  --accent-glow: rgba(99, 102, 241, 0.2);
  
  --success: #10b981;
  --success-soft: #ecfdf5;
  --warning: #f59e0b;
  --warning-soft: #fffbeb;
  --info: #0ea5e9;
  --info-soft: #f0f9ff;
  
  --gradient-primary: linear-gradient(135deg, #6366f1 0%, #8b5cf6 50%, #d946ef 100%);
  --gradient-card: linear-gradient(180deg, rgba(255, 255, 255, 0.9) 0%, #ffffff 100%);
  --gradient-mesh: radial-gradient(at 10% 20%, rgba(99, 102, 241, 0.12) 0px, transparent 50%),
                    radial-gradient(at 90% 10%, rgba(139, 92, 246, 0.12) 0px, transparent 50%),
                    radial-gradient(at 50% 80%, rgba(217, 70, 239, 0.08) 0px, transparent 50%);
  
  --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.06), 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-md: 0 4px 20px -2px rgba(15, 23, 42, 0.08), 0 2px 6px -1px rgba(15, 23, 42, 0.04);
  --shadow-lg: 0 16px 36px -6px rgba(15, 23, 42, 0.12), 0 6px 16px -3px rgba(15, 23, 42, 0.06);
  --shadow-glow: 0 0 30px rgba(99, 102, 241, 0.2);
  
  --radius-sm: 8px;
  --radius: 14px;
  --radius-lg: 20px;
  --radius-full: 9999px;
  
  --font-sans: 'Plus Jakarta Sans', system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-heading: 'Outfit', 'Plus Jakarta Sans', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, monospace;
  
  --article-font-size: 1.125rem;
  --article-line-height: 1.82;
  --article-max-width: 760px;
  
  --header-height: 72px;
}

/* Dark Mode Palette */
[data-theme="dark"] {
  --bg: #090d16;
  --bg-subtle: #0f1523;
  --surface: #111827;
  --surface-hover: #172237;
  --surface-card: #131d31;
  --border: #1e293b;
  --border-subtle: #152033;
  --border-focus: #818cf8;
  
  --text: #f8fafc;
  --text-secondary: #cbd5e1;
  --text-muted: #94a3b8;
  --text-light: #64748b;
  
  --accent: #818cf8;
  --accent-hover: #6366f1;
  --accent-soft: rgba(129, 140, 248, 0.12);
  --accent-soft-hover: rgba(129, 140, 248, 0.2);
  --accent-glow: rgba(129, 140, 248, 0.35);
  
  --success: #34d399;
  --success-soft: rgba(52, 211, 153, 0.12);
  --warning: #fbbf24;
  --warning-soft: rgba(251, 191, 36, 0.12);
  --info: #38bdf8;
  --info-soft: rgba(56, 189, 248, 0.12);
  
  --gradient-primary: linear-gradient(135deg, #818cf8 0%, #a855f7 50%, #ec4899 100%);
  --gradient-card: linear-gradient(180deg, rgba(19, 29, 49, 0.8) 0%, #111827 100%);
  --gradient-mesh: radial-gradient(at 15% 15%, rgba(99, 102, 241, 0.18) 0px, transparent 60%),
                    radial-gradient(at 85% 20%, rgba(168, 85, 247, 0.16) 0px, transparent 60%),
                    radial-gradient(at 50% 90%, rgba(236, 72, 153, 0.1) 0px, transparent 60%);
  
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 6px 24px rgba(0, 0, 0, 0.45);
  --shadow-lg: 0 18px 40px rgba(0, 0, 0, 0.6);
  --shadow-glow: 0 0 35px rgba(129, 140, 248, 0.3);
}

/* --------------------------------------------------------------------------
   2. Reset & Global 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: var(--font-sans);
  background-color: var(--bg);
  color: var(--text);
  line-height: 1.65;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow-x: hidden;
  transition: background-color 0.25s ease, color 0.25s ease;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-image: var(--gradient-mesh);
  background-attachment: fixed;
  pointer-events: none;
  z-index: -1;
  opacity: 0.8;
}

main {
  flex: 1;
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: color 0.2s ease, transform 0.15s ease;
}

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

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

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  color: var(--text);
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: -0.02em;
}

button, input, select, textarea {
  font-family: inherit;
  font-size: inherit;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* --------------------------------------------------------------------------
   3. Reading Progress Bar (Top of Screen)
   -------------------------------------------------------------------------- */
.reading-progress-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 3px;
  background: transparent;
  z-index: 1000;
  pointer-events: none;
}

.reading-progress-bar {
  height: 100%;
  width: 0%;
  background: var(--gradient-primary);
  box-shadow: 0 0 10px var(--accent);
  transition: width 0.1s linear;
}

/* --------------------------------------------------------------------------
   4. Site Header & Navigation
   -------------------------------------------------------------------------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
  transition: background-color 0.25s ease, border-color 0.25s ease;
}

[data-theme="dark"] .site-header {
  background: rgba(9, 13, 22, 0.85);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--header-height);
  gap: 1.5rem;
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  font-family: var(--font-heading);
  font-weight: 800;
  font-size: 1.35rem;
  color: var(--text);
  letter-spacing: -0.02em;
}

.logo:hover {
  color: var(--text);
}

.logo-icon {
  width: 38px;
  height: 38px;
  background: var(--gradient-primary);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 1.2rem;
  box-shadow: 0 4px 12px var(--accent-glow);
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.logo:hover .logo-icon {
  transform: rotate(10deg) scale(1.05);
}

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

.nav-links {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  list-style: none;
}

.nav-links a {
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.95rem;
  padding: 0.5rem 0.9rem;
  border-radius: var(--radius-full);
  transition: all 0.2s ease;
}

.nav-links a:hover {
  color: var(--text);
  background: var(--accent-soft);
}

.nav-links a.active {
  color: var(--accent);
  background: var(--accent-soft);
}

/* Theme Toggle Button */
.theme-toggle {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-muted);
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1.15rem;
  transition: all 0.2s ease;
  box-shadow: var(--shadow-sm);
}

.theme-toggle:hover {
  color: var(--text);
  border-color: var(--accent);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.menu-toggle {
  display: none;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  width: 40px;
  height: 40px;
  border-radius: 12px;
  font-size: 1.25rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

/* --------------------------------------------------------------------------
   5. Hero Section
   -------------------------------------------------------------------------- */
.hero {
  padding: 5rem 0 3.5rem;
  text-align: center;
  position: relative;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--accent-soft);
  color: var(--accent);
  padding: 0.4rem 1.1rem;
  border-radius: var(--radius-full);
  font-size: 0.85rem;
  font-weight: 700;
  margin-bottom: 1.5rem;
  border: 1px solid rgba(99, 102, 241, 0.2);
  box-shadow: 0 2px 10px var(--accent-glow);
}

.pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
  animation: pulse 1.8s infinite;
}

@keyframes pulse {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
  70% { transform: scale(1); box-shadow: 0 0 0 8px rgba(16, 185, 129, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

.hero h1 {
  font-size: clamp(2.3rem, 5.5vw, 3.8rem);
  line-height: 1.12;
  margin-bottom: 1.25rem;
  letter-spacing: -0.03em;
  font-weight: 800;
}

.hero h1 span {
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero p {
  color: var(--text-muted);
  font-size: 1.2rem;
  max-width: 620px;
  margin: 0 auto 2.25rem;
  line-height: 1.6;
}

.hero-search-wrapper {
  max-width: 540px;
  margin: 0 auto;
  position: relative;
}

.hero-search {
  display: flex;
  gap: 0.5rem;
  background: var(--surface);
  padding: 0.4rem 0.4rem 0.4rem 1.25rem;
  border-radius: var(--radius-full);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-md);
  transition: all 0.25s ease;
  align-items: center;
}

.hero-search:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft), var(--shadow-lg);
}

.search-icon-left {
  color: var(--text-muted);
  font-size: 1.1rem;
}

.hero-search input {
  flex: 1;
  border: none;
  background: transparent;
  color: var(--text);
  font-size: 1rem;
  outline: none;
}

.hero-search input::placeholder {
  color: var(--text-light);
}

.search-shortcut-badge {
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  color: var(--text-muted);
  padding: 0.2rem 0.5rem;
  border-radius: 6px;
  font-size: 0.75rem;
  font-family: var(--font-mono);
  font-weight: 600;
  margin-right: 0.25rem;
  user-select: none;
}

/* --------------------------------------------------------------------------
   6. Buttons & Badges
   -------------------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1.4rem;
  border-radius: var(--radius-full);
  font-weight: 600;
  font-size: 0.95rem;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  text-decoration: none;
}

.btn-primary {
  background: var(--gradient-primary);
  color: white;
  box-shadow: 0 4px 16px var(--accent-glow);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px var(--accent-glow);
  color: white;
}

.btn-outline {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}

.btn-outline:hover {
  border-color: var(--accent);
  color: var(--accent);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

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

/* --------------------------------------------------------------------------
   7. Stats Bar
   -------------------------------------------------------------------------- */
.stats-bar {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.5rem;
  margin: 2.5rem 0 3.5rem;
  padding: 1.75rem 2rem;
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border);
  position: relative;
  overflow: hidden;
}

.stat-item {
  text-align: center;
  position: relative;
}

.stat-item:not(:last-child)::after {
  content: '';
  position: absolute;
  right: -0.75rem;
  top: 15%;
  height: 70%;
  width: 1px;
  background: var(--border);
}

.stat-value {
  font-family: var(--font-heading);
  font-size: 2rem;
  font-weight: 800;
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1.1;
}

.stat-label {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 0.4rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

/* --------------------------------------------------------------------------
   8. Section Headers & Category Grid
   -------------------------------------------------------------------------- */
.section {
  padding: 3.5rem 0;
}

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

.section-header h2 {
  font-size: 1.85rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.section-subtitle {
  color: var(--text-muted);
  font-size: 0.95rem;
  margin-top: 0.25rem;
}

/* Category Grid */
.category-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 1.25rem;
}

.category-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem 1.25rem;
  text-align: center;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  color: var(--text);
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.category-card:hover {
  border-color: var(--accent);
  transform: translateY(-4px);
  box-shadow: var(--shadow-md), var(--shadow-glow);
  color: var(--text);
}

.category-icon {
  font-size: 2.2rem;
  margin-bottom: 0.75rem;
  transition: transform 0.25s ease;
}

.category-card:hover .category-icon {
  transform: scale(1.15);
}

.category-card h3 {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 0.25rem;
}

.category-card span {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 500;
}

/* --------------------------------------------------------------------------
   9. Post Cards & Featured Post
   -------------------------------------------------------------------------- */
.post-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 1.75rem;
}

.post-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-sm);
  position: relative;
}

.post-card:hover {
  transform: translateY(-6px);
  box-shadow: var(--shadow-lg), 0 0 20px var(--accent-glow);
  border-color: rgba(99, 102, 241, 0.4);
}

.post-card-image {
  height: 190px;
  background: var(--gradient-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3.5rem;
  position: relative;
  overflow: hidden;
}

.post-card-image::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 40%, rgba(0, 0, 0, 0.25) 100%);
}

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

.post-meta {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.85rem;
  flex-wrap: wrap;
}

.post-category {
  background: var(--accent-soft);
  color: var(--accent);
  padding: 0.25rem 0.75rem;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  border: 1px solid rgba(99, 102, 241, 0.15);
}

.post-date {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.post-card h3 {
  font-size: 1.25rem;
  margin-bottom: 0.65rem;
  line-height: 1.35;
  font-weight: 700;
}

.post-card h3 a {
  color: var(--text);
  transition: color 0.2s ease;
}

.post-card h3 a:hover {
  color: var(--accent);
}

.post-card p {
  color: var(--text-muted);
  font-size: 0.925rem;
  line-height: 1.6;
  flex: 1;
  margin-bottom: 1.25rem;
}

.post-stats {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
  font-size: 0.825rem;
  color: var(--text-muted);
}

.post-stats-item {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.post-stats strong {
  color: var(--accent);
  font-weight: 700;
}

/* Featured Post */
.featured-post {
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: 2rem;
  box-shadow: var(--shadow-md);
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
}

.featured-post:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg), var(--shadow-glow);
  border-color: rgba(99, 102, 241, 0.4);
}

.featured-post-image {
  min-height: 360px;
  background: var(--gradient-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 5.5rem;
  position: relative;
}

.featured-badge {
  position: absolute;
  top: 1.25rem;
  left: 1.25rem;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(8px);
  color: #fbbf24;
  padding: 0.35rem 0.9rem;
  border-radius: var(--radius-full);
  font-size: 0.8rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.featured-post-content {
  padding: 2.75rem 2.25rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.featured-post-content h2 {
  font-size: 1.9rem;
  margin-bottom: 1rem;
  line-height: 1.25;
  font-weight: 800;
}

.featured-post-content h2 a {
  color: var(--text);
}

.featured-post-content h2 a:hover {
  color: var(--accent);
}

.featured-post-content p {
  color: var(--text-muted);
  font-size: 1.05rem;
  line-height: 1.65;
  margin-bottom: 1.5rem;
}

/* --------------------------------------------------------------------------
   10. Blog Listing Page Controls (Filters, Sorting, Live Search)
   -------------------------------------------------------------------------- */
.blog-controls-wrapper {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  margin-bottom: 2rem;
  box-shadow: var(--shadow-sm);
}

.filters {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
  margin-bottom: 1.25rem;
}

.filter-btn {
  padding: 0.5rem 1.1rem;
  border-radius: var(--radius-full);
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text-muted);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.filter-btn:hover {
  border-color: var(--accent);
  color: var(--text);
  transform: translateY(-1px);
}

.filter-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
  box-shadow: 0 2px 10px var(--accent-glow);
}

.blog-meta-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
  flex-wrap: wrap;
  gap: 1rem;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.sort-wrapper {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.sort-select {
  padding: 0.45rem 1rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-size: 0.875rem;
  outline: none;
  cursor: pointer;
}

.sort-select:focus {
  border-color: var(--accent);
}

/* --------------------------------------------------------------------------
   11. Article Reading Experience & Layout (post.html)
   -------------------------------------------------------------------------- */
.article-page-layout {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  gap: 3.5rem;
  align-items: start;
  margin-top: 2rem;
  padding-bottom: 4rem;
}

/* Sticky Table of Contents (TOC) Sidebar */
.article-toc-sidebar {
  position: sticky;
  top: calc(var(--header-height) + 1.5rem);
  max-height: calc(100vh - var(--header-height) - 3rem);
  overflow-y: auto;
  padding: 1.5rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

.article-toc-sidebar::-webkit-scrollbar {
  width: 4px;
}

.article-toc-sidebar::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 4px;
}

.toc-header {
  font-family: var(--font-heading);
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  font-weight: 700;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.toc-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.toc-item {
  font-size: 0.875rem;
  line-height: 1.4;
}

.toc-item.toc-sub {
  margin-left: 0.85rem;
  font-size: 0.825rem;
}

.toc-link {
  color: var(--text-muted);
  display: block;
  padding: 0.35rem 0.5rem;
  border-radius: 6px;
  transition: all 0.15s ease;
  border-left: 2px solid transparent;
}

.toc-link:hover {
  color: var(--accent);
  background: var(--accent-soft);
}

.toc-link.active {
  color: var(--accent);
  font-weight: 600;
  background: var(--accent-soft);
  border-left-color: var(--accent);
}

/* Mobile Collapsible TOC */
.toc-mobile-box {
  display: none;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  margin: 1.5rem 0 2rem;
}

.toc-mobile-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  font-weight: 700;
  font-size: 0.95rem;
}

.toc-mobile-content {
  display: none;
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.toc-mobile-content.open {
  display: block;
}

/* Article Main Area */
.article-main {
  max-width: var(--article-max-width);
  margin: 0 auto;
  width: 100%;
}

.article-header {
  padding: 1.5rem 0 2rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 2.25rem;
}

.article-header h1 {
  font-size: clamp(2rem, 4.5vw, 2.75rem);
  line-height: 1.18;
  margin: 1rem 0 1.25rem;
  letter-spacing: -0.025em;
  font-weight: 800;
}

/* Reading Toolbar: Font size adjuster, estimated read time, share buttons */
.reading-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.75rem 1.25rem;
  margin-top: 1.5rem;
  flex-wrap: wrap;
  gap: 1rem;
  box-shadow: var(--shadow-sm);
}

.reading-stats-group {
  display: flex;
  align-items: center;
  gap: 1rem;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.reading-tools-group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.font-size-adjuster {
  display: flex;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  overflow: hidden;
  background: var(--bg);
}

.font-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  padding: 0.3rem 0.65rem;
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
}

.font-btn:hover {
  background: var(--accent-soft);
  color: var(--accent);
}

.tool-action-btn {
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text-muted);
  padding: 0.35rem 0.75rem;
  border-radius: var(--radius-full);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  transition: all 0.2s ease;
}

.tool-action-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-soft);
}

/* Article Typography */
.article-content {
  font-size: var(--article-font-size);
  line-height: var(--article-line-height);
  color: var(--text-secondary);
}

.article-content p {
  margin-bottom: 1.6rem;
  letter-spacing: -0.003em;
}

.article-content h2 {
  font-size: 1.7rem;
  margin: 3.25rem 0 1.25rem;
  letter-spacing: -0.02em;
  font-weight: 800;
  padding-bottom: 0.6rem;
  border-bottom: 1px solid var(--border);
  position: relative;
}

.article-content h3 {
  font-size: 1.35rem;
  margin: 2.25rem 0 0.85rem;
  font-weight: 700;
}

.article-content h4 {
  font-size: 1.15rem;
  margin: 1.75rem 0 0.5rem;
  font-weight: 700;
}

.article-content strong {
  color: var(--text);
  font-weight: 700;
}

.article-content ul,
.article-content ol {
  margin: 0 0 1.75rem 1.5rem;
}

.article-content li {
  margin-bottom: 0.65rem;
  padding-left: 0.25rem;
}

.article-content li::marker {
  color: var(--accent);
}

/* Comparison Tables */
.table-container {
  width: 100%;
  overflow-x: auto;
  margin: 2rem 0;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  background: var(--surface);
}

.tool-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.925rem;
  text-align: left;
}

.tool-table th {
  background: var(--bg-subtle);
  color: var(--text);
  font-weight: 700;
  padding: 0.95rem 1.15rem;
  border-bottom: 1px solid var(--border);
  font-family: var(--font-heading);
  white-space: nowrap;
}

.tool-table td {
  padding: 0.9rem 1.15rem;
  border-bottom: 1px solid var(--border);
  color: var(--text-secondary);
}

.tool-table tbody tr:last-child td {
  border-bottom: none;
}

.tool-table tbody tr:hover td {
  background: var(--accent-soft);
}

/* Callout Box / Blockquotes */
.article-content blockquote {
  border-left: 4px solid var(--accent);
  padding: 1.25rem 1.75rem;
  margin: 2rem 0;
  background: var(--accent-soft);
  border-radius: 0 var(--radius) var(--radius) 0;
  color: var(--text);
  font-style: normal;
  font-size: 1.05rem;
  line-height: 1.7;
}

.callout-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  margin: 2rem 0;
  box-shadow: var(--shadow-sm);
}

.callout-title {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 1rem;
  margin-bottom: 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text);
}

/* Keyword Cloud */
.keyword-cloud {
  margin: 3rem 0;
  padding: 1.75rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

.keyword-cloud h3 {
  font-size: 1.05rem;
  margin-bottom: 1rem;
  font-weight: 700;
}

.keyword-tag {
  display: inline-flex;
  align-items: center;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text-muted);
  padding: 0.35rem 0.8rem;
  border-radius: var(--radius-full);
  font-size: 0.825rem;
  font-weight: 500;
  margin: 0.3rem;
  transition: all 0.2s ease;
  cursor: pointer;
}

.keyword-tag:hover {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent);
  transform: translateY(-1px);
}

/* Article Feedback & Share Widget */
.article-feedback {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.75rem;
  margin: 3rem 0;
  text-align: center;
  box-shadow: var(--shadow-sm);
}

.article-feedback h3 {
  font-size: 1.15rem;
  margin-bottom: 0.5rem;
}

.article-feedback p {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: 1.25rem;
}

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

.feedback-btn {
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 0.6rem 1.4rem;
  border-radius: var(--radius-full);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  transition: all 0.2s ease;
}

.feedback-btn:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
  transform: scale(1.04);
}

/* Post Navigation (Prev/Next) */
.post-navigation {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  margin: 3rem 0;
}

.post-nav-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  transition: all 0.2s ease;
  box-shadow: var(--shadow-sm);
}

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

.post-nav-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  font-weight: 700;
  margin-bottom: 0.35rem;
}

.post-nav-title {
  color: var(--text);
  font-weight: 700;
  font-size: 0.95rem;
  line-height: 1.35;
}

/* --------------------------------------------------------------------------
   12. Newsletter Section
   -------------------------------------------------------------------------- */
.newsletter-section {
  margin: 4rem 0 2rem;
  background: var(--gradient-primary);
  border-radius: var(--radius-lg);
  padding: 3.5rem 2rem;
  text-align: center;
  color: white;
  position: relative;
  overflow: hidden;
  box-shadow: 0 16px 36px var(--accent-glow);
}

.newsletter-section::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -20%;
  width: 140%;
  height: 200%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.15) 0%, transparent 60%);
  pointer-events: none;
}

.newsletter-content {
  max-width: 540px;
  margin: 0 auto;
  position: relative;
  z-index: 1;
}

.newsletter-content h2 {
  color: white;
  font-size: 2.1rem;
  margin-bottom: 0.75rem;
  font-weight: 800;
}

.newsletter-content p {
  color: rgba(255, 255, 255, 0.9);
  font-size: 1.05rem;
  margin-bottom: 1.75rem;
}

.newsletter-form {
  display: flex;
  gap: 0.5rem;
  max-width: 440px;
  margin: 0 auto;
}

.newsletter-form input {
  flex: 1;
  padding: 0.85rem 1.25rem;
  border-radius: var(--radius-full);
  border: 1px solid rgba(255, 255, 255, 0.3);
  background: rgba(255, 255, 255, 0.95);
  color: #0f172a;
  outline: none;
  font-size: 0.95rem;
}

.newsletter-form button {
  background: #0f172a;
  color: white;
  border: none;
  padding: 0.85rem 1.5rem;
  border-radius: var(--radius-full);
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.newsletter-form button:hover {
  background: #1e293b;
  transform: translateY(-1px);
}

/* --------------------------------------------------------------------------
   13. Footer
   -------------------------------------------------------------------------- */
.site-footer {
  background: #090d16;
  color: #94a3b8;
  padding: 4rem 0 2rem;
  margin-top: 5rem;
  border-top: 1px solid #1e293b;
}

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

.footer-brand p {
  font-size: 0.925rem;
  line-height: 1.6;
  margin-top: 0.75rem;
  color: #94a3b8;
  max-width: 320px;
}

.footer-grid h4 {
  color: white;
  margin-bottom: 1.25rem;
  font-size: 1rem;
  font-weight: 700;
}

.footer-grid ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.footer-grid a {
  color: #94a3b8;
  font-size: 0.9rem;
  transition: color 0.2s ease;
}

.footer-grid a:hover {
  color: white;
}

.footer-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  background: rgba(16, 185, 129, 0.1);
  color: #34d399;
  border: 1px solid rgba(52, 211, 153, 0.2);
  padding: 0.3rem 0.75rem;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 600;
  margin-top: 1rem;
}

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

.footer-bottom a {
  color: #94a3b8;
}

.footer-bottom a:hover {
  color: white;
}

/* --------------------------------------------------------------------------
   14. Floating Back to Top Button & Toast Notification
   -------------------------------------------------------------------------- */
.back-to-top {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  cursor: pointer;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px);
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  z-index: 99;
}

.back-to-top.visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.back-to-top:hover {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
  transform: translateY(-3px);
}

/* Toast Container */
.toast-container {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  z-index: 2000;
  pointer-events: none;
}

.toast {
  background: var(--text);
  color: var(--bg);
  padding: 0.75rem 1.5rem;
  border-radius: var(--radius-full);
  font-size: 0.875rem;
  font-weight: 600;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  animation: toastIn 0.3s cubic-bezier(0.16, 1, 0.3, 1), toastOut 0.3s 2.7s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes toastIn {
  from { opacity: 0; transform: translateY(15px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes toastOut {
  from { opacity: 1; transform: translateY(0); }
  to { opacity: 0; transform: translateY(15px); }
}

/* --------------------------------------------------------------------------
   15. Breadcrumb, Contact, About, Legal Pages
   -------------------------------------------------------------------------- */
.breadcrumb {
  padding: 1.25rem 0 0;
  font-size: 0.875rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

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

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

/* About Page */
.about-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3.5rem;
  align-items: center;
}

.about-visual {
  background: var(--gradient-primary);
  border-radius: var(--radius-lg);
  height: 380px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 6.5rem;
  box-shadow: var(--shadow-lg), var(--shadow-glow);
}

/* Contact Page */
.contact-grid {
  display: grid;
  grid-template-columns: 1fr 1.3fr;
  gap: 3rem;
  align-items: start;
}

.contact-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
}

.contact-card h2 {
  font-size: 1.1rem;
  margin-bottom: 0.35rem;
}

.contact-form {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2.25rem;
  box-shadow: var(--shadow-md);
}

.form-group {
  margin-bottom: 1.35rem;
}

.form-group label {
  display: block;
  font-weight: 600;
  font-size: 0.9rem;
  margin-bottom: 0.45rem;
}

.required {
  color: #ef4444;
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 0.8rem 1.1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.95rem;
  outline: none;
  background: var(--bg);
  color: var(--text);
  transition: all 0.2s ease;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.form-error {
  display: block;
  color: #ef4444;
  font-size: 0.8rem;
  margin-top: 0.35rem;
  min-height: 1rem;
}

.btn-full {
  width: 100%;
  margin-top: 0.5rem;
}

.form-note {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 1rem;
  text-align: center;
}

.form-success {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 3rem 2rem;
  text-align: center;
  box-shadow: var(--shadow-md);
}

/* Legal Pages */
.legal-page {
  padding-bottom: 4rem;
}

.legal-header {
  margin-bottom: 2.5rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
}

.legal-content h2 {
  font-size: 1.4rem;
  margin: 2.25rem 0 0.85rem;
}

.legal-content h3 {
  font-size: 1.15rem;
  margin: 1.5rem 0 0.5rem;
}

.legal-content p,
.legal-content li {
  color: var(--text-secondary);
  margin-bottom: 0.85rem;
  font-size: 1.025rem;
}

/* No Results */
.no-results {
  text-align: center;
  padding: 4rem 2rem;
  background: var(--surface);
  border-radius: var(--radius-lg);
  border: 1px dashed var(--border);
  grid-column: 1 / -1;
}

.no-results h3 {
  font-size: 1.35rem;
  margin-bottom: 0.5rem;
}

/* --------------------------------------------------------------------------
   16. Responsive Breakpoints
   -------------------------------------------------------------------------- */
@media (max-width: 1024px) {
  .article-page-layout {
    grid-template-columns: 1fr;
    gap: 2rem;
  }
  
  .article-toc-sidebar {
    display: none;
  }
  
  .toc-mobile-box {
    display: block;
  }
  
  .footer-grid {
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
  }
}

@media (max-width: 768px) {
  .nav-links {
    display: none;
    position: absolute;
    top: var(--header-height);
    left: 0;
    right: 0;
    background: var(--surface);
    flex-direction: column;
    padding: 1.25rem;
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow-lg);
    gap: 0.5rem;
  }

  .nav-links.open {
    display: flex;
  }

  .nav-links a {
    width: 100%;
    padding: 0.75rem 1rem;
    border-radius: var(--radius-sm);
  }

  .menu-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .stats-bar {
    grid-template-columns: repeat(2, 1fr);
    gap: 1.25rem;
    padding: 1.5rem;
  }

  .stat-item:nth-child(2)::after {
    display: none;
  }

  .featured-post {
    grid-template-columns: 1fr;
  }

  .featured-post-image {
    min-height: 220px;
  }

  .featured-post-content {
    padding: 1.75rem;
  }

  .about-grid,
  .contact-grid {
    grid-template-columns: 1fr;
  }

  .post-grid {
    grid-template-columns: 1fr;
  }

  .newsletter-form {
    flex-direction: column;
  }

  .footer-grid {
    grid-template-columns: 1fr;
  }

  .post-navigation {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 480px) {
  .stats-bar {
    grid-template-columns: 1fr;
  }
  
  .stat-item::after {
    display: none !important;
  }
  
  .reading-toolbar {
    flex-direction: column;
    align-items: flex-start;
  }
}
