:root {
  --bg: #f7f7f5;
  --surface: #ffffff;
  --text: #1c1d1f;
  --muted: #62666d;
  --border: #e3e3df;
  --accent: #1f6f5c;
  --accent-hover: #185a4b;
  --accent-text: #ffffff;
  --accent-soft: #e3f1ec;
  --glow: rgb(31 111 92 / 12%);
  --code-bg: #f0f0ec;
  --shadow: 0 1px 2px rgb(0 0 0 / 4%), 0 4px 16px rgb(0 0 0 / 4%);
  --radius: 14px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #131415;
    --surface: #1c1d1f;
    --text: #ececea;
    --muted: #9a9ea5;
    --border: #2e3033;
    --accent: #4fb89b;
    --accent-hover: #6bc9ae;
    --accent-text: #0e1f1a;
    --accent-soft: #1d322c;
    --glow: rgb(79 184 155 / 14%);
    --code-bg: #26282b;
    --shadow: 0 1px 2px rgb(0 0 0 / 30%);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: radial-gradient(ellipse 80% 420px at 50% -120px, var(--glow), transparent) no-repeat, var(--bg);
  color: var(--text);
  font: 16px/1.6 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

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

.wrap { width: 100%; max-width: 1040px; margin: 0 auto; padding: 0 16px; }

main.wrap { flex: 1; padding-top: 24px; padding-bottom: 64px; }

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

/* Header & footer: no bars, just the brand and a quiet footer line on the page itself. */

.site-header .wrap { display: flex; align-items: center; padding-top: 28px; padding-bottom: 8px; }

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  font-weight: 650;
  font-size: 16px;
  letter-spacing: -0.01em;
  text-decoration: none;
}
.brand:hover { color: var(--text); }
.brand-mark { width: 32px; height: 32px; border-radius: 9px; transition: transform 0.2s; }
.brand:hover .brand-mark { transform: rotate(-6deg) scale(1.05); }

.site-footer { color: var(--muted); font-size: 13px; }
.site-footer .wrap { padding-top: 24px; padding-bottom: 32px; }

/* Home */

.hero { padding: clamp(32px, 8vw, 72px) 0 clamp(32px, 6vw, 56px); }
.hero h1 {
  max-width: 14em;
  margin: 0;
  font-size: clamp(34px, 6vw, 56px);
  font-weight: 700;
  line-height: 1.08;
  letter-spacing: -0.035em;
  text-wrap: balance;
}
.lead { margin: 0; color: var(--muted); font-size: 18px; }
.empty { color: var(--muted); }

.project-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }

.project-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  color: var(--text);
  text-decoration: none;
  transition: border-color 0.15s, transform 0.15s;
}
.project-card:hover { color: var(--text); border-color: var(--accent); transform: translateY(-1px); }
.project-card h2 { margin: 0; font-size: 18px; line-height: 1.3; }
.project-card p { margin: 0; color: var(--muted); flex: 1; }
.project-card .muted { font-size: 14px; }

.card-head { display: flex; align-items: center; gap: 14px; }

.card-meta { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 14px; color: var(--muted); }

.icon { width: 48px; height: 48px; border-radius: 12px; flex: none; }
.icon-large { width: 80px; height: 80px; border-radius: 18px; }
.icon-letter {
  display: inline-grid;
  place-items: center;
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 700;
  font-size: 22px;
}
.icon-large.icon-letter { font-size: 34px; }

/* Project page */

.crumbs { margin-bottom: 24px; font-size: 15px; }
.crumbs a { text-decoration: none; }

.project-head { display: flex; align-items: center; gap: 20px; margin-bottom: 32px; }
.project-head h1 { margin: 0 0 4px; font-size: clamp(28px, 5vw, 36px); line-height: 1.15; letter-spacing: -0.02em; }
.facts { display: flex; flex-wrap: wrap; gap: 4px 16px; margin: 8px 0 0; color: var(--muted); font-size: 14px; }

.project-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  grid-template-areas: "prose card";
  gap: 32px;
  align-items: start;
}
.project-layout > .prose { grid-area: prose; }

.download-card {
  grid-area: card;
  position: sticky;
  top: 24px;
  padding: 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.download-card h2 { margin: 0; font-size: 18px; }
.download-card > p { margin: 2px 0 16px; font-size: 14px; }

.download-list { display: flex; flex-direction: column; gap: 10px; }

.download {
  display: grid;
  gap: 2px;
  padding: 12px 14px;
  border-radius: 10px;
  background: var(--accent);
  color: var(--accent-text);
  text-decoration: none;
}
.download:hover { background: var(--accent-hover); color: var(--accent-text); }
.download-label { font-weight: 650; }
.download-file { font-size: 13px; opacity: 0.85; overflow-wrap: anywhere; }
.download-count { font-size: 12px; opacity: 0.75; }

@media (max-width: 760px) {
  .project-layout { grid-template-columns: minmax(0, 1fr); grid-template-areas: "card" "prose"; gap: 24px; }
  .download-card { position: static; }
  .project-head { align-items: flex-start; gap: 16px; }
  .icon-large { width: 64px; height: 64px; border-radius: 15px; }
}

/* Markdown */

.prose { min-width: 0; }
.prose > :first-child { margin-top: 0; }
.prose > :last-child { margin-bottom: 0; }
.prose h2 { margin: 32px 0 8px; font-size: 22px; line-height: 1.3; }
.prose h3 { margin: 24px 0 8px; font-size: 18px; }
.prose ul, .prose ol { padding-left: 22px; }
.prose li { margin: 4px 0; }
.prose img { max-width: 100%; height: auto; border-radius: 10px; border: 1px solid var(--border); }
.prose code {
  padding: 1px 5px;
  border-radius: 5px;
  background: var(--code-bg);
  font: 0.9em/1.5 ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}
.prose pre { padding: 14px 16px; overflow-x: auto; border-radius: 10px; background: var(--code-bg); }
.prose pre code { padding: 0; background: none; }
.prose table { display: block; overflow-x: auto; border-collapse: collapse; margin: 16px 0; font-size: 15px; }
.prose th, .prose td { padding: 8px 12px; border: 1px solid var(--border); text-align: left; vertical-align: top; }
.prose th { background: var(--code-bg); }

/* Releases */

.releases { margin-top: 56px; padding-top: 32px; border-top: 1px solid var(--border); }
.releases > h2 { margin: 0 0 16px; font-size: 22px; }

.release { padding: 16px 0; }
.release + .release { border-top: 1px solid var(--border); }
.release-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; margin-bottom: 8px; }
.release-head h3 { margin: 0; font-size: 18px; }
.release-head .muted { font-size: 14px; }
.release .prose { margin-bottom: 8px; }

.badge {
  padding: 1px 8px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 12px;
  font-weight: 650;
}
.badge-muted { background: var(--code-bg); color: var(--muted); }

.file-list { margin: 0; padding: 0; list-style: none; }
.file-list li { display: flex; flex-wrap: wrap; gap: 2px 16px; padding: 4px 0; font-size: 15px; }
.file-list a { overflow-wrap: anywhere; }
.file-list .muted { font-size: 14px; }
