:root {
	--bg: #fbfaf8;
	--surface: #ffffff;
	--text: #1d1c1a;
	--muted: #6b6862;
	--border: #e6e3dd;
	--accent: #2f6f4f;
	--accent-text: #ffffff;
	--add: #2f7a3e;
	--del: #b23a2e;
	--warn-bg: #fdf3e2;
	--error-bg: #fbeae8;
	--radius: 10px;
	--font: ui-sans-serif, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
	--mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
	color-scheme: light;
}

@media (prefers-color-scheme: dark) {
	:root {
		--bg: #151514;
		--surface: #1e1e1c;
		--text: #ecebe8;
		--muted: #a19e97;
		--border: #33322f;
		--accent: #5fb487;
		--accent-text: #0f1a14;
		--add: #6cc380;
		--del: #f08a7e;
		--warn-bg: #3a2f1c;
		--error-bg: #3d2421;
		color-scheme: dark;
	}
}

* {
	box-sizing: border-box;
}

body {
	margin: 0;
	background: var(--bg);
	color: var(--text);
	font: 16px/1.55 var(--font);
	-webkit-font-smoothing: antialiased;
}

a {
	color: var(--accent);
}

main {
	max-width: 760px;
	margin: 0 auto;
	padding: 24px 16px 64px;
}

h1 {
	font-size: 28px;
	line-height: 1.2;
	margin: 0 0 8px;
	font-weight: 650;
}

h2 {
	font-size: 18px;
	margin: 0;
	font-weight: 600;
}

h3 {
	font-size: 17px;
	margin: 0 0 6px;
	font-weight: 600;
}

.muted {
	color: var(--muted);
}

.site-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	max-width: 760px;
	margin: 0 auto;
	padding: 16px;
}

.brand {
	font-weight: 700;
	font-size: 18px;
	color: var(--text);
	text-decoration: none;
	letter-spacing: -0.01em;
}

.brand span {
	color: var(--accent);
}

.site-header nav {
	display: flex;
	align-items: center;
	gap: 14px;
	font-size: 15px;
}

.avatar {
	border-radius: 50%;
}

.site-footer {
	max-width: 760px;
	margin: 0 auto;
	padding: 24px 16px 40px;
	color: var(--muted);
	font-size: 13px;
}

button,
.button {
	font: inherit;
	font-size: 15px;
	border: 1px solid var(--accent);
	background: var(--accent);
	color: var(--accent-text);
	border-radius: 8px;
	padding: 8px 14px;
	cursor: pointer;
	text-decoration: none;
	display: inline-block;
}

button.secondary {
	background: transparent;
	color: var(--accent);
}

button.small,
.button.small {
	font-size: 13px;
	padding: 4px 10px;
}

button.link {
	background: none;
	border: none;
	padding: 0;
	color: var(--accent);
	text-decoration: underline;
	font-size: inherit;
}

form.inline {
	display: inline;
	margin: 0;
}

input {
	font: inherit;
	padding: 8px 12px;
	border: 1px solid var(--border);
	border-radius: 8px;
	background: var(--surface);
	color: var(--text);
	min-width: 0;
}

.hero {
	padding: 32px 0 16px;
}

.hero p {
	color: var(--muted);
	max-width: 60ch;
}

.add-repo {
	display: flex;
	gap: 8px;
	margin: 16px 0;
}

.add-repo input {
	flex: 1;
}

.notice {
	border-radius: var(--radius);
	padding: 10px 14px;
	margin: 12px 0;
	background: var(--warn-bg);
}

.notice.error {
	background: var(--error-bg);
}

.badge {
	display: inline-block;
	font-size: 12px;
	padding: 1px 8px;
	border-radius: 999px;
	border: 1px solid var(--border);
	color: var(--muted);
	margin-left: 6px;
	vertical-align: middle;
}

.badge.working,
.working::after {
	animation: pulse 1.4s ease-in-out infinite;
}

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

.repo-list li {
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 8px 0;
	border-bottom: 1px solid var(--border);
}

.repo-list li a {
	flex: 1;
}

section + section {
	margin-top: 28px;
}

.repo-head {
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	gap: 16px;
}

.repo-head h1 a {
	color: var(--text);
	text-decoration: none;
	font-weight: 400;
}

.repo-head h1 strong {
	font-weight: 700;
}

.tile {
	background: var(--surface);
	border: 1px solid var(--border);
	border-radius: var(--radius);
	padding: 16px 18px;
}

.tile.quiet {
	background: transparent;
	padding: 8px 18px;
	border-style: dashed;
}

.tile.quiet header {
	margin: 0;
}

.tile.quiet h2 {
	font-size: 15px;
	font-weight: 500;
	color: var(--muted);
}

.tile header {
	display: flex;
	align-items: baseline;
	justify-content: space-between;
	gap: 12px;
	margin-bottom: 10px;
}

.tile .period {
	background: none;
	border: none;
	color: inherit;
	padding: 0;
	text-align: left;
}

.tile .period:hover h2 {
	color: var(--accent);
	text-decoration: underline;
}

.tile .summary p {
	margin: 0 0 8px;
}

.highlights {
	margin: 8px 0 0;
	padding-left: 20px;
}

.highlights li {
	margin: 4px 0;
}

code {
	font-family: var(--mono);
	font-size: 0.88em;
	padding: 1px 5px;
	border-radius: 5px;
	background: var(--bg);
	border: 1px solid var(--border);
}

.refs {
	display: inline-flex;
	flex-wrap: wrap;
	column-gap: 6px;
}

.refs a {
	font-family: var(--mono);
	font-size: 13px;
	margin-left: 6px;
}

.tile footer {
	display: flex;
	justify-content: space-between;
	gap: 12px;
	margin-top: 12px;
	font-size: 13px;
}

.stats {
	margin: 0;
	color: var(--muted);
}

.add {
	color: var(--add);
}

.del {
	color: var(--del);
}

.placeholder {
	color: var(--muted);
	margin: 0;
}

.working::after {
	content: '';
}

@keyframes pulse {
	50% {
		opacity: 0.45;
	}
}

@keyframes zoom-in {
	from {
		opacity: 0;
		transform: scale(0.97);
	}
}

@keyframes zoom-out {
	from {
		opacity: 0;
		transform: scale(1.03);
	}
}

@media (prefers-reduced-motion: reduce) {
	.badge.working,
	.working::after {
		animation: none;
	}
}

@media (max-width: 560px) {
	.repo-head {
		flex-direction: column;
	}
	.tile footer {
		flex-direction: column;
	}
}

/* The repo view: a full-height canvas of cards above the timeline. */

body.app {
	height: 100vh;
	height: 100dvh;
	display: flex;
	flex-direction: column;
	overflow: hidden;
}

body.app .site-header {
	max-width: none;
	padding: 10px 20px;
	width: 100%;
}

body.app main {
	flex: 1;
	min-height: 0;
	max-width: none;
	margin: 0;
	padding: 0;
	display: flex;
	flex-direction: column;
}

body.app .repo-head {
	display: flex;
	align-items: baseline;
	flex-wrap: wrap;
	gap: 4px 12px;
	padding: 0 20px 6px;
}

body.app .repo-head h1 {
	font-size: 20px;
	margin: 0;
}

body.app .repo-head .track {
	margin-left: auto;
}

.canvas {
	position: relative;
	flex: 1;
	min-height: 0;
	overflow: hidden;
	touch-action: pan-y;
}

.slot {
	position: absolute;
	top: 6px;
	bottom: 12px;
	left: 0;
	will-change: transform;
}

.slot > .tile {
	height: 100%;
	overflow-y: auto;
	overflow-x: hidden;
	overscroll-behavior: contain;
	overflow-wrap: anywhere;
}

.slot.quiet > .tile {
	background: transparent;
	border-style: dashed;
}

.slot.quiet h2 {
	color: var(--muted);
	font-weight: 500;
}

.slot.narrow > .tile {
	padding: 12px;
	font-size: 14px;
}

.slot.narrow .tile header {
	flex-direction: column;
	gap: 4px;
}

.slot.narrow .tile footer {
	flex-direction: column;
	gap: 4px;
}

.tile.loading .placeholder {
	animation: pulse 1.4s ease-in-out infinite;
}

.timeline-bar {
	position: relative;
	flex: none;
	height: 104px;
	border-top: 1px solid var(--border);
	background: var(--surface);
	touch-action: none;
	user-select: none;
	cursor: grab;
}

.timeline-bar.dragging {
	cursor: grabbing;
}

#timeline-canvas {
	display: block;
	width: 100%;
	height: 100%;
}

.timeline-controls {
	position: absolute;
	top: 4px;
	right: 10px;
	display: flex;
	align-items: center;
	gap: 4px;
	padding: 2px 4px;
	border-radius: 8px;
	background: var(--surface);
	cursor: default;
}

.timeline-controls button {
	background: var(--bg);
	color: var(--text);
	border: 1px solid var(--border);
	padding: 1px 10px;
	font-size: 14px;
	line-height: 1.6;
}

.timeline-controls button:hover {
	border-color: var(--accent);
}

.resolution {
	font-size: 12px;
	color: var(--muted);
	margin-right: 4px;
	min-width: 56px;
	text-align: right;
}

@media (max-width: 560px) {
	body.app .repo-head .track {
		margin-left: 0;
	}
}
