@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;600;800&display=swap');

:root {
  --color-bg: #ffffff;
  --color-text: #1b1b1b;
  --color-text-grey: #6b6b6b;
  --color-link: #1851b4;
  --color-border: #e9e9e9;
  --color-surface: #f5f5f5;
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif;
  --font-mono: 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', monospace;
  --max-width: 722px;
  --max-post-width: 822px;
}

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

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-sans);
  font-size: 16px;
  font-weight: 400;
  line-height: 22px;
  color: var(--color-text);
  background: var(--color-bg);
}

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

a:hover {
  color: var(--color-link);
  text-decoration: none;
}

.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 24px;
}

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

.site-header nav {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 20px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.site-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 18px;
  font-weight: 500;
  color: var(--color-text);
  text-decoration: none;
  letter-spacing: -0.01em;
}

.site-logo {
  flex-shrink: 0;
}

.site-title:hover {
  color: var(--color-link);
  text-decoration: none;
}

.back-link {
  font-size: 14px;
  font-weight: 600;
  color: #fff;
  text-decoration: none;
  background: var(--color-text);
  padding: 10px 20px;
  border-radius: 100px;
  transition: all 0.15s ease;
}

.back-link:hover {
  background: var(--color-link);
  color: #fff;
  text-decoration: none;
  transform: translateY(-1px);
}

/* Main content */
main {
  padding: 48px 0 80px;
  background: #f7f7f7;
}

.page-post main {
  background: #fff;
}

main > h1 {
  font-size: 40px;
  font-weight: 800;
  line-height: 44px;
  margin-bottom: 32px;
  color: var(--color-text);
  max-width: var(--max-width);
  margin-left: auto;
  margin-right: auto;
  padding: 0 24px;
}

/* Post list */
.post-list {
  max-width: var(--max-post-width);
  margin: 0 auto;
  padding: 0 24px;
}

.post-preview {
  background: #fff;
  border: 1px solid #ddd;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
  padding: 80px 153px 80px;
  margin-bottom: 24px;
  margin-top: 60px;
  position: relative;
}

.post-preview:first-child {
  margin-top: 40px;
}

.post-preview:last-child {
  margin-bottom: 0;
}

.author-avatar {
  position: absolute;
  top: -40px;
  left: 50%;
  transform: translateX(-50%);
  width: 80px;
  height: 80px;
  border-radius: 50%;
  object-fit: cover;
}

.post-meta {
  font-size: 16px;
  font-weight: 400;
  line-height: 22px;
  color: var(--color-text-grey);
  margin-bottom: 24px;
  text-align: center;
}

.post-meta a {
  color: var(--color-text-grey);
}

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

.post-preview h3 {
  font-size: 30px;
  font-weight: 600;
  line-height: 40px;
  margin-bottom: 16px;
  text-align: center;
}

.post-preview h3 a {
  color: var(--color-text);
  text-decoration: none;
}

.post-preview h3 a:hover {
  color: var(--color-link);
  text-decoration: none;
}

.post-preview img {
  max-width: 100%;
  height: auto;
  border-radius: 4px;
  margin-bottom: 16px;
}

.post-preview img.author-avatar {
  position: absolute;
  top: -40px;
  left: 50%;
  transform: translateX(-50%);
  width: 80px;
  height: 80px;
  border-radius: 50%;
  object-fit: cover;
  margin: 0;
}

.post-preview p {
  font-size: 20px;
  font-weight: 400;
  line-height: 28px;
  color: var(--color-text);
  margin-bottom: 10px;
}

.post-preview p:last-child {
  margin-bottom: 0;
}

.post-preview p a {
  color: var(--color-text);
}

.post-preview p a:hover {
  color: var(--color-link);
  text-decoration: none;
}

/* Single post */
.post {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 40px 24px 80px;
  position: relative;
}


.post-header {
  margin-bottom: 40px;
  text-align: center;
}

.post-share {
  margin-top: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
}

.share-label {
  font-size: 14px;
  font-weight: 500;
  color: var(--color-text-grey);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.share-buttons {
  display: flex;
  gap: 8px;
}

.share-button {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--color-surface);
  color: var(--color-text);
  transition: all 0.15s ease;
}

.share-button:hover {
  background: var(--color-text);
  color: #fff;
  text-decoration: none;
}

.post-cta {
  margin-top: 40px;
  padding-top: 40px;
  border-top: 1px solid var(--color-border);
  text-align: center;
}

.post-cta p {
  font-size: 18px;
  color: var(--color-text-grey);
}

.post-cta a {
  color: var(--color-link);
  font-weight: 600;
  text-decoration: none;
}

.post-cta a:hover {
  text-decoration: none;
}

.post-date {
  font-size: 16px;
  font-weight: 400;
  line-height: 22px;
  color: var(--color-text-grey);
  margin-top: 8px;
}

.post-title {
  font-size: 30px;
  font-weight: 600;
  line-height: 40px;
  color: var(--color-text);
}

.post-image {
  max-width: 100%;
  height: auto;
  border-radius: 8px;
  margin-top: 24px;
}

.post-content {
  font-size: 20px;
  font-weight: 400;
  line-height: 30px;
}

.post-content p {
  margin-bottom: 36px;
}

.post-content h2 {
  font-size: 24px;
  font-weight: 600;
  line-height: 32px;
  margin-top: 60px;
  margin-bottom: 16px;
  color: var(--color-text);
}

.post-content h3 {
  font-size: 20px;
  font-weight: 600;
  line-height: 28px;
  margin-top: 40px;
  margin-bottom: 16px;
  color: var(--color-text);
}

.post-content a {
  color: var(--color-link);
  text-decoration: underline;
  text-decoration-color: rgba(24, 81, 180, 0.3);
  text-underline-offset: 2px;
}

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

.post-content strong {
  font-weight: 600;
}

.post-content ul,
.post-content ol {
  margin-bottom: 10px;
  padding-left: 24px;
}

.post-content li {
  margin-bottom: 8px;
}

.post-content code {
  font-family: var(--font-mono);
  font-size: 0.9em;
  background: var(--color-surface);
  padding: 2px 6px;
  border-radius: 4px;
}

.post-content pre {
  background: var(--color-surface);
  padding: 20px 24px;
  border-radius: 8px;
  overflow-x: auto;
  margin: 20px 0;
}

.post-content pre code {
  background: none;
  padding: 0;
  font-size: 14px;
  line-height: 22px;
}

/* Syntax highlighting - GitHub-inspired theme */
.highlight {
  background: var(--color-surface);
  border-radius: 8px;
  margin: 20px 0;
}

.highlight pre {
  margin: 0;
  padding: 20px 24px;
  overflow-x: auto;
}

.highlight .c,
.highlight .c1,
.highlight .cm { color: #6a737d; font-style: italic; } /* Comments */
.highlight .k,
.highlight .kd,
.highlight .kn,
.highlight .kp,
.highlight .kr,
.highlight .kt { color: #d73a49; } /* Keywords */
.highlight .s,
.highlight .s1,
.highlight .s2,
.highlight .sb,
.highlight .sc,
.highlight .sd,
.highlight .se,
.highlight .sh,
.highlight .si,
.highlight .sx,
.highlight .sr { color: #032f62; } /* Strings */
.highlight .mi,
.highlight .mf,
.highlight .mh,
.highlight .mo,
.highlight .il { color: #005cc5; } /* Numbers */
.highlight .na { color: #005cc5; } /* Attribute names */
.highlight .nb { color: #005cc5; } /* Built-in names */
.highlight .nc { color: #6f42c1; } /* Class names */
.highlight .nf,
.highlight .fm { color: #6f42c1; } /* Function names */
.highlight .nn { color: #005cc5; } /* Namespace */
.highlight .o,
.highlight .ow { color: #d73a49; } /* Operators */
.highlight .p { color: var(--color-text); } /* Punctuation */
.highlight .nv,
.highlight .vi,
.highlight .vm { color: #e36209; } /* Variables */
.highlight .nx { color: var(--color-text); } /* Other names */
.highlight .err { color: #cb2431; background-color: #ffeef0; } /* Errors */

.post-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 20px 0;
  font-size: 16px;
}

.post-content thead {
  background: var(--color-surface);
}

.post-content th {
  font-weight: 600;
  text-align: left;
  padding: 12px 16px;
  border-bottom: 2px solid var(--color-border);
  color: var(--color-text);
}

.post-content td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--color-border);
}

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

.post-content blockquote {
  border-left: 3px solid var(--color-border);
  padding-left: 20px;
  margin: 20px 0;
  color: var(--color-text-grey);
  font-style: italic;
}

.post-content img {
  max-width: 100%;
  height: auto;
  border-radius: 4px;
  margin: 20px 0;
}

.image-row {
  display: flex;
  gap: 16px;
  margin: 20px 0;
}

.image-row img {
  flex: 1;
  margin: 0;
  min-width: 0;
}

.post-content hr {
  border: none;
  height: 1px;
  background: var(--color-border);
  margin: 40px 0;
}

/* Footer */
.site-footer {
  padding: 40px 0;
  border-top: 1px solid var(--color-border);
}

.site-footer p {
  font-size: 14px;
  font-weight: 400;
  line-height: 20px;
  color: var(--color-text-grey);
}

/* Responsive */
@media (max-width: 768px) {
  main {
    padding: 32px 0 60px;
  }

  main > h1 {
    font-size: 28px;
    line-height: 32px;
    margin-bottom: 32px;
  }

  .post-preview h3 {
    font-size: 20px;
    line-height: 28px;
  }

  .post-preview p {
    font-size: 16px;
    line-height: 22px;
  }

  .post-preview,
  .post {
    padding: 48px 24px;
  }

  .author-avatar,
  .post-preview img.author-avatar {
    width: 60px;
    height: 60px;
    top: -30px;
  }

  .post-title {
    font-size: 24px;
    line-height: 32px;
  }

  .post-content {
    font-size: 16px;
    line-height: 24px;
  }

  .post-content h2 {
    font-size: 20px;
    line-height: 28px;
    margin-top: 40px;
  }

  .post-content h3 {
    font-size: 18px;
    line-height: 24px;
    margin-top: 32px;
  }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
  :root {
    --color-bg: #121212;
    --color-text: #f5f5f5;
    --color-text-grey: #8a8a8a;
    --color-link: #5c9aff;
    --color-border: #2a2a2a;
    --color-surface: #1e1e1e;
  }

  .site-header {
    background: rgba(18, 18, 18, 0.97);
  }

  main {
    background: #0a0a0a;
  }

  .post-preview {
    background: #1a1a1a;
    border-color: #2a2a2a;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
  }

  .page-post main {
    background: #121212;
  }

  .back-link {
    background: #f5f5f5;
    color: #121212;
  }

  .back-link:hover {
    background: var(--color-link);
    color: #fff;
  }

  /* Dark mode syntax highlighting */
  .highlight .c,
  .highlight .c1,
  .highlight .cm { color: #8b949e; }
  .highlight .k,
  .highlight .kd,
  .highlight .kn,
  .highlight .kp,
  .highlight .kr,
  .highlight .kt { color: #ff7b72; }
  .highlight .s,
  .highlight .s1,
  .highlight .s2,
  .highlight .sb,
  .highlight .sc,
  .highlight .sd,
  .highlight .se,
  .highlight .sh,
  .highlight .si,
  .highlight .sx,
  .highlight .sr { color: #a5d6ff; }
  .highlight .mi,
  .highlight .mf,
  .highlight .mh,
  .highlight .mo,
  .highlight .il { color: #79c0ff; }
  .highlight .na { color: #79c0ff; }
  .highlight .nb { color: #79c0ff; }
  .highlight .nc { color: #d2a8ff; }
  .highlight .nf,
  .highlight .fm { color: #d2a8ff; }
  .highlight .nn { color: #79c0ff; }
  .highlight .o,
  .highlight .ow { color: #ff7b72; }
  .highlight .nv,
  .highlight .vi,
  .highlight .vm { color: #ffa657; }
  .highlight .err { color: #f85149; background-color: rgba(248, 81, 73, 0.1); }
}
