:root {
  --bg: #fbfaf7;
  --surface: #ffffff;
  --text: #1c1b18;
  --muted: #66625a;
  --border: #e6e2d9;
  --accent: #007a5e;
  --accent-text: #ffffff;
  --accent-soft: #e3f2ec;
  --red: #ce1126;
  --yellow: #fcd116;
  --merged: #6e40c9;
  --merged-soft: #efe8fb;
  --closed: #8c2d2d;
  --closed-soft: #f8e6e6;
  --neutral-soft: #efede8;
  --radius: 12px;
  --shadow: 0 1px 2px rgb(0 0 0 / 0.04), 0 4px 16px rgb(0 0 0 / 0.04);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #12130f;
    --surface: #1b1c18;
    --text: #ecebe6;
    --muted: #a19d93;
    --border: #2e2f29;
    --accent: #3fbf93;
    --accent-text: #08130f;
    --accent-soft: #15302a;
    --merged: #b394f0;
    --merged-soft: #2a2140;
    --closed: #e58c8c;
    --closed-soft: #3a1e1e;
    --neutral-soft: #262722;
    --shadow: none;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.6 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

a { color: var(--accent); }
a:hover { text-decoration-thickness: 2px; }
code { font-size: 0.9em; background: var(--neutral-soft); padding: 0.1em 0.35em; border-radius: 4px; }

.flag { display: flex; height: 4px; }
.flag span { flex: 1; }
.flag span:nth-child(1) { background: #007a5e; }
.flag span:nth-child(2) { background: var(--red); }
.flag span:nth-child(3) { background: var(--yellow); }

.nav, main, .footer { max-width: 1040px; margin: 0 auto; padding: 0 16px; }
.nav { display: flex; justify-content: space-between; align-items: center; padding-top: 20px; padding-bottom: 20px; }
.nav a { color: var(--text); text-decoration: none; font-weight: 500; }
.brand { font-weight: 700 !important; }
.brand span { color: var(--muted); font-weight: 400; }

.hero { padding: 48px 0 32px; max-width: 720px; }
.eyebrow { margin: 0 0 8px; color: var(--accent); font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; font-size: 0.8rem; }
h1 { font-size: clamp(2rem, 5vw, 3rem); line-height: 1.1; margin: 0 0 16px; letter-spacing: -0.02em; text-wrap: balance; }
h2 { font-size: 1.35rem; margin: 0; }
.lede { font-size: 1.15rem; color: var(--muted); margin: 0 0 28px; }

.join label { display: block; font-weight: 600; margin-bottom: 6px; }
.join-row { display: flex; gap: 8px; max-width: 480px; }
.join input, .toolbar input {
  flex: 1; min-width: 0; font: inherit; color: var(--text); background: var(--surface);
  border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px;
}
.join input:focus, .toolbar input:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: transparent; }
.join button {
  font: inherit; font-weight: 600; color: var(--accent-text); background: var(--accent);
  border: 0; border-radius: 8px; padding: 10px 18px; cursor: pointer; white-space: nowrap;
}
.join button:hover { filter: brightness(1.08); }
.hint { margin: 8px 0 0; font-size: 0.9rem; color: var(--muted); }

.stats { display: flex; gap: 40px; margin: 36px 0 0; flex-wrap: wrap; }
.stats div { display: flex; flex-direction: column-reverse; }
.stats dt { color: var(--muted); font-size: 0.9rem; }
.stats dd { margin: 0; font-size: 2rem; font-weight: 700; font-variant-numeric: tabular-nums; }

.section { padding: 32px 0; border-top: 1px solid var(--border); }
.toolbar { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.toolbar input { max-width: 320px; }

.grid { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.card a {
  display: flex; gap: 14px; align-items: center; padding: 14px; height: 100%;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); color: inherit; text-decoration: none; transition: border-color 0.15s, transform 0.15s;
}
.card a:hover { border-color: var(--accent); transform: translateY(-1px); }
.card-text { display: flex; flex-direction: column; min-width: 0; }
.card-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card-login, .card-meta { color: var(--muted); font-size: 0.875rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.avatar { border-radius: 50%; background: var(--neutral-soft); flex-shrink: 0; }

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

.steps { padding-left: 1.4em; max-width: 720px; }
.steps li { margin-bottom: 10px; padding-left: 4px; }
.how > p { max-width: 720px; color: var(--muted); }

.back { display: inline-block; margin-top: 24px; text-decoration: none; }
.profile { display: flex; gap: 24px; align-items: flex-start; padding: 24px 0 32px; }
.profile h1 { margin-bottom: 6px; }
.profile-links { display: flex; flex-wrap: wrap; gap: 4px 16px; margin: 0 0 12px; color: var(--muted); }
.bio { margin: 0; max-width: 620px; font-size: 1.05rem; }
.button-secondary {
  font-size: 0.9rem; font-weight: 600; text-decoration: none; padding: 8px 14px;
  border: 1px solid var(--border); border-radius: 8px; background: var(--surface);
}

.contribs { list-style: none; margin: 0; padding: 0; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.contrib { display: flex; gap: 14px; align-items: flex-start; padding: 14px 16px; }
.contrib + .contrib { border-top: 1px solid var(--border); }
.contrib-body { display: flex; flex-direction: column; min-width: 0; }
.contrib-title { font-weight: 600; color: var(--text); text-decoration: none; overflow-wrap: anywhere; }
.contrib-title:hover { color: var(--accent); text-decoration: underline; }
.contrib-meta { color: var(--muted); font-size: 0.875rem; }

.pill {
  flex-shrink: 0; width: 92px; text-align: center; font-size: 0.75rem; font-weight: 600;
  padding: 3px 8px; border-radius: 999px; margin-top: 2px;
  background: var(--neutral-soft); color: var(--muted);
}
.pill-open { background: var(--accent-soft); color: var(--accent); }
.pill-merged, .pill-issue.pill-completed { background: var(--merged-soft); color: var(--merged); }
.pill-pull.pill-closed { background: var(--closed-soft); color: var(--closed); }

.footer { padding-top: 32px; padding-bottom: 48px; color: var(--muted); font-size: 0.9rem; border-top: 1px solid var(--border); }

@media (max-width: 560px) {
  .join-row { flex-direction: column; }
  .profile { flex-direction: column; gap: 16px; }
  .contrib { flex-direction: column; gap: 6px; }
  .pill { width: auto; }
  .stats { gap: 24px; }
}
