/* Primer-flavoured colors, straight from GitHub's own light/dark palettes */
:root {
	color-scheme: light dark;

	--canvas-default: light-dark(#ffffff, #0d1117);
	--canvas-subtle: light-dark(#f6f8fa, #151b23);
	--canvas-inset: light-dark(#f6f8fa, #010409);
	--fg-default: light-dark(#1f2328, #f0f6fc);
	--fg-muted: light-dark(#59636e, #9198a1);
	--border-default: light-dark(#d1d9e0, #3d444d);
	--border-muted: light-dark(#d1d9e0b3, #3d444db3);
	--accent-fg: light-dark(#0969da, #4493f8);
	--accent-emphasis: light-dark(#0969da, #1f6feb);
	--accent-subtle: light-dark(#ddf4ff, #388bfd1a);
	--btn-bg: light-dark(#f6f8fa, #212830);
	--btn-hover-bg: light-dark(#eff2f5, #262c36);
	--success-emphasis: light-dark(#1f883d, #238636);
	--shadow-card: light-dark(0 1px 3px #1f232814, 0 1px 3px #01040966);
	--shadow-card-hover: light-dark(0 6px 16px #1f232824, 0 6px 16px #010409cc);

	--header-height: 56px;

	--font-stack:
		-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, monospace;
}

* {
	box-sizing: border-box;
}

body {
	margin: 0;
	background-color: var(--canvas-default);
	color: var(--fg-default);
	font-family: var(--font-stack);
	font-size: 14px;
	line-height: 1.5;
}

/* A faint Primer-blue wash behind the top of the page, so the fold has depth */
body::before {
	content: "";
	position: fixed;
	inset: 0 0 auto;
	height: 420px;
	background: radial-gradient(120% 100% at 50% 0%, var(--accent-subtle), transparent 70%);
	pointer-events: none;
	z-index: -1;
}

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

a:hover {
	text-decoration: underline;
}

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

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

.sr-only {
	position: absolute;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
}

.counter {
	padding: 0 6px;
	background-color: var(--canvas-subtle);
	border: 1px solid var(--border-muted);
	border-radius: 2em;
	color: var(--fg-muted);
	font-size: 12px;
	font-weight: 500;
	line-height: 18px;
}

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

.tag {
	border-color: transparent;
	background-color: var(--accent-subtle);
	color: var(--accent-fg);
}

.meta-item {
	display: inline-flex;
	align-items: center;
	gap: 4px;
}

.language-dot {
	display: inline-block;
	width: 12px;
	height: 12px;
	border: 1px solid var(--border-muted);
	border-radius: 50%;
	flex-shrink: 0;
}

/* Header */

.app-header {
	position: sticky;
	top: 0;
	z-index: 10;
	display: flex;
	align-items: center;
	gap: 8px;
	height: var(--header-height);
	padding: 0 32px;
	background-color: light-dark(#ffffffd9, #0d1117d9);
	backdrop-filter: saturate(180%) blur(12px);
	border-bottom: 1px solid var(--border-default);
}

.app-header-mark {
	display: flex;
	color: var(--fg-default);
}

.app-header-mark .octicon {
	width: 28px;
	height: 28px;
}

.app-header-title {
	font-weight: 600;
}

.app-nav {
	display: flex;
	gap: 4px;
	margin-left: auto;
}

.app-nav-link {
	padding: 6px 12px;
	border-radius: 6px;
	color: var(--fg-muted);
	font-weight: 500;
}

.app-nav-link:hover {
	background-color: var(--btn-hover-bg);
	color: var(--fg-default);
	text-decoration: none;
}

/* Layout */

.layout {
	display: grid;
	grid-template-columns: 296px minmax(0, 1fr);
	gap: 32px;
	max-width: 1280px;
	margin: 0 auto;
	padding: 32px;
}

.content {
	display: flex;
	flex-direction: column;
	gap: 40px;
	min-width: 0;
}

.section-title {
	display: flex;
	align-items: center;
	gap: 8px;
	margin: 0 0 16px;
	padding-bottom: 8px;
	border-bottom: 1px solid var(--border-muted);
	font-size: 16px;
	font-weight: 600;
}

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

/* Sidebar */

.sidebar {
	position: sticky;
	top: calc(var(--header-height) + 32px);
	display: flex;
	flex-direction: column;
	gap: 8px;
	align-self: start;
}

.avatar-frame {
	max-width: 260px;
	line-height: 0;
}

.avatar {
	width: 100%;
	height: auto;
	display: block;
	border: 1px solid var(--border-muted);
	border-radius: 50%;
}

.fullname {
	margin: 12px 0 0;
	font-size: 26px;
	font-weight: 600;
	line-height: 1.25;
}

.username {
	margin: 0;
	color: var(--fg-muted);
	font-size: 20px;
	font-weight: 300;
	line-height: 24px;
}

.bio {
	margin: 8px 0 0;
}

.actions {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin-top: 12px;
}

.actions .btn {
	flex: 1 1 auto;
	min-width: 0;
}

.btn {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	padding: 6px 16px;
	overflow: hidden;
	white-space: nowrap;
	text-overflow: ellipsis;
	background-color: var(--btn-bg);
	border: 1px solid var(--border-default);
	border-radius: 6px;
	color: var(--fg-default);
	font-size: 14px;
	font-weight: 500;
}

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

.btn-primary {
	background-color: var(--success-emphasis);
	border-color: #1f883d33;
	color: #ffffff;
}

.btn-primary:hover {
	background-color: light-dark(#1a7f37, #29903b);
}

.sidebar-details {
	margin: 12px 0 0;
	padding: 0;
	list-style: none;
}

.sidebar-item {
	display: flex;
	align-items: baseline;
	gap: 8px;
	padding: 4px 0;
	color: var(--fg-muted);
}

.sidebar-item a {
	color: inherit;
}

.sidebar-item strong {
	color: var(--fg-default);
	font-weight: 600;
}

.sidebar-title {
	margin: 0 0 8px;
	color: var(--fg-muted);
	font-size: 12px;
	font-weight: 600;
	letter-spacing: 0.04em;
	text-transform: uppercase;
}

/* Languages */

.languages {
	margin-top: 24px;
}

.lang-bar {
	display: flex;
	height: 8px;
	overflow: hidden;
	border-radius: 6px;
	background-color: var(--canvas-subtle);
}

.lang-slice {
	height: 100%;
}

.lang-legend {
	display: flex;
	flex-wrap: wrap;
	gap: 4px 16px;
	margin: 12px 0 0;
	padding: 0;
	list-style: none;
	font-size: 12px;
}

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

.lang-share {
	color: var(--fg-muted);
	font-variant-numeric: tabular-nums;
}

/* Featured cards */

.card-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
	gap: 16px;
	margin: 0;
	padding: 0;
	list-style: none;
}

.card {
	position: relative;
	display: flex;
	flex-direction: column;
	gap: 8px;
	padding: 16px;
	background-color: var(--canvas-default);
	border: 1px solid var(--border-default);
	border-radius: 8px;
	box-shadow: var(--shadow-card);
	transition: border-color 0.15s ease;
}

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

.card-top {
	display: flex;
	align-items: center;
	gap: 8px;
}

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

.card-title {
	margin: 0;
	font-size: 16px;
	font-weight: 600;
	line-height: 1.25;
	min-width: 0;
}

.card-top .tag {
	margin-left: auto;
}

/* The whole card is the link, while the inner links stay clickable on top */
.stretched::after {
	content: "";
	position: absolute;
	inset: 0;
	border-radius: 8px;
}

.card-description {
	margin: 0;
	color: var(--fg-muted);
	flex-grow: 1;
}

.card-links {
	display: flex;
	flex-wrap: wrap;
	gap: 12px;
}

.card-links:empty {
	display: none;
}

/* Only the anchors themselves rise above the stretched overlay, so the gaps
   around them still belong to the card-wide link */
.card-link,
.meta-link {
	position: relative;
	z-index: 1;
}

.card-link {
	display: inline-flex;
	align-items: center;
	gap: 4px;
	font-size: 12px;
	font-weight: 600;
}

.card-meta {
	display: flex;
	flex-wrap: wrap;
	gap: 16px;
	color: var(--fg-muted);
	font-size: 12px;
}

/* Quiet enough to sit among the counters, until it is pointed at */
.meta-link {
	color: inherit;
}

.meta-link:hover {
	color: var(--accent-fg);
}

/* Other repositories */

.repo-list {
	margin: 0;
	padding: 0;
	list-style: none;
}

.repo {
	padding: 16px 0;
	border-bottom: 1px solid var(--border-muted);
}

.repo:first-child {
	padding-top: 0;
}

.repo-name {
	margin: 0;
	font-size: 16px;
	font-weight: 600;
	line-height: 1.25;
}

.repo-description {
	max-width: 75ch;
	margin: 4px 0 8px;
	color: var(--fg-muted);
}

/* Footer */

.footer {
	max-width: 1280px;
	margin: 0 auto;
	padding: 40px 32px;
	color: var(--fg-muted);
	font-size: 12px;
	text-align: center;
}

/* Narrow screens */

@media (max-width: 1012px) {
	.layout {
		grid-template-columns: minmax(0, 1fr);
		gap: 24px;
		padding: 24px;
	}

	.sidebar {
		position: static;
		display: grid;
		grid-template-columns: 120px minmax(0, 1fr);
		gap: 4px 20px;
		align-items: start;
	}

	.avatar-frame {
		grid-row: span 3;
	}

	.sidebar > :not(.avatar-frame) {
		grid-column: 2;
	}
}

@media (max-width: 768px) {
	.app-header {
		padding: 0 16px;
	}

	.app-nav-link {
		padding: 6px 8px;
	}

	.layout {
		padding: 16px;
	}

	.sidebar {
		grid-template-columns: 80px minmax(0, 1fr);
	}

	.card-grid {
		grid-template-columns: minmax(0, 1fr);
	}
}

/* Below this the two-column sidebar squeezes the name into a sliver, so the
   avatar goes back on top of a single column */
@media (max-width: 540px) {
	.app-nav {
		display: none;
	}

	.sidebar {
		display: flex;
		flex-direction: column;
		gap: 4px;
	}

	.avatar-frame {
		max-width: 96px;
	}

	.fullname {
		margin-top: 8px;
		font-size: 22px;
	}

	.username {
		font-size: 18px;
	}
}

@media (prefers-reduced-motion: reduce) {
	.card {
		transition: none;
	}
}
