/* Modern Variables & Colors */
:root {
  --bg-primary: #f8fafc;
  --bg-secondary: #ffffff;
  --bg-glass: rgba(255, 255, 255, 0.75);
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #64748b;
  --accent-color: #6366f1;
  --accent-gradient: linear-gradient(135deg, #8b5cf6 0%, #6366f1 100%);
  --border-color: #e2e8f0;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.05);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.05), 0 2px 4px -1px rgba(0,0,0,0.03);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.05), 0 4px 6px -2px rgba(0,0,0,0.02);
  --card-hover: translateY(-6px);
  --header-height: 70px;
}

[data-theme="dark"] {
  --bg-primary: #0b0f19;
  --bg-secondary: #131c2e;
  --bg-glass: rgba(19, 28, 46, 0.85);
  --text-primary: #f1f5f9;
  --text-secondary: #cbd5e1;
  --text-muted: #94a3b8;
  --accent-color: #8b5cf6;
  --accent-gradient: linear-gradient(135deg, #a78bfa 0%, #8b5cf6 100%);
  --border-color: #1e293b;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.2);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.25), 0 2px 4px -1px rgba(0,0,0,0.15);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.4), 0 4px 6px -2px rgba(0,0,0,0.2);
}

/* Global Reset */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

h1, h2, h3, h4, h5, h6 {
  font-family: 'Outfit', sans-serif;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.25;
}

a {
  color: var(--accent-color);
  text-decoration: none;
  transition: color 0.2s ease;
}
a:hover {
  text-decoration: underline;
}

/* Custom scrollbar */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: var(--bg-primary);
}
::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* Base Layout & Header */
.container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 16px;
}

header {
  position: sticky;
  top: 0;
  height: var(--header-height);
  background-color: var(--bg-glass);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-color);
  z-index: 100;
  display: flex;
  align-items: center;
  transition: background-color 0.3s, border-color 0.3s;
}

header .header-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
}

.logo {
  font-family: 'Outfit', sans-serif;
  font-size: 1.5rem;
  font-weight: 800;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  display: flex;
  align-items: center;
  gap: 8px;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 20px;
}

.nav-link {
  color: var(--text-secondary);
  font-weight: 500;
  font-size: 0.95rem;
}
.nav-link:hover {
  color: var(--accent-color);
  text-decoration: none;
}

/* Theme Toggle Button */
.theme-toggle-btn {
  background: none;
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  padding: 8px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  transition: background-color 0.2s, border-color 0.2s, color 0.2s;
}
.theme-toggle-btn:hover {
  background-color: var(--border-color);
  color: var(--text-primary);
}
.theme-toggle-btn svg {
  width: 18px;
  height: 18px;
}
.theme-toggle-btn .sun-icon { display: none; }
[data-theme="dark"] .theme-toggle-btn .sun-icon { display: block; }
[data-theme="dark"] .theme-toggle-btn .moon-icon { display: none; }

/* Scroll Progress Bar */
.scroll-progress-container {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 3px;
  background: transparent;
}
.scroll-progress-bar {
  height: 100%;
  width: 0%;
  background: var(--accent-gradient);
  transition: width 0.1s ease-out;
}

/* Hero Section */
.hero {
  position: relative;
  padding: 30px 0 15px;
  text-align: center;
  overflow: hidden;
}
.hero-bg-blobs {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: -1;
  display: flex;
  justify-content: center;
  gap: 100px;
  opacity: 0.12;
}
[data-theme="dark"] .hero-bg-blobs {
  opacity: 0.22;
}
.hero-blob {
  width: 350px;
  height: 350px;
  border-radius: 50%;
  filter: blur(90px);
  animation: float-blob 8s infinite alternate ease-in-out;
}
.hero-blob-1 {
  background: #8b5cf6;
  animation-delay: 0s;
}
.hero-blob-2 {
  background: #3b82f6;
  animation-delay: 3s;
}
@keyframes float-blob {
  0% { transform: translateY(0) scale(1); }
  100% { transform: translateY(-40px) scale(1.15); }
}

.hero h1 {
  font-size: 2.2rem;
  margin-bottom: 12px;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  letter-spacing: -0.04em;
  line-height: 1.15;
}
.hero p {
  color: var(--text-secondary);
  font-size: 1rem;
  max-width: 550px;
  margin: 0 auto;
}
.blog-stats {
  display: flex;
  justify-content: center;
  gap: 32px;
  margin-top: 24px;
  color: var(--text-muted);
  font-size: 0.95rem;
  font-weight: 500;
}
.blog-stats span {
  display: flex;
  align-items: center;
  gap: 6px;
}
.blog-stats svg {
  width: 16px;
  height: 16px;
}

/* Tab Switcher Styles */
.tabs-container {
  display: flex;
  justify-content: center;
  gap: 16px;
  margin: -10px auto 40px;
  max-width: 500px;
}
.tab-btn {
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  padding: 12px 24px;
  border-radius: 12px;
  font-family: 'Outfit', sans-serif;
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  justify-content: center;
  transition: all 0.25s ease;
  box-shadow: var(--shadow-sm);
}
.tab-btn svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}
.tab-btn:hover {
  border-color: var(--accent-color);
  color: var(--accent-color);
}
.tab-btn.active {
  background: var(--accent-gradient);
  border-color: transparent;
  color: white;
  box-shadow: 0 4px 15px rgba(99, 102, 241, 0.25);
}

/* Search & Tags Section */
.search-filter-section {
  margin-bottom: 30px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.search-box-wrapper {
  position: relative;
  width: 100%;
}
.search-box {
  width: 100%;
  padding: 16px 50px 16px 52px;
  font-size: 1.05rem;
  border-radius: 14px;
  border: 1px solid var(--border-color);
  background-color: var(--bg-secondary);
  color: var(--text-primary);
  box-shadow: var(--shadow-sm);
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.search-box:focus {
  border-color: var(--accent-color);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}
.search-icon {
  position: absolute;
  left: 18px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
}
.search-icon svg {
  width: 20px;
  height: 20px;
}

.search-box-wrapper .clear-icon {
  position: absolute;
  right: 18px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  cursor: pointer;
  font-size: 1.5rem;
  font-weight: bold;
  display: none;
  line-height: 1;
  transition: color 0.2s;
}
.search-box-wrapper .clear-icon:hover {
  color: var(--text-primary);
}

.search-info-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  padding: 12px 20px;
  border-radius: 12px;
  margin-bottom: 24px;
  font-size: 0.95rem;
  color: var(--text-secondary);
  animation: fadeIn 0.2s ease-in-out;
}
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(5px); }
  to { opacity: 1; transform: translateY(0); }
}
.clear-search-btn-bar {
  background: none;
  border: none;
  color: var(--accent-color);
  font-weight: 600;
  cursor: pointer;
  font-size: 0.9rem;
}
.clear-search-btn-bar:hover {
  text-decoration: underline;
}

.search-highlight {
  background-color: rgba(253, 224, 71, 0.35);
  color: inherit;
  padding: 0 2px;
  border-radius: 4px;
}
[data-theme="dark"] .search-highlight {
  background-color: rgba(234, 179, 8, 0.25);
}

/* Sidebar Navigation Panels */
.blog-page-layout, .videos-page-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 30px;
  margin-top: 20px;
}

@media (min-width: 992px) {
  .blog-page-layout, .videos-page-layout {
    grid-template-columns: 250px 1fr;
  }
}

.blog-sidebar, .videos-sidebar {
  display: flex;
  flex-direction: column;
  gap: 8px;
  position: sticky;
  top: calc(var(--header-height) + 20px);
  height: fit-content;
}

.filter-tag, .video-category-btn {
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  padding: 12px 16px;
  border-radius: 10px;
  font-family: 'Outfit', sans-serif;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  transition: all 0.2s ease;
  box-shadow: var(--shadow-sm);
  width: 100%;
  text-align: left;
}

.filter-tag svg, .video-category-btn svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

.filter-tag:hover, .video-category-btn:hover {
  border-color: var(--accent-color);
  color: var(--accent-color);
}

.filter-tag.active, .video-category-btn.active {
  background: var(--accent-gradient);
  border-color: transparent;
  color: white;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.2);
}

.filter-tag .tag-count, .video-category-btn .category-count {
  font-size: 0.75rem;
  background-color: var(--border-color);
  color: var(--text-muted);
  padding: 2px 8px;
  border-radius: 20px;
  transition: all 0.2s;
}

.filter-tag.active .tag-count, .video-category-btn.active .category-count {
  background-color: rgba(255, 255, 255, 0.2);
  color: white;
}

@media (max-width: 991px) {
  .blog-sidebar, .videos-sidebar {
    flex-direction: row;
    overflow-x: auto;
    padding-bottom: 10px;
    position: static;
    scrollbar-width: none;
  }
  .blog-sidebar::-webkit-scrollbar, .videos-sidebar::-webkit-scrollbar {
    display: none;
  }
  .filter-tag, .video-category-btn {
    flex-shrink: 0;
    width: auto;
  }
}

/* Featured Post Layout */
.featured-post-card {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  background-color: var(--bg-secondary);
  border-radius: 20px;
  border: 1px solid var(--border-color);
  overflow: hidden;
  box-shadow: var(--shadow-md);
  margin-bottom: 10px;
  transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s;
}
.featured-post-card:hover {
  transform: var(--card-hover);
  box-shadow: var(--shadow-lg);
  border-color: var(--accent-color);
}
.featured-image-wrapper {
  position: relative;
  width: 100%;
  height: 100%;
  min-height: 380px;
  background: linear-gradient(135deg, #1e1b4b 0%, #311042 100%);
  overflow: hidden;
}
.featured-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s ease;
}
.featured-post-card:hover .featured-image {
  transform: scale(1.03);
}
.featured-badge {
  position: absolute;
  top: 20px;
  left: 20px;
  background: var(--accent-gradient);
  color: white;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  padding: 6px 12px;
  border-radius: 20px;
  letter-spacing: 0.05em;
  box-shadow: 0 4px 10px rgba(99, 102, 241, 0.3);
}
.featured-content {
  padding: 40px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.featured-title {
  font-size: 2.25rem;
  margin-bottom: 16px;
  line-height: 1.2;
}
.featured-title a {
  color: var(--text-primary);
}
.featured-title a:hover {
  color: var(--accent-color);
  text-decoration: none;
}
.featured-excerpt {
  color: var(--text-secondary);
  font-size: 1.05rem;
  margin-bottom: 24px;
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

@media (max-width: 992px) {
  .featured-post-card {
    grid-template-columns: 1fr;
  }
  .featured-image-wrapper {
    min-height: 250px;
    aspect-ratio: 16/9;
  }
  .featured-content {
    padding: 30px;
  }
  .featured-title {
    font-size: 1.75rem;
  }
}

/* Main Post Grid */
.posts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
  gap: 20px;
  margin-bottom: 50px;
}

.post-card {
  background-color: var(--bg-secondary);
  border-radius: 16px;
  border: 1px solid var(--border-color);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  height: 100%;
  transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s;
}
.post-card:hover {
  transform: var(--card-hover);
  box-shadow: var(--shadow-lg);
  border-color: var(--accent-color);
}

/* Performance class for off-screen cards */
.post-card-lazy {
  content-visibility: auto;
  contain-intrinsic-size: auto 450px;
}

.card-image-wrapper {
  position: relative;
  aspect-ratio: 16/9;
  width: 100%;
  background: linear-gradient(135deg, #1e1b4b 0%, #311042 100%);
  overflow: hidden;
}
.card-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s ease;
}
.post-card:hover .card-image {
  transform: scale(1.05);
}
.card-image-fallback {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-family: 'Outfit', sans-serif;
  font-weight: 800;
  font-size: 1.5rem;
  background: var(--accent-gradient);
  opacity: 0.85;
}

.card-content {
  padding: 24px;
  display: flex;
  flex-direction: column;
  flex-grow: 1;
}

.card-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 12px;
}
.card-meta span {
  display: flex;
  align-items: center;
  gap: 4px;
}
.card-meta svg {
  width: 12px;
  height: 12px;
}

.card-title {
  font-size: 1.25rem;
  margin-bottom: 10px;
  line-height: 1.35;
}
.card-title a {
  color: var(--text-primary);
}
.card-title a:hover {
  color: var(--accent-color);
  text-decoration: none;
}

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

.card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.card-tag {
  background-color: var(--bg-primary);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 500;
}

/* Play button overlay on Video Card */
.play-overlay {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 54px;
  height: 54px;
  background-color: rgba(99, 102, 241, 0.9);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  opacity: 0;
  transition: opacity 0.3s ease, transform 0.3s ease;
  box-shadow: 0 4px 15px rgba(99, 102, 241, 0.4);
}
.play-overlay svg {
  width: 22px;
  height: 22px;
  margin-left: 3px;
}
.video-card:hover .play-overlay {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1.1);
}

/* Video Subscribe Shortcut */
.video-subscribe-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background-color: #ef4444;
  color: white !important;
  font-family: 'Outfit', sans-serif;
  font-weight: 700;
  font-size: 0.8rem;
  padding: 6px 12px;
  border-radius: 6px;
  text-decoration: none !important;
  transition: background-color 0.2s ease, transform 0.1s ease;
  box-shadow: 0 2px 6px rgba(239, 68, 68, 0.2);
  margin-top: 10px;
  width: fit-content;
}
.video-subscribe-btn:hover {
  background-color: #dc2626;
  transform: translateY(-1px);
}
.video-subscribe-btn:active {
  transform: translateY(0);
}

/* Pagination */
.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  margin-top: 60px;
  margin-bottom: 160px;
}
.page-btn {
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  width: 40px;
  height: 40px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-weight: 600;
  transition: all 0.2s;
}
.page-btn:hover:not(:disabled) {
  border-color: var(--accent-color);
  color: var(--accent-color);
}
.page-btn.active {
  background: var(--accent-gradient);
  border-color: transparent;
  color: white;
}
.page-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* Blog Post Detail Page */
.post-layout {
  padding: 40px 0 80px;
}
.back-btn-wrapper {
  margin-bottom: 24px;
}
.back-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text-secondary);
  font-weight: 500;
  font-size: 0.95rem;
  padding: 8px 16px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background-color: var(--bg-secondary);
  transition: all 0.2s;
}
.back-btn:hover {
  border-color: var(--accent-color);
  color: var(--accent-color);
  text-decoration: none;
}
.back-btn svg {
  width: 16px;
  height: 16px;
}

.post-header {
  margin-bottom: 32px;
  text-align: center;
}
.post-header-title {
  font-size: 2.75rem;
  margin-bottom: 16px;
  letter-spacing: -0.03em;
}
.post-header-meta {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  gap: 20px;
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: 16px;
}
.post-header-meta span {
  display: flex;
  align-items: center;
  gap: 6px;
}
.post-header-meta svg {
  width: 16px;
  height: 16px;
}

.post-header-tags {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
}

.post-hero-image {
  width: 100%;
  max-height: 480px;
  object-fit: cover;
  border-radius: 16px;
  box-shadow: var(--shadow-md);
  margin-bottom: 40px;
}

.post-content-container {
  display: grid;
  grid-template-columns: 1fr;
  gap: 40px;
}

@media (min-width: 992px) {
  .post-content-container {
    grid-template-columns: 3fr 1fr;
  }
}

.post-main-content {
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 40px;
  box-shadow: var(--shadow-sm);
  font-size: 1.1rem;
  line-height: 1.8;
  color: var(--text-primary);
  overflow-wrap: break-word;
}
.post-main-content p {
  margin-bottom: 24px;
}
.post-main-content h2 {
  font-size: 1.75rem;
  margin: 40px 0 20px;
}
.post-main-content h3 {
  font-size: 1.4rem;
  margin: 30px 0 15px;
}
.post-main-content blockquote {
  border-left: 4px solid var(--accent-color);
  padding-left: 20px;
  font-style: italic;
  color: var(--text-secondary);
  margin: 30px 0;
  background-color: var(--bg-primary);
  padding: 20px;
  border-radius: 0 8px 8px 0;
}
.post-main-content ul, .post-main-content ol {
  margin-bottom: 24px;
  padding-left: 24px;
}
.post-main-content li {
  margin-bottom: 8px;
}
.post-main-content img {
  max-width: 100%;
  height: auto;
  border-radius: 12px;
  margin: 20px auto;
  display: block;
}
.post-main-content code {
  background-color: var(--bg-primary);
  padding: 2px 6px;
  border-radius: 4px;
  font-family: monospace;
  font-size: 0.9em;
}
.post-main-content pre {
  background-color: var(--bg-primary);
  padding: 20px;
  border-radius: 8px;
  overflow-x: auto;
  margin-bottom: 24px;
  border: 1px solid var(--border-color);
}
.post-main-content pre code {
  background-color: transparent;
  padding: 0;
  font-size: 0.9em;
}

/* Table of Contents and Sidebar Widgets */
.post-sidebar {
  display: flex;
  flex-direction: column;
  gap: 30px;
}
.sidebar-widget {
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 24px;
  box-shadow: var(--shadow-sm);
}
.sidebar-widget h3 {
  font-size: 1.15rem;
  margin-bottom: 16px;
  border-bottom: 2px solid var(--border-color);
  padding-bottom: 8px;
}

.toc-links {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.toc-link {
  color: var(--text-secondary);
  font-size: 0.9rem;
  font-weight: 500;
  line-height: 1.4;
  padding: 4px 0 4px 12px;
  border-left: 2px solid transparent;
  transition: all 0.2s ease;
  display: block;
}
.toc-link:hover {
  color: var(--accent-color);
  text-decoration: none;
  padding-left: 16px;
}
.toc-link.active {
  color: var(--accent-color);
  border-left-color: var(--accent-color);
  font-weight: 600;
  padding-left: 16px;
}
.toc-link.toc-h3 {
  padding-left: 24px;
  font-size: 0.85rem;
}
.toc-link.toc-h3:hover, .toc-link.toc-h3.active {
  padding-left: 28px;
}

#toc-widget {
  position: sticky;
  top: calc(var(--header-height) + 20px);
  max-height: calc(100vh - var(--header-height) - 60px);
  overflow-y: auto;
}

.share-links {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.share-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  background-color: var(--bg-primary);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  padding: 10px 16px;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}
.share-btn:hover {
  background-color: var(--border-color);
  color: var(--text-primary);
}
.share-btn svg {
  width: 16px;
  height: 16px;
}

/* Figure & Figure Captions styling */
.post-figure {
  margin: 28px 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}
.post-figure a {
  display: block;
  max-width: 100%;
}
.post-figure img {
  max-width: 100%;
  height: auto;
  border-radius: 12px;
  box-shadow: var(--shadow-md);
}
.post-figcaption {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-style: italic;
  text-align: center;
  max-width: 80%;
}

/* Code block wrapper and copy button */
.code-block-wrapper {
  position: relative;
  margin-bottom: 24px;
}
.code-block-wrapper pre {
  margin-bottom: 0;
}
.copy-code-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  padding: 6px 12px;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: 6px;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.2s, background-color 0.2s, color 0.2s;
  z-index: 10;
}
.code-block-wrapper:hover .copy-code-btn {
  opacity: 1;
}
.copy-code-btn:hover {
  background-color: var(--border-color);
  color: var(--text-primary);
}
.copy-code-btn.copied {
  background-color: #10b981;
  color: white;
  border-color: #10b981;
}

/* Lightbox Modal */
.lightbox-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: rgba(11, 15, 25, 0.9);
  backdrop-filter: blur(8px);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.3s ease;
  cursor: zoom-out;
}
.lightbox-overlay.active {
  opacity: 1;
}
.lightbox-img {
  max-width: 90%;
  max-height: 80%;
  border-radius: 12px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
  transform: scale(0.95);
  transition: transform 0.3s ease;
  cursor: default;
}
.lightbox-overlay.active .lightbox-img {
  transform: scale(1);
}
.lightbox-close {
  position: absolute;
  top: 24px;
  right: 24px;
  color: white;
  background: none;
  border: none;
  font-size: 2.5rem;
  cursor: pointer;
  line-height: 1;
  opacity: 0.7;
  transition: opacity 0.2s;
}
.lightbox-close:hover {
  opacity: 1;
}

/* Embedded Video Player Styles */
.lightbox-video-container {
  width: 85%;
  max-width: 800px;
  aspect-ratio: 16/9;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.55);
  background-color: #000;
  transform: scale(0.95);
  transition: transform 0.3s ease;
}
.lightbox-overlay.active .lightbox-video-container {
  transform: scale(1);
}
.lightbox-video {
  width: 100%;
  height: 100%;
  border: none;
}

@media (max-width: 768px) {
  .lightbox-video-container {
    width: 95%;
  }
}

/* Related Posts Section */
.related-posts-section {
  margin-top: 60px;
  padding-top: 40px;
  border-top: 1px solid var(--border-color);
}
.related-posts-section h2 {
  font-size: 1.75rem;
  margin-bottom: 30px;
}

/* Footer styling */
footer {
  border-top: 1px solid var(--border-color);
  background-color: var(--bg-secondary);
  padding: 40px 0;
  color: var(--text-muted);
  text-align: center;
  font-size: 0.9rem;
}
footer p {
  margin-bottom: 8px;
}

/* Responsive adjust */
@media (max-width: 768px) {
  .hero h1 {
    font-size: 2.5rem;
  }
  .post-header-title {
    font-size: 2rem;
  }
  .post-main-content {
    padding: 24px;
  }
  .tabs-container {
    flex-direction: row;
    gap: 10px;
    padding: 0 10px;
  }
  .tab-btn {
    padding: 10px 16px;
    font-size: 0.9rem;
  }
}

/* Standalone Page Layout */
.page-layout {
  padding: 40px 0 80px;
  max-width: 800px;
  margin: 0 auto;
}
.page-header {
  margin-bottom: 30px;
  text-align: center;
}
.page-title {
  font-family: 'Outfit', sans-serif;
  font-size: 2.5rem;
  font-weight: 800;
  line-height: 1.2;
  margin-bottom: 8px;
  color: var(--text-primary);
}
.page-content {
  font-size: 1.05rem;
  line-height: 1.75;
  color: var(--text-secondary);
}
.page-content p {
  margin-bottom: 1.5rem;
}
.page-content h2 {
  font-family: 'Outfit', sans-serif;
  font-size: 1.6rem;
  font-weight: 700;
  margin: 2.5rem 0 1rem 0;
  color: var(--text-primary);
}
.page-content ul, .page-content ol {
  margin-bottom: 1.5rem;
  padding-left: 20px;
}
.page-content li {
  margin-bottom: 0.5rem;
}

/* Compact Scroll-free view for Interactive Tools/Games */
.game-page.page-layout {
  padding: 10px 0 30px !important;
}
.game-page .page-header {
  margin-bottom: 12px !important;
}
.game-page .page-title {
  font-size: 1.6rem !important;
}

/* Top line search display configurations */
#header-search-container {
  display: block !important;
}
.header-Dashboard #header-search-container {
  display: none !important;
}

/* Premium Glowing Borders */
.post-card, .sidebar-widget, .search-box, .tab-btn, .cell, .mode-btn, .reset-btn, .spin-button {
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1) !important;
}
.post-card:hover, .sidebar-widget:hover, .search-box:focus, .tab-btn.active, .cell:hover, .mode-btn.active {
  border-color: #8b5cf6 !important;
  box-shadow: 0 0 12px rgba(139, 92, 246, 0.25) !important;
}
[data-theme="dark"] .post-card:hover,
[data-theme="dark"] .sidebar-widget:hover,
[data-theme="dark"] .search-box:focus,
[data-theme="dark"] .tab-btn.active,
[data-theme="dark"] .cell:hover,
[data-theme="dark"] .mode-btn.active {
  box-shadow: 0 0 16px rgba(139, 92, 246, 0.45) !important;
}

@media (max-width: 768px) {
  .page-title {
    font-size: 2rem;
  }
}

/* Mobile Responsive Header, Grid and Games fixes */
@media (max-width: 600px) {
  header .header-content {
    flex-direction: column !important;
    gap: 12px !important;
    align-items: stretch !important;
    padding: 10px 16px !important;
  }
  .logo-search-wrapper {
    flex-direction: column !important;
    gap: 10px !important;
    width: 100% !important;
    align-items: stretch !important;
  }
  .header-search-box-wrapper {
    width: 100% !important;
  }
  .nav-links {
    width: 100% !important;
    justify-content: space-around !important;
    padding-top: 8px !important;
    border-top: 1px solid var(--border-color);
  }
  /* Grid padding adjustments */
  .posts-grid {
    grid-template-columns: 1fr !important;
    gap: 16px !important;
  }
  .post-card {
    border-radius: 12px !important;
  }
  /* Responsive Game Views scales to fit container width without scroll */
  .bottle-container, #tictactoe-game, .coin-container {
    max-width: 100% !important;
    overflow-x: hidden !important;
  }
  #tictactoe-game .board {
    gap: 6px !important;
    padding: 6px !important;
  }
  #tictactoe-game .cell {
    font-size: 2.2rem !important;
  }
}
