:root {
	--paper: #f4f1ea;
	--paper-raised: #fdfbf6;
	--ink: #1b2531;
	--ink-soft: #525c69;
	--ink-faint: #8d94a0;
	--navy: #1a3e63;
	--navy-deep: #11293f;
	--navy-tint: #eaf0f5;
	--line: #e6e0d4;
	--line-strong: #d6cdbd;
	--brass: #a06a2e;
	--brass-ink: #7a4f1e;
	--brass-soft: #f0e4cd;
	--flag-ink: #9a3b28;
	--flag-soft: #f4ddd3;
}

* {
	margin: 0;
	padding: 0;
	box-sizing: border-box;
}

html,
body {
	font-family: "IBM Plex Sans", "Helvetica Neue", Helvetica, Arial, sans-serif;
	background: var(--paper);
	height: 100dvh;
	scroll-behavior: smooth;
}

mark.hl { background: var(--brass-soft); color: var(--brass-ink); border-radius: 2px; padding: 0 1.5px; }
.mono { font-family: "IBM Plex Mono", monospace; font-variant-numeric: tabular-nums; }
.born-unknown { font-style: italic; color: var(--ink-faint); }

/* Tabs - kept for .active nested rule on .tab-n */
.sr-tab { font-size: 14px; font-weight: 500; color: var(--ink-soft); background: none; border: none; padding: 10px 2px; margin-right: 26px; cursor: pointer; border-bottom: 2px solid transparent; display: flex; align-items: center; gap: 8px; }
.sr-tab.active { color: var(--navy); border-bottom-color: var(--navy); font-weight: 600; }
.tab-n { font-family: "IBM Plex Mono", monospace; font-size: 11px; color: var(--ink-faint); background: var(--paper); border: 1px solid var(--line); border-radius: 20px; padding: 1px 7px; }
.sr-tab.active .tab-n { color: var(--navy); border-color: var(--line-strong); }

/* View toggle */
.vt { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; font-weight: 500; color: var(--ink-soft); background: none; border: none; padding: 6px 13px; border-radius: 6px; cursor: pointer; }
.vt:hover { color: var(--ink); }
.vt.active { background: var(--paper-raised); color: var(--navy); box-shadow: 0 1px 2px rgba(20,40,60,.12); font-weight: 600; }

/* List rows - kept for hover/focus descendant rule and first/last-child */
.a-row { display: grid; grid-template-columns: 24px 1fr auto auto 14px; align-items: center; gap: 18px; padding: 12px 14px 12px 10px; border-bottom: 1px solid var(--line); border-left: 2px solid transparent; cursor: pointer; outline: none; }
.a-row:first-child { border-top: none; }
.a-row:last-child { border-bottom: none; }
.a-row:hover, .a-row:focus { background: var(--paper-raised); border-left-color: var(--brass); }
.a-row:hover .a-chev, .a-row:focus .a-chev { color: var(--brass); }
.skel-row { cursor: default; pointer-events: none; }
.skel-row:hover { background: none; border-left-color: transparent; }
.a-chev { grid-column: 4 / -1; justify-self: end; }

@media (max-width: 639px) {
    .sr-tab { margin-right: 0; }
    .a-row:not(.skel-row) { grid-template-columns: 24px 1fr auto; align-items: start; gap: 10px; }
    .a-row:not(.skel-row) > :first-child { align-self: center; grid-row: 1; }
    .a-date { grid-column: 2; grid-row: 2; justify-self: start; text-align: left; min-width: 0; }
    .a-row:not(.skel-row) .a-chev { grid-column: 3; grid-row: 1 / 3; align-self: center; }
}

/* Card */
.b-card { display: block; text-decoration: none; background: var(--paper-raised); border: 1px solid var(--line); border-top: 3px solid var(--line-strong); border-radius: 4px; padding: 17px 18px 16px; transition: transform .14s ease, box-shadow .14s ease, border-color .14s ease; }
.b-card:hover { border-top-color: var(--brass); box-shadow: 0 8px 22px rgba(20,40,60,.09); transform: translateY(-2px); }
.skel-card { pointer-events: none; }

/* Pagination - kept for :not() and .cur/.gap variants */
.a-pg { min-width: 34px; height: 34px; padding: 0 10px; display: inline-flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 500; color: var(--ink-soft); background: none; border: 1px solid transparent; border-radius: 7px; cursor: pointer; font-family: "IBM Plex Mono", monospace; }
.a-pg.arrow { font-family: "IBM Plex Sans", sans-serif; }
.a-pg:hover:not(:disabled):not(.gap) { background: var(--paper-raised); border-color: var(--line); color: var(--ink); }
.a-pg.cur { background: var(--navy); border-color: var(--navy); color: #fff; }
.a-pg:disabled { color: var(--ink-faint); opacity: .5; cursor: default; }
.a-pg.gap { cursor: default; min-width: 16px; padding: 0 2px; color: var(--ink-faint); }


/* Skeleton shimmer */
@keyframes sk-shimmer { 0% { background-position: -280px 0; } 100% { background-position: 560px 0; } }
.skel { background-color: #e7e1d3; background-image: linear-gradient(90deg, rgba(255,255,255,0) 0, rgba(255,255,255,.7) 50%, rgba(255,255,255,0) 100%); background-size: 280px 100%; background-repeat: no-repeat; animation: sk-shimmer 1.25s infinite; border-radius: 4px; display: inline-block; }
.sk-glyph { width: 16px; height: 16px; border-radius: 50%; }
.sk-name { height: 14px; }
.sk-born { width: 72px; height: 12px; justify-self: end; }
.sk-ref { width: 96px; height: 11px; justify-self: end; }
.sk-tag { width: 58px; height: 17px; border-radius: 3px; }
.sk-cref { width: 52px; height: 11px; }
.sk-cname { height: 20px; margin-top: 2px; }
.sk-blabel { width: 38px; height: 10px; }
.sk-byear { width: 46px; height: 20px; }
.sk-avatar { width: 48px; height: 48px; border-radius: 50%; }
.sk-idname { height: 22px; width: 230px; }
.sk-chip { height: 21px; width: 84px; border-radius: 20px; }
.sk-tab { height: 15px; width: 76px; border-radius: 4px; }
.sk-rowtitle { height: 15px; width: 150px; }
.sk-rowline { height: 11px; width: 85%; }

/* Record pages (person / company) - identity card, record cards, fact grid, tooltip popover */
.id-card { background: var(--paper-raised); border: 1px solid var(--line); border-top: 3px solid var(--brass); border-radius: 6px; padding: 20px 22px; display: flex; align-items: flex-start; gap: 16px; margin-bottom: 20px; }
.id-avatar { width: 48px; height: 48px; border-radius: 50%; background: var(--navy-tint); color: var(--navy); display: flex; align-items: center; justify-content: center; font-size: 18px; flex: none; }
.id-eyebrow { font-family: "IBM Plex Mono", monospace; font-size: 10px; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-faint); font-weight: 600; }
.id-name { font-family: "Spectral", Georgia, serif; font-size: 24px; font-weight: 600; color: var(--ink); margin: 5px 0 11px; line-height: 1.15; }
.id-meta { display: flex; gap: 8px; flex-wrap: wrap; }
.meta-chip { font-size: 11.5px; color: var(--ink-soft); background: var(--paper); border: 1px solid var(--line); border-radius: 20px; padding: 4px 10px; display: inline-flex; align-items: center; gap: 5px; }
.meta-chip b { color: var(--ink); font-family: "IBM Plex Mono", monospace; font-weight: 600; }
@media (max-width: 639px) {
    .id-card { flex-direction: column; }
}

.comment-note { margin: 0 0 20px; padding: 11px 13px; border-left: 3px solid var(--brass-soft); background: var(--paper-raised); border-radius: 0 6px 6px 0; font-size: 13px; color: var(--ink-soft); font-style: italic; line-height: 1.5; }
.comment-note .fact-label { font-style: normal; }

.rec-card { background: var(--paper-raised); border: 1px solid var(--line); border-top: 3px solid var(--line-strong); border-radius: 6px; padding: 15px 17px; }
.rec-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.rec-title { font-family: "Spectral", Georgia, serif; font-size: 16.5px; font-weight: 600; color: var(--ink); }
.rec-year { font-family: "IBM Plex Mono", monospace; font-size: 10.5px; color: var(--ink-faint); background: var(--paper); border: 1px solid var(--line); padding: 2px 8px; border-radius: 20px; white-space: nowrap; }
.rec-line { font-size: 13px; color: var(--ink-soft); display: flex; align-items: center; gap: 6px; margin-top: 4px; flex-wrap: wrap; }
.rec-line b { color: var(--ink); font-weight: 500; }
.rec-sub { border-radius: 5px; background: var(--paper); border: 1px solid var(--line); padding: 10px 12px; margin-top: 10px; }
.chip-warn { font-size: 10.5px; font-weight: 700; letter-spacing: .03em; color: var(--flag-ink); background: var(--flag-soft); border-radius: 4px; padding: 2px 8px; display: inline-block; margin-bottom: 8px; }

.fact-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); border: 1px solid var(--line); border-top: 3px solid var(--line-strong); border-radius: 6px; overflow: hidden; background: var(--paper-raised); }
.fact-grid.flush { border: none; border-radius: 0; margin-top: 12px; }
.fact { padding: 10px 14px; border-bottom: 1px solid var(--line); border-right: 1px solid var(--line); }
.fact-label { font-size: 9.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-faint); font-weight: 600; margin-bottom: 3px; }
.fact-value { font-size: 13px; color: var(--ink); font-weight: 500; }

.empty-note { display: flex; align-items: center; justify-content: center; text-align: center; font-size: 13px; color: var(--ink-faint); font-style: italic; padding: 34px 16px; border: 1px dashed var(--line-strong); border-radius: 6px; background: var(--paper-raised); }

.info { position: relative; display: inline-flex; vertical-align: middle; }
.info .ic { width: 15px; height: 15px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; color: var(--ink-faint); cursor: help; background: none; border: none; padding: 0; font-size: 12px; line-height: 1; }
.info .ic:hover, .info .ic:focus-visible { color: var(--brass); outline: none; }
.info .bubble { position: absolute; bottom: calc(100% + 9px); left: 50%; transform: translateX(-50%) translateY(4px); background: var(--navy-deep); color: #fdfbf6; font-size: 11.5px; line-height: 1.45; padding: 9px 11px; border-radius: 6px; width: 200px; box-shadow: 0 12px 26px rgba(17,41,63,.3); opacity: 0; pointer-events: none; transition: opacity .12s ease, transform .12s ease; z-index: 6; }
.info .bubble::after { content: ""; position: absolute; top: 100%; left: 50%; transform: translateX(-50%); border: 5px solid transparent; border-top-color: var(--navy-deep); }
.info .ic:hover + .bubble, .info .ic:focus-visible + .bubble { opacity: 1; transform: translateX(-50%) translateY(0); pointer-events: auto; }
@media (prefers-reduced-motion: reduce) {
    .info .bubble { transition: none; }
}

.share-option { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 6px; color: var(--ink); text-decoration: none; font-size: 14px; font-weight: 500; border: 1px solid transparent; background: none; cursor: pointer; text-align: left; }
.share-option:hover { background: var(--paper-raised); border-color: var(--line); }
.share-option i { width: 18px; text-align: center; color: var(--ink-soft); }

dialog.modal-dialog { margin: auto; max-width: 560px; width: calc(100% - 2rem); max-height: calc(100dvh - 2rem); padding: 0; border: 1px solid var(--line); border-radius: 8px; background: var(--paper-raised); box-shadow: 0 20px 50px rgba(17,41,63,.18); }
dialog.modal-dialog::backdrop { background: rgba(17,41,63,.45); }
dialog.modal-dialog[open] { display: flex; flex-direction: column; animation: modal-in .18s ease-out; }
@keyframes modal-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }

@media (max-width: 639px) {
    dialog.modal-dialog { margin: 0; width: 100%; height: 100dvh; max-width: 100%; max-height: 100dvh; border: none; border-radius: 0; }
}

#attribution a { text-decoration: underline; }

input[type="search"]::-webkit-search-cancel-button {
	-webkit-appearance: none;
	appearance: none;
}

[data-search-submit] .search-spinner { display: none; }
[data-search-submit].is-loading .search-icon { display: none; }
[data-search-submit].is-loading .search-spinner { display: inline-flex; }
@keyframes search-spin { to { transform: rotate(360deg); } }
.search-spinner svg { animation: search-spin .7s linear infinite; }

#nav-loading-bar {
	position: fixed;
	top: 0;
	left: 0;
	height: 3px;
	width: 0;
	z-index: 100;
	background: linear-gradient(90deg, var(--navy), var(--brass));
	opacity: 0;
	transition: width 3s cubic-bezier(.1,.6,.2,1), opacity .2s ease;
}
#nav-loading-bar.is-loading {
	width: 85%;
	opacity: 1;
}
#nav-loading-bar.is-done {
	width: 100%;
	opacity: 0;
	transition: width .2s ease, opacity .3s ease .1s;
}

#hero {
	background-image: url("/img/hero.jpg");
	background-position: center;
	background-repeat: no-repeat;
	background-size: cover;
}

#hero.hero-about { background-image: url("/img/hero-about.jpg"); }
#hero.hero-developers { background-image: url("/img/hero-developers.jpg"); }

p a { text-decoration: underline; }
#footer-links a { text-decoration: underline; }

.tabControl button.active { border-bottom: 1px solid #000; }
.tabControl button.inactive { border: 1px solid #ccc; }

/* ── Printing ─────────────────────────────────────────────────────────────
   Printable pages render a hidden print document alongside their on-screen
   markup, so the browser's own print shortcut produces the same A4 output as
   the button in the share dialog. */

.print-doc { display: none; }

/* Tailwind's stylesheet is loaded after this one, so the layout utilities it
   applies to the app shell have to be overridden with !important here. */
@media print {
	@page { size: A4 portrait; margin: 16mm 14mm; }

	html, body { height: auto !important; background: #fff !important; color: #000 !important; font-size: 10pt; }
	.page { display: block !important; height: auto !important; min-height: 0 !important; }
	main { display: block !important; flex: none !important; }

	/* Site chrome and the on-screen view of a printable page are left out */
	#desktop-nav, #mobile-nav, footer, dialog, .print-hide { display: none !important; }

	.print-doc { display: block !important; }
	.print-doc a[href] { color: #000; text-decoration: none; }
}

/* Print document layout. Sized in points because the output is paper. */
.print-doc { font-family: "IBM Plex Sans", Helvetica, Arial, sans-serif; color: #000; line-height: 1.45; }
.pd-head { border-bottom: 2px solid #000; padding-bottom: 8pt; }
.pd-brand { font-size: 8pt; letter-spacing: 0.16em; text-transform: uppercase; }
.pd-title { font-family: "Spectral", Georgia, serif; font-size: 19pt; font-weight: 600; margin: 4pt 0 2pt; }
.pd-sub { font-size: 10pt; }
.pd-meta { font-size: 8pt; color: #444; margin-top: 5pt; display: flex; justify-content: space-between; gap: 12pt; }
.pd-meta span { word-break: break-all; }

.pd-section { margin-top: 13pt; }
.pd-section-title { font-size: 10.5pt; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; border-bottom: 1px solid #000; padding-bottom: 3pt; margin-bottom: 6pt; break-after: avoid; page-break-after: avoid; }
.pd-sub-title { font-size: 10.5pt; font-weight: 600; margin: 8pt 0 4pt; break-after: avoid; page-break-after: avoid; }

.pd-table { width: 100%; border-collapse: collapse; font-size: 9pt; margin-bottom: 6pt; }
.pd-table th, .pd-table td { border: 1px solid #999; padding: 3pt 5pt; text-align: left; vertical-align: top; }
.pd-table thead th, .pd-table tbody th { font-weight: 600; background: #eee; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.pd-table tbody th { width: 34%; }
.pd-table tr { break-inside: avoid; page-break-inside: avoid; }

.pd-entry { break-inside: avoid; page-break-inside: avoid; padding: 6pt 0; border-bottom: 1px solid #ccc; }
.pd-entry:last-child { border-bottom: none; }
.pd-entry-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12pt; }
.pd-entry-name { font-family: "Spectral", Georgia, serif; font-size: 12pt; font-weight: 600; }
.pd-entry-ref { font-family: "IBM Plex Mono", monospace; font-size: 8pt; white-space: nowrap; }
.pd-line { font-size: 9pt; margin-top: 2pt; }
.pd-label { font-weight: 600; }
.pd-list { list-style: none; }
.pd-empty { font-size: 9pt; font-style: italic; color: #444; }
.pd-foot { margin-top: 14pt; padding-top: 5pt; border-top: 1px solid #999; font-size: 8pt; color: #444; }
