:root {
  --bg: #f4f4f2;
  --surface: #ffffff;
  --text: #2b2b2b;
  --muted: #6b6b6b;
  --header: #2d3238;
  --accent: #c0392b;
  --border: #e2e2de;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.6 "Open Sans", "Helvetica Neue", Arial, sans-serif;
}

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

/* Header */
.site-header { background: var(--header); }
.site-header .inner {
  max-width: 980px;
  margin: 0 auto;
  padding: 18px 16px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.logo img { display: block; height: 55px; width: auto; }
.nav { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 4px; }
.nav a {
  display: block;
  padding: 6px 12px;
  color: #e8e8e8;
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: .05em;
  border-radius: 3px;
}
.nav a:hover, .nav a.active { background: rgba(255,255,255,.12); text-decoration: none; color: #fff; }

/* Main */
main { max-width: 980px; margin: 0 auto; padding: 32px 16px 48px; }
.tagline {
  text-align: center;
  font-size: 22px;
  font-weight: 300;
  margin: 8px 0 32px;
}
h2 {
  font-weight: 400;
  font-size: 22px;
  margin: 0 0 16px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--accent);
}
.box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 24px;
  margin-bottom: 24px;
}

.columns { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.columns .box { margin-bottom: 0; }
@media (max-width: 760px) { .columns { grid-template-columns: 1fr; } }

/* Home: portfolio (left) + lifestream (right) */
.home-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 24px;
  align-items: start;
}
.home-grid .box { margin-bottom: 0; }
@media (max-width: 860px) {
  .home-grid { grid-template-columns: 1fr; }
}

/* Portfolio slideshow */
.slideshow { max-width: 480px; margin: 0 auto 24px; }
.slides {
  position: relative;
  aspect-ratio: 3 / 2;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 4px;
  overflow: hidden;
}
.slides img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  opacity: 0;
  transition: opacity .8s ease;
}
.slides img.active { opacity: 1; }
.slide-nav { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px; margin-top: 8px; }
.slide-nav button {
  min-width: 26px;
  padding: 2px 4px;
  font-size: 12px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  border-radius: 3px;
  cursor: pointer;
}
.slide-nav button.active { background: var(--accent); border-color: var(--accent); color: #fff; }

/* Portfolio cards */
.portfolio { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.project {
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 16px;
  display: flex;
  flex-direction: column;
}
.project h3 { margin: 0 0 6px; font-size: 17px; font-weight: 600; }
.project p { margin: 0 0 12px; color: var(--muted); font-size: 14px; flex: 1; }
.project .meta { font-size: 13px; color: var(--muted); }

/* Posts */
.posts { list-style: none; margin: 0; padding: 0; }
.posts li { padding: 10px 0; border-bottom: 1px solid var(--border); }
.posts li:last-child { border-bottom: 0; }
.posts time { display: block; font-size: 13px; color: var(--muted); }
.more { margin-top: 12px; font-size: 14px; }

/* Lifestream */
.lifestream { max-height: 900px; overflow-y: auto; }
.fallback { color: var(--muted); font-size: 14px; }

/* About */
.about { display: grid; grid-template-columns: 1fr 315px; gap: 24px; align-items: start; }
.about img { width: 100%; height: auto; border-radius: 4px; display: block; }
.about figcaption { font-size: 13px; color: var(--muted); margin-top: 6px; }
@media (max-width: 760px) { .about { grid-template-columns: 1fr; } }
.links { columns: 2; padding-left: 20px; }
@media (max-width: 500px) { .links { columns: 1; } }

/* Footer */
footer {
  text-align: center;
  font-size: 13px;
  color: var(--muted);
  padding: 24px 16px;
  border-top: 1px solid var(--border);
}

/* Blog page: posts (left) + tags (right) */
.blog-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 240px;
  gap: 24px;
  align-items: start;
}
.blog-grid .box { margin-bottom: 0; }
.tags-box { padding: 20px; }
.tags-box h2 { font-size: 18px; }
.tag-cloud { display: flex; flex-wrap: wrap; gap: 2px; margin-bottom: 8px; }
.tag-cloud .tag { cursor: pointer; }
.tag-cloud .tag:hover { text-decoration: none; border-color: var(--accent); color: var(--accent); }
.tag-cloud .tag.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.tags-box .tag-heading { font-size: 14px; margin-top: 12px; }
.tags-box .tag-list { font-size: 13px; padding-left: 16px; }
@media (max-width: 640px) {
  .blog-grid { grid-template-columns: 1fr; }
}

/* Blog list */
.year { margin: 24px 0 4px; font-weight: 600; font-size: 18px; }
.muted { color: var(--muted); font-size: 13px; }
.tag-heading { margin: 16px 0 4px; font-size: 15px; font-weight: 600; scroll-margin-top: 16px; }
.tag-list { margin: 0; padding-left: 20px; font-size: 15px; }

/* Post */
.post-header h1 { font-weight: 400; font-size: 30px; line-height: 1.25; margin: 0 0 6px; }
.post-meta { color: var(--muted); font-size: 14px; margin: 0 0 24px; }
.tag {
  display: inline-block;
  margin: 2px 2px;
  padding: 0 8px;
  font-size: 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--muted);
}
.post-content img { max-width: 100%; height: auto; }
.post-content h2 { border-bottom: 1px solid var(--border); }
.post-content pre, .post-content code {
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 14px;
}
.post-content code { background: var(--bg); padding: 1px 4px; border-radius: 3px; }
.post-content pre {
  background: #f6f8fa;
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 12px 16px;
  overflow-x: auto;
}
.post-content pre code { background: none; padding: 0; }
.post-content table { border-collapse: collapse; }
.post-content th, .post-content td { border: 1px solid var(--border); padding: 4px 8px; }

.post-nav {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-top: 32px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  font-size: 15px;
}
.post-nav a { max-width: 48%; }
.post-nav a span { display: block; font-size: 12px; color: var(--muted); }
.post-nav .next { text-align: right; margin-left: auto; }

/* Rouge syntax highlighting (light) */
.highlight .c, .highlight .c1, .highlight .cm { color: #6a737d; font-style: italic; }
.highlight .k, .highlight .kd, .highlight .kn, .highlight .kc { color: #d73a49; }
.highlight .s, .highlight .s1, .highlight .s2, .highlight .sd { color: #032f62; }
.highlight .m, .highlight .mi, .highlight .mf { color: #005cc5; }
.highlight .nf, .highlight .nc { color: #6f42c1; }
.highlight .nb, .highlight .bp { color: #005cc5; }
