:root {
  color-scheme: dark;
  --bg: #0d1117;
  --panel: #161b22;
  --panel-hover: #1c2128;

  --ink: #e6edf3;
  --muted: #8b949e;
  --subtle: #6e7681;

  --line: #30363d;

  --purple: #a371f7;
  --purple-bg: rgba(163, 113, 247, 0.15);

  --blue: #58a6ff;
  --gold: #d29922;

  --input: #0d1117;
}

:root[data-theme="light"] {
  color-scheme: light;

  --bg: #ffffff;
  --panel: #f6f8fa;
  --panel-hover: #eef1f4;

  --ink: #1f2328;
  --muted: #656d76;
  --subtle: #818b98;

  --line: #d1d9e0;

  --purple: #8250df;
  --purple-bg: rgba(130, 80, 223, 0.12);

  --blue: #0969da;
  --gold: #9a6700;

  --input: #ffffff;
}

* {
  box-sizing: border-box;
}

html {
  scroll-padding-top: 24px;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);

  font:
    15px / 1.55 "Instrument Sans",
    system-ui,
    -apple-system,
    "Segoe UI",
    sans-serif;

  transition:
    background-color 0.2s ease,
    color 0.2s ease;
}

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

a:hover {
  text-decoration: underline;
}

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

button {
  font: inherit;
}

/* Layout */

.wrap {
  width: min(1080px, 100%);
  margin: 0 auto;
  padding: 56px 24px;

  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 48px;
}

/* Sidebar */

aside {
  position: sticky;
  top: 32px;
  align-self: start;
}

.avatar {
  width: 96px;
  height: 96px;

  display: block;

  border-radius: 50%;
  border: 1px solid var(--line);

  background: var(--panel);
  object-fit: cover;
}

h1 {
  margin: 18px 0 4px;

  font:
    400 38px / 1.1 "Instrument Serif",
    Georgia,
    serif;

  letter-spacing: -0.5px;
}

.handle {
  margin: 0 0 14px;
  color: var(--muted);
}

.bio {
  margin: 0 0 22px;
  color: var(--muted);
}

.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);

  overflow: hidden;

  border: 1px solid var(--line);
  border-radius: 6px;

  background: var(--panel);
}

.stat {
  padding: 12px 8px;

  border-right: 1px solid var(--line);
  text-align: center;
}

.stat:last-child {
  border-right: 0;
}

.stat b {
  display: block;

  font-size: 20px;
  font-weight: 600;

  color: var(--ink);
}

.stat span {
  display: block;

  margin-top: 2px;

  color: var(--muted);
  font-size: 11px;
}

/* social links */

.socials {
  display: flex;
  gap: 8px;
  margin-top: 18px;
}

.socials a {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel);

  transition:
    background-color 0.15s ease,
    border-color 0.15s ease;
}

.socials a:hover {
  background: var(--panel-hover);
  border-color: var(--muted);
}

.socials img {
  width: 18px;
  height: 18px;
}

/* White GitHub icon on a light background */
:root[data-theme="light"] .socials a:first-child img {
  filter: invert(1);
}

.section-header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

.eyebrow {
  margin: 0 0 2px;

  color: var(--muted);

  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.12em;
}

h2 {
  margin: 0;

  font:
    400 32px / 1.15 "Instrument Serif",
    Georgia,
    serif;
}

.project-count {
  color: var(--muted);
  font-size: 13px;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 14px;
}

.theme-toggle {
  width: 38px;
  height: 38px;
  flex-shrink: 0;

  display: grid;
  place-items: center;

  border: 1px solid var(--line);
  border-radius: 10px;

  background: var(--panel);
  color: var(--ink);

  font-size: 19px;
  line-height: 1;

  cursor: pointer;

  transition:
    background-color 0.2s ease,
    border-color 0.2s ease,
    color 0.2s ease;
}

.theme-toggle:hover {
  background: var(--panel-hover);
  border-color: var(--muted);
}

.tools {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}

.tools input,
.tools select {
  height: 36px;

  font: inherit;
  color: var(--ink);

  background: var(--input);

  border: 1px solid var(--line);
  border-radius: 6px;

  padding: 7px 10px;

  transition:
    border-color 0.15s ease,
    box-shadow 0.15s ease,
    background-color 0.2s ease,
    color 0.2s ease;
}

.tools input {
  flex: 1;
  min-width: 180px;
}

.tools input::placeholder {
  color: var(--subtle);
}

.tools input:focus,
.tools select:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 2px rgba(88, 166, 255, 0.15);
}

.project {
  margin-bottom: 12px;
  overflow: hidden;

  background: var(--panel);

  border: 1px solid var(--line);
  border-radius: 6px;

  transition:
    border-color 0.15s ease,
    background-color 0.2s ease;
}

.project:hover {
  border-color: var(--muted);
}

/* Project header */

.ph {
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}

.ph-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.pname {
  color: var(--blue);
  font-size: 15px;
  font-weight: 600;
}

.pname:hover {
  text-decoration: underline;
}

.meta {
  display: flex;
  gap: 12px;

  color: var(--muted);
  font-size: 12px;
}

.star {
  color: var(--gold);
}

.desc {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.pr {
  display: flex;
  gap: 12px;

  padding: 12px 16px;

  border-top: 1px solid var(--line);
}

.pr:first-of-type {
  border-top: 0;
}

.ico {
  flex: none;

  width: 20px;
  height: 20px;

  display: grid;
  place-items: center;

  margin-top: 1px;
  border-radius: 50%;

  background: var(--purple-bg);
  color: var(--purple);
}

.ico svg {
  width: 13px;
  height: 13px;
  fill: currentColor;
}

.pr-title {
  color: var(--ink);
  font-weight: 500;
}

.pr-title:hover {
  color: var(--blue);
}

.pr-meta {
  margin-top: 1px;
  color: var(--muted);
  font-size: 12px;
}

/* Prevent scrolling while initial data loads */
body.is-loading {
  overflow: hidden;
}

/* Blur the entire page content behind the overlay */
body.is-loading .wrap {
  filter: blur(6px);
  pointer-events: none;
  user-select: none;
}

/* Fixed overlay covers the entire viewport */

.page-loader {
  position: fixed;
  inset: 0;
  z-index: 9999;

  display: grid;
  place-items: center;

  background: var(--bg);
  color: var(--ink);
  font-size: 14px;
}

.page-loader[hidden] {
  display: none !important;
}

.loader-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

/* Spinner */

.loader {
  width: 30px;
  height: 30px;

  border: 3px solid var(--line);
  border-top-color: var(--purple);
  border-radius: 50%;

  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.state {
  padding: 40px 20px;
  text-align: center;

  color: var(--muted);

  border: 1px dashed var(--line);
  border-radius: 6px;
}

/* Retained in case skeleton placeholders are used */
.skeleton {
  height: 110px;
  margin-bottom: 12px;

  border: 1px solid var(--line);
  border-radius: 6px;

  background: var(--panel);
  opacity: 0.6;
}

@media (prefers-reduced-motion: no-preference) {
  .skeleton {
    animation: pulse 1.2s ease-in-out infinite alternate;
  }

  @keyframes pulse {
    to {
      opacity: 0.3;
    }
  }
}

@media (max-width: 820px) {
  .wrap {
    grid-template-columns: 1fr;
    gap: 32px;
    padding: 36px 20px;
  }

  aside {
    position: static;
  }
}

@media (max-width: 560px) {
  .tools {
    flex-direction: column;
  }

  .tools input,
  .tools select {
    width: 100%;
  }

  .section-header {
    align-items: start;
  }

  .header-actions {
    gap: 8px;
  }

  .meta {
    width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }

  .loader {
    animation: spin 0.8s linear infinite !important;
  }
}
