@charset "UTF-8";

/* ── Brand tokens ────────────────────────────────────────────────────────────── */
:root {
  /* Palette */
  --ob:   #0F0E0C;   /* Obsidian — tooltips, darkest UI */
  --ink:  #1C1A16;   /* Ink — primary text, buttons */
  --st:   #6B6558;   /* Stone — secondary / muted text */
  --sa:   #E4E0D4;   /* Sand — decorative surfaces */
  --iv:   #F7F5F0;   /* Ivory — base background */
  --tl:   #087066;   /* Teal — brand accent, links */
  --am:   #8C5A18;   /* Amber — principle numbers */
  --brd:  #8C8880;   /* Border grey — accessible UI borders (3.5:1+) */

  /* Semantic aliases */
  --color-bg:         var(--iv);
  --color-surface:    #ffffff;
  --color-border:     var(--brd);
  --color-text:       var(--ink);
  --color-muted:      var(--st);
  --color-primary:    var(--tl);
  --color-primary-h:  #065a52;

  /* Warning */
  --color-warning-bg: #fffbeb;
  --color-warning-bd: #fcd34d;
  --color-warning-tx: #92400e;

  /* Tag */
  --color-tag-bg:  rgba(8,112,102,.08);
  --color-tag-tx:  var(--tl);

  /* Layout */
  --radius:     .75rem;
  --radius-sm:  .375rem;
  --shadow:     0 1px 3px rgba(0,0,0,.07), 0 1px 2px rgba(0,0,0,.05);
  --shadow-md:  0 4px 6px -1px rgba(0,0,0,.09), 0 2px 4px -1px rgba(0,0,0,.05);
  --max-w:      1200px;
  --header-h:   60px;

  /* Typography */
  --serif: Georgia, 'Times New Roman', serif;
  --sans:  system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --mono:  ui-monospace, 'Cascadia Code', 'SF Mono', Menlo, monospace;
  --font:      var(--sans);
  --font-mono: var(--mono);
}

/* ── Reset ──────────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; scrollbar-gutter: stable; }
body { font-family: var(--sans); background: var(--iv); color: var(--ink); line-height: 1.6; min-height: 100vh; display: flex; flex-direction: column; }
main { flex: 1; display: flex; flex-direction: column; }
a { color: var(--tl); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; display: block; }
ul { list-style: none; }

.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

/* ── Skip link ───────────────────────────────────────────────────────────────── */
.skip-link {
  position: absolute;
  top: -100%;
  left: 1rem;
  z-index: 9999;
  background: var(--ink);
  color: var(--iv);
  padding: .625rem 1.25rem;
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  font-weight: 600;
  font-size: .9375rem;
  text-decoration: none;
  transition: top .15s;
}
.skip-link:focus { top: 0; }
.skip-link:focus-visible { top: 0; outline: 2px solid var(--iv); outline-offset: 2px; }

/* ── Global focus-visible ────────────────────────────────────────────────────── */
:focus { outline: none; }
:focus-visible { box-shadow: 0 0 0 3px rgba(8,112,102,.35); outline: none; border-radius: 2px; }
.site-header :focus-visible { box-shadow: 0 0 0 3px rgba(247,245,240,.5); }

/* ── Header ─────────────────────────────────────────────────────────────────── */
.site-header {
  background: var(--ink);
  height: var(--header-h);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 1px 0 rgba(255,255,255,.08);
}
.header-inner {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 1.5rem;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.site-logo {
  display: flex;
  align-items: center;
  gap: .5rem;
  text-decoration: none;
  line-height: 1;
}
.site-logo img { height: 28px; width: auto; display: block; }
.site-logo:hover { opacity: .85; text-decoration: none; }
.site-nav { display: flex; gap: 1.5rem; }
.site-nav a { color: var(--iv); font-size: .9rem; text-decoration: none; transition: opacity .15s; opacity: .75; }
.site-nav a:hover { opacity: 1; text-decoration: none; }
.site-nav a[aria-current="page"] { opacity: 1; font-weight: 600; }

/* ── Header search (shown when body.has-results) ─────────────────────────────── */
.site-logo .logo-mark { display: none; }

.header-search-form {
  display: flex;
  flex: 1;
  max-width: 500px;
  align-items: center;
  gap: .5rem;
}
.header-search-form input[type="search"] {
  flex: 1;
  height: 36px;
  padding: 0 .75rem;
  border: 1px solid rgba(247,245,240,.25);
  border-radius: var(--radius-sm);
  background: rgba(247,245,240,.1);
  color: var(--iv);
  font-family: var(--sans);
  font-size: 1rem;
  outline: none;
  transition: border-color .15s, background .15s;
}
.header-search-form input[type="search"]::placeholder { color: rgba(247,245,240,.45); opacity: 1; }
.header-search-form input[type="search"]:focus { border-color: rgba(247,245,240,.5); background: rgba(247,245,240,.15); }
.header-search-form input[type="search"]:focus-visible { box-shadow: 0 0 0 3px rgba(247,245,240,.25); border-color: rgba(247,245,240,.5); }
.header-search-form input[type="search"]::-webkit-search-cancel-button { filter: invert(1) brightness(2); }

.header-actions {
  display: none;
  align-items: center;
  gap: .5rem;
  flex-shrink: 0;
}
.header-actions .btn-ghost {
  color: rgba(247,245,240,.85);
  border-color: rgba(247,245,240,.3);
}
.header-actions .btn-ghost:hover:not(:disabled) {
  color: var(--iv);
  border-color: rgba(247,245,240,.6);
  background: rgba(247,245,240,.08);
  text-decoration: none;
}

/* Home page: hide the header form until a search has produced results.
   On every other page it stays visible as a plain GET fallback that lands
   at /?q=…, where the search-results JS path takes over. */
body.is-home .header-search-form              { display: none; }
body.is-home.has-results .header-search-form  { display: flex; }
body.has-results .header-actions              { display: flex; }
body.has-results .hero                        { display: none; }

/* Footer ─────────────────────────────────────────────────────────────────── */
.site-footer {
  background: var(--color-surface);
  border-top: 1px solid var(--sa);
  padding: 2rem 1.5rem;
  margin-top: 4rem;
}
.footer-inner {
  max-width: var(--max-w);
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .5rem;
  text-align: center;
}
.footer-nav { display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; justify-content: center; }
.footer-nav a { color: var(--st); font-size: .875rem; text-decoration: none; }
.footer-nav a:hover { color: var(--tl); }
.footer-nav a[aria-current="page"] { color: var(--tl); font-weight: 600; }
.footer-nav .sep { color: var(--sa); }
.footer-credit { font-size: .8125rem; color: var(--st); }
.footer-credit a { color: var(--st); }
.footer-credit a:hover { color: var(--tl); }

/* ── Buttons ─────────────────────────────────────────────────────────────────── */
.btn {
  align-items: center;
  justify-content: center;
  gap: .375rem;
  padding: .5rem 1rem;
  min-height: 44px;
  border-radius: var(--radius-sm);
  font-family: var(--sans);
  font-size: .875rem;
  font-weight: 500;
  cursor: pointer;
  transition: background .15s, color .15s, border-color .15s, opacity .15s;
  border: 1px solid transparent;
  white-space: nowrap;
  text-decoration: none;
}
.btn:not([hidden]) { display: inline-flex; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--ink); color: var(--iv); border-color: var(--ink); text-transform: uppercase; letter-spacing: .04em; font-size: .8125rem; }
.btn-primary:hover:not(:disabled) { background: var(--ob); border-color: var(--ob); text-decoration: none; }
.btn-outline { background: transparent; color: var(--tl); border-color: var(--tl); }
.btn-outline:hover:not(:disabled) { background: var(--tl); color: var(--iv); text-decoration: none; }
.btn-ghost { background: transparent; color: var(--st); border-color: var(--brd); }
.btn-ghost:hover:not(:disabled) { color: var(--ink); border-color: var(--ink); background: transparent; text-decoration: none; }
.btn-sm { padding: .4rem .75rem; font-size: .75rem; min-height: 36px; }

/* ── Hero ────────────────────────────────────────────────────────────────────── */
.hero {
  background: var(--ink);
  color: var(--iv);
  padding: 5rem 1.5rem 4rem;
  text-align: center;
  flex: 1;
  min-height: 20rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  transition: padding .35s ease;
}
.hero--compact {
  flex: 0;
  min-height: 0;
  padding: 1.75rem 1.5rem;
}
.hero-inner { max-width: 680px; margin: 0 auto; width: 100%; }
.hero h1 {
  font-family: var(--serif);
  font-size: clamp(1.75rem, 4vw, 2.75rem);
  font-weight: 400;
  line-height: 1.2;
  letter-spacing: -.025em;
  margin-bottom: .75rem;
  max-height: 10rem;
  overflow: hidden;
  transition: opacity .2s ease, max-height .35s ease, margin .3s ease;
}
.hero-sub {
  font-size: 1.0625rem;
  color: var(--iv);
  opacity: .85;
  max-width: 560px;
  margin: 0 auto 2.5rem;
  max-height: 8rem;
  overflow: hidden;
  transition: opacity .2s ease, max-height .35s ease, margin .3s ease;
}
.hero--compact h1,
.hero--compact .hero-sub {
  opacity: 0;
  max-height: 0;
  margin-bottom: 0;
}

/* ── Search form ─────────────────────────────────────────────────────────────── */
.search-row {
  display: flex;
  gap: .5rem;
  max-width: 600px;
  margin: 0 auto .75rem;
}
.search-row input[type="search"] {
  flex: 1;
  padding: .75rem 1rem;
  border: 2px solid rgba(247,245,240,.2);
  border-radius: var(--radius-sm);
  background: rgba(247,245,240,.08);
  color: var(--iv);
  font-family: var(--sans);
  font-size: 1rem;
  outline: none;
  transition: border-color .15s, background .15s;
}
.search-row input[type="search"]::placeholder { color: rgba(247,245,240,.55); opacity: 1; }
.search-row input[type="search"]:focus { border-color: rgba(247,245,240,.6); background: rgba(247,245,240,.12); }
.search-row input[type="search"]:focus-visible { box-shadow: 0 0 0 3px rgba(247,245,240,.25); border-color: rgba(247,245,240,.6); }
.search-row input[type="search"]::-webkit-search-cancel-button { filter: invert(1) brightness(2); }
/* ── Results toolbar ─────────────────────────────────────────────────────────── */
.results-section { max-width: var(--max-w); width: 100%; margin: 2rem auto; padding: 0 1.5rem; }
.results-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: .75rem;
  margin-bottom: 1.25rem;
}
.toolbar-right { display: flex; align-items: center; gap: .625rem; flex-wrap: wrap; }
.toolbar-limit { display: flex; align-items: center; gap: .375rem; font-size: .8125rem; color: var(--st); }
.toolbar-limit select {
  background: var(--iv);
  border: 1px solid var(--brd);
  border-radius: var(--radius-sm);
  color: var(--ink);
  font-family: var(--sans);
  font-size: .8125rem;
  padding: .25rem .5rem;
  cursor: pointer;
  min-height: 36px;
}
.toolbar-limit select:hover { border-color: var(--ink); }
.results-summary { font-size: .875rem; color: var(--st); }
#results-summary:focus { outline: none; }
.api-status {
  display: flex;
  align-items: center;
  gap: .3rem;
  font-size: .6875rem;
  color: var(--st);
  letter-spacing: .02em;
}
.api-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  margin-left: .2rem;
}
.api-dot--ok      { background: var(--tl); }
.api-dot--warn    { background: var(--am); }
.api-dot--err     { background: #a33; }
.api-dot--pending { background: var(--tl); animation: api-dot-pulse 1.4s ease-in-out infinite; }
.api-partial      { color: var(--st); font-style: italic; }

/* Phase-2 enrichment in progress: make the pill more prominent so users see
   that something is still happening, but without per-card skeletons (many
   cards legitimately have no Wikidata, so empty placeholders would mislead). */
.api-status--enriching {
  background: rgba(8, 112, 102, 0.08);
  border: 1px solid rgba(8, 112, 102, 0.25);
  border-radius: var(--radius-sm);
  padding: .25rem .5rem;
  color: var(--ink);
  transition: background .25s ease, border-color .25s ease;
}
.api-status--enriching .api-partial { color: var(--tl); font-weight: 500; }
@media (prefers-reduced-motion: reduce) {
  .api-status--enriching { transition: none; }
}

@keyframes api-dot-pulse {
  0%, 100% { opacity: .35; }
  50%      { opacity: 1;   }
}
@media (prefers-reduced-motion: reduce) {
  .api-dot--pending { animation: none; opacity: .65; }
}

/* ── Banner ──────────────────────────────────────────────────────────────────── */
.banner {
  border-radius: var(--radius-sm);
  padding: .75rem 1rem;
  font-size: .875rem;
  margin-bottom: 1rem;
}
.banner-warning:empty { display: none; }
.banner-warning:not(:empty) { display: block; background: var(--color-warning-bg); border: 1px solid var(--color-warning-bd); color: var(--color-warning-tx); }

/* ── Results list ────────────────────────────────────────────────────────────── */
.results-grid {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  padding: 0;
}

/* ── Entity card ─────────────────────────────────────────────────────────────── */
.entity-card {
  background: var(--color-surface);
  border: 1px solid var(--sa);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  transition: box-shadow .15s, transform .15s;
  display: flex;
  flex-direction: column;
  width: 100%;
}
.entity-card:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }
.card-image { width: 100%; height: 160px; object-fit: cover; background: var(--iv); border-radius: var(--radius) var(--radius) 0 0; }

/* ── Technical view — card header ────────────────────────────────────────────── */
.card-tech-header {
  padding: 18px 20px 14px;
  border-bottom: 1px solid var(--sa);
}
.card-tech-name {
  font-family: var(--serif);
  font-size: 1.25rem;
  font-weight: 400;
  letter-spacing: -.02em;
  color: var(--ink);
}
.card-tech-sub {
  font-size: .6875rem;
  text-transform: uppercase;
  letter-spacing: .09em;
  color: var(--st);
  margin-top: 3px;
}
.card-tech-desc-head {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--sa);
  margin-bottom: 5px;
}
.cdesc-label {
  font-size: 9px;
  letter-spacing: .15em;
  text-transform: uppercase;
  color: var(--st);
}
.wiki-link {
  font-size: .625rem;
  color: var(--tl);
  text-decoration: none;
  margin-left: auto;
}
.wiki-link:hover { text-decoration: underline; }
.card-tech-desc {
  font-size: .8125rem;
  color: var(--st);
  line-height: 1.55;
}

/* ── Technical view — sections ───────────────────────────────────────────────── */
.card-sec {
  padding: 10px 20px;
  border-bottom: 1px solid var(--sa);
}
.card-sec:last-child { border-bottom: none; }
.sec-hd {
  font-size: 9px;
  letter-spacing: .15em;
  text-transform: uppercase;
  color: var(--st);
  display: flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 8px;
}

/* ── Type chain ──────────────────────────────────────────────────────────────── */
.type-chain { display: flex; flex-wrap: wrap; align-items: center; gap: 5px; }
.type-chip {
  font-size: .6875rem;
  padding: 3px 9px;
  border: 1px solid var(--sa);
  border-radius: 3px;
  color: var(--st);
  background: var(--iv);
}
.type-chip-leaf {
  border-color: rgba(8,112,102,.45);
  color: var(--tl);
  background: rgba(8,112,102,.05);
  font-weight: 600;
}
.type-arr { color: var(--sa); font-size: .875rem; user-select: none; }

/* ── Data rows ───────────────────────────────────────────────────────────────── */
.data-row {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 5px 0;
  border-bottom: 1px solid var(--sa);
}
.data-row:last-child { border-bottom: none; }
.data-key {
  font-size: .6875rem;
  color: var(--st);
  min-width: 110px;
  flex-shrink: 0;
}
.data-val {
  font-family: var(--mono);
  font-size: .6875rem;
  color: var(--ink);
  flex: 1;
  word-break: break-all;
}
.data-val-plain {
  font-family: var(--sans);
  font-size: .75rem;
  color: var(--ink);
  flex: 1;
}
.data-val-muted {
  font-family: var(--sans);
  font-size: .6875rem;
  color: var(--st);
  font-style: italic;
  flex: 1;
}
.data-link { color: var(--tl); text-decoration: none; }
.data-link:hover { text-decoration: underline; }
.data-badge {
  margin-left: auto;
  flex-shrink: 0;
  display: flex;
  gap: 3px;
  padding-left: 6px;
  align-items: center;
}

/* ── Confidence bar ──────────────────────────────────────────────────────────── */
.cbar-row { flex: 1; display: flex; align-items: center; gap: 8px; }
.cval { font-family: var(--mono); font-size: .6875rem; color: var(--ink); min-width: 38px; }
.cbar-w { flex: 1; height: 3px; background: var(--sa); border-radius: 2px; }
.cbar { height: 3px; background: var(--tl); border-radius: 2px; }
.cnote { font-size: .625rem; color: var(--st); white-space: nowrap; }

/* ── Source badge tooltips ───────────────────────────────────────────────────── */
.badge[data-tip] { cursor: help; position: relative; }
.badge[data-tip]::after {
  content: attr(data-tip);
  position: absolute;
  bottom: calc(100% + 5px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--ob);
  color: var(--iv);
  font-size: .625rem;
  font-family: var(--sans);
  font-weight: 400;
  letter-spacing: 0;
  padding: 5px 9px;
  border-radius: 3px;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity .15s;
  z-index: 20;
}
.badge[data-tip]:hover::after,
.badge[data-tip]:focus::after { opacity: 1; }

/* ── Card actions ────────────────────────────────────────────────────────────── */
.card-actions {
  padding: .75rem 1.25rem;
  border-top: 1px solid var(--sa);
  display: flex;
  gap: .5rem;
  flex-wrap: wrap;
  background: var(--iv);
}

/* ── Teal outline button (KG action) ─────────────────────────────────────────── */
.btn-teal {
  background: transparent;
  color: var(--tl);
  border-color: rgba(8,112,102,.45);
}
.btn-teal:hover:not(:disabled) {
  background: rgba(8,112,102,.06);
  border-color: var(--tl);
  text-decoration: none;
}

/* ── Amber outline button (Wikidata action) ──────────────────────────────────── */
.btn-am {
  background: transparent;
  color: var(--am);
  border-color: rgba(140,90,24,.45);
}
.btn-am:hover:not(:disabled) {
  background: rgba(140,90,24,.06);
  border-color: var(--am);
  text-decoration: none;
}

/* ── Results legend ──────────────────────────────────────────────────────────── */
.results-legend {
  display: flex;
  gap: .75rem;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 1rem;
  padding: .375rem 0;
  border-top: 1px solid var(--sa);
}
.legend-item {
  display: flex;
  align-items: center;
  gap: .3rem;
  font-size: .6875rem;
  color: var(--st);
}

/* ── SPARQL dialog ───────────────────────────────────────────────────────────── */
.sparql-dialog {
  border: 1px solid var(--sa);
  border-radius: var(--radius);
  padding: 0;
  max-width: min(860px, 95vw);
  max-height: calc(100vh - 2rem);
  max-height: calc(100dvh - 2rem);
  overflow-y: auto;
  box-shadow: var(--shadow-md);
  background: var(--color-surface);
  /* The global margin:0 reset kills the UA auto-centering for showModal(); restore it */
  position: fixed;
  inset: 0;
  margin: auto;
}
.sparql-dialog::backdrop { background: rgba(28,26,22,.5); }
.sparql-dialog-inner { padding: 1.25rem; }
.sparql-dialog-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: .875rem;
}
.sparql-dialog-title {
  font-family: var(--serif);
  font-size: 1.125rem;
  font-weight: 400;
  color: var(--ink);
}
.sparql-query-pre {
  font-family: var(--mono);
  font-size: .75rem;
  color: var(--ink);
  background: var(--iv);
  border: 1px solid var(--sa);
  border-radius: var(--radius-sm);
  padding: .875rem 1rem;
  overflow-x: auto;
  white-space: pre;
  margin-bottom: .875rem;
  line-height: 1.6;
  max-height: 60vh;
  overflow-y: auto;
}
.sparql-dialog-actions { display: flex; gap: .5rem; flex-wrap: wrap; }

/* ── Source badges ───────────────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
  padding: .1rem .35rem;
  border-radius: .2rem;
  line-height: 1.4;
  cursor: default;
}
.badge-kg  { background: rgba(8,112,102,.1);  color: var(--tl);  border: 1px solid rgba(8,112,102,.3); }
.badge-wd  { background: rgba(140,90,24,.1);  color: var(--am);  border: 1px solid rgba(140,90,24,.3); }
.badge-fx  { background: rgba(107,101,88,.1); color: var(--st);  border: 1px solid rgba(107,101,88,.3); }


@media (max-width: 1400px) {
	.badge[data-tip]::after {
		white-space: unset;
	}
}

/* ── Empty state ─────────────────────────────────────────────────────────────── */
.empty-state {
  grid-column: 1 / -1;
  padding: 3rem 1.5rem;
  text-align: center;
  color: var(--st);
  font-size: .9375rem;
  list-style: none;
}
.empty-state strong { color: var(--ink); font-weight: 600; }

/* ── Pagination ──────────────────────────────────────────────────────────────── */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .375rem;
  margin-top: 2rem;
  flex-wrap: wrap;
}
.pag-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.25rem;
  height: 2.25rem;
  padding: 0 .5rem;
  border: 1px solid var(--brd);
  border-radius: var(--radius-sm);
  background: var(--iv);
  color: var(--ink);
  font-family: var(--sans);
  font-size: .875rem;
  font-weight: 500;
  cursor: pointer;
  transition: border-color .15s, background .15s, color .15s;
  line-height: 1;
}
.pag-btn:hover:not(:disabled):not([aria-current]) {
  border-color: var(--tl);
  color: var(--tl);
}
.pag-btn[aria-current="page"] {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--iv);
  cursor: default;
}
.pag-btn:disabled {
  opacity: .35;
  cursor: default;
}
.pag-ellipsis {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.25rem;
  height: 2.25rem;
  color: var(--st);
  font-size: .875rem;
  user-select: none;
}

/* ── Loading overlay ─────────────────────────────────────────────────────────── */
.loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(247,245,240,.88);
  backdrop-filter: blur(2px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  font-size: .9375rem;
  color: var(--st);
  z-index: 200;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity .18s, visibility .18s;
}
.loading-overlay.is-loading {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}
.spinner {
  width: 32px; height: 32px;
  border: 3px solid var(--sa);
  border-top-color: var(--tl);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Toast ───────────────────────────────────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%) translateY(1rem);
  background: var(--ink);
  color: var(--iv);
  padding: .625rem 1.25rem;
  border-radius: var(--radius-sm);
  font-size: .875rem;
  box-shadow: var(--shadow-md);
  z-index: 300;
  opacity: 0;
  transition: opacity .2s, transform .2s;
  pointer-events: none;
  white-space: normal;
  max-width: calc(100vw - 2rem);
}
.toast--error { background: #6b1a1a; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ── Static page prose ───────────────────────────────────────────────────────── */
.page-content { width:100%; max-width: 740px; margin: 3rem auto; padding: 0 1.5rem; }
.prose .page-header { margin-bottom: 2.5rem; }
.prose h1 { font-family: var(--serif); font-size: clamp(1.5rem, 3vw, 2.25rem); font-weight: 400; letter-spacing: -.025em; margin-bottom: .5rem; color: var(--ink); }
.prose .page-meta { color: var(--st); font-size: .9rem; }
.prose section { margin-bottom: 2rem; }
.prose h2 { font-size: 1.0625rem; font-weight: 600; margin-bottom: .6rem; color: var(--ink); letter-spacing: -.01em; }
.prose p { font-size: .9375rem; color: var(--ink); margin-bottom: .75rem; line-height: 1.75; }
.prose ul { list-style: disc; padding-left: 1.5rem; margin-bottom: .75rem; }
.prose li { font-size: .9375rem; color: var(--ink); margin-bottom: .35rem; line-height: 1.7; }
.prose strong { font-weight: 600; color: var(--ink); }
.prose a { color: var(--tl); }
.prose a:hover { text-decoration: underline; }

/* ── Responsive ──────────────────────────────────────────────────────────────── */
@media (max-width: 640px) {
  .hero { padding: 3rem 1.25rem 2.5rem; }
  .hero--compact { padding: 1.25rem; }
  .search-row { flex-direction: column; }
  .search-row .btn { width: 100%; }
  .results-toolbar { flex-direction: column; align-items: flex-start; }
  .toolbar-left { display: flex; flex-direction: column; gap: .25rem; }
  .toolbar-right { width: 100%; justify-content: space-between; gap: .375rem; flex-wrap: wrap; }
  .site-nav { gap: 1rem; }
  .site-nav a { font-size: .8125rem; }
  .card-actions { flex-direction: column; }
  .card-actions .btn { width: 100%; justify-content: center; }

  /* On mobile: collapse logo to mark and use toolbar for Share/New Search */
  body.has-results .logo-full  { display: none; }
  body.has-results .logo-mark  { display: block; }
  body.has-results .header-actions { display: none; }
  .header-search-form { max-width: none; }
}

@media (min-width: 641px) {
  /* Hide toolbar Share/New Search on desktop — they move to the header */
  body.has-results .toolbar-actions { display: none; }
}

@media (max-width: 380px) {
  .toolbar-right { flex-direction: column; align-items: flex-start; }
}

@media (max-width: 400px) {
  .site-nav { gap: .5rem; }
  .site-nav a { font-size: .75rem; }
}

/* ── Reduced motion ──────────────────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}

/* ── Cache Status admin page ─────────────────────────────────────────────────── */
.cs-page-header { margin-bottom: 2rem; }
.cs-page-header h1 {
  font-family: var(--serif);
  font-size: clamp(1.5rem, 3vw, 2.25rem);
  font-weight: 400;
  letter-spacing: -.025em;
  color: var(--ink);
}
.cs-section { margin-bottom: 2.5rem; }
.cs-section-title {
  font-size: 1rem; font-weight: 600; color: var(--ink);
  letter-spacing: -.01em; margin-bottom: .875rem;
  display: flex; align-items: center; gap: .75rem;
}
.cs-count { font-weight: 400; font-size: .8125rem; color: var(--st); }
.cs-table { width: 100%; border-collapse: collapse; font-size: .875rem; }
.cs-table th {
  text-align: left; padding: .5rem .75rem;
  background: var(--sa); color: var(--st);
  font-weight: 500; font-size: .75rem;
  letter-spacing: .02em; text-transform: uppercase;
  border-bottom: 1px solid var(--brd);
}
.cs-table td {
  padding: .5rem .75rem; border-bottom: 1px solid var(--sa);
  vertical-align: middle; color: var(--ink);
}
.cs-table tr:last-child td { border-bottom: none; }
.cs-table--searches td:first-child { max-width: 320px; word-break: break-word; }
.cs-badge {
  display: inline-block; padding: .1875rem .5rem;
  border-radius: var(--radius-sm); font-size: .75rem;
  font-weight: 500; background: var(--sa); color: var(--st);
}
.cs-badge--ok   { background: rgba(8,112,102,.12); color: #065a52; }
.cs-badge--warn { background: rgba(140,90,24,.12);  color: var(--am); }
.cs-badge--err  { background: rgba(163,51,51,.12);  color: #a33; }
.cs-num   { text-align: right; font-variant-numeric: tabular-nums; }
.cs-muted { color: var(--st); }
.cs-empty { font-size: .875rem; color: var(--st); }
.cs-pagination { display: flex; align-items: center; gap: .75rem; margin-top: 1rem; }
.cs-page-num  { font-size: .8125rem; color: var(--st); }
.cs-page-info { font-size: .8125rem; color: var(--st); margin-bottom: .75rem; }
.cs-flash {
  background: rgba(8,112,102,.1); border: 1px solid rgba(8,112,102,.25);
  border-radius: var(--radius-sm); color: #065a52;
  padding: .625rem 1rem; font-size: .875rem; margin-bottom: 1.5rem;
}

@media (max-width: 640px) {
  .cs-section {
	  max-width:100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .cs-table th,
  .cs-table td {
    padding: .375rem .5rem;
    white-space: nowrap;
  }
  .cs-table--searches td:first-child {
    white-space: normal;
    max-width: 140px;
  }
}
