/**
 * blog.css
 * Main stylesheet for static blog pages with inline theme variables
 */

/* ============================================
   CSS Variables (Inlined Theme)
   ============================================ */

:root {
  /* Colors */
  --color-primary: hsl(0, 0%, 35%);
  --color-primary-rgb: 89, 89, 89;
  --color-secondary: hsl(0, 0%, 55%);
  --color-success: #4A4A4A;
  --color-warning: #606060;
  --color-error: #404040;

  --color-surface: #FFFFFF;
  --color-surface-dark: #F5F5F5;
  --color-surface-variant: hsl(0, 0%, 97%);
  --color-secondary-container: hsl(0, 0%, 95%);
  --color-error-container: #F0F0F0;

  --color-text-primary: #111111;
  --color-text-secondary: #666666;
  --color-text-inverted: #FFFFFF;
  --color-text-disabled: #999999;

  --color-background: hsl(0, 0%, 100%);
  --color-background-dark: hsl(0, 0%, 98%);

  --color-border: hsl(0, 0%, 85%);
  --color-border-dark: hsl(0, 0%, 80%);
  --color-outline: hsl(0, 0%, 75%);

  --color-border-primary-10: rgba(var(--color-primary-rgb), 0.1);
  --color-border-primary-15: rgba(var(--color-primary-rgb), 0.15);
  --color-border-primary-20: rgba(var(--color-primary-rgb), 0.2);

  /* Spacing */
  --spacing-xs: 4px;
  --spacing-sm: 8px;
  --spacing-md: 16px;
  --spacing-lg: 24px;
  --spacing-xl: 32px;
  --spacing-xxl: 48px;

  /* Typography */
  --font-body: 'OpenSans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-heading: 'Zepto', Georgia, serif;
  --font-brand: 'ArchivoBlack', Impact, sans-serif;

  --font-size-xs: 12px;
  --font-size-sm: 14px;
  --font-size-md: 15px;
  --font-size-lg: 18px;
  --font-size-xl: 20px;
  --font-size-xxl: 28px;

  --font-weight-regular: 400;
  --font-weight-medium: 500;
  --font-weight-semibold: 600;
  --font-weight-bold: 700;

  /* Border Radius */
  --radius-xs: 2px;
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --radius-xxl: 24px;
  --radius-round: 9999px;

  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.08);
  --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.12);
  --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.15);
  --shadow-accent: 0 4px 12px rgba(100, 100, 100, 0.2);

  /* Animation */
  --animation-fast: 150ms;
  --animation-normal: 300ms;
  --animation-slow: 500ms;

  /* Z-index */
  --z-base: 1;
  --z-content: 10;
  --z-navigation: 100;
  --z-modal: 1000;
  --z-tooltip: 2000;
}

/* ============================================
   Global Reset
   ============================================ */

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

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

body {
  margin: 0;
  padding: 0;
  background: var(--color-background);
  color: var(--color-text-primary);
  font-family: var(--font-body);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ============================================
   Header & Navigation
   ============================================ */

header {
  border-bottom: 1px solid var(--color-border);
  padding: var(--spacing-md) 0;
  background: var(--color-surface);
  position: static;
  z-index: var(--z-navigation);
}

nav {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 var(--spacing-lg);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--spacing-xl);
}

nav a {
  color: var(--color-text-secondary);
  text-decoration: none;
  font-weight: var(--font-weight-medium);
  transition: color var(--animation-fast) ease;
}

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

.logo-link {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  color: var(--color-text-primary);
}

.logo-link .logo {
  height: 32px;
  width: auto;
}

.logo-link .site-name {
  font-family: var(--font-brand);
  font-size: var(--font-size-xl);
  letter-spacing: -0.02em;
}

.chat-link {
  padding: var(--spacing-sm) var(--spacing-md);
  background: var(--color-primary);
  color: var(--color-text-inverted) !important;
  border-radius: var(--radius-md);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-semibold);
  transition: all var(--animation-fast) ease;
}

.chat-link:hover {
  background: var(--color-secondary);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

/* ============================================
   Main Content
   ============================================ */

main {
  max-width: 1200px;
  margin: 0 auto;
  padding: var(--spacing-xxl) var(--spacing-lg);
}

.blog-post {
  max-width: 780px;
  margin: 0 auto;
}

/* ============================================
   Post Header
   ============================================ */

.post-header {
  max-width: 680px;
  margin: 0 auto var(--spacing-xxl);
  text-align: center;
}

.post-header h1 {
  font-family: var(--font-heading);
  font-size: 3rem;
  line-height: 1.2;
  margin-bottom: var(--spacing-md);
  letter-spacing: -0.03em;
  color: var(--color-text-primary);
}

.post-meta {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--spacing-md);
  color: var(--color-text-secondary);
  font-size: var(--font-size-sm);
}

/* ============================================
   Post Content Typography
   ============================================ */

.post-content {
  font-size: 18px;
  line-height: 1.75;
  color: var(--color-text-primary);
}

.post-content h1,
.post-content h2,
.post-content h3,
.post-content h4,
.post-content h5,
.post-content h6 {
  font-family: var(--font-heading);
  font-weight: var(--font-weight-bold);
  line-height: 1.3;
  color: var(--color-text-primary);
  margin-top: 2.5em;
  margin-bottom: 0.75em;
  letter-spacing: -0.02em;
}

.post-content h2 {
  font-size: 2rem;
  border-bottom: 1px solid var(--color-border);
  padding-bottom: 0.25em;
}

.post-content h3 {
  font-size: 1.5rem;
}

.post-content h4 {
  font-size: 1.25rem;
}

.post-content p {
  margin-bottom: 1.5em;
}

.post-content a {
  color: var(--color-primary);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
  transition: all var(--animation-fast) ease;
}

.post-content a:hover {
  color: var(--color-text-primary);
  text-decoration-thickness: 2px;
}

.post-content ul,
.post-content ol {
  margin-bottom: 1.5em;
  padding-left: 1.75em;
}

.post-content li {
  margin-bottom: 0.5em;
  line-height: 1.6;
}

.post-content blockquote {
  margin: 2em 0;
  padding: var(--spacing-lg) var(--spacing-xl);
  border-left: 4px solid var(--color-primary);
  background: var(--color-surface-variant);
  border-radius: var(--radius-sm);
  font-style: italic;
  color: var(--color-text-secondary);
}

.post-content hr {
  border: none;
  border-top: 2px solid var(--color-border);
  margin: 3em 0;
  opacity: 0.5;
}

.post-content img {
  max-width: 100%;
  height: auto;
  display: block;
  margin: 2em auto;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}

/* ============================================
   Code Styling
   ============================================ */

.post-content code {
  font-family: 'Monaco', 'Courier New', monospace;
  font-size: 0.9em;
  padding: 0.2em 0.4em;
  background: var(--color-surface-variant);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xs);
  color: var(--color-text-primary);
}

.post-content pre {
  margin: 2em 0;
  border-radius: var(--radius-md);
  background: #282c34;
  overflow-x: auto;
  box-shadow: var(--shadow-md);
}

.post-content pre code {
  display: block;
  padding: var(--spacing-lg);
  font-size: 14px;
  line-height: 1.6;
  background: none;
  border: none;
  color: #abb2bf;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

/* ============================================
   Tables
   ============================================ */

.post-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 2em 0;
  font-size: 0.9em;
}

.post-content th,
.post-content td {
  padding: 0.75em 1em;
  text-align: left;
  border-bottom: 1px solid var(--color-border);
}

.post-content th {
  background: var(--color-surface-variant);
  font-weight: var(--font-weight-bold);
  color: var(--color-text-primary);
}

.post-content tr:hover {
  background: var(--color-surface-variant);
}

/* ============================================
   Blog List
   ============================================ */

.blog-list h1 {
  font-family: var(--font-brand);
  font-size: 4rem;
  margin-bottom: var(--spacing-sm);
  letter-spacing: -0.03em;
}

.subtitle {
  font-size: var(--font-size-xl);
  color: var(--color-text-secondary);
  margin-bottom: var(--spacing-xxl);
}

.posts {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: var(--spacing-xl);
  margin-top: var(--spacing-xxl);
}

.blog-card,
.content-card {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--spacing-lg);
  transition: all var(--animation-fast) ease;
  background: var(--color-surface);
  height: 100%;
  display: flex;
  flex-direction: column;
}

.blog-card:hover,
.content-card:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--color-primary);
  transform: translateY(-2px);
}

.blog-card h2,
.content-card h2 {
  font-family: var(--font-heading);
  font-size: var(--font-size-xl);
  margin-bottom: var(--spacing-sm);
  line-height: 1.3;
}

.blog-card h2 a,
.content-card h2 a {
  color: var(--color-text-primary);
  text-decoration: none;
}

.blog-card h2 a:hover,
.content-card h2 a:hover {
  color: var(--color-primary);
}

.blog-card p,
.content-card p {
  color: var(--color-text-secondary);
  margin-bottom: var(--spacing-md);
  line-height: 1.6;
  flex-grow: 1;
}

.meta {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  font-size: var(--font-size-sm);
  color: var(--color-text-disabled);
  padding-top: var(--spacing-md);
  border-top: 1px solid var(--color-border);
}

/* ============================================
   Footer
   ============================================ */

footer {
  border-top: 1px solid var(--color-border);
  padding: var(--spacing-xxl) var(--spacing-lg);
  color: var(--color-text-secondary);
  font-size: var(--font-size-sm);
  margin-top: var(--spacing-xxl);
  background: var(--color-surface-variant);
}

.footer-content {
  max-width: 1200px;
  margin: 0 auto;
}

.related-posts {
  margin-bottom: var(--spacing-xxl);
  padding-bottom: var(--spacing-xxl);
  border-bottom: 1px solid var(--color-border);
}

.related-posts h3 {
  font-family: var(--font-heading);
  font-size: var(--font-size-xl);
  color: var(--color-text-primary);
  margin-bottom: var(--spacing-lg);
  letter-spacing: -0.02em;
}

.related-posts-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--spacing-md);
}

.related-post {
  padding: var(--spacing-md);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  transition: all var(--animation-fast) ease;
}

.related-post:hover {
  border-color: var(--color-primary);
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
}

.related-post a {
  color: var(--color-text-primary);
  text-decoration: none;
  font-weight: var(--font-weight-medium);
  display: block;
}

.footer-meta {
  text-align: center;
}

/* ============================================
   Responsive
   ============================================ */

@media (max-width: 768px) {
  nav {
    gap: var(--spacing-md);
  }

  .logo-link .site-name {
    font-size: var(--font-size-lg);
  }

  .logo-link .logo {
    height: 24px;
  }

  .chat-link {
    font-size: var(--font-size-xs);
    padding: var(--spacing-xs) var(--spacing-sm);
  }

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

  .blog-list h1 {
    font-size: 2.5rem;
  }

  .posts {
    grid-template-columns: 1fr;
  }

  .post-content {
    font-size: 17px;
  }

  .post-content pre {
    margin-left: calc(var(--spacing-md) * -1);
    margin-right: calc(var(--spacing-md) * -1);
    border-radius: 0;
  }

  .post-content pre code {
    font-size: 13px;
  }

  .related-posts-list {
    grid-template-columns: 1fr;
  }
}
