/* ==========================================
   NamasteNode - Complete Production Stylesheet
   Dark theme default / Light theme alternate
   ========================================== */

/* ----------------------------------------
   CSS Custom Properties (Dark Theme Default)
   ---------------------------------------- */
:root {
  --bg: #0a0a0a;
  --bg-secondary: #111111;
  --bg-card: #161616;
  --bg-elevated: #1a1a1a;
  --border: #262626;
  --border-light: #333333;
  --text: #e5e5e5;
  --text-secondary: #a3a3a3;
  --text-muted: #737373;
  --accent: #22c55e;
  --accent-light: #4ade80;
  --accent-bg: rgba(34, 197, 94, 0.1);
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 10px 40px rgba(0, 0, 0, 0.4);
  --header-bg: rgba(10, 10, 10, 0.8);
  --gradient-text: linear-gradient(135deg, #4ade80, #22c55e, #16a34a);

  --font-body: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-code: 'Fira Code', 'Consolas', 'Monaco', monospace;
}

/* ----------------------------------------
   Light Theme Overrides
   ---------------------------------------- */
[data-theme="light"] {
  --bg: #fafafa;
  --bg-secondary: #f5f5f5;
  --bg-card: #ffffff;
  --bg-elevated: #ffffff;
  --border: #e5e5e5;
  --border-light: #d4d4d4;
  --text: #171717;
  --text-secondary: #525252;
  --text-muted: #737373;
  --accent: #16a34a;
  --accent-light: #22c55e;
  --accent-bg: rgba(22, 163, 74, 0.08);
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 10px 40px rgba(0, 0, 0, 0.1);
  --header-bg: rgba(250, 250, 250, 0.8);
  --gradient-text: linear-gradient(135deg, #22c55e, #16a34a, #15803d);
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: 80px;
  font-size: 16px;
}

body {
  font-family: var(--font-body);
  background-color: var(--bg);
  color: var(--text);
  line-height: 1.7;
  transition: color 0.3s, background-color 0.3s;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-wrap: break-word;
  word-wrap: break-word;
  overflow-x: hidden;
}

a {
  color: inherit;
  text-decoration: none;
}

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

button {
  cursor: pointer;
  font-family: inherit;
}

ul,
ol {
  list-style: none;
}

::selection {
  background-color: var(--accent-bg);
  color: var(--accent);
}

/* ----------------------------------------
   Utilities
   ---------------------------------------- */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
}

.section {
  padding: 80px 0;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

.skip-link {
  position: fixed;
  top: -100%;
  left: 16px;
  z-index: 9999;
  padding: 12px 24px;
  background: var(--accent);
  color: #fff;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.9rem;
  transition: top 0.2s ease;
}

.skip-link:focus {
  top: 16px;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 28px;
  border-radius: 50px;
  font-weight: 600;
  font-size: 0.9rem;
  line-height: 1;
  transition: all 0.2s ease;
  gap: 8px;
  border: none;
  text-decoration: none;
  white-space: nowrap;
}

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

.btn-primary:hover {
  filter: brightness(1.1);
  transform: translateY(-1px);
}

.btn-outline {
  border: 2px solid var(--accent);
  color: var(--accent);
  background: transparent;
}

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

.btn-sm {
  padding: 8px 20px;
  font-size: 0.85rem;
}

.btn-full {
  width: 100%;
}

/* Animations */
.animate-fade-up {
  opacity: 1;
  transform: translateY(0);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.animate-fade-up.is-visible,
.loaded .animate-fade-up {
  opacity: 1;
  transform: translateY(0);
}

.animate-on-scroll {
  opacity: 1;
  transform: translateY(0);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.animate-on-scroll.is-visible {
  opacity: 1;
  transform: translateY(0);
}

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

/* ----------------------------------------
   Header (.site-header)
   ---------------------------------------- */
.site-header {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  z-index: 1000;
  background: var(--header-bg);
  -webkit-backdrop-filter: blur(20px);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
}

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

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}

.logo-mark {
  display: flex;
  align-items: center;
}

.logo-text {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--text);
}

.main-nav {
  display: flex;
  align-items: center;
  gap: 4px;
}

.nav-links {
  display: flex;
  gap: 4px;
}

/* Hide sidebar-only elements on desktop */
.sidebar-header,
.sidebar-divider,
.sidebar-utils,
.sidebar-backdrop,
.nav-icon {
  display: none;
}

.nav-link {
  padding: 8px 16px;
  border-radius: 50px;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-secondary);
  transition: color 0.2s ease, background-color 0.2s ease, box-shadow 0.2s ease;
  text-decoration: none;
}

.nav-link:hover {
  color: var(--text);
  background-color: var(--bg-elevated);
}

.nav-link.active {
  color: var(--accent);
  background-color: var(--accent-bg);
  box-shadow: inset 0 0 0 1px rgba(34,197,94,0.2);
  font-weight: 600;
}

/* Sidebar backdrop */
.sidebar-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 998;
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.sidebar-backdrop.visible {
  opacity: 1;
  pointer-events: auto;
}

/* Sidebar utility button base */
.sidebar-util-btn {
  display: flex;
  flex: 1;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  font-size: 0.9rem;
  font-weight: 500;
  font-family: var(--font-body);
  transition: background-color 0.2s ease, color 0.2s ease;
}

.sidebar-util-btn:hover {
  background: var(--bg-elevated);
  color: var(--text);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

.search-toggle,
.theme-toggle {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  color: var(--text-secondary);
  background: transparent;
  border: none;
  transition: background-color 0.2s ease, color 0.2s ease;
}

.search-toggle:hover,
.theme-toggle:hover {
  background-color: var(--bg-secondary);
  color: var(--text);
}

/* Theme toggle icons: dark mode (default) shows sun, light mode shows moon */
.theme-toggle .icon-sun {
  display: block;
}

.theme-toggle .icon-moon {
  display: none;
}

[data-theme="light"] .theme-toggle .icon-sun {
  display: none;
}

[data-theme="light"] .theme-toggle .icon-moon {
  display: block;
}

/* Mobile menu toggle */
.mobile-menu-toggle {
  display: none;
  width: 40px;
  height: 40px;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 5px;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 0;
}

.mobile-menu-toggle span {
  width: 22px;
  height: 2px;
  background-color: var(--text);
  border-radius: 2px;
  transition: transform 0.2s ease, opacity 0.2s ease;
  display: block;
}

.mobile-menu-toggle.active span:nth-child(1) {
  transform: rotate(45deg) translateY(7px);
}

.mobile-menu-toggle.active span:nth-child(2) {
  opacity: 0;
}

.mobile-menu-toggle.active span:nth-child(3) {
  transform: rotate(-45deg) translateY(-7px);
}

/* Search overlay */
.search-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  z-index: 1001;
  display: none;
  flex-direction: column;
  padding-top: 100px;
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
}

[data-theme="light"] .search-overlay {
  background: rgba(255, 255, 255, 0.95);
}

.search-overlay.active {
  display: flex;
}

.search-container {
  max-width: 640px;
  margin: 0 auto;
  width: 100%;
  padding: 0 24px;
}

.search-input-wrapper {
  display: flex;
  align-items: center;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 16px;
  gap: 12px;
}

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

.search-input-wrapper input::placeholder {
  color: var(--text-muted);
}

.search-close {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  border-radius: 6px;
  transition: color 0.2s ease;
}

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

.search-results {
  margin-top: 16px;
}

/* Reading progress */
.reading-progress {
  position: fixed;
  top: 64px;
  left: 0;
  width: 100%;
  height: 3px;
  background: transparent;
  z-index: 999;
}

.reading-progress-bar {
  height: 100%;
  background-color: var(--accent);
  width: 0%;
  transition: width 0.1s linear;
}

/* ----------------------------------------
   Hero Section
   ---------------------------------------- */
.hero {
  padding: 120px 0 80px;
  position: relative;
  overflow: hidden;
}

.hero-bg {
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at 20% 50%, var(--accent-bg) 0%, transparent 50%);
  z-index: 0;
}

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

.hero-content {
  position: relative;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: center;
  padding: 6px 16px;
  background: var(--accent-bg);
  border: 1px solid rgba(34, 197, 94, 0.2);
  border-radius: 50px;
  font-size: 0.85rem;
  color: var(--accent-light);
  font-weight: 500;
  margin-bottom: 24px;
}

.hero-title {
  font-size: 3.5rem;
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.02em;
  margin-bottom: 20px;
}

.hero-title .gradient-text {
  background: var(--gradient-text);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  display: inline-block;
  min-width: 4.5em;
  vertical-align: bottom;
}

.hero-subtitle {
  font-size: 1.15rem;
  color: var(--text-secondary);
  line-height: 1.7;
  margin-bottom: 32px;
  max-width: 500px;
}

.hero-cta {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

.hero-visual {
  position: relative;
}

/* Code window */
.code-window {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: var(--shadow-lg);
}

.code-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
}

.dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
}

.dot.red {
  background-color: #ff5f57;
}

.dot.yellow {
  background-color: #febc2e;
}

.dot.green {
  background-color: #28c840;
}

.code-title {
  margin-left: auto;
  font-size: 0.8rem;
  color: var(--text-muted);
  font-family: var(--font-code);
}

.code-body {
  padding: 20px;
  font-family: var(--font-code);
  font-size: 0.85rem;
  line-height: 1.8;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.code-body code {
  font-family: inherit;
}

/* Syntax highlighting colors */
.c-keyword {
  color: #ff7b72;
}

.c-func {
  color: #d2a8ff;
}

.c-string {
  color: #a5d6ff;
}

.c-num {
  color: #79c0ff;
}

.c-comment {
  color: var(--text-muted);
}

/* ----------------------------------------
   Stats Bar
   ---------------------------------------- */
.stats-bar {
  padding: 40px 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  background: var(--bg-secondary);
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 24px;
  text-align: center;
}

.stat-item {
  padding: 16px;
}

.stat-number {
  font-size: 2rem;
  font-weight: 800;
  color: var(--accent);
  display: block;
}

.stat-label {
  font-size: 0.85rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-top: 4px;
  display: block;
}

/* ----------------------------------------
   Section Headers
   ---------------------------------------- */
.section-header {
  text-align: center;
  margin-bottom: 48px;
}

.section-title,
.section-header h2 {
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 12px;
}

.section-subtitle,
.section-header p {
  color: var(--text-secondary);
  font-size: 1.05rem;
  max-width: 600px;
  margin: 0 auto;
}

/* ----------------------------------------
   Featured Cards
   ---------------------------------------- */
.featured-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(340px, 100%), 1fr));
  gap: 24px;
}

.featured-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0;
  overflow: hidden;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.featured-card-image-link {
  display: block;
  overflow: hidden;
}

.featured-card-image {
  width: 100%;
  height: 120px;
  object-fit: cover;
  display: block;
  transition: transform 0.3s ease;
}

.featured-card:hover .featured-card-image {
  transform: scale(1.03);
}

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

.card-badge {
  display: inline-block;
  padding: 4px 12px;
  background: var(--accent-bg);
  color: var(--accent);
  border-radius: 50px;
  font-size: 0.75rem;
  font-weight: 600;
  margin-bottom: 12px;
  margin-left: 20px;
  margin-top: 16px;
}

.card-title,
.card-excerpt,
.card-meta,
.card-footer {
  padding-left: 20px;
  padding-right: 20px;
}

.card-footer {
  padding-bottom: 20px;
}

.card-title {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 12px;
  line-height: 1.4;
}

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

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

.card-excerpt {
  color: var(--text-secondary);
  font-size: 0.9rem;
  line-height: 1.7;
  margin-bottom: 16px;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 16px;
}

.card-author {
  display: flex;
  align-items: center;
  gap: 8px;
}

.author-avatar-sm {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background-color: var(--accent);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
}

.card-stats {
  display: flex;
  align-items: center;
  gap: 4px;
}

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

.card-tags {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.tag {
  padding: 3px 10px;
  background: var(--bg-secondary);
  border-radius: 50px;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.read-more {
  color: var(--accent);
  font-size: 0.85rem;
  font-weight: 600;
  white-space: nowrap;
}

/* ----------------------------------------
   Content Layout
   ---------------------------------------- */
.content-layout {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 40px;
  align-items: start;
}

.content-main {
  min-width: 0;
  overflow: hidden;
}

/* ----------------------------------------
   Post Cards (blog page + home latest)
   ---------------------------------------- */
.posts-grid {
  display: grid;
  gap: 24px;
}

.post-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  display: grid;
  grid-template-columns: 160px 1fr;
  transition: border-color 0.2s ease, transform 0.2s ease;
}

.post-card-image-link {
  display: block;
  overflow: hidden;
  height: 100%;
}

.post-card-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.3s ease;
}

.post-card:hover .post-card-image {
  transform: scale(1.05);
}

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

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

.post-card-category {
  display: inline-block;
  padding: 3px 10px;
  background: var(--accent-bg);
  color: var(--accent);
  border-radius: 50px;
  font-size: 0.75rem;
  font-weight: 600;
  margin-bottom: 8px;
}

.post-card-title {
  font-size: 1.05rem;
  font-weight: 700;
  margin-bottom: 6px;
  line-height: 1.4;
}

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

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

.post-card-excerpt {
  color: var(--text-secondary);
  font-size: 0.85rem;
  line-height: 1.5;
  margin-bottom: 12px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.post-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 10px;
  align-items: center;
}

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

.post-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.post-card-tags {
  display: flex;
  gap: 6px;
}

.tag-sm {
  padding: 2px 8px;
  background: var(--bg-secondary);
  border-radius: 50px;
  font-size: 0.7rem;
  color: var(--text-muted);
}

.read-more-link {
  color: var(--accent);
  font-size: 0.85rem;
  font-weight: 600;
  transition: opacity 0.2s ease;
}

.read-more-link:hover {
  opacity: 0.8;
}

/* ----------------------------------------
   Blog List
   ---------------------------------------- */
.posts-list {
  display: grid;
  gap: 24px;
}

.post-list-item {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px;
  transition: border-color 0.2s ease, transform 0.2s ease;
}

.post-list-item:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
}

.post-list-body {
  position: relative;
}

.post-list-meta-top {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.post-list-category {
  display: inline-block;
  padding: 3px 10px;
  background: var(--accent-bg);
  color: var(--accent);
  border-radius: 50px;
  font-size: 0.8rem;
  font-weight: 600;
}

.post-list-date {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.post-list-title {
  font-size: 1.2rem;
  font-weight: 700;
  margin-bottom: 8px;
  line-height: 1.4;
}

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

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

.post-list-excerpt {
  color: var(--text-secondary);
  font-size: 0.9rem;
  line-height: 1.6;
  margin-bottom: 16px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.post-list-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

.post-list-author {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.post-list-stats {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.post-list-tags {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

/* ----------------------------------------
   Page Header
   ---------------------------------------- */
.page-header {
  padding: 120px 0 48px;
  text-align: center;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
}

.page-title {
  font-size: 2.5rem;
  font-weight: 800;
  margin-bottom: 12px;
}

.page-subtitle {
  color: var(--text-secondary);
  font-size: 1.1rem;
}

/* ----------------------------------------
   Filter Bar
   ---------------------------------------- */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 32px;
}

.filter-chip {
  padding: 6px 18px;
  border-radius: 50px;
  font-size: 0.85rem;
  font-weight: 500;
  background: var(--bg-secondary);
  color: var(--text-secondary);
  border: 1px solid var(--border);
  transition: border-color 0.2s ease, color 0.2s ease, background-color 0.2s ease;
  cursor: pointer;
  text-decoration: none;
}

.filter-chip:hover {
  border-color: var(--accent);
  color: var(--text);
}

.filter-chip.active {
  background-color: var(--accent);
  color: #ffffff;
  border-color: var(--accent);
}

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

.page-link {
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 0.9rem;
  color: var(--accent);
  font-weight: 600;
  transition: background-color 0.2s ease;
  text-decoration: none;
}

.page-link:hover {
  background-color: var(--bg-secondary);
}

.page-numbers {
  display: flex;
  gap: 4px;
}

.page-num {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  font-size: 0.9rem;
  color: var(--text-secondary);
  transition: background-color 0.2s ease, color 0.2s ease;
  text-decoration: none;
}

.page-num:hover {
  background-color: var(--bg-secondary);
}

.page-num.active {
  background-color: var(--accent);
  color: #ffffff;
}

/* ----------------------------------------
   Section CTA
   ---------------------------------------- */
.section-cta {
  text-align: center;
  margin-top: 32px;
}

/* ----------------------------------------
   Blog Post Page
   ---------------------------------------- */
.post-page {
  padding-top: 80px;
}

/* Breadcrumb */
.breadcrumb {
  margin-bottom: 24px;
  font-size: 0.85rem;
}

.breadcrumb ol {
  display: flex;
  gap: 8px;
  list-style: none;
  padding: 0;
  margin: 0;
  flex-wrap: wrap;
}

.breadcrumb li {
  display: flex;
  align-items: center;
  gap: 8px;
}

.breadcrumb li + li::before {
  content: "\203A";
  color: var(--text-muted);
}

.breadcrumb a {
  color: var(--text-secondary);
  transition: color 0.2s ease;
}

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

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

/* Post featured image */
.post-featured-image {
  margin-bottom: 20px;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--border);
}

.post-featured-image img {
  width: 100%;
  height: 240px;
  display: block;
  object-fit: cover;
}

/* Post header */
.post-header {
  margin-bottom: 32px;
}

.post-category-badge {
  display: inline-block;
  padding: 4px 12px;
  background: var(--accent-bg);
  color: var(--accent);
  border-radius: 50px;
  font-size: 0.8rem;
  font-weight: 600;
  margin-bottom: 16px;
}

.post-title {
  font-size: 2.5rem;
  font-weight: 800;
  line-height: 1.2;
  margin-bottom: 16px;
}

.post-excerpt-lg {
  font-size: 1.15rem;
  color: var(--text-secondary);
  line-height: 1.7;
  margin-bottom: 24px;
}

.post-meta-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  padding: 20px 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

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

.author-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background-color: var(--accent);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1.1rem;
  flex-shrink: 0;
}

.author-name {
  font-weight: 600;
  display: block;
}

.post-date {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.post-stats-bar {
  display: flex;
  gap: 8px;
  align-items: center;
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* Ad placeholders */
.ad-inline {
  margin: 24px 0;
}

.ad-placeholder {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 8px;
  min-height: 100px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 0.8rem;
}

/* ----------------------------------------
   Table of Contents
   ---------------------------------------- */
.toc-container {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  margin-bottom: 32px;
  overflow: hidden;
}

.toc-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  background: transparent;
  border: none;
  color: var(--text);
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  font-family: var(--font-body);
}

.toc-toggle svg {
  transition: transform 0.2s ease;
}

.toc-toggle[aria-expanded="true"] svg {
  transform: rotate(180deg);
}

.toc-nav {
  padding: 0 20px 16px;
  display: none;
}

.toc-nav.open {
  display: block;
}

.toc-nav a {
  display: block;
  padding: 6px 0;
  color: var(--text-secondary);
  font-size: 0.85rem;
  border-left: 2px solid var(--border);
  padding-left: 16px;
  transition: color 0.2s ease, border-color 0.2s ease;
}

.toc-nav a:hover,
.toc-nav a.active {
  color: var(--accent);
  border-left-color: var(--accent);
}

/* ----------------------------------------
   Post Content (article body)
   ---------------------------------------- */
.post-content {
  line-height: 1.8;
  font-size: 1.05rem;
  margin-bottom: 32px;
  overflow-wrap: break-word;
  word-break: break-word;
  min-width: 0;
}

.post-content h2 {
  font-size: 1.6rem;
  font-weight: 700;
  margin: 48px 0 16px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
}

.post-content h3 {
  font-size: 1.3rem;
  font-weight: 600;
  margin: 32px 0 12px;
  color: var(--text);
}

.post-content p {
  margin-bottom: 20px;
  color: var(--text-secondary);
}

.post-content a {
  color: var(--accent);
  text-decoration: underline;
}

.post-content a:hover {
  opacity: 0.8;
}

.post-content strong {
  color: var(--text);
  font-weight: 600;
}

.post-content code {
  background: var(--bg-secondary);
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.9em;
  font-family: var(--font-code);
}

.post-content pre {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 20px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin-bottom: 24px;
}

.post-content pre code {
  background: transparent;
  padding: 0;
  font-size: 0.85rem;
  line-height: 1.7;
}

.post-content ul,
.post-content ol {
  margin-bottom: 20px;
  padding-left: 28px;
  list-style: revert;
}

.post-content li {
  margin-bottom: 8px;
  color: var(--text-secondary);
}

.post-content blockquote {
  border-left: 3px solid var(--accent);
  padding-left: 20px;
  margin: 24px 0;
  font-style: italic;
  color: var(--text-secondary);
}

.post-content img {
  border-radius: 8px;
  margin: 24px 0;
}

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

.tags-label {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-right: 4px;
}

.post-tag {
  padding: 4px 14px;
  background: var(--bg-secondary);
  color: var(--accent);
  border-radius: 50px;
  font-size: 0.8rem;
  font-weight: 500;
  transition: background-color 0.2s ease;
  text-decoration: none;
}

.post-tag:hover {
  background: var(--accent-bg);
}

.post-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 24px 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  margin-bottom: 32px;
}

.like-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  background: transparent;
  border: 2px solid var(--border);
  padding: 10px 20px;
  border-radius: 50px;
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 0.9rem;
  transition: border-color 0.2s ease, color 0.2s ease;
  font-family: var(--font-body);
}

.like-btn:hover,
.like-btn.liked {
  border-color: #ef4444;
  color: #ef4444;
}

.like-btn.liked svg {
  fill: #ef4444;
}

.like-count {
  font-size: 0.9rem;
}

.share-buttons {
  display: flex;
  align-items: center;
  gap: 12px;
}

.share-label {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 500;
}

.share-btn {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--bg-secondary);
  color: var(--text-secondary);
  transition: background-color 0.2s ease, color 0.2s ease;
  border: none;
  text-decoration: none;
}

.share-btn:hover {
  background: var(--accent-bg);
  color: var(--accent);
}

/* ----------------------------------------
   Author Box
   ---------------------------------------- */
.author-box {
  display: flex;
  gap: 20px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px;
  margin-bottom: 32px;
}

.author-avatar-lg {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background-color: var(--accent);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  font-weight: 700;
  flex-shrink: 0;
}

.author-box-info h4 {
  font-weight: 700;
  margin-bottom: 4px;
}

.author-box-info p {
  color: var(--text-secondary);
  font-size: 0.9rem;
  line-height: 1.6;
}

/* ----------------------------------------
   Related Posts
   ---------------------------------------- */
.related-section {
  margin-bottom: 32px;
}

.related-title {
  font-size: 1.3rem;
  font-weight: 700;
  margin-bottom: 20px;
}

.related-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(250px, 100%), 1fr));
  gap: 16px;
}

.related-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0;
  overflow: hidden;
  text-decoration: none;
  transition: border-color 0.2s ease, transform 0.2s ease;
  display: block;
}

.related-card-image {
  width: 100%;
  height: 90px;
  object-fit: cover;
  display: block;
}

.related-category,
.related-card h4,
.related-meta {
  padding-left: 16px;
  padding-right: 16px;
}

.related-category {
  margin-top: 12px;
}

.related-meta {
  padding-bottom: 16px;
}

.related-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
}

.related-category {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.related-card h4 {
  font-size: 1rem;
  font-weight: 600;
  margin: 8px 0;
  color: var(--text);
  line-height: 1.4;
}

.related-meta {
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* ----------------------------------------
   Comments
   ---------------------------------------- */
.comments-section {
  margin-bottom: 32px;
}

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

.comment-form {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px;
  margin-bottom: 24px;
}

.form-row {
  margin-bottom: 16px;
}

.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-weight: 600;
  font-size: 0.85rem;
  margin-bottom: 6px;
  color: var(--text);
}

.form-group input,
.form-group textarea {
  width: 100%;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 16px;
  color: var(--text);
  font-size: 0.9rem;
  font-family: var(--font-body);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

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

.form-group input::placeholder,
.form-group textarea::placeholder {
  color: var(--text-muted);
}

.form-group textarea {
  resize: vertical;
  min-height: 100px;
}

.comment-form-footer {
  display: flex;
  align-items: center;
  gap: 16px;
}

#comment-form-msg {
  font-size: 0.85rem;
}

.comment-form-msg.success {
  color: var(--accent);
}

.comment-form-msg.error {
  color: #ef4444;
}

.comments-list {
  display: grid;
  gap: 16px;
}

.comment {
  display: flex;
  gap: 12px;
}

.comment-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--accent-bg);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.9rem;
  flex-shrink: 0;
}

.comment-body {
  flex: 1;
  min-width: 0;
}

.comment-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 6px;
}

.comment-author {
  font-weight: 600;
  font-size: 0.9rem;
}

.comment-date {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.comment-text {
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

#empty-comments {
  text-align: center;
  padding: 32px;
  color: var(--text-muted);
}

/* ----------------------------------------
   Categories Page
   ---------------------------------------- */
.categories-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(340px, 100%), 1fr));
  gap: 24px;
}

.category-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 28px;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

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

.category-card-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: var(--accent-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
  margin-bottom: 16px;
}

.category-card-name {
  font-size: 1.3rem;
  font-weight: 700;
  margin-bottom: 4px;
}

.category-card-count {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 16px;
}

.category-card-posts {
  border-top: 1px solid var(--border);
  padding-top: 16px;
  list-style: none;
  padding-left: 0;
  margin: 0 0 12px 0;
}

.category-card-posts a {
  display: block;
  padding: 8px 0;
  color: var(--text-secondary);
  font-size: 0.9rem;
  transition: color 0.2s ease;
  border-bottom: 1px solid var(--border);
}

.category-card-posts a:last-child {
  border-bottom: none;
}

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

.category-card-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 12px;
  color: var(--accent);
  font-weight: 600;
  font-size: 0.85rem;
  transition: opacity 0.2s ease;
}

.category-card-link:hover {
  opacity: 0.8;
}

/* ----------------------------------------
   Newsletter Section
   ---------------------------------------- */
.newsletter-section {
  padding: 60px 0;
  background: var(--bg-secondary);
  border-top: 1px solid var(--border);
}

.newsletter-card {
  max-width: 600px;
  margin: 0 auto;
  text-align: center;
}

.newsletter-content h2 {
  font-size: 1.8rem;
  font-weight: 700;
  margin-bottom: 12px;
}

.newsletter-content p {
  color: var(--text-secondary);
  margin-bottom: 24px;
}

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

.newsletter-form-inline input {
  flex: 1;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 50px;
  padding: 12px 20px;
  color: var(--text);
  font-size: 0.9rem;
  font-family: var(--font-body);
  transition: border-color 0.2s ease;
}

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

.newsletter-form-inline input::placeholder {
  color: var(--text-muted);
}

.newsletter-form-inline button {
  flex-shrink: 0;
}

.newsletter-msg {
  margin-top: 12px;
  font-size: 0.85rem;
}

.newsletter-msg.success {
  color: var(--accent);
}

.newsletter-msg.error {
  color: #ef4444;
}

/* ----------------------------------------
   Sidebar
   ---------------------------------------- */
.sidebar {
  position: sticky;
  top: 88px;
}

.widget {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 20px;
}

.widget-title {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

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

.sidebar-search-form input {
  flex: 1;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 14px;
  color: var(--text);
  font-size: 0.85rem;
  font-family: var(--font-body);
  transition: border-color 0.2s ease;
}

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

.sidebar-search-form input::placeholder {
  color: var(--text-muted);
}

.sidebar-search-form button {
  width: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: var(--accent);
  color: #ffffff;
  border: none;
  border-radius: 8px;
  transition: filter 0.2s ease;
}

.sidebar-search-form button:hover {
  filter: brightness(1.1);
}

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

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

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

.popular-rank {
  width: 28px;
  height: 28px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--accent-bg);
  color: var(--accent);
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 700;
}

.popular-link {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text);
  display: block;
  line-height: 1.4;
  transition: color 0.2s ease;
}

.popular-link:hover {
  color: var(--accent);
}

.popular-meta {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.category-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.category-tag {
  padding: 5px 14px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 50px;
  font-size: 0.8rem;
  color: var(--text-secondary);
  transition: border-color 0.2s ease, color 0.2s ease, background-color 0.2s ease;
  text-decoration: none;
}

.category-tag:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.category-tag.active {
  background-color: var(--accent);
  color: #ffffff;
  border-color: var(--accent);
}

.newsletter-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.newsletter-form input {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 14px;
  color: var(--text);
  font-size: 0.85rem;
  font-family: var(--font-body);
  transition: border-color 0.2s ease;
}

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

.newsletter-form input::placeholder {
  color: var(--text-muted);
}

.newsletter-form button {
  background-color: var(--accent);
  color: #ffffff;
  border: none;
  border-radius: 8px;
  padding: 10px;
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
  transition: filter 0.2s ease;
  font-family: var(--font-body);
}

.newsletter-form button:hover {
  filter: brightness(1.1);
}

/* ----------------------------------------
   Footer
   ---------------------------------------- */
.site-footer {
  background: var(--bg-secondary);
  border-top: 1px solid var(--border);
  padding: 60px 0 0;
}

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

.footer-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  margin-bottom: 16px;
}

.footer-desc {
  color: var(--text-secondary);
  font-size: 0.9rem;
  line-height: 1.6;
  margin-bottom: 20px;
}

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

.social-link {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  background: var(--bg-elevated);
  color: var(--text-secondary);
  transition: color 0.2s ease, background-color 0.2s ease;
  text-decoration: none;
}

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

.footer-links h4 {
  font-weight: 700;
  font-size: 0.9rem;
  margin-bottom: 16px;
  color: var(--text);
}

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

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

.footer-links a {
  color: var(--text-secondary);
  font-size: 0.85rem;
  transition: color 0.2s ease;
}

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

.footer-bottom {
  padding: 24px 0;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.8rem;
  color: var(--text-muted);
  flex-wrap: wrap;
  gap: 12px;
}

/* Back to top */
.back-to-top {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background-color: var(--accent);
  color: #ffffff;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, visibility 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
  z-index: 100;
  box-shadow: var(--shadow);
}

.back-to-top.visible {
  opacity: 1;
  visibility: visible;
}

.back-to-top:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

/* ----------------------------------------
   Cookie Banner
   ---------------------------------------- */
.cookie-banner {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--bg-card);
  border-top: 1px solid var(--border);
  padding: 16px 0;
  z-index: 1000;
  display: none;
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.2);
  transform: translateY(100%);
  opacity: 0;
  transition: transform 0.4s ease, opacity 0.4s ease;
}

.cookie-banner.show {
  transform: translateY(0);
  opacity: 1;
}

.cookie-banner-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.cookie-banner p {
  font-size: 0.85rem;
  color: var(--text-secondary);
  flex: 1;
}

.cookie-banner a {
  color: var(--accent);
}

.cookie-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

/* ----------------------------------------
   Error Page
   ---------------------------------------- */
.error-page {
  min-height: calc(100vh - 64px);
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 40px 24px;
}

.error-content {
  max-width: 480px;
}

.error-code {
  font-size: 8rem;
  font-weight: 800;
  line-height: 1;
  color: var(--accent);
  margin-bottom: 16px;
  opacity: 0.3;
}

.error-content h1 {
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 12px;
}

.error-content p {
  color: var(--text-secondary);
  margin-bottom: 32px;
}

.error-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
}

/* ----------------------------------------
   Legal Pages
   ---------------------------------------- */
.legal-content {
  max-width: 800px;
  margin: 0 auto;
  line-height: 1.8;
}

.legal-content h2 {
  font-size: 1.4rem;
  font-weight: 700;
  margin: 40px 0 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
}

.legal-content p {
  color: var(--text-secondary);
  margin-bottom: 16px;
}

.legal-content ul {
  margin-bottom: 16px;
  padding-left: 24px;
  list-style: disc;
}

.legal-content li {
  margin-bottom: 8px;
  color: var(--text-secondary);
}

.legal-content a {
  color: var(--accent);
}

/* ----------------------------------------
   About Page
   ---------------------------------------- */
.about-content {
  max-width: 800px;
  margin: 0 auto;
}

.about-story {
  margin-bottom: 48px;
}

.about-story h2,
.about-mission h2,
.about-author h2,
.about-cta h2 {
  font-size: 1.6rem;
  font-weight: 700;
  margin-bottom: 16px;
}

.about-story p {
  color: var(--text-secondary);
  margin-bottom: 16px;
  line-height: 1.8;
}

.about-mission {
  margin-bottom: 48px;
}

.mission-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
  margin-top: 24px;
}

.mission-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px;
  text-align: center;
}

.mission-icon {
  width: 56px;
  height: 56px;
  border-radius: 12px;
  background: var(--accent-bg);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
}

.mission-card h3 {
  font-weight: 700;
  font-size: 1.05rem;
  margin-bottom: 8px;
}

.mission-card p {
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.about-author {
  margin-bottom: 48px;
}

.author-profile {
  display: flex;
  gap: 24px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 28px;
  margin-top: 24px;
}

.author-avatar-xl {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background-color: var(--accent);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  font-weight: 700;
  flex-shrink: 0;
}

.author-profile-info {
  flex: 1;
}

.author-profile-info h3 {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 4px;
}

.author-role {
  color: var(--accent);
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 12px;
}

.author-profile-info p:not(.author-role) {
  color: var(--text-secondary);
  font-size: 0.9rem;
  line-height: 1.7;
  margin-bottom: 12px;
}

.author-social {
  display: flex;
  gap: 16px;
}

.social-link-text {
  color: var(--accent);
  font-weight: 600;
  font-size: 0.85rem;
  transition: opacity 0.2s ease;
}

.social-link-text:hover {
  text-decoration: underline;
}

.about-cta {
  text-align: center;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 40px;
}

.about-cta h2 {
  margin-bottom: 8px;
}

.about-cta p {
  color: var(--text-secondary);
  margin-bottom: 20px;
}

/* ----------------------------------------
   Contact Page
   ---------------------------------------- */
.contact-layout {
  max-width: 800px;
  margin: 0 auto;
}

.contact-info {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  margin-bottom: 40px;
}

.contact-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px;
  text-align: center;
}

.contact-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: var(--accent-bg);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 12px;
}

.contact-card h3 {
  font-weight: 700;
  font-size: 0.95rem;
  margin-bottom: 4px;
}

.contact-card p {
  color: var(--text-secondary);
  font-size: 0.85rem;
}

.contact-form-wrapper {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 32px;
}

.contact-form {
  /* Uses .form-group and .form-row-2 */
}

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

.success-message,
.error-message {
  display: flex;
  gap: 12px;
  padding: 16px 20px;
  border-radius: 12px;
  margin-bottom: 24px;
  align-items: center;
  font-size: 0.9rem;
}

.success-message {
  background: rgba(34, 197, 94, 0.1);
  color: var(--accent);
  border: 1px solid rgba(34, 197, 94, 0.2);
}

.error-message {
  background: rgba(239, 68, 68, 0.1);
  color: #ef4444;
  border: 1px solid rgba(239, 68, 68, 0.2);
}

/* ----------------------------------------
   Empty State
   ---------------------------------------- */
.empty-state {
  text-align: center;
  padding: 64px 24px;
  color: var(--text-muted);
}

.empty-state svg {
  margin: 0 auto 16px;
  opacity: 0.5;
  display: block;
}

.empty-state h3 {
  font-size: 1.2rem;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--text);
}

.empty-state p {
  margin-bottom: 20px;
}

/* ----------------------------------------
   Custom Scrollbar
   ---------------------------------------- */
::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: var(--bg);
}

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

::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* ----------------------------------------
   Responsive: Tablet (max-width: 1024px)
   ---------------------------------------- */
@media (max-width: 1024px) {
  .content-layout {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: relative;
    top: auto;
  }

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

  .hero-visual {
    display: none;
  }

  .footer-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .mission-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .search-overlay {
    padding-top: 80px;
  }
}

/* ----------------------------------------
   Responsive: Mobile (max-width: 768px)
   ---------------------------------------- */
@media (max-width: 768px) {
  .container {
    padding: 0 16px;
  }

  .section {
    padding: 48px 0;
  }

  .hero {
    padding: 100px 0 48px;
  }

  .hero-title {
    font-size: 2.5rem;
  }

  .hero-subtitle {
    font-size: 1.05rem;
  }

  .hero-badge {
    font-size: 0.75rem;
    padding: 5px 12px;
  }

  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
  }

  .stat-number {
    font-size: 1.6rem;
  }

  .section-header h2,
  .section-title {
    font-size: 1.6rem;
  }

  .section-header p,
  .section-subtitle {
    font-size: 0.95rem;
  }

  .page-header {
    padding: 100px 0 36px;
  }

  .page-title {
    font-size: 2rem;
  }

  .page-subtitle {
    font-size: 1rem;
  }

  .post-page {
    padding-top: 72px;
  }

  .post-title {
    font-size: 1.75rem;
  }

  .post-excerpt-lg {
    font-size: 1rem;
  }

  .main-nav {
    position: fixed;
    top: 0;
    left: 0;
    width: 280px;
    height: 100vh;
    height: 100dvh;
    background: var(--bg);
    flex-direction: column;
    align-items: stretch;
    transform: translateX(-100%);
    transition: transform 0.3s ease, visibility 0.3s ease;
    visibility: hidden;
    z-index: 1001;
    border-right: 1px solid var(--border);
    overflow-y: auto;
    gap: 0;
  }

  .main-nav.open {
    transform: translateX(0);
    visibility: visible;
  }

  .sidebar-header {
    display: flex;
    align-items: center;
    height: 64px;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
  }

  .sidebar-backdrop {
    display: block;
    pointer-events: none;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    height: 100dvh;
  }

  .nav-links {
    display: flex;
    flex-direction: column;
    padding: 12px;
    gap: 2px;
  }

  .nav-link {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: 10px;
    font-size: 0.95rem;
    box-shadow: none;
  }

  .nav-icon {
    display: block;
    color: var(--text-muted);
    flex-shrink: 0;
  }

  .nav-link.active .nav-icon {
    color: var(--accent);
  }

  .nav-link.active {
    box-shadow: none;
  }

  .sidebar-divider {
    display: block;
    height: 1px;
    background: var(--border);
    margin: 4px 20px;
    flex-shrink: 0;
  }

  .sidebar-utils {
    display: flex;
    gap: 8px;
    padding: 12px 20px;
    flex-shrink: 0;
  }

  .mobile-menu-toggle {
    display: flex;
  }

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

  .featured-card-image {
    height: 140px;
  }

  .card-title {
    font-size: 1.05rem;
  }

  .card-excerpt {
    font-size: 0.85rem;
    -webkit-line-clamp: 2;
  }

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

  .post-card-image {
    height: 160px;
  }

  .post-card-body {
    padding: 12px 14px;
  }

  .post-featured-image img {
    height: 180px;
  }

  .post-card-title {
    font-size: 1rem;
  }

  .post-card-excerpt {
    font-size: 0.83rem;
    -webkit-line-clamp: 2;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }

  .post-card-meta {
    font-size: 0.72rem;
  }

  .post-card-tags .tag-sm {
    font-size: 0.7rem;
    padding: 2px 6px;
  }

  .post-card-footer {
    flex-wrap: wrap;
    gap: 8px;
  }

  .post-content {
    font-size: 1rem;
  }

  .post-content h2 {
    font-size: 1.35rem;
    margin: 36px 0 12px;
  }

  .post-content h3 {
    font-size: 1.15rem;
    margin: 24px 0 10px;
  }

  .post-content pre {
    padding: 16px;
    margin-left: -16px;
    margin-right: -16px;
    border-radius: 0;
  }

  .post-content pre code {
    font-size: 0.8rem;
  }

  .author-box {
    flex-direction: column;
    text-align: center;
  }

  .author-avatar-lg {
    margin: 0 auto;
  }

  .comment-form {
    padding: 20px;
  }

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

  .related-card-image {
    height: 80px;
  }

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

  .footer-brand {
    grid-column: 1 / -1;
  }

  .footer-bottom {
    flex-direction: column;
    text-align: center;
  }

  .form-row-2 {
    grid-template-columns: 1fr;
  }

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

  .contact-form-wrapper {
    padding: 20px;
  }

  .author-profile {
    flex-direction: column;
    text-align: center;
  }

  .author-avatar-xl {
    margin: 0 auto;
  }

  .author-social {
    justify-content: center;
  }

  .about-story h2,
  .about-mission h2,
  .about-author h2,
  .about-cta h2 {
    font-size: 1.4rem;
  }

  .about-cta {
    padding: 28px 20px;
  }

  .mission-card {
    padding: 20px;
  }

  .post-meta-bar {
    flex-direction: column;
    align-items: flex-start;
  }

  .newsletter-content h2 {
    font-size: 1.5rem;
  }

  .newsletter-section {
    padding: 40px 0;
  }

  .cookie-banner-inner {
    flex-direction: column;
    text-align: center;
  }

  .cookie-actions {
    justify-content: center;
  }

  .toc {
    padding: 20px;
  }

  .search-overlay {
    padding-top: 70px;
  }

  .search-input-wrapper {
    padding: 10px 14px;
  }

  .breadcrumb {
    font-size: 0.8rem;
  }

  .toast-container {
    left: 12px;
    right: 12px;
    max-width: 100%;
  }

  .back-to-top {
    bottom: 16px;
    right: 16px;
    width: 40px;
    height: 40px;
  }

  /* Prevent iOS Safari auto-zoom on input focus (requires >= 16px) */
  .form-group input,
  .form-group textarea,
  .newsletter-form-inline input,
  .newsletter-form input,
  .sidebar-search-form input,
  .search-input-wrapper input {
    font-size: 16px;
  }

  /* Touch targets: minimum 44x44px on mobile */
  .share-btn {
    width: 44px;
    height: 44px;
  }

  .page-num {
    width: 44px;
    height: 44px;
  }

  .social-link {
    width: 44px;
    height: 44px;
  }
}

/* ----------------------------------------
   Responsive: Small Mobile (max-width: 480px)
   ---------------------------------------- */
@media (max-width: 480px) {
  .container {
    padding: 0 12px;
  }

  .hero {
    padding: 88px 0 36px;
  }

  .hero-title {
    font-size: 1.75rem;
  }

  .hero-title .gradient-text {
    min-width: 3.5em;
  }

  .hero-subtitle {
    font-size: 0.95rem;
  }

  .hero-badge {
    font-size: 0.7rem;
    padding: 4px 10px;
    border-radius: 8px;
  }

  .hero-cta {
    flex-direction: column;
  }

  .hero-cta .btn {
    width: 100%;
  }

  .section-header h2,
  .section-title {
    font-size: 1.4rem;
  }

  .page-header {
    padding: 88px 0 28px;
  }

  .page-title {
    font-size: 1.6rem;
  }

  .post-title {
    font-size: 1.5rem;
  }

  .stat-number {
    font-size: 1.4rem;
  }

  .stat-label {
    font-size: 0.75rem;
  }

  .error-code {
    font-size: 5rem;
  }

  .error-content h1 {
    font-size: 1.5rem;
  }

  .post-actions {
    flex-direction: column;
    gap: 16px;
  }

  .share-buttons {
    width: 100%;
    justify-content: center;
  }

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

  .newsletter-content h2 {
    font-size: 1.3rem;
  }

  .filter-bar {
    gap: 6px;
  }

  .filter-chip {
    padding: 5px 14px;
    font-size: 0.8rem;
  }

  .btn {
    padding: 10px 24px;
    font-size: 0.85rem;
  }

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

  .category-card {
    padding: 20px;
  }

  .category-card-name {
    font-size: 1.1rem;
  }

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

  .footer-links h4 {
    font-size: 0.85rem;
  }

  .footer-links a {
    font-size: 0.8rem;
  }

  .post-card-image {
    height: 140px;
  }

  .featured-card-image {
    height: 120px;
  }

  .related-card-image {
    height: 80px;
  }

  .post-featured-image img {
    height: 150px;
  }

  .legal-content h2 {
    font-size: 1.2rem;
  }

  .post-content pre {
    margin-left: -12px;
    margin-right: -12px;
    padding: 14px;
  }

  .post-content pre code {
    font-size: 0.75rem;
  }

  .code-body {
    padding: 12px;
    font-size: 0.75rem;
  }
}

/* ----------------------------------------
   Print Styles
   ---------------------------------------- */
@media print {
  .site-header,
  .sidebar,
  .site-footer,
  .cookie-banner,
  .back-to-top,
  .search-overlay,
  .reading-progress,
  .ad-inline,
  .post-actions,
  .comment-form,
  .newsletter-section,
  .sidebar-backdrop {
    display: none !important;
  }

  body {
    color: #000000;
    background: #ffffff;
  }

  .post-content a {
    color: #000000;
    text-decoration: underline;
  }

  .post-content a::after {
    content: " (" attr(href) ")";
    font-size: 0.8em;
  }
}

/* ----------------------------------------
   Toast Notifications
   ---------------------------------------- */
.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 100000;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
  max-width: 380px;
  width: 100%;
}

.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 20px;
  border-radius: 12px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 0.9rem;
  box-shadow: var(--shadow-lg);
  pointer-events: auto;
  transform: translateX(120%);
  opacity: 0;
  transition: transform 0.4s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.4s ease;
}

.toast.visible {
  transform: translateX(0);
  opacity: 1;
}

.toast-icon {
  flex-shrink: 0;
  display: flex;
}

.toast.success .toast-icon { color: var(--accent); }
.toast.error .toast-icon { color: #ef4444; }
.toast.info .toast-icon { color: #3b82f6; }

.toast-msg {
  flex: 1;
  line-height: 1.4;
}

.toast-close {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  font-size: 1.2rem;
  line-height: 1;
  transition: color 0.2s;
}

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

/* ----------------------------------------
   Ripple Effect
   ---------------------------------------- */
@keyframes ripple-anim {
  to {
    transform: scale(4);
    opacity: 0;
  }
}

/* ----------------------------------------
   Search Results
   ---------------------------------------- */
.search-result-item {
  display: block;
  padding: 16px;
  margin-bottom: 8px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  text-decoration: none;
  transition: border-color 0.2s, background 0.2s;
}

.search-result-item:hover,
.search-result-item.highlighted {
  border-color: var(--accent);
  background: var(--bg-elevated);
}

.search-result-item h4 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 4px;
}

.search-result-item p {
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-bottom: 6px;
}

.search-meta {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.search-empty {
  text-align: center;
  padding: 32px 16px;
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* ----------------------------------------
   Menu Open Body Lock
   ---------------------------------------- */
body.menu-open {
  overflow: hidden;
}

/* ----------------------------------------
   Scrolled Header
   ---------------------------------------- */
.site-header.scrolled {
  box-shadow: var(--shadow);
}

/* ----------------------------------------
   Reduced Motion
   ---------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }

  html {
    scroll-behavior: auto;
  }
}

/* ===== Legal Pages: Table of Contents ===== */
.toc {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px 32px;
  margin-bottom: 40px;
}

.toc h2,
.toc h3 {
  font-size: 1.1rem;
  margin-bottom: 12px;
  color: var(--text);
}

.toc ol {
  margin: 0;
  padding-left: 20px;
}

.toc li {
  margin-bottom: 6px;
  line-height: 1.6;
}

.toc a {
  color: var(--accent);
  text-decoration: none;
  transition: color 0.2s;
}

.toc a:hover {
  color: var(--accent-hover);
  text-decoration: underline;
}

/* ===== Legal Pages: Table ===== */
.legal-table {
  width: 100%;
  border-collapse: collapse;
  margin: 16px 0 24px;
  font-size: 0.9rem;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--border);
}

.legal-table thead {
  background: var(--bg-card);
}

.legal-table th,
.legal-table td {
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.legal-table th {
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
}

.legal-table td {
  color: var(--text-muted);
}

.legal-table tbody tr:hover {
  background: var(--bg-card);
}

@media (max-width: 768px) {
  .legal-table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .legal-table th,
  .legal-table td {
    padding: 10px 12px;
    font-size: 0.82rem;
  }
}

/* ===== About Page: Stats on About ===== */
.mission-grid-2x2 {
  grid-template-columns: repeat(2, 1fr);
}

.about-stats {
  margin: 32px 0;
}

.about-stats .stats-grid {
  gap: 20px;
}

.about-stats .stat-item {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px;
}
