/* "Ash": monochrome with one crimson accent. --c-<kind> colour the map's node kinds (read by map.js). */
:root {
  --bg: #fafafa; --fg: #161616; --muted: #5e5e5e; --line: #e2e2e2; --link: #c8102e; --node: #dcdcdc; --edge: #e0e0e0; --focus: #c8102e;
  --c-topics: #c8102e; --c-positions: #2b2b2b; --c-traditions: #6e6e6e; --c-figures: #a8a8a8; --c-events: #e8868b; color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { --bg: #121212; --fg: #ececec; --muted: #a6a6a6; --line: #2c2c2c; --link: #ef5a5f; --node: #3a3a3a; --edge: #303030; --focus: #ef5a5f;
    --c-topics: #ef5a5f; --c-positions: #d6d6d6; --c-traditions: #8f8f8f; --c-figures: #6f6f6f; --c-events: #f2a3a5; color-scheme: dark; }
}
:root[data-theme="dark"] { --bg: #121212; --fg: #ececec; --muted: #a6a6a6; --line: #2c2c2c; --link: #ef5a5f; --node: #3a3a3a; --edge: #303030; --focus: #ef5a5f;
  --c-topics: #ef5a5f; --c-positions: #d6d6d6; --c-traditions: #8f8f8f; --c-figures: #6f6f6f; --c-events: #f2a3a5; color-scheme: dark; }
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--fg); font: 1.0625rem/1.7 Inter, system-ui, sans-serif; }
:root[data-size="large"] { font-size: 118.75%; }
:root[data-size="larger"] { font-size: 137.5%; }
a { color: var(--link); }
h1, h2, #panel h2 { font-family: 'Instrument Serif', Georgia, serif; font-weight: normal; line-height: 1.05; }
h1 { font-size: clamp(2.75rem, 7vw, 5rem); margin: .2em 0 .3em; }
article h2 { font-size: 2.4rem; margin: 2rem 0 .5rem; }
article h3 { font-size: .8rem; text-transform: uppercase; letter-spacing: .16em; margin: 1.75rem 0 .4rem; }
blockquote { margin: 2rem 0; padding: 1.25rem 0; border-block: 1px solid var(--line); font: 1.75rem/1.2 'Instrument Serif', Georgia, serif; }
header { display: flex; flex-wrap: wrap; gap: 1rem 1.5rem; align-items: center; padding: .75rem 1.5rem; border-bottom: 1px solid var(--line); }
header .brand { font: 1.6rem/1 'Instrument Serif', Georgia, serif; color: var(--fg); text-decoration: none; }
header .brand em { color: var(--link); }
header nav { display: flex; flex-wrap: wrap; gap: .5rem 1.25rem; font-size: .85rem; letter-spacing: .04em; }
header nav a { color: var(--muted); text-decoration: none; }
header nav a:hover { color: var(--fg); }
main { max-width: 46rem; margin: 0 auto; padding: 1rem; }
@media (min-width: 1024px) { main { max-width: 90vw; } }
/* Note page: centred hero, then essay (capped for reading) beside a side column that stacks below on phones. */
.hero { max-width: 72rem; margin: 0 auto; padding: 3.5rem 0 2.5rem; text-align: center; border-bottom: 1px solid var(--line);
  background: radial-gradient(ellipse at 50% 0%, color-mix(in srgb, var(--fg) 7%, var(--bg)), var(--bg) 70%); }
.hero h1 { font-size: clamp(3rem, 9vw, 7rem); margin: .25em 0 .3em; }
.hero > p:not(.kind) { max-width: 42rem; margin: 0 auto; font-size: 1.15rem; color: var(--muted); }
.chips { list-style: none; padding: 0; margin: 2rem auto 0; max-width: 56rem; display: flex; flex-wrap: wrap; justify-content: center; gap: .6rem; }
.chips a { display: inline-flex; align-items: center; gap: .5rem; min-height: 2.75rem; padding: 0 1rem; border: 1px solid var(--line); border-radius: 999px; color: var(--fg); text-decoration: none; font-size: .9rem; }
.chips a::before { content: ''; width: .5rem; height: .5rem; border-radius: 50%; background: var(--c, var(--node)); }
.chips a:hover { border-color: var(--link); }
.chips span { color: var(--muted); }
.essay { max-width: 72rem; margin: 0 auto; padding: 2rem 0 4rem; display: flow-root; }
.essay aside { float: right; width: 22rem; margin: 0 0 2rem 3.5rem; padding-top: 2.5rem; }
.essay blockquote, .essay ul, .essay ol { display: flow-root; } /* their borders and bullets stop at the float's edge */
@media (max-width: 760px) {
  .essay { display: flex; flex-direction: column; }
  .essay aside { float: none; width: auto; margin: 2rem 0 0; order: 1; }
}
.essay aside .links { margin-top: 1.5rem; padding-top: .5rem; }
.essay aside .links:not(:has(dt)) { display: none; }
.card { padding: 1.25rem 1.4rem; border: 1px solid var(--line); border-radius: 1rem; background: color-mix(in srgb, var(--fg) 4%, var(--bg)); font-size: .9rem; line-height: 1.55; }
.card h2 { margin: 0 0 .75rem; font: .75rem/1 Inter, system-ui, sans-serif; text-transform: uppercase; letter-spacing: .16em; color: var(--muted); }
.card ul { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 1rem; }
.card li { color: var(--muted); }
.card li > a:first-of-type { display: block; font-weight: 600; color: var(--fg); text-decoration: none; }
.card li > a:first-of-type:hover { color: var(--link); }
.kind { color: var(--muted); font-size: .75rem; text-transform: uppercase; letter-spacing: .16em; }
.links { border-top: 1px solid var(--line); margin-top: 2rem; font-size: .95rem; }
.links dt { color: var(--muted); margin-top: .75rem; font-size: .75rem; text-transform: uppercase; letter-spacing: .12em; }
.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: .45rem 1rem; border: 1px solid var(--line); border-radius: 999px; background: var(--bg); color: var(--fg); cursor: pointer; }
#tools select { font: inherit; font-size: .85rem; padding: .45rem .75rem; border: 1px solid var(--line); border-radius: 999px; background: var(--bg); color: var(--fg); }
#tools button[aria-pressed="true"] { background: var(--link); border-color: var(--link); color: var(--bg); font-weight: 600; }
#panel h2 { font-size: 2.6rem; margin: .2rem 0 .5rem; }
#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; }
#size small { font-size: .7em; }
:root[data-size] #size { border-color: var(--link); color: var(--link); }
:root[data-size=""] #size { border-color: var(--line); color: var(--fg); }
#settings, #theme, #size { 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; }
/* Notes sit apart from the map's sections in the header. */
header nav .notes { padding-left: 1.25rem; border-left: 1px solid var(--line); color: var(--link); }
/* Notes tag cloud: font grows with the tag's note count (--n). */
.cloud { list-style: none; padding: 0; display: flex; flex-wrap: wrap; align-items: baseline; gap: .5rem 1.5rem; }
.cloud a { font: clamp(1.4rem, 1rem + var(--n) * .4rem, 3.5rem)/1.1 'Instrument Serif', Georgia, serif; color: var(--fg); text-decoration: none; }
.cloud a:hover, .cloud a[aria-pressed="true"] { color: var(--link); }
/* Notes page: list on the left, tag filter on the right; the filter goes on top on phones. */
.notes-page { display: grid; grid-template-columns: 1fr 18rem; gap: 3rem; align-items: start; }
.notes-page aside { position: sticky; top: 1rem; padding-left: 2rem; border-left: 1px solid var(--line); }
.notes-page aside h2 { margin: 0 0 1rem; font-family: Inter, system-ui, sans-serif; }
.notes-page .cloud a { font-size: clamp(1.2rem, .9rem + var(--n) * .3rem, 2.4rem); }
@media (max-width: 760px) { .notes-page { grid-template-columns: 1fr; gap: 1rem; } .notes-page aside { order: -1; position: static; padding: 0; border: 0; } }
