/* Reset */
*, *::before, *::after {
  box-sizing: border-box;
}

body, h1, h2, h3, h4, p, ul, ol, figure, blockquote {
  margin: 0;
}

/* Variables & Color Scheme */
:root {
  --bg: #fff;
  --text: #111;
  --text-muted: #666;
  --link: #0066cc;
  --link-visited: #551a8b;
  --border: #ddd;
  --code-bg: #f5f5f5;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111;
    --text: #ccc;
    --text-muted: #888;
    --link: #6cb6ff;
    --link-visited: #b5b5ff;
    --border: #333;
    --code-bg: #1a1a1a;
  }
}

/* Typography */
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Avenir Next', Avenir, 'Segoe UI', Helvetica, Arial, sans-serif;
  font-size: 16px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
}

/* Layout */
body {
  max-width: 640px;
  margin: 0 auto;
  padding: 2rem 1.25rem;
}

header {
  margin-bottom: 3rem;
}

nav {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.5rem 1.5rem;
}

.name {
  font-weight: 600;
  text-decoration: none;
  color: var(--text);
}

.nav-links {
  display: flex;
  gap: 1rem;
}

.nav-links a {
  color: var(--text-muted);
  text-decoration: none;
}

.nav-links a:hover,
.nav-links a[aria-current="page"] {
  color: var(--text);
}

main {
  min-height: 60vh;
}

footer {
  margin-top: 4rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.875rem;
}

/* Links */
a {
  color: var(--link);
}

a:visited {
  color: var(--link-visited);
}

/* Headings */
h1 {
  font-size: 1.5rem;
  font-weight: 600;
  line-height: 1.25;
  margin-bottom: 1rem;
}

h2 {
  font-size: 1.25rem;
  font-weight: 600;
  margin-top: 2rem;
  margin-bottom: 0.75rem;
}

h3 {
  font-size: 1rem;
  font-weight: 600;
  margin-top: 1.5rem;
  margin-bottom: 0.5rem;
}

/* Content */
p, ul, ol, blockquote, pre, figure {
  margin-bottom: 1rem;
}

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

blockquote {
  border-left: 3px solid var(--border);
  padding-left: 1rem;
  color: var(--text-muted);
  font-style: italic;
}

/* Code */
code {
  font-family: 'Berkeley Mono', 'JetBrains Mono', 'Fira Code', 'SF Mono', Menlo, Monaco, 'Courier New', monospace;
  font-size: 0.875em;
  background: var(--code-bg);
  padding: 0.125rem 0.375rem;
  border-radius: 3px;
}

pre {
  background: var(--code-bg);
  padding: 1rem;
  overflow-x: auto;
  border-radius: 4px;
}

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

/* Images */
img {
  max-width: 100%;
  height: auto;
  display: block;
  margin: 1.5rem 0;
}

figure img {
  margin: 0;
}

figcaption {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-top: 0.5rem;
}

/* Post List */
.post-list {
  list-style: none;
  padding: 0;
}

.post-list li {
  display: flex;
  gap: 1rem;
  margin-bottom: 0.5rem;
}

.post-list time {
  color: var(--text-muted);
  font-size: 0.875rem;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  min-width: 6rem;
}

.post-list a {
  text-decoration: none;
}

.post-list a:hover {
  text-decoration: underline;
}

/* Post Header */
.post-header {
  margin-bottom: 2rem;
}

.post-header time {
  color: var(--text-muted);
  font-size: 0.875rem;
}

/* Projects */
.project {
  margin-bottom: 2rem;
}

.project h2 {
  margin-top: 0;
  margin-bottom: 0.25rem;
}

.project p {
  margin-bottom: 0;
}

/* Intro */
.intro {
  font-size: 1.125rem;
  margin-bottom: 2.5rem;
}

/* Section */
.section {
  margin-bottom: 3rem;
}

.section h2 {
  margin-top: 0;
  margin-bottom: 1rem;
  font-size: 0.875rem;
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.section h2 a {
  color: inherit;
  text-decoration: none;
}

.section h2 a:hover {
  text-decoration: underline;
}

/* Gallery */
.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
  margin: 1.5rem 0;
}

.gallery img {
  width: 100%;
  height: 200px;
  object-fit: cover;
  margin: 0;
  border-radius: 4px;
}

.gallery figure {
  margin: 0;
}

.gallery figcaption {
  margin-top: 0.25rem;
}

/* Responsive */
@media (max-width: 480px) {
  .post-list li {
    flex-direction: column;
    gap: 0.125rem;
    margin-bottom: 1rem;
  }

  .post-list time {
    min-width: auto;
  }
}
