/* =========================================
   CSS Variables & Theme
   ========================================= */
:root {
  --bg: #ffffff;
  --bg-secondary: #f8f9fa;
  --text: #1a1a2e;
  --text-muted: #6b7280;
  --accent: #6c63ff;
  --accent-hover: #5a52d5;
  --border: #e5e7eb;
  --code-bg: #f3f4f6;
  --card-shadow: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.05);
  --card-shadow-hover: 0 10px 30px rgba(108,99,255,0.12), 0 4px 8px rgba(0,0,0,0.06);
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: "SF Mono", "Fira Code", "Cascadia Code", Consolas, monospace;
  --radius: 12px;
  --max-width: 760px;
  --transition: 0.2s ease;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f0f1a;
    --bg-secondary: #1a1a2e;
    --text: #e8e8f0;
    --text-muted: #9ca3af;
    --accent: #8b82ff;
    --accent-hover: #a39bff;
    --border: #2d2d44;
    --code-bg: #1e1e30;
    --card-shadow: 0 1px 3px rgba(0,0,0,0.3), 0 1px 2px rgba(0,0,0,0.2);
    --card-shadow-hover: 0 10px 30px rgba(139,130,255,0.15), 0 4px 8px rgba(0,0,0,0.3);
  }
}

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

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: background var(--transition), color var(--transition);
}

/* =========================================
   Layout
   ========================================= */
.container {
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1.5rem;
}

main {
  flex: 1;
  padding: 3rem 0;
}

/* =========================================
   Header / Nav
   ========================================= */
header {
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  background: rgba(255,255,255,0.85);
}

@media (prefers-color-scheme: dark) {
  header {
    background: rgba(15,15,26,0.85);
  }
}

nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.5rem;
  max-width: var(--max-width);
  margin: 0 auto;
}

.nav-logo {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text);
  text-decoration: none;
  letter-spacing: -0.02em;
}

.nav-logo span {
  color: var(--accent);
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 2rem;
  list-style: none;
}

.nav-links a {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  transition: color var(--transition);
}

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

/* =========================================
   Hero Section
   ========================================= */
.hero {
  padding: 4rem 0 3rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 3rem;
}

.hero-greeting {
  font-size: 0.875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent);
  margin-bottom: 0.75rem;
}

.hero h1 {
  font-size: clamp(2rem, 5vw, 3rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.2;
  margin-bottom: 1rem;
  background: linear-gradient(135deg, var(--text) 0%, var(--accent) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero p {
  font-size: 1.125rem;
  color: var(--text-muted);
  max-width: 520px;
  line-height: 1.75;
}

/* =========================================
   Section Headers
   ========================================= */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
}

.section-title {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.view-all {
  font-size: 0.875rem;
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
  transition: opacity var(--transition);
}

.view-all:hover {
  opacity: 0.8;
}

/* =========================================
   Post Cards
   ========================================= */
.post-grid {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.post-card {
  display: block;
  padding: 1.5rem;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-decoration: none;
  color: inherit;
  box-shadow: var(--card-shadow);
  transition: box-shadow var(--transition), transform var(--transition), border-color var(--transition);
}

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

.post-card-meta {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
}

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

.post-tag {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.post-tag.tag-tech { background: #6c63ff; }
.post-tag.tag-life { background: #10b981; }
.post-tag.tag-thoughts { background: #f59e0b; }
.post-tag.tag-tutorial { background: #3b82f6; }

.post-card h2 {
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 0.5rem;
  line-height: 1.35;
  transition: color var(--transition);
}

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

.post-card p {
  font-size: 0.925rem;
  color: var(--text-muted);
  line-height: 1.65;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

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

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

.read-more {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--accent);
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.read-more::after {
  content: "→";
  transition: transform var(--transition);
}

.post-card:hover .read-more::after {
  transform: translateX(3px);
}

/* =========================================
   Article / Blog Post
   ========================================= */
.post-header {
  padding: 3rem 0 2rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 2.5rem;
}

.post-header-meta {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.875rem;
  color: var(--text-muted);
  text-decoration: none;
  font-weight: 500;
  margin-bottom: 1.5rem;
  transition: color var(--transition);
}

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

.back-link::before {
  content: "←";
}

.post-header h1 {
  font-size: clamp(1.75rem, 4vw, 2.5rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.2;
  margin-bottom: 1rem;
}

.post-header .post-description {
  font-size: 1.125rem;
  color: var(--text-muted);
  line-height: 1.7;
}

.article-body {
  font-size: 1.0625rem;
  line-height: 1.8;
}

.article-body h2 {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 2.5rem 0 1rem;
  color: var(--text);
}

.article-body h3 {
  font-size: 1.2rem;
  font-weight: 700;
  margin: 2rem 0 0.75rem;
}

.article-body p {
  margin-bottom: 1.5rem;
}

.article-body a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.article-body ul,
.article-body ol {
  margin: 1.5rem 0;
  padding-left: 1.5rem;
}

.article-body li {
  margin-bottom: 0.5rem;
}

.article-body code {
  font-family: var(--font-mono);
  font-size: 0.875em;
  background: var(--code-bg);
  padding: 0.2em 0.4em;
  border-radius: 4px;
  color: var(--accent);
}

.article-body pre {
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  overflow-x: auto;
  margin: 1.5rem 0;
}

.article-body pre code {
  background: none;
  padding: 0;
  color: var(--text);
  font-size: 0.9rem;
}

.article-body blockquote {
  border-left: 3px solid var(--accent);
  padding: 0.5rem 0 0.5rem 1.5rem;
  margin: 2rem 0;
  color: var(--text-muted);
  font-style: italic;
}

.article-body hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 3rem 0;
}

/* =========================================
   About Page
   ========================================= */
.about-header {
  padding: 4rem 0 3rem;
}

.about-avatar {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent) 0%, #a78bfa 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  margin-bottom: 1.5rem;
}

.about-header h1 {
  font-size: 2.5rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  margin-bottom: 0.5rem;
}

.about-header .role {
  font-size: 1rem;
  color: var(--accent);
  font-weight: 600;
  margin-bottom: 1rem;
}

.about-content {
  font-size: 1.05rem;
  line-height: 1.85;
}

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

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

.skills-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 0.75rem;
  margin: 1.5rem 0;
}

.skill-tag {
  padding: 0.5rem 1rem;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.875rem;
  font-weight: 500;
  text-align: center;
  color: var(--text);
}

.social-links {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  margin-top: 2rem;
}

.social-link {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 1.2rem;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 8px;
  text-decoration: none;
  color: var(--text);
  font-size: 0.875rem;
  font-weight: 500;
  transition: border-color var(--transition), color var(--transition);
}

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

/* =========================================
   Footer
   ========================================= */
footer {
  border-top: 1px solid var(--border);
  padding: 2rem 1.5rem;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.875rem;
}

footer a {
  color: var(--accent);
  text-decoration: none;
}

/* =========================================
   Utilities
   ========================================= */
.divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 3rem 0;
}

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

/* =========================================
   Responsive
   ========================================= */
@media (max-width: 640px) {
  nav {
    padding: 0.875rem 1rem;
  }

  .nav-links {
    gap: 1.25rem;
  }

  main {
    padding: 2rem 0;
  }

  .hero {
    padding: 2.5rem 0 2rem;
  }

  .post-card {
    padding: 1.25rem;
  }
}
