:root {
  --text: #1a1a1a;
  --muted: #6b6b6b;
  --accent: #2b5797;
  --rule: #e4e4e4;
  --code-bg: #f6f6f4;
  --max: 42rem;
}

@media (prefers-color-scheme: dark) {
  :root {
    --text: #e6e6e6;
    --muted: #9a9a9a;
    --accent: #7aa7e8;
    --rule: #333;
    --code-bg: #1c1c1c;
    --bg: #131313;
  }
  body { background: var(--bg); }
}

* { box-sizing: border-box; }

body {
  font: 17px/1.65 -apple-system, BlinkMacSystemFont, "Segoe UI", Georgia, serif;
  color: var(--text);
  margin: 0;
  padding: 0 1.25rem;
  -webkit-font-smoothing: antialiased;
}

.content, .site-header, .site-footer {
  max-width: var(--max);
  margin: 0 auto;
}

/* ---------- header ---------- */
.site-header {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 2.5rem 0 1.5rem;
  border-bottom: 1px solid var(--rule);
}

.site-title {
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text);
  text-decoration: none;
}

.site-nav a {
  margin-left: 1.1rem;
  font-size: 0.95rem;
  color: var(--muted);
  text-decoration: none;
}
.site-nav a:hover { color: var(--accent); }
.site-nav a:first-child { margin-left: 0; }
.site-nav a.ext span { font-size: 0.7em; margin-left: 0.15em; opacity: 0.6; }

@media (max-width: 560px) {
  .site-header { justify-content: flex-start; }
  .site-nav a { margin: 0 1rem 0 0; }
}

/* ---------- typography ---------- */
a { color: var(--accent); }

h1, h2, h3, h4 {
  line-height: 1.25;
  letter-spacing: -0.015em;
  margin-top: 2rem;
}

.page-title { font-size: 1.9rem; margin: 2rem 0 0.5rem; }

.content { padding-bottom: 3rem; }

img { max-width: 100%; height: auto; }

blockquote {
  margin: 1.5rem 0;
  padding-left: 1rem;
  border-left: 3px solid var(--rule);
  color: var(--muted);
}

code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.87em;
  background: var(--code-bg);
  padding: 0.15em 0.35em;
  border-radius: 3px;
}

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

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

table { border-collapse: collapse; width: 100%; font-size: 0.95rem; }
th, td { border-bottom: 1px solid var(--rule); padding: 0.5rem; text-align: left; }

/* ---------- home intro ---------- */
.intro {
  display: flex;
  gap: 2rem;
  align-items: center;
  margin-top: 1.5rem;
}
.intro-text { flex: 1 1 auto; min-width: 0; }
.intro-text h2 { margin-top: 0; }
.intro-photo {
  flex: 0 0 auto;
  width: 150px;
  margin: 0;
}
.intro-photo img {
  width: 100%;
  height: auto;
  border-radius: 8px;
  display: block;
}
@media (max-width: 640px) {
  .intro { flex-direction: column; align-items: stretch; }
  .intro-photo { width: 110px; align-self: center; }
}

/* ---------- post list ---------- */
.tagline {
  color: var(--muted);
  font-size: 1.05rem;
  margin: 2rem 0 0;
}

.post-list { list-style: none; padding: 0; margin: 2rem 0 0; }

.content:has(.post-list) { max-width: 60rem; }

.post-list li {
  padding: 1.1rem 0;
  border-bottom: 1px solid var(--rule);
}

.post-item {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
}

.post-thumb {
  flex: 0 0 auto;
  width: 96px;
  height: 96px;
  border-radius: 6px;
  overflow: hidden;
  background: var(--rule);
}

.post-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.post-body { flex: 1 1 auto; min-width: 0; }

@media (max-width: 480px) {
  .post-thumb { width: 64px; height: 64px; }
}

.post-list h2 { font-size: 1.15rem; margin: 0 0 0.2rem; }
.post-list h2 a { text-decoration: none; }
.post-list h2 a:hover { text-decoration: underline; }

.post-meta, .post-list time {
  color: var(--muted);
  font-size: 0.85rem;
  font-variant-numeric: tabular-nums;
}

.post-excerpt { margin: 0.35rem 0 0; color: var(--muted); font-size: 0.95rem; }

.tag {
  display: inline-block;
  font-size: 0.75rem;
  color: var(--muted);
  border: 1px solid var(--rule);
  border-radius: 999px;
  padding: 0.05rem 0.5rem;
  margin-right: 0.3rem;
}

.post-nav {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 3rem;
  padding-top: 1rem;
  border-top: 1px solid var(--rule);
  font-size: 0.9rem;
}
.post-nav .next { margin-left: auto; text-align: right; }

/* ---------- repos ---------- */
/* the grid needs more room than the prose column */
.content:has(.repo-grid) { max-width: 60rem; }

.repo-toolbar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-top: 1.75rem;
}
#repo-filter {
  flex: 1 1 auto;
  min-width: 0;
  font: inherit;
  font-size: 0.92rem;
  color: var(--text);
  background: transparent;
  border: 1px solid var(--rule);
  border-radius: 8px;
  padding: 0.45rem 0.7rem;
}
#repo-filter:focus { outline: none; border-color: var(--accent); }
.repo-count { font-size: 0.8rem; color: var(--muted); font-variant-numeric: tabular-nums; }

.repo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(17rem, 1fr));
  gap: 0.85rem;
  margin-top: 1.25rem;
}

.repo-card {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--rule);
  border-radius: 10px;
  padding: 0.9rem 1rem;
  color: inherit;
  text-decoration: none;
  transition: border-color 0.15s ease, transform 0.15s ease;
}
.repo-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
}
.repo-card h3 {
  display: flex;
  align-items: baseline;
  gap: 0.4rem;
  margin: 0 0 0.3rem;
  font-size: 1.02rem;
  color: var(--accent);
}
.repo-card p { margin: 0 0 0.55rem; font-size: 0.92rem; color: var(--muted); }
.repo-card.is-pinned { border-color: color-mix(in srgb, var(--accent) 40%, var(--rule)); }
.repo-pin { font-size: 0.8rem; color: var(--muted); }

.repo-topics { margin-bottom: 0.55rem; }
.repo-topics .tag { margin-bottom: 0.25rem; }

/* meta sits at the card's bottom so rows line up across the grid */
.repo-meta {
  margin-top: auto;
  font-size: 0.8rem;
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  gap: 0.9rem;
  font-variant-numeric: tabular-nums;
}
.repo-lang { display: inline-flex; align-items: center; gap: 0.35rem; }
.repo-lang i {
  width: 0.6rem;
  height: 0.6rem;
  border-radius: 50%;
  display: inline-block;
}
.repo-updated { margin-left: auto; }

/* placeholders shown while the GitHub request is in flight */
.repo-card.is-skeleton {
  height: 8.5rem;
  border-style: dashed;
  opacity: 0.5;
  animation: repo-pulse 1.4s ease-in-out infinite;
}
.repo-card.is-skeleton:nth-child(2) { animation-delay: 0.15s; }
.repo-card.is-skeleton:nth-child(3) { animation-delay: 0.3s; }
.repo-card.is-skeleton:nth-child(4) { animation-delay: 0.45s; }
@keyframes repo-pulse { 50% { opacity: 0.2; } }

@media (prefers-reduced-motion: reduce) {
  .repo-card, .repo-card.is-skeleton { transition: none; animation: none; }
  .repo-card:hover { transform: none; }
}

/* ---------- footer ---------- */
.site-footer {
  border-top: 1px solid var(--rule);
  padding: 1.5rem 0 3rem;
  font-size: 0.88rem;
  color: var(--muted);
}
.footer-links a { margin-right: 1rem; color: var(--muted); text-decoration: none; }
.footer-links a:hover { color: var(--accent); }
.copyright { margin: 0.6rem 0 0; }

/* ---------- figures ---------- */
.post-figure {
  margin: 2rem 0;
}
.post-figure img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 6px;
}
.post-figure figcaption {
  margin-top: 0.5rem;
  font-size: 0.85rem;
  line-height: 1.5;
  color: var(--muted);
}
.post-figure figcaption a { color: var(--muted); }

.github-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4em;
}
.github-logo {
  height: 1em;
  width: auto;
  display: inline;
  border-radius: 0;
  vertical-align: middle;
}

/* side-by-side figures, from WordPress column blocks */
.fig-row {
  display: flex;
  flex-wrap: wrap;
  gap: 1.25rem;
  align-items: flex-start;
  margin: 2rem 0;
}
.fig-col {
  flex: 1 1 14rem;
  min-width: 0;
}
.fig-row .post-figure { margin: 0; }

/* video embeds keep a 16:9 box so the page does not reflow while loading */
.post-embed iframe {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  border: 0;
  border-radius: 6px;
}
