:root {
  --text-color: #1a1a1a;
  --text-secondary: #6b7280;
  --bg-color: #ffffff;
  --bg-subtle: #f9fafb;
  --border-color: #e5e7eb;
  --border-subtle: #f3f4f6;
  --link-color: #4f46e5;
  --link-hover-color: #3730a3;
  --code-bg: #f8fafc;
  --code-border: #e2e8f0;
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
}

html.dark-theme {
  --text-color: #f8fafc;
  --text-secondary: #94a3b8;
  --bg-color: #0f172a;
  --bg-subtle: #1e293b;
  --border-color: #334155;
  --border-subtle: #475569;
  --link-color: #a78bfa;
  --link-hover-color: #c4b5fd;
  --code-bg: #1e293b;
  --code-border: #334155;
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.3);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.3), 0 2px 4px -2px rgb(0 0 0 / 0.3);
}

/* Base styles */
html,
body {
  font-family: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", "Roboto",
    "Helvetica Neue", sans-serif;
  max-width: 65ch;
  padding: 0 1.5rem;
  margin: auto;
  line-height: 1.7;
  font-size: 16px;
  color: var(--text-color);
  background-color: var(--bg-color);
  transition: background-color 0.3s ease, color 0.3s ease;
  font-feature-settings: "liga" 1, "kern" 1;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Header & navigation */
header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 2rem 0 3rem;
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: 3rem;
}

#head-link {
  color: var(--text-color);
  font-weight: 700;
  font-size: 1.25rem;
  text-decoration: none;
  letter-spacing: -0.025em;
  transition: opacity 0.2s ease;
}

#head-link:hover {
  opacity: 0.8;
}

.main-nav {
  display: flex;
  gap: 2rem;
}

.nav-link {
  position: relative;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.95rem;
  font-weight: 500;
  padding: 0.5rem 0;
  transition: color 0.2s ease;
}

.nav-link::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  width: 0;
  height: 2px;
  background: var(--link-color);
  border-radius: 1px;
  transition: width 0.3s ease;
}

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

.nav-link:hover::after {
  width: 100%;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

#theme-toggle {
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 0.5rem;
  font-size: 1.1rem;
  border-radius: var(--radius-sm);
  transition: all 0.2s ease;
}

#theme-toggle:hover {
  color: var(--text-color);
  background-color: var(--bg-subtle);
}

.social-icons {
  display: flex;
  gap: 0.75rem;
}

.social-icons a {
  color: var(--text-secondary);
  font-size: 1.1rem;
  padding: 0.5rem;
  border-radius: var(--radius-sm);
  transition: all 0.2s ease;
}

.social-icons a:hover {
  color: var(--text-color);
  background-color: var(--bg-subtle);
}

/* Typography */
h1 {
  font-size: 2.25rem;
  font-weight: 800;
  line-height: 1.2;
  margin: 0 0 1.5rem;
  letter-spacing: -0.025em;
  color: var(--text-color);
}

h2 {
  font-size: 1.875rem;
  font-weight: 700;
  line-height: 1.3;
  margin: 2.5rem 0 1rem;
  letter-spacing: -0.025em;
  color: var(--text-color);
}

h3 {
  font-size: 1.5rem;
  font-weight: 600;
  line-height: 1.4;
  margin: 2rem 0 0.75rem;
  color: var(--text-color);
}

h4,
h5,
h6 {
  font-size: 1.25rem;
  font-weight: 600;
  line-height: 1.5;
  margin: 1.75rem 0 0.5rem;
  color: var(--text-color);
}

p {
  margin-bottom: 1.5rem;
  color: var(--text-color);
}

/* Enhanced main content */
main {
  margin-bottom: 4rem;
}

/* Blog post lists */
main ul {
  list-style: none;
  padding-left: 0;
  margin: 0;
}

main ul li {
  padding: 0.5rem 0 0.5rem 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  position: relative;
}

main ul li::before {
  content: "•";
  color: var(--text-secondary);
  position: absolute;
  left: 0.5rem;
  top: 0.5rem;
  line-height: 1.3;
}

main ul li:hover {
  background-color: var(--bg-subtle);
}

main ul li a {
  font-weight: 500;
  font-size: 0.95rem;
  line-height: 1.3;
  text-decoration: none;
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

main ul li small {
  color: var(--text-secondary);
  font-size: 0.75rem;
  font-weight: 400;
  white-space: nowrap;
}

/* Content links */
main a {
  color: var(--link-color);
  text-decoration: none;
  font-weight: 500;
  transition: all 0.2s ease;
  border-radius: 2px;
  padding: 0 2px;
  margin: 0 -2px;
}

main a:hover {
  color: var(--link-hover-color);
  background-color: var(--bg-subtle);
}

/* Post date */
.post-date {
  color: var(--text-secondary);
  font-size: 0.875rem;
  margin-bottom: 2rem;
  font-weight: 500;
  letter-spacing: 0.025em;
}

/* Code blocks */
pre {
  background: var(--code-bg);
  border: 1px solid var(--code-border);
  border-radius: var(--radius-md);
  margin: 2rem 0;
  padding: 1.5rem;
  overflow-x: auto;
  font-size: 0.875rem;
  line-height: 1.6;
  box-shadow: var(--shadow-sm);
}

code {
  font-family: "SF Mono", Monaco, "Cascadia Code", "Roboto Mono", Consolas,
    "Courier New", monospace;
  background: var(--code-bg);
  padding: 0.25rem 0.375rem;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  border: 1px solid var(--code-border);
}

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

/* Images */
img {
  max-width: 100%;
  height: auto;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  margin: 1.5rem 0;
}

/* Blockquotes */
blockquote {
  margin: 2rem 0;
  padding: 1.5rem;
  background: var(--bg-subtle);
  border-left: 4px solid var(--link-color);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  font-style: italic;
  color: var(--text-secondary);
}

blockquote p:first-child {
  margin-top: 0;
}

blockquote p:last-child {
  margin-bottom: 0;
}

/* Footer */
footer {
  margin-top: 4rem;
  padding: 2rem 0;
  border-top: 1px solid var(--border-subtle);
  text-align: center;
  color: var(--text-secondary);
  font-size: 0.875rem;
}

/* Responsive design */
@media (max-width: 768px) {
  html,
  body {
    padding: 0 1rem;
    font-size: 15px;
  }

  header {
    flex-direction: column;
    gap: 1rem;
    padding: 1.5rem 0 2rem;
    margin-bottom: 2rem;
  }

  .main-nav {
    gap: 1.5rem;
  }

  h1 {
    font-size: 1.875rem;
  }

  h2 {
    font-size: 1.5rem;
  }

  main ul li:hover {
    background: none;
  }

  main ul li {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.25rem;
  }

  main ul li a {
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
  }
}
