/* ------------------------------------------------------------------ */
/* Reset & base                                                         */
/* ------------------------------------------------------------------ */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:        #f8f8f6;
  --surface:   #ffffff;
  --border:    #e2e2dc;
  --text:      #1a1a18;
  --muted:     #6b6b65;
  --accent:    #2563eb;
  --accent-bg: #eff4ff;
  --tag-bg:    #f0f0ec;
  --tag-text:  #44443e;
  --radius:    6px;
  --font-mono: "JetBrains Mono", "Fira Mono", "Cascadia Code", ui-monospace, monospace;
  --font-sans: system-ui, -apple-system, sans-serif;
}

html { font-size: 16px; }

body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

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

/* ------------------------------------------------------------------ */
/* Layout                                                               */
/* ------------------------------------------------------------------ */

.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0 2rem;
}

.site-header__inner {
  max-width: 1100px;
  margin: 0 auto;
  height: 56px;
  display: flex;
  align-items: center;
  gap: 2rem;
}

.site-header__name {
  font-family: var(--font-mono);
  font-size: .9rem;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -.02em;
}

.site-header__name a { color: inherit; }
.site-header__name a:hover { text-decoration: none; opacity: .7; }

main {
  flex: 1;
  max-width: 1100px;
  width: 100%;
  margin: 0 auto;
  padding: 2.5rem 2rem;
}

.site-footer {
  border-top: 1px solid var(--border);
  padding: 1.25rem 2rem;
  font-size: .8rem;
  color: var(--muted);
  text-align: center;
}

/* ------------------------------------------------------------------ */
/* Index page                                                           */
/* ------------------------------------------------------------------ */

.page-heading {
  margin-bottom: 2rem;
}

.page-heading h1 {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -.03em;
}

.page-heading p {
  color: var(--muted);
  margin-top: .25rem;
  font-size: .95rem;
}

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

.project-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: .6rem;
  transition: box-shadow .15s, border-color .15s;
}

/* ------------------------------------------------------------------ */
/* Filter bar                                                           */
/* ------------------------------------------------------------------ */

.filter-bar {
  display: flex;
  align-items: center;
  gap: .75rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
  padding: .6rem .9rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: .8rem;
}

.filter-bar__label {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: .7rem;
  text-transform: uppercase;
  letter-spacing: .07em;
}

.filter-group {
  display: flex;
  gap: .4rem;
  flex-wrap: wrap;
}

.filter-sep {
  width: 1px;
  height: 16px;
  background: var(--border);
}

.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: .3em;
  padding: .25em .65em;
  border-radius: 99px;
  border: 1px solid var(--border);
  background: var(--tag-bg);
  color: var(--tag-text);
  cursor: pointer;
  user-select: none;
  font-size: .75rem;
  transition: border-color .1s, background .1s;
}

.filter-chip:hover { border-color: var(--accent); }

.filter-chip input {
  width: 12px;
  height: 12px;
  accent-color: var(--accent);
  cursor: pointer;
}

/* ------------------------------------------------------------------ */
/* Table of contents                                                    */
/* ------------------------------------------------------------------ */

.toc {
  display: flex;
  gap: .25rem;
  margin-bottom: 1.25rem;
}

.toc__link {
  font-size: .75rem;
  font-family: var(--font-mono);
  padding: .3em .8em;
  border-radius: 99px;
  border: 1px solid var(--border);
  color: var(--muted);
  background: var(--surface);
  transition: border-color .1s, color .1s;
}

.toc__link:hover { border-color: var(--accent); color: var(--accent); text-decoration: none; }

/* ------------------------------------------------------------------ */
/* Sections                                                             */
/* ------------------------------------------------------------------ */

.project-section { margin-bottom: 2rem; }

.section-heading {
  font-size: .7rem;
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--muted);
  margin: 1.75rem 0 .75rem;
}

.section-heading:first-child { margin-top: 0; }

.project-card--pinned {
  border-color: #c7d7f9;
  background: #fafbff;
}

.pin-icon {
  color: var(--accent);
  font-size: .5rem;
  vertical-align: middle;
  margin-right: .3em;
}

.project-card:hover {
  box-shadow: 0 2px 12px rgba(0,0,0,.07);
  border-color: #ccc;
}

.project-card__name {
  font-size: 1rem;
  font-weight: 600;
  font-family: var(--font-mono);
  letter-spacing: -.02em;
}

.project-card__name a { color: var(--text); }
.project-card__name a:hover { color: var(--accent); text-decoration: none; }

.project-card__desc {
  font-size: .875rem;
  color: var(--muted);
  line-height: 1.5;
  flex: 1;
}

.project-card__meta {
  display: flex;
  align-items: center;
  gap: .5rem;
  flex-wrap: wrap;
  margin-top: .25rem;
}

.badge {
  font-size: .7rem;
  font-family: var(--font-mono);
  padding: .2em .55em;
  border-radius: 3px;
  background: var(--tag-bg);
  color: var(--tag-text);
}

.badge--type {
  background: var(--accent-bg);
  color: var(--accent);
}

.project-card__links {
  display: flex;
  gap: .75rem;
  font-size: .8rem;
  border-top: 1px solid var(--border);
  padding-top: .75rem;
  margin-top: .25rem;
}

.project-card__links a {
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: .25rem;
}

.project-card__links a:hover { color: var(--accent); text-decoration: none; }

/* ------------------------------------------------------------------ */
/* Project page                                                         */
/* ------------------------------------------------------------------ */

.project-header {
  margin-bottom: 2rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
}

.project-header__back {
  font-size: .8rem;
  color: var(--muted);
  margin-bottom: 1rem;
  display: inline-flex;
  align-items: center;
  gap: .3rem;
}

.project-header__back:hover { color: var(--accent); text-decoration: none; }

.project-header h1 {
  font-family: var(--font-mono);
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: -.03em;
  margin-bottom: .5rem;
}

.project-header__desc {
  color: var(--muted);
  font-size: .95rem;
  margin-bottom: 1rem;
}

.project-header__meta {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  align-items: center;
}

.project-header__actions {
  display: flex;
  gap: .75rem;
  margin-top: 1rem;
  flex-wrap: wrap;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  padding: .45em 1em;
  border-radius: var(--radius);
  font-size: .85rem;
  font-weight: 500;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
}

.btn:hover { border-color: var(--accent); color: var(--accent); text-decoration: none; }

.btn--primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.btn--primary:hover { background: #1d4ed8; border-color: #1d4ed8; color: #fff; }

/* ------------------------------------------------------------------ */
/* README / prose                                                       */
/* ------------------------------------------------------------------ */

.readme {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem 2.5rem;
  max-width: 800px;
}

.readme h1, .readme h2, .readme h3,
.readme h4, .readme h5, .readme h6 {
  margin-top: 1.75em;
  margin-bottom: .5em;
  line-height: 1.3;
  letter-spacing: -.02em;
}

.readme h1 { font-size: 1.5rem; padding-bottom: .4em; border-bottom: 1px solid var(--border); }
.readme h2 { font-size: 1.2rem; padding-bottom: .3em; border-bottom: 1px solid var(--border); }
.readme h3 { font-size: 1rem; }

.readme p { margin: .75em 0; }

.readme ul, .readme ol {
  margin: .75em 0;
  padding-left: 1.5em;
}

.readme li { margin: .3em 0; }

.readme code {
  font-family: var(--font-mono);
  font-size: .85em;
  background: var(--tag-bg);
  padding: .15em .4em;
  border-radius: 3px;
}

.readme pre {
  background: #1e1e1e;
  color: #d4d4d4;
  border-radius: var(--radius);
  padding: 1.1em 1.4em;
  overflow-x: auto;
  margin: 1em 0;
}

.readme pre code {
  background: none;
  padding: 0;
  color: inherit;
  font-size: .85rem;
}

.readme blockquote {
  border-left: 3px solid var(--border);
  padding-left: 1em;
  color: var(--muted);
  margin: 1em 0;
}

.readme table {
  border-collapse: collapse;
  width: 100%;
  margin: 1em 0;
  font-size: .9rem;
}

.readme th, .readme td {
  text-align: left;
  padding: .5em .75em;
  border: 1px solid var(--border);
}

.readme th { background: var(--tag-bg); font-weight: 600; }
.readme tr:nth-child(even) td { background: #fafaf8; }

.readme a { color: var(--accent); }
.readme img { max-width: 100%; height: auto; border-radius: var(--radius); }

.readme hr { border: none; border-top: 1px solid var(--border); margin: 1.5em 0; }
