:root {
	--ink: #1d1d1b;
	--muted: #6b6b66;
	--faint: #a9a9a2;
	--rule: #e3e2dc;
	--paper: #fbfaf6;
	--panel: #f2f0e8;
	--accent: #b4372b;
	--accent-soft: #e8c2bc;
	--bar: #2f4b6e;
	--bar-soft: #c9d3df;
	--focus: #d99a2b;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
	margin: 0; background: var(--paper); color: var(--ink);
	font-family: 'Rubik', Arial, Helvetica, sans-serif; font-weight: 400; line-height: 1.4;
}
a { color: inherit; text-decoration-color: var(--faint); text-underline-offset: 2px; }
a:hover { text-decoration-color: var(--accent); }

header.site {
	border-bottom: 1px solid var(--ink); background: var(--paper);
	position: sticky; top: 0; z-index: 50;
}
header.site .inner {
	max-width: 1080px; margin: 0 auto; padding: 10px 16px;
	display: flex; align-items: center; gap: 18px; flex-wrap: wrap;
}
header.site nav { margin-right: auto; }
header.site nav a { text-decoration: none; font-size: 14px; padding: 4px 0; color: var(--muted); }
header.site nav a.on { color: var(--ink); border-bottom: 2px solid var(--accent); }
header.site nav { display: flex; gap: 16px; }
.search { position: relative; }
.search input {
	font: inherit; font-size: 14px; padding: 5px 9px; width: 210px;
	border: 1px solid var(--rule); background: white; border-radius: 3px;
}
.search .results {
	position: absolute; right: 0; top: 34px; width: 340px; background: white;
	border: 1px solid var(--rule); box-shadow: 0 6px 18px rgba(0,0,0,.08); display: none; z-index: 60;
}
.search .results a { display: block; padding: 7px 10px; font-size: 14px; text-decoration: none; border-bottom: 1px solid var(--rule); }
.search .results a:hover { background: var(--panel); }
.search .results small { color: var(--muted); }

main { max-width: 1080px; margin: 0 auto; padding: 24px 16px 80px; }
.lede { max-width: 680px; }
h1 { font-size: 30px; line-height: 1.15; margin: 8px 0 8px; font-weight: 600; letter-spacing: -0.01em; }
h2 { font-size: 20px; margin: 34px 0 6px; font-weight: 600; }
h3 { font-size: 16px; margin: 0 0 4px; font-weight: 600; }
p { margin: 0 0 12px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }

.controls {
	display: flex; flex-wrap: wrap; gap: 8px 18px; align-items: center;
	padding: 12px 0; border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule); margin: 16px 0;
}
.controls label { font-size: 13px; color: var(--muted); }
.controls select, .controls input[type=text] {
	font: inherit; font-size: 14px; padding: 4px 6px; border: 1px solid var(--rule); background: white; border-radius: 3px;
}
.seg { display: inline-flex; border: 1px solid var(--rule); border-radius: 3px; overflow: hidden; background: white; }
.seg button {
	font: inherit; font-size: 13px; border: 0; background: none; padding: 5px 10px; cursor: pointer; color: var(--muted);
	border-right: 1px solid var(--rule);
}
.seg button:last-child { border-right: 0; }
.seg button.on { background: var(--ink); color: white; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips button {
	font: inherit; font-size: 12px; padding: 4px 9px; border: 1px solid var(--rule); background: white;
	border-radius: 999px; cursor: pointer; color: var(--muted);
}
.chips button.on { border-color: var(--ink); color: var(--ink); background: var(--panel); }

.overview { margin-top: 6px; }
.overview .note { font-size: 12px; color: var(--muted); margin-top: 2px; }
.overview-title { font-size: 15px; font-weight: 500; margin: 4px 0 4px; }
.overview .chips { margin: 6px 0 8px; }
.window-label { font-size: 15px; font-weight: 500; margin: 18px 0 2px; }

.row { display: grid; grid-template-columns: 300px 1fr; gap: 20px; padding: 16px 0; border-bottom: 1px solid var(--rule); }
.row .meta h3 a { text-decoration: none; }
.row .meta h3 a:hover { text-decoration: underline; }
.row .meta .dates { font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.row .meta .desc { font-size: 13px; color: #3d3d39; display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
.row .meta .stat { font-size: 13px; margin-top: 6px; }
.row .meta .stat b { font-weight: 600; }
.rank { color: var(--faint); font-weight: 400; margin-right: 6px; }
.tag {
	display: inline-block; font-size: 11px; padding: 1px 6px; border-radius: 2px; background: var(--panel);
	color: var(--muted); margin-right: 4px; vertical-align: 1px;
}
.tag.warn { background: #f6e3cf; color: #8a4b12; }

svg text { font-family: 'Rubik', Arial, sans-serif; }
.axis text { font-size: 11px; fill: var(--muted); }
.axis path, .axis line { stroke: var(--rule); }
.tooltip {
	position: fixed; pointer-events: none; z-index: 100; max-width: 280px; display: none;
	background: rgba(20,20,18,.92); color: white; font-size: 12px; padding: 6px 8px; border-radius: 2px; line-height: 1.35;
}

table.rank-table { width: 100%; border-collapse: collapse; font-size: 14px; }
table.rank-table th {
	text-align: left; font-weight: 500; font-size: 12px; color: var(--muted); border-bottom: 1px solid var(--ink);
	padding: 6px 8px; cursor: pointer; white-space: nowrap;
}
table.rank-table th.num, table.rank-table td.num { text-align: right; font-variant-numeric: tabular-nums; }
table.rank-table th.on { color: var(--ink); }
table.rank-table td { border-bottom: 1px solid var(--rule); padding: 8px; vertical-align: top; }
table.rank-table td .desc { font-size: 12px; color: var(--muted); max-width: 440px; }
table.rank-table td.spark { width: 150px; max-width: 150px; }
table.rank-table td.story { min-width: 300px; }

.story-head { display: grid; grid-template-columns: 1fr 260px; gap: 32px; align-items: start; }
.facts { font-size: 13px; border-left: 1px solid var(--rule); padding-left: 16px; }
.facts div { display: flex; justify-content: space-between; padding: 4px 0; border-bottom: 1px dotted var(--rule); }
.facts div span:first-child { color: var(--muted); }
.callout { background: #f6e3cf; padding: 8px 10px; font-size: 13px; border-radius: 2px; margin: 8px 0; }
.phases { font-size: 13px; }
.phases li { margin-bottom: 4px; }
.articles { font-size: 14px; }
.articles .a { display: grid; grid-template-columns: 92px 18px 1fr; gap: 6px; padding: 5px 0; border-bottom: 1px solid var(--rule); }
.articles .d { color: var(--muted); font-variant-numeric: tabular-nums; font-size: 13px; }
.articles .fp { color: var(--accent); font-size: 12px; }
.articles .ab { font-size: 12px; color: var(--muted); }

.era-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 20px; }
.era-card { background: white; border: 1px solid var(--rule); padding: 14px; }
.era-card ol { padding-left: 20px; margin: 6px 0 0; font-size: 13px; }
.era-card ol li { margin-bottom: 3px; }
.heat td, .heat th { font-size: 12px; padding: 4px 6px; text-align: center; }
.heat th { font-weight: 500; color: var(--muted); }
.heat td.lab { text-align: right; color: var(--ink); white-space: nowrap; }
.heat { border-collapse: collapse; }
.heat-wrap { overflow-x: auto; }

footer.site { border-top: 1px solid var(--rule); max-width: 1080px; margin: 0 auto; padding: 18px 16px 40px; font-size: 12px; color: var(--muted); }

@media (max-width: 760px) {
	h1 { font-size: 24px; }
	.row { grid-template-columns: 1fr; gap: 8px; }
	.story-head { grid-template-columns: 1fr; }
	.facts { border-left: 0; padding-left: 0; }
	.search input { width: 150px; }
	table.rank-table td.spark, table.rank-table th.spark { display: none; }
	table.rank-table td .desc { display: none; }
}

.more-wrap { margin: 18px 0 0; display: flex; align-items: center; gap: 12px; }
.more { font: inherit; font-size: 14px; padding: 7px 14px; border: 1px solid var(--ink); background: white; border-radius: 3px; cursor: pointer; }
.more:hover { background: var(--panel); }

.key { display: inline-block; width: 10px; height: 10px; margin: 0 4px 0 10px; vertical-align: -1px; }
.key:first-child { margin-left: 0; }

.asof { display: inline-block; margin: 2px 0 12px; padding: 5px 12px; font-size: 14px; line-height: 1.4;
	background: var(--panel); border-left: 3px solid var(--accent); }
.asof b { font-weight: 600; }

.heat .sort-btn { font: inherit; color: inherit; background: none; border: 0; padding: 2px 2px; cursor: pointer; white-space: nowrap; }
.heat .sort-btn:hover { color: var(--ink); text-decoration: underline; }
.heat th:first-child { text-align: right; }
.heat th.sorted { color: var(--ink); font-weight: 600; }
.heat th.sorted .sort-btn { border-bottom: 2px solid var(--accent); }
/* sorted column: one outline around the whole column (sides on every cell, top on the
   header, bottom on the last row) rather than a box around each cell */
.heat th.sorted, .heat td.sorted { --col-line: rgba(29, 29, 27, .45);
	box-shadow: inset 1px 0 0 var(--col-line), inset -1px 0 0 var(--col-line); }
.heat th.sorted { box-shadow: inset 1px 0 0 var(--col-line), inset -1px 0 0 var(--col-line), inset 0 1px 0 var(--col-line); }
.heat tbody tr:last-child td.sorted { box-shadow: inset 1px 0 0 var(--col-line), inset -1px 0 0 var(--col-line), inset 0 -1px 0 var(--col-line); }

/* column headers that explain themselves on hover */
th.has-tip { cursor: help; text-decoration: underline dotted var(--faint); text-underline-offset: 3px; }
th.has-tip[data-s] { cursor: pointer; }
#tooltip { max-width: 280px; }

.callout { max-width: 680px; margin: 18px 0 6px; padding: 12px 16px; background: var(--panel); border-left: 3px solid var(--accent); font-size: 15px; line-height: 1.5; }
.heat td.cell { cursor: default; }
.callout p { margin: 0 0 8px; }
.callout p:last-child { margin-bottom: 0; }

/* Eras: bars view */
.ebar-key { display: flex; flex-wrap: wrap; gap: 4px 16px; align-items: center; margin: 4px 0 8px; }
.ek { display: inline-flex; align-items: center; gap: 6px; }
.ek i { display: inline-block; height: 8px; }
table.ebars { border-collapse: collapse; }
table.ebars th { font-size: 12px; font-weight: 500; color: var(--muted); text-align: left; padding: 2px 8px 4px; white-space: nowrap; }
table.ebars td { padding: 4px 8px; vertical-align: middle; }
table.ebars td.lab { text-align: right; font-size: 12px; white-space: nowrap; }
table.ebars tbody tr { border-top: 1px solid var(--rule); }
.eb { position: relative; height: 10px; }
.eb span { position: absolute; left: 0; top: 0; height: 10px; }
.eb .all { background: var(--bar-soft); }
.eb .maj { background: var(--bar); }
.ev { font-size: 11px; color: var(--ink); margin-top: 2px; white-space: nowrap; }
.ev span { color: var(--muted); }
table.ebars td { padding: 4px 5px; }
table.ebars th { padding: 2px 5px 4px; }
table.ebars .sort-btn { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; white-space: nowrap; }
table.ebars .sort-btn:hover { color: var(--ink); text-decoration: underline; }
table.ebars th.sorted { color: var(--ink); font-weight: 600; }
table.ebars th.sorted .sort-btn { border-bottom: 2px solid var(--accent); }
table.ebars td.sorted { background: var(--panel); }
table.ebars tbody tr { transition: opacity .15s; }
table.ebars tbody tr.dim { opacity: .28; }
table.ebars tbody tr.hl td { box-shadow: inset 0 2px 0 var(--ink), inset 0 -2px 0 var(--ink); }
table.ebars tbody tr.hl td:first-child { box-shadow: inset 2px 2px 0 var(--ink), inset 0 -2px 0 var(--ink); }
table.ebars tbody tr.hl td:last-child { box-shadow: inset -2px 2px 0 var(--ink), inset 0 -2px 0 var(--ink); }
table.ebars tbody tr.hl td.lab { font-weight: 600; }
table.ebars td.lab .sort-btn { font-size: 12px; }
.linkish { font: inherit; background: none; border: 0; padding: 0; color: var(--accent); text-decoration: underline; cursor: pointer; }

/* timeline composition view */
.comp-key { display: flex; flex-wrap: wrap; gap: 3px 14px; margin: 2px 0 6px; color: var(--muted); }
.comp-key .ck { display: inline-flex; align-items: center; gap: 5px; }
.comp-key .ck i { display: inline-block; width: 10px; height: 10px; }
.comp-key .ck.dim { opacity: .4; }
