/**
 * main.css - Base Styles
 * 
 * Core styles for the entire site including:
 * - Reset and base typography
 * - Navigation and footer
 * - Article content formatting (headings, paragraphs, lists)
 * - Code blocks and syntax highlighting
 * - Tables, blockquotes, and links
 * - Tag styling for blog posts
 * 
 * Used across all pages via _layouts/default.html
 */

/* Reset and Base Styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen,
    Ubuntu, Cantarell, sans-serif;
  line-height: 1.6;
  color: #333;
  background: #fff;
}

/* Layout */
.layout {
  display: flex;
  min-height: 100vh;
}

/* Sidebar */
.sidebar {
  width: 260px;
  min-width: 260px;
  background: #f6f8fa;
  border-right: 1px solid #e1e4e8;
  display: flex;
  flex-direction: column;
  padding: 2rem 1.5rem;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.sidebar-profile {
  text-align: center;
  margin-bottom: 2rem;
}

.sidebar-avatar {
  width: 200px;
  height: 200px;
  border-radius: 50%;
  object-fit: cover;
  object-position: center top;
  border: 3px solid #e1e4e8;
  margin-bottom: 1rem;
  transform: translateZ(0);
}

.sidebar-name {
  font-size: 1.1rem;
  font-weight: 700;
  color: #1a1a1a;
  margin-bottom: 0.25rem;
}

.sidebar-tagline {
  font-size: 0.85rem;
  color: #57606a;
  line-height: 1.4;
}

.sidebar-nav {
  margin-bottom: auto;
}

.sidebar-nav ul {
  list-style: none;
}

.sidebar-nav li {
  margin-bottom: 0.25rem;
}

.sidebar-nav a {
  display: block;
  padding: 0.6rem 0.75rem;
  border-radius: 6px;
  color: #333;
  text-decoration: none;
  font-weight: 500;
  font-size: 0.95rem;
  transition: background 0.15s;
}

.sidebar-nav a:hover {
  background: #e1e4e8;
  color: #0969da;
}

.sidebar-nav a.active {
  background: #dbeafe;
  color: #0969da;
  font-weight: 600;
}

.sidebar-links {
  display: flex;
  gap: 1rem;
  justify-content: center;
  padding-top: 1.5rem;
  border-top: 1px solid #e1e4e8;
  margin-top: 1.5rem;
}

.sidebar-links a {
  color: #57606a;
  text-decoration: none;
  font-size: 0.85rem;
}

.sidebar-links a:hover {
  color: #0969da;
}

/* Responsive: collapse sidebar on small screens */
@media (max-width: 768px) {
  .layout {
    flex-direction: column;
  }
  .sidebar {
    width: 100%;
    min-width: unset;
    height: auto;
    position: static;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    padding: 1rem;
    gap: 1rem;
  }
  .sidebar-profile {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 0;
    text-align: left;
  }
  .sidebar-avatar {
    width: 48px;
    height: 48px;
    margin-bottom: 0;
  }
  .sidebar-nav ul {
    display: flex;
    gap: 0.5rem;
  }
  .sidebar-links {
    border-top: none;
    margin-top: 0;
    padding-top: 0;
  }
}

/* Main Content Area */
main {
  flex: 1;
  max-width: 900px;
  padding: 2rem 2.5rem;
  min-width: 0;
}

/* Article Typography */
article h1 {
  font-size: 2.5rem;
  margin-bottom: 1rem;
  font-weight: 700;
  color: #1a1a1a;
}

/* Post Date */
.post-date {
  color: #57606a;
  font-size: 0.95rem;
  margin-bottom: 1.5rem;
  font-style: italic;
}

.post-updated {
  color: #8b949e;
  font-size: 0.9rem;
  margin-left: 0.5rem;
}

/* Tags */
.post-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.tag {
  background: #f6f8fa;
  border-radius: 16px;
  border: 1px solid #d0d7de;
  color: #57606a;
  display: inline-block;
  font-size: 0.85rem;
  font-weight: 500;
  margin-bottom: 0.5rem;
  padding: 0.25rem 0.75rem;
}

article h2 {
  font-size: 1.8rem;
  margin: 2rem 0 1rem;
  font-weight: 600;
  color: #1a1a1a;
  border-bottom: 1px solid #e1e4e8;
  padding-bottom: 0.3rem;
}

article h3 {
  font-size: 1.4rem;
  margin: 1.5rem 0 0.8rem;
  font-weight: 600;
  color: #1a1a1a;
}

article p {
  margin-bottom: 1rem;
  line-height: 1.7;
}

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

article li {
  margin-bottom: 0.5rem;
}

/* Article Media */
article img {
  max-width: 100%;
  height: auto;
  margin: 1.5rem 0;
  border-radius: 8px;
  border: 1px solid #e1e4e8;
}

/* Code Blocks */
article pre {
  background: #f6f8fa;
  padding: 1rem;
  border-radius: 6px;
  overflow-x: auto;
  margin: 1rem 0;
  border: 1px solid #e1e4e8;
}

article code {
  background: #f6f8fa;
  padding: 0.2em 0.4em;
  border-radius: 3px;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 0.9em;
}

article pre code {
  background: none;
  padding: 0;
}

/* Blockquotes */
article blockquote {
  border-left: 4px solid #d0d7de;
  padding-left: 1rem;
  color: #57606a;
  margin: 1rem 0;
}

/* Links */
article a {
  color: #0969da;
  text-decoration: none;
}

article a:hover {
  text-decoration: underline;
}

/* Tables */
article table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5rem 0;
}

article table th,
article table td {
  padding: 0.5rem;
  text-align: left;
  border: 1px solid #d0d7de;
}

article table th {
  background: #f6f8fa;
  font-weight: 600;
  color: #1a1a1a;
}

article table tr:hover {
  background: #f6f8fa;
}

/* Footer */
footer {
  border-top: 1px solid #e1e4e8;
  padding: 2rem 1rem;
  text-align: center;
  color: #57606a;
  margin-top: 4rem;
}

footer a {
  color: #57606a;
  margin: 0 1rem;
  text-decoration: none;
}

footer a:hover {
  color: #0969da;
}
