:root {
  color-scheme: dark;
  --canvas: #090c10;
  --canvas-soft: #0d1117;
  --panel: #11161d;
  --panel-hover: #151b23;
  --border: #29313b;
  --border-soft: #1d252e;
  --text: #e6edf3;
  --text-soft: #9da7b3;
  --text-faint: #6e7885;
  --blue: #58a6ff;
  --blue-soft: rgba(88, 166, 255, 0.12);
  --green: #3fb950;
  --green-soft: rgba(63, 185, 80, 0.12);
  --fire: #f0883e;
  --fire-soft: rgba(240, 136, 62, 0.12);
  --shell: min(1240px, calc(100vw - 48px));
  --display: "Space Grotesk", "Noto Sans SC", sans-serif;
  --body: "Noto Sans SC", sans-serif;
  --mono: "IBM Plex Mono", "Cascadia Code", monospace;
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: 88px;
}

body {
  margin: 0;
  min-width: 320px;
  overflow-x: hidden;
  background:
    radial-gradient(circle at 76% 5%, rgba(31, 111, 235, 0.1), transparent 29rem),
    var(--canvas);
  color: var(--text);
  font-family: var(--body);
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  opacity: 0.28;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.025) 1px, transparent 1px);
  background-size: 64px 64px;
  mask-image: linear-gradient(to bottom, black, transparent 72%);
  pointer-events: none;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  color: inherit;
  font: inherit;
}

a:focus-visible,
button:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 3px;
}

.page-shell {
  width: var(--shell);
  margin-inline: auto;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  border-bottom: 1px solid var(--border);
  background: rgba(9, 12, 16, 0.86);
  backdrop-filter: blur(18px);
}

.topbar-inner {
  width: var(--shell);
  min-height: 64px;
  margin-inline: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.site-mark {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  font-family: var(--mono);
  font-size: 0.76rem;
  font-weight: 500;
}

.mark-box {
  width: 35px;
  height: 30px;
  display: grid;
  place-items: center;
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--green);
  font-size: 0.68rem;
  letter-spacing: -0.04em;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 30px;
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--text-soft);
}

.site-nav a {
  transition: color 160ms ease;
}

.site-nav a:hover {
  color: var(--text);
}

.nav-toggle {
  display: none;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 1px solid var(--border);
  background: var(--panel);
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 5px;
  cursor: pointer;
}

.nav-toggle span {
  width: 16px;
  height: 1px;
  background: var(--text);
}

.profile-layout {
  padding: 62px 0 110px;
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  gap: clamp(48px, 7vw, 92px);
  align-items: start;
}

.profile-sidebar {
  position: sticky;
  top: 100px;
}

.avatar {
  position: relative;
  width: 132px;
  height: 132px;
  margin-bottom: 24px;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: var(--canvas-soft);
  box-shadow: 0 0 0 5px var(--canvas-soft), 0 18px 42px rgba(0, 0, 0, 0.32);
}

.avatar img {
  width: 100%;
  height: 100%;
  display: block;
  border-radius: inherit;
  object-fit: cover;
}

.avatar i {
  position: absolute;
  right: 3px;
  bottom: 13px;
  width: 23px;
  height: 23px;
  border: 5px solid var(--canvas);
  border-radius: 50%;
  background: var(--green);
}

.profile-sidebar h1 {
  margin: 0;
  font-family: var(--display);
  font-size: 1.9rem;
  line-height: 1.15;
  letter-spacing: -0.04em;
}

.profile-handle {
  margin: 5px 0 18px;
  font-family: var(--mono);
  color: var(--text-faint);
  font-size: 0.82rem;
}

.profile-role {
  margin: 0 0 10px;
  color: var(--text);
  font-size: 0.94rem;
  font-weight: 600;
}

.profile-bio {
  margin: 0;
  color: var(--text-soft);
  font-size: 0.88rem;
  line-height: 1.75;
  text-wrap: pretty;
}

.profile-actions {
  margin-top: 22px;
  display: grid;
  grid-template-columns: 1fr;
  gap: 9px;
}

.button {
  min-height: 40px;
  padding: 0 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.82rem;
  font-weight: 600;
  transition: background 160ms ease, border-color 160ms ease, transform 160ms ease;
}

.button:hover {
  transform: translateY(-1px);
}

.button-primary {
  border-color: #238636;
  background: #238636;
  color: white;
}

.button-primary:hover {
  background: #2ea043;
}

.button-ghost {
  background: var(--panel);
}

.button-ghost:hover {
  border-color: var(--text-faint);
  background: var(--panel-hover);
}

.profile-meta {
  margin: 24px 0 0;
  padding: 20px 0 0;
  display: grid;
  gap: 10px;
  border-top: 1px solid var(--border-soft);
  list-style: none;
  color: var(--text-soft);
  font-family: var(--mono);
  font-size: 0.68rem;
}

.profile-meta li {
  display: flex;
  gap: 9px;
  align-items: center;
}

.profile-meta li > span {
  width: 14px;
  color: var(--text-faint);
  text-align: center;
}

.profile-meta a:hover {
  color: var(--blue);
}

.profile-links {
  margin-top: 20px;
  display: grid;
  gap: 2px;
}

.profile-links a {
  min-height: 38px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-soft);
  color: var(--text-soft);
  font-family: var(--mono);
  font-size: 0.7rem;
}

.profile-links a:hover {
  color: var(--blue);
}

.profile-links b {
  font-weight: 400;
}

.profile-main {
  min-width: 0;
}

.panel {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(17, 22, 29, 0.82);
}

.panel-header {
  min-height: 49px;
  padding: 0 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
  background: rgba(13, 17, 23, 0.75);
}

.file-path {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--mono);
  font-size: 0.7rem;
  color: var(--text-soft);
}

.file-path b {
  color: var(--text-faint);
  font-weight: 400;
}

.file-path strong {
  color: var(--text);
  font-weight: 500;
}

.branch-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 4px var(--green-soft);
}

.visibility,
.repo-visibility {
  padding: 2px 8px;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text-soft);
  font-family: var(--mono);
  font-size: 0.61rem;
}

.readme-body {
  padding: clamp(28px, 5vw, 52px);
}

.terminal-line {
  margin: 0 0 25px;
  color: var(--text-faint);
  font-family: var(--mono);
  font-size: 0.72rem;
}

.terminal-line span {
  margin-right: 8px;
  color: var(--green);
}

.readme-body h2 {
  margin: 0 0 24px;
  font-family: var(--display);
  font-size: clamp(2rem, 5vw, 3.8rem);
  font-weight: 600;
  line-height: 1.03;
  letter-spacing: -0.055em;
}

.readme-body > p:not(.terminal-line, .personal-statement) {
  max-width: 770px;
  margin: 0 0 15px;
  color: var(--text-soft);
  font-size: 0.95rem;
  line-height: 1.85;
  text-wrap: pretty;
}

.readme-body .personal-statement {
  margin: -8px 0 28px;
  color: var(--text);
  font-size: clamp(1rem, 1.8vw, 1.28rem);
  font-weight: 500;
  letter-spacing: 0.02em;
}

.focus-callout {
  margin-top: 34px;
  padding: 18px 20px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 15px;
  align-items: center;
  border: 1px solid rgba(240, 136, 62, 0.32);
  border-radius: 7px;
  background: linear-gradient(90deg, var(--fire-soft), transparent);
}

.focus-icon {
  font-size: 1.3rem;
  filter: saturate(0.85);
}

.focus-callout strong {
  font-size: 0.88rem;
}

.focus-callout p {
  margin: 4px 0 0;
  color: var(--text-soft);
  font-size: 0.77rem;
}

.focus-callout a {
  color: var(--fire);
  font-family: var(--mono);
  font-size: 0.67rem;
  white-space: nowrap;
}

.stats-row {
  margin-top: 18px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(17, 22, 29, 0.6);
}

.stats-row article {
  min-width: 0;
  padding: 20px 22px;
  display: grid;
  gap: 4px;
}

.stats-row article + article {
  border-left: 1px solid var(--border);
}

.stats-row span,
.stats-row small {
  font-family: var(--mono);
  color: var(--text-faint);
  font-size: 0.62rem;
}

.stats-row strong {
  font-family: var(--display);
  font-size: 1.7rem;
  line-height: 1.1;
}

.research-section,
.activity-section,
.outputs-section,
.follow-panel {
  margin-top: 64px;
}

.section-heading {
  margin-bottom: 18px;
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
}

.section-kicker {
  display: block;
  margin-bottom: 4px;
  color: var(--green);
  font-family: var(--mono);
  font-size: 0.62rem;
  letter-spacing: 0.12em;
}

.section-heading h2,
.follow-panel h2 {
  margin: 0;
  font-family: var(--display);
  font-size: 1.42rem;
  letter-spacing: -0.03em;
}

.section-heading > p {
  margin: 0;
  color: var(--text-faint);
  font-size: 0.77rem;
}

.repo-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.repo-card {
  min-width: 0;
  padding: 20px;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(17, 22, 29, 0.72);
  transition: border-color 180ms ease, background 180ms ease, transform 180ms ease;
}

.repo-card:first-child {
  grid-column: span 2;
}

.repo-card:hover {
  border-color: #3d4855;
  background: var(--panel-hover);
  transform: translateY(-2px);
}

.repo-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.repo-icon {
  position: relative;
  width: 16px;
  height: 13px;
  border: 1px solid var(--text-faint);
  border-radius: 2px;
}

.repo-icon::before {
  content: "";
  position: absolute;
  top: -4px;
  left: 2px;
  width: 7px;
  height: 4px;
  border: 1px solid var(--text-faint);
  border-bottom: 0;
  border-radius: 2px 2px 0 0;
}

.repo-card h3 {
  margin: 20px 0 3px;
  color: var(--blue);
  font-family: var(--mono);
  font-size: 0.94rem;
  font-weight: 500;
  overflow-wrap: anywhere;
}

.repo-title {
  margin: 0;
  font-size: 0.9rem;
  font-weight: 600;
}

.repo-description {
  flex: 1;
  margin: 14px 0 18px;
  color: var(--text-soft);
  font-size: 0.8rem;
  line-height: 1.75;
}

.repo-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.repo-tags span {
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--blue-soft);
  color: #79c0ff;
  font-size: 0.62rem;
}

.repo-card footer {
  margin-top: 20px;
  padding-top: 15px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-top: 1px solid var(--border-soft);
  color: var(--text-faint);
  font-family: var(--mono);
  font-size: 0.62rem;
}

.repo-card footer span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.repo-card footer i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--blue);
}

.repo-card footer .hot-label {
  color: var(--fire);
}

.hot-label b {
  font-size: 0.75rem;
  font-weight: 400;
}

.activity-list,
.release-list {
  overflow: hidden;
}

.activity-item {
  position: relative;
  padding: 22px 24px 22px 58px;
}

.activity-item + .activity-item,
.release-item + .release-item {
  border-top: 1px solid var(--border);
}

.activity-item::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 30px;
  width: 1px;
  background: var(--border);
}

.activity-item:first-child::before {
  top: 31px;
}

.activity-item:last-child::before {
  bottom: calc(100% - 31px);
}

.activity-node {
  position: absolute;
  top: 26px;
  left: 25px;
  z-index: 1;
  width: 11px;
  height: 11px;
  border: 2px solid var(--panel);
  border-radius: 50%;
  background: var(--text-faint);
  box-shadow: 0 0 0 1px var(--border);
}

.activity-node.active {
  background: var(--fire);
  box-shadow: 0 0 0 1px var(--fire), 0 0 16px var(--fire-soft);
}

.activity-node.maintained {
  background: var(--green);
}

.activity-node.open {
  background: var(--blue);
}

.activity-meta,
.release-type {
  margin: 0 0 5px;
  color: var(--text-faint);
  font-family: var(--mono);
  font-size: 0.61rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.activity-copy h3,
.release-item h3 {
  margin: 0;
  font-size: 0.93rem;
  font-weight: 600;
}

.activity-copy > p:last-child,
.release-item div > p:last-child {
  margin: 7px 0 0;
  color: var(--text-soft);
  font-size: 0.78rem;
  line-height: 1.7;
}

.release-item {
  min-height: 120px;
  padding: 22px 24px;
  display: grid;
  grid-template-columns: 70px minmax(0, 1fr) auto;
  gap: 22px;
  align-items: center;
}

.release-count {
  font-family: var(--display);
  font-size: 1.55rem;
  color: var(--text);
}

.release-arrow {
  color: var(--text-faint);
  font-family: var(--mono);
}

.follow-panel {
  padding: clamp(26px, 4vw, 38px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 30px;
  border-color: rgba(63, 185, 80, 0.3);
  background:
    linear-gradient(105deg, var(--green-soft), transparent 50%),
    rgba(17, 22, 29, 0.88);
}

.follow-panel p {
  max-width: 620px;
  margin: 9px 0 0;
  color: var(--text-soft);
  font-size: 0.82rem;
}

.follow-actions {
  flex-shrink: 0;
  display: flex;
  gap: 9px;
}

.site-footer {
  border-top: 1px solid var(--border);
  background: var(--canvas-soft);
}

.footer-inner {
  min-height: 86px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 30px;
}

.footer-inner p {
  margin: 0;
  color: var(--text-faint);
  font-family: var(--mono);
  font-size: 0.64rem;
}

.footer-stats {
  display: flex;
  align-items: center;
  gap: 18px;
  color: var(--text-faint);
  font-family: var(--mono);
  font-size: 0.62rem;
}

.footer-stats strong {
  color: var(--text-soft);
  font-weight: 500;
}

.favorite-button {
  min-height: 32px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--panel);
  cursor: pointer;
}

.favorite-button:hover,
.favorite-button[data-active="true"] {
  border-color: var(--green);
  color: var(--green);
}

.favorite-button:disabled {
  opacity: 0.6;
  cursor: wait;
}

@media (max-width: 900px) {
  :root {
    --shell: min(100% - 32px, 760px);
  }

  .profile-layout {
    grid-template-columns: 1fr;
    gap: 50px;
  }

  .profile-sidebar {
    position: static;
    display: grid;
    grid-template-columns: 108px minmax(0, 1fr);
    column-gap: 24px;
  }

  .avatar {
    grid-row: span 4;
    width: 108px;
    height: 108px;
    margin: 0;
  }

  .profile-handle {
    margin-bottom: 10px;
  }

  .profile-actions,
  .profile-meta,
  .profile-links {
    grid-column: 1 / -1;
  }

  .profile-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 680px) {
  .topbar-inner {
    min-height: 58px;
  }

  .nav-toggle {
    display: inline-flex;
  }

  .site-nav {
    position: absolute;
    top: calc(100% + 8px);
    right: 16px;
    width: min(240px, calc(100vw - 32px));
    padding: 8px;
    display: none;
    align-items: stretch;
    flex-direction: column;
    gap: 0;
    border: 1px solid var(--border);
    border-radius: 7px;
    background: var(--panel);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.45);
  }

  .site-nav.is-open {
    display: flex;
  }

  .site-nav a {
    padding: 10px 12px;
  }

  .profile-layout {
    padding-top: 42px;
  }

  .profile-sidebar {
    grid-template-columns: 78px minmax(0, 1fr);
    column-gap: 18px;
  }

  .avatar {
    width: 78px;
    height: 78px;
    font-size: 1.1rem;
  }

  .avatar i {
    right: -2px;
    bottom: 5px;
    width: 19px;
    height: 19px;
    border-width: 4px;
  }

  .profile-sidebar h1 {
    font-size: 1.55rem;
  }

  .profile-role,
  .profile-bio {
    grid-column: 1 / -1;
  }

  .profile-role {
    margin-top: 20px;
  }

  .profile-actions {
    grid-template-columns: 1fr;
  }

  .panel-header {
    padding-inline: 14px;
  }

  .file-path span:nth-child(2),
  .file-path b {
    display: none;
  }

  .readme-body {
    padding: 26px 20px;
  }

  .readme-body h2 {
    font-size: clamp(2rem, 12vw, 3rem);
  }

  .focus-callout {
    grid-template-columns: auto 1fr;
  }

  .focus-callout a {
    grid-column: 2;
  }

  .stats-row {
    grid-template-columns: 1fr;
  }

  .stats-row article + article {
    border-top: 1px solid var(--border);
    border-left: 0;
  }

  .section-heading {
    align-items: start;
    flex-direction: column;
    gap: 7px;
  }

  .repo-grid {
    grid-template-columns: 1fr;
  }

  .repo-card:first-child {
    grid-column: auto;
  }

  .release-item {
    grid-template-columns: 55px minmax(0, 1fr);
  }

  .release-arrow {
    display: none;
  }

  .follow-panel {
    align-items: stretch;
    flex-direction: column;
  }

  .follow-actions {
    flex-direction: column;
  }

  .footer-inner {
    padding: 22px 0;
    align-items: flex-start;
    flex-direction: column;
    gap: 14px;
  }

  .footer-stats {
    width: 100%;
    justify-content: space-between;
    gap: 8px;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    transition: none !important;
  }
}
