/* ──────────────────────────────────────────────────────────
   Theme tokens: GitHub Primer colors
   Light by default, dark when the system prefers it,
   and the toggle overrides both via <html data-theme="…">.
   ────────────────────────────────────────────────────────── */

:root {
  --bg: #ffffff;
  --bg-subtle: #f6f8fa;
  --header-bg: #f6f8fa;
  --fg: #1f2328;
  --fg-muted: #59636e;
  --border: #d1d9e0;
  --border-muted: #d1d9e0b3;
  --border-hover: #818b98;
  --accent: #0969da;
  --topic-bg: #ddf4ff;
  --topic-fg: #0969da;
  --neutral-muted: #818b981f;
  --underline: #fd8c73;
  --btn-bg: #f6f8fa;
  --btn-hover-bg: #eff2f5;
  --btn-border: #d1d9e0;
  --btn-primary-bg: #1f883d;
  --btn-primary-hover-bg: #1c8139;
  --btn-primary-border: #1f232826;
  --attention-fg: #9a6700;
  --attention-border: #d4a72c66;
  --success-fg: #1a7f37;
  --success-border: #4ac26b66;
  --dot-border: #1f23281a;

  --icon-sun: none;
  --icon-moon: block;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0d1117;
    --bg-subtle: #151b23;
    --header-bg: #010409;
    --fg: #f0f6fc;
    --fg-muted: #9198a1;
    --border: #3d444d;
    --border-muted: #3d444db3;
    --border-hover: #656c76;
    --accent: #4493f8;
    --topic-bg: #388bfd1a;
    --topic-fg: #4493f8;
    --neutral-muted: #656c7633;
    --underline: #f78166;
    --btn-bg: #212830;
    --btn-hover-bg: #262c36;
    --btn-border: #3d444d;
    --btn-primary-bg: #238636;
    --btn-primary-hover-bg: #29903b;
    --btn-primary-border: #f0f6fc1a;
    --attention-fg: #d29922;
    --attention-border: #bb800966;
    --success-fg: #3fb950;
    --success-border: #2386364d;
    --dot-border: #f0f6fc1a;

    --icon-sun: block;
    --icon-moon: none;
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg: #0d1117;
  --bg-subtle: #151b23;
  --header-bg: #010409;
  --fg: #f0f6fc;
  --fg-muted: #9198a1;
  --border: #3d444d;
  --border-muted: #3d444db3;
  --border-hover: #656c76;
  --accent: #4493f8;
  --topic-bg: #388bfd1a;
  --topic-fg: #4493f8;
  --neutral-muted: #656c7633;
  --underline: #f78166;
  --btn-bg: #212830;
  --btn-hover-bg: #262c36;
  --btn-border: #3d444d;
  --btn-primary-bg: #238636;
  --btn-primary-hover-bg: #29903b;
  --btn-primary-border: #f0f6fc1a;
  --attention-fg: #d29922;
  --attention-border: #bb800966;
  --success-fg: #3fb950;
  --success-border: #2386364d;
  --dot-border: #f0f6fc1a;

  --icon-sun: block;
  --icon-moon: none;
  color-scheme: dark;
}

/* ──────────────────────────────────────────────────────────
   Base
   ────────────────────────────────────────────────────────── */

:root {
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans", Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji";
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  --radius: 6px;
  --header-h: 64px;
  /* Avatars sit on a dark circle in both themes, so transparent
     avatars with light artwork stay visible in light mode */
  --avatar-bg: #0d1117;
}

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

html {
  scroll-padding-top: calc(var(--header-h) + 16px);
  -webkit-text-size-adjust: 100%;
}

@media (prefers-reduced-motion: no-preference) {
  html {
    scroll-behavior: smooth;
  }
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

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

a:hover {
  text-decoration: underline;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
  border-radius: var(--radius);
}

h1, h2, p, ul {
  margin: 0;
}

ul {
  padding: 0;
  list-style: none;
}

.octicon {
  width: 16px;
  height: 16px;
  fill: currentColor;
  flex-shrink: 0;
  vertical-align: text-bottom;
}

.container {
  width: 100%;
  max-width: 1012px;
  margin: 0 auto;
  padding-left: 16px;
  padding-right: 16px;
}

@media (min-width: 768px) {
  .container {
    padding-left: 24px;
    padding-right: 24px;
  }
}

.skip-link {
  position: absolute;
  top: -100px;
  left: 16px;
  z-index: 100;
  padding: 8px 16px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.skip-link:focus {
  top: 12px;
}

/* ──────────────────────────────────────────────────────────
   Header + tabs (GitHub UnderlineNav)
   ────────────────────────────────────────────────────────── */

.header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--header-bg);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  display: grid;
  grid-template-columns: auto 1fr auto;
  grid-template-areas: "brand tabs actions";
  align-items: center;
  column-gap: 24px;
  height: var(--header-h);
}

.brand {
  grid-area: brand;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--fg);
  font-weight: 600;
  font-size: 14px;
  border-radius: var(--radius);
}

.brand:hover {
  text-decoration: none;
}

.brand-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  box-shadow: 0 0 0 1px var(--border-muted);
  background: var(--avatar-bg);
}

.tabs {
  grid-area: tabs;
  display: flex;
  gap: 8px;
  height: 100%;
  overflow-x: auto;
  scrollbar-width: none;
}

.tabs::-webkit-scrollbar {
  display: none;
}

.tab {
  position: relative;
  display: flex;
  align-items: center;
  flex-shrink: 0;
  color: var(--fg);
  font-size: 14px;
  border-radius: var(--radius);
}

.tab:hover {
  text-decoration: none;
}

.tab-inner {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 32px;
  padding: 0 8px;
  border-radius: var(--radius);
  transition: background-color 80ms;
}

.tab .octicon {
  color: var(--fg-muted);
}

.tab:hover .tab-inner {
  background: var(--neutral-muted);
}

/* Reserve bold width so tabs don't shift when selected */
.tab-label::before {
  content: attr(data-content);
  display: block;
  height: 0;
  font-weight: 600;
  visibility: hidden;
  white-space: nowrap;
}

.tab[aria-current="true"] {
  font-weight: 600;
}

.tab[aria-current="true"]::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 2px;
  border-radius: var(--radius);
  background: var(--underline);
}

.header-actions {
  grid-area: actions;
  display: flex;
  gap: 8px;
}

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 32px;
  padding: 0;
  color: var(--fg-muted);
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: background-color 80ms, color 80ms;
}

.icon-btn:hover {
  color: var(--fg);
  background: var(--neutral-muted);
}

.icon-sun {
  display: var(--icon-sun);
}

.icon-moon {
  display: var(--icon-moon);
}

@media (max-width: 767px) {
  :root {
    --header-h: 104px;
  }

  .header-inner {
    grid-template-columns: 1fr auto;
    grid-template-areas:
      "brand actions"
      "tabs tabs";
    grid-template-rows: 56px 48px;
    height: auto;
  }

  .tabs {
    margin: 0 -8px;
  }
}

/* ──────────────────────────────────────────────────────────
   Shared bits: counters, labels, topics, buttons
   ────────────────────────────────────────────────────────── */

.counter {
  display: inline-block;
  min-width: 20px;
  padding: 0 6px;
  font-size: 12px;
  font-weight: 500;
  line-height: 18px;
  text-align: center;
  color: var(--fg);
  background: var(--neutral-muted);
  border: 1px solid transparent;
  border-radius: 2em;
}

.counter:empty {
  display: none;
}

.label {
  display: inline-block;
  padding: 0 7px;
  font-size: 12px;
  font-weight: 500;
  line-height: 18px;
  white-space: nowrap;
  color: var(--fg-muted);
  border: 1px solid var(--border);
  border-radius: 2em;
}

.label--attention {
  color: var(--attention-fg);
  border-color: var(--attention-border);
}

.label--success {
  color: var(--success-fg);
  border-color: var(--success-border);
}

.topics {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.topic {
  display: inline-block;
  padding: 0 10px;
  font-size: 12px;
  font-weight: 500;
  line-height: 22px;
  color: var(--topic-fg);
  background: var(--topic-bg);
  border-radius: 2em;
}

.btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 32px;
  padding: 0 12px;
  font: inherit;
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
  color: var(--fg);
  background: var(--btn-bg);
  border: 1px solid var(--btn-border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: background-color 80ms, border-color 80ms;
}

.btn:hover {
  text-decoration: none;
  background: var(--btn-hover-bg);
}

.btn .octicon {
  color: var(--fg-muted);
}

.btn--sm {
  height: 28px;
  padding: 0 8px;
  gap: 4px;
  font-size: 12px;
}

.btn--icon {
  width: 32px;
  padding: 0;
}

.btn .fa-brands {
  font-size: 16px;
  color: var(--fg-muted);
  transition: color 80ms;
}

.btn:hover .fa-brands {
  color: var(--fg);
}

.btn--primary {
  color: #ffffff;
  background: var(--btn-primary-bg);
  border-color: var(--btn-primary-border);
}

.btn--primary .octicon {
  color: inherit;
}

.btn--primary:hover {
  background: var(--btn-primary-hover-bg);
}

/* ──────────────────────────────────────────────────────────
   Sections
   ────────────────────────────────────────────────────────── */

main {
  flex: 1;
  padding-top: 32px;
  padding-bottom: 48px;
}

.section + .section {
  margin-top: 48px;
}

.section-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 4px 16px;
  padding-bottom: 8px;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--border-muted);
}

.section-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 20px;
  font-weight: 600;
  line-height: 1.5;
}

.section-title .octicon {
  color: var(--fg-muted);
}

.section-desc {
  color: var(--fg-muted);
}

/* ──────────────────────────────────────────────────────────
   About: GitHub profile style
   ────────────────────────────────────────────────────────── */

.profile {
  display: grid;
  grid-template-columns: 200px 1fr;
  grid-template-areas:
    "avatar names"
    "avatar body";
  grid-template-rows: auto 1fr;
  column-gap: 32px;
  row-gap: 16px;
  padding-bottom: 32px;
  border-bottom: 1px solid var(--border-muted);
}

.avatar {
  grid-area: avatar;
  width: 200px;
  height: 200px;
  border-radius: 50%;
  box-shadow: 0 0 0 1px var(--border-muted);
  background: var(--avatar-bg);
  object-fit: cover;
}

.avatar-fallback {
  display: grid;
  place-items: center;
  font-size: 64px;
  font-weight: 600;
  color: #9198a1;
}

.profile-names {
  grid-area: names;
  align-self: end;
}

.profile-name {
  font-size: 26px;
  font-weight: 600;
  line-height: 1.25;
}

.profile-handle {
  display: block;
  font-size: 20px;
  font-weight: 300;
  line-height: 24px;
  color: var(--fg-muted);
}

.profile-body {
  grid-area: body;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 16px;
}

.profile-bio {
  max-width: 60ch;
  font-size: 16px;
}

.profile-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.social-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.profile-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 16px;
  color: var(--fg-muted);
}

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

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

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

.profile-meta strong {
  color: var(--fg);
  font-weight: 600;
}

@media (max-width: 639px) {
  .profile {
    grid-template-columns: 72px 1fr;
    grid-template-areas:
      "avatar names"
      "body body";
    grid-template-rows: auto auto;
    column-gap: 16px;
    padding-bottom: 24px;
  }

  .avatar {
    width: 72px;
    height: 72px;
  }

  .avatar-fallback {
    font-size: 26px;
  }

  .profile-names {
    align-self: center;
  }

  .profile-name {
    font-size: 24px;
  }

  .profile-handle {
    font-size: 18px;
  }
}

/* ──────────────────────────────────────────────────────────
   Project cards: GitHub pinned-repo style
   ────────────────────────────────────────────────────────── */

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 288px), 1fr));
  gap: 16px;
}

.card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 16px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: border-color 80ms;
}

.card.is-clickable:hover {
  border-color: var(--border-hover);
}

/* Banner image across the top of the card, edge to edge */
.card-media {
  position: relative;
  aspect-ratio: 16 / 9;
  margin: -16px -16px 4px;
  overflow: hidden;
  background: var(--bg-subtle);
  border-bottom: 1px solid var(--border);
  border-radius: calc(var(--radius) - 1px) calc(var(--radius) - 1px) 0 0;
}

.card-media img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

@media (prefers-reduced-motion: no-preference) {
  .card-media img {
    transition: transform 200ms ease-out;
  }

  .card.is-clickable:hover .card-media img {
    transform: scale(1.03);
  }
}

/* Generated banner for projects without an image */
.card-media--placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 16px;
  color: #ffffff;
  background:
    radial-gradient(circle at 1px 1px, rgb(255 255 255 / 0.16) 1px, transparent 0) 0 0 / 18px 18px,
    linear-gradient(135deg, hsl(var(--hue) 58% 40%), hsl(calc(var(--hue) + 40) 62% 22%));
}

.card-media--placeholder .octicon {
  width: 28px;
  height: 28px;
  opacity: 0.8;
}

.card-media-name {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: var(--font-mono);
  font-size: 18px;
  font-weight: 600;
  text-shadow: 0 1px 2px rgb(0 0 0 / 0.3);
}

.card-head {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.card-head .octicon {
  color: var(--fg-muted);
}

.card-title {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 14px;
  font-weight: 600;
  color: var(--accent);
}

/* The title link covers the whole card so the card itself is clickable */
.card-link::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: var(--radius);
}

.card-link:focus-visible {
  outline: none;
}

.card-link:focus-visible::after {
  outline: 2px solid var(--accent);
  outline-offset: -1px;
}

.card.is-clickable:hover .card-title {
  text-decoration: underline;
}

.card-head .label {
  margin-left: auto;
}

.card-desc {
  flex: 1;
  font-size: 12px;
  color: var(--fg-muted);
}

.card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 8px;
  font-size: 12px;
  color: var(--fg-muted);
}

.lang {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.lang-dot {
  width: 12px;
  height: 12px;
  flex-shrink: 0;
  border-radius: 50%;
  border: 1px solid var(--dot-border);
}

.card-actions {
  display: flex;
  gap: 8px;
  margin-left: auto;
}

/* GitHub button sits above the card's click overlay */
.card-actions a.btn {
  z-index: 1;
}

.card.is-clickable:hover .btn--primary {
  background: var(--btn-primary-hover-bg);
}

.card-soon {
  font-style: italic;
}

.blankslate {
  grid-column: 1 / -1;
  padding: 32px;
  text-align: center;
  color: var(--fg-muted);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
}

/* ──────────────────────────────────────────────────────────
   Footer
   ────────────────────────────────────────────────────────── */

.footer {
  border-top: 1px solid var(--border-muted);
}

.footer-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 16px;
  padding-top: 24px;
  padding-bottom: 24px;
  font-size: 12px;
  color: var(--fg-muted);
}

.footer-links {
  display: flex;
  gap: 16px;
}

.footer-links a {
  color: var(--fg-muted);
}

.footer-links a:hover {
  color: var(--accent);
}
