:root {
  --fg: #222;
  --muted: #666;
  --bg: #fafafa;
  --card: #fff;
  --accent: #0a66c2;
  --rule: #e2e2e2;
  --radius: 12px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, sans-serif;
  line-height: 1.6;
  color: var(--fg);
  background: var(--bg);
}

.site-header, main, footer {
  max-width: 48rem;
  margin: 0 auto;
  padding: 0 1.25rem;
}

.site-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding-top: 1.5rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--rule);
}

.brand {
  font-weight: 600;
  font-size: 1.25rem;
  color: var(--fg);
  text-decoration: none;
}

nav a {
  margin-left: 1rem;
  color: var(--muted);
  text-decoration: none;
}

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

main { padding-top: 2.5rem; padding-bottom: 3rem; }

h1 { font-weight: 600; margin: 0 0 0.25rem; }
h2 { font-weight: 600; margin: 2.5rem 0 1rem; }

.kicker {
  margin: 0;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.tagline { color: var(--muted); margin: 0.25rem 0 0; }

/* Intro block on the home page */
.intro {
  display: flex;
  gap: 1.5rem;
  align-items: center;
}

.intro p { margin: 0.25rem 0; }

.avatar {
  width: 128px;
  height: 128px;
  flex-shrink: 0;
  border-radius: var(--radius);
  image-rendering: pixelated;
}

.links a { margin-right: 1rem; text-decoration: none; }
.links a:hover { text-decoration: underline; }

/* Cover images: every cover is the same square box. Images larger than the
   box are scaled down and cropped to fill it; smaller ones sit centered at
   their natural size and are never upscaled. "photo" fills a rounded box;
   "icon" is shown as-is, since app icons bring their own corners. */
.cover {
  display: grid;
  place-items: center;
  aspect-ratio: 1;
  width: 100%;
  overflow: hidden;
  border-radius: 8px;
  background: #ededed;
}

.cover img {
  display: block;
  max-width: 100%;
  max-height: 100%;
  aspect-ratio: 1;
  object-fit: cover;
}

.cover.icon { background: none; border-radius: 0; }

/* Project grid: three across, then two, then one */
.project-grid {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.25rem;
}

@media (max-width: 40rem) {
  .project-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 26rem) {
  .project-grid { grid-template-columns: 1fr; }
}

.project-grid a {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  height: 100%;
  padding: 1rem;
  background: var(--card);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  color: var(--fg);
  text-decoration: none;
  transition: border-color 0.15s, transform 0.15s;
}

.project-grid a:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
}

.project-grid .cover { margin-bottom: 0.75rem; }
.project-grid strong { font-size: 1.1rem; }
.project-grid .tagline { font-size: 0.95rem; }

/* Topic chips */
.chips { margin: 0 0 1.25rem; }

.chips a {
  display: inline-block;
  margin: 0 0.4rem 0.4rem 0;
  padding: 0.15rem 0.7rem;
  border: 1px solid var(--rule);
  border-radius: 999px;
  background: var(--card);
  color: var(--muted);
  font-size: 0.85rem;
  text-decoration: none;
}

.chips a:hover { border-color: var(--accent); color: var(--accent); }

.muted { color: var(--muted); }

/* Project page */
.project-header {
  display: flex;
  gap: 1.5rem;
  align-items: flex-start;
  margin-bottom: 2rem;
}

.project-header .cover {
  flex-shrink: 0;
  width: 160px;
  border-radius: var(--radius);
}

.project-header .chips { margin: 0.5rem 0 0; }

.version {
  margin: 0.5rem 0 0;
  font-size: 0.9rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.project-links a {
  display: inline-block;
  margin: 0.75rem 0.5rem 0 0;
  padding: 0.4rem 0.9rem;
  border: 1px solid var(--accent);
  border-radius: 999px;
  text-decoration: none;
  font-size: 0.95rem;
}

.project img { max-width: 100%; border-radius: 8px; }

.back { margin-top: 3rem; }
.back a { text-decoration: none; }

pre, code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.9em;
}

pre {
  padding: 1rem;
  overflow-x: auto;
  background: #f0f0f0;
  border-radius: 4px;
}

footer {
  padding-top: 1.5rem;
  padding-bottom: 2rem;
  border-top: 1px solid var(--rule);
  color: var(--muted);
  font-size: 0.9rem;
}

@media (max-width: 36rem) {
  .intro, .project-header { flex-direction: column; align-items: flex-start; }
}
