/*
Theme Name: Soapberry Bugs of the World
Theme URI: https://soapberrybug.org/
Author: Soapberry Bugs of the World
Description: Custom theme for soapberrybug.org: species-based identification guide to the soapberry bugs (Rhopalidae: Serinethinae), with diagnostic field marks, look-alike comparisons, live iNaturalist maps, host plants and literature. Creates its own pages on activation.
Version: 1.0.2
Requires at least: 6.0
Tested up to: 6.8
Requires PHP: 7.4
License: GNU General Public License v2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Text Domain: sbb
*/

/* ==========================================================================
   1. Tokens
   ========================================================================== */
:root {
	--paper: #f8f6f1;
	--surface: #ffffff;
	--sunk: #f0ece4;
	--plate: #fbfaf7;
	--ink: #1b1e1c;
	--ink-2: #353b37;
	--muted: #5f6762;
	--line: #e3dfd6;
	--line-2: #cfc8bb;
	--accent: #a8322a;
	--accent-2: #82241e;
	--accent-soft: #f7e9e6;
	--leaf: #2e5a4c;
	--leaf-2: #234538;
	--leaf-soft: #e5efe9;
	--gold: #a97c14;

	--serif: "Source Serif 4", "Iowan Old Style", "Palatino Linotype", Georgia, serif;
	--sans: Inter, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
	--mono: ui-monospace, "SF Mono", "Cascadia Mono", "Roboto Mono", Consolas, monospace;

	--r: 12px;
	--r-sm: 8px;
	--shadow: 0 1px 2px rgba(27, 30, 28, .05), 0 6px 20px rgba(27, 30, 28, .06);
	--shadow-lg: 0 2px 4px rgba(27, 30, 28, .05), 0 18px 40px rgba(27, 30, 28, .10);
	--wrap: 1200px;
	--header-h: 72px;
}

/* ==========================================================================
   2. Base
   ========================================================================== */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: calc(var(--header-h) + 16px); }
body {
	margin: 0;
	background: var(--paper);
	color: var(--ink);
	font-family: var(--sans);
	font-size: 17px;
	line-height: 1.65;
	-webkit-font-smoothing: antialiased;
	text-rendering: optimizeLegibility;
}
img, svg, video, iframe { max-width: 100%; }
img { height: auto; display: block; }
a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: .18em; }
a:hover { color: var(--accent-2); }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 55%, transparent); outline-offset: 2px; border-radius: 4px; }
h1, h2, h3, h4 { font-family: var(--serif); font-weight: 600; line-height: 1.18; color: var(--ink); margin: 0 0 .5em; letter-spacing: -.01em; }
h1 { font-size: clamp(2.1rem, 4.2vw, 3.3rem); }
h2 { font-size: clamp(1.5rem, 2.6vw, 2.05rem); }
h3 { font-size: 1.3rem; }
h4 { font-size: 1.08rem; }
p { margin: 0 0 1em; }
i, em, .sci { font-style: italic; }
hr { border: 0; border-top: 1px solid var(--line); margin: 2.5rem 0; }
small { font-size: .85em; }
.screen-reader-text, .sr-only {
	position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
.skip-link:focus { position: fixed; top: 8px; left: 8px; width: auto; height: auto; clip: auto; z-index: 1000; background: var(--ink); color: #fff; padding: .6rem 1rem; border-radius: var(--r-sm); }

.wrap { width: min(100% - 2.5rem, var(--wrap)); margin-inline: auto; }
.wrap-narrow { width: min(100% - 2.5rem, 780px); margin-inline: auto; }
.section { padding-block: clamp(2.5rem, 6vw, 5rem); }
.section--tight { padding-block: clamp(1.75rem, 4vw, 3rem); }
.section--sunk { background: var(--sunk); }
.section--ink { background: var(--ink); color: #eae7e0; }
.section--ink h2, .section--ink h3 { color: #fff; }
.section--ink a { color: #f0b9b2; }

.eyebrow {
	font-family: var(--mono);
	font-size: .74rem;
	font-weight: 500;
	letter-spacing: .12em;
	text-transform: uppercase;
	color: var(--accent);
	margin: 0 0 .7rem;
	display: block;
}
.lead { font-size: 1.18rem; color: var(--ink-2); max-width: 62ch; }
.muted { color: var(--muted); }
.label {
	font-family: var(--mono);
	font-size: .72rem;
	letter-spacing: .1em;
	text-transform: uppercase;
	color: var(--muted);
	font-weight: 500;
}

/* ==========================================================================
   3. Buttons, chips, inputs
   ========================================================================== */
.btn {
	display: inline-flex; align-items: center; gap: .5rem;
	font: 600 .95rem/1 var(--sans);
	padding: .8rem 1.15rem;
	border-radius: 999px;
	border: 1.5px solid var(--accent);
	background: var(--accent);
	color: #fff;
	text-decoration: none;
	cursor: pointer;
	transition: background .15s, color .15s, border-color .15s, transform .15s;
	white-space: nowrap;
}
.btn:hover { background: var(--accent-2); border-color: var(--accent-2); color: #fff; }
.btn--ghost { background: transparent; color: var(--ink); border-color: var(--line-2); }
.btn--ghost:hover { background: var(--surface); color: var(--ink); border-color: var(--ink); }
.btn--leaf { background: var(--leaf); border-color: var(--leaf); }
.btn--leaf:hover { background: var(--leaf-2); border-color: var(--leaf-2); }
.btn--sm { padding: .55rem .85rem; font-size: .85rem; }
.btn svg { width: 1.05em; height: 1.05em; flex: none; }
.btn-row { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; }

.chip {
	display: inline-flex; align-items: center; gap: .4rem;
	font-size: .8rem; font-weight: 500;
	padding: .28rem .65rem;
	border-radius: 999px;
	background: var(--sunk);
	color: var(--ink-2);
	border: 1px solid transparent;
	text-decoration: none;
	line-height: 1.3;
}
a.chip:hover { border-color: var(--line-2); color: var(--ink); }
.chip--accent { background: var(--accent-soft); color: var(--accent-2); }
.chip--leaf { background: var(--leaf-soft); color: var(--leaf-2); }
.chips { display: flex; flex-wrap: wrap; gap: .4rem; }
.swatch { width: .8rem; height: .8rem; border-radius: 50%; display: inline-block; border: 1px solid rgba(0,0,0,.15); flex: none; }

input[type="search"], input[type="text"], input[type="email"], select, textarea {
	font: inherit; font-size: .95rem;
	color: var(--ink);
	background: var(--surface);
	border: 1.5px solid var(--line-2);
	border-radius: var(--r-sm);
	padding: .62rem .8rem;
	width: 100%;
	transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--ink-2); box-shadow: 0 0 0 3px rgba(27,30,28,.08); }
select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23353b37' stroke-width='1.6' fill='none'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right .8rem center; padding-right: 2.2rem; }

/* ==========================================================================
   4. Header & navigation
   ========================================================================== */
.site-header {
	position: sticky; top: 0; z-index: 50;
	background: color-mix(in srgb, var(--paper) 92%, transparent);
	backdrop-filter: saturate(1.4) blur(10px);
	-webkit-backdrop-filter: saturate(1.4) blur(10px);
	border-bottom: 1px solid var(--line);
}
.admin-bar .site-header { top: 32px; }
@media (max-width: 782px) { .admin-bar .site-header { top: 46px; } }
.site-header__inner { display: flex; align-items: center; gap: 1.5rem; min-height: var(--header-h); }
.brand { display: flex; align-items: center; gap: .7rem; text-decoration: none; color: var(--ink); flex: none; }
.brand:hover { color: var(--ink); }
.brand__mark { width: 38px; height: 38px; flex: none; }
.brand__text { display: flex; flex-direction: column; line-height: 1.05; }
.brand__over { font-family: var(--mono); font-size: .6rem; letter-spacing: .16em; text-transform: uppercase; color: var(--accent); margin-bottom: .2rem; }
.brand__name { font-family: var(--serif); font-size: 1.22rem; font-weight: 600; font-variant: small-caps; letter-spacing: .02em; }
.brand__name small { font-size: .62em; font-variant: normal; font-style: italic; font-weight: 400; color: var(--muted); margin: 0 .12em; }

.nav { margin-left: auto; }
.nav ul { list-style: none; margin: 0; padding: 0; }
.nav > ul, .nav .menu { display: flex; align-items: center; gap: .15rem; }
.nav li { position: relative; }
.nav a {
	display: block; padding: .5rem .7rem; border-radius: var(--r-sm);
	text-decoration: none; color: var(--ink-2); font-weight: 500; font-size: .93rem;
}
.nav a:hover, .nav .current-menu-item > a, .nav .current-menu-ancestor > a, .nav .current_page_item > a { color: var(--ink); background: var(--sunk); }
.nav .menu-item-has-children > a::after { content: ""; display: inline-block; width: .42em; height: .42em; margin-left: .45em; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: translateY(-.2em) rotate(45deg); opacity: .6; }
.nav .sub-menu {
	position: absolute; top: calc(100% + 6px); left: -.5rem; min-width: 250px;
	background: var(--surface); border: 1px solid var(--line); border-radius: var(--r);
	box-shadow: var(--shadow-lg); padding: .4rem;
	opacity: 0; visibility: hidden; transform: translateY(-4px); transition: opacity .15s, transform .15s, visibility .15s;
}
.nav .sub-menu::before { content: ""; position: absolute; inset: -8px 0 auto 0; height: 8px; }
.nav li:hover > .sub-menu, .nav li:focus-within > .sub-menu { opacity: 1; visibility: visible; transform: none; }
.nav .sub-menu a { padding: .55rem .75rem; }

.header-tools { display: flex; align-items: center; gap: .5rem; }
.quickfind { position: relative; width: 230px; }
.quickfind input { padding-left: 2.2rem; border-radius: 999px; background: var(--surface); font-size: .88rem; padding-block: .5rem; }
.quickfind svg { position: absolute; left: .8rem; top: 50%; width: 15px; height: 15px; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.quickfind__results {
	position: absolute; top: calc(100% + 6px); right: 0; width: min(380px, 92vw);
	background: var(--surface); border: 1px solid var(--line); border-radius: var(--r);
	box-shadow: var(--shadow-lg); padding: .35rem; display: none; max-height: 70vh; overflow: auto; z-index: 60;
}
.quickfind__results.is-open { display: block; }
.quickfind__results a { display: flex; align-items: center; gap: .7rem; padding: .45rem .55rem; border-radius: var(--r-sm); color: var(--ink); text-decoration: none; }
.quickfind__results a:hover, .quickfind__results a[aria-selected="true"] { background: var(--sunk); }
.quickfind__results img { width: 40px; height: 40px; object-fit: contain; background: var(--plate); border-radius: 6px; border: 1px solid var(--line); }
.quickfind__results .qf-name { font-family: var(--serif); font-style: italic; font-size: 1rem; }
.quickfind__results .qf-sub { display: block; font-size: .76rem; color: var(--muted); }
.quickfind__empty { padding: .7rem; color: var(--muted); font-size: .9rem; }

.nav-toggle { display: none; background: none; border: 1.5px solid var(--line-2); border-radius: var(--r-sm); width: 42px; height: 42px; cursor: pointer; color: var(--ink); align-items: center; justify-content: center; }
.nav-toggle svg { width: 20px; height: 20px; }
.submenu-toggle { display: none; }

@media (max-width: 1080px) {
	.quickfind { width: 180px; }
	.nav a { padding-inline: .5rem; font-size: .9rem; }
}
@media (max-width: 960px) {
	.nav-toggle { display: inline-flex; }
	.site-header__inner { flex-wrap: wrap; }
	.header-tools { margin-left: auto; }
	.nav { order: 10; width: 100%; display: none; padding-bottom: 1rem; }
	.nav.is-open { display: block; }
	.nav > ul, .nav .menu { flex-direction: column; align-items: stretch; gap: 0; }
	.nav a { padding: .7rem .5rem; font-size: 1rem; border-bottom: 1px solid var(--line); border-radius: 0; }
	.nav .sub-menu { position: static; opacity: 1; visibility: visible; transform: none; box-shadow: none; border: 0; padding: 0 0 0 1rem; display: none; min-width: 0; background: transparent; }
	.nav li.is-open > .sub-menu { display: block; }
	.nav .menu-item-has-children > a::after { display: none; }
	.submenu-toggle { display: block; position: absolute; right: 0; top: 0; width: 46px; height: 46px; background: none; border: 0; cursor: pointer; color: var(--ink-2); }
	.submenu-toggle::before { content: ""; display: block; margin: auto; width: .5em; height: .5em; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: rotate(45deg); }
	.nav li.is-open > .submenu-toggle::before { transform: rotate(-135deg); }
}
@media (max-width: 560px) {
	.quickfind { width: 44px; }
	.quickfind input { width: 44px; padding: .5rem; color: transparent; cursor: pointer; }
	.quickfind input::placeholder { color: transparent; }
	.quickfind.is-active { position: absolute; left: 1.25rem; right: 1.25rem; width: auto; z-index: 70; }
	.quickfind.is-active input { width: 100%; padding-left: 2.2rem; color: var(--ink); cursor: text; }
	.brand__over { display: none; }
	.brand__name { font-size: 1.05rem; }
}

/* ==========================================================================
   5. Page headers & breadcrumbs
   ========================================================================== */
.page-head { padding: clamp(2rem, 5vw, 3.6rem) 0 clamp(1.4rem, 3vw, 2.2rem); border-bottom: 1px solid var(--line); background: linear-gradient(180deg, var(--surface), var(--paper)); }
.page-head h1 { margin-bottom: .35rem; }
.page-head .lead { margin: .4rem 0 0; }
.crumbs { font-size: .82rem; color: var(--muted); margin-bottom: 1rem; display: flex; flex-wrap: wrap; gap: .35rem; align-items: center; }
.crumbs a { color: var(--muted); text-decoration: none; }
.crumbs a:hover { color: var(--ink); text-decoration: underline; }
.crumbs span[aria-hidden] { opacity: .5; }

/* ==========================================================================
   6. Prose (editable page content)
   ========================================================================== */
.prose { font-size: 1.04rem; color: var(--ink-2); }
.prose > * { max-width: 72ch; }
.prose > .alignwide, .prose > .wp-block-table, .prose > .sbb-wide, .prose > .wp-block-embed, .prose > figure.sbb-figure--wide, .prose > .sbb-grid, .prose > .sbb-table-wrap, .prose > .sbb-cards { max-width: none; }
.prose h2 { margin-top: 2.6rem; padding-top: 1.2rem; border-top: 1px solid var(--line); }
.prose h2:first-child { margin-top: 0; padding-top: 0; border-top: 0; }
.prose h3 { margin-top: 2rem; }
.prose ul, .prose ol { padding-left: 1.3rem; margin: 0 0 1.2em; }
.prose li { margin-bottom: .35em; }
.prose li::marker { color: var(--accent); }
.prose blockquote { margin: 1.5rem 0; padding: .2rem 0 .2rem 1.2rem; border-left: 3px solid var(--accent); color: var(--ink); font-family: var(--serif); font-size: 1.15rem; }
.prose table, .sbb-table { width: 100%; border-collapse: collapse; font-size: .95rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.prose th, .prose td, .sbb-table th, .sbb-table td { text-align: left; vertical-align: top; padding: .75rem .9rem; border-bottom: 1px solid var(--line); }
.prose th, .sbb-table th { background: var(--sunk); font-family: var(--mono); font-size: .72rem; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-2); font-weight: 600; }
.prose tr:last-child td, .sbb-table tr:last-child td { border-bottom: 0; }
.sbb-table-wrap { overflow-x: auto; border-radius: var(--r); }
.prose dl.terms { display: grid; grid-template-columns: max-content 1fr; gap: .45rem 1.2rem; margin: 0 0 1.5rem; }
.prose dl.terms dt { font-weight: 600; color: var(--ink); }
.prose dl.terms dd { margin: 0; }
@media (max-width: 560px) { .prose dl.terms { grid-template-columns: 1fr; } .prose dl.terms dd { margin-bottom: .6rem; } }

.layout-with-toc { display: grid; grid-template-columns: minmax(0, 1fr) 240px; gap: 3.5rem; align-items: start; }
.toc { position: sticky; top: calc(var(--header-h) + 24px); font-size: .88rem; border-left: 2px solid var(--line); padding-left: 1rem; }
.toc .label { display: block; margin-bottom: .6rem; }
.toc ol { list-style: none; margin: 0; padding: 0; }
.toc li { margin: 0 0 .45rem; }
.toc a { color: var(--muted); text-decoration: none; }
.toc a:hover, .toc a.is-active { color: var(--accent); }
@media (max-width: 960px) { .layout-with-toc { grid-template-columns: 1fr; } .toc { display: none; } }

/* Figures (shortcode) */
.sbb-figure { margin: 1.6rem 0; }
.sbb-figure__img { background: var(--plate); border: 1px solid var(--line); border-radius: var(--r); padding: .6rem; display: flex; justify-content: center; }
.sbb-figure__img img { border-radius: 4px; max-height: 560px; width: auto; }
.sbb-figure figcaption { font-size: .86rem; color: var(--muted); margin-top: .55rem; line-height: 1.5; }
.sbb-figure--right { float: right; width: min(44%, 340px); margin: .3rem 0 1rem 1.6rem; }
.sbb-figure--left { float: left; width: min(44%, 340px); margin: .3rem 1.6rem 1rem 0; }
.sbb-figure--small .sbb-figure__img img { max-height: 260px; }
.sbb-clear { clear: both; }
@media (max-width: 640px) { .sbb-figure--right, .sbb-figure--left { float: none; width: auto; margin: 1.2rem 0; } }

.notice { background: var(--leaf-soft); border: 1px solid color-mix(in srgb, var(--leaf) 25%, transparent); color: var(--leaf-2); border-radius: var(--r); padding: 1rem 1.2rem; font-size: .95rem; }
.notice--accent { background: var(--accent-soft); color: var(--accent-2); border-color: color-mix(in srgb, var(--accent) 22%, transparent); }
.notice--draft { background: #fff8e6; color: #6b4e00; border-color: #f0dca4; }
.notice > :last-child { margin-bottom: 0; }

/* ==========================================================================
   7. Cards & grids
   ========================================================================== */
.grid { display: grid; gap: 1.25rem; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 960px) { .grid-3, .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 600px) { .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; } }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 1.4rem; box-shadow: 0 1px 0 rgba(0,0,0,.02); }
.card h3 { margin-bottom: .4rem; }
.card p:last-child { margin-bottom: 0; }
a.card { color: inherit; text-decoration: none; transition: border-color .15s, box-shadow .15s, transform .15s; display: block; }
a.card:hover { border-color: var(--line-2); box-shadow: var(--shadow); transform: translateY(-2px); }

/* Specimen plate: small museum photos shown at sensible sizes on a neutral ground */
.plate { background: var(--plate); border: 1px solid var(--line); border-radius: var(--r); display: flex; align-items: center; justify-content: center; overflow: hidden; position: relative; }
.plate img { object-fit: contain; width: 100%; height: 100%; }
.plate--empty { color: var(--line-2); }
.plate--empty svg { width: 44%; height: auto; }

/* Species card */
.species-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 1.1rem; }
.sp-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; display: flex; flex-direction: column; text-decoration: none; color: inherit; transition: border-color .15s, box-shadow .15s, transform .15s; }
.sp-card:hover { border-color: var(--line-2); box-shadow: var(--shadow); transform: translateY(-2px); color: inherit; }
.sp-card .plate { border: 0; border-bottom: 1px solid var(--line); border-radius: 0; aspect-ratio: 4 / 3.4; padding: .7rem; }
.sp-card__body { padding: .85rem 1rem 1rem; display: flex; flex-direction: column; gap: .35rem; flex: 1; }
.sp-card__name { font-family: var(--serif); font-style: italic; font-size: 1.12rem; font-weight: 600; line-height: 1.2; margin: 0; color: var(--ink); }
.sp-card__auth { font-size: .78rem; color: var(--muted); }
.sp-card__common { font-size: .82rem; color: var(--leaf-2); font-weight: 600; }
.sp-card__meta { display: flex; flex-wrap: wrap; gap: .3rem .6rem; align-items: center; font-size: .78rem; color: var(--muted); margin-top: auto; padding-top: .45rem; }
.sp-card__mark { font-size: .84rem; color: var(--ink-2); line-height: 1.45; margin: 0; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.sp-card__mark b { font-weight: 600; }
.genus-tag { font-family: var(--mono); font-size: .66rem; letter-spacing: .1em; text-transform: uppercase; color: var(--accent); }
.species-grid.is-list { grid-template-columns: 1fr; gap: .5rem; }
.species-grid.is-list .sp-card { flex-direction: row; align-items: stretch; }
.species-grid.is-list .sp-card .plate { width: 120px; aspect-ratio: auto; border-bottom: 0; border-right: 1px solid var(--line); flex: none; }
.species-grid.is-list .sp-card__body { flex-direction: row; flex-wrap: wrap; align-items: center; gap: .3rem 1rem; }
.species-grid.is-list .sp-card__mark { flex-basis: 100%; -webkit-line-clamp: 2; }
.species-grid.is-list .sp-card__meta { margin-top: 0; padding-top: 0; }

/* ==========================================================================
   8. Species index filters
   ========================================================================== */
.filters { position: sticky; top: var(--header-h); z-index: 20; background: color-mix(in srgb, var(--paper) 94%, transparent); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); padding: .9rem 0; }
.admin-bar .filters { top: calc(var(--header-h) + 32px); }
.filters__row { display: grid; grid-template-columns: minmax(200px, 1.6fr) repeat(3, minmax(140px, 1fr)) auto; gap: .6rem; align-items: center; }
.filters__row--2 { display: flex; flex-wrap: wrap; gap: .5rem 1.2rem; align-items: center; margin-top: .7rem; }
.seg { display: inline-flex; background: var(--sunk); border-radius: 999px; padding: 3px; gap: 2px; }
.seg button { font: 500 .84rem var(--sans); border: 0; background: none; padding: .38rem .8rem; border-radius: 999px; cursor: pointer; color: var(--ink-2); }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px rgba(0,0,0,.1); }
.seg button i { font-style: italic; font-family: var(--serif); font-size: .95rem; }
.color-filter { display: inline-flex; gap: .3rem; align-items: center; flex-wrap: wrap; }
.color-filter button { display: inline-flex; align-items: center; gap: .35rem; font: 500 .8rem var(--sans); border: 1.5px solid var(--line); background: var(--surface); border-radius: 999px; padding: .3rem .65rem .3rem .45rem; cursor: pointer; color: var(--ink-2); }
.color-filter button[aria-pressed="true"] { border-color: var(--ink); color: var(--ink); background: var(--sunk); }
.filters__count { font-size: .85rem; color: var(--muted); margin-left: auto; white-space: nowrap; }
.view-toggle { display: inline-flex; gap: .25rem; }
.view-toggle button { border: 1.5px solid var(--line); background: var(--surface); border-radius: var(--r-sm); width: 36px; height: 36px; display: grid; place-items: center; cursor: pointer; color: var(--muted); }
.view-toggle button[aria-pressed="true"] { border-color: var(--ink); color: var(--ink); }
.view-toggle svg { width: 16px; height: 16px; }
.link-btn { background: none; border: 0; color: var(--accent); font: 500 .85rem var(--sans); cursor: pointer; padding: 0; text-decoration: underline; text-underline-offset: .2em; }
.no-results { padding: 3rem 1rem; text-align: center; color: var(--muted); display: none; }
@media (max-width: 960px) {
	.filters { position: static; }
	.filters__row { grid-template-columns: 1fr 1fr; }
	.filters__row > :first-child { grid-column: 1 / -1; }
}

/* ==========================================================================
   9. Species single
   ========================================================================== */
.sp-hero { padding: clamp(1.6rem, 4vw, 2.6rem) 0 2rem; background: linear-gradient(180deg, var(--surface), var(--paper)); border-bottom: 1px solid var(--line); }
.sp-hero__grid { display: grid; grid-template-columns: minmax(0, 340px) minmax(0, 1fr); gap: clamp(1.5rem, 4vw, 3.5rem); align-items: start; }
.sp-hero .plate { aspect-ratio: 4 / 5; padding: 1rem; cursor: zoom-in; }
.sp-hero .plate img { image-rendering: auto; }
.sp-hero figcaption { font-size: .82rem; color: var(--muted); margin-top: .55rem; line-height: 1.45; }
.sp-title { font-style: italic; margin: .1rem 0 .25rem; }
.sp-authority { font-family: var(--serif); font-size: 1.15rem; color: var(--muted); font-style: normal; }
.sp-common { font-size: 1.05rem; color: var(--leaf-2); font-weight: 600; margin: 0 0 .8rem; }
.sp-intro { font-size: 1.06rem; color: var(--ink-2); max-width: 62ch; }
.facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); margin: 1.3rem 0; overflow: hidden; }
.facts > div { padding: .85rem 1rem; border-bottom: 1px solid var(--line); border-right: 1px solid var(--line); }
.facts > div:nth-child(2n) { border-right: 0; }
.facts > div.facts__wide { grid-column: 1 / -1; border-right: 0; }
.facts > div:last-child, .facts > div:nth-last-child(2):not(.facts__wide):nth-child(odd) { border-bottom: 0; }
.facts dt { font-family: var(--mono); font-size: .68rem; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); margin-bottom: .25rem; }
.facts dd { margin: 0; font-size: .95rem; color: var(--ink); line-height: 1.5; }
.facts dd a { color: var(--ink); }
.facts dd a:hover { color: var(--accent); }
.sizebar { margin-top: .4rem; height: 6px; background: var(--sunk); border-radius: 999px; position: relative; max-width: 220px; }
.sizebar span { position: absolute; top: 0; bottom: 0; background: var(--accent); border-radius: 999px; }
.sizebar-scale { display: flex; justify-content: space-between; max-width: 220px; font-family: var(--mono); font-size: .62rem; color: var(--muted); margin-top: .2rem; }

.sp-layout { display: grid; grid-template-columns: minmax(0, 1fr) 230px; gap: 3.5rem; align-items: start; padding-block: 2.5rem 4rem; }
.sp-section { padding-bottom: 2.4rem; margin-bottom: 2.4rem; border-bottom: 1px solid var(--line); }
.sp-section:last-child { border-bottom: 0; }
.sp-section > h2 { display: flex; align-items: baseline; gap: .7rem; font-size: 1.55rem; }
.sp-section > h2 .num { font-family: var(--mono); font-size: .75rem; color: var(--accent); font-weight: 500; letter-spacing: .05em; }
@media (max-width: 960px) { .sp-hero__grid, .sp-layout { grid-template-columns: 1fr; } .sp-hero .plate { max-width: 340px; } }

.marks { list-style: none; counter-reset: mark; padding: 0; margin: 0; display: grid; gap: .65rem; }
.marks li { counter-increment: mark; position: relative; padding: .85rem 1rem .85rem 3.1rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); line-height: 1.55; }
.marks li::before { content: counter(mark); position: absolute; left: .9rem; top: .82rem; width: 1.55rem; height: 1.55rem; border-radius: 50%; background: var(--accent); color: #fff; font: 600 .78rem/1.55rem var(--mono); text-align: center; }
.marks b { color: var(--ink); }

.desc-block { margin-bottom: 1.6rem; }
.desc-block h3 { font-style: italic; font-size: 1.15rem; margin-bottom: .35rem; }
.desc-block h3 span { font-style: normal; color: var(--muted); font-weight: 400; font-size: .9em; }
.desc-block .meta-line { font-size: .9rem; color: var(--muted); margin-bottom: .5rem; }
.term { color: inherit; text-decoration: underline dotted color-mix(in srgb, var(--accent) 70%, transparent); text-underline-offset: .22em; text-decoration-thickness: 1.5px; position: relative; cursor: help; }
.term:hover, .term:focus { color: var(--accent-2); }
.term[data-tip]:hover::after, .term[data-tip]:focus::after {
	content: attr(data-tip); position: absolute; left: 50%; bottom: calc(100% + 8px); transform: translateX(-50%);
	width: max-content; max-width: 260px; background: var(--ink); color: #fff; font: 400 .8rem/1.45 var(--sans);
	padding: .5rem .65rem; border-radius: 6px; z-index: 30; pointer-events: none; white-space: normal; text-align: left; box-shadow: var(--shadow-lg);
}

.lookalikes { display: grid; gap: .7rem; }
.la-row { display: grid; grid-template-columns: 92px minmax(0, 1fr) auto; gap: 1rem; align-items: center; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: .7rem; }
.la-row .plate { width: 92px; height: 92px; padding: .35rem; }
.la-row__name { font-family: var(--serif); font-style: italic; font-weight: 600; font-size: 1.08rem; color: var(--ink); text-decoration: none; }
.la-row__name:hover { color: var(--accent); }
.la-row__note { margin: .2rem 0 0; font-size: .93rem; color: var(--ink-2); line-height: 1.5; }
.la-row__note q { quotes: "“" "”"; }
.la-row__src { display: block; font-size: .76rem; color: var(--muted); margin-top: .25rem; }
@media (max-width: 640px) { .la-row { grid-template-columns: 72px minmax(0, 1fr); } .la-row .plate { width: 72px; height: 72px; } .la-row .btn { grid-column: 1 / -1; justify-self: start; } }

.subsp { display: grid; grid-template-columns: 140px minmax(0, 1fr); gap: 1.2rem; align-items: start; }
.subsp .plate { aspect-ratio: 4/5; padding: .5rem; }
.subsp--noimg { grid-template-columns: 1fr; }
@media (max-width: 560px) { .subsp { grid-template-columns: 1fr; } .subsp .plate { max-width: 160px; } }

.refobs { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: .6rem; }
.refobs a { display: flex; align-items: center; gap: .6rem; padding: .7rem .85rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-sm); text-decoration: none; color: var(--ink); font-size: .9rem; font-weight: 500; }
.refobs a:hover { border-color: var(--leaf); color: var(--leaf-2); }
.refobs svg { width: 18px; height: 18px; flex: none; color: var(--leaf); }

.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: .8rem; }
.gallery figure { margin: 0; }
.gallery .plate { aspect-ratio: 1; padding: .3rem; cursor: zoom-in; }
.gallery .plate img { object-fit: cover; border-radius: 6px; }
.gallery figcaption { font-size: .78rem; color: var(--muted); margin-top: .35rem; line-height: 1.4; }

.hostlist { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: .6rem; }
.hostlist a, .hostlist div.host-item { display: flex; flex-direction: column; padding: .75rem .9rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-sm); text-decoration: none; color: var(--ink); }
.hostlist a:hover { border-color: var(--leaf); }
.hostlist .h-name { font-family: var(--serif); font-style: italic; font-weight: 600; }
.hostlist .h-common { font-size: .84rem; color: var(--muted); }

/* Maps */
.map-tabs { display: flex; gap: .3rem; border-bottom: 1px solid var(--line); margin-bottom: 1rem; flex-wrap: wrap; }
.map-tabs button { font: 600 .9rem var(--sans); background: none; border: 0; border-bottom: 2.5px solid transparent; padding: .6rem .9rem; cursor: pointer; color: var(--muted); margin-bottom: -1px; }
.map-tabs button[aria-selected="true"] { color: var(--ink); border-color: var(--accent); }
.map-panel[hidden] { display: none; }
.inat-map { height: 420px; border-radius: var(--r); border: 1px solid var(--line); background: #eef0ec; z-index: 0; }
.map-meta { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .6rem 1rem; align-items: center; margin-top: .75rem; font-size: .88rem; color: var(--muted); }
.map-meta strong { color: var(--ink); font-family: var(--mono); font-weight: 600; }
.static-map .plate { padding: .5rem; }
.static-map .plate img { max-height: 460px; width: auto; }
.legend { display: flex; flex-wrap: wrap; gap: .4rem 1.1rem; font-size: .82rem; color: var(--muted); margin-top: .6rem; }
.legend i { display: inline-block; width: .8rem; height: .8rem; border-radius: 50%; vertical-align: -1px; margin-right: .35rem; font-style: normal; }
.leaflet-container { font-family: var(--sans); }
.leaflet-control-attribution { font-size: 10px; }

.refs { list-style: none; padding: 0; margin: 0; display: grid; gap: .6rem; }
.refs li { font-size: .93rem; line-height: 1.55; padding-left: 1rem; border-left: 2px solid var(--line); color: var(--ink-2); }
.refs a.ref-link { font-size: .78rem; font-weight: 600; white-space: nowrap; margin-left: .35rem; }

.cite-box { background: var(--surface); border: 1px dashed var(--line-2); border-radius: var(--r); padding: 1rem 1.1rem; font-size: .92rem; }
.cite-box code { display: block; font-family: var(--mono); font-size: .82rem; background: var(--sunk); padding: .7rem .8rem; border-radius: 6px; margin: .5rem 0 .7rem; white-space: pre-wrap; word-break: break-word; color: var(--ink); }

.sp-aside { position: sticky; top: calc(var(--header-h) + 24px); font-size: .9rem; display: grid; gap: 1.3rem; }
.sp-aside nav ol { list-style: none; padding: 0; margin: .5rem 0 0; border-left: 2px solid var(--line); }
.sp-aside nav a { display: block; padding: .25rem 0 .25rem .9rem; margin-left: -2px; border-left: 2px solid transparent; color: var(--muted); text-decoration: none; }
.sp-aside nav a:hover, .sp-aside nav a.is-active { color: var(--accent); border-left-color: var(--accent); }
@media (max-width: 960px) { .sp-aside { position: static; display: none; } }

.pager { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin-top: 1rem; }
.pager a { display: block; padding: 1rem 1.1rem; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); text-decoration: none; color: var(--ink); }
.pager a:hover { border-color: var(--line-2); box-shadow: var(--shadow); }
.pager .label { display: block; margin-bottom: .2rem; }
.pager .sci { font-family: var(--serif); font-size: 1.08rem; font-weight: 600; }
.pager a.next { text-align: right; }

/* Lightbox */
.lightbox { position: fixed; inset: 0; background: rgba(15, 17, 16, .9); z-index: 1000; display: none; align-items: center; justify-content: center; padding: 2rem; }
.lightbox.is-open { display: flex; }
.lightbox figure { margin: 0; max-width: min(1000px, 100%); text-align: center; }
.lightbox img { max-height: 80vh; width: auto; margin: 0 auto; border-radius: 6px; background: #fff; image-rendering: auto; min-width: min(480px, 90vw); object-fit: contain; }
.lightbox figcaption { color: #ddd; font-size: .9rem; margin-top: .8rem; }
.lightbox button { position: absolute; top: 1rem; right: 1rem; width: 44px; height: 44px; border-radius: 50%; border: 0; background: rgba(255,255,255,.12); color: #fff; font-size: 1.6rem; cursor: pointer; line-height: 1; }

/* ==========================================================================
   10. Compare
   ========================================================================== */
.compare-pickers { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .8rem; margin-bottom: 1.5rem; }
.compare-pickers label { display: block; }
.compare-pickers .label { display: block; margin-bottom: .35rem; }
@media (max-width: 760px) { .compare-pickers { grid-template-columns: 1fr; } }
.compare-scroll { overflow-x: auto; padding-bottom: .5rem; }
.compare-table { display: grid; grid-template-columns: 150px repeat(var(--cols, 3), minmax(230px, 1fr)); border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); min-width: max-content; width: 100%; overflow: hidden; }
.compare-table > div { padding: .85rem 1rem; border-bottom: 1px solid var(--line); border-right: 1px solid var(--line); font-size: .92rem; line-height: 1.5; }
.compare-table > div:nth-child(calc(var(--cols, 3) + 1)n) { border-right: 0; }
.compare-table .c-label { background: var(--sunk); font-family: var(--mono); font-size: .68rem; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.compare-table .c-head .plate { aspect-ratio: 4/4.5; padding: .5rem; margin-bottom: .6rem; cursor: zoom-in; }
.compare-table .c-name { font-family: var(--serif); font-style: italic; font-size: 1.15rem; font-weight: 600; color: var(--ink); text-decoration: none; }
.compare-table ul { margin: 0; padding-left: 1.1rem; }
.compare-table li { margin-bottom: .35rem; }
.compare-table .c-diff { background: var(--accent-soft); }
.compare-empty { padding: 3rem; text-align: center; color: var(--muted); border: 1px dashed var(--line-2); border-radius: var(--r); }

/* ==========================================================================
   11. Identification key
   ========================================================================== */
.key { background: var(--surface); border: 1px solid var(--line); border-radius: calc(var(--r) + 4px); padding: clamp(1.2rem, 3vw, 2rem); box-shadow: var(--shadow); }
.key__progress { display: flex; gap: .35rem; margin-bottom: 1.1rem; flex-wrap: wrap; }
.key__progress button { font: 500 .78rem var(--sans); background: var(--sunk); border: 0; border-radius: 999px; padding: .3rem .7rem; cursor: pointer; color: var(--ink-2); }
.key__q { font-family: var(--serif); font-size: clamp(1.25rem, 2.4vw, 1.6rem); font-weight: 600; margin: 0 0 .4rem; line-height: 1.3; }
.key__hint { color: var(--muted); font-size: .95rem; margin: 0 0 1.2rem; }
.key__options { display: grid; gap: .65rem; }
.key__opt { display: grid; grid-template-columns: auto 1fr auto; gap: 1rem; align-items: center; width: 100%; text-align: left; font: inherit; background: var(--paper); border: 1.5px solid var(--line); border-radius: var(--r); padding: .9rem 1rem; cursor: pointer; color: var(--ink); transition: border-color .15s, background .15s; }
.key__opt:hover, .key__opt:focus-visible { border-color: var(--accent); background: var(--surface); }
.key__opt .plate { width: 64px; height: 64px; padding: .2rem; }
.key__opt .k-letter { font: 600 .8rem var(--mono); width: 1.8rem; height: 1.8rem; border-radius: 50%; display: grid; place-items: center; background: var(--ink); color: #fff; }
.key__opt .k-arrow { color: var(--muted); }
.key__opt small { display: block; color: var(--muted); font-size: .85rem; margin-top: .15rem; }
.key__result { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: 1.5rem; align-items: start; }
.key__result .plate { aspect-ratio: 4/5; padding: .7rem; }
.key__result h3 { font-style: italic; font-size: 1.6rem; margin-bottom: .2rem; }
@media (max-width: 600px) { .key__result { grid-template-columns: 1fr; } .key__result .plate { max-width: 200px; } }

/* ==========================================================================
   12. Front page
   ========================================================================== */
.hero { padding: clamp(2.5rem, 7vw, 5.5rem) 0 clamp(2.5rem, 6vw, 4.5rem); background:
	radial-gradient(1200px 400px at 85% -10%, rgba(168, 50, 42, .07), transparent 60%),
	linear-gradient(180deg, var(--surface), var(--paper)); border-bottom: 1px solid var(--line); overflow: hidden; }
.hero__grid { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); gap: clamp(2rem, 5vw, 4.5rem); align-items: center; }
.hero h1 { font-size: clamp(2.4rem, 5.4vw, 4.1rem); line-height: 1.04; margin-bottom: 1rem; }
.hero h1 em { color: var(--accent); font-style: italic; }
.hero .lead { margin-bottom: 1.6rem; }
.hero-search { position: relative; max-width: 520px; margin-bottom: 1.1rem; }
.hero-search input { padding: 1rem 1rem 1rem 3rem; font-size: 1.05rem; border-radius: 999px; box-shadow: var(--shadow); border-color: var(--line); }
.hero-search svg { position: absolute; left: 1.15rem; top: 50%; width: 19px; height: 19px; transform: translateY(-50%); color: var(--muted); }
.hero-search .quickfind__results { left: 0; right: auto; width: 100%; }
.hero-stats { display: flex; gap: 2rem; margin-top: 2rem; flex-wrap: wrap; }
.hero-stats div { display: flex; flex-direction: column; }
.hero-stats strong { font-family: var(--serif); font-size: 2rem; font-weight: 600; line-height: 1; color: var(--ink); }
.hero-stats span { font-size: .8rem; color: var(--muted); margin-top: .3rem; }
.mosaic { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .75rem; }
.mosaic a { display: block; text-decoration: none; color: var(--ink); }
.mosaic .plate { aspect-ratio: 4/5; padding: .55rem; box-shadow: var(--shadow); transition: transform .2s, box-shadow .2s; }
.mosaic a:hover .plate { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.mosaic a:nth-child(3n+2) { transform: translateY(1.5rem); }
.mosaic span { display: block; font-family: var(--serif); font-style: italic; font-size: .82rem; margin-top: .35rem; color: var(--ink-2); text-align: center; }
@media (max-width: 900px) { .hero__grid { grid-template-columns: 1fr; } .mosaic a:nth-child(3n+2) { transform: none; } }

.pillars { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1.25rem; margin-top: -1px; }
.pillar { position: relative; background: var(--surface); border: 1px solid var(--line); border-radius: calc(var(--r) + 4px); padding: 1.8rem 1.6rem 1.6rem; text-decoration: none; color: var(--ink); display: flex; flex-direction: column; gap: .4rem; transition: border-color .15s, box-shadow .2s, transform .2s; }
.pillar:hover { color: var(--ink); border-color: var(--line-2); box-shadow: var(--shadow-lg); transform: translateY(-3px); }
.pillar__icon { width: 56px; height: 56px; border-radius: 14px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); margin-bottom: .6rem; }
.pillar:nth-child(2) .pillar__icon { background: var(--leaf-soft); color: var(--leaf); }
.pillar:nth-child(3) .pillar__icon { background: #f4eddc; color: var(--gold); }
.pillar__icon svg { width: 30px; height: 30px; }
.pillar h3 { font-size: 1.5rem; margin: 0; }
.pillar p { color: var(--ink-2); margin: 0; font-size: .97rem; }
.pillar ul { list-style: none; padding: 0; margin: .6rem 0 0; font-size: .88rem; color: var(--muted); display: grid; gap: .25rem; }
.pillar ul li::before { content: "→ "; color: var(--line-2); }
.pillar__go { margin-top: auto; padding-top: 1rem; font-weight: 600; font-size: .9rem; color: var(--accent); }
@media (max-width: 900px) { .pillars { grid-template-columns: 1fr; } }

.about-panel { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: clamp(2rem, 5vw, 4rem); align-items: center; }
.about-panel .plate { aspect-ratio: 1; padding: 1rem; }
@media (max-width: 900px) { .about-panel { grid-template-columns: 1fr; } }

.genus-cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1.25rem; }
.genus-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; display: flex; flex-direction: column; text-decoration: none; color: var(--ink); transition: box-shadow .2s, transform .2s; }
.genus-card:hover { color: var(--ink); box-shadow: var(--shadow-lg); transform: translateY(-3px); }
.genus-card .plate { border: 0; border-radius: 0; aspect-ratio: 16/10; padding: .8rem; border-bottom: 1px solid var(--line); }
.genus-card__body { padding: 1.2rem 1.3rem 1.4rem; }
.genus-card h3 { font-style: italic; font-size: 1.5rem; margin: 0 0 .1rem; }
.genus-card .count { font-family: var(--mono); font-size: .75rem; color: var(--accent); letter-spacing: .06em; text-transform: uppercase; }
.genus-card p { font-size: .93rem; color: var(--ink-2); margin: .6rem 0 0; }
@media (max-width: 900px) { .genus-cards { grid-template-columns: 1fr; } }

.band { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2rem; align-items: center; background: var(--leaf); color: #e9f1ed; border-radius: calc(var(--r) + 6px); padding: clamp(1.6rem, 4vw, 2.6rem); }
.band h2 { color: #fff; margin-bottom: .4rem; }
.band p { margin: 0; color: #d4e4dc; max-width: 60ch; }
.band .btn { background: #fff; color: var(--leaf-2); border-color: #fff; }
.band .btn:hover { background: #eef5f1; }
.band .btn--ghost { background: transparent; color: #fff; border-color: rgba(255,255,255,.5); }
@media (max-width: 760px) { .band { grid-template-columns: 1fr; } }

/* Hosts */
.host-genus-card .plate { aspect-ratio: 4/3; padding: .6rem; border: 0; border-radius: 0; border-bottom: 1px solid var(--line); }
.host-row { display: grid; grid-template-columns: 180px minmax(0, 1fr); gap: 1.5rem; padding: 1.5rem 0; border-bottom: 1px solid var(--line); }
.host-row:last-child { border-bottom: 0; }
.host-row .plate { aspect-ratio: 4/3.2; padding: .4rem; cursor: zoom-in; }
.host-row h3 { font-style: italic; margin-bottom: .15rem; }
.host-row dl { display: grid; grid-template-columns: max-content 1fr; gap: .3rem 1rem; font-size: .93rem; margin: .7rem 0; }
.host-row dt { font-family: var(--mono); font-size: .68rem; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); padding-top: .2rem; }
.host-row dd { margin: 0; }
.bug-chips { display: flex; flex-wrap: wrap; gap: .5rem; }
.bug-chip { display: inline-flex; align-items: center; gap: .5rem; padding: .25rem .7rem .25rem .25rem; background: var(--surface); border: 1px solid var(--line); border-radius: 999px; text-decoration: none; color: var(--ink); font-family: var(--serif); font-style: italic; font-size: .92rem; }
.bug-chip:hover { border-color: var(--accent); color: var(--accent-2); }
.bug-chip img { width: 28px; height: 28px; border-radius: 50%; object-fit: cover; background: var(--plate); }
@media (max-width: 640px) { .host-row { grid-template-columns: 1fr; } .host-row .plate { max-width: 220px; } }

/* Library */
.lib-controls { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: .8rem; align-items: center; margin-bottom: 1.4rem; }
@media (max-width: 760px) { .lib-controls { grid-template-columns: 1fr; } }
.lib-list { list-style: none; padding: 0; margin: 0; }
.lib-item { display: grid; grid-template-columns: 64px minmax(0, 1fr); gap: 1rem; padding: 1.1rem 0; border-bottom: 1px solid var(--line); }
.lib-item__year { font-family: var(--mono); font-weight: 600; color: var(--accent); font-size: .95rem; padding-top: .1rem; }
.lib-item__text { margin: 0 0 .5rem; color: var(--ink); line-height: 1.55; }
.lib-item__meta { display: flex; flex-wrap: wrap; gap: .4rem .5rem; align-items: center; font-size: .8rem; }
.lib-item.is-featured { background: linear-gradient(90deg, var(--accent-soft), transparent 70%); border-radius: var(--r-sm); padding-inline: .7rem; }

/* People */
.people { display: grid; gap: 1.2rem; }
.person { display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: 1.2rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 1.2rem; }
.person img { width: 96px; height: 96px; object-fit: cover; border-radius: 50%; border: 1px solid var(--line); }
.person .ph { width: 96px; height: 96px; border-radius: 50%; background: var(--sunk); display: grid; place-items: center; font-family: var(--serif); font-size: 1.6rem; color: var(--muted); }
.person h3 { margin: 0 0 .1rem; font-size: 1.2rem; }
.person p { margin: .4rem 0 0; font-size: .95rem; color: var(--ink-2); }
.person .role { font-size: .85rem; color: var(--leaf-2); font-weight: 600; }

/* Videos */
.video-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.6rem; }
.video-grid figure { margin: 0; }
.video-frame { position: relative; aspect-ratio: 16/9; border-radius: var(--r); overflow: hidden; background: #111; border: 1px solid var(--line); }
.video-frame iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.video-grid h3 { font-size: 1.12rem; margin: .8rem 0 .25rem; }
.video-grid p { font-size: .93rem; color: var(--ink-2); margin: 0; }
@media (max-width: 760px) { .video-grid { grid-template-columns: 1fr; } }

/* Comparison table on "not a soapberry bug" */
.nab-table td:first-child { font-weight: 600; color: var(--ink); white-space: nowrap; }
.nab-table tr.is-sbb td { background: var(--accent-soft); }
.checklist { list-style: none; padding: 0 !important; display: grid; gap: .7rem; counter-reset: chk; }
.checklist li { counter-increment: chk; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 1rem 1.1rem 1rem 3.4rem; position: relative; margin: 0 !important; }
.checklist li::before { content: counter(chk); position: absolute; left: 1rem; top: 1rem; width: 1.7rem; height: 1.7rem; border-radius: 50%; background: var(--leaf); color: #fff; font: 600 .8rem/1.7rem var(--mono); text-align: center; }
.checklist strong { display: block; color: var(--ink); }

/* ==========================================================================
   13. Footer
   ========================================================================== */
.site-footer { background: var(--ink); color: #c9c6bf; margin-top: 0; padding: 3.5rem 0 2rem; font-size: .92rem; }
.site-footer a { color: #e9e5dc; text-decoration: none; }
.site-footer a:hover { color: #fff; text-decoration: underline; }
.footer-grid { display: grid; grid-template-columns: 1.4fr repeat(3, 1fr); gap: 2rem; }
.footer-grid h4 { color: #fff; font-family: var(--mono); font-size: .72rem; letter-spacing: .14em; text-transform: uppercase; font-weight: 500; margin-bottom: .9rem; }
.footer-grid ul { list-style: none; padding: 0; margin: 0; display: grid; gap: .45rem; }
.footer-brand .brand { color: #fff; }
.footer-brand .brand__name small { color: #aaa69e; }
.footer-brand p { margin-top: 1rem; max-width: 36ch; color: #a9a59d; }
.footer-bottom { border-top: 1px solid #3a3e3b; margin-top: 2.5rem; padding-top: 1.4rem; display: flex; flex-wrap: wrap; justify-content: space-between; gap: 1rem; color: #8f8b84; font-size: .82rem; }
@media (max-width: 860px) { .footer-grid { grid-template-columns: 1fr 1fr; } .footer-brand { grid-column: 1 / -1; } }

/* WordPress core alignment helpers */
.alignleft { float: left; margin: .3rem 1.5rem 1rem 0; }
.alignright { float: right; margin: .3rem 0 1rem 1.5rem; }
.aligncenter { margin-inline: auto; }
.wp-caption-text, .wp-element-caption { font-size: .85rem; color: var(--muted); }
.wp-block-image img { border-radius: 6px; }

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; scroll-behavior: auto !important; } }
@media print {
	.site-header, .site-footer, .filters, .sp-aside, .map-tabs, .inat-map, .btn, .pager { display: none !important; }
	body { background: #fff; font-size: 11pt; }
	.sp-layout { display: block; }
}
