/* Nicoll Commentaries wiki */
:root {
  --bg: #faf8f4;
  --bg-raised: #ffffff;
  --ink: #2b2620;
  --ink-muted: #7d746a;
  --accent: #8a4b2d;
  --accent-soft: #f0e4da;
  --rule: #e4ddd2;
  --highlight: #fbe9a8;
  --serif: "Charter", "Iowan Old Style", Georgia, "Times New Roman", serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
}
[data-theme="dark"] {
  --bg: #1d1a17;
  --bg-raised: #26221e;
  --ink: #e6ded2;
  --ink-muted: #97897a;
  --accent: #d9905f;
  --accent-soft: #3a2f26;
  --rule: #383229;
  --highlight: #5c4a14;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #1d1a17;
    --bg-raised: #26221e;
    --ink: #e6ded2;
    --ink-muted: #97897a;
    --accent: #d9905f;
    --accent-soft: #3a2f26;
    --rule: #383229;
    --highlight: #5c4a14;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 1.06rem;
  line-height: 1.65;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* header */
header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--bg-raised);
  border-bottom: 1px solid var(--rule);
}
.site-nav {
  max-width: 60rem;
  margin: 0 auto;
  padding: 0.55rem 1rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  font-family: var(--sans);
  font-size: 0.88rem;
}
.site-nav .brand { font-weight: 700; color: var(--ink); font-size: 0.95rem; }
.site-nav a { color: var(--ink-muted); }
.site-nav a.brand:hover, .site-nav a:hover { color: var(--accent); text-decoration: none; }
.site-nav .spacer { flex: 1; }
#theme-toggle {
  background: none; border: none; color: var(--ink-muted);
  font-size: 1.1rem; cursor: pointer; padding: 0.2rem 0.4rem;
}
#theme-toggle:hover { color: var(--accent); }

/* search */
.searchbox { position: relative; }
#site-search {
  font-family: var(--sans);
  font-size: 0.85rem;
  padding: 0.35rem 0.6rem;
  border: 1px solid var(--rule);
  border-radius: 6px;
  background: var(--bg);
  color: var(--ink);
  width: 15rem;
}
#site-search:focus { outline: none; border-color: var(--accent); }
#search-results {
  position: absolute;
  top: 110%;
  right: 0;
  width: 24rem;
  max-width: 85vw;
  max-height: 24rem;
  overflow-y: auto;
  background: var(--bg-raised);
  border: 1px solid var(--rule);
  border-radius: 8px;
  box-shadow: 0 8px 28px rgba(0,0,0,0.18);
  font-family: var(--sans);
  font-size: 0.85rem;
}
#search-results .group { padding: 0.35rem 0.7rem 0.15rem; color: var(--ink-muted); font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.06em; }
#search-results a { display: block; padding: 0.35rem 0.7rem; color: var(--ink); }
#search-results a .muted { margin-left: 0.4rem; }
#search-results a:hover, #search-results a.active { background: var(--accent-soft); text-decoration: none; }

/* layout */
main { max-width: 44rem; margin: 0 auto; padding: 2rem 1.25rem 4rem; }
footer {
  max-width: 44rem; margin: 0 auto; padding: 1.2rem;
  border-top: 1px solid var(--rule);
  color: var(--ink-muted);
  font-family: var(--sans); font-size: 0.78rem;
  text-align: center;
}

h1 { font-size: 1.9rem; line-height: 1.2; margin: 0.4rem 0 1rem; }
h2 { font-size: 1.25rem; margin: 2rem 0 0.6rem; }
h3 { font-size: 1.05rem; margin: 1.5rem 0 0.4rem; }
h1, h2, h3 { font-family: var(--serif); font-weight: 700; }

blockquote {
  margin: 1rem 0;
  padding: 0.2rem 1.1rem;
  border-left: 3px solid var(--accent);
  background: var(--accent-soft);
  border-radius: 0 6px 6px 0;
  font-style: italic;
}
.concept-diagram {
  margin: 1.2rem 0;
  padding: 1rem;
  background: var(--bg-raised);
  border: 1px solid var(--rule);
  border-radius: 6px;
  text-align: center;
}
.concept-diagram img { max-width: 260px; width: 100%; color: var(--ink); }
.concept-diagram figcaption { margin-top: 0.5rem; font-size: 0.85rem; color: var(--ink-muted); font-style: italic; }
table { border-collapse: collapse; margin: 1rem 0; width: 100%; font-size: 0.95rem; }
th, td { border: 1px solid var(--rule); padding: 0.4rem 0.6rem; text-align: left; }
th { background: var(--accent-soft); font-family: var(--sans); font-size: 0.85rem; }
ul, ol { padding-left: 1.4rem; }
li { margin: 0.25rem 0; }

.muted { color: var(--ink-muted); font-size: 0.85em; font-family: var(--sans); }
.citation { font-family: var(--sans); font-size: 0.75em; vertical-align: super; line-height: 0; }
mark { background: var(--highlight); color: inherit; padding: 0 0.1em; border-radius: 2px; }

/* commentary pages */
.crumbs { font-family: var(--sans); font-size: 0.82rem; color: var(--ink-muted); margin-bottom: 0; }
.crumbs a { color: var(--ink-muted); }
.crumbs a:hover { color: var(--accent); }
.place { color: var(--ink-muted); font-style: italic; font-size: 0.9rem; }
.src-heading { text-transform: none; letter-spacing: 0.02em; color: var(--ink-muted); font-family: var(--sans); font-size: 0.9rem; }
.commentary p { text-align: justify; hyphens: auto; }
.prevnext {
  display: flex; justify-content: space-between; gap: 1rem;
  margin-top: 2.5rem; padding-top: 1rem;
  border-top: 1px solid var(--rule);
  font-family: var(--sans); font-size: 0.85rem;
}
.prevnext a { max-width: 45%; }

/* auto sections (concordance, backlinks, chips) */
.auto-section {
  margin-top: 2.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--rule);
}
.auto-section h2 { margin-top: 0.5rem; }
.chips { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.chip {
  font-family: var(--sans); font-size: 0.8rem;
  padding: 0.2rem 0.65rem;
  background: var(--accent-soft);
  border-radius: 999px;
  color: var(--accent);
}
.chip:hover { text-decoration: none; filter: brightness(0.95); }

/* concordance volume bars */
.volbar {
  display: flex; align-items: center; gap: 0.6rem;
  font-family: var(--sans); font-size: 0.8rem;
  margin: 0.25rem 0;
}
.volbar-label { width: 3rem; color: var(--ink-muted); }
.volbar-track { flex: 1; height: 0.55rem; background: var(--accent-soft); border-radius: 999px; overflow: hidden; }
.volbar-fill { display: block; height: 100%; background: var(--accent); border-radius: 999px; }
.volbar-count { width: 2rem; text-align: right; color: var(--ink-muted); }
details { margin: 0.5rem 0; }
summary { cursor: pointer; font-family: var(--sans); font-size: 0.9rem; color: var(--accent); }
details ul { margin: 0.4rem 0; }
details li { font-size: 0.95rem; }

/* index pages */
.index-page h1 { margin-bottom: 0.3rem; }
#index-filter {
  width: 100%;
  font-family: var(--sans); font-size: 0.95rem;
  padding: 0.55rem 0.8rem;
  margin: 0.8rem 0;
  border: 1px solid var(--rule); border-radius: 8px;
  background: var(--bg-raised); color: var(--ink);
}
#index-filter:focus { outline: none; border-color: var(--accent); }
.vol-nav, .letter-nav {
  display: flex; flex-wrap: wrap; gap: 0.3rem;
  font-family: var(--sans); font-size: 0.85rem;
  position: sticky; top: 3.1rem;
  background: var(--bg);
  padding: 0.5rem 0;
  z-index: 5;
}
.vol-nav a, .letter-nav a {
  padding: 0.2rem 0.7rem;
  background: var(--bg-raised);
  border: 1px solid var(--rule);
  border-radius: 999px;
  color: var(--ink-muted);
}
.vol-nav a:hover, .letter-nav a:hover { color: var(--accent); border-color: var(--accent); text-decoration: none; }
.entry-list, .concept-list { list-style: none; padding: 0; }
.entry { padding: 0.3rem 0; border-bottom: 1px solid var(--rule); }
.entry-date {
  display: inline-block; width: 10.5rem;
  color: var(--ink-muted);
  font-family: var(--sans); font-size: 0.82rem;
}
.untitled { color: var(--ink-muted); }
.concept-list li { border-bottom: 1px solid var(--rule); padding: 0.3rem 0; }

@media (max-width: 700px) {
  .site-nav { flex-wrap: wrap; gap: 0.5rem 0.8rem; }
  #site-search { width: 100%; }
  .searchbox { order: 10; flex-basis: 100%; }
  .entry-date { display: block; width: auto; }
  .commentary p { text-align: left; }
}

/* Bennett: book names in concordance bars need more room */
.volbar-label.book-label {
  width: 8.5rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

li > ul, li > ol { margin: 0.3rem 0 0.4rem; }
