/* Junicode 2 (OFL, Peter S. Baker): the machine readings write letters above
   letters as combining characters (U+0363–036F) and use MUFI signs that Source
   Serif and the Google subsets lack. Loaded only when a page needs a glyph. */
@font-face {
  font-family: "Junicode";
  src: url("https://cdn.jsdelivr.net/gh/psb1558/Junicode-font@v2.226/webfiles/JunicodeVF-Roman.woff2") format("woff2");
  font-weight: 300 700;
  font-display: swap;
}
:root {
  --bg: #fbfaf7;
  --panel: #ffffff;
  --ink: #1f2328;
  --muted: #5f6670;
  --line: #e2ded6;
  --accent: #121212;
  --brand: #e7302a;          /* UniBE red */
  --chip: #f1eee8;
  --chip-on: #1f2328;
  --chip-on-ink: #ffffff;
  --per: #c0392b;  --per-bg: #fbe9e7;
  --place: #1e7a45; --place-bg: #e6f4ec;
  --org: #6c3fb5;  --org-bg: #efe8fa;
  --date: #9a6700; --date-bg: #fff4d6;
  --ins: #0a6b2b;  --ins-bg: #dcf5e3;
  --del: #a3171b;  --del-bg: #fde2e1;
  --warn-bg: #fff4d6; --warn-ink: #6b4a00;
  --text-font: "Source Serif 4", "Junicode", Georgia, serif;  /* Junicode: letters written above (o\0364, u\0366), MUFI signs */
  --ui-font: "Source Sans 3", system-ui, -apple-system, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #15171a; --panel: #1c1f23; --ink: #e8e6e1; --muted: #a2a8b0; --line: #30353b;
    --accent: #ffffff; --chip: #262a2f; --chip-on: #e8e6e1; --chip-on-ink: #15171a;
    --per: #ff8a7a; --per-bg: #3a1f1c; --place: #6fd49a; --place-bg: #17321f;
    --org: #c3a6ff; --org-bg: #2a2140; --date: #f0c55a; --date-bg: #3a3014;
    --ins: #7ee2a0; --ins-bg: #173a24; --del: #ff9d97; --del-bg: #431c1b;
    --warn-bg: #3a3014; --warn-ink: #f0d58a;
  }
}
:root[data-theme="dark"] {
  --bg: #15171a; --panel: #1c1f23; --ink: #e8e6e1; --muted: #a2a8b0; --line: #30353b;
  --accent: #ffffff; --chip: #262a2f; --chip-on: #e8e6e1; --chip-on-ink: #15171a;
  --per: #ff8a7a; --per-bg: #3a1f1c; --place: #6fd49a; --place-bg: #17321f;
  --org: #c3a6ff; --org-bg: #2a2140; --date: #f0c55a; --date-bg: #3a3014;
  --ins: #7ee2a0; --ins-bg: #173a24; --del: #ff9d97; --del-bg: #431c1b;
  --warn-bg: #3a3014; --warn-ink: #f0d58a;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); font: 16px/1.5 var(--ui-font); }
a { color: inherit; }
button { font: inherit; color: inherit; }

.top {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 10px 20px; border-bottom: 3px solid var(--brand); background: var(--panel);
  position: sticky; top: 0; z-index: 10;
}
.brand { font-weight: 700; text-decoration: none; font-size: 1.05rem; }
.brand span { font-weight: 400; color: var(--muted); }
.top nav { display: flex; gap: 4px; }
.top nav a { text-decoration: none; padding: 4px 10px; border-radius: 6px; color: var(--muted); }
.top nav a.on { color: var(--ink); background: var(--chip); font-weight: 600; }

main { padding: 20px; max-width: 1600px; margin: 0 auto; }
.loading { color: var(--muted); }
h1 { font-size: 1.6rem; margin: 0 0 4px; line-height: 1.25; }
h2 { font-size: 1.15rem; margin: 24px 0 8px; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }

/* letters list */
.intro { max-width: 70ch; margin-bottom: 20px; }
.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 12px; }
.filters input, .filters select {
  font: inherit; padding: 6px 10px; border: 1px solid var(--line); border-radius: 6px;
  background: var(--panel); color: var(--ink); min-width: 0;
}
.filters input { flex: 1 1 260px; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; }
.seg button { font: inherit; border: 0; border-left: 1px solid var(--line); background: var(--panel); color: var(--ink); padding: 6px 10px; cursor: pointer; }
.seg button:first-child { border-left: 0; }
.seg button .n { color: var(--muted); font-size: .85em; }
.seg button.on { background: var(--chip-on); color: var(--chip-on-ink); font-weight: 600; }
.seg button.on .n { color: inherit; }
.yrange { flex: 1 1 240px; min-width: 200px; max-width: 420px; }
.yr-head { display: flex; justify-content: space-between; font-size: .8rem; color: var(--muted); line-height: 1.2; }
.yr-head b { color: var(--ink); font-variant-numeric: tabular-nums; }
.yr-track { position: relative; height: 34px; }
.yr-hist { position: absolute; left: 8px; right: 8px; top: 2px; bottom: 11px; display: flex; align-items: flex-end; gap: 1px; }
.yr-hist i { flex: 1; background: var(--line); border-radius: 1px 1px 0 0; }
.yr-hist i.in { background: var(--muted); }
.yr-track input[type=range] {
  position: absolute; left: 0; right: 0; bottom: 0; width: 100%; height: 18px; margin: 0;
  background: none; border: 0; border-radius: 0; padding: 0; pointer-events: none; -webkit-appearance: none; appearance: none; z-index: 2;
}
@media (max-width: 640px) { .yrange { flex-basis: 100%; max-width: none; } }
.yr-track input[type=range]::-webkit-slider-runnable-track { height: 2px; background: var(--line); }
.yr-track input[type=range]::-moz-range-track { height: 2px; background: var(--line); }
.yr-track input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none; pointer-events: auto; width: 16px; height: 16px; margin-top: -7px;
  border-radius: 50%; background: var(--chip-on); border: 2px solid var(--panel); box-shadow: 0 0 0 1px var(--chip-on); cursor: pointer;
}
.yr-track input[type=range]::-moz-range-thumb {
  pointer-events: auto; width: 12px; height: 12px; border-radius: 50%;
  background: var(--chip-on); border: 2px solid var(--panel); box-shadow: 0 0 0 1px var(--chip-on); cursor: pointer;
}
.yr-track input[type=range]:focus-visible::-webkit-slider-thumb { outline: 2px solid var(--chip-on); outline-offset: 2px; }
.list { border-top: 1px solid var(--line); }
.row {
  display: grid; grid-template-columns: 5.5rem 7rem 1fr; gap: 12px; padding: 10px 4px;
  border-bottom: 1px solid var(--line); text-decoration: none;
}
.row:hover { background: var(--chip); }
.row .num { color: var(--muted); font-variant-numeric: tabular-nums; }
.row .date { font-variant-numeric: tabular-nums; }
.row .who { font-weight: 600; }
.row .reg { color: var(--muted); font-size: .9rem; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
@media (max-width: 640px) {
  .row { grid-template-columns: 1fr; gap: 2px; }
}

/* letter view */
.letter { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 20px; align-items: start; }
@media (max-width: 960px) { .letter { grid-template-columns: 1fr; } }
.pane { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 16px 18px; min-width: 0; }
.imgpane { position: sticky; top: 64px; padding: 0; overflow: hidden; }
@media (max-width: 960px) { .imgpane { position: static; } }
#osd { width: 100%; height: calc(100vh - 140px); min-height: 360px; background: #2b2b2b; }
@media (max-width: 960px) { #osd { height: 60vh; } }
.imgbar { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 8px 12px; border-top: 1px solid var(--line); font-size: .875rem; }

.lnav { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 10px; flex-wrap: wrap; }
.lnav a { text-decoration: none; color: var(--muted); font-size: .9rem; }
.meta { margin: 6px 0 10px; }
.meta .parties { font-weight: 600; }
details.regest { margin: 8px 0 12px; }
details.regest summary { cursor: pointer; color: var(--muted); font-size: .9rem; }
.kw { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.kw span, .kw a { font-size: .8rem; background: var(--chip); padding: 1px 8px; border-radius: 99px; color: var(--ink); text-decoration: none; }
.kw a:hover { background: var(--chip-on); color: var(--chip-on-ink); }
.kw a .n { background: none; padding: 0; color: var(--muted); font-variant-numeric: tabular-nums; }
.kw a:hover .n { color: inherit; }

.pages { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin: 12px 0; }
.pages .lbl { font-size: .85rem; color: var(--muted); margin-right: 4px; }
.pg { border: 1px solid var(--line); background: var(--panel); border-radius: 6px; padding: 2px 10px; cursor: pointer; }
.pg.on { background: var(--chip-on); color: var(--chip-on-ink); border-color: var(--chip-on); }

.readers { display: flex; flex-direction: column; gap: 4px; margin: 4px 0 12px; }
.rd {
  display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 8px; text-align: left;
  border: 1px solid transparent; background: var(--chip); border-radius: 8px; padding: 6px 10px; cursor: pointer;
}
.rd .k { font-size: .75rem; color: var(--muted); display: block; }
.rd.on { background: var(--chip-on); color: var(--chip-on-ink); }
.rd.on .k { color: inherit; opacity: .75; }
.rd[disabled] { opacity: .45; cursor: not-allowed; }
.cer { font-variant-numeric: tabular-nums; font-size: .85rem; padding: 1px 8px; border-radius: 99px; background: var(--panel); color: var(--ink); white-space: nowrap; }
.rd.on .cer { background: rgba(255,255,255,.18); color: inherit; }

.viewmode { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 10px 0; font-size: .9rem; }
.viewmode label { font-weight: 600; }
.viewmode select { font: inherit; padding: 4px 8px; border: 1px solid var(--line, #ccc); border-radius: 6px; background: var(--bg, #fff); color: inherit; }

.about-reader { font-size: .875rem; color: var(--muted); margin: 0 0 8px; }
.fn-mark { font-size: .7em; margin-left: 1px; }
.footnote { font-size: .8rem; color: var(--muted); margin-top: 4px; }
.footnote a { color: inherit; }
.caveat { font-size: .875rem; background: var(--warn-bg); color: var(--warn-ink); padding: 6px 10px; border-radius: 6px; margin: 0 0 8px; }

.text {
  font: 1.06rem/1.85 var(--text-font); white-space: normal; overflow-wrap: anywhere;
  border-top: 1px solid var(--line); padding-top: 10px;
}
.text .line { display: block; padding-left: 2.6em; text-indent: -2.6em; }
.text .ln { display: inline-block; width: 2.2em; margin-right: .4em; text-align: right; color: var(--muted); font: .75rem var(--ui-font); text-indent: 0; user-select: none; }
.text.edition .ln { width: 2.2em; }
.text .hy { color: var(--muted); }
.text .note { color: var(--brand); cursor: help; font: 600 .7rem var(--ui-font); }
.text .choice { border-bottom: 1px dotted var(--muted); cursor: help; }
.text .supplied::before { content: "["; } .text .supplied::after { content: "]"; }
.text .unclear { color: var(--muted); font-style: italic; }
.text .ex { font-style: italic; }
.text .gap { color: var(--muted); }
.empty { color: var(--muted); font-style: italic; }

.text.ents .ent { border-radius: 3px; padding: 0 2px; cursor: help; }
.text.ents .ent.per { background: var(--per-bg); box-shadow: inset 0 -2px var(--per); }
.text.ents .ent.place { background: var(--place-bg); box-shadow: inset 0 -2px var(--place); }
.text.ents .ent.org { background: var(--org-bg); box-shadow: inset 0 -2px var(--org); }
.text.ents .ent.date { background: var(--date-bg); box-shadow: inset 0 -2px var(--date); }
.legend { display: flex; gap: 10px; flex-wrap: wrap; font-size: .8rem; color: var(--muted); margin: 0 0 8px; }
.legend i { display: inline-block; width: .8em; height: .8em; border-radius: 2px; margin-right: 4px; vertical-align: -1px; }
.legend .per i { background: var(--per); } .legend .place i { background: var(--place); }
.legend .org i { background: var(--org); } .legend .date i { background: var(--date); }

.text ins { text-decoration: none; background: var(--ins-bg); color: var(--ins); border-radius: 2px; }
.text del { text-decoration: line-through; background: var(--del-bg); color: var(--del); border-radius: 2px; }

.tip {
  position: fixed; z-index: 50; max-width: 320px; background: var(--panel); color: var(--ink);
  border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; font-size: .85rem;
  box-shadow: 0 6px 24px rgba(0,0,0,.18); pointer-events: auto;
}
.tip b { display: block; }
.tip a { display: inline-block; margin-right: 8px; }

/* readers table */
table.scores { border-collapse: collapse; width: 100%; font-size: .95rem; }
table.scores th, table.scores td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.scores th { font-size: .8rem; color: var(--muted); font-weight: 600; }
table.scores td.n { font-variant-numeric: tabular-nums; white-space: nowrap; }
.bar { height: 8px; background: var(--chip); border-radius: 4px; overflow: hidden; min-width: 80px; margin-top: 6px; }
.bar i { display: block; height: 100%; background: var(--ink); }
.scroll { overflow-x: auto; }
.prose { max-width: 72ch; }
.prose li { margin: 4px 0; }
footer.foot { color: var(--muted); font-size: .8rem; padding: 24px 20px; text-align: center; }
@media (max-width: 640px) { main { padding: 16px; } .top { padding: 10px 16px; } .brand span { display: none; } }
.noimg { color: #ddd; padding: 24px; text-align: center; margin-top: 30%; }
details.regest.draft { border-left: 3px solid var(--date); padding-left: 10px; }

/* registers and map */
.badge { font-size: .75rem; font-weight: 600; padding: 1px 6px; border-radius: 999px; background: var(--warn-bg); color: var(--warn-ink); white-space: nowrap; }
.list.reg .row { grid-template-columns: 6.5rem minmax(0, 1fr) minmax(0, 42%); position: relative; align-items: start; }
.list.reg .row .reg { display: block; -webkit-line-clamp: unset; }
.rrow .who.go { color: inherit; text-decoration: none; }
.rrow .who.go::after { content: ""; position: absolute; inset: 0; }   /* the whole row opens the entry */
.rrow .who.go:focus-visible { outline: none; }
.rrow:has(.who.go:focus-visible) { outline: 2px solid var(--chip-on); outline-offset: -2px; }
.rrow .badge { position: relative; }
.rrow .ext { position: relative; z-index: 1; display: flex; flex-wrap: wrap; gap: 4px; justify-content: flex-end; align-content: flex-start; }
.rrow .ext a { font-size: .75rem; padding: 0 8px; border-radius: 999px; border: 1px solid var(--line); background: var(--panel); color: var(--ink); text-decoration: none; white-space: nowrap; }
.rrow .ext a:hover { background: var(--chip-on); color: var(--chip-on-ink); }
.rrow .ext a.more { background: transparent; color: var(--muted); }
.rrow .ext a.added, .entry .links a.added { border: 1px dashed var(--muted); }
.ext a.added sup, .links a.added sup { font-size: .7em; margin-left: 1px; color: var(--muted); }
@media (max-width: 900px) {
  .list.reg .row { grid-template-columns: 6.5rem minmax(0, 1fr); }
  .rrow .ext { grid-column: 2; justify-content: flex-start; }
}
@media (max-width: 640px) {
  .list.reg .row { grid-template-columns: 1fr; }
  .rrow .ext { grid-column: 1; }
}
.entry { max-width: 1000px; }
.entry .links a, .chips a { display: inline-block; margin: 0 6px 6px 0; padding: 2px 10px; border-radius: 999px; background: var(--chip); text-decoration: none; font-size: .9rem; }
.note-box { background: var(--warn-bg); color: var(--warn-ink); padding: 8px 12px; border-radius: 6px; }
.emap { height: 320px; border: 1px solid var(--line); border-radius: 8px; margin: 12px 0 20px; }
.bigmap { height: min(70vh, 720px); border: 1px solid var(--line); border-radius: 8px; margin: 12px 0 24px; }
.leaflet-container { font: inherit; background: var(--chip); }
path.lf-place { stroke: var(--place); fill: var(--place); cursor: pointer; }
path.lf-place.on { stroke: var(--brand); fill: var(--brand); stroke-width: 3; fill-opacity: .6; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .leaflet-tile-pane { filter: invert(1) hue-rotate(180deg) brightness(.85) contrast(.9); } }
:root[data-theme="dark"] .leaflet-tile-pane { filter: invert(1) hue-rotate(180deg) brightness(.85) contrast(.9); }
@media (max-width: 700px) { .top nav { flex-wrap: wrap; } .top nav a { padding: 4px 6px; } }
.badge.auto { background: var(--chip); color: var(--muted); }
/* language switch */
.top nav { align-items: center; }
.lang { display: inline-flex; margin-left: 8px; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; }
.lang button { border: 0; background: transparent; color: var(--muted); padding: 3px 8px; font-size: .85rem; cursor: pointer; }
.lang button.on { background: var(--chip-on); color: var(--chip-on-ink); font-weight: 600; }
/* search */
.sbar { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; margin: 12px 0 16px; }
.sbar #sq { flex: 1 1 320px; min-width: 0; padding: 8px 10px; font: inherit; border: 1px solid var(--line); border-radius: 6px; background: var(--panel); color: var(--ink); }
.sbar .yrange { flex: 1 1 220px; }
.sbar select { padding: 6px 8px; font: inherit; border: 1px solid var(--line); border-radius: 6px; background: var(--panel); color: var(--ink); }
.linkish { border: 0; background: none; padding: 0; color: var(--ink); text-decoration: underline; cursor: pointer; font-size: .9rem; }
.search { display: grid; grid-template-columns: minmax(220px, 300px) 1fr; gap: 24px; align-items: start; }
.facets { position: sticky; top: 64px; max-height: calc(100vh - 80px); overflow: auto; padding-right: 6px; }
.facet { border-bottom: 1px solid var(--line); padding: 6px 0; }
.facet summary { cursor: pointer; font-weight: 600; padding: 4px 0; }
.facet ul { list-style: none; margin: 4px 0; padding: 0; }
.facet li label { display: flex; gap: 6px; align-items: baseline; padding: 2px 0; cursor: pointer; font-size: .92rem; }
.facet li label.zero { opacity: .45; }
.facet .fl { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.facet .fc { color: var(--muted); font-variant-numeric: tabular-nums; font-size: .85rem; }
.facet .ffilter { width: 100%; margin: 4px 0; padding: 4px 8px; font: inherit; font-size: .9rem; border: 1px solid var(--line); border-radius: 6px; background: var(--panel); color: var(--ink); }
.srow .who { font-weight: 600; text-decoration: none; display: block; }
.srow .num a { text-decoration: none; }
.hit { display: block; text-decoration: none; margin-top: 4px; font-family: var(--text-font); font-size: .95rem; line-height: 1.45; }
.hit:hover { background: var(--chip); }
mark { background: var(--date-bg); color: inherit; padding: 0 1px; border-radius: 2px; }
.ftoggle { display: none; }
@media (max-width: 800px) {
  .search { grid-template-columns: 1fr; gap: 12px; }
  .facets { position: static; max-height: none; display: none; }
  .facets.shown { display: block; }
  .ftoggle { display: block; width: 100%; text-align: left; padding: 8px 12px; font: inherit; font-weight: 600;
             border: 1px solid var(--line); border-radius: 6px; background: var(--panel); color: var(--ink); cursor: pointer; }
}

/* uncertain words (joint reading): dotted underline, stronger when less certain */
.text .unc, .unc-legend .unc { text-decoration-line: underline; text-decoration-style: dotted; text-underline-offset: 3px; cursor: help; }
.text .unc.low, .unc-legend .unc.low { text-decoration-color: var(--warn-ink); text-decoration-thickness: 2px; }
.text .unc.medium, .unc-legend .unc.medium { text-decoration-color: var(--muted); text-decoration-thickness: 1.5px; }
.unc-legend { margin: 4px 0 8px; }

/* lines linked to the image (docs/LINES.md) */
.text .line.hl { background: var(--chip); border-radius: 3px; }
.row-hl { pointer-events: none; }
.row-hl svg { display: block; width: 100%; height: 100%; overflow: visible; }
.row-hl polygon { fill: color-mix(in srgb, var(--brand) 16%, transparent); stroke: var(--brand); stroke-width: 2px; vector-effect: non-scaling-stroke; stroke-linejoin: round; }
.text .line[data-i] { cursor: default; }
.line-note { margin: 4px 0 6px; }

/* year bars: a click narrows the years to that decade */
.yr-hist i { cursor: pointer; }
.yr-hist i:hover { background: var(--ink); }

/* keywords: heatmap, index, keyword page */
.heatwrap { overflow-x: auto; margin: 8px 0 4px; }
.heat { display: grid; gap: 2px; min-width: 560px; font-size: .8rem; }
.heat .hh { color: var(--muted); text-align: center; font-variant-numeric: tabular-nums; line-height: 1.1; padding-bottom: 4px; align-self: end; }
.heat .hh span { display: block; font-size: .7rem; }
.heat .hk { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding-right: 6px; color: var(--ink); text-decoration: none; align-self: center; }
.heat a.hk:hover { text-decoration: underline; }
.heat .hc { min-height: 22px; border-radius: 2px; box-shadow: inset 0 0 0 1px var(--line); display: flex; align-items: center; justify-content: center; text-decoration: none; color: var(--ink); font-variant-numeric: tabular-nums; }
.heat .hc:hover { outline: 2px solid var(--ink); outline-offset: -1px; }
.heat .hc span { font-size: .7rem; background: var(--panel); border-radius: 3px; padding: 0 3px; line-height: 1.3; }
.heat .htot { text-align: center; color: var(--muted); font-variant-numeric: tabular-nums; }
.heat .hn { text-align: right; color: var(--muted); font-variant-numeric: tabular-nums; align-self: center; }
.hlegend { display: inline-flex; align-items: center; gap: 6px; margin-right: 10px; vertical-align: middle; }
.hlegend i { width: 90px; height: 10px; border-radius: 2px; background: linear-gradient(90deg, color-mix(in oklab, var(--brand) 12%, var(--panel)), var(--brand)); }
.kwindex section { margin: 10px 0; }
.kwindex h3 { margin: 0 0 4px; font-size: .95rem; color: var(--muted); }
.kwcols { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 20px; margin-bottom: 16px; }
@media (max-width: 860px) { .kwcols { grid-template-columns: 1fr; } }
.kwbars a { display: grid; grid-template-columns: 3rem 1fr 2.2rem; gap: 8px; align-items: center; text-decoration: none; color: var(--ink); font-size: .85rem; padding: 1px 0; }
.kwbars .yr { color: var(--muted); font-variant-numeric: tabular-nums; }
.kwbars .bar { height: 12px; }
.kwbars .bar i { display: block; height: 100%; background: var(--brand); border-radius: 0 4px 4px 0; }
.kwbars .n { text-align: right; font-variant-numeric: tabular-nums; color: var(--muted); }
.kwbars a:hover .bar i { background: var(--ink); }
.heat .hc.thin, .heat .htot.thin { background: repeating-linear-gradient(135deg, transparent 0 4px, var(--line) 4px 5px); }

/* keyword Sankey (keyword page) */
.sankeypane { margin-bottom: 16px; }
.sankeywrap { overflow-x: auto; }
.sankey { width: 100%; min-width: 620px; height: auto; display: block; font: 12px var(--ui-font); }
.sankey .sk-band { fill: var(--muted); fill-opacity: .22; transition: fill-opacity .1s; }
.sankey .sk-band.hl { fill: var(--brand); fill-opacity: .55; }
.sankey .sk-band.dim { fill-opacity: .08; }
.sankey .sk-node { fill: var(--muted); }
.sankey .sk-node.key { fill: var(--ink); }
.sankey .sk-node.on { fill: var(--brand); }
.sankey a:hover .sk-node { fill: var(--brand); }
.sankey .sk-lab { fill: var(--ink); }
.sankey .sk-n { fill: var(--muted); font-variant-numeric: tabular-nums; }

/* keyword network */
.netcols { display: grid; grid-template-columns: minmax(0, 3fr) minmax(220px, 1fr); gap: 20px; align-items: start; }
@media (max-width: 900px) { .netcols { grid-template-columns: 1fr; } }
.netpane { padding: 8px; }
.net { width: 100%; height: min(72vh, 680px); display: block; cursor: grab; touch-action: none; }
.net .n-links line { stroke: var(--muted); stroke-opacity: .35; }
.net .n-links line.hot { stroke: var(--brand); stroke-opacity: .8; }
.net .n-links line.dim { stroke-opacity: .06; }
.net circle { fill: var(--panel); stroke: var(--ink); stroke-width: 1.4; }
.net a.hot circle { fill: var(--brand); stroke: var(--brand); }
.net a:hover circle { fill: var(--brand); stroke: var(--brand); }
.net a.dim { opacity: .2; }
.net .n-lab { font-family: var(--ui-font); fill: var(--ink); paint-order: stroke; stroke: var(--panel); stroke-linejoin: round; pointer-events: none; }
.net .n-hidden { display: none; }
.netgroups ol { margin: 0; padding-left: 1.3em; }
.netgroups li { margin: 0 0 10px; cursor: default; }
.netgroups li:hover b { color: var(--brand); }
#kwletters { scroll-margin-top: 72px; }

/* automatic keywords (letters not yet edited): dashed, labelled */
.kw.auto { align-items: center; margin: 4px 0 10px; }
.kw.auto a { background: none; box-shadow: inset 0 0 0 1px var(--line); border: 1px dashed var(--muted); }
.kw.auto .kwlab { background: none; padding: 0; color: var(--muted); font-size: .8rem; }

/* register entries generated automatically (issue #12) */
.badge.gen { background: transparent; border: 1px dashed var(--muted); color: var(--muted); font-weight: normal; }
.ext a.graded { border-style: dashed; }
.ext a.graded .gr { font-size: .68rem; color: var(--muted); margin-left: 2px; }
.list.cands .row.cand { display: grid; grid-template-columns: 8rem minmax(0, 1fr) auto; gap: 10px; align-items: baseline; padding: 6px 0; border-bottom: 1px solid var(--line); }
.cand .ext { display: flex; flex-wrap: wrap; gap: 4px; }
.cand .ext a { font-size: .75rem; padding: 0 8px; border-radius: 999px; border: 1px solid var(--line); text-decoration: none; color: var(--ink); }
.grade { font-size: .75rem; padding: 1px 8px; border-radius: 999px; border: 1px solid var(--line); text-align: center; }
.grade.g-sicher, .ext a.g-sicher .gr { color: var(--ink); font-weight: 600; }
.grade.g-wahrscheinlich { color: var(--ink); }
.grade.g-möglich { color: var(--muted); border-style: dashed; }
@media (max-width: 700px) { .list.cands .row.cand { grid-template-columns: 1fr; } }

/* ---------- Thun: letters ---------- */
.readers { flex-direction: row; flex-wrap: wrap; }
.readers .rd { flex: 1 1 220px; }
.cmp-note { color: var(--muted); margin: 0 0 8px; }
.cmp-note ins { text-decoration: none; background: var(--ins-bg); color: var(--ins); padding: 0 2px; border-radius: 2px; }
.cmp-note del { background: var(--del-bg); color: var(--del); padding: 0 2px; border-radius: 2px; }
h2.shelf { margin: 22px 0 6px; font-size: 1.05rem; scroll-margin-top: 64px; }
.intro .caveat { margin-top: 8px; }
.shelves { display: flex; flex-wrap: wrap; gap: 4px 10px; margin: 0 0 6px; }
.shelves a { color: var(--muted); }
.list .lrow { grid-template-columns: 44px 4.5rem minmax(0, 1fr); align-items: start; position: relative; }
.lrow .th { width: 44px; height: 60px; background: var(--chip); border-radius: 3px; overflow: hidden; }
.lrow .th img { width: 44px; height: 60px; object-fit: cover; display: block; }
.lrow .body { display: flex; flex-direction: column; min-width: 0; }
.lrow .who { text-decoration: none; }
.lrow .who::after { content: ""; position: absolute; inset: 0; }   /* the whole row opens the letter */
.lrow .who:focus-visible { outline: none; }
.lrow:has(.who:focus-visible) { outline: 2px solid var(--chip-on); outline-offset: -2px; }
.lrow .reg { display: block; -webkit-line-clamp: unset; color: var(--ink); font-size: .92rem; }
.lrow .hit { position: relative; z-index: 1; }
.lrow .badge { margin-left: 4px; }
@media (max-width: 640px) {
  .list .lrow { grid-template-columns: 44px minmax(0, 1fr); column-gap: 12px; }
  .lrow .th { grid-row: span 2; }
  .lrow .num { grid-column: 2; }
  .lrow .body { grid-column: 2; }
}
.pages .extra-lbl { margin-left: 8px; }
.pages .pg { text-decoration: none; }
.imgtoggle { margin-left: auto; }
.letter.noimgpane { grid-template-columns: minmax(0, 1fr); max-width: 980px; margin: 0 auto; }
.imgcredit { margin: 0; padding: 0 12px 10px; }
details.regest.draft summary { color: var(--ink); font-weight: 600; }
details.regest.draft p { margin: 6px 0; }
@media (max-width: 960px) { #osd { height: 70vh; } }
