@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Space+Grotesk:wght@450;500;600;700&display=swap');

:root {
  /* Theme variables - Dark Mode (Default) */
  --bg-color: #020617; /* slate-950 */
  --panel-bg: rgba(15, 23, 42, 0.5); /* slate-900/50 */
  --card-bg: rgba(15, 23, 42, 0.5);
  --card-hover-bg: rgba(15, 23, 42, 0.8);
  --tag-bg: rgba(99, 102, 241, 0.1);
  --border-color: rgba(30, 41, 59, 0.8); /* slate-800 */
  --border-hover: rgba(99, 102, 241, 0.4); /* indigo */
  --text-primary: #f8fafc; /* slate-50 */
  --text-secondary: #94a3b8; /* slate-400 */
  --accent-color: #6366f1; /* indigo-500 */
  --accent-gradient: linear-gradient(135deg, #6366f1 0%, #818cf8 100%);
  --accent-glow: rgba(99, 102, 241, 0.2);
  --selection-bg: rgba(99, 102, 241, 0.3);
  --selection-color: #f8fafc;
  --card-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.3), 0 4px 6px -4px rgba(0, 0, 0, 0.3);
  
  --font-title: 'Space Grotesk', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  
  --transition-fast: 0.15s ease;
  --transition-normal: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  
  --bg-gradient-1: rgba(99, 102, 241, 0.05);
  --bg-gradient-2: rgba(245, 158, 11, 0.02);
}

html[data-theme="light"] {
  /* Theme variables - Light Mode */
  --bg-color: #f8fafc; /* slate-50 */
  --panel-bg: rgba(255, 255, 255, 0.8);
  --card-bg: rgba(255, 255, 255, 0.8);
  --card-hover-bg: #ffffff;
  --tag-bg: rgba(99, 102, 241, 0.08);
  --border-color: rgba(226, 232, 240, 0.8); /* slate-200 */
  --border-hover: rgba(99, 102, 241, 0.3); /* indigo */
  --text-primary: #0f172a; /* slate-900 */
  --text-secondary: #475569; /* slate-600 */
  --accent-color: #4f46e5; /* indigo-600 */
  --accent-gradient: linear-gradient(135deg, #4f46e5 0%, #6366f1 100%);
  --accent-glow: rgba(99, 102, 241, 0.1);
  --selection-bg: rgba(99, 102, 241, 0.15);
  --selection-color: #4f46e5;
  --card-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
  
  --bg-gradient-1: rgba(99, 102, 241, 0.03);
  --bg-gradient-2: rgba(245, 158, 11, 0.015);
}

/* Selection */
::selection {
  background: var(--selection-bg);
  color: var(--selection-color);
}

/* Base resets & styles */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background-color: var(--bg-color);
  background-image: 
    radial-gradient(at 0% 0%, var(--bg-gradient-1) 0px, transparent 50%),
    radial-gradient(at 100% 100%, var(--bg-gradient-2) 0px, transparent 50%);
  color: var(--text-primary);
  font-family: var(--font-body);
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  display: flex;
  flex-direction: column;
}

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

/* Page Layout */
.site-container {
  max-width: 1024px; /* max-w-5xl */
  width: 100%;
  margin: 0 auto;
  padding: 2rem 1.5rem;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  gap: 2rem;
}

/* Header & Navbar */
.site-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 1.5rem;
  background: var(--panel-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border-color);
  border-radius: 9999px; /* Pill-shaped navbar! */
  box-shadow: var(--card-shadow);
  position: sticky;
  top: 1rem;
  z-index: 100;
  transition: border-color var(--transition-normal), background var(--transition-normal);
}

.site-logo {
  font-family: var(--font-title);
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.nav-link {
  font-family: var(--font-title);
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-secondary);
  padding: 0.4rem 0.8rem;
  border-radius: 9999px;
  border: 1px solid transparent;
  transition: all var(--transition-fast);
}

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

.nav-link.active {
  color: var(--accent-color);
  background: var(--tag-bg);
  border-color: rgba(99, 102, 241, 0.2);
}

/* Theme Toggle Button */
.theme-toggle {
  background: none;
  border: 1px solid transparent;
  color: var(--text-secondary);
  cursor: pointer;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 9999px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  transition: all var(--transition-fast);
}

.theme-toggle:hover {
  color: var(--text-primary);
  background: var(--panel-bg);
  border-color: var(--border-color);
}

/* Toggle visibility of icons based on current theme */
[data-theme="light"] .theme-toggle .light-icon {
  display: none;
}
[data-theme="light"] .theme-toggle .dark-icon {
  display: block;
}
html:not([data-theme="light"]) .theme-toggle .light-icon {
  display: block;
}
html:not([data-theme="light"]) .theme-toggle .dark-icon {
  display: none;
}

.lang-switch {
  font-family: var(--font-title);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
  padding: 0.4rem 0.8rem;
  border-radius: 9999px;
  border: 1px solid var(--border-color);
  background: rgba(255, 255, 255, 0.02);
  transition: all var(--transition-fast);
}

.lang-switch:hover {
  color: var(--accent-color);
  border-color: var(--accent-color);
  background: var(--tag-bg);
}

/* Layout Content - Single Column */
.site-content {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 2rem;
  align-items: center;
}

.main-content {
  width: 100%;
}

/* Blog Intro / Hero */
.blog-hero {
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 2.5rem;
  margin-bottom: 2.5rem;
  text-align: center;
  max-width: 800px;
  margin-left: auto;
  margin-right: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
}

/* Profile Intro block with avatar */
.profile-intro {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  text-align: left;
  margin-bottom: 0.5rem;
  width: 100%;
}

.hero-avatar {
  width: 80px;
  height: 80px;
  border-radius: 9999px;
  border: 2px solid var(--border-color);
  padding: 2px;
  object-fit: cover;
  transition: border-color var(--transition-normal);
}

.blog-hero:hover .hero-avatar {
  border-color: var(--accent-color);
}

.hero-title-area {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.hero-title-area h1 {
  font-family: var(--font-title);
  font-size: 2.25rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.1;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero-subtitle {
  font-family: var(--font-title);
  font-size: 1.1rem;
  font-weight: 500;
  color: var(--text-secondary);
}

.author-intro {
  font-size: 1.05rem;
  color: var(--text-secondary);
  line-height: 1.7;
  text-align: left;
  width: 100%;
}

.author-intro strong {
  font-weight: 600;
  color: var(--text-primary);
}

.author-intro a {
  color: var(--accent-color);
  border-bottom: 1px dashed var(--accent-color);
  font-weight: 500;
}

.author-intro a:hover {
  border-bottom-style: solid;
}

.hero-socials {
  display: flex;
  gap: 0.75rem;
  margin-top: 0.5rem;
  align-self: flex-start;
}

/* Monospaced / Minimal social icons matching connect section in portfolio */
.hero-social-link {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 9999px;
  border: 1px solid var(--border-color);
  background: var(--card-bg);
  color: var(--text-secondary);
  font-size: 0.95rem;
  transition: all var(--transition-fast);
}

.hero-social-link:hover {
  color: var(--text-primary);
  border-color: var(--text-primary);
  transform: translateY(-2px);
}

/* Feed Title */
.feed-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  width: 100%;
}

.feed-header h2 {
  font-family: var(--font-title);
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

/* Main Blog Feed & Cards */
.posts-list {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  width: 100%;
}

.post-preview {
  padding: 1.5rem;
  border-radius: 16px;
  border: 1px solid var(--border-color);
  background: var(--card-bg);
  transition: all var(--transition-normal);
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  position: relative;
  cursor: pointer;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.post-preview:hover {
  transform: translateY(-2px);
  border-color: var(--border-hover);
  background: var(--card-hover-bg);
  box-shadow: var(--card-shadow);
}

.post-meta {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-family: monospace;
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.post-category {
  background: var(--tag-bg);
  color: var(--accent-color);
  padding: 0.2rem 0.5rem;
  border-radius: 6px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-size: 0.7rem;
  border: 1px solid rgba(99, 102, 241, 0.15);
}

.post-preview h3 {
  font-family: var(--font-title);
  font-size: 1.35rem;
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: -0.01em;
  color: var(--text-primary);
  transition: color var(--transition-fast);
}

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

.post-excerpt {
  font-size: 0.95rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

.read-more {
  font-family: var(--font-title);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--accent-color);
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  transition: gap var(--transition-fast);
}

.read-more::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
}

.post-preview:hover .read-more {
  gap: 0.5rem;
}

/* Post Detail Layout */
.post-detail-container {
  max-width: 720px; /* Reading-optimized width */
  margin: 0 auto;
  width: 100%;
}

.post-header {
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 1.75rem;
  margin-bottom: 2rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.post-header h1 {
  font-family: var(--font-title);
  font-size: 2.5rem;
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.03em;
  color: var(--text-primary);
}

/* Markdown post content styling */
.post-content {
  line-height: 1.8;
  font-size: 1.05rem;
  color: var(--text-primary);
}

.post-content h2, .post-content h3, .post-content h4 {
  font-family: var(--font-title);
  color: var(--text-primary);
  margin-top: 2rem;
  margin-bottom: 0.85rem;
  letter-spacing: -0.015em;
  font-weight: 600;
}

.post-content h2 { font-size: 1.6rem; border-bottom: 1px solid var(--border-color); padding-bottom: 0.5rem; }
.post-content h3 { font-size: 1.3rem; }

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

.post-content p strong {
  color: var(--text-primary);
}

.post-content ul, .post-content ol {
  margin-left: 1.5rem;
  margin-bottom: 1.5rem;
  color: var(--text-secondary);
}

.post-content li {
  margin-bottom: 0.5rem;
}

/* Links inside posts */
.post-content a {
  color: var(--accent-color);
  border-bottom: 1px dashed var(--accent-color);
}

.post-content a:hover {
  border-bottom-style: solid;
}

/* Blockquotes */
.post-content blockquote {
  border-left: 4px solid var(--accent-color);
  padding: 0.5rem 0 0.5rem 1.25rem;
  margin: 1.5rem 0;
  background: var(--tag-bg);
  border-radius: 0 8px 8px 0;
  font-style: italic;
}

.post-content blockquote p {
  margin-bottom: 0;
  color: var(--text-primary);
}

/* Code & Highlight styling */
.post-content code {
  font-family: monospace;
  font-size: 0.9em;
  background: rgba(99, 102, 241, 0.08);
  color: var(--accent-color);
  padding: 0.2rem 0.4rem;
  border-radius: 6px;
  border: 1px solid rgba(99, 102, 241, 0.15);
}

.post-content pre {
  font-family: monospace;
  font-size: 0.9rem;
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 1.25rem;
  overflow-x: auto;
  margin: 1.5rem 0;
  line-height: 1.5;
}

.post-content pre code {
  background: none;
  border: none;
  color: var(--text-primary);
  padding: 0;
  font-size: inherit;
  border-radius: 0;
}

/* Dark Mode Rouge Syntax Highlighting */
html:not([data-theme="light"]) .highlight .c, 
html:not([data-theme="light"]) .highlight .c1 { color: #6a737d; font-style: italic; } /* Comment */
html:not([data-theme="light"]) .highlight .k { color: #ff7b72; font-weight: bold; } /* Keyword */
html:not([data-theme="light"]) .highlight .m,
html:not([data-theme="light"]) .highlight .mi { color: #79c0ff; } /* Number */
html:not([data-theme="light"]) .highlight .s,
html:not([data-theme="light"]) .highlight .s2 { color: #a5d6ff; } /* String */
html:not([data-theme="light"]) .highlight .na { color: #7ee787; } /* Attribute */
html:not([data-theme="light"]) .highlight .nb { color: #d2a8ff; } /* Builtin */
html:not([data-theme="light"]) .highlight .nc { color: #f0883e; font-weight: bold; } /* Class */
html:not([data-theme="light"]) .highlight .nf { color: #d2a8ff; } /* Function */
html:not([data-theme="light"]) .highlight .o { color: #ff7b72; } /* Operator */

/* Light Mode Rouge Syntax Highlighting */
html[data-theme="light"] .highlight .c, 
html[data-theme="light"] .highlight .c1 { color: #6a737d; font-style: italic; }
html[data-theme="light"] .highlight .k { color: #d73a49; font-weight: bold; }
html[data-theme="light"] .highlight .m,
html[data-theme="light"] .highlight .mi { color: #005cc5; }
html[data-theme="light"] .highlight .s,
html[data-theme="light"] .highlight .s2 { color: #032f62; }
html[data-theme="light"] .highlight .na { color: #e36209; }
html[data-theme="light"] .highlight .nb { color: #e36209; }
html[data-theme="light"] .highlight .nc { color: #6f42c1; font-weight: bold; }
html[data-theme="light"] .highlight .nf { color: #6f42c1; }
html[data-theme="light"] .highlight .o { color: #d73a49; }

/* Author card at the end of post */
.author-signature-card {
  margin-top: 3rem;
  padding: 1.5rem;
  border-radius: 16px;
  border: 1px solid var(--border-color);
  background: var(--panel-bg);
  display: flex;
  gap: 1.25rem;
  align-items: center;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.author-signature-avatar {
  width: 60px;
  height: 60px;
  border-radius: 9999px;
  object-fit: cover;
  border: 1px solid var(--border-color);
}

.author-signature-content {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  flex-grow: 1;
}

.author-signature-name {
  font-family: var(--font-title);
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-primary);
}

.author-signature-bio {
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* Featured Products grid section on home page */
.featured-products-section {
  width: 100%;
  margin-top: 2rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.featured-products-section h2 {
  font-family: var(--font-title);
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

/* Projects Page & Grid Styles */
.projects-header {
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 2rem;
  margin-bottom: 2rem;
  width: 100%;
}

.projects-header h1 {
  font-family: var(--font-title);
  font-size: 2.5rem;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.03em;
  margin-bottom: 0.75rem;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.projects-header p {
  font-size: 1.05rem;
  color: var(--text-secondary);
  line-height: 1.7;
}

.projects-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
  width: 100%;
}

@media (min-width: 768px) {
  .projects-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

.project-card {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  transition: all var(--transition-normal);
  position: relative;
  cursor: pointer;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.project-card:hover {
  transform: translateY(-4px);
  border-color: var(--border-hover);
  box-shadow: var(--card-shadow);
  background: var(--card-hover-bg);
}

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

.project-card-icon {
  font-size: 1.25rem;
  color: var(--accent-color);
  background: var(--tag-bg);
  width: 40px;
  height: 40px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(99, 102, 241, 0.15);
}

.project-card-logo {
  width: 24px;
  height: 24px;
  object-fit: contain;
  border-radius: 4px;
}

.project-card-header h3 {
  font-family: var(--font-title);
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
  transition: color var(--transition-fast);
}

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

.project-card-desc {
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.5;
  flex-grow: 1;
}

.project-card-footer {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  margin-top: auto;
  border-top: 1px solid var(--border-color);
  padding-top: 1rem;
}

.project-tag {
  font-size: 0.75rem;
  background: var(--tag-bg);
  color: var(--text-secondary);
  padding: 0.2rem 0.5rem;
  border-radius: 6px;
  font-family: monospace;
}

.project-card-link {
  font-family: var(--font-title);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--accent-color);
  margin-left: auto;
  transition: transform var(--transition-fast);
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}

.project-card:hover .project-card-link {
  transform: translateX(3px);
}

/* About Page layout wrap */
.about-content {
  max-width: 720px;
  margin: 0 auto;
  width: 100%;
}

.about-content h1 {
  font-family: var(--font-title);
  font-size: 2.5rem;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.03em;
  margin-bottom: 1.5rem;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.about-content h2 {
  font-family: var(--font-title);
  font-size: 1.6rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-top: 2rem;
  margin-bottom: 1rem;
  letter-spacing: -0.015em;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 0.5rem;
}

.about-content p {
  font-size: 1.05rem;
  color: var(--text-secondary);
  line-height: 1.8;
  margin-bottom: 1.25rem;
}

.about-content ul, .about-content ol {
  margin-left: 1.5rem;
  margin-bottom: 1.5rem;
  color: var(--text-secondary);
}

.about-content li {
  margin-bottom: 0.75rem;
  font-size: 1.05rem;
  line-height: 1.7;
}

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

/* Pagination */
.pagination {
  margin-top: 2.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
}

.pagination-item {
  font-family: var(--font-title);
  font-size: 0.9rem;
  font-weight: 600;
  padding: 0.5rem 1rem;
  border-radius: 9999px;
  border: 1px solid var(--border-color);
  background: var(--card-bg);
  transition: all var(--transition-fast);
}

.pagination-item:hover {
  border-color: var(--accent-color);
  background: var(--tag-bg);
  color: var(--accent-color);
}

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

/* Footer */
.site-footer {
  text-align: center;
  padding: 2.5rem 0;
  font-size: 0.85rem;
  color: var(--text-secondary);
  border-top: 1px solid var(--border-color);
  margin-top: auto;
  width: 100%;
}

/* Responsive queries */
@media (max-width: 900px) {
  .site-container {
    padding: 1.5rem 1rem;
  }
}

@media (max-width: 640px) {
  .site-header {
    flex-direction: column;
    gap: 0.75rem;
    padding: 1rem;
    border-radius: 24px;
    top: 0.5rem;
  }
  
  .site-nav {
    width: 100%;
    justify-content: center;
    gap: 0.5rem;
    flex-wrap: wrap;
  }
  
  .nav-link, .lang-switch {
    font-size: 0.85rem;
    padding: 0.3rem 0.6rem;
  }
  
  .post-header h1, .about-content h1, .projects-header h1 {
    font-size: 2rem;
  }
  
  .hero-avatar {
    width: 60px;
    height: 60px;
  }
  
  .hero-title-area h1 {
    font-size: 1.75rem;
  }
  
  .profile-intro {
    gap: 1rem;
  }
  
  .project-card {
    padding: 1.25rem;
  }
}
