/* ========================================
   Karim Bhalwani Blog - Polished Minimal Theme
   ======================================== */

/* CSS Variables for easy theming */
:root {
  /* Color Palette - Medium-inspired deep graphite */
  --color-bg: #ffffff;
  --color-surface: #ffffff;
  --color-text: #242424;
  --color-text-muted: #6b6b6b;
  --color-accent: #E77500;
  --color-accent-hover: #c96500;
  --color-border: #e2e8f0;
  --color-tip: #42b983;
  --color-tip-bg: #e2f5ec;

  /* Typography */
  --font-display: 'Newsreader', serif;
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-serif: 'Source Serif 4', Georgia, 'Times New Roman', serif;
  --font-mono: 'SF Mono', 'Fira Code', monospace;

  /* Spacing */
  --space-xs: 0.5rem;
  --space-sm: 1rem;
  --space-md: 1.5rem;
  --space-lg: 2rem;
  --space-xl: 3rem;
}

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

/* Base */
html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-sans);
  font-size: 1rem;
  line-height: 1.7;
  font-weight: 400;
  color: var(--color-text);
  background-color: var(--color-bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-osx-font-smoothing: grayscale;
}

/* Images */
img {
  max-width: 100%;
  height: auto;
  display: block;
  margin: var(--space-md) auto;
  border-radius: 8px;
}

.img-hero {
  width: 100%;
  margin-top: 0;
  margin-bottom: var(--space-xl);
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

/* Typography */
h1,
h2,
h3,
h4,
h5,
h6 {
  font-weight: 700;
  line-height: 1.25;
  color: var(--color-text);
  margin-top: var(--space-xl);
  margin-bottom: var(--space-md);
  letter-spacing: -0.022em;
}

h1 {
  font-size: 2.5rem;
}

h2 {
  font-size: 1.8rem;
}

h3 {
  font-size: 1.4rem;
}

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

/* Links */
a {
  color: var(--color-accent);
  text-decoration: none;
  transition: color 0.2s ease;
}

a:hover {
  color: var(--color-accent-hover);
}

/* Layout */
.wrap {
  max-width: 720px;
  margin: 0 auto;
  padding: 0 var(--space-md);
}

.page-content {
  padding: var(--space-xl) 0;
  min-height: calc(100vh - 180px);
}

/* Header */
.site-header {
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  padding: var(--space-md) 0;
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(8px);
  background: rgba(255, 255, 255, 0.9);
}

.site-header .wrap {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.site-title {
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--color-text);
  letter-spacing: -0.02em;
}

.site-title:hover {
  color: var(--color-accent);
}

.site-nav a {
  color: var(--color-text-muted);
  font-weight: 500;
  font-size: 0.9rem;
  margin-left: var(--space-md);
  transition: color 0.2s ease;
}

.site-nav a:hover {
  color: var(--color-accent);
}

/* Footer */
.site-footer {
  border-top: 1px solid var(--color-border);
  padding: var(--space-lg) 0;
  background: var(--color-surface);
  text-align: center;
}

.site-footer p {
  color: var(--color-text-muted);
  font-size: 0.875rem;
  margin-bottom: var(--space-xs);
}

.site-footer a {
  color: var(--color-text-muted);
  font-weight: 500;
}

.site-footer a:hover {
  color: var(--color-accent);
}

/* Home Page - Post List */
.home .posts {
  list-style: none;
}

.home .posts li {
  margin-bottom: var(--space-xl);
  padding-bottom: var(--space-lg);
  border-bottom: 1px solid var(--color-border);
}

.home .posts li:last-child {
  border-bottom: none;
}

.post-date {
  display: block;
  color: var(--color-text-muted);
  font-size: 0.85rem;
  font-weight: 500;
  margin-bottom: var(--space-xs);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.post-link {
  font-size: 1.4rem;
  font-weight: 600;
  display: block;
  margin-bottom: var(--space-xs);
  color: var(--color-text);
  letter-spacing: -0.02em;
  transition: color 0.2s ease;
}

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

.post-excerpt {
  color: var(--color-text-muted);
  line-height: 1.6;
  font-size: 1rem;
}

/* Post Page */
.post-header {
  margin-bottom: var(--space-xl);
  padding-bottom: var(--space-lg);
}

.post-header h1 {
  margin: 0 0 var(--space-xs) 0;
  font-size: 2.75rem;
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 1.15;
}

.post-meta {
  color: var(--color-text-muted);
  font-size: 0.95rem;
  font-weight: 400;
}

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

/* Summary/TL;DR Section */
.post-tldr {
  font-family: var(--font-sans);
  font-size: 1rem;
  line-height: 1.6;
  padding: var(--space-md);
  margin-bottom: var(--space-xl);
  background: #fef3c7;
  border-left: 3px solid var(--color-accent);
  border-radius: 0 6px 6px 0;
}

.post-tldr strong {
  color: var(--color-accent);
}

.post-content {
  font-family: var(--font-serif);
  font-size: 1.25rem;
  line-height: 1.62;
  margin-bottom: var(--space-xl);
}

.post-content h2,
.post-content h3,
.post-content h4 {
  font-family: var(--font-sans);
}

.post-content h2 {
  margin-top: var(--space-xl);
}

.post-content ul,
.post-content ol {
  margin-left: var(--space-md);
  margin-bottom: var(--space-sm);
}

.post-content li {
  margin-bottom: var(--space-xs);
}

/* Code Blocks */
pre,
code {
  font-family: var(--font-mono);
  font-size: 0.9rem;
  background-color: #f1f5f9;
  border-radius: 6px;
}

pre {
  padding: var(--space-md);
  overflow-x: auto;
  margin-bottom: var(--space-md);
  border: 1px solid var(--color-border);
}

code {
  padding: 0.2em 0.4em;
}

pre code {
  padding: 0;
  background-color: transparent;
  border: none;
}

/* Blockquotes - Alex Zhang style */
blockquote {
  background: var(--color-bg);
  border-left: 4px solid var(--color-accent);
  margin: var(--space-md) 0;
  padding: var(--space-sm) var(--space-md);
  font-size: 1.1rem;
  font-style: italic;
}

blockquote p {
  margin-bottom: 0;
}

/* Strong emphasis in content */
.post-content strong,
.page .page-content strong {
  color: var(--color-text);
  font-weight: 600;
}

/* Page Layout */
.page-header {
  margin-bottom: var(--space-lg);
}

.page-header h1 {
  margin: 0;
}

.page .page-content {
  font-family: var(--font-serif);
  font-size: 1.1rem;
  line-height: 1.8;
}

.page .page-content h2,
.page .page-content h3,
.page .page-content h4 {
  font-family: var(--font-sans);
}

.page .page-content ul,
.page .page-content ol {
  margin-left: var(--space-md);
  margin-bottom: var(--space-sm);
}

.page .page-content li {
  margin-bottom: var(--space-xs);
}

/* Responsive */
@media screen and (max-width: 640px) {
  html {
    font-size: 15px;
  }

  .wrap {
    padding: 0 var(--space-sm);
  }

  .site-header .wrap {
    flex-direction: column;
    gap: var(--space-sm);
  }

  .site-nav a {
    margin-left: var(--space-sm);
  }

  .site-nav a:first-child {
    margin-left: 0;
  }

  .post-link {
    font-size: 1.2rem;
  }

  .post-header h1 {
    font-size: 1.75rem;
  }
}

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