﻿/**
 * ShadxBlog Core Stylesheet & Complete Layout Utilities
 * 
 * Complete responsive grid, layout utilities, typography, and Shadcn component archetypes.
 * Pure Vanilla CSS - Zero Framework Dependencies.
 * 
 * @package ShadxBlog
 */

/* ==========================================================================
   1. RESET & BASE BOX-SIZING
   ========================================================================== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  -webkit-text-size-adjust: 100%;
  tab-size: 4;
  scroll-behavior: smooth;
  scrollbar-width: thin;
  scrollbar-color: var(--scrollbar-thumb) var(--scrollbar-track);
}

/* Global Modern Thin Compositor Scrollbars (Zero Lag / Pure CSS) */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--scrollbar-thumb) var(--scrollbar-track);
}

::-webkit-scrollbar {
  width: var(--scrollbar-size, 6px);
  height: var(--scrollbar-size, 6px);
}

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

::-webkit-scrollbar-thumb {
  background-color: var(--scrollbar-thumb);
  border-radius: 9999px;
  border: 1px solid transparent;
  background-clip: padding-box;
}

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

::-webkit-scrollbar-corner {
  background: transparent;
}

body {
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: var(--leading-relaxed);
  color: var(--foreground);
  background-color: var(--background);
  min-height: 100vh;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Accessible Focus Rings */
:focus-visible {
  outline: 2px solid var(--ring);
  outline-offset: 2px;
}

/* Accessible Skip to Content Link */
.skip-to-content {
  position: absolute;
  top: -100px;
  left: 1rem;
  background: var(--foreground);
  color: var(--background);
  padding: 0.5rem 1rem;
  border-radius: var(--radius-badge);
  font-size: var(--text-sm);
  font-weight: 600;
  z-index: 10000;
  transition: top var(--transition-fast);
  text-decoration: none;
}
.skip-to-content:focus {
  top: 1rem;
}

/* ==========================================================================
   2. TYPOGRAPHY & LINKS
   ========================================================================== */
h1, h2, h3, h4, h5, h6 {
  color: var(--foreground);
  font-weight: 700;
  letter-spacing: var(--tracking-tight);
  line-height: var(--leading-tight);
}

h1 { font-size: var(--text-4xl); }
h2 { font-size: var(--text-2xl); }
h3 { font-size: var(--text-xl); }
h4 { font-size: var(--text-lg); }

p {
  margin-bottom: var(--space-md);
}

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

ul, ol {
  list-style: none;
  margin: 0;
  padding: 0;
}

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

/* In-text hyperlinks: hover states strictly restricted to Electric Blue */
.prose a, .link-accent {
  color: var(--foreground);
  text-decoration: underline;
  text-decoration-color: var(--border);
  text-underline-offset: 4px;
  transition: all var(--transition-fast);
}

.prose a:hover, .link-accent:hover {
  color: var(--brand-blue);
  text-decoration-color: var(--brand-blue);
}

/* ==========================================================================
   Terminal-Grade Code Block Container & Copy Header
   ========================================================================== */
.code-block-container {
  margin: 1.75rem 0;
  border-radius: var(--radius-card);
  border: 1px solid var(--border);
  background-color: var(--card);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: border-color var(--transition-fast);
}

.code-block-container:hover {
  border-color: var(--border-hover);
}

.code-block-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 0.875rem;
  background-color: var(--background-subtle);
  border-bottom: 1px solid var(--border);
  user-select: none;
}

.code-header-left {
  display: flex;
  align-items: center;
  gap: 0.625rem;
}

.code-terminal-dots {
  display: flex;
  align-items: center;
  gap: 0.375rem;
}

.code-dot {
  width: 9px;
  height: 9px;
  border-radius: 9999px;
  opacity: 0.7;
  transition: opacity var(--transition-fast);
}

.code-block-container:hover .code-dot {
  opacity: 1;
}

.dot-red { background-color: #ef4444; }
.dot-yellow { background-color: #f59e0b; }
.dot-green { background-color: #10b981; }

.code-lang-label {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  color: var(--foreground-muted);
}

.code-copy-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.25rem 0.625rem;
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  font-weight: 500;
  color: var(--foreground-muted);
  background-color: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-badge);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.code-copy-btn:hover {
  color: var(--foreground);
  background-color: var(--background);
  border-color: var(--border);
}

.code-copy-btn.copied {
  color: #10b981;
  background-color: rgba(16, 185, 129, 0.1);
  border-color: rgba(16, 185, 129, 0.3);
}

.code-block-container pre {
  margin: 0 !important;
  padding: 1.125rem 1.25rem !important;
  background-color: transparent !important;
  border: none !important;
  border-radius: 0 !important;
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  line-height: 1.7;
  color: var(--foreground);
}

.code-block-container code {
  font-family: inherit;
  font-size: inherit;
  background: transparent !important;
  padding: 0 !important;
  border: none !important;
}

/* ==========================================================================
   3. COMPLETE LAYOUT & FLEX/GRID UTILITIES (Replaces Tailwind)
   ========================================================================== */
.container {
  width: 100%;
  max-width: var(--content-max-width);
  margin-left: auto;
  margin-right: auto;
  padding-left: var(--space-md);
  padding-right: var(--space-md);
}

.prose-container {
  max-width: var(--prose-max-width);
  margin-left: auto;
  margin-right: auto;
}

/* Display & Flexbox */
.block { display: block; }
.hidden { display: none !important; }
.flex { display: flex; }
.inline-flex { display: inline-flex; }
.flex-col { flex-direction: column; }
.flex-row { flex-direction: row; }
.flex-wrap { flex-wrap: wrap; }
.flex-grow { flex-grow: 1; }
.flex-shrink-0 { flex-shrink: 0; }

.items-start { align-items: flex-start; }
.items-center { align-items: center; }
.items-stretch { align-items: stretch; }

.justify-start { justify-content: flex-start; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.justify-end { justify-content: flex-end; }

/* Dimensions & Sizing Utilities */
.w-full { width: 100%; }
.h-full { height: 100%; }
.w-auto { width: auto; }
.h-auto { height: auto; }
.w-2 { width: 0.5rem; }
.h-2 { height: 0.5rem; }
.w-2\.5 { width: 0.625rem; }
.h-2\.5 { height: 0.625rem; }
.w-3 { width: 0.75rem; }
.h-3 { height: 0.75rem; }
.w-3\.5 { width: 0.875rem; }
.h-3\.5 { height: 0.875rem; }
.w-4 { width: 1rem; }
.h-4 { height: 1rem; }
.w-5 { width: 1.25rem; }
.h-5 { height: 1.25rem; }
.w-6 { width: 1.5rem; }
.h-6 { height: 1.5rem; }
.w-8 { width: 2rem; }
.h-8 { height: 2rem; }
.w-10 { width: 2.5rem; }
.h-10 { height: 2.5rem; }
.w-12 { width: 3rem; }
.h-12 { height: 3rem; }
.w-14 { width: 3.5rem; }
.h-14 { height: 3.5rem; }
.w-16 { width: 4rem; }
.h-16 { height: 4rem; }

/* SVG Lucide Vector Icons */
svg.lucide-icon {
  display: inline-block;
  vertical-align: middle;
  flex-shrink: 0;
}
svg.lucide-icon.w-2\.5, svg.lucide-icon.h-2\.5 { width: 0.625rem; height: 0.625rem; }
svg.lucide-icon.w-3, svg.lucide-icon.h-3 { width: 0.75rem; height: 0.75rem; }
svg.lucide-icon.w-3\.5, svg.lucide-icon.h-3\.5 { width: 0.875rem; height: 0.875rem; }
svg.lucide-icon.w-4, svg.lucide-icon.h-4 { width: 1rem; height: 1rem; }
svg.lucide-icon.w-5, svg.lucide-icon.h-5 { width: 1.25rem; height: 1.25rem; }
svg.lucide-icon.w-6, svg.lucide-icon.h-6 { width: 1.5rem; height: 1.5rem; }
svg.lucide-icon.w-8, svg.lucide-icon.h-8 { width: 2rem; height: 2rem; }

/* Grid & Responsive Display Utilities */
.grid { display: grid; }
.grid-cols-1 { grid-template-columns: repeat(1, minmax(0, 1fr)); }

@media (min-width: 640px) {
  .sm\:grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sm\:flex-row { flex-direction: row; }
  .sm\:w-36 { width: 9rem; }
  .sm\:w-56 { width: 14rem; }
  .sm\:inline { display: inline !important; }
  .sm\:inline-flex { display: inline-flex !important; }
  .sm\:flex { display: flex !important; }
  .sm\:block { display: block !important; }
  .sm\:hidden { display: none !important; }
}

@media (min-width: 768px) {
  .md\:grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .md\:grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .md\:flex { display: flex !important; }
  .md\:block { display: block !important; }
  .md\:hidden { display: none !important; }
}

@media (min-width: 1024px) {
  .lg\:grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .lg\:grid-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .lg\:grid-cols-12 { grid-template-columns: repeat(12, minmax(0, 1fr)); }
  .lg\:col-span-4 { grid-column: span 4 / span 4; }
  .lg\:col-span-5 { grid-column: span 5 / span 5; }
  .lg\:col-span-7 { grid-column: span 7 / span 7; }
  .lg\:col-span-8 { grid-column: span 8 / span 8; }
  .lg\:flex { display: flex !important; }
  .lg\:inline-flex { display: inline-flex !important; }
  .lg\:block { display: block !important; }
  .lg\:grid { display: grid !important; }
  .lg\:hidden { display: none !important; }
}

/* Spacings & Gaps */
.gap-1 { gap: 0.25rem; }
.gap-1\.5 { gap: 0.375rem; }
.gap-2 { gap: var(--space-xs); }
.gap-2\.5 { gap: 0.625rem; }
.gap-3 { gap: var(--space-sm); }
.gap-4 { gap: var(--space-md); }
.gap-5 { gap: 1.25rem; }
.gap-6 { gap: var(--space-lg); }
.gap-8 { gap: var(--space-xl); }
.gap-10 { gap: 2.5rem; }
.gap-12 { gap: 3rem; }

.space-y-1 > * + * { margin-top: 0.25rem; }
.space-y-1\.5 > * + * { margin-top: 0.375rem; }
.space-y-2 > * + * { margin-top: 0.5rem; }
.space-y-2\.5 > * + * { margin-top: 0.625rem; }
.space-y-3 > * + * { margin-top: 0.75rem; }
.space-y-4 > * + * { margin-top: 1rem; }
.space-y-6 > * + * { margin-top: 1.5rem; }
.space-y-8 > * + * { margin-top: 2rem; }
.space-y-10 > * + * { margin-top: 2.5rem; }
.space-y-12 > * + * { margin-top: 3rem; }

.space-x-2 > * + * { margin-left: 0.5rem; }
.space-x-4 > * + * { margin-left: 1rem; }

.p-0 { padding: 0; }
.p-2 { padding: 0.5rem; }
.p-3 { padding: 0.75rem; }
.p-4 { padding: 1rem; }
.p-5 { padding: 1.25rem; }
.p-6 { padding: 1.5rem; }
.p-8 { padding: 2rem; }
.p-10 { padding: 2.5rem; }
.p-12 { padding: 3rem; }

.p-3\.5 { padding: 0.875rem; }
.px-2 { padding-left: 0.5rem; padding-right: 0.5rem; }
.px-2\.5 { padding-left: 0.625rem; padding-right: 0.625rem; }
.px-3 { padding-left: 0.75rem; padding-right: 0.75rem; }
.px-3\.5 { padding-left: 0.875rem; padding-right: 0.875rem; }
.px-4 { padding-left: 1rem; padding-right: 1rem; }
.px-6 { padding-left: 1.5rem; padding-right: 1.5rem; }

.py-0\.5 { padding-top: 0.125rem; padding-bottom: 0.125rem; }
.py-1 { padding-top: 0.25rem; padding-bottom: 0.25rem; }
.py-1\.5 { padding-top: 0.375rem; padding-bottom: 0.375rem; }
.py-2 { padding-top: 0.5rem; padding-bottom: 0.5rem; }
.py-2\.5 { padding-top: 0.625rem; padding-bottom: 0.625rem; }
.py-4 { padding-top: 1rem; padding-bottom: 1rem; }
.py-6 { padding-top: 1.5rem; padding-bottom: 1.5rem; }
.py-8 { padding-top: 2rem; padding-bottom: 2rem; }
.py-10 { padding-top: 2.5rem; padding-bottom: 2.5rem; }
.py-12 { padding-top: 3rem; padding-bottom: 3rem; }
.py-16 { padding-top: 4rem; padding-bottom: 4rem; }
.py-20 { padding-top: 5rem; padding-bottom: 5rem; }

.pt-0\.5 { padding-top: 0.125rem; }
.pt-1 { padding-top: 0.25rem; }
.pt-2 { padding-top: 0.5rem; }
.pt-2\.5 { padding-top: 0.625rem; }
.pt-3 { padding-top: 0.75rem; }
.pt-4 { padding-top: 1rem; }
.pt-6 { padding-top: 1.5rem; }
.pt-8 { padding-top: 2rem; }
.pt-24 { padding-top: 6rem; }
.pb-0\.5 { padding-bottom: 0.125rem; }
.pb-1 { padding-bottom: 0.25rem; }
.pb-2 { padding-bottom: 0.5rem; }
.pb-2\.5 { padding-bottom: 0.625rem; }
.pb-3 { padding-bottom: 0.75rem; }
.pb-3\.5 { padding-bottom: 0.875rem; }
.pb-4 { padding-bottom: 1rem; }
.pb-6 { padding-bottom: 1.5rem; }

.m-0 { margin: 0; }
.my-6 { margin-top: 1.5rem; margin-bottom: 1.5rem; }
.my-8 { margin-top: 2rem; margin-bottom: 2rem; }
.my-10 { margin-top: 2.5rem; margin-bottom: 2.5rem; }
.mx-auto { margin-left: auto; margin-right: auto; }
.mt-auto { margin-top: auto; }
.mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-4 { margin-top: 1rem; }
.mt-12 { margin-top: 3rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-3 { margin-bottom: 0.75rem; }
.mb-4 { margin-bottom: 1rem; }
.mb-6 { margin-bottom: 1.5rem; }
.ml-auto { margin-left: auto; }
.mr-1 { margin-right: 0.25rem; }
.mr-2 { margin-right: 0.5rem; }
.mr-3 { margin-right: 0.75rem; }

.w-full { width: 100%; }
.h-full { height: 100%; }
.w-4 { width: 1rem; }
.h-4 { height: 1rem; }
.w-5 { width: 1.25rem; }
.h-5 { height: 1.25rem; }
.w-6 { width: 1.5rem; }
.h-6 { height: 1.5rem; }
.w-7 { width: 1.75rem; }
.h-7 { height: 1.75rem; }
.w-8 { width: 2rem; }
.h-8 { height: 2rem; }
.h-16 { height: 4rem; }
.h-36 { height: 9rem; }
.h-40 { height: 10rem; }
.max-w-xl { max-width: 36rem; }
.max-w-lg { max-width: 32rem; }
.max-w-2xl { max-width: 42rem; }

/* Positioning */
.relative { position: relative; }
.absolute { position: absolute; }
.fixed { position: fixed; }
.sticky { position: sticky; }
.top-0 { top: 0; }
.top-2 { top: 0.5rem; }
.top-3 { top: 0.75rem; }
.top-20 { top: 5rem; }
.top-24 { top: 6rem; }
.right-2 { right: 0.5rem; }
.right-3 { right: 0.75rem; }
.inset-0 { top: 0; right: 0; bottom: 0; left: 0; }
.z-50 { z-index: 50; }

/* Sizing & Aspect Ratios */
.aspect-video { aspect-ratio: 16 / 9; }
.object-cover { object-fit: cover; }
.overflow-hidden { overflow: hidden; }
.overflow-y-auto { overflow-y: auto; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.line-clamp-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.line-clamp-3 {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Rounded */
.rounded-md { border-radius: 6px; }
.rounded-lg { border-radius: 8px; }
.rounded-full { border-radius: 9999px; }

/* Borders & Separators */
.border { border: 1px solid var(--border); }
.border-b { border-bottom: 1px solid var(--border); }
.border-t { border-top: 1px solid var(--border); }
.border-y { border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.border-border { border-color: var(--border); }
.divide-y > * + * { border-top: 1px solid var(--border); }

/* Backdrop Blur */
.backdrop-blur-md { backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); }
.backdrop-blur-sm { backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); }

/* Colors & Text Utilities */
.text-foreground { color: var(--foreground); }
.text-foreground-muted { color: var(--foreground-muted); }
.text-background { color: var(--background); }
.text-brand-blue { color: var(--brand-blue); }

.bg-background { background-color: var(--background); }
.bg-background\/80 { background-color: rgba(255, 255, 255, 0.85); }
[data-theme="dark"] .bg-background\/80 { background-color: rgba(9, 9, 11, 0.85); }

.bg-background-subtle { background-color: var(--background-subtle); }
.bg-background-muted { background-color: var(--background-muted); }
.bg-card { background-color: var(--card); }
.bg-foreground { background-color: var(--foreground); }

.text-\[10px\] { font-size: 0.625rem; line-height: 0.875rem; }
.text-\[11px\] { font-size: 0.6875rem; line-height: 1rem; }
.text-xs { font-size: var(--text-xs); }
.text-sm { font-size: var(--text-sm); }
.text-base { font-size: var(--text-base); }
.text-lg { font-size: var(--text-lg); }
.text-xl { font-size: var(--text-xl); }
.text-2xl { font-size: var(--text-2xl); }
.text-3xl { font-size: var(--text-3xl); }
.text-4xl { font-size: var(--text-4xl); }
.text-5xl { font-size: clamp(2.5rem, 2rem + 2.5vw, 3.75rem); }

/* Border Radius Utilities */
.rounded-none { border-radius: 0; }
.rounded-sm { border-radius: var(--radius-sm); }
.rounded { border-radius: var(--radius-input); }
.rounded-md { border-radius: var(--radius-input); }
.rounded-lg { border-radius: var(--radius-card); }
.rounded-xl { border-radius: 0.75rem; }
.rounded-full { border-radius: 9999px; }

.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }
.font-extrabold { font-weight: 800; }
.font-black { font-weight: 900; }
.font-mono { font-family: var(--font-mono); }
.uppercase { text-transform: uppercase; }
.tracking-tight { letter-spacing: var(--tracking-tight); }
.tracking-wider { letter-spacing: 0.05em; }
.text-center { text-align: center; }
.text-right { text-align: right; }

/* Transitions */
.transition-colors { transition: color var(--transition-fast), background-color var(--transition-fast), border-color var(--transition-fast); }
.transition-all { transition: all var(--transition-fast); }
.transition-transform { transition: transform var(--transition-normal); }

/* ==========================================================================
   4. SHADCN UI COMPONENT ARCHETYPES
   ========================================================================== */

/* 4.1 Cards */
.card {
  background-color: var(--card);
  color: var(--card-foreground);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-sm);
  transition: border-color var(--transition-normal), box-shadow var(--transition-normal);
  overflow: hidden;
}

.card:hover {
  border-color: var(--border-hover);
  box-shadow: var(--shadow-md);
}

/* 4.2 Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-xs);
  border-radius: var(--radius-button);
  font-size: var(--text-sm);
  font-weight: 500;
  padding: 0.5rem 1rem;
  min-height: 40px;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all var(--transition-fast);
  text-decoration: none;
}

.btn-primary {
  background-color: var(--brand-blue);
  color: var(--brand-blue-foreground);
}
.btn-primary:hover {
  background-color: var(--brand-blue-hover);
}

.btn-outline {
  background-color: transparent;
  border-color: var(--border);
  color: var(--foreground);
}
.btn-outline:hover {
  background-color: var(--background-subtle);
  border-color: var(--border-hover);
}

.btn-ghost {
  background-color: transparent;
  color: var(--foreground-muted);
}
.btn-ghost:hover {
  background-color: var(--background-subtle);
  color: var(--foreground);
}

.btn-icon {
  width: 40px;
  height: 40px;
  padding: 0;
  border-radius: var(--radius-button);
}

/* 4.3 Badges / Category Pills */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0.65rem;
  border-radius: var(--radius-badge);
  font-size: var(--text-xs);
  font-weight: 500;
  line-height: 1;
  background-color: var(--background-subtle);
  color: var(--foreground-muted);
  border: 1px solid var(--border);
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.badge:hover {
  color: var(--foreground);
  border-color: var(--border-hover);
}

/* 4.3.1 Scoped Micro-Badge & Meta Padding for Related Stories 4-Card Grid Only */
.related-stories-section .badge {
  font-size: 0.6875rem !important; /* 11px - compact & refined */
  padding: 0.15rem 0.45rem !important;
  font-weight: 500;
  line-height: 1.15 !important;
  letter-spacing: 0.01em;
  border-radius: var(--radius-badge);
}

.related-stories-section .related-card-meta {
  padding: 0.625rem 0.875rem 0.75rem !important; /* 10px top, 14px horizontal, 12px bottom */
  border-top: 1px solid var(--border) !important;
}

/* 4.4 Alerts / Key Takeaways Box (GEO Direct Answer) */
.alert {
  padding: 1.25rem;
  border-radius: var(--radius-card);
  border: 1px solid var(--border);
  background-color: var(--background-subtle);
  margin-bottom: var(--space-lg);
}

.alert-takeaways {
  display: block;
}

.alert-takeaways .alert-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.alert-icon {
  color: var(--brand-blue);
  flex-shrink: 0;
}

.alert-title {
  font-size: var(--text-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--foreground);
  margin: 0;
}

.alert-body {
  font-size: var(--text-sm);
  color: var(--foreground-muted);
  line-height: var(--leading-normal);
}

/* Table of Contents Component */
.toc-container {
  padding: 1.25rem;
  border-radius: var(--radius-card);
}
.toc-list {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  margin: 0;
  padding: 0;
  list-style: none;
}
.toc-item {
  margin: 0;
  padding: 0;
}
.toc-link {
  display: block;
  font-size: 0.8125rem; /* 13px */
  line-height: 1.35;
  padding: 0.35rem 0.5rem;
  border-radius: var(--radius-input);
  color: var(--foreground-muted);
  transition: color var(--transition-fast), background-color var(--transition-fast);
}
.toc-link:hover {
  color: var(--foreground);
  background-color: var(--background-subtle);
}
.toc-link.text-foreground {
  color: var(--brand-blue) !important;
  font-weight: 600 !important;
  background-color: var(--brand-blue-subtle) !important;
}

/* Empty Comments Box */
.empty-comments-state {
  border-radius: var(--radius-card);
}

/* 4.5 Reading Progress Indicator (Fixed 2px Top Line) */
#reading-progress-bar {
  position: fixed;
  top: 0;
  left: 0;
  width: 0%;
  height: 2px;
  background-color: var(--brand-blue);
  z-index: 10001;
  transition: width 50ms linear;
}

/* 4.6 Comments & Community Discussion */
.comments-area {
  scroll-margin-top: 5rem;
}

.comment-list {
  list-style: none !important;
  margin: 0 !important;
  padding: 0 !important;
}

.comment-item {
  list-style: none !important;
  position: relative;
}

/* Parent Comment Card */
.comment-item > .comment-card {
  padding: 1.125rem 1.25rem;
  border-radius: var(--radius-card);
  border: 1px solid var(--border);
  background: var(--card);
  box-shadow: var(--shadow-sm);
}

/* Reply Action Button (Strict var(--radius-button)) */
.comment-item .comment-reply-link {
  display: inline-flex !important;
  align-items: center !important;
  gap: 0.35rem !important;
  padding: 0.25rem 0.65rem !important;
  font-size: var(--text-xs) !important;
  font-weight: 600 !important;
  color: var(--foreground-muted) !important;
  background: var(--background-subtle) !important;
  border: 1px solid var(--border) !important;
  border-radius: var(--radius-button) !important;
  text-decoration: none !important;
  transition: all var(--transition-fast) !important;
}

.comment-item .comment-reply-link:hover {
  color: var(--foreground) !important;
  background: var(--card) !important;
  border-color: var(--border-hover) !important;
}

/* Child Replies Container (Indented Facebook-style threaded branch) */
.comment-item ul.children {
  list-style: none !important;
  margin: 0.75rem 0 0 0.875rem !important;
  padding: 0 0 0 1rem !important;
  border-left: 2px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

@media (min-width: 640px) {
  .comment-item ul.children {
    margin-left: 1.5rem !important;
    padding-left: 1.25rem !important;
    border-left-color: rgba(37, 99, 235, 0.25);
  }
}

/* Nested Child Comment Card */
.comment-item ul.children .comment-card {
  padding: 0.875rem 1rem !important;
  border-radius: var(--radius-card) !important;
  border: 1px solid var(--border) !important;
  background: var(--background-subtle) !important;
  box-shadow: none !important;
}

/* Load More Replies Toggle Button (Facebook Style Branch Link) */
.load-more-replies-btn {
  background: transparent !important;
  border: none !important;
  color: var(--brand-blue) !important;
  font-size: var(--text-xs) !important;
  font-weight: 600 !important;
  padding: 0.35rem 0.5rem !important;
  cursor: pointer !important;
  display: inline-flex !important;
  align-items: center !important;
  gap: 0.35rem !important;
  border-radius: var(--radius-button) !important;
  transition: all var(--transition-fast) !important;
  width: fit-content !important;
}
.load-more-replies-btn:hover {
  text-decoration: underline !important;
  background: var(--brand-blue-subtle) !important;
}

/* Inline Reply Form Seamlessly Embedded Inside Parent Comment Card */
.comment-card #respond,
.comment-card .comment-respond,
.comment-item > .comment-respond {
  margin: 0.875rem 0 0 0 !important;
  padding: 0.875rem 0 0 0 !important;
  background: transparent !important;
  border: none !important;
  border-top: 1px solid var(--border) !important;
  border-radius: 0 !important;
  box-shadow: none !important;
}

.comment-card #respond .comment-reply-title,
.comment-item > .comment-respond .comment-reply-title {
  font-size: var(--text-xs) !important;
  font-weight: 700 !important;
  color: var(--foreground) !important;
  margin-bottom: 0.625rem !important;
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
}

/* Hide Cancel Link inside title heading */
#reply-title #cancel-comment-reply-link {
  display: none !important;
}

.comment-card #respond .comment-field-wrap,
.comment-item > .comment-respond .comment-field-wrap {
  margin-bottom: 0.75rem !important;
  width: 100% !important;
  box-sizing: border-box !important;
}

.comment-card #respond .comment-field-wrap textarea,
.comment-item > .comment-respond .comment-field-wrap textarea,
.comment-form textarea,
.comment-respond textarea {
  min-height: 64px !important;
  padding: 0.625rem 0.875rem !important;
  font-size: 0.8125rem !important;
  border-radius: 8px !important;
  background: var(--background) !important;
  border: 1px solid var(--border) !important;
  box-sizing: border-box !important;
  width: 100% !important;
  max-width: 100% !important;
  display: block !important;
  line-height: var(--leading-normal) !important;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast) !important;
}

.comment-form input[type="text"],
.comment-form input[type="email"],
.comment-respond input[type="text"],
.comment-respond input[type="email"] {
  box-sizing: border-box !important;
  width: 100% !important;
  max-width: 100% !important;
  height: 38px !important;
  border-radius: 8px !important;
  border: 1px solid var(--border) !important;
  padding: 0 0.75rem !important;
  font-size: 0.8125rem !important;
  background: var(--background) !important;
}

.comment-form p.form-submit,
.comment-form .form-submit,
.comment-respond .form-submit {
  margin-top: 0.75rem !important;
  margin-bottom: 0 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: flex-end !important;
  gap: 0.625rem !important;
}

/* Cancel Reply Button Beside Submit Button (Identical Size & Alignment) */
.form-submit #cancel-comment-reply-link,
#cancel-comment-reply-link {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  height: 36px !important;
  min-height: 36px !important;
  max-height: 36px !important;
  padding: 0 1.125rem !important;
  font-size: 0.8125rem !important;
  font-weight: 600 !important;
  border-radius: var(--radius-button) !important;
  border: 1px solid var(--border) !important;
  background: var(--background-subtle) !important;
  color: var(--foreground-muted) !important;
  text-decoration: none !important;
  line-height: 1 !important;
  box-sizing: border-box !important;
  transition: all var(--transition-fast) !important;
  cursor: pointer !important;
}

.form-submit #cancel-comment-reply-link:hover,
#cancel-comment-reply-link:hover {
  color: var(--foreground) !important;
  background: var(--card) !important;
  border-color: var(--border-hover) !important;
}

.form-submit #submit,
.comment-respond #submit {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  height: 36px !important;
  min-height: 36px !important;
  max-height: 36px !important;
  padding: 0 1.25rem !important;
  font-size: 0.8125rem !important;
  font-weight: 600 !important;
  border-radius: var(--radius-button) !important;
  border: 1px solid transparent !important;
  background-color: var(--brand-blue) !important;
  color: #ffffff !important;
  line-height: 1 !important;
  box-sizing: border-box !important;
  cursor: pointer !important;
  transition: all var(--transition-fast) !important;
}

.form-submit #submit:hover,
.comment-respond #submit:hover {
  background-color: var(--brand-blue-hover) !important;
}

/* Comment Header Author Info Spacing */
.comment-card header time {
  display: inline-block !important;
  line-height: 1.2 !important;
}

.comment-form-wrapper form {
  margin: 0;
}
.aspect-video {
  aspect-ratio: 16 / 9;
}
.aspect-square {
  aspect-ratio: 1 / 1;
}

/* ==========================================================================
   5. DEDICATED LAYOUT COMPONENTS (Header, Search, Navigation, Drawer)
   ========================================================================== */

/* 5.1 Primary Navigation (Desktop) */
.primary-nav {
  display: none;
}
@media (min-width: 1024px) {
  .primary-nav {
    display: flex !important;
    align-items: center;
    gap: 0.25rem;
  }
}
.primary-nav ul,
.mobile-drawer ul,
.site-footer ul {
  list-style: none !important;
  margin: 0 !important;
  padding: 0 !important;
}
.primary-nav ul li,
.mobile-drawer ul li,
.site-footer ul li {
  list-style: none !important;
  list-style-type: none !important;
}

/* ==========================================================================
   Pebble-Style Kinetic Moving Line for Navigation & Titles
   ========================================================================== */
/* 1. Footer Links */
.footer-menu-link,
.site-footer ul li a,
.site-footer .footer-legal-link {
  position: relative;
  display: inline-block;
  width: fit-content;
  color: var(--foreground-muted);
  text-decoration: none !important;
  transition: color var(--transition-fast) ease;
}

.footer-menu-link::after,
.site-footer ul li a::after,
.site-footer .footer-legal-link::after {
  content: '';
  position: absolute;
  left: 0;
  bottom: -2.5px;
  width: 100%;
  height: 1.5px;
  background: linear-gradient(90deg, var(--brand-blue), #60a5fa, var(--brand-blue));
  background-size: 200% 100%;
  transform: scaleX(0);
  transform-origin: right;
  transition: transform 0.38s cubic-bezier(0.25, 1, 0.5, 1);
  pointer-events: none;
  border-radius: 1px;
}

[data-theme="dark"] .footer-menu-link::after,
[data-theme="dark"] .site-footer ul li a::after,
[data-theme="dark"] .site-footer .footer-legal-link::after {
  background: linear-gradient(90deg, var(--brand-blue), #93c5fd, var(--brand-blue));
  background-size: 200% 100%;
}

.footer-menu-link:hover,
.site-footer ul li a:hover,
.site-footer .footer-legal-link:hover {
  color: var(--foreground);
  text-decoration: none !important;
}

.footer-menu-link:hover::after,
.site-footer ul li a:hover::after,
.site-footer .footer-legal-link:hover::after {
  transform: scaleX(1);
  transform-origin: left;
  animation: pebbleLineMoving 1.4s linear infinite;
}

/* 2. Header Primary Navigation Links */
.primary-nav ul li a,
.primary-nav .nav-item {
  position: relative;
  display: inline-flex;
  align-items: center;
  text-decoration: none !important;
  transition: color var(--transition-fast) ease;
}

.primary-nav ul li a::after,
.primary-nav .nav-item::after {
  content: '';
  position: absolute;
  left: 0.75rem;
  right: 0.75rem;
  bottom: 0.2rem;
  height: 1.5px;
  background: linear-gradient(90deg, var(--brand-blue), #60a5fa, var(--brand-blue));
  background-size: 200% 100%;
  transform: scaleX(0);
  transform-origin: right;
  transition: transform 0.35s cubic-bezier(0.25, 1, 0.5, 1);
  pointer-events: none;
  border-radius: 1px;
}

[data-theme="dark"] .primary-nav ul li a::after,
[data-theme="dark"] .primary-nav .nav-item::after {
  background: linear-gradient(90deg, var(--brand-blue), #93c5fd, var(--brand-blue));
  background-size: 200% 100%;
}

.primary-nav ul li a:hover,
.primary-nav .nav-item:hover {
  color: var(--foreground);
}

.primary-nav ul li a:hover::after,
.primary-nav .nav-item:hover::after {
  transform: scaleX(1);
  transform-origin: left;
  animation: pebbleLineMoving 1.4s linear infinite;
}

/* 3. Card Blog Titles (Clean Color Transition on Hover) */
article.card:hover h2 a,
article.card:hover h3 a,
article.card:hover h4 a,
.trending-story-item:hover h4 a,
.card-headline:hover h3 a,
h2 a:hover,
h3 a:hover,
h4 a:hover {
  color: var(--brand-blue);
  transition: color var(--transition-fast) ease;
}

@keyframes pebbleLineMoving {
  0% {
    background-position: 0% 50%;
  }
  100% {
    background-position: 200% 50%;
  }
}

.brand-link {
  white-space: nowrap;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 0.625rem;
  text-decoration: none;
}
.brand-link:hover {
  text-decoration: none;
}
.brand-logo-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: transform 0.45s cubic-bezier(0.34, 1.56, 0.64, 1);
  will-change: transform;
}
.brand-link:hover .brand-logo-icon {
  transform: rotate(25deg) scale(1.08);
}
.brand-title {
  white-space: nowrap;
  transition: color var(--transition-fast);
}
.brand-link:hover .brand-title {
  color: var(--brand-blue);
}

/* Spinner Animation for Newsletter */
@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}
.animate-spin {
  animation: spin 1s linear infinite;
}

.primary-nav .nav-item {
  display: inline-flex;
  align-items: center;
  padding: 0.35rem 0.65rem;
  font-size: var(--text-xs);
  font-weight: 500;
  color: var(--foreground-muted);
  background-color: transparent !important;
  transition: color var(--transition-fast);
  white-space: nowrap;
}
.primary-nav .nav-item:hover {
  color: var(--foreground);
  background-color: transparent !important;
}

/* Search Trigger Elements */
.search-label {
  display: none;
}
.search-shortcut {
  display: none;
}
@media (min-width: 640px) {
  .search-label {
    display: inline !important;
  }
  .search-shortcut {
    display: inline-flex !important;
  }
}

/* Mobile Toggle Button */
.mobile-toggle-btn {
  display: inline-flex !important;
}
@media (min-width: 1024px) {
  .mobile-toggle-btn {
    display: none !important;
  }
}

/* 5.2 Theme Switcher (Zero-Emoji Vector Sun & Moon) */
#theme-toggle-btn {
  transition: transform 200ms cubic-bezier(0.34, 1.56, 0.64, 1), background-color var(--transition-fast), border-color var(--transition-fast) !important;
  user-select: none;
}
#theme-toggle-btn:hover {
  transform: scale(1.06);
}
#theme-toggle-btn:active {
  transform: scale(0.92);
}

.theme-icon-sun {
  display: inline-flex !important;
  transition: transform 300ms ease;
}
.theme-icon-moon {
  display: none !important;
  transition: transform 300ms ease;
}
[data-theme="dark"] .theme-icon-sun,
html[data-theme="dark"] .theme-icon-sun,
html.dark .theme-icon-sun {
  display: none !important;
}
[data-theme="dark"] .theme-icon-moon,
html[data-theme="dark"] .theme-icon-moon,
html.dark .theme-icon-moon {
  display: inline-flex !important;
}

/* 5.3 Mobile Navigation Drawer */
.mobile-drawer {
  display: none;
}
.mobile-drawer:not(.hidden) {
  display: block !important;
}
@media (min-width: 1024px) {
  .mobile-drawer,
  .mobile-drawer:not(.hidden) {
    display: none !important;
  }
}

/* 5.4 Command Palette / Search Modal (Shadcn Architecture) */
.search-modal {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background-color: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: none !important;
  align-items: flex-start;
  justify-content: center;
  padding-top: 5rem;
  padding-left: 1rem;
  padding-right: 1rem;
}
[data-theme="dark"] .search-modal {
  background-color: rgba(0, 0, 0, 0.75);
}
.search-modal:not(.hidden) {
  display: flex !important;
}
.search-modal-content {
  box-shadow: var(--shadow-lg);
  max-width: 36rem;
  width: 100%;
}

/* ==========================================================================
   5.4.1 Client-Side Saved Stories Reading List Drawer & Badges
   ========================================================================== */
.saved-stories-badge {
  position: absolute;
  top: 1px;
  right: 1px;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 17px;
  height: 17px;
  padding: 0 4px;
  border-radius: 9999px;
  background-color: var(--brand-blue);
  color: var(--brand-blue-foreground);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
}

.card-bookmark-btn {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: var(--radius-badge);
  background-color: var(--background);
  border: 1px solid var(--border);
  color: var(--foreground-muted);
  cursor: pointer;
  opacity: 0;
  transition: all var(--transition-fast);
}

.group:hover .card-bookmark-btn,
.card-bookmark-btn.is-saved {
  opacity: 1;
}

.card-bookmark-btn:hover {
  color: var(--foreground);
  border-color: var(--border-hover);
}

.card-bookmark-btn.is-saved {
  color: var(--brand-blue);
  background-color: var(--background);
  border-color: var(--brand-blue);
}

.bookmark-story-btn .bookmark-icon.fill-brand-blue svg {
  fill: var(--brand-blue);
}

/* 5.5 Form Inputs & Controls (Minimalist Shadcn Focus State) */
input[type="text"],
input[type="email"],
input[type="search"],
textarea {
  font-family: inherit;
  border-radius: var(--radius-input);
  border: 1px solid var(--border);
  background-color: var(--background);
  color: var(--foreground);
  padding: 0.5rem 0.75rem;
  font-size: var(--text-sm);
  line-height: var(--leading-normal);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}
input[type="text"]:focus,
input[type="email"]:focus,
textarea:focus {
  outline: none;
  border-color: var(--ring);
  box-shadow: 0 0 0 1px var(--ring);
}

/* Search Modal Input: Pure Borderless & Clean */
#search-modal-input {
  border: none !important;
  outline: none !important;
  box-shadow: none !important;
  background-color: transparent !important;
  border-radius: 0 !important;
}
#search-modal-input:focus {
  border: none !important;
  outline: none !important;
  box-shadow: none !important;
}

/* 5.6 WordPress Comment Form Layout & Spacing */
.comment-form p {
  margin-bottom: 0.875rem;
}
.comment-form p.comment-form-cookies-consent {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  font-size: var(--text-xs);
  color: var(--foreground-muted);
  margin-top: 0.5rem;
  margin-bottom: 1.25rem;
}
.comment-form p.comment-form-cookies-consent input[type="checkbox"] {
  margin-top: 0.2rem;
  accent-color: var(--brand-blue);
}
.comment-form p.form-submit {
  margin-bottom: 0;
  padding-top: 0.25rem;
}

/* ==========================================================================
   6. NATIVE GPU VIEW TRANSITION (Zero-Lag Circular Animation)
   ========================================================================== */
::view-transition-old(root),
::view-transition-new(root) {
  animation: none;
  mix-blend-mode: normal;
}

::view-transition-new(root) {
  z-index: 9999;
  will-change: clip-path;
}
::view-transition-old(root) {
  z-index: 1;
}

/* ==========================================================================
   8. TERMINAL-GRADE CODE BLOCKS (Zero Plugin, 100% Core Proof)
   ========================================================================== */
.code-block-container {
  margin: 1.75rem 0;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--card);
  overflow: hidden;
  box-shadow: 0 4px 12px -2px rgba(0, 0, 0, 0.05);
}
.dark .code-block-container {
  box-shadow: 0 4px 16px -2px rgba(0, 0, 0, 0.4);
}
.code-block-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 0.875rem;
  background: var(--background-subtle);
  border-bottom: 1px solid var(--border);
  user-select: none;
}
.code-header-left {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.code-terminal-dots {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}
.code-dot {
  width: 0.65rem;
  height: 0.65rem;
  border-radius: 50%;
  display: inline-block;
}
.dot-red { background: #ff5f56; }
.dot-yellow { background: #ffbd2e; }
.dot-green { background: #27c93f; }
.code-lang-label {
  font-size: 0.65rem;
  font-family: var(--font-mono);
  font-weight: 700;
  letter-spacing: 0.05em;
  color: var(--foreground-muted);
}
.code-copy-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0.5rem;
  font-size: 0.7rem;
  font-weight: 500;
  border-radius: calc(var(--radius) - 4px);
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--foreground-muted);
  cursor: pointer;
  transition: all var(--transition-fast);
}
.code-copy-btn:hover {
  color: var(--foreground);
  border-color: var(--border-hover);
  background: var(--background-subtle);
}
.code-copy-btn.copied {
  color: #10b981;
  border-color: rgba(16, 185, 129, 0.4);
  background: rgba(16, 185, 129, 0.1);
}
.code-block-container pre {
  margin: 0 !important;
  padding: 1rem !important;
  background: transparent !important;
  border: none !important;
  overflow-x: auto;
  font-size: 0.8125rem;
  font-family: var(--font-mono);
  line-height: 1.6;
}

/* ==========================================================================
   9. CLIENT-SIDE SAVED STORIES (Slide-Over Drawer & Bookmarks)
   ========================================================================== */
.saved-stories-drawer {
  position: fixed;
  inset: 0;
  z-index: 9999;
}
.saved-stories-drawer.hidden {
  display: none !important;
}
.saved-drawer-backdrop {
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  opacity: 0;
  pointer-events: none;
  transition: opacity 180ms ease-out;
  will-change: opacity;
}
.saved-drawer-panel {
  position: fixed;
  top: 0;
  right: 0;
  z-index: 10001 !important;
  width: 100%;
  max-width: 400px;
  height: 100%;
  background: var(--card) !important;
  border-left: 1px solid var(--border);
  box-shadow: -12px 0 35px rgba(0, 0, 0, 0.2);
  display: flex;
  flex-direction: column;
  transform: translate3d(100%, 0, 0);
  will-change: transform;
  overscroll-behavior: contain;
  transition: transform 240ms cubic-bezier(0.16, 1, 0.3, 1);
}
.saved-stories-drawer.is-open .saved-drawer-backdrop {
  opacity: 1;
  pointer-events: auto;
}
.saved-stories-drawer.is-open .saved-drawer-panel {
  transform: translate3d(0, 0, 0);
}

/* Drawer Header */
.saved-drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border);
  background: var(--card);
  gap: 1rem;
}
.saved-drawer-title-group {
  display: flex;
  align-items: center;
  gap: 0.625rem;
}
.saved-drawer-title {
  font-size: var(--text-sm);
  font-weight: 700;
  color: var(--foreground);
  margin: 0;
  line-height: 1;
}
.saved-drawer-count {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  font-weight: 600;
  color: var(--foreground-muted);
  background: var(--background-subtle);
  border: 1px solid var(--border);
  padding: 0.15rem 0.5rem;
  border-radius: var(--radius-badge);
  line-height: 1;
}
.saved-drawer-actions {
  display: flex;
  align-items: center;
  gap: 0.375rem;
}

/* Drawer Header Buttons (Exact Theme Radius) */
.drawer-clear-btn {
  background: transparent !important;
  border: 1px solid transparent !important;
  font-size: var(--text-xs);
  font-weight: 500;
  color: var(--foreground-muted);
  cursor: pointer;
  padding: 0.35rem 0.75rem;
  border-radius: var(--radius-button);
  transition: all var(--transition-fast);
}
.drawer-clear-btn:hover {
  color: var(--foreground) !important;
  background: var(--background-subtle) !important;
  border-color: var(--border) !important;
}

.drawer-close-btn {
  background: transparent !important;
  border: 1px solid transparent !important;
  color: var(--foreground-muted);
  cursor: pointer;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-button);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
}
.drawer-close-btn:hover {
  color: var(--foreground) !important;
  background: var(--background-subtle) !important;
  border-color: var(--border) !important;
}

/* Stories List (GPU Hardware-Accelerated Scrolling) */
.saved-drawer-list {
  flex: 1 1 0%;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: var(--scrollbar-thumb) transparent;
  transform: translateZ(0);
  will-change: scroll-position;
  padding: 1.25rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.saved-drawer-list::-webkit-scrollbar {
  width: 5px;
}
.saved-drawer-list::-webkit-scrollbar-track {
  background: transparent;
}
.saved-drawer-list::-webkit-scrollbar-thumb {
  background-color: var(--scrollbar-thumb);
  border-radius: 9999px;
}
.saved-drawer-list::-webkit-scrollbar-thumb:hover {
  background-color: var(--scrollbar-thumb-hover);
}

/* Saved Story Card */
.saved-story-card {
  padding: 0.875rem 1rem;
  border-radius: var(--radius-card);
  border: 1px solid var(--border);
  background: var(--card);
  transition: border-color var(--transition-fast);
}
.saved-story-card:hover {
  border-color: var(--border-hover);
}

/* Micro Category Badge in Drawer (Strict 10px) */
.saved-story-card .badge,
.saved-story-category {
  display: inline-block !important;
  font-size: 0.625rem !important; /* 10px */
  font-family: var(--font-mono) !important;
  font-weight: 500 !important;
  line-height: 1.2 !important;
  color: var(--foreground-muted) !important;
  background: var(--background-subtle) !important;
  border: 1px solid var(--border) !important;
  padding: 0.125rem 0.45rem !important;
  border-radius: var(--radius-badge) !important;
  margin-bottom: 0.35rem !important;
  height: auto !important;
  min-height: 0 !important;
}

/* Remove Story Button */
.remove-saved-item-btn {
  background: transparent !important;
  border: 1px solid transparent !important;
  color: var(--foreground-muted);
  cursor: pointer;
  width: 28px;
  height: 28px;
  border-radius: var(--radius-button);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all var(--transition-fast);
}
.remove-saved-item-btn:hover {
  color: #ef4444 !important;
  background: rgba(239, 68, 68, 0.1) !important;
  border-color: rgba(239, 68, 68, 0.2) !important;
}

/* Drawer Footer */
.saved-drawer-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border);
  background: var(--background-subtle);
  font-size: var(--text-xs);
  color: var(--foreground-muted);
}
.saved-drawer-footer kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.2rem 0.5rem;
  font-family: var(--font-mono);
  font-size: 0.625rem;
  font-weight: 600;
  border-radius: var(--radius-input);
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--foreground-muted);
  line-height: 1;
}

.card-bookmark-btn {
  cursor: pointer;
  outline: none;
}
.card-bookmark-btn:hover {
  color: var(--brand-blue);
}
.bookmark-story-btn.is-saved svg,
.card-bookmark-btn.is-saved svg {
  fill: var(--brand-blue);
  stroke: var(--brand-blue);
}

/* ==========================================================================
   9.5 INTELLIGENT COMMENT SYSTEM (Shadcn + FB/Instagram Aesthetics)
   ========================================================================== */
.comment-card {
  position: relative;
  transition: border-color var(--transition-fast), background-color var(--transition-fast);
}

.comment-card .comment-actions {
  min-height: 32px;
  flex-wrap: wrap;
  gap: 0.375rem;
}

/* Comment Reaction Buttons — Symmetrical Hover & 14px Radius Token */
.comment-reaction-btn {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 0.35rem !important;
  min-width: 28px !important;
  height: 28px !important;
  padding: 0 0.375rem !important;
  background: transparent !important;
  border: 1px solid transparent !important;
  color: var(--foreground-muted) !important;
  border-radius: var(--radius-button) !important;
  transition: all var(--transition-fast) !important;
  user-select: none;
  font-family: var(--font-sans);
  font-size: var(--text-xs) !important;
  font-weight: 500;
  line-height: 1;
}

.comment-reaction-btn:hover {
  background: var(--background-subtle) !important;
  border-color: var(--border) !important;
}

/* Symmetrical compact state when count is 0 / empty */
.comment-reaction-btn span.like-count:empty,
.comment-reaction-btn span.dislike-count:empty {
  display: none !important;
}

.comment-reaction-btn svg {
  flex-shrink: 0;
  transition: transform 0.15s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

/* Liked state: Electric Blue */
.comment-like-btn.is-liked {
  color: var(--brand-blue) !important;
  background: rgba(37, 99, 235, 0.08) !important;
  border-color: rgba(37, 99, 235, 0.25) !important;
  font-weight: 600;
}
.comment-like-btn.is-liked svg {
  fill: var(--brand-blue);
  stroke: var(--brand-blue);
  transform: scale(1.1);
}

/* Disliked state: Soft destructive tone */
.comment-dislike-btn.is-disliked {
  color: #ef4444 !important;
  background: rgba(239, 68, 68, 0.08) !important;
  border-color: rgba(239, 68, 68, 0.25) !important;
  font-weight: 600;
}
.comment-dislike-btn.is-disliked svg {
  fill: #ef4444;
  stroke: #ef4444;
  transform: scale(1.1);
}

/* Reply Link Button */
.comment-actions .comment-reply-link {
  display: inline-flex !important;
  align-items: center !important;
  gap: 0.375rem !important;
  font-size: var(--text-xs) !important;
  font-weight: 500 !important;
  color: var(--foreground-muted) !important;
  height: 28px !important;
  padding: 0 0.625rem !important;
  border-radius: var(--radius-button) !important;
  transition: all var(--transition-fast) !important;
  text-decoration: none !important;
}
.comment-actions .comment-reply-link:hover {
  color: var(--brand-blue) !important;
  background: var(--background-subtle) !important;
}

/* Field Wrapper & 4-Sided Visible Focus Ring */
.comment-field-wrap {
  width: 100% !important;
  box-sizing: border-box !important;
  padding: 1px !important;
}

.comment-respond textarea,
.comment-form-wrapper textarea {
  width: 100% !important;
  max-width: 100% !important;
  box-sizing: border-box !important;
  display: block !important;
  margin: 0 !important;
  border: 1px solid var(--border) !important;
  border-radius: var(--radius-input) !important;
  background: var(--background) !important;
  color: var(--foreground) !important;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast) !important;
}

.comment-respond textarea:focus,
.comment-form-wrapper textarea:focus {
  outline: none !important;
  border-color: var(--brand-blue) !important;
  box-shadow: 0 0 0 1px var(--brand-blue) !important;
}

/* Nested In-Card Reply Form Reset */
.comment-item > .comment-respond,
.comment-card .comment-respond {
  margin-top: 0.75rem !important;
  margin-bottom: 0.5rem !important;
  padding: 1rem !important;
  background: var(--background-subtle) !important;
  border: 1px solid rgba(37, 99, 235, 0.3) !important;
  border-radius: var(--radius-card) !important;
  box-shadow: none !important;
  box-sizing: border-box !important;
  width: 100% !important;
  max-width: 100% !important;
}

/* Form Cancel & Submit Matching Heights (36px) — Single 1px Border */
#cancel-comment-reply-link {
  display: none !important;
  align-items: center;
  justify-content: center;
  height: 36px !important;
  min-height: 36px !important;
  padding: 0.5rem 1rem !important;
  font-size: var(--text-xs) !important;
  font-weight: 600 !important;
  line-height: 1 !important;
  border-radius: var(--radius-button) !important;
  border: 1px solid var(--border) !important;
  background: var(--background) !important;
  color: var(--foreground-muted) !important;
  text-decoration: none !important;
  cursor: pointer;
  box-shadow: none !important;
  outline: none !important;
  transition: all var(--transition-fast) !important;
}
#cancel-comment-reply-link * {
  border: none !important;
  background: transparent !important;
  padding: 0 !important;
  margin: 0 !important;
  box-shadow: none !important;
}
#cancel-comment-reply-link:hover {
  background: var(--background-subtle) !important;
  color: var(--foreground) !important;
  border-color: var(--foreground-muted) !important;
}

/* Strictly only display cancel button when actively in reply mode */
.comment-respond.is-replying #cancel-comment-reply-link,
#cancel-comment-reply-link.is-visible {
  display: inline-flex !important;
}

.comment-respond .form-submit input[type="submit"],
.comment-respond .form-submit .btn-primary {
  height: 36px !important;
  min-height: 36px !important;
  line-height: 1 !important;
  border-radius: var(--radius-button) !important;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* Comment card inside replies trigger */
.comment-card-replies-trigger {
  user-select: none;
}
.comment-card-replies-trigger .view-replies-btn {
  user-select: none;
  border: none;
  background: transparent;
  border-radius: var(--radius-button) !important;
}

/* Threaded Comment Reply Branch Tree */
ul.children.comment-tree-branch {
  position: relative;
}
ul.children.comment-tree-branch::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 12px;
  left: -2px;
  width: 2px;
  background: var(--border);
  border-radius: 9999px;
}

.view-replies-btn {
  user-select: none;
  border-radius: var(--radius-button) !important;
}

/* ==========================================================================
   10. PRINT STYLESHEET (@media print)
   ========================================================================== */
@media print {
  body {
    background: #ffffff !important;
    color: #000000 !important;
    font-size: 12pt;
  }
  .site-header, .site-footer, #reading-progress-bar, .share-bar, .sidebar, #theme-toggle-btn {
    display: none !important;
  }
  .card, .prose {
    border: none !important;
    box-shadow: none !important;
  }
  a {
    text-decoration: underline !important;
    color: #000000 !important;
  }
}







/* ==========================================================================
   11. AUTHOR PROFILE HERO CARD & UTILITIES
   ========================================================================== */
.relative { position: relative; }
.absolute { position: absolute; }
.fixed { position: fixed; }
.sticky { position: sticky; }
.top-0 { top: 0; }
.right-0 { right: 0; }
.bottom-0 { bottom: 0; }
.left-0 { left: 0; }
.z-10 { z-index: 10; }
.z-20 { z-index: 20; }
.z-50 { z-index: 50; }
.overflow-hidden { overflow: hidden; }

.author-hero-card {
  position: relative;
  background: var(--color-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-card);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
}

@media (min-width: 640px) {
  .author-hero-card {
    padding: 2rem;
  }
}

.author-hero-wrap {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

@media (min-width: 640px) {
  .author-hero-wrap {
    flex-direction: row;
    align-items: flex-start;
    gap: 1.75rem;
  }
}

.author-hero-avatar {
  width: 76px;
  height: 76px;
  flex-shrink: 0;
  border-radius: 9999px;
  border: 2px solid var(--color-border);
  background: var(--color-background-subtle);
  overflow: hidden;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
}

@media (min-width: 640px) {
  .author-hero-avatar {
    width: 88px;
    height: 88px;
  }
}

.author-hero-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.author-hero-body {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  flex: 1;
  min-width: 0;
}

.author-hero-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.author-hero-name {
  font-size: 1.625rem;
  font-weight: 800;
  letter-spacing: -0.025em;
  color: var(--color-foreground);
  line-height: 1.2;
  margin: 0;
}

@media (min-width: 640px) {
  .author-hero-name {
    font-size: 1.875rem;
  }
}

.author-verified-tick {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--color-brand-blue, #2563eb);
}

.author-hero-meta {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--color-foreground-muted);
  margin-top: 0.125rem;
}

.author-hero-bio {
  font-size: 0.875rem;
  color: var(--color-foreground-muted);
  line-height: 1.6;
  max-width: 720px;
  margin-top: 0.35rem;
}

.author-hero-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-top: 0.75rem;
}



/* ==========================================================================
   12. SHADCN UI ACCESSIBLE PAGINATION
   ========================================================================== */
.navigation.pagination {
  margin: 0 auto;
  display: flex;
  width: 100%;
  justify-content: center;
}

.navigation.pagination .screen-reader-text {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.navigation.pagination .nav-links {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  flex-wrap: wrap;
  justify-content: center;
}

.navigation.pagination .page-numbers {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
  border-radius: var(--radius-button, 8px);
  font-size: 0.875rem;
  font-weight: 500;
  min-width: 2.25rem;
  height: 2.25rem;
  padding: 0 0.75rem;
  color: var(--color-foreground);
  background: transparent;
  border: 1px solid transparent;
  text-decoration: none;
  transition: color 0.15s ease, background-color 0.15s ease, border-color 0.15s ease;
  user-select: none;
}

.navigation.pagination a.page-numbers:hover {
  background-color: var(--color-accent, rgba(255, 255, 255, 0.08));
  color: var(--color-foreground);
}

.navigation.pagination .page-numbers.current {
  background-color: var(--color-background-subtle, #18181b);
  border-color: var(--color-border);
  color: var(--color-foreground);
  font-weight: 700;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.navigation.pagination a.prev.page-numbers,
.navigation.pagination a.next.page-numbers {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0 0.875rem;
  font-weight: 500;
  border: 1px solid var(--color-border);
  background-color: var(--color-card);
}

.navigation.pagination a.prev.page-numbers:hover,
.navigation.pagination a.next.page-numbers:hover {
  background-color: var(--color-accent, rgba(255, 255, 255, 0.08));
  border-color: var(--color-border);
}

.navigation.pagination .page-numbers.dots {
  min-width: 2rem;
  height: 2.25rem;
  color: var(--color-foreground-muted);
  font-family: var(--font-mono);
  letter-spacing: 0.1em;
  border: none;
  background: transparent;
}



/* ==========================================================================
   13. AUDIO STORY PLAYER COMPONENT (Hands-Free TTS)
   ========================================================================== */
.audio-player-card {
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.tts-wave {
  display: inline-flex;
  align-items: center;
  height: 14px;
}

.tts-wave-bar {
  display: inline-block;
  width: 2.5px;
  height: 100%;
  background-color: var(--color-brand-blue, #2563eb);
  border-radius: 9999px;
  margin: 0 1px;
  animation: ttsWaveJump 1.2s ease-in-out infinite;
}

.tts-wave-bar:nth-child(1) { animation-delay: 0.0s; height: 40%; }
.tts-wave-bar:nth-child(2) { animation-delay: 0.2s; height: 90%; }
.tts-wave-bar:nth-child(3) { animation-delay: 0.4s; height: 60%; }
.tts-wave-bar:nth-child(4) { animation-delay: 0.6s; height: 100%; }

@keyframes ttsWaveJump {
  0%, 100% {
    transform: scaleY(0.3);
  }
  50% {
    transform: scaleY(1);
  }
}


#tts-play-btn *, #tts-speed-btn *, #tts-stop-btn * {
  pointer-events: none;
}
