/* BlogIA UI 2026 - Modern Tech Blog Design
 * Based on The Verge, TechCrunch, Medium best practices
 * Typography-first, reading-optimized design
 */

/* ============================================
   1. CSS CUSTOM PROPERTIES - NEW PALETTE
   ============================================ */
:root {
  /* NEW Brand Colors - Indigo/Cyan AI Theme */
  --color-primary: #6366f1;
  --color-primary-hover: #4f46e5;
  --color-primary-light: #e0e7ff;
  --color-primary-dark: #4338ca;
  
  --color-accent: #22d3ee;
  --color-accent-light: #cffafe;
  --color-accent-dark: #0891b2;
  
  --color-highlight: #f472b6;
  
  /* Semantic Colors */
  --color-success: #10b981;
  --color-warning: #f59e0b;
  --color-danger: #ef4444;
  
  /* Light Mode - Refined Neutrals */
  --bg-primary: #fafafa;
  --bg-secondary: #f4f4f5;
  --bg-tertiary: #e4e4e7;
  --bg-card: #ffffff;
  --bg-code: #18181b;
  
  --text-primary: #18181b;
  --text-secondary: #52525b;
  --text-muted: #a1a1aa;
  --text-inverse: #fafafa;
  
  --border-color: rgba(0, 0, 0, 0.08);
  --border-strong: rgba(0, 0, 0, 0.15);
  
  /* Typography Scale */
  --font-display: 'Sora', 'Inter', system-ui, sans-serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', 'Consolas', monospace;
  
  /* Font Sizes - Optimized for reading */
  --text-xs: 0.75rem;      /* 12px */
  --text-sm: 0.875rem;     /* 14px */
  --text-base: 1rem;       /* 16px */
  --text-lg: 1.125rem;     /* 18px */
  --text-xl: 1.1875rem;    /* 19px - body text */
  --text-2xl: 1.5rem;      /* 24px */
  --text-3xl: 1.875rem;    /* 30px - H2 */
  --text-4xl: 2.625rem;    /* 42px - H1 */
  --text-5xl: 3.5rem;      /* 56px - Hero */
  
  /* Line Heights */
  --leading-tight: 1.2;
  --leading-snug: 1.4;
  --leading-normal: 1.6;
  --leading-relaxed: 1.75;  /* Optimal for body text */
  
  /* Spacing - 8px base */
  --space-1: 0.25rem;   /* 4px */
  --space-2: 0.5rem;    /* 8px */
  --space-3: 0.75rem;   /* 12px */
  --space-4: 1rem;      /* 16px */
  --space-5: 1.5rem;    /* 24px */
  --space-6: 2rem;      /* 32px */
  --space-7: 3rem;      /* 48px */
  --space-8: 4rem;      /* 64px */
  --space-9: 6rem;      /* 96px */
  
  /* Layout */
  --content-width: 720px;      /* Optimal 65 chars/line */
  --container-width: 1280px;
  --sidebar-width: 280px;
  
  /* Borders & Shadows */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-full: 9999px;
  
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.08);
  --shadow-xl: 0 16px 48px rgba(0, 0, 0, 0.12);
  --shadow-glow: 0 0 60px -15px var(--color-primary);
  --shadow-card: 0 1px 2px rgba(0,0,0,0.04), 0 4px 12px rgba(0,0,0,0.04);
  --shadow-card-hover: 0 4px 8px rgba(0,0,0,0.04), 0 12px 32px rgba(0,0,0,0.08);
  
  /* Transitions */
  --transition-fast: 150ms ease;
  --transition-base: 200ms ease;
  --transition-slow: 300ms ease;
  --transition-bounce: 300ms cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ============================================
   2. DARK MODE - True Dark (not inverted)
   ============================================ */
[data-theme="dark"],
.dark {
  --bg-primary: #09090b;
  --bg-secondary: #18181b;
  --bg-tertiary: #27272a;
  --bg-card: #1c1c1f;
  --bg-code: #0d0d0f;
  
  --text-primary: #fafafa;
  --text-secondary: #a1a1aa;
  --text-muted: #71717a;
  --text-inverse: #18181b;
  
  --border-color: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.15);
  
  /* Brighter primary in dark mode */
  --color-primary: #818cf8;
  --color-primary-light: #312e81;
  --color-accent: #67e8f9;
  
  --shadow-card: 0 1px 2px rgba(0,0,0,0.2), 0 4px 12px rgba(0,0,0,0.3);
  --shadow-card-hover: 0 4px 8px rgba(0,0,0,0.3), 0 12px 32px rgba(0,0,0,0.4);
  --shadow-glow: 0 0 60px -15px rgba(129, 140, 248, 0.5);
}

/* ============================================
   3. BASE STYLES
   ============================================ */
html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

body {
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: var(--leading-normal);
  color: var(--text-primary);
  background: var(--bg-primary);
  transition: background-color var(--transition-slow), color var(--transition-slow);
}

/* ============================================
   4. TYPOGRAPHY - Article Optimized
   ============================================ */

/* Article Content - The Star of the Show */
.post-content,
.article-content,
.entry-content {
  max-width: var(--content-width);
  margin: 0 auto;
  font-size: var(--text-xl);  /* 19px */
  line-height: var(--leading-relaxed);  /* 1.75 */
  letter-spacing: -0.01em;
}

/* First paragraph - slightly larger */
.post-content > p:first-of-type,
.article-content > p:first-of-type {
  font-size: 1.3125rem;  /* 21px */
  color: var(--text-secondary);
  line-height: 1.7;
}

/* Paragraphs */
.post-content p,
.article-content p {
  margin-bottom: 1.5em;
}

/* Headings - Display Font */
h1, h2, h3, h4, h5, h6,
.post-title,
.entry-title {
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: var(--leading-tight);
  color: var(--text-primary);
}

/* H1 - Article Title */
h1, .post-title {
  font-size: var(--text-4xl);  /* 42px */
  font-weight: 800;
  margin-bottom: var(--space-5);
}

/* H2 - Section Headers */
.post-content h2,
.article-content h2 {
  font-size: var(--text-3xl);  /* 30px */
  font-weight: 700;
  margin-top: 3rem;
  margin-bottom: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border-color);
}

/* H3 */
.post-content h3,
.article-content h3 {
  font-size: var(--text-2xl);  /* 24px */
  font-weight: 600;
  margin-top: 2.5rem;
  margin-bottom: 0.75rem;
}

/* Links - Subtle underline */
.post-content a,
.article-content a {
  color: var(--color-primary);
  text-decoration: underline;
  text-decoration-color: rgba(99, 102, 241, 0.3);
  text-underline-offset: 3px;
  transition: text-decoration-color var(--transition-fast);
}

.post-content a:hover,
.article-content a:hover {
  text-decoration-color: var(--color-primary);
}

/* Blockquotes */
.post-content blockquote,
.article-content blockquote {
  margin: var(--space-6) 0;
  padding: var(--space-5) var(--space-6);
  background: var(--bg-secondary);
  border-left: 4px solid var(--color-primary);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  font-size: 1.125rem;
  font-style: italic;
  color: var(--text-secondary);
}

/* Code blocks */
.post-content pre,
.article-content pre {
  background: var(--bg-code);
  color: #e4e4e7;
  padding: var(--space-5);
  border-radius: var(--radius-lg);
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 0.9rem;
  line-height: 1.6;
  margin: var(--space-6) 0;
}

/* Inline code */
.post-content code:not(pre code),
.article-content code:not(pre code) {
  background: var(--bg-secondary);
  padding: 0.15em 0.4em;
  border-radius: 4px;
  font-size: 0.9em;
  font-family: var(--font-mono);
}

/* Lists */
.post-content ul,
.post-content ol,
.article-content ul,
.article-content ol {
  margin: var(--space-5) 0;
  padding-left: 1.5em;
}

.post-content li,
.article-content li {
  margin-bottom: 0.75em;
}

/* ============================================
   5. CARDS - Modern with Depth
   ============================================ */
.card,
.post-entry,
.archive-entry,
.pro-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  box-shadow: var(--shadow-card);
  transition: transform var(--transition-base), box-shadow var(--transition-base);
  position: relative;
  overflow: hidden;
}

.card:hover,
.post-entry:hover,
.archive-entry:hover,
.pro-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-card-hover);
}

/* Card with accent bar on hover */
.card::before,
.post-entry::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--color-primary), var(--color-accent));
  transform: scaleX(0);
  transform-origin: left;
  transition: transform var(--transition-base);
}

.card:hover::before,
.post-entry:hover::before {
  transform: scaleX(1);
}

/* Card title */
.card-title,
.entry-title,
.post-entry .entry-title {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 700;
  line-height: 1.3;
  margin-bottom: var(--space-3);
}

.card-title a,
.entry-title a {
  color: var(--text-primary);
  text-decoration: none;
  transition: color var(--transition-fast);
}

.card-title a:hover,
.entry-title a:hover {
  color: var(--color-primary);
}

/* Card excerpt */
.card-excerpt,
.entry-content {
  color: var(--text-secondary);
  font-size: var(--text-base);
  line-height: 1.6;
  margin-bottom: var(--space-4);
}

/* Card meta */
.card-meta,
.post-meta {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  font-size: var(--text-sm);
  color: var(--text-muted);
}

/* Category badge */
.card-category,
.post-category {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-1) var(--space-3);
  background: var(--color-primary-light);
  color: var(--color-primary-dark);
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-radius: var(--radius-full);
}

[data-theme="dark"] .card-category,
.dark .card-category {
  background: rgba(99, 102, 241, 0.2);
  color: var(--color-primary);
}

/* Card image */
.card-image,
.entry-cover img {
  width: 100%;
  aspect-ratio: 16/9;
  object-fit: cover;
  border-radius: var(--radius-md);
  margin-bottom: var(--space-4);
  transition: transform var(--transition-slow);
}

.card:hover .card-image,
.post-entry:hover .entry-cover img {
  transform: scale(1.03);
}

/* Card grid */
.card-grid,
.posts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: var(--space-6);
}

/* Featured card - spans 2 columns */
.card-featured {
  grid-column: span 2;
}

@media (max-width: 768px) {
  .card-featured {
    grid-column: span 1;
  }
}

/* ============================================
   6. HERO SECTION - Modern Gradient
   ============================================ */
.hero,
.hero-section,
.digest-hero {
  position: relative;
  padding: var(--space-9) var(--space-5);
  background: linear-gradient(135deg, #1e1b4b 0%, #312e81 30%, #4338ca 70%, #6366f1 100%);
  color: white;
  overflow: hidden;
  min-height: 450px;
  display: flex;
  align-items: center;
}

/* Mesh gradient overlay */
.hero::before,
.hero-section::before {
  content: '';
  position: absolute;
  inset: 0;
  background: 
    radial-gradient(ellipse 80% 50% at 50% -20%, rgba(34, 211, 238, 0.3), transparent),
    radial-gradient(ellipse 60% 40% at 100% 0%, rgba(244, 114, 182, 0.2), transparent),
    radial-gradient(ellipse 50% 50% at 0% 100%, rgba(16, 185, 129, 0.15), transparent);
  pointer-events: none;
}

/* Gradient fade to content */
.hero::after,
.hero-section::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 120px;
  background: linear-gradient(to top, var(--bg-primary), transparent);
}

[data-theme="dark"] .hero::after,
.dark .hero::after {
  background: linear-gradient(to top, var(--bg-primary), transparent);
}

.hero-content {
  position: relative;
  z-index: 1;
  max-width: 900px;
  margin: 0 auto;
  text-align: center;
}

.hero-title {
  font-family: var(--font-display);
  font-size: clamp(2.5rem, 6vw, var(--text-5xl));
  font-weight: 800;
  line-height: 1.1;
  margin-bottom: var(--space-5);
  text-shadow: 0 2px 30px rgba(0, 0, 0, 0.3);
}

.hero-title .highlight {
  background: linear-gradient(90deg, #fff 0%, var(--color-accent) 50%, var(--color-highlight) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-subtitle {
  font-size: clamp(1rem, 2vw, 1.25rem);
  opacity: 0.9;
  max-width: 600px;
  margin: 0 auto var(--space-6);
  line-height: 1.6;
}

/* ============================================
   7. BUTTONS - Modern with Feedback
   ============================================ */
.btn,
.button,
[type="submit"] {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-5);
  font-family: var(--font-body);
  font-size: var(--text-base);
  font-weight: 600;
  border-radius: var(--radius-md);
  border: none;
  cursor: pointer;
  transition: all var(--transition-base);
  text-decoration: none;
}

.btn:active {
  transform: scale(0.98);
}

.btn-primary {
  background: linear-gradient(135deg, var(--color-primary), var(--color-primary-dark));
  color: white;
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.3);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(99, 102, 241, 0.4);
}

.btn-secondary {
  background: var(--bg-card);
  color: var(--text-primary);
  border: 2px solid var(--border-strong);
}

.btn-secondary:hover {
  border-color: var(--color-primary);
  color: var(--color-primary);
}

.btn-ghost {
  background: transparent;
  color: var(--color-primary);
}

.btn-ghost:hover {
  background: var(--color-primary-light);
}

/* ============================================
   8. READING PROGRESS BAR
   ============================================ */
.reading-progress {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 3px;
  background: transparent;
  z-index: 9999;
}

.reading-progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--color-primary), var(--color-accent));
  width: 0%;
  transition: width 50ms linear;
}

/* ============================================
   9. NAVIGATION
   ============================================ */
.nav,
#nav,
header nav {
  background: var(--bg-card);
  border-bottom: 1px solid var(--border-color);
  backdrop-filter: blur(10px);
}

[data-theme="dark"] .nav,
.dark header nav {
  background: rgba(9, 9, 11, 0.9);
}

.nav-link {
  font-weight: 500;
  color: var(--text-secondary);
  transition: color var(--transition-fast);
}

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

/* ============================================
   10. FOOTER
   ============================================ */
footer,
.footer {
  background: var(--bg-secondary);
  border-top: 1px solid var(--border-color);
  padding: var(--space-8) var(--space-5);
  margin-top: var(--space-9);
}

/* ============================================
   11. MICRO-INTERACTIONS
   ============================================ */

/* Smooth link underlines */
a {
  transition: color var(--transition-fast);
}

/* Focus states */
a:focus-visible,
button:focus-visible,
input:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

/* Selection color */
::selection {
  background: rgba(99, 102, 241, 0.3);
}

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

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

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

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

/* Skeleton loading */
.skeleton {
  background: linear-gradient(90deg, 
    var(--bg-secondary) 25%, 
    var(--bg-tertiary) 50%, 
    var(--bg-secondary) 75%
  );
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-md);
}

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

/* ============================================
   12. RESPONSIVE ADJUSTMENTS
   ============================================ */
@media (max-width: 768px) {
  :root {
    --text-4xl: 2rem;
    --text-5xl: 2.5rem;
  }
  
  .post-content,
  .article-content {
    font-size: var(--text-lg);  /* 18px on mobile */
  }
  
  .hero {
    padding: var(--space-7) var(--space-4);
    min-height: 350px;
  }
  
  .card-grid {
    grid-template-columns: 1fr;
    gap: var(--space-4);
  }
}

/* ============================================
   13. UTILITY CLASSES
   ============================================ */
.container {
  max-width: var(--container-width);
  margin: 0 auto;
  padding: 0 var(--space-5);
}

.content-width {
  max-width: var(--content-width);
  margin: 0 auto;
}

.text-gradient {
  background: linear-gradient(135deg, var(--color-primary), var(--color-accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.glow {
  box-shadow: var(--shadow-glow);
}

/* Spacing utilities */
.mt-0 { margin-top: 0; }
.mt-4 { margin-top: var(--space-4); }
.mt-6 { margin-top: var(--space-6); }
.mt-8 { margin-top: var(--space-8); }
.mb-4 { margin-bottom: var(--space-4); }
.mb-6 { margin-bottom: var(--space-6); }
.py-6 { padding-top: var(--space-6); padding-bottom: var(--space-6); }
.py-8 { padding-top: var(--space-8); padding-bottom: var(--space-8); }
