:root {
  --bg: #fbfaf7; --fg: #1f1d1a; --muted: #6b665e; --line: #e2ded6; --link: #1d4ed8; --node: #c4bfb5; --edge: #e4e0d8; --focus: #e8590c; color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { --bg: #171614; --fg: #ece8e1; --muted: #a39e94; --line: #34312c; --link: #93b4ff; --node: #57534c; --edge: #36332e; --focus: #ff922b; color-scheme: dark; }
}
:root[data-theme="dark"] { --bg: #171614; --fg: #ece8e1; --muted: #a39e94; --line: #34312c; --link: #93b4ff; --node: #57534c; --edge: #36332e; --focus: #ff922b; color-scheme: dark; }
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--fg); font: 17px/1.6 Georgia, serif; }
a { color: var(--link); }
header { display: flex; flex-wrap: wrap; gap: 1rem; align-items: baseline; padding: .75rem 1rem; border-bottom: 1px solid var(--line); }
header .brand { font-weight: bold; color: var(--fg); text-decoration: none; }
header nav { display: flex; flex-wrap: wrap; gap: .75rem; font-size: .9rem; }
main { max-width: 46rem; margin: 0 auto; padding: 1rem; }
.kind { color: var(--muted); font-size: .85rem; text-transform: uppercase; letter-spacing: .05em; }
.links { border-top: 1px solid var(--line); margin-top: 2rem; font-size: .95rem; }
.links dt { color: var(--muted); margin-top: .5rem; }
.links dt::first-letter { text-transform: uppercase; }
.links dd { margin: 0; }
.list .kind { text-transform: none; }
.list li { margin-bottom: .6rem; }
.list .summary { color: var(--muted); font-size: .95rem; }
.hint { color: var(--muted); font-size: .95rem; }
.onmap { margin-left: .4em; vertical-align: -3px; }
#verse { position: fixed; inset: auto; margin: 0; width: min(420px, calc(100vw - 16px)); max-height: 50vh; overflow: auto; padding: .75rem 1rem; background: var(--bg); color: var(--fg); border: 1px solid var(--line); border-radius: 6px; box-shadow: 0 6px 24px rgb(0 0 0 / .18); }
#verse h3 { margin: 0 0 .4rem; font-size: 1rem; }
#verse sup { color: var(--muted); }

body:has(#map) { height: 100dvh; display: flex; flex-direction: column; }
body:has(#map) main { max-width: none; margin: 0; padding: 0; flex: 1; min-height: 0; overflow: auto; }
#map { display: flex; height: 100%; }
#stage { flex: 1; min-width: 0; position: relative; display: flex; }
#cy { flex: 1; min-width: 0; }
#panel { width: 20rem; padding: 1rem; border-left: 1px solid var(--line); overflow-y: auto; }
@media (max-width: 700px) {
  #map { flex-direction: column; height: auto; }
  #stage { height: 65vh; flex: none; }
  #panel { width: auto; border-left: 0; border-top: 1px solid var(--line); }
}

#tools { position: absolute; top: .75rem; left: .75rem; display: flex; flex-wrap: wrap; gap: .4rem; }
#tools button { font: inherit; font-size: .85rem; padding: .25rem .7rem; border: 1px solid var(--line); border-radius: 999px; background: var(--bg); color: var(--fg); cursor: pointer; }
#tools select { font: inherit; font-size: .85rem; padding: .25rem .5rem; border: 1px solid var(--line); border-radius: 999px; background: var(--bg); color: var(--fg); }
#tools button[aria-pressed="true"] { background: var(--fg); color: var(--bg); }
#lanes { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }
#lanes span { position: absolute; left: .5rem; transform: translateY(-50%); padding: 0 .3rem; background: var(--bg); font-weight: bold; font-size: .85rem; }
#ticks { position: absolute; left: 0; right: 0; bottom: 0; overflow: hidden; pointer-events: none; }
#ticks:not(:empty) { height: 1.5rem; border-top: 1px solid var(--line); background: var(--bg); }
#ticks span { position: absolute; top: .15rem; transform: translateX(-50%); font-size: .75rem; color: var(--muted); }
#stage:has(#ticks:not(:empty)) #legend { bottom: 2.1rem; left: auto; right: .75rem; } /* timeline: keep clear of the lane labels */
#legend { position: absolute; bottom: .75rem; left: .75rem; margin: 0; padding: 0; list-style: none; display: flex; flex-wrap: wrap; gap: .3rem .8rem; font-size: .8rem; color: var(--muted); text-transform: capitalize; pointer-events: none; }
#legend li::before { content: ''; display: inline-block; width: .6em; height: .6em; border-radius: 50%; background: var(--c); margin-right: .35em; }
#panel .links { margin-top: 1.5rem; }

#settings { margin-left: auto; }
#settings, #theme { display: inline-block; font: inherit; font-size: 1.1rem; line-height: 1; padding: .3rem .55rem; border: 1px solid var(--line); border-radius: 999px; background: var(--bg); color: var(--fg); cursor: pointer; text-decoration: none; }
#search { position: relative; width: min(16rem, 100%); }
#search .pagefind-ui__search-input { font-size: .95rem; font-weight: normal; }
@media (max-width: 700px) {
  header nav { order: 1; flex-basis: 100%; }
  #search { flex: 1; width: auto; min-width: 6rem; }
}
#search .pagefind-ui__drawer { position: absolute; right: 0; z-index: 10; width: min(30rem, calc(100vw - 2rem)); max-height: 70vh; overflow-y: auto; background: var(--bg); border: 1px solid var(--line); padding: 0 1rem; }
:root { --pagefind-ui-scale: .5; --pagefind-ui-primary: var(--link); --pagefind-ui-text: var(--fg); --pagefind-ui-background: var(--bg); --pagefind-ui-border: var(--line); --pagefind-ui-tag: var(--line); --pagefind-ui-font: inherit; }
