/*
Theme Name: Recognition Guide
Description: Encyclopedia theme for the Recognition Guide — vessels, classes, faceted browse.
Version: 0.3.0
Requires at least: 6.4
Requires PHP: 7.4
Text Domain: recognition
*/

/*
 * A fighting-ships annual: near-white stock, hairline rules, a single red rule
 * under the running head, photographs presented as numbered plates.
 *
 * The vessel page opens as a two-page spread — plate and headline figures on the
 * verso, particulars on the recto — and everything that will not fit continues
 * below in ordinary single-column flow. A DANFS history can run to twenty
 * paragraphs; the format has to survive that rather than truncate it.
 *
 * Type is serif throughout, with a system sans in tracked capitals for labels,
 * running heads and table headings. No webfonts, so Leaflet stays the theme's
 * only third-party dependency.
 */

/*
 * A book page: almost white, black text. The warmth is a whisper — enough that
 * the stock is not screen-white and the greys never read cold against it — not
 * a cream or a buff. Age shows in the texture, not in the colour.
 */
:root {
	color-scheme: light;

	--paper: #faf9f5;
	--paper-deep: #f0eee6;
	--panel: #fefdfb;
	--ink: #141310;
	--ink-soft: #464036;
	/* Measured, not picked by eye: 6.5:1 on paper, 5.9:1 on the deep ground.
	   It carries the unit conversions — "(376 ft)" — which are text a reader
	   needs, so it has to clear 4.5:1 on every stock it lands on. */
	--ink-faint: #5f5a4d;
	--rule: #e3ded1;
	--rule-strong: #b8b1a0;
	--accent: #8c2f22;
	--accent-soft: #f4efe1;
	--measure: 68rem;
	--radius: 0;

	--chrome: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
	--body: "Iowan Old Style", "Charter", Georgia, "Times New Roman", serif;
	--data: "Consolas", "SF Mono", "DejaVu Sans Mono", monospace;

	/* Two textures, because paper has two scales. Fine turbulence is the fibre;
	   coarse turbulence is the uneven ageing across a leaf. Both are inline SVG
	   filters, so the look costs no request and no image. */
	--grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
	--foxing: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='420' height='420'%3E%3Cfilter id='f'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.012' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23f)'/%3E%3C/svg%3E");
}

/*
 * There is no dark theme, and that is a decision rather than an omission. This
 * site is a printed page: paper is white and ink is black, and a night edition
 * of it would be a different object. `color-scheme: light` above is what makes
 * the browser agree — without it the scrollbars, form controls and text fields
 * a reader on a dark system gets are still dark, and they show up against the
 * stock as the one part of the page that did not get the memo.
 */

*, *::before, *::after { box-sizing: border-box; }

body {
	margin: 0;
	background: var(--paper);
	color: var(--ink);
	font: 16px/1.6 var(--body);
	-webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { text-decoration-thickness: 2px; }

.wrap { width: min(100% - 2.5rem, var(--measure)); margin-inline: auto; }

.sr {
	position: absolute; width: 1px; height: 1px;
	padding: 0; margin: -1px; overflow: hidden;
	clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* --- masthead ---------------------------------------------------------- */

.site-head {
	background: var(--panel);
	border-bottom: 2px solid var(--accent);
	/* Half again the height it was. The anchor is inline-flex, so a line-box
	   descender rides under it; the padding is set against the measured result
	   rather than against arithmetic that ignores it. */
	padding: 1.9rem 0 1.8rem;
	margin-bottom: 1.4rem;
}
.brand {
	display: inline-flex;
	align-items: center;
	gap: 0.95rem;
	text-decoration: none;
	color: inherit;
}
.brand-text { display: flex; flex-direction: column; }
/* The mark carries the red so the wordmark beside it can stay ink. */
.brand .mark { color: var(--accent); display: block; }
.brand .logo { display: block; width: 3rem; height: 3rem; }
@media (max-width: 34rem) {
	.brand .logo { width: 2.4rem; height: 2.4rem; }
}
.brand-name {
	font-family: var(--body);
	font-weight: 600;
	font-size: clamp(1.35rem, 3vw, 1.75rem);
	letter-spacing: -0.005em;
	line-height: 1.05;
}
.brand-sub {
	font-family: var(--chrome);
	font-size: 0.72rem;
	letter-spacing: 0.2em;
	text-transform: uppercase;
	color: var(--ink-faint);
	margin-top: 0.3rem;
}

.site-foot {
	margin-top: 4rem;
	padding: 1.5rem 0 3rem;
	border-top: 1px solid var(--rule-strong);
	color: var(--ink-faint);
	font-size: 0.85rem;
}
.site-foot .small { font-size: 0.78rem; }

/* --- the spread -------------------------------------------------------- */

/*
 * min-height, never a fixed height, and nothing is clipped. The shape is close
 * to a real spread on a typical vessel and grows where a ship has more dates or
 * a longer builder's name — because hiding a fact to preserve a proportion is
 * not a trade this site makes.
 */
.spread {
	display: grid;
	grid-template-columns: 1fr 1fr;
	min-height: min(62vh, 38rem);
	position: relative;
	isolation: isolate;
	margin-bottom: 2rem;
	border: 1px solid var(--rule-strong);
	box-shadow: 0 12px 26px -18px rgba(0,0,0,0.34);
}

/* Gutter: paired inner shadows meeting at the spine. */
.spread::after {
	content: "";
	position: absolute;
	inset: 0;
	pointer-events: none;
	z-index: 3;
	background:
		linear-gradient(90deg, rgba(0,0,0,0) 46%, rgba(0,0,0,0.13) 49.6%, rgba(0,0,0,0.20) 50%, rgba(0,0,0,0.13) 50.4%, rgba(0,0,0,0) 54%);
}

/* The trim, as a variable: anything that needs to bleed to the edge of a leaf
   reads it from here rather than restating the number. Declared once — this
   file carried a second .page padding rule 640 lines further down that silently
   won, which is why a hand-off bled to -1.8rem overshot the page by 3px. */
.page {
	--leaf-pad-x: 1.6rem;
	--leaf-pad-y: 1.4rem;
	position: relative;
	z-index: 1;
	padding: var(--leaf-pad-y) var(--leaf-pad-x) var(--leaf-pad-x);
	background: var(--panel);
	display: flex;
	flex-direction: column;
}
.page.verso { background: var(--paper); }

/*
 * Texture lives on the pages only — never behind the running prose below, where
 * it would sit under long-form reading and tire the eye.
 *
 * ::before is the fibre and ::after the ageing. They are kept apart because they
 * want different blend modes: the fibre multiplies into the stock, while the
 * foxing needs a soft-light pass so it lightens and darkens across the leaf the
 * way real discolouration does, rather than only ever dirtying it.
 */
.page::before,
.page::after {
	content: "";
	position: absolute;
	inset: 0;
	z-index: -1;
	pointer-events: none;
}
.page::before {
	background-image: var(--grain);
	opacity: 0.05;
	mix-blend-mode: multiply;
}
.page::after {
	background-image: var(--foxing);
	background-size: 420px 420px;
	opacity: 0.16;
	mix-blend-mode: soft-light;
}

.runhead {
	display: flex;
	justify-content: space-between;
	align-items: baseline;
	gap: 1rem;
	font-family: var(--chrome);
	font-size: 0.66rem;
	letter-spacing: 0.18em;
	text-transform: uppercase;
	color: var(--ink-faint);
	padding-bottom: 0.5rem;
	margin-bottom: 1.1rem;
	border-bottom: 2px solid var(--accent);
}

@media (max-width: 46rem) {
	.spread { grid-template-columns: 1fr; min-height: 0; }
	.spread::after { display: none; }
	.page.recto { border-top: 1px solid var(--rule-strong); }
}

/* --- vessel and class heads -------------------------------------------- */

.vessel-head { margin-bottom: 1.1rem; }
.eyebrow {
	margin: 0 0 0.35rem;
	font-family: var(--chrome);
	font-size: 0.72rem;
	letter-spacing: 0.18em;
	text-transform: uppercase;
	color: var(--accent);
}
.vessel-head h1 {
	margin: 0;
	font-family: var(--body);
	font-weight: 600;
	font-size: clamp(1.7rem, 3.6vw, 2.4rem);
	line-height: 1.06;
	letter-spacing: -0.012em;
	text-wrap: balance;
}
.lede { margin: 0.35rem 0 0; color: var(--ink-soft); font-size: 1.02rem; }

/* --- plates ------------------------------------------------------------ */

.hero {
	margin: 0 0 1rem;
	background: transparent;
	border: 0;
	padding: 0;
}
.hero img {
	display: block;
	width: 100%;
	height: auto;
	border: 1px solid var(--rule-strong);
}

/* Inside a spread the plate is capped, so the whole spread lands near the fold
   on a 16:9 window instead of the photograph alone filling half of it. Cropped
   about the waterline rather than the centre, which is where the ship is. */
.page .hero img {
	max-height: 15rem;
	object-fit: cover;
	object-position: center 45%;
}
.hero figcaption {
	padding: 0.5rem 0 0;
	font-size: 0.8rem;
	color: var(--ink-soft);
	display: grid;
	gap: 0.25rem;
}
.hero .plate {
	font-family: var(--chrome);
	letter-spacing: 0.18em;
	text-transform: uppercase;
	font-size: 0.68rem;
	color: var(--accent);
}
/* First in the caption block, immediately beneath the photograph. A little extra
   air below it so the attribution reads as belonging to the image rather than
   as the opening line of the plate label and description under it. */
.hero .credit {
	color: var(--ink-faint);
	font-size: 0.74rem;
	margin-bottom: 0.3rem;
}

/*
 * Specifications continuing the particulars on the same leaf.
 *
 * Deliberately not a .panel: it is not a separate section of the page, it is
 * the same list of facts carrying on after a rule, which is how a data page in
 * an annual reads. The heading is set at runhead weight so it divides without
 * announcing itself.
 *
 * Scoped under .page. The one-word class that painted the hand-off label
 * invisible was unscoped, and this file already has several more like it.
 */
.page .leaf-specs {
	margin-top: 1.1rem;
	padding-top: 0.8rem;
	border-top: 1px solid var(--rule-strong);
}
/* Service follows the plate directly. It was pinned to the foot to give the leaf
   a base, but that opened a 163px hole in the middle of the page — and a gap
   below the last line reads as a page, where a gap inside it reads as a fault. */
.page .leaf-specs h2 {
	margin: 0 0 0.5rem;
	font-family: var(--chrome);
	font-size: 0.66rem;
	font-weight: 600;
	letter-spacing: 0.18em;
	text-transform: uppercase;
	color: var(--ink-faint);
	border: 0;
	padding: 0;
}

/* Headline figures, verso foot — the annual's two-column data block. */
.headline-figs {
	margin: auto 0 0;
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 0 1.4rem;
	padding-top: 1rem;
}
.headline-figs > div {
	display: grid;
	grid-template-columns: 1fr auto;
	gap: 0.5rem;
	align-items: baseline;
	padding: 0.22rem 0;
	border-bottom: 1px dotted var(--rule);
}
.headline-figs dt {
	font-family: var(--chrome);
	font-size: 0.66rem;
	letter-spacing: 0.1em;
	text-transform: uppercase;
	color: var(--ink-faint);
}
.headline-figs dd { margin: 0; font-size: 0.86rem; font-variant-numeric: tabular-nums; }

@media (max-width: 30rem) {
	.headline-figs { grid-template-columns: 1fr; }
}

/* --- running text ------------------------------------------------------- */

.prose { max-width: 38rem; font-size: 1.05rem; line-height: 1.65; }
.prose p { margin: 0 0 0.95rem; }
.prose.danfs { border-left: 2px solid var(--rule); padding-left: 1.2rem; }
.prose .provenance {
	font-size: 0.78rem;
	color: var(--ink-faint);
	font-family: var(--chrome);
	letter-spacing: 0.04em;
	border-top: 1px solid var(--rule);
	padding-top: 0.6rem;
	margin-top: 1.2rem;
}

/*
 * The hand-off, at the foot of the particulars.
 *
 * margin-top: auto is the whole trick — the recto is a flex column, so this
 * drops to the bottom of the leaf and takes up the slack that a short list of
 * particulars leaves behind, instead of the page ending in blank stock.
 *
 * Set as a cross-reference rather than as a control: a rule, the destination in
 * tracked capitals, the extent beneath it. The filled red button this replaced
 * was the only such object on the site and read as though it had been pasted in
 * from a different kind of page.
 */
/*
 * A band across the foot of the leaf, bled to both edges — the device a printed
 * page uses to make something unmissable without shouting. The negative margins
 * cancel .page's padding so it meets the trim on three sides; the accent rule
 * on top is the same signature the running heads carry, and the tint is the
 * one already in the palette, so it gains weight without a new colour.
 *
 * Still not a button. The filled red block this replaced was the only control
 * of its kind on the site and read as though it had come from another page.
 */
.handoff {
	margin: auto calc(-1 * var(--leaf-pad-x)) calc(-1 * var(--leaf-pad-x));
	padding: 0.9rem var(--leaf-pad-x) 1rem;
	background: var(--accent-soft);
	border-top: 2px solid var(--accent);
	display: grid;
	gap: 0.25rem;
	text-decoration: none;
	color: inherit;
}
.handoff:hover { background: var(--paper-deep); }
/* .dest, not .go — `.go` is the browse search button, declared unscoped further
   down as a filled accent block. Reusing the name painted this label in accent
   on accent: a solid red bar with the words invisible inside it. */
.handoff .dest {
	font-family: var(--chrome);
	font-size: 0.95rem;
	font-weight: 600;
	letter-spacing: 0.12em;
	text-transform: uppercase;
	color: var(--accent);
	display: flex;
	align-items: baseline;
	justify-content: space-between;
	gap: 1rem;
}
.handoff .arrow { font-size: 1.2em; }
/* The arrow travels on hover, which is the only movement on the page and reads
   as turning to the reference rather than as decoration. */
.handoff .arrow { transition: transform 0.14s ease-out; }
@media (prefers-reduced-motion: reduce) {
	.handoff .arrow { transition: none; }
}
.handoff:hover .arrow { transform: translateX(0.25rem); }
.handoff:hover .dest { text-decoration: underline; text-underline-offset: 3px; }
.handoff:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.handoff .extent {
	font-family: var(--chrome);
	font-size: 0.74rem;
	color: var(--ink-faint);
	letter-spacing: 0.03em;
}

/*
 * The continuation under the truncated excerpt, set to match the band on the
 * leaf. It is the same offer in the same words, and a reader who has just read
 * three paragraphs and wants the rest should not have to find a quieter link
 * than the one they already passed.
 *
 * Not bled, because .prose is a text column rather than a leaf; the rule and
 * the tint carry it instead.
 */
.prose .continues { margin: 1.4rem 0 0; }
.prose .continues a {
	display: grid;
	gap: 0.25rem;
	padding: 0.9rem 1.1rem 1rem;
	background: var(--accent-soft);
	border-top: 2px solid var(--accent);
	text-decoration: none;
	color: inherit;
}
.prose .continues a:hover { background: var(--paper-deep); }
.prose .continues .dest {
	font-family: var(--chrome);
	font-size: 0.95rem;
	font-weight: 600;
	letter-spacing: 0.12em;
	text-transform: uppercase;
	color: var(--accent);
	display: flex;
	align-items: baseline;
	justify-content: space-between;
	gap: 1rem;
}
.prose .continues .arrow {
	font-size: 1.2em;
	transition: transform 0.14s ease-out;
}
@media (prefers-reduced-motion: reduce) {
	.prose .continues .arrow { transition: none; }
}
.prose .continues a:hover .arrow { transform: translateX(0.25rem); }
.prose .continues a:hover .dest { text-decoration: underline; text-underline-offset: 3px; }
.prose .continues a:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.prose .continues .extent {
	font-family: var(--chrome);
	font-size: 0.74rem;
	color: var(--ink-faint);
	letter-spacing: 0.03em;
}

/* Whose words these are, stated before the account rather than under it. Set
   quieter than the hatnote — it is a note about the text, not the text. */
.history-head .voice {
	margin: 0.6rem 0 0;
	max-width: 46rem;
	font-size: 0.84rem;
	line-height: 1.5;
	color: var(--ink-faint);
	border-left: 2px solid var(--accent);
	padding-left: 0.8rem;
}
.history-head .voice .who {
	font-family: var(--chrome);
	font-size: 0.7rem;
	letter-spacing: 0.14em;
	text-transform: uppercase;
	color: var(--accent);
	margin-right: 0.35rem;
}

/*
 * --- photographs inside a history --------------------------------------
 *
 * Floated to the right with the text closing round them, except where the
 * photograph is wider than 2:1 — most ship profiles are — in which case it
 * spans the measure, because a 3:1 profile floated into a third of the column
 * is a grey stripe with a funnel in it.
 */
.plate-figure {
	margin: 0.2rem 0 1rem 1.6rem;
	float: right;
	width: min(19rem, 42%);
}
.plate-figure.wide {
	float: none;
	width: auto;
	max-width: 42rem;
	margin: 1.4rem 0;
}
.plate-figure img {
	display: block;
	width: 100%;
	height: auto;
	border: 1px solid var(--rule-strong);
	background: var(--paper-deep);
}
.plate-figure figcaption {
	display: grid;
	gap: 0.2rem;
	padding-top: 0.4rem;
	font-size: 0.78rem;
	line-height: 1.4;
	color: var(--ink-soft);
}
.plate-figure figcaption .credit { color: var(--ink-faint); font-size: 0.72rem; }

/* A section must not end mid-float, or the next year's heading rides up beside
   the previous year's photograph and appears to belong to it. */
.chapter::after,
.month-part::after { content: ""; display: block; clear: both; }

/* Undated photographs, gathered rather than guessed into a year. */
.loose-plates { margin-top: 2.4rem; padding-top: 1.2rem; border-top: 1px solid var(--rule-strong); }
.loose-plates h2 {
	margin: 0 0 0.3rem;
	font-family: var(--chrome);
	font-size: 0.72rem;
	letter-spacing: 0.2em;
	text-transform: uppercase;
	color: var(--ink-faint);
	border: 0;
	padding: 0;
}
.loose-plates .note { margin: 0 0 1rem; max-width: 40rem; }
.loose-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr)); gap: 1.2rem; }
.plate-figure.loose { float: none; width: auto; margin: 0; max-width: none; }

@media (max-width: 46rem) {
	.plate-figure, .plate-figure.wide { float: none; width: auto; margin: 1.2rem 0; }
}

/*
 * --- plates, full screen ------------------------------------------------
 *
 * The one place the site leaves its own paper. A photograph shown against the
 * stock competes with it; against near-black it is the only thing in the room,
 * which is the point of opening it at all.
 */
.rg-zoomable { cursor: zoom-in; }
.rg-zoomable:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

html.rg-lb-open { overflow: hidden; }

.rg-lightbox {
	position: fixed;
	inset: 0;
	z-index: 999;
	background: rgba(14, 13, 11, 0.94);
	display: grid;
	grid-template-rows: 1fr auto;
	place-items: center;
	padding: clamp(1rem, 4vw, 3rem);
}
.rg-lightbox[hidden] { display: none; }

.rg-lb-figure {
	margin: 0;
	display: grid;
	gap: 0.9rem;
	justify-items: center;
	max-width: 100%;
	min-height: 0;
}
.rg-lb-figure img {
	display: block;
	max-width: 100%;
	/* Room for the caption beneath, so a tall photograph is never cut off by
	   the edge of the window on the one screen meant to show all of it. */
	max-height: calc(100vh - 11rem);
	width: auto;
	height: auto;
	object-fit: contain;
	border: 1px solid rgba(250, 249, 245, 0.22);
}
.rg-lb-figure figcaption {
	color: #d9d4c8;
	font-size: 0.88rem;
	line-height: 1.45;
	max-width: 46rem;
	text-align: center;
	display: grid;
	gap: 0.3rem;
}
.rg-lb-figure figcaption a { color: #e8b9ad; }
.rg-lb-figure figcaption .credit { color: #a8a294; font-size: 0.78rem; }

.rg-lightbox button {
	position: absolute;
	background: transparent;
	border: 1px solid rgba(250, 249, 245, 0.3);
	color: #faf9f5;
	font-family: var(--chrome);
	cursor: pointer;
	line-height: 1;
	transition: background 0.14s, border-color 0.14s;
}
.rg-lightbox button:hover { background: rgba(250, 249, 245, 0.14); border-color: rgba(250, 249, 245, 0.6); }
.rg-lightbox button:focus-visible { outline: 2px solid #e8b9ad; outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) {
	.rg-lightbox button { transition: none; }
}

.rg-lb-close { top: 1rem; right: 1rem; width: 2.6rem; height: 2.6rem; font-size: 1.5rem; }
.rg-lb-nav { top: 50%; transform: translateY(-50%); width: 2.8rem; height: 3.4rem; font-size: 1.1rem; }
.rg-lb-prev { left: 1rem; }
.rg-lb-next { right: 1rem; }
.rg-lb-nav[hidden], .rg-lb-close[hidden] { display: none; }

.rg-lb-count {
	margin: 0;
	color: #a8a294;
	font-family: var(--chrome);
	font-size: 0.68rem;
	letter-spacing: 0.18em;
	text-transform: uppercase;
	font-variant-numeric: tabular-nums;
}
.rg-lb-count[hidden] { display: none; }

@media (max-width: 40rem) {
	.rg-lb-nav { top: auto; bottom: 1rem; transform: none; }
	.rg-lb-figure img { max-height: calc(100vh - 14rem); }
}

/*
 * --- the front page ----------------------------------------------------
 *
 * A catalogue hall: the search first, because most readers arrive knowing which
 * ship they want; the collection stated in figures; three plates as punctuation
 * rather than wallpaper; and an index set as a printed one.
 */
.hall { padding-bottom: 1rem; }
.hall-head { max-width: 46rem; margin: 1.5rem auto 2rem; text-align: center; }
.hall-head .eyebrow { justify-content: center; }
.hall-head h1 {
	margin: 0.4rem 0 0.6rem;
	font-size: clamp(2rem, 5.5vw, 3.4rem);
	line-height: 1.02;
	letter-spacing: -0.02em;
	text-wrap: balance;
}
.hall-head .lede { margin: 0 auto; max-width: 36rem; color: var(--ink-soft); }

.hall-search { display: flex; margin: 1.5rem auto 0; max-width: 40rem; border: 1px solid var(--ink); background: var(--panel); }
.hall-search input {
	flex: 1; min-width: 0; border: 0; background: transparent;
	padding: 0.85rem 1rem; font: inherit; color: var(--ink);
}
.hall-search input:focus { outline: 2px solid var(--accent); outline-offset: -2px; }
.hall-search button {
	border: 0; background: var(--accent); color: var(--panel); cursor: pointer;
	padding: 0.85rem 1.4rem; font-family: var(--chrome); font-size: 0.74rem;
	font-weight: 600; letter-spacing: 0.16em; text-transform: uppercase;
}
.hall-search button:hover { filter: brightness(1.12); }

.hall-figures {
	list-style: none; margin: 2.2rem 0; padding: 0;
	display: grid; grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr)); gap: 1rem;
	text-align: center;
}
.hall-figures li { border-top: 2px solid var(--accent); padding-top: 0.55rem; }
.hall-figures b { display: block; font-size: clamp(1.6rem, 3.4vw, 2.3rem); line-height: 1; font-variant-numeric: tabular-nums; }
.hall-figures span { font-family: var(--chrome); font-size: 0.62rem; letter-spacing: 0.16em; text-transform: uppercase; color: var(--ink-faint); }

.hall-plates { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; margin: 2rem 0; }
.hall-plates figure { margin: 0; }
.hall-plates img {
	display: block; width: 100%; aspect-ratio: 16 / 9;
	object-fit: cover; object-position: center 45%;
	border: 1px solid var(--rule-strong);
}
.hall-plates figcaption {
	font-family: var(--chrome); font-size: 0.66rem; letter-spacing: 0.1em;
	padding-top: 0.45rem; display: flex; justify-content: space-between; gap: 0.6rem;
}
.hall-plates figcaption span { color: var(--ink-faint); text-transform: uppercase; font-size: 0.6rem; letter-spacing: 0.14em; }

.hall-index {
	display: grid; grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr)); gap: 2rem;
	border-top: 1px solid var(--rule-strong); padding-top: 1.4rem; margin-top: 2.4rem;
	align-items: start;
}
/* The navy column lists all 24 flags. Set two abreast on a wide screen so a
   complete list does not stand three times the height of the ones beside it —
   the fix for a long column is more columns, not a shorter list. */
.hall-index .wide { grid-column: span 2; }
.hall-index .wide .rows { columns: 2; column-gap: 1.6rem; }
.hall-index .wide .rows a { break-inside: avoid; }
@media (max-width: 60rem) {
	.hall-index .wide { grid-column: auto; }
	.hall-index .wide .rows { columns: 1; }
}
.hall-index h2 {
	margin: 0 0 0.6rem; font-family: var(--chrome); font-size: 0.68rem;
	letter-spacing: 0.2em; text-transform: uppercase; color: var(--accent); border: 0; padding: 0;
}
.hall-index a {
	display: flex; justify-content: space-between; gap: 1rem;
	padding: 0.3rem 0; border-bottom: 1px solid var(--rule);
	text-decoration: none; color: inherit; font-size: 0.94rem;
}
.hall-index a:hover span { text-decoration: underline; }
.hall-index a b {
	font-family: var(--chrome); font-size: 0.74rem; font-weight: 400;
	color: var(--ink-faint); font-variant-numeric: tabular-nums;
}
.hall-note {
	margin: 2.4rem auto 0; max-width: 42rem; text-align: center;
	color: var(--ink-faint); font-size: 0.86rem;
}
@media (max-width: 46rem) {
	.hall-plates { grid-template-columns: 1fr; }
}

/* Losses, as a page of its own. */
.theatres { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(8rem, 1fr)); gap: 1rem; }
.theatres li { border-top: 2px solid var(--accent); padding-top: 0.5rem; }
.theatres b { display: block; font-size: 1.5rem; line-height: 1; font-variant-numeric: tabular-nums; }
.theatres span { font-family: var(--chrome); font-size: 0.62rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink-faint); }
.losses .note.filtered { margin-bottom: 1rem; }

/* --- the service history page ------------------------------------------ */

.history-head {
	margin-bottom: 1.6rem;
	padding-bottom: 0.8rem;
	border-bottom: 2px solid var(--accent);
}
.history-head h1 {
	margin: 0;
	font-family: var(--body);
	font-weight: 600;
	font-size: clamp(1.6rem, 3.4vw, 2.2rem);
	line-height: 1.08;
	letter-spacing: -0.012em;
	text-wrap: balance;
}

/*
 * The history is a spread too: contents on the verso, narrative on the recto,
 * one seam down the middle. It shares .page with the entry above it, so the
 * stock, the grain and the gutter are the same object rather than a second
 * design that happens to sit underneath the first.
 *
 * The left page is short and the right page very long, which is exactly how an
 * open book looks when one side is an index.
 */
.history-body {
	display: grid;
	grid-template-columns: 17rem minmax(0, 1fr);
	position: relative;
	isolation: isolate;
	border: 1px solid var(--rule-strong);
	box-shadow: 0 12px 26px -18px rgba(0,0,0,0.34);
}
.history-body::after {
	content: "";
	position: absolute;
	inset: 0;
	pointer-events: none;
	z-index: 3;
	background: linear-gradient(90deg,
		rgba(0,0,0,0) calc(17rem - 3.5rem), rgba(0,0,0,0.13) calc(17rem - 0.4rem),
		rgba(0,0,0,0.20) 17rem, rgba(0,0,0,0.13) calc(17rem + 0.4rem),
		rgba(0,0,0,0) calc(17rem + 3.5rem));
}
@media (max-width: 56rem) {
	.history-body { grid-template-columns: 1fr; }
	.history-body::after { display: none; }
	.history-main { border-top: 1px solid var(--rule-strong); }
}

/* Open on the page, not a box sitting on it: no border of its own, no panel
   fill — it is the left leaf. */
/*
 * The leaf runs the full height of the spread and the list runs its full
 * length — no inner scroller, and not sticky.
 *
 * Both of those were the same mistake. A scrolling box inside a page that
 * already scrolls gives a reader two scrollbars and no idea which one they are
 * in, and it hid most of the contents of the longest articles — exactly the
 * ones that need contents. Sticky cannot survive dropping it either: pinned at
 * top: 0, any list taller than the window strands its own bottom where nothing
 * can reach it. A book's index does not follow you down the page.
 */
.contents {
	font-family: var(--chrome);
	font-size: 0.85rem;
	background: var(--paper);
	padding: 1.4rem 1.6rem 1.6rem;
}
.contents summary {
	cursor: pointer;
	font-size: 0.72rem;
	letter-spacing: 0.18em;
	text-transform: uppercase;
	color: var(--ink-faint);
	padding-bottom: 0.5rem;
	border-bottom: 2px solid var(--accent);
	margin-bottom: 0.6rem;
	list-style: none;
}
.contents summary::-webkit-details-marker { display: none; }
.contents ol {
	margin: 0;
	padding: 0;
	list-style: none;
	display: grid;
	gap: 0.1rem;
}
.contents li { display: flex; align-items: baseline; gap: 0.5rem; }
.contents a {
	flex: 1;
	text-decoration: none;
	padding: 0.18rem 0;
	display: grid;
	gap: 0.05rem;
}
.contents a:hover .when { text-decoration: underline; }
.contents .when { font-variant-numeric: tabular-nums; }
/* The action, where the passage names one. Set quieter than the date because
   the date is what is always true; the action is what happened to be said. */
.contents .what {
	font-size: 0.76rem;
	line-height: 1.3;
	color: var(--ink-faint);
	font-style: italic;
	font-family: var(--body);
}
.contents a:hover .what { color: var(--accent); }
.contents .n {
	color: var(--ink-faint);
	font-size: 0.75rem;
	font-variant-numeric: tabular-nums;
	font-family: var(--data);
	padding-top: 0.2rem;
}
/* Three levels: period, year, month — indented so the shape of the ship's life
   is legible before a single link is followed. */
.contents li.era { margin-top: 0.7rem; }
.contents li.era:first-child { margin-top: 0; }
.contents li.era a { padding: 0.1rem 0 0.25rem; border-bottom: 1px solid var(--rule); }
.contents li.era .when {
	font-size: 0.78rem;
	letter-spacing: 0.12em;
	text-transform: uppercase;
	font-weight: 600;
	color: var(--ink);
}
.contents li.era .what {
	font-family: var(--data);
	font-style: normal;
	font-size: 0.7rem;
	letter-spacing: 0.04em;
}
.contents li.year a { padding-left: 0.6rem; }
.contents li.month a { padding-left: 1.5rem; }
.contents li.month .when { font-size: 0.95em; color: var(--ink-soft); }
.contents .to-refs { margin-top: 0.5rem; padding-top: 0.5rem; border-top: 1px solid var(--rule); }
.contents .derived {
	margin: 0.9rem 0 0;
	font-size: 0.72rem;
	line-height: 1.45;
	color: var(--ink-faint);
	font-family: var(--body);
}

.history-main { min-width: 0; background: var(--panel); padding: 1.4rem 1.8rem 2rem; }

/* The hatnote sits where a wiki article puts it: under the title, indented and
   italic, saying what this page is and where the rest of it lives. */
.hatnote {
	margin: 0.5rem 0 0 1.4rem;
	font-style: italic;
	font-size: 0.92rem;
	color: var(--ink-soft);
	max-width: 42rem;
}

/* Era band — the only heading carrying a full-width rule, which is what gives a
   long article its spine. */
.era-band { scroll-margin-top: 1.5rem; }
.era-band > h2 {
	margin: 2rem 0 1.1rem;
	padding-bottom: 0.35rem;
	border-bottom: 1px solid var(--rule-strong);
	font-family: var(--body);
	font-weight: 600;
	font-size: 1.5rem;
	letter-spacing: -0.008em;
	line-height: 1.15;
	display: flex;
	flex-wrap: wrap;
	align-items: baseline;
	gap: 0.2rem 0.7rem;
}
.era-band:first-of-type > h2 { margin-top: 0; }
.era-band > h2 .range {
	font-family: var(--chrome);
	font-size: 0.72rem;
	letter-spacing: 0.16em;
	text-transform: uppercase;
	color: var(--ink-faint);
	font-weight: 600;
}

.chapter {
	/* So a jump from the contents leaves the heading clear of the masthead. */
	scroll-margin-top: 1.5rem;
	margin-bottom: 1.8rem;
}
.chapter h3 {
	margin: 0 0 0.7rem;
	font-family: var(--chrome);
	font-size: 0.82rem;
	letter-spacing: 0.2em;
	text-transform: uppercase;
	font-weight: 600;
	color: var(--ink-faint);
	display: flex;
	flex-wrap: wrap;
	align-items: baseline;
	gap: 0.2rem 0.7rem;
}
/* The named action, where the passage names one. Set in the body face and
   unshouted: the date is always true, the action is what happened to be said. */
.chapter h3 .action,
.month-part h4 .action {
	font-family: var(--body);
	font-size: 1.05rem;
	letter-spacing: 0;
	text-transform: none;
	font-style: italic;
	font-weight: 400;
	color: var(--ink);
}
.month-part h4 .action { font-size: 0.98rem; color: var(--ink-soft); }
.chapter p {
	margin: 0 0 0.9rem;
	max-width: 40rem;
	font-size: 1.05rem;
	line-height: 1.68;
}
.month-part { scroll-margin-top: 1.5rem; }
.month-part h4 {
	margin: 1.2rem 0 0.6rem;
	font-family: var(--chrome);
	font-size: 0.74rem;
	letter-spacing: 0.16em;
	text-transform: uppercase;
	font-weight: 600;
	color: var(--accent);
	display: flex;
	flex-wrap: wrap;
	align-items: baseline;
	gap: 0.15rem 0.6rem;
}
.month-part:first-child h3 { margin-top: 0; }

.bibliography { scroll-margin-top: 1.5rem; margin-top: 2.4rem; }
.bibliography h2 {
	margin: 0 0 0.7rem;
	padding-bottom: 0.35rem;
	border-bottom: 1px solid var(--rule-strong);
	font-family: var(--body);
	font-weight: 600;
	font-size: 1.5rem;
	letter-spacing: -0.008em;
}
.bibliography .note { max-width: 40rem; }
.works { margin: 0; padding: 0 0 0 1.4rem; display: grid; gap: 0.7rem; max-width: 44rem; }
.works li { padding-left: 0.2rem; }
.works .kind {
	display: inline-block;
	font-family: var(--chrome);
	font-size: 0.64rem;
	letter-spacing: 0.16em;
	text-transform: uppercase;
	color: var(--accent);
	margin-bottom: 0.1rem;
}
.works .work { display: block; }
.works .detail {
	display: block;
	font-size: 0.84rem;
	color: var(--ink-faint);
	margin-top: 0.1rem;
}

/* --- panels ------------------------------------------------------------- */

.panel {
	background: var(--panel);
	border: 1px solid var(--rule-strong);
	padding: 1.1rem 1.3rem 1.3rem;
	margin-bottom: 1.4rem;
}
.panel h2 {
	margin: 0 0 1rem;
	padding-bottom: 0.4rem;
	border-bottom: 1px solid var(--rule-strong);
	font-family: var(--chrome);
	font-size: 0.78rem;
	letter-spacing: 0.2em;
	text-transform: uppercase;
	font-weight: 600;
	color: var(--ink);
}
.note {
	margin: 0 0 1rem;
	font-size: 0.88rem;
	color: var(--ink-soft);
	border-left: 2px solid var(--rule);
	padding-left: 0.8rem;
}

.specs { margin: 0; display: grid; gap: 0; }
.specs .row {
	display: grid;
	grid-template-columns: 12rem 1fr;
	gap: 1rem;
	padding: 0.35rem 0;
	border-top: 1px solid var(--rule);
}
.specs .row:first-child { border-top: 0; }
.specs dt {
	color: var(--ink-faint);
	font-family: var(--chrome);
	font-size: 0.7rem;
	letter-spacing: 0.12em;
	text-transform: uppercase;
	padding-top: 0.2rem;
}
.specs dd { margin: 0; }
.alt { color: var(--ink-faint); font-size: 0.86em; }

/* Inside a spread page the label column is narrower — half the width — and the
   rows are tighter, so a full set of particulars still reads as one page. */
.page .specs .row { grid-template-columns: 9rem 1fr; padding: 0.22rem 0; }

@media (max-width: 40rem) {
	.specs .row, .page .specs .row { grid-template-columns: 1fr; gap: 0.1rem; }
}

.lines { margin: 0; padding-left: 1.1rem; }
.lines li { margin: 0.15rem 0; }

/* --- configurations ----------------------------------------------------- */

.config {
	border: 1px solid var(--rule);
	margin-bottom: 0.6rem;
	background: var(--paper);
}
.config > summary {
	cursor: pointer;
	padding: 0.55rem 0.9rem;
	font-family: var(--chrome);
	font-size: 0.82rem;
	letter-spacing: 0.1em;
	text-transform: uppercase;
}
.config[open] > summary { border-bottom: 1px solid var(--rule); }
.config .specs { padding: 0.4rem 0.9rem 0.8rem; }

/* --- services ----------------------------------------------------------- */

.services { margin: 0; padding: 0; list-style: none; }
.services li {
	position: relative;
	padding: 0.5rem 0 0.5rem 1.5rem;
	border-top: 1px solid var(--rule);
	display: flex;
	flex-wrap: wrap;
	gap: 0.25rem 0.7rem;
	align-items: baseline;
}
.services li:first-child { border-top: 0; }
.services li::before {
	content: "";
	position: absolute;
	left: 0.3rem;
	top: 1rem;
	width: 7px; height: 7px;
	background: var(--accent);
}
.services .navy { font-weight: 600; }
.services .as { color: var(--ink-soft); font-style: italic; }
.services .span, .services .wardays {
	font-size: 0.82rem;
	color: var(--ink-faint);
	font-family: var(--chrome);
	letter-spacing: 0.04em;
}
.services .wardays::before { content: "· "; }

.sisters {
	margin: 0; padding: 0; list-style: none;
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(14rem, 1fr));
	gap: 0.15rem 1rem;
	font-size: 0.93rem;
}

/* --- class stats -------------------------------------------------------- */

.stats {
	margin: 0; padding: 0; list-style: none;
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(7rem, 1fr));
	gap: 0;
	border: 1px solid var(--rule-strong);
}
.stats li {
	padding: 0.7rem 0.8rem;
	background: var(--paper);
	border-right: 1px solid var(--rule);
}
.stats li:last-child { border-right: 0; }
.stats .figure {
	display: block;
	font-family: var(--body);
	font-weight: 600;
	font-size: 1.9rem;
	line-height: 1;
	font-variant-numeric: tabular-nums;
}
.stats .label {
	display: block;
	margin-top: 0.25rem;
	font-family: var(--chrome);
	font-size: 0.7rem;
	letter-spacing: 0.14em;
	text-transform: uppercase;
	color: var(--ink-faint);
}

/* --- tables ------------------------------------------------------------- */

.tablewrap { overflow-x: auto; }

.roster {
	width: 100%;
	border-collapse: collapse;
	font-size: 0.92rem;
}
.roster th, .roster td {
	text-align: left;
	padding: 0.35rem 0.7rem 0.35rem 0;
	border-bottom: 1px solid var(--rule);
	vertical-align: baseline;
}
.roster thead th {
	font-family: var(--chrome);
	font-size: 0.72rem;
	letter-spacing: 0.14em;
	text-transform: uppercase;
	color: var(--ink);
	border-bottom: 2px solid var(--accent);
	position: sticky;
	top: 0;
	background: var(--panel);
}
.roster tbody tr:hover { background: var(--accent-soft); }
.roster .num { font-variant-numeric: tabular-nums; white-space: nowrap; font-family: var(--data); font-size: 0.88em; }
.roster .alt { margin-left: 0.3rem; }

/* --- browse ------------------------------------------------------------- */

.browse-head h1 {
	margin: 0 0 0.25rem;
	font-family: var(--body);
	font-weight: 600;
	font-size: clamp(1.7rem, 3.6vw, 2.3rem);
	letter-spacing: -0.012em;
}
.browse-head .lede { margin: 0 0 1.5rem; color: var(--ink-soft); }

.controls {
	display: flex;
	gap: 0.6rem;
	margin-bottom: 1.25rem;
	flex-wrap: wrap;
	align-items: center;
}
.controls .search { flex: 1 1 20rem; }
.controls input[type="search"],
.controls select,
.facet input[type="number"] {
	width: 100%;
	padding: 0.5rem 0.65rem;
	border: 1px solid var(--rule-strong);
	background: var(--panel);
	color: var(--ink);
	font: inherit;
	font-size: 0.95rem;
	border-radius: 0;
}
.go {
	padding: 0.5rem 1.2rem;
	border: 1px solid var(--accent);
	background: var(--accent);
	color: var(--panel);
	font-family: var(--chrome);
	font-size: 0.86rem;
	letter-spacing: 0.12em;
	text-transform: uppercase;
	cursor: pointer;
	border-radius: 0;
}
.go:hover { filter: brightness(1.12); }
.go.wide { width: 100%; margin-top: 0.5rem; }

.views { display: inline-flex; align-items: stretch; }
.views a {
	padding: 0.5rem 0.9rem;
	border: 1px solid var(--rule-strong);
	margin-left: -1px;
	text-decoration: none;
	font-family: var(--chrome);
	font-size: 0.82rem;
	letter-spacing: 0.12em;
	text-transform: uppercase;
	color: var(--ink-soft);
	background: var(--panel);
}
.views a.on { color: var(--panel); background: var(--rule-strong); }

.browse-body {
	display: grid;
	grid-template-columns: 16rem 1fr;
	gap: 1.5rem;
	align-items: start;
}
@media (max-width: 56rem) {
	.browse-body { grid-template-columns: 1fr; }
}

.facets { display: grid; gap: 0.9rem; }
.facet {
	border: 1px solid var(--rule-strong);
	background: var(--panel);
	padding: 0.6rem 0.8rem 0.8rem;
	margin: 0;
}
.facet legend {
	font-family: var(--chrome);
	font-size: 0.72rem;
	letter-spacing: 0.14em;
	text-transform: uppercase;
	color: var(--ink);
	padding: 0 0.3rem;
}
.facet .options { display: grid; gap: 0.1rem; max-height: 15rem; overflow-y: auto; }
.facet label {
	display: flex;
	align-items: baseline;
	gap: 0.45rem;
	font-size: 0.88rem;
	cursor: pointer;
	padding: 0.08rem 0;
}
.facet label:hover { color: var(--accent); }
.facet .opt { flex: 1; }
.facet .count {
	color: var(--ink-faint);
	font-size: 0.78rem;
	font-variant-numeric: tabular-nums;
	font-family: var(--data);
}
.facet .pair { display: grid; grid-template-columns: 1fr 1fr; gap: 0.4rem; }
.facet .pair label, .facet .single { display: grid; gap: 0.2rem; }
.facet .pair span, .facet .single span {
	font-family: var(--chrome);
	font-size: 0.7rem;
	letter-spacing: 0.1em;
	text-transform: uppercase;
	color: var(--ink-faint);
}

.browse-table th, .browse-table td { padding-right: 0.9rem; }
.browse-table .num { text-align: right; }
.browse-table .pick { width: 2rem; padding-right: 0.3rem; }

.compare-bar {
	display: flex;
	align-items: center;
	gap: 0.9rem;
	flex-wrap: wrap;
	margin: 1rem 0 0;
}
.compare-bar .hint {
	font-size: 0.8rem;
	color: var(--ink-faint);
	font-family: var(--chrome);
	letter-spacing: 0.04em;
}

.empty {
	border: 1px dashed var(--rule-strong);
	padding: 2rem 1rem;
	text-align: center;
	color: var(--ink-soft);
}

/* --- loss map ----------------------------------------------------------- */

.lossmap .map {
	height: min(70vh, 34rem);
	border: 1px solid var(--rule-strong);
	background: var(--panel);
}
.lossmap .credit {
	margin: 0.6rem 0 0;
	font-size: 0.76rem;
	color: var(--ink-faint);
}
.leaflet-popup-content-wrapper, .leaflet-popup-tip {
	background: var(--panel);
	color: var(--ink);
	border-radius: 0;
}
.leaflet-popup-content a { color: var(--accent); }
.leaflet-container { font: inherit; }

/* --- comparison --------------------------------------------------------- */

.compare { margin-bottom: 2rem; }
.compare h2 {
	margin: 0 0 0.9rem;
	font-family: var(--chrome);
	font-size: 0.8rem;
	letter-spacing: 0.2em;
	text-transform: uppercase;
	font-weight: 600;
}
.compare-table {
	width: 100%;
	border-collapse: collapse;
	font-size: 0.92rem;
}
.compare-table th, .compare-table td {
	border: 1px solid var(--rule);
	padding: 0.4rem 0.7rem;
	vertical-align: top;
	text-align: left;
}
.compare-table thead th {
	background: var(--panel);
	min-width: 11rem;
	border-bottom: 2px solid var(--accent);
}
.compare-table thead img {
	display: block;
	width: 100%;
	max-width: 14rem;
	height: 5.5rem;
	object-fit: cover;
	margin-bottom: 0.4rem;
	border: 1px solid var(--rule);
}
.compare-table .noimage {
	display: block;
	height: 5.5rem;
	margin-bottom: 0.4rem;
	border: 1px solid var(--rule);
	background: repeating-linear-gradient(45deg, var(--paper), var(--paper) 6px, var(--paper-deep) 6px, var(--paper-deep) 12px);
}
.compare-table .rowhead {
	background: var(--panel);
	font-family: var(--chrome);
	font-size: 0.72rem;
	letter-spacing: 0.12em;
	text-transform: uppercase;
	color: var(--ink-faint);
	white-space: nowrap;
}
/* Weight and a rule, never colour alone. */
.compare-table td.best {
	font-weight: 700;
	box-shadow: inset 4px 0 0 var(--accent);
}
.compare-table .none { color: var(--ink-faint); }

/* --- listings ----------------------------------------------------------- */

.listing h1 {
	font-family: var(--body);
	font-weight: 600;
	font-size: 1.9rem;
	letter-spacing: -0.012em;
	margin: 0 0 1.25rem;
}
.index { margin: 0; padding: 0; list-style: none; }
.index li {
	padding: 0.45rem 0;
	border-top: 1px solid var(--rule);
	display: flex;
	flex-wrap: wrap;
	gap: 0.2rem 0.75rem;
	align-items: baseline;
}
.index .meta {
	font-size: 0.8rem;
	color: var(--ink-faint);
	font-family: var(--chrome);
	letter-spacing: 0.06em;
}
.pager { margin-top: 1.5rem; font-family: var(--chrome); letter-spacing: 0.06em; font-size: 0.88rem; }
.pager .page-numbers { padding: 0.2rem 0.55rem; border: 1px solid var(--rule); margin-right: -1px; }
.pager .current { background: var(--rule-strong); color: var(--panel); }

.sources { font-size: 0.88rem; color: var(--ink-soft); }
