html {
  scroll-padding-top: 5em;
}

body {
  margin: 0;
}

.Header {
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  padding-left: 32px!important;
  padding-right: 32px!important;
  z-index: 32;
  padding: 16px;
  font-size: 14px;
  line-height: 1.5;
  color: var(--color-header-text);
  background-color: var(--color-header-bg);
}

.Header-link {
  align-items: center;
  display: flex;
  font-weight: 600;
  color: var(--color-header-logo);
  white-space: nowrap;
}

.Header-item {
  margin-right: 16px;
}

.octicon {
  fill: currentColor;
}

.Header-search {
  max-width: 272px;
  width: 100%;
  transition: .2s ease-in-out;
  transition-property: max-width, padding-bottom, padding-top;
}

.Header-search:focus-within {
  max-width: 544px;
}

.Header-search-label {
  display: flex;
  width: 100%;
  max-width: 100%;
  padding: 0;
  font-size: 14px;
  font-weight: 400;
  color: var(--color-text-white);
  vertical-align: middle;
  background-color: var(--color-header-search-bg);
  border: 1px solid var(--color-header-search-border);
  border-radius: 6px;
  box-shadow: none;
}

.Header-search-label:focus-within {
  background-color: hsla(0, 0%, 100%, .175);
  border-color: var(--color-state-focus-border);
  outline: none;
}

.Header-search-input {
  min-height: 28px;
  width: 100%;
  padding: 5px 12px;
  padding-top: 0;
  padding-bottom: 0;
  font-size: 14px;
  background: none;
  border: 0;
  box-shadow: none;
  border-radius: 6px;
  color: #fff;
}

.Header-search-input:focus {
  border: 0;
  box-shadow: none;
  background-color: var(--color-bg-secondary);
  color: var(--color-text-primary);
  border-color: var(--color-state-focus-border);
  outline: none;
}

::placeholder {
  color: #c2c3c4;
  opacity: 1;
}

.switch-theme {
  top: -2px;
  left: -2px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background-color: var(--color-profile-color-modes-toggle-thumb-bg);
  cursor: pointer;
}

.no-select {
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  -khtml-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
}

.details-reset>summary {
  outline: none;
}

.sticky-header {
  position: sticky;
  top: 0;
  background: var(--color-bg-primary, #fff);
  z-index: 2;
}

/* Article tree sidebar */
.article-tree {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  font-size: 13px;
}

.tree-section {
  margin-bottom: 4px;
}

.tree-toggle {
  padding: 6px 8px;
  cursor: pointer;
  border-radius: 4px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 4px;
}

.tree-toggle:hover {
  background: var(--color-bg-secondary);
}

.tree-toggle--sub {
  font-weight: 500;
  padding-left: 16px;
  font-size: 12px;
}

.tree-icon {
  font-size: 14px;
  flex-shrink: 0;
}

.tree-count {
  margin-left: auto;
}

.tree-children {
  padding-left: 8px;
}

.tree-subsection {
  margin-bottom: 2px;
}

.tree-leaf {
  display: block;
  padding: 3px 8px 3px 24px;
  color: var(--color-text-secondary);
  text-decoration: none;
  border-radius: 4px;
  line-height: 1.4;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tree-leaf:hover {
  background: var(--color-bg-secondary);
  color: var(--color-text-primary);
}

.tree-num {
  display: inline-block;
  width: 22px;
  color: var(--color-text-tertiary, #8b949e);
  font-weight: 600;
}

/* Ensure first paragraph isn't hidden behind sticky post header */
.Box-body .markdown-body > *:first-child {
  margin-top: 0.5em;
}

.tippy-box {
  border-radius: 10px;
}

.tippy-content {
  border-radius: 10px;
  background-color: var(--color-bg-table-of-contents-container);
  border: 1px solid var(--color-border-primary);
  overflow-y: hidden;
  padding: 0;
}

#table-of-contents {
  max-height: 30em;
  overflow-y: auto;
}
#table-of-contents > nav ul {
  list-style-type: none;
}

#table-of-contents > nav > ul li > a {
  color: var(--color-text-primary);
  text-decoration: none;
  padding: 0.5em;
  border-radius: 6px;
  display: block;
}

#table-of-contents > nav > ul li > a.table-of-contents-option-selected {
  background-color: var(--color-bg-table-of-contents-option-selected);
  color: var(--color-fg-table-of-contents-option-selected);
}

#table-of-contents > nav ul > li {
  margin-left: 1em;
  font-family: -apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif,Apple Color Emoji,Segoe UI Emoji;
}

#table-of-contents > nav > ul > li {
  margin-left: 0;
}

@media (max-width: 768px) {
  .Header {
    padding-left: 24px!important;
    padding-right: 24px!important;
  }
}

@media (max-width: 480px) {
  .Header {
    padding-left: 16px!important;
    padding-right: 16px!important;
  }
  .mobile-none {
    display: none!important;
  }
  .Header-search {
    max-width: 100%;
  }
}

.pinned-item-desc img {
  max-width: 100%;
}

/* Microblog feed */
.Box-row .markdown-body {
  font-size: 14px;
  line-height: 1.6;
}

.Box-row .markdown-body img {
  max-width: 100%;
  border-radius: 6px;
}

.Box-row .markdown-body p:last-child {
  margin-bottom: 0;
}

.IssueLabel {
  display: inline-block;
  padding: 0 7px;
  font-size: 12px;
  font-weight: 500;
  line-height: 18px;
  border-radius: 2em;
  white-space: nowrap;
}

/* Activity streak mini heatmap */
.activity-streak {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 2px;
}

.streak-cell {
  aspect-ratio: 1;
  border-radius: 2px;
}

.streak-level-0 { background-color: var(--color-calendar-graph-day-bg, #ebedf0); }
.streak-level-1 { background-color: var(--color-calendar-graph-day-L1-bg, #9be9a8); }
.streak-level-2 { background-color: var(--color-calendar-graph-day-L2-bg, #40c463); }
.streak-level-3 { background-color: var(--color-calendar-graph-day-L3-bg, #30a14e); }

/* Mobile compact sidebar */
@media (max-width: 768px) {
  .h-card .p-note.user-profile-bio {
    font-size: 12px;
  }

  .h-card .activity-streak,
  .h-card .vcard-details {
    display: none;
  }
}

/* Tab system */
.homepage-tabs .UnderlineNav {
  border-bottom: 1px solid var(--color-border-primary);
  margin-bottom: 16px;
}

.homepage-tabs .UnderlineNav-body {
  display: flex;
  gap: 0;
}

.homepage-tabs .UnderlineNav-item {
  padding: 8px 16px;
  font-size: 14px;
  color: var(--color-text-secondary);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  display: flex;
  align-items: center;
  text-decoration: none;
}

.homepage-tabs .UnderlineNav-item[aria-current="page"] {
  font-weight: 600;
  color: var(--color-text-primary);
  border-bottom-color: #6f42c1;
}

.homepage-tabs .UnderlineNav-item:hover {
  color: var(--color-text-primary);
}

@media (max-width: 768px) {
  .homepage-tabs .UnderlineNav-body {
    overflow-x: auto;
    white-space: nowrap;
    -webkit-overflow-scrolling: touch;
  }
}

/* Feed items */
.feed-item { border-radius: 6px; }

.feed-label {
  display: inline-block;
  padding: 1px 8px;
  font-size: 12px;
  font-weight: 500;
  line-height: 18px;
  border-radius: 2em;
  color: #fff;
}

.feed-label--thought { background-color: #6f42c1; }
.feed-label--shipped { background-color: #28a745; }
.feed-label--article { background-color: #0366d6; }

.feed-tag {
  display: inline-block;
  padding: 2px 8px;
  font-size: 11px;
  border-radius: 2em;
  background: var(--color-bg-secondary);
  border: 1px solid var(--color-border-primary);
  margin-right: 4px;
}

.feed-item--pinned {
  border-color: #6f42c1;
  border-width: 2px;
}

.pinned-badge {
  font-size: 11px;
  color: #6f42c1;
  font-weight: 600;
}

/* Tag filter pills */
.tag-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tag-pill {
  padding: 4px 12px;
  font-size: 12px;
  border-radius: 2em;
  border: 1px solid var(--color-border-primary);
  background: var(--color-bg-secondary);
  color: var(--color-text-secondary);
  cursor: pointer;
}

.tag-pill:hover {
  color: var(--color-text-primary);
  border-color: var(--color-text-secondary);
}

.tag-pill--active {
  background: #6f42c1;
  color: #fff;
  border-color: #6f42c1;
}

/* Article thumbnail */
.article-thumb {
  width: 80px;
  height: 80px;
  overflow: hidden;
  border-radius: 6px;
  flex-shrink: 0;
}

.article-thumb-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

@media (max-width: 480px) {
  .article-thumb {
    width: 60px;
    height: 60px;
  }
}

.article-thumb-placeholder {
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, #6f42c1, #0366d6);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 700;
  font-size: 18px;
  letter-spacing: 1px;
}

/* Article summary — strip images and clean up */
.article-summary img,
.article-summary hr {
  display: none;
}

.article-summary h1,
.article-summary h2,
.article-summary h3 {
  font-size: inherit;
  font-weight: normal;
  display: inline;
}
