:root {
  --font-sans: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: 'Fira Code', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;

  /* Dark theme colors (default) */
  --bg-color: #0b0f14;
  --card-bg: #111823;
  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --accent-color: #10b981; /* Emerald green */
  --accent-hover: #34d399;
  --border-color: #1e293b;
  --code-bg: #161f30;
  --shadow-color: rgba(0, 0, 0, 0.4);
}

@media (prefers-color-scheme: light) {
  :root {
    /* Light theme colors */
    --bg-color: #f8fafc;
    --card-bg: #ffffff;
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --accent-color: #059669; /* Darker emerald */
    --accent-hover: #047857;
    --border-color: #e2e8f0;
    --code-bg: #f1f5f9;
    --shadow-color: rgba(0, 0, 0, 0.05);
  }
}

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

body {
  font-family: var(--font-sans);
  background-color: var(--bg-color);
  color: var(--text-primary);
  line-height: 1.625;
  font-size: 1rem;
  -webkit-font-smoothing: antialiased;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.skip-link {
  position: absolute;
  left: 1rem;
  top: -3rem;
  z-index: 20;
  background-color: var(--accent-color);
  color: #052e26;
  padding: 0.7rem 0.9rem;
  border-radius: 0.5rem;
  font-weight: 700;
}

.skip-link:focus {
  top: 1rem;
}

.container {
  max-width: 48rem; /* 768px */
  width: 100%;
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* Header & Navigation */
header {
  border-bottom: 1px solid var(--border-color);
  padding: 1.5rem 0;
  background-color: var(--bg-color);
  position: sticky;
  top: 0;
  z-index: 10;
}

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

.logo-link {
  text-decoration: none;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 1.125rem;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

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

nav {
  display: flex;
  gap: 1.5rem;
}

nav a {
  text-decoration: none;
  color: var(--text-secondary);
  font-weight: 500;
  font-size: 0.95rem;
  transition: color 0.2s ease, border-color 0.2s ease;
  border-bottom: 2px solid transparent;
  padding-bottom: 0.25rem;
}

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

nav a.active {
  border-color: var(--accent-color);
}

/* Main Content Area */
main {
  flex-grow: 1;
  padding: 3rem 0;
}

/* Typography & Content Layout */
h1, h2, h3, h4, h5, h6 {
  color: var(--text-primary);
  font-weight: 700;
  line-height: 1.25;
  margin-top: 2rem;
  margin-bottom: 1rem;
}

h1 {
  font-size: 2.25rem;
  margin-top: 0;
  letter-spacing: -0.025em;
}

h2 {
  font-size: 1.5rem;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 0.5rem;
  letter-spacing: -0.02em;
}

h3 {
  font-size: 1.25rem;
}

p {
  margin-bottom: 1.25rem;
}

a {
  color: var(--accent-color);
  text-decoration: none;
  transition: color 0.15s ease;
}

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

ul, ol {
  margin-bottom: 1.5rem;
  padding-left: 1.5rem;
}

li {
  margin-bottom: 0.5rem;
}

/* Blockquotes */
blockquote {
  border-left: 4px solid var(--accent-color);
  padding: 0.75rem 1.25rem;
  margin: 1.5rem 0;
  background-color: var(--card-bg);
  border-radius: 0 6px 6px 0;
  color: var(--text-secondary);
  font-style: italic;
}

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

/* Code & Pre */
pre {
  background-color: var(--code-bg);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 1.25rem;
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 0.875rem;
  margin: 1.5rem 0;
  box-shadow: 0 4px 6px -1px var(--shadow-color);
}

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

pre code {
  background-color: transparent;
  padding: 0;
  border-radius: 0;
  color: inherit;
  font-size: inherit;
}

hr {
  border: 0;
  border-top: 1px solid var(--border-color);
  margin: 2.5rem 0;
}

/* Homepage Hero & Features */
.hero {
  padding-bottom: 2rem;
}

.hero p {
  font-size: 1.125rem;
  color: var(--text-secondary);
}

.profile-card {
  background-color: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 2rem;
  margin-top: 2rem;
  box-shadow: 0 4px 12px var(--shadow-color);
}

.profile-card h2 {
  margin-top: 0;
  border-bottom: none;
  padding-bottom: 0;
}

/* Lists & Grid layouts */
.post-list {
  list-style: none;
  padding-left: 0;
  margin-top: 2rem;
}

.post-item {
  margin-bottom: 2rem;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 1.5rem;
}

.post-item:last-child {
  border-bottom: none;
}

.home-post-link {
  color: var(--text-primary);
  text-decoration: none;
  border-bottom: 2px solid transparent;
  transition: color 0.2s ease, border-color 0.2s ease;
}

.home-post-link:hover,
.home-post-link:focus-visible {
  color: var(--accent-color);
  border-color: var(--accent-color);
}

.post-meta {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
}

.post-title {
  font-size: 1.35rem;
  margin: 0.25rem 0 0.5rem 0;
}

.post-title a {
  color: var(--text-primary);
  text-decoration: none;
}

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

.post-summary {
  color: var(--text-secondary);
  font-size: 0.95rem;
}

/* Post Detail styling */
.post-header {
  margin-bottom: 2.5rem;
}

.post-header h1 {
  margin-bottom: 0.75rem;
}

/* Footer */
footer {
  border-top: 1px solid var(--border-color);
  padding: 2.5rem 0;
  background-color: var(--bg-color);
  color: var(--text-secondary);
  font-size: 0.875rem;
}

footer .footer-container {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.footer-meta {
  display: flex;
  gap: 1.5rem;
}

/* Responsive adjustments */
@media (max-width: 640px) {
  header .nav-container, footer .footer-container {
    flex-direction: column;
    gap: 1rem;
    text-align: left;
    align-items: flex-start;
  }
  
  nav {
    justify-content: flex-start;
    flex-wrap: wrap;
    gap: 0.9rem 1.25rem;
  }
  
  .footer-meta {
    justify-content: flex-start;
    flex-direction: column;
    gap: 0.25rem;
  }

  .container {
    padding: 0 1rem;
  }

  main {
    padding: 2.25rem 0 3.5rem;
  }

  h1 {
    font-size: 1.95rem;
  }

  .profile-card {
    padding: 1.5rem;
  }
}
