/* DLR1 (DA / DLR) – layout modelled on the DLR² site: light header, beige bands, slate headings. */
:root {
	--text: #444444;
	--heading: #4a5759;
	--accent: #4a5759;
	--accent-contrast: #ffffff;
	--sage: #95a194;
	--sage-dark: #7c8a7b;
	--beige: #f1eee5;
	--beige-dark: #e4dfd0;
	--surface: #ffffff;
	--border: #dcd8cc;
	--muted: #6f7778;
	--da: #445588;
	--dlr: #6b7f4f;
	/* chart series: the same hues as the sigla, a little more saturated (checked for colour-blind separation) */
	--series-da: #3d58a0;
	--series-dlr: #62883a;
	--grid: #e6e3da;
	--focus: #2f6f9f;
	--font-body: "Roboto", system-ui, -apple-system, "Segoe UI", "Helvetica Neue", Arial, sans-serif;
	--font-heading: "Raleway", "Roboto", sans-serif;
	--header-h: 92px;
	--radius: 4px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; }
body {
	margin: 0;
	font-family: var(--font-body);
	font-size: 16px;
	line-height: 1.55;
	color: var(--text);
	background: var(--surface);
	min-height: 100vh;
	display: flex;
	flex-direction: column;
}
main { flex: 1 0 auto; }
a { color: var(--accent); }
a:hover { color: #2c3536; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
h1, h2, h3, h4 { font-family: var(--font-heading); color: var(--heading); line-height: 1.25; }
img { max-width: 100%; }

.container { width: 100%; max-width: 1200px; margin: 0 auto; padding: 0 16px; }
.container-wide { width: 100%; max-width: 1600px; margin: 0 auto; padding: 0 16px; }
.narrow { max-width: 900px; }

/* ---------- header ---------- */
.site-header {
	position: sticky;
	top: 0;
	z-index: 50;
	background: var(--surface);
	box-shadow: 0 1px 0 rgba(0, 0, 0, .06), 0 2px 12px rgba(0, 0, 0, .04);
}
.header-inner {
	display: flex;
	align-items: center;
	gap: 24px;
	min-height: var(--header-h);
	max-width: 1600px;
}
.brand {
	font-family: var(--font-heading);
	font-weight: 700;
	font-size: 26px;
	letter-spacing: .5px;
	color: var(--heading);
	text-decoration: none;
	white-space: nowrap;
}
.brand-sep { color: var(--sage); margin: 0 1px; font-weight: 500; }
.brand sup { font-size: 14px; margin-left: 2px; }

.main-nav { margin-left: auto; }
.main-nav > ul { list-style: none; display: flex; align-items: center; gap: 4px; margin: 0; padding: 0; }
.main-nav a, .dropdown-toggle {
	display: inline-flex;
	align-items: center;
	gap: 4px;
	padding: 8px 12px;
	font: 400 15px var(--font-body);
	color: #212529;
	text-decoration: none;
	background: none;
	border: 0;
	cursor: pointer;
	white-space: nowrap;
}
.main-nav > ul > li > a.active, .dropdown.active > .dropdown-toggle { color: var(--sage-dark); }
.main-nav a:hover, .dropdown-toggle:hover { color: var(--sage-dark); }
.dropdown-toggle svg { width: 14px; height: 14px; }
.dropdown { position: relative; }
.dropdown-menu {
	display: none;
	position: absolute;
	right: 0;
	top: calc(100% + 6px);
	min-width: 220px;
	list-style: none;
	margin: 0;
	padding: 8px 0;
	background: var(--surface);
	border-radius: var(--radius);
	box-shadow: 0 6px 24px rgba(0, 0, 0, .12);
	z-index: 60;
}
.dropdown.open > .dropdown-menu { display: block; }
.dropdown-menu a { display: block; padding: 8px 18px; font-size: 14px; }
.dropdown-menu a.active { color: var(--sage-dark); font-weight: 500; }
.dropdown-menu .divider { height: 1px; margin: 6px 0; background: var(--border); }

.nav-toggle { display: none; margin-left: auto; width: 40px; height: 40px; border: 0; background: none; cursor: pointer; position: relative; }
.nav-toggle span, .nav-toggle span::before, .nav-toggle span::after {
	position: absolute; left: 9px; width: 22px; height: 2px; background: var(--heading); content: ""; transition: transform .2s;
}
.nav-toggle span { top: 19px; }
.nav-toggle span::before { left: 0; top: -7px; }
.nav-toggle span::after { left: 0; top: 7px; }
.nav-toggle[aria-expanded="true"] span { background: transparent; }
.nav-toggle[aria-expanded="true"] span::before { transform: translateY(7px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] span::after { transform: translateY(-7px) rotate(-45deg); }

.academy-strip { background: var(--beige); font-family: var(--font-heading); font-size: 14px; }
.academy-strip .container { max-width: 1600px; padding-top: 4px; padding-bottom: 4px; }
.academy-strip a { display: inline-flex; align-items: center; gap: 8px; color: var(--heading); text-decoration: none; font-weight: 500; }
.academy-strip img { width: 26px; height: 26px; object-fit: contain; }

/* ---------- search box ---------- */
.search-form { display: flex; align-items: flex-start; gap: 0; position: relative; flex-wrap: wrap; }
/* basis 0 + min-width 0: the box shrinks with the header instead of pushing the button to a new line */
.search-box { position: relative; flex: 1 1 0; min-width: 0; }
.search-box input {
	width: 100%;
	height: 36px;
	padding: 6px 32px 6px 10px;
	font: 14px var(--font-body);
	color: var(--text);
	border: 1px solid var(--border);
	border-right: 0;
	border-radius: var(--radius) 0 0 var(--radius);
	background: var(--surface);
	-webkit-appearance: none;
	appearance: none;
}
.search-box input::-webkit-search-cancel-button { display: none; }
.search-box input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(74, 87, 89, .15); }
.search-clear { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); border: 0; background: none; font-size: 18px; line-height: 1; color: var(--muted); cursor: pointer; padding: 4px; }
.search-submit {
	height: 36px;
	width: 42px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	border: 0;
	border-radius: 0 var(--radius) var(--radius) 0;
	background: var(--accent);
	color: var(--accent-contrast);
	cursor: pointer;
}
.search-submit:hover { background: #374244; }
.search-submit svg { width: 16px; height: 16px; }
.search-form.small { width: 300px; flex: 0 1 300px; padding-top: 8px; }
.browse-link { flex-basis: 100%; font-size: 12px; color: var(--muted); text-decoration: none; margin: 2px 0 4px; }
.browse-link:hover { text-decoration: underline; }
.search-form.large { width: 100%; max-width: 420px; }
.search-form.large .search-box input, .search-form.large .search-submit { height: 42px; font-size: 15px; }

.suggestions {
	position: absolute;
	left: 0;
	right: -42px;
	top: calc(100% + 2px);
	z-index: 70;
	list-style: none;
	margin: 0;
	padding: 4px 0;
	max-height: 360px;
	overflow-y: auto;
	background: var(--surface);
	border: 1px solid var(--border);
	border-radius: var(--radius);
	box-shadow: 0 8px 24px rgba(0, 0, 0, .12);
	text-align: left;
}
.suggestions li { padding: 6px 12px; cursor: pointer; font-size: 14px; }
.suggestions li:hover, .suggestions li[aria-selected="true"] { background: var(--beige); }

/* ---------- home ---------- */
.hero {
	background:
		linear-gradient(120deg, rgba(255, 255, 255, .92), rgba(255, 255, 255, .7)),
		repeating-linear-gradient(135deg, #f4f4f2 0 2px, transparent 2px 22px),
		linear-gradient(160deg, #ffffff 0%, #f2f2ef 55%, #e9e9e4 100%);
	padding: 64px 0 72px;
	text-align: center;
}
.hero-inner { display: flex; flex-direction: column; align-items: center; gap: 18px; }
.hero h1 { font-size: clamp(32px, 5vw, 52px); font-weight: 700; margin: 0; max-width: 760px; }
.hero-sub { margin: -10px 0 12px; font-family: var(--font-heading); font-size: clamp(16px, 2vw, 20px); color: var(--heading); }
.hero-search { display: flex; align-items: center; justify-content: center; gap: 12px; flex-wrap: wrap; width: 100%; margin-top: 4px; }
.hero-search .search-form.large { flex: 0 1 420px; }
.hero-search .btn-outline { height: 42px; display: inline-flex; align-items: center; }
.btn-outline {
	display: inline-block;
	padding: 8px 16px;
	font-size: 14px;
	color: var(--heading);
	text-decoration: none;
	border: 1px solid var(--heading);
	border-radius: var(--radius);
	background: var(--surface);
}
.btn-outline:hover { background: var(--heading); color: #fff; }

.stats-band { background: var(--beige); padding: 48px 0; }
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 24px; text-align: center; }
.stat-number { display: block; font-family: var(--font-heading); font-weight: 700; font-size: clamp(28px, 4vw, 40px); color: var(--sage); font-variant-numeric: tabular-nums; }
.stat-label { display: block; font-size: 14px; color: var(--muted); margin-top: 4px; }

.about-band { padding: 56px 0 64px; text-align: center; }
.section-title { font-size: 14px; letter-spacing: 2px; text-transform: uppercase; color: var(--muted); font-weight: 600; margin: 0 0 20px; }
.about-band p { text-align: justify; hyphens: auto; }
.partner-logos { display: flex; justify-content: center; align-items: center; gap: 56px; flex-wrap: wrap; margin-top: 40px; }
.partner-logos img { height: 110px; width: auto; object-fit: contain; filter: saturate(.9); }
.partner-logos a:hover img { filter: none; }
/* the institute logo is a wide banner (seal + name): sized by width, shrinks on narrow screens */
.partner-logos img.logo-wide { width: 420px; max-width: 100%; height: auto; }

/* ---------- content pages ---------- */
.content-page { padding-top: 32px; padding-bottom: 56px; }
.content-page h1 { font-size: 30px; text-align: center; margin: 0 0 24px; }
.content-page h2 { font-size: 22px; }
.content-page article > p { text-align: justify; hyphens: auto; }
.content-page table { max-width: 100%; }
.content-page .peritext { margin-top: 8px; }
.content-page .peritext a { line-height: 1.8; }
.data-table { width: 100%; border-collapse: collapse; margin: 16px 0; }
.data-table th, .data-table td { padding: 10px 12px; border-bottom: 1px solid var(--border); text-align: left; }
.data-table thead th { background: var(--beige); font-family: var(--font-heading); color: var(--heading); }
.data-table td:nth-child(n+3), .data-table th:nth-child(n+3) { text-align: right; font-variant-numeric: tabular-nums; }
.data-table tfoot th, .data-table tfoot td { font-weight: 700; border-bottom: 0; }
.note { font-size: 14px; color: var(--muted); }

/* ---------- search page ---------- */
.search-layout {
	display: grid;
	grid-template-columns: 250px minmax(0, 1fr) 250px;
	gap: 24px;
	padding-top: 20px;
	padding-bottom: 40px;
	align-items: start;
}
.results-pane, .facets-pane { position: sticky; top: calc(var(--header-h) + 12px); }
.results-pane { display: flex; flex-direction: column; max-height: calc(100vh - var(--header-h) - 32px); }
.pager { display: flex; align-items: center; gap: 4px; margin-bottom: 8px; }
.pager button {
	min-width: 30px; height: 28px; padding: 0 6px;
	font: 13px var(--font-body); color: var(--heading);
	background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); cursor: pointer;
}
.pager button:disabled { opacity: .4; cursor: default; }
.pager-current { flex: 1; text-align: center; font-size: 13px; }
.result-list {
	list-style: none;
	margin: 0;
	padding: 0;
	overflow-y: auto;
	border: 1px solid var(--border);
	border-radius: var(--radius);
}
.result-list li + li { border-top: 1px solid var(--border); }
.result-list a { display: flex; gap: 6px; align-items: baseline; padding: 7px 10px; font-size: 14px; color: var(--text); text-decoration: none; }
.result-list a:hover { background: var(--beige); }
.result-list a[aria-current] { background: var(--heading); color: #fff; }
.result-list a[aria-current] .siglum { background: #fff; color: var(--heading); }
.result-list .label { font-weight: 500; }
.result-list .empty, .result-list .loading, .results-pane > .loading { padding: 10px; font-size: 14px; color: var(--muted); }

.siglum {
	flex: none;
	display: inline-block;
	min-width: 32px;
	padding: 0 5px;
	font: 700 11px/18px var(--font-body);
	text-align: center;
	letter-spacing: .5px;
	color: #fff;
	background: var(--heading);
	border-radius: 3px;
}
.siglum.DA { background: var(--da); }
.siglum.DLR { background: var(--dlr); }

.entry-toolbar { display: flex; justify-content: flex-end; min-height: 22px; font-size: 14px; color: var(--muted); }
.homonyms { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 4px 0 12px; font-size: 14px; }
.homonyms-label { margin-right: 4px; }
.homonyms a {
	display: inline-flex; gap: 6px; align-items: center;
	padding: 3px 10px 3px 3px; border: 1px solid var(--border); border-radius: 20px;
	color: var(--text); text-decoration: none; background: var(--surface);
}
.homonyms a .siglum { border-radius: 12px; }
.homonyms a[aria-current] { border-color: var(--heading); box-shadow: inset 0 0 0 1px var(--heading); font-weight: 500; }

.entry .placeholder { padding: 48px 0; text-align: center; color: var(--muted); }
.entry-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; margin-bottom: 12px; }
.entry-head .headword { margin: 0; font-size: 26px; font-weight: 700; }
.entry-head .siglum { font-size: 13px; line-height: 22px; }
.entry-head .dict-name { flex-basis: 100%; margin: 0; font-size: 14px; color: var(--muted); }

.viewer-toolbar { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; align-items: center; padding: 8px 0; border-top: 1px solid var(--border); }
.page-tabs { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; font-size: 14px; }
.page-tabs-label { margin-right: 4px; color: var(--muted); }
.page-tabs button, .viewer-actions button, .chips button, .letters button {
	min-width: 32px; height: 30px; padding: 0 9px;
	font: 14px var(--font-body); color: var(--heading);
	background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); cursor: pointer;
}
.page-tabs button[aria-selected="true"], .chips button.active, .letters button.active, .viewer-actions button[aria-pressed="true"] {
	background: var(--heading); border-color: var(--heading); color: #fff;
}
.page-tabs button:hover, .viewer-actions button:hover, .chips button:hover, .letters button:hover { border-color: var(--heading); }
.viewer-actions { display: flex; gap: 4px; align-items: center; font-size: 14px; }
.viewer-actions .open-image { margin-left: 6px; }
/* scanned page with a magnifier (as on CLRE): the page grows inside its frame, which then scrolls */
.scan { position: relative; margin: 0; background: var(--beige); border: 1px solid var(--border); border-radius: var(--radius); }
.scan-zoom { overflow: hidden; border-radius: var(--radius); touch-action: pan-y pinch-zoom; }
.scan.zoomed .scan-zoom { overflow: auto; max-height: calc(100vh - var(--header-h) - 120px); overscroll-behavior: contain; touch-action: pan-x pan-y pinch-zoom; }
.scan img { display: block; width: 100%; height: auto; max-width: none; cursor: zoom-in; user-select: none; -webkit-user-drag: none; }
.scan img.at-max { cursor: zoom-out; }
.scan-zoom.dragging, .scan-zoom.dragging img { cursor: grabbing; }
/* the buttons: a translucent slate pill, top right, visible while the page is on screen */
.zoom-bar { position: sticky; top: calc(var(--header-h) + 8px); z-index: 3; height: 0; display: flex; justify-content: flex-end; overflow: visible; pointer-events: none; }
.zoom-pill {
	display: flex; gap: 2px; height: max-content; margin: 10px 10px 0 0; padding: 3px;
	border: 1px solid rgba(255, 255, 255, .55); border-radius: 22px;
	background: rgba(74, 87, 89, .6); -webkit-backdrop-filter: blur(10px) saturate(150%); backdrop-filter: blur(10px) saturate(150%);
	box-shadow: 0 6px 20px rgba(47, 56, 57, .25); pointer-events: auto;
}
.zoom-pill button { min-width: 36px; height: 36px; padding: 0 8px; border: 0; border-radius: 18px; background: transparent; color: #fff; font: 20px/1 var(--font-body); cursor: pointer; }
.zoom-pill .zoom-level { min-width: 58px; font-size: 13px; font-variant-numeric: tabular-nums; }
.zoom-pill button:hover:not(:disabled) { background: rgba(255, 255, 255, .18); }
.zoom-pill button:disabled { opacity: .4; cursor: default; }
.zoom-pill button:focus-visible { outline: 2px solid #fff; outline-offset: -2px; }
/* side areas of the page (as on CLRE): a round glass arrow appears on hover and stays mid-screen on long pages */
.page-zone { position: absolute; top: 0; bottom: 0; z-index: 2; width: 22%; display: flex; flex-direction: column; }
.page-zone.prev { left: 0; align-items: flex-start; padding-left: 14px; }
.page-zone.next { right: 0; align-items: flex-end; padding-right: 14px; }
.page-zone::before { content: ""; flex: 0 0 auto; height: min(calc(50vh - 30px), calc(50% - 30px)); }
.page-nav {
	position: sticky; top: calc(50vh - 30px); flex: 0 0 auto; width: 60px; height: 60px; border-radius: 50%;
	border: 1px solid rgba(255, 255, 255, .55); background: rgba(74, 87, 89, .42);
	-webkit-backdrop-filter: blur(10px) saturate(150%); backdrop-filter: blur(10px) saturate(150%);
	box-shadow: 0 8px 30px rgba(47, 56, 57, .3), inset 0 1px 0 rgba(255, 255, 255, .35);
	color: #fff; font: 38px/1 var(--font-body); cursor: pointer;
	opacity: 0; transform: scale(.9); transition: opacity .2s, transform .2s, background .2s;
}
.page-zone:hover .page-nav:not(:disabled), .page-nav:focus-visible { opacity: 1; transform: scale(1); }
.page-nav:hover { background: rgba(74, 87, 89, .65); }
.page-nav:disabled { cursor: default; visibility: hidden; }
/* while the page is magnified the arrows step aside: the edges can be dragged and scrolled */
.scan.zoomed .page-zone { display: none; }
@media (hover: none) {
	.page-zone .page-nav:not(:disabled) { opacity: .85; transform: scale(.85); }
}
/* under the page: where we are, and the page numbers again */
.page-counter { margin: 10px 0 6px; text-align: center; font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.page-tabs-bottom { justify-content: center; }
.page-tabs-bottom button[aria-pressed="true"] { background: var(--heading); border-color: var(--heading); color: #fff; }
.cite { margin-top: 12px; font-size: 13px; color: var(--muted); overflow-wrap: anywhere; }

.facet { border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 8px; background: var(--surface); }
.facet summary {
	display: flex; justify-content: space-between; align-items: center;
	padding: 9px 12px; font-size: 14px; color: #212529; cursor: pointer; list-style: none;
}
.facet summary::-webkit-details-marker { display: none; }
.facet summary::after { content: ""; width: 7px; height: 7px; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: rotate(45deg); margin-top: -4px; transition: transform .15s; }
.facet[open] summary { background: var(--beige); }
.facet[open] summary::after { transform: rotate(-135deg); margin-top: 4px; }
.facet-body { padding: 10px 12px; }
.chips { display: flex; flex-wrap: wrap; gap: 4px; }
/* grammatical categories: subcategories with their counts, under the main categories */
.subcategories { border-top: 1px dashed var(--border); padding-top: 8px; }
.subcategories-label { flex-basis: 100%; margin: 0 0 2px; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.chips button .count { margin-left: 6px; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.chips button.active .count { color: rgba(255, 255, 255, .8); }
.chips button:disabled { opacity: .45; cursor: default; }
/* active filters above the result list, each removable */
.active-filters { display: flex; flex-wrap: wrap; gap: 4px; padding: 8px 10px 0; }
.filter-chip {
	display: inline-flex; align-items: center; gap: 6px; padding: 2px 6px 2px 10px;
	font: 13px var(--font-body); color: var(--heading); background: var(--beige);
	border: 1px solid var(--border); border-radius: 14px; cursor: pointer;
}
.filter-chip b { font-weight: 600; }
.filter-chip span { font-size: 15px; line-height: 1; color: var(--muted); }
.filter-chip:hover { border-color: var(--heading); }
.filter-chip:hover span { color: var(--heading); }
.letters { display: grid; grid-template-columns: repeat(6, 1fr); gap: 4px; }
.letters button { min-width: 0; padding: 0; }
.neighbours { list-style: none; margin: 0; padding: 4px 0; }
.neighbours a { display: block; padding: 3px 12px; font-size: 14px; color: var(--text); text-decoration: none; }
.neighbours a:hover { background: var(--beige); }
.neighbours a[aria-current] { font-weight: 700; color: var(--heading); }

.loading { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 14px; }
.spinner { width: 16px; height: 16px; border: 2px solid var(--border); border-top-color: var(--heading); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.error { color: #9b2c2c; }

/* ---------- footer ---------- */
.site-footer { background: var(--beige); font-size: 14px; padding-top: 40px; margin-top: auto; }
.footer-cols { display: grid; grid-template-columns: repeat(3, 1fr); gap: 32px; }
.site-footer h4 { margin: 0 0 12px; font-size: 16px; }
.site-footer p { margin: 0 0 8px; }
.footer-bar { margin-top: 32px; padding: 18px 16px; text-align: center; color: #fff; background: var(--sage); font-size: 13px; }

/* ---------- responsive ---------- */
@media (max-width: 1199px) {
	.search-layout { grid-template-columns: 220px minmax(0, 1fr); }
	.facets-pane { grid-column: 1 / -1; grid-row: 1; position: static; display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 8px; align-items: start; }
	.facet { margin: 0; }
}
@media (max-width: 991px) {
	:root { --header-h: 64px; }
	.nav-toggle { display: block; }
	.header-inner { flex-wrap: wrap; gap: 8px 16px; }
	.main-nav { display: none; flex-basis: 100%; margin: 0; padding-bottom: 8px; }
	.main-nav.open { display: block; }
	.main-nav > ul { flex-direction: column; align-items: stretch; }
	.dropdown-menu { position: static; box-shadow: none; padding: 0 0 4px 12px; min-width: 0; }
	.search-form.small { order: 3; flex: 1 1 100%; width: 100%; padding-top: 0; }
	.search-layout { grid-template-columns: 1fr; }
	.results-pane { position: static; max-height: 320px; }
	/* phones: results, then the entry, then the filters */
	.facets-pane { grid-row: auto; order: 3; }
	.entry-pane { order: 2; }
	.results-pane { order: 1; }
	.footer-cols { grid-template-columns: 1fr; gap: 16px; }
	.stats-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 480px) {
	.brand { font-size: 22px; }
	.hero { padding: 40px 0 48px; }
	.partner-logos { gap: 28px; }
	.partner-logos img { height: 80px; }
	.partner-logos img.logo-wide { width: 320px; height: auto; }
}

/* ================= resource pages: peritexts, reference lists, statistics ================= */
.resource-page { padding-top: 32px; padding-bottom: 64px; }
.page-head { max-width: 860px; margin: 0 0 28px; }
.page-head h1 { font-size: clamp(28px, 4vw, 38px); margin: 4px 0 12px; }
.eyebrow { margin: 0; font-size: 13px; letter-spacing: .12em; text-transform: uppercase; color: var(--sage-dark); font-weight: 600; }
.lead { font-size: 18px; line-height: 1.6; margin: 0 0 16px; }
.muted { color: var(--muted); }
.page-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 16px 0 0; }
.page-actions .btn-outline { display: inline-flex; align-items: center; gap: 8px; }
.doc-icon { width: 14px; height: 18px; flex: none; }
.list-switch { display: flex; flex-wrap: wrap; gap: 4px 18px; margin-top: 18px; font-size: 15px; }
.list-switch a { color: var(--muted); text-decoration: none; padding-bottom: 2px; border-bottom: 2px solid transparent; }
.list-switch a:hover { color: var(--heading); }
.list-switch a[aria-current] { color: var(--heading); border-bottom-color: var(--sage); font-weight: 500; }

/* key figures */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin: 24px 0 0; }
.kpis > div { background: var(--beige); border-radius: var(--radius); padding: 14px 16px; }
.kpis dt { font-size: 13px; color: var(--muted); }
.kpis dd { margin: 2px 0 0; font-family: var(--font-heading); font-size: 26px; font-weight: 700; color: var(--heading); font-variant-numeric: tabular-nums; }
.kpis-large { margin-bottom: 40px; }
.kpis-large dd { font-size: clamp(24px, 3vw, 32px); }

/* filter boxes shared by the lists */
.filter-box { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.filter-box input {
	flex: 1 1 260px; min-width: 0; height: 40px; padding: 0 14px;
	font: 15px var(--font-body); color: var(--text); background: var(--surface);
	border: 1px solid var(--border); border-radius: var(--radius);
}
.filter-box input:focus { outline: 2px solid var(--focus); outline-offset: 1px; border-color: transparent; }
.refs-count, .peritexts-count { font-size: 14px; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }

/* ---- reference lists ---- */
.refs-toolbar {
	position: sticky; top: var(--header-h); z-index: 5; margin: 0 -16px 8px; padding: 12px 16px 10px;
	background: rgba(255, 255, 255, .96); backdrop-filter: blur(4px); border-bottom: 1px solid var(--border);
}
.letter-jump { display: flex; flex-wrap: wrap; gap: 2px; margin-top: 10px; }
.letter-jump a {
	min-width: 28px; height: 28px; padding: 0 4px; display: inline-flex; align-items: center; justify-content: center;
	font: 500 14px var(--font-heading); color: var(--heading); text-decoration: none; border-radius: var(--radius);
}
.letter-jump a:hover { background: var(--beige); }
.ref-group { scroll-margin-top: calc(var(--header-h) + 110px); }
.ref-group h2 { font-size: 26px; margin: 28px 0 6px; padding-bottom: 6px; border-bottom: 2px solid var(--sage); }
.ref-list { margin: 0; }
.ref { display: grid; grid-template-columns: minmax(140px, 240px) 1fr; gap: 4px 24px; padding: 9px 8px; border-bottom: 1px solid var(--grid); scroll-margin-top: calc(var(--header-h) + 120px); }
.ref:target { background: #fbf6df; }
.ref dt { font-weight: 600; color: var(--heading); font-variant: small-caps; letter-spacing: .02em; overflow-wrap: anywhere; }
.ref dt small { font-size: inherit; }
.ref dd { margin: 0; line-height: 1.55; }
.ref-plain dd { grid-column: 1 / -1; }
.note-ref { text-decoration: none; }
.refs-empty, .peritexts-empty { padding: 32px 0; text-align: center; color: var(--muted); }
.ref-notes { margin-top: 48px; padding-top: 16px; border-top: 1px solid var(--border); font-size: 14px; color: var(--muted); }
.ref-notes h2 { font-size: 18px; }
.ref-notes ol { list-style: none; padding: 0; }
.ref-notes li { display: flex; gap: 10px; margin-bottom: 10px; scroll-margin-top: calc(var(--header-h) + 20px); }
.ref-notes li:target { color: var(--text); background: #fbf6df; }
.note-label { flex: none; min-width: 18px; font-weight: 700; color: var(--heading); }

/* ---- peritexts ---- */
.peritexts-toolbar { display: grid; gap: 10px; margin: 0 0 28px; padding: 16px 0; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.segmented { display: inline-flex; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; width: max-content; max-width: 100%; }
.segmented button { padding: 7px 16px; font: 14px var(--font-body); color: var(--heading); background: var(--surface); border: 0; border-right: 1px solid var(--border); cursor: pointer; }
.segmented button:last-child { border-right: 0; }
.segmented button small { color: var(--muted); margin-left: 4px; }
.segmented button[aria-pressed="true"] { background: var(--heading); color: #fff; }
.segmented button[aria-pressed="true"] small { color: rgba(255, 255, 255, .75); }
.type-chips button { height: 32px; }
.series-block { margin-bottom: 40px; }
.series-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 16px; border-bottom: 2px solid var(--sage); margin-bottom: 18px; }
.series-head h2 { display: flex; align-items: center; gap: 10px; font-size: 22px; margin: 0 0 8px; }
.series-head p { margin: 0 0 8px; color: var(--muted); font-size: 14px; }
.volume-grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.volume-card {
	display: flex; flex-direction: column; padding: 16px 18px 12px; background: var(--surface);
	border: 1px solid var(--border); border-top: 4px solid var(--series-dlr); border-radius: var(--radius);
	scroll-margin-top: calc(var(--header-h) + 180px); transition: box-shadow .15s;
}
.volume-card[data-series="DA"] { border-top-color: var(--series-da); }
.volume-card:hover { box-shadow: 0 6px 18px rgba(74, 87, 89, .12); }
.volume-card.highlight { box-shadow: 0 0 0 3px var(--sage); }
.vc-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.vc-top .siglum { font-size: 13px; }
.vc-year { font-family: var(--font-heading); font-weight: 600; color: var(--muted); font-variant-numeric: tabular-nums; }
.vc-range { margin: 10px 0 2px; font-size: 22px; }
.vc-tome { margin: 0; font-size: 13px; color: var(--muted); line-height: 1.4; }
.vc-pages { margin: 4px 0 10px; font-size: 13px; color: var(--muted); }
.vc-docs { list-style: none; margin: 0 0 8px; padding: 8px 0 0; border-top: 1px solid var(--grid); }
.vc-docs a { display: flex; align-items: flex-start; gap: 8px; padding: 4px 0; font-size: 14px; line-height: 1.35; color: var(--text); text-decoration: none; }
.vc-docs a:hover { color: var(--heading); text-decoration: underline; }
.vc-docs .doc-icon { margin-top: 1px; color: #b0453a; }
.vc-empty { margin: 0 0 8px; padding-top: 8px; border-top: 1px solid var(--grid); font-size: 14px; color: var(--muted); font-style: italic; }
.vc-desc { margin-top: auto; font-size: 13px; }
.vc-desc summary { cursor: pointer; color: var(--muted); padding: 4px 0; }
.vc-desc p { margin: 4px 0 6px; line-height: 1.5; }
.digital-lists { margin-top: 24px; padding: 28px; background: var(--beige); border-radius: var(--radius); }
.digital-lists h2 { margin: 0 0 4px; font-size: 22px; }
.digital-lists > p { margin: 0 0 16px; color: var(--muted); }
.list-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }
.list-card { display: grid; gap: 4px; padding: 14px 16px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); text-decoration: none; color: var(--text); }
.list-card .siglum { justify-self: start; }
.list-card strong { color: var(--heading); font-family: var(--font-heading); }
.list-card span:last-child { font-size: 13px; color: var(--muted); }
.list-card:hover { border-color: var(--heading); }

/* ---- statistics ---- */
.stats-section { margin: 0 0 48px; }
.stats-section h2 { font-size: 24px; margin: 0 0 8px; }
.section-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 8px 24px; }
.section-lead { margin: 0 0 18px; color: var(--muted); max-width: 820px; }
.series-table td, .series-table th { white-space: nowrap; }
.series-table tbody th { font-weight: 400; }
.series-table td:nth-child(2), .series-table th:nth-child(2) { text-align: left; }
.table-scroll { overflow-x: auto; }
.chart-legend { display: flex; gap: 16px; list-style: none; margin: 0; padding: 0; font-size: 14px; color: var(--muted); }
.chart-legend li { display: inline-flex; align-items: center; gap: 6px; }
.chart-legend .key { width: 12px; height: 12px; border-radius: 3px; }
.key.da, .seg.da, .col.da .col-fill { background: var(--series-da); }
.key.dlr, .seg.dlr, .col.dlr .col-fill { background: var(--series-dlr); }

/* horizontal bars: one per letter / category, DA and DLR side by side with a 2px gap */
.bar-chart { list-style: none; margin: 0; padding: 0; }
.bar-row { display: grid; grid-template-columns: 110px 1fr; align-items: center; gap: 12px; }
.letters-chart .bar-row { grid-template-columns: 32px 1fr; }
.bar-label { font-size: 14px; color: var(--text); text-decoration: none; text-align: right; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar-label:hover { color: var(--heading); text-decoration: underline; }
.bar-track { display: flex; align-items: center; gap: 2px; height: 26px; text-decoration: none; border-left: 1px solid #cfcabd; padding: 4px 0; }
.bar-track:hover .seg, .bar-track:focus-visible .seg { filter: brightness(1.12); }
.seg { display: block; height: 14px; min-width: 2px; flex: none; }
.seg:last-of-type { border-radius: 0 4px 4px 0; }
.bar-value { margin-left: 8px; font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }

/* subcategories: one series, simple bars */
.sub-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; margin-top: 24px; }
.sub-grid.two { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.sub-card { padding: 16px 18px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.sub-card h3 { margin: 0 0 12px; font-size: 17px; }
.mini-bars { list-style: none; margin: 0; padding: 0; }
.mini-bars a { display: grid; grid-template-columns: 112px 1fr auto; align-items: center; gap: 10px; padding: 3px 0; color: var(--text); text-decoration: none; font-size: 14px; }
.mini-bars a:hover .mini-label { text-decoration: underline; color: var(--heading); }
.mini-track { display: block; height: 10px; }
.mini-fill { display: block; height: 10px; min-width: 2px; background: var(--heading); border-radius: 0 4px 4px 0; }
.mini-value { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }

/* volumes over time: one column per volume */
.column-chart { position: relative; padding-top: 22px; }
.column-chart .axis-max { position: absolute; top: 0; left: 0; font-size: 12px; color: var(--muted); }
.column-chart ol { list-style: none; margin: 0; padding: 0; display: flex; align-items: flex-end; gap: 2px; height: 220px; border-bottom: 1px solid #cfcabd; background: linear-gradient(var(--grid), var(--grid)) 0 0 / 100% 1px no-repeat; }
.column-chart li { position: relative; flex: 1 1 0; max-width: 24px; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; }
.column-chart li a { display: flex; align-items: flex-end; height: 100%; }
.col-fill { display: block; width: 100%; min-height: 2px; border-radius: 4px 4px 0 0; }
.column-chart li a:hover .col-fill, .column-chart li a:focus-visible .col-fill { filter: brightness(1.15); }
.col-year { position: absolute; top: 100%; left: 50%; transform: translateX(-50%); margin-top: 4px; font-size: 11px; color: var(--muted); white-space: nowrap; }
.column-chart { margin-bottom: 28px; }
.col-gap { flex: 0 0 56px !important; max-width: none !important; justify-content: center !important; align-items: center; }
.col-gap span { font-size: 11px; color: var(--muted); writing-mode: vertical-rl; transform: rotate(180deg); border-left: 1px dashed #cfcabd; padding-left: 4px; }

.table-view { margin-top: 12px; font-size: 14px; }
.table-view summary { cursor: pointer; color: var(--muted); }
.table-view .data-table { font-size: 14px; }
.table-view .data-table th, .table-view .data-table td { padding: 5px 10px; }

.facts { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.facts li { padding: 14px 16px; border-left: 3px solid var(--sage); background: var(--beige); border-radius: 0 var(--radius) var(--radius) 0; font-size: 15px; }
.facts strong { display: block; font-family: var(--font-heading); font-size: 24px; color: var(--heading); font-variant-numeric: tabular-nums; }
.rank-list { margin: 0; padding-left: 22px; }
.rank-list li { padding: 4px 0; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.rank-list li::marker { color: var(--muted); }
.rank-list a { font-weight: 600; text-decoration: none; overflow-wrap: anywhere; }
.rank-list a:hover { text-decoration: underline; }
.rank-list .siglum { font-size: 11px; }
.rank-value { margin-left: auto; font-size: 13px; color: var(--muted); }

.chart-tip {
	position: fixed; left: 0; top: 0; z-index: 50; pointer-events: none; max-width: 280px;
	padding: 6px 10px; font-size: 13px; line-height: 1.4; color: #fff; background: #2f3839; border-radius: var(--radius);
	box-shadow: 0 4px 14px rgba(0, 0, 0, .18);
}

@media (max-width: 767px) {
	.ref { grid-template-columns: 1fr; gap: 2px; }
	.refs-toolbar, .peritexts-toolbar { position: static; }
	.bar-row { grid-template-columns: 84px minmax(0, 1fr); gap: 8px; }
	/* on narrow screens the 14% left after the longest bar is too little for its value */
	.bar-track { padding-right: 36px; }
	.column-chart ol { height: 160px; }
	.col-gap { flex-basis: 28px !important; }
	.col-year { display: none; }
	.segmented button { padding: 7px 10px; }
	.segmented button small { display: none; }
	.digital-lists { padding: 20px 16px; }
}

/* ---- user guide ---- */
.quick-steps { list-style: none; margin: 0 0 40px; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.quick-steps li { display: grid; grid-template-columns: auto 1fr; gap: 2px 12px; align-items: baseline; padding: 16px 18px; background: var(--beige); border-radius: var(--radius); }
.step-no { grid-row: span 2; display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; border-radius: 50%; background: var(--heading); color: #fff; font: 700 16px var(--font-heading); }
.quick-steps strong { font-family: var(--font-heading); color: var(--heading); font-size: 17px; }
.quick-steps span:last-child { font-size: 14px; color: var(--muted); }
.guide-layout { display: grid; grid-template-columns: 230px minmax(0, 1fr); gap: 48px; align-items: start; }
.guide-toc { position: sticky; top: calc(var(--header-h) + 20px); font-size: 14px; }
.guide-toc p { margin: 0 0 8px; font-size: 12px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.guide-toc ol { list-style: none; margin: 0; padding: 0; border-left: 2px solid var(--border); }
.guide-toc a { display: block; padding: 5px 0 5px 14px; margin-left: -2px; border-left: 2px solid transparent; color: var(--text); text-decoration: none; line-height: 1.35; }
.guide-toc a:hover { color: var(--heading); border-left-color: var(--sage); }
.guide-section { padding-bottom: 28px; margin-bottom: 28px; border-bottom: 1px solid var(--grid); scroll-margin-top: calc(var(--header-h) + 16px); max-width: 760px; }
.guide-section:last-child { border-bottom: 0; }
.guide-section h2 { display: flex; align-items: center; gap: 12px; font-size: 23px; margin: 0 0 12px; }
.section-no { flex: none; display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; border-radius: 50%; border: 2px solid var(--sage); color: var(--sage-dark); font-size: 14px; }
.guide-section p, .guide-section li { line-height: 1.65; }
.guide-section ul { padding-left: 20px; }
.guide-section li { margin-bottom: 6px; }
.guide-section .siglum { font-size: 12px; }
.guide-section .tip { padding: 10px 14px; background: #fbf6df; border-left: 3px solid #d8b84a; border-radius: 0 var(--radius) var(--radius) 0; font-size: 15px; }
kbd { display: inline-block; padding: 0 6px; font: 13px/1.6 var(--font-body); color: var(--heading); background: var(--surface); border: 1px solid var(--border); border-bottom-width: 2px; border-radius: 4px; }
.examples { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 14px; }
.examples > span { font-size: 14px; color: var(--muted); margin-right: 2px; }
.example { display: inline-flex; align-items: center; height: 30px; padding: 0 12px; font-size: 14px; color: var(--heading); text-decoration: none; background: var(--surface); border: 1px solid var(--border); border-radius: 15px; }
.example:hover { border-color: var(--heading); background: var(--heading); color: #fff; }
@media (max-width: 860px) {
	.guide-layout { grid-template-columns: 1fr; gap: 16px; }
	.guide-toc { position: static; }
}

/* ---- home: grammatical category next to the search box ---- */
.search-form.with-pos { flex-wrap: nowrap; }
.hero-search .search-form.large.with-pos { flex: 0 1 560px; max-width: 560px; }
.pos-select {
	flex: 0 0 auto; max-width: 190px; height: 42px; padding: 0 30px 0 12px;
	font: 15px var(--font-body); color: var(--heading); background: var(--beige) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M3.5 6l4.5 4.5L12.5 6' fill='none' stroke='%234a5759' stroke-width='1.6'/%3E%3C/svg%3E") no-repeat right 10px center / 12px;
	border: 1px solid var(--border); border-right: 0; border-radius: var(--radius) 0 0 var(--radius);
	-webkit-appearance: none; appearance: none; cursor: pointer;
}
.pos-select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(74, 87, 89, .15); position: relative; z-index: 1; }
.search-form.with-pos .search-box input { border-radius: 0; }
@media (max-width: 600px) {
	/* grid on phones: the category takes the first row, the box and the button the second */
	.search-form.with-pos { display: grid; grid-template-columns: minmax(0, 1fr) 42px; width: 100%; }
	.pos-select { grid-column: 1 / -1; max-width: none; border-right: 1px solid var(--border); border-bottom: 0; border-radius: var(--radius) var(--radius) 0 0; }
	.search-form.with-pos .search-box input { border-radius: 0 0 0 var(--radius); }
	.search-form.with-pos .search-submit { border-radius: 0 0 var(--radius) 0; }
}
