:root {
	--page-bg: #f3f5f6;
	--surface: #ffffff;
	--surface-soft: #f8fafb;
	--text: #1e292f;
	--muted: #607078;
	--line: #d8dfe2;
	--line-strong: #b9c4c9;
	--accent: #155d72;
	--accent-dark: #0f4656;
	--accent-soft: #e5f1f4;
	--shadow: 0 12px 35px rgba(22, 40, 48, 0.08);
	--radius: 12px;
	--sans: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
	--serif: Georgia, "Times New Roman", serif;
}

* {
	box-sizing: border-box;
}

html {
	font-size: 16px;
}

body {
	margin: 0;
	min-width: 280px;
	min-height: 100vh;
	background: var(--page-bg);
	color: var(--text);
	font-family: var(--sans);
	line-height: 1.45;
}

button,
input,
select {
	font: inherit;
}

button,
select {
	cursor: pointer;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
a:focus-visible {
	outline: 3px solid rgba(21, 93, 114, 0.28);
	outline-offset: 2px;
}

a {
	color: var(--accent);
	text-decoration-thickness: 1px;
	text-underline-offset: 0.15em;
}

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

.site-header {
	background: var(--surface);
	border-bottom: 1px solid var(--line);
}

.site-header__inner {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 1rem;
	width: min(100% - 2rem, 1800px);
	margin: 0 auto;
	padding: clamp(1rem, 2vw, 1.8rem) 0;
}

.eyebrow {
	margin: 0 0 0.2rem;
	color: var(--accent);
	font-size: 0.75rem;
	font-weight: 750;
	letter-spacing: 0.12em;
	text-transform: uppercase;
}

.site-header h1 {
	margin: 0;
	font-family: var(--serif);
	font-size: clamp(1.5rem, 2.2vw, 2.35rem);
	font-weight: 600;
	line-height: 1.12;
}

.site-header h1 span {
	color: var(--muted);
	font-weight: 400;
}

.publisher {
	margin: 0.3rem 0 0;
	color: var(--muted);
	font-size: clamp(0.85rem, 1.2vw, 1rem);
}

.info-button,
.close-button {
	display: inline-grid;
	place-items: center;
	flex: 0 0 auto;
	border: 1px solid var(--line-strong);
	border-radius: 50%;
	background: var(--surface);
	color: var(--accent);
}

.info-button {
	width: 2.5rem;
	height: 2.5rem;
	font-family: var(--serif);
	font-size: 1.25rem;
	font-weight: 700;
}

.info-button:hover,
.close-button:hover {
	background: var(--accent-soft);
}

.app-shell {
	width: min(100% - 2rem, 1800px);
	margin: 0 auto;
	padding: clamp(1rem, 2vw, 1.6rem) 0 3rem;
}

.search-panel {
	display: grid;
	grid-template-columns: minmax(120px, 0.7fr) auto minmax(120px, 0.7fr) minmax(240px, 2fr) minmax(220px, 1.3fr) auto;
	align-items: end;
	gap: 0.75rem;
	padding: 1rem;
	border: 1px solid var(--line);
	border-radius: var(--radius);
	background: var(--surface);
	box-shadow: var(--shadow);
}

.field-group {
	display: grid;
	min-width: 0;
	gap: 0.35rem;
	text-align: left;
}

.field-group label {
	color: var(--muted);
	font-size: 0.75rem;
	font-weight: 700;
	letter-spacing: 0.04em;
	text-transform: uppercase;
}

input,
select {
	width: 100%;
	min-width: 0;
	height: 2.75rem;
	border: 1px solid var(--line-strong);
	border-radius: 8px;
	background: var(--surface);
	color: var(--text);
	padding: 0 0.75rem;
}

input:hover,
select:hover {
	border-color: #8da0a8;
}

input[type="search"] {
	-webkit-appearance: none;
}

.switch-button,
.search-button,
.pager-button {
	border: 1px solid transparent;
	border-radius: 8px;
	font-weight: 700;
}

.switch-button {
	width: 2.75rem;
	height: 2.75rem;
	border-color: var(--line-strong);
	background: var(--surface-soft);
	color: var(--accent);
	font-size: 1.2rem;
}

.switch-button:hover {
	background: var(--accent-soft);
}

.search-button {
	height: 2.75rem;
	padding: 0 1.25rem;
	background: var(--accent);
	color: white;
}

.search-button:hover {
	background: var(--accent-dark);
}

.workspace {
	display: grid;
	grid-template-columns: minmax(0, 1.55fr) minmax(320px, 0.85fr);
	align-items: start;
	gap: clamp(1rem, 2vw, 1.5rem);
	margin-top: clamp(1rem, 2vw, 1.5rem);
}

.results-panel,
.illustration-panel {
	min-width: 0;
	border: 1px solid var(--line);
	border-radius: var(--radius);
	background: var(--surface);
	box-shadow: var(--shadow);
	overflow: hidden;
}

.results-toolbar {
	display: grid;
	grid-template-columns: auto minmax(0, 1fr) auto auto;
	align-items: center;
	gap: 0.7rem;
	padding: 0.75rem;
	border-bottom: 1px solid var(--line);
	background: var(--surface-soft);
}

.results-status {
	min-width: 0;
	color: var(--muted);
	font-size: 0.9rem;
	text-align: center;
}

.page-size {
	display: flex;
	align-items: center;
	gap: 0.45rem;
	color: var(--muted);
	font-size: 0.82rem;
	white-space: nowrap;
}

.page-size select {
	width: auto;
	height: 2.25rem;
	padding-right: 1.8rem;
}

.pager-button {
	min-height: 2.35rem;
	padding: 0.45rem 0.75rem;
	border-color: var(--line-strong);
	background: var(--surface);
	color: var(--accent);
}

.pager-button:hover:not(:disabled) {
	background: var(--accent-soft);
}

.pager-button:disabled {
	cursor: default;
	opacity: 0.42;
}

.table-wrap {
	overflow-x: auto;
}

.result-table {
	width: 100%;
	border-collapse: separate;
	border-spacing: 0;
	font-family: var(--serif);
	text-align: left;
}

.result-table th,
.result-table td {
	padding: clamp(0.65rem, 1vw, 0.9rem);
	border-bottom: 1px solid var(--line);
	vertical-align: top;
}

.result-table th {
	position: sticky;
	top: 0;
	z-index: 1;
	background: #eef3f5;
	color: #34434a;
	font-family: var(--sans);
	font-size: 0.78rem;
	font-weight: 750;
	letter-spacing: 0.04em;
	text-transform: uppercase;
}

.result-table tbody tr:last-child td {
	border-bottom: 0;
}

.result-table tbody tr:nth-child(even) {
	background: #fbfcfc;
}

.result-table tbody tr:hover {
	background: #f2f7f8;
}

.hSearch,
.hFind,
.cellSearch,
.cellFind {
	width: 31%;
}

.cellSearch,
.cellFind {
	font-size: clamp(1rem, 1.15vw, 1.22rem);
	line-height: 1.35;
}

.hCat,
.cellCat {
	width: 22%;
}

.hRef,
.cellRef {
	width: 6%;
	text-align: center;
}

.hID,
.cellId {
	width: 10%;
	text-align: right;
}

.cellCat,
.cellRef,
.cellId {
	font-family: var(--sans);
	font-size: 0.82rem;
}

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

.term-part {
	display: inline;
}

.term-part + .term-part::before {
	content: " · ";
	color: var(--muted);
}

.link-button,
.ref-button {
	border: 0;
	background: transparent;
	color: var(--accent);
	font: inherit;
	text-align: inherit;
	text-decoration: underline;
	text-decoration-thickness: 1px;
	text-underline-offset: 0.15em;
}

.link-button:hover,
.ref-button:hover {
	color: var(--accent-dark);
}

.ref-button {
	min-width: 2rem;
	padding: 0.2rem 0.45rem;
	border: 1px solid var(--line-strong);
	border-radius: 6px;
	background: var(--surface-soft);
	text-align: center;
	text-decoration: none;
}

.empty-results {
	padding: clamp(2rem, 5vw, 4rem) 1.5rem;
	color: var(--muted);
	text-align: center;
}

.illustration-panel {
	position: sticky;
	top: 1rem;
}

.illustration-panel__heading {
	display: flex;
	align-items: baseline;
	justify-content: space-between;
	gap: 1rem;
	min-height: 3.35rem;
	padding: 0.85rem 1rem;
	border-bottom: 1px solid var(--line);
	background: var(--surface-soft);
}

.illustration-panel h2 {
	margin: 0;
	font-size: 0.85rem;
	letter-spacing: 0.05em;
	text-transform: uppercase;
}

#caption {
	color: var(--muted);
	font-size: 0.84rem;
	text-align: right;
}

.image-link {
	display: block;
	color: inherit;
}

#imageBox {
	width: 100%;
	min-height: 280px;
	height: clamp(360px, 64vh, 850px);
	background-image: url("img0000.png");
	background-position: center top;
	background-repeat: no-repeat;
	background-size: contain;
}

.modal-backdrop {
	position: fixed;
	inset: 0;
	z-index: 100;
	display: none;
	place-items: center;
	padding: 1rem;
	background: rgba(14, 27, 33, 0.55);
}

.modal-backdrop.is-open {
	display: grid;
}

.info-dialog {
	width: min(720px, 100%);
	max-height: min(82vh, 850px);
	overflow: auto;
	padding: clamp(1.1rem, 3vw, 2rem);
	border-radius: var(--radius);
	background: var(--surface);
	box-shadow: 0 25px 70px rgba(0, 0, 0, 0.24);
}

.info-dialog__header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 1rem;
	margin-bottom: 1rem;
}

.info-dialog h2 {
	margin: 0;
	font-family: var(--serif);
	font-size: clamp(1.45rem, 3vw, 2rem);
}

.info-dialog p,
.info-dialog ul {
	text-align: left;
}

.close-button {
	width: 2.35rem;
	height: 2.35rem;
	font-size: 1.55rem;
	line-height: 1;
}

q {
	quotes: "«" "»";
}

@media (min-width: 1500px) {
	.workspace {
		grid-template-columns: minmax(0, 1.7fr) minmax(420px, 0.9fr);
	}
}

@media (max-width: 1180px) {
	.search-panel {
		grid-template-columns: minmax(130px, 1fr) auto minmax(130px, 1fr) minmax(260px, 2fr);
	}

	.chapter-field {
		grid-column: 1 / 4;
	}

	.search-button {
		grid-column: 4;
	}

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

	.illustration-panel {
		position: static;
	}

	#imageBox {
		height: clamp(320px, 62vw, 720px);
	}
}

@media (max-width: 820px) {
	.app-shell,
	.site-header__inner {
		width: min(100% - 1.25rem, 1800px);
	}

	.search-panel {
		grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
		padding: 0.8rem;
	}

	.search-field,
	.chapter-field {
		grid-column: 1 / -1;
	}

	.search-button {
		grid-column: 1 / -1;
		width: 100%;
	}

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

	.page-size {
		grid-column: 1 / -1;
		grid-row: 2;
		justify-content: center;
	}

	.hID,
	.cellId {
		display: none;
	}

	.hSearch,
	.hFind,
	.cellSearch,
	.cellFind {
		width: 35%;
	}
}

@media (max-width: 680px) {
	.site-header__inner {
		align-items: flex-start;
	}

	.site-header h1 {
		font-size: clamp(1.35rem, 7vw, 1.8rem);
	}

	.publisher {
		font-size: 0.82rem;
	}

	.search-panel {
		gap: 0.65rem;
	}

	.results-panel,
	.illustration-panel,
	.search-panel {
		border-radius: 10px;
	}

	.results-toolbar {
		grid-template-columns: 1fr 1fr;
		gap: 0.55rem;
	}

	.results-status {
		grid-column: 1 / -1;
		grid-row: 1;
	}

	.pager-button:first-child {
		grid-column: 1;
		grid-row: 2;
	}

	.pager-button:last-child {
		grid-column: 2;
		grid-row: 2;
	}

	.page-size {
		grid-column: 1 / -1;
		grid-row: 3;
	}

	.table-wrap {
		overflow: visible;
		padding: 0.75rem;
		background: var(--page-bg);
	}

	.result-table,
	.result-table tbody,
	.result-table td {
		display: block;
		width: 100%;
	}

	.result-table thead {
		display: none;
	}

	.result-table tbody {
		display: grid;
		gap: 0.75rem;
	}

	.result-table tbody tr {
		display: grid;
		grid-template-columns: minmax(0, 1fr) auto auto;
		overflow: hidden;
		border: 1px solid var(--line);
		border-radius: 10px;
		background: var(--surface);
		box-shadow: 0 4px 14px rgba(22, 40, 48, 0.05);
	}

	.result-table tbody tr:nth-child(even),
	.result-table tbody tr:hover {
		background: var(--surface);
	}

	.result-table td {
		padding: 0.75rem 0.85rem;
		border: 0;
		border-bottom: 1px solid var(--line);
		text-align: left;
	}

	.result-table td:last-child {
		border-bottom: 0;
	}

	.cellSearch,
	.cellFind {
		grid-column: 1 / -1;
	}

	.cellCat {
		grid-column: 1;
	}

	.cellRef {
		grid-column: 2;
	}

	.cellId {
		grid-column: 3;
	}

	.cellCat,
	.cellRef,
	.cellId {
		border-bottom: 0;
	}

	.result-table td::before {
		content: attr(data-label);
		display: block;
		margin-bottom: 0.25rem;
		color: var(--muted);
		font-family: var(--sans);
		font-size: 0.68rem;
		font-weight: 750;
		letter-spacing: 0.06em;
		text-transform: uppercase;
	}

	.cellSearch,
	.cellFind {
		font-size: 1.12rem;
	}

	.cellCat,
	.cellRef,
	.cellId {
		display: block;
		font-size: 0.85rem;
	}

	.illustration-panel__heading {
		align-items: flex-start;
		flex-direction: column;
		gap: 0.3rem;
	}

	#caption {
		text-align: left;
	}

	#imageBox {
		min-height: 240px;
		height: clamp(260px, 88vw, 520px);
	}
}

@media (max-width: 410px) {
	.language-field label {
		font-size: 0.68rem;
	}

	.switch-button {
		width: 2.5rem;
	}

	input,
	select,
	.switch-button,
	.search-button {
		height: 2.6rem;
	}
}

@media print {
	body {
		background: white;
	}

	.site-header,
	.search-panel,
	.results-toolbar,
	.illustration-panel,
	.modal-backdrop {
		display: none !important;
	}

	.app-shell {
		width: 100%;
		padding: 0;
	}

	.workspace {
		display: block;
		margin: 0;
	}

	.results-panel {
		border: 0;
		box-shadow: none;
	}

	.result-table tr,
	.result-table td,
	.result-table th {
		page-break-inside: avoid;
	}
}
