@font-face {
  font-family: "Hanken Grotesk";
  src: url("assets/fonts/hanken-grotesk.woff2") format("woff2");
  font-weight: 400 700;
  font-display: swap;
}
@font-face {
  font-family: "JetBrains Mono";
  src: url("assets/fonts/jetbrains-mono.woff2") format("woff2");
  font-weight: 400 500;
  font-display: swap;
}

/* ---------- Tokens ---------- */
:root {
  --bg: #ffffff;
  --soft: #f6f8fa;
  --line: #d9dee3;
  --text: #1d2329;
  --muted: #5b6670;
  --link: #1b62c9;
  --topic-bg: #ddf0ff;
  --tab-on: #e46c43;
  --btn-primary: #1f883d;
  --btn-primary-line: #1a7f37;
  --latest: #1f883d;
  --dir: #54aeff;
  --avatar: #2b3a4a;

  /* code */
  --c-keyword: #cf222e;
  --c-string: #0a3069;
  --c-type: #8250df;
  --c-comment: #6e7781;
  --code-text: #24292f;

  --sans: "Hanken Grotesk", ui-sans-serif, system-ui, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --radius: 8px;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e1116;
    --soft: #151a21;
    --line: #2c333c;
    --text: #e3e8ed;
    --muted: #919ba6;
    --link: #5ea4ff;
    --topic-bg: #142b45;
    --tab-on: #f08a62;
    --btn-primary: #238636;
    --btn-primary-line: #2ea043;
    --latest: #4ac26b;
    --dir: #6cb6ff;
    --avatar: #3a4c5f;

    --c-keyword: #ff7b72;
    --c-string: #a5d6ff;
    --c-type: #d2a8ff;
    --c-comment: #8b949e;
    --code-text: #e3e8ed;
  }
}

/* ---------- Base ---------- */
* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 15px/1.5 var(--sans);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 0.2em; }
:focus-visible { outline: 2px solid var(--link); outline-offset: 2px; border-radius: 4px; }
::selection { background: var(--link); color: var(--bg); }

.ico { fill: none; stroke: var(--muted); stroke-width: 1.3; flex: none; }
.ico .fill { fill: var(--muted); stroke: none; }
.dir { fill: var(--dir); flex: none; }

/* ---------- Header ---------- */
.top { background: var(--soft); border-bottom: 1px solid var(--line); }
.top .in {
  max-width: 1220px;
  margin: 0 auto;
  padding: 22px 32px 0;
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  row-gap: 18px;
}

.crumb { display: flex; align-items: center; gap: 10px; font-size: 20px; min-width: 0; }
.crumb .owner { color: var(--link); }
.crumb .sep { color: var(--muted); }
.crumb .repo { color: var(--link); font-weight: 700; }

.pill {
  font-size: 12px;
  line-height: 1.6;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0 9px;
  color: var(--muted);
  background: var(--bg);
}

.actions { display: flex; gap: 8px; }
.btn {
  font-size: 13px;
  font-weight: 600;
  line-height: 20px;
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--text);
  border-radius: 6px;
  padding: 5px 12px;
  white-space: nowrap;
  transition: background-color 120ms ease-out, border-color 120ms ease-out;
}
.btn:hover { text-decoration: none; background: var(--soft); border-color: var(--muted); }
.btn.primary { background: var(--btn-primary); border-color: var(--btn-primary-line); color: #fff; }
.btn.primary:hover { filter: brightness(1.08); }

.tabs { grid-column: 1 / -1; display: flex; gap: 4px; overflow-x: auto; }
.tab {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px 10px;
  font-size: 14px;
  color: var(--text);
  border-bottom: 2px solid transparent;
  white-space: nowrap;
}
.tab:hover { text-decoration: none; border-color: var(--line); }
.tab.on { border-color: var(--tab-on); font-weight: 600; }
.tab .n {
  font-size: 12px;
  line-height: 18px;
  background: var(--line);
  border-radius: 999px;
  padding: 0 7px;
  color: var(--muted);
  font-weight: 500;
}

/* ---------- Layout ---------- */
.wrap {
  max-width: 1220px;
  margin: 0 auto;
  padding: 24px 32px 48px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 296px;
  gap: 32px;
  align-items: start;
}

.box { border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }

/* ---------- File list ---------- */
.commit {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  background: var(--soft);
  border-bottom: 1px solid var(--line);
  font-size: 14px;
}
.av {
  width: 22px; height: 22px;
  border-radius: 50%;
  background: var(--avatar);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  display: grid;
  place-items: center;
  flex: none;
}
.commit .msg { color: var(--muted); }
.commit .when { margin-left: auto; color: var(--muted); font-family: var(--mono); font-size: 12px; white-space: nowrap; }

.row {
  display: grid;
  grid-template-columns: 16px 200px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 9px 16px;
  border-bottom: 1px solid var(--line);
  font-size: 14px;
  color: var(--text);
}
.row:last-child { border-bottom: 0; }
a.row:hover { text-decoration: none; background: var(--soft); }
a.row:hover .name { color: var(--link); text-decoration: underline; text-underline-offset: 0.2em; }
.row .m { color: var(--muted); }
.row .t { color: var(--muted); font-size: 13px; }

/* ---------- README ---------- */
.readme { margin-top: 24px; scroll-margin-top: 16px; }
.readme .hd {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
  font-weight: 600;
}
.readme .bd { padding: 28px 32px 32px; }
.readme h1 {
  margin: 0;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
  font-size: 34px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.2;
}
.readme p { margin: 16px 0; font-size: 16px; max-width: 62ch; }

pre {
  margin: 16px 0 0;
  background: var(--soft);
  border-radius: 6px;
  padding: 16px 18px;
  font: 13.5px/1.6 var(--mono);
  color: var(--code-text);
  overflow-x: auto;
  scroll-margin-top: 16px;
}
.k { color: var(--c-keyword); }
.s { color: var(--c-string); }
.ty { color: var(--c-type); }
.c { color: var(--c-comment); }

/* ---------- Sidebar ---------- */
.side h2 { margin: 0 0 10px; font-size: 16px; font-weight: 600; }
.side p { margin: 0 0 14px; font-size: 14.5px; }
.side .loc { display: flex; align-items: center; gap: 9px; font-size: 14px; }
.sec { border-top: 1px solid var(--line); padding-top: 18px; margin-top: 20px; scroll-margin-top: 16px; }

.topics { list-style: none; padding: 0; margin: 4px 0 0; display: flex; flex-wrap: wrap; gap: 6px; }
.topics li {
  font-size: 12px;
  font-weight: 600;
  color: var(--link);
  background: var(--topic-bg);
  border-radius: 999px;
  padding: 2px 10px;
}

.links { list-style: none; padding: 0; margin: 0; display: grid; gap: 4px; font-size: 14px; }
.links small { color: var(--muted); font-size: 13px; }

.count { font-family: var(--mono); font-size: 12px; font-weight: 400; color: var(--muted); }
.rel { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; font-size: 13.5px; }
.rel li { display: grid; grid-template-columns: 2.4em 1fr; align-items: baseline; }
.tag { font-family: var(--mono); font-size: 12px; color: var(--muted); }
.latest {
  margin-left: 6px;
  font-size: 11px;
  font-weight: 600;
  color: var(--latest);
  border: 1px solid currentColor;
  border-radius: 999px;
  padding: 0 7px;
}

/* ---------- README sections (Listening, Interests) ---------- */
.md-h2 {
  margin: 28px 0 10px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--line);
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.01em;
  scroll-margin-top: 16px;
}
.md-table { width: 100%; border-collapse: collapse; font-size: 15px; }
.md-table th, .md-table td { text-align: left; padding: 7px 14px; border: 1px solid var(--line); vertical-align: top; }
.md-table thead th { background: var(--soft); font-weight: 600; }
.md-table td:first-child { white-space: nowrap; }
.md-table td:last-child { color: var(--muted); }
@media (max-width: 640px) {
  .md-table th, .md-table td { padding: 7px 10px; }
  .md-table td:first-child { white-space: normal; }
}

/* ---------- 404 ---------- */
.wrap-single { grid-template-columns: minmax(0, 1fr); max-width: 880px; }
.wrap-single .readme { margin-top: 0; }
.readme .btn { display: inline-block; }

/* ---------- Footer ---------- */
.foot {
  max-width: 1220px;
  margin: 0 auto;
  padding: 0 32px 32px;
  font-size: 12px;
  color: var(--muted);
}

/* ---------- Narrow screens ---------- */
@media (max-width: 900px) {
  .wrap { grid-template-columns: minmax(0, 1fr); }
  .side { border-top: 1px solid var(--line); padding-top: 20px; }
}

@media (max-width: 640px) {
  .top .in { padding: 16px 16px 0; grid-template-columns: 1fr; row-gap: 12px; }
  .crumb { font-size: 18px; flex-wrap: wrap; }
  .actions { flex-wrap: wrap; }
  .wrap { padding: 16px 16px 40px; gap: 24px; }
  .row { grid-template-columns: 16px minmax(0, 1fr) auto; }
  .row .m { display: none; }
  .commit .msg { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .readme .bd { padding: 20px 16px 20px; }
  .readme h1 { font-size: 28px; }
  pre { font-size: 12px; padding: 14px 12px; }
  .foot { padding: 0 16px 24px; }
}
