/* base.css — structure only; colours/fonts come from theme variables.
   Theme files set the CSS custom properties below under [data-theme="..."]. */

:root {
  --maxw: 820px;
  /* sensible fallbacks (Academic-ish) so the page is usable even with no theme */
  --bg: #f7f5ef; --fg: #1c1b19; --muted: #6b6459; --border: #d9d3c7;
  --accent: #7a1f1f; --link: #7a1f1f; --card-bg: transparent;
  --title-fg: #1c1b19; --byline-fg: #6b6459; --section-fg: #1c1b19;
  --note-bg: #fff8e6; --note-border: #caa53c; --note-flag-bg: #caa53c; --note-flag-fg: #241f10;
  --flash: #ffe9a8;
  --font-body: Georgia, "Times New Roman", serif;
  --font-head: Georgia, serif;
  --font-mono: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg); color: var(--fg);
  font-family: var(--font-body); line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--link); }
.wrap { max-width: var(--maxw); margin: 0 auto; padding: 1.5rem 1.1rem 4rem; }

/* header */
.site-head { border-bottom: 2px solid var(--border); padding-bottom: 1rem; margin-bottom: 1.2rem; }
.site-head h1 { font-family: var(--font-head); font-size: 1.9rem; margin: 0 0 .2rem; color: var(--title-fg); }
.site-head h1 .title-tag {
  font-size: .6em; font-weight: normal; color: var(--muted);
  letter-spacing: 0; white-space: nowrap; vertical-align: baseline;
}
.site-head .tagline { color: var(--muted); margin: 0 0 1rem; font-size: .98rem; }
.controls { display: flex; flex-wrap: wrap; gap: 1rem; align-items: flex-end; }
.control label { display: block; font-size: .72rem; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin-bottom: .25rem; }
.control select {
  font: inherit; font-size: .95rem; padding: .35rem .5rem; min-width: 15rem;
  background: var(--card-bg); color: var(--fg); border: 1px solid var(--border); border-radius: 4px;
}
.nav-links { margin-left: auto; font-size: .9rem; }
.nav-links [aria-current="page"] { color: var(--fg); font-weight: 700; }
.nav-sep { color: var(--muted); padding: 0 .18rem; }

/* edition meta */
#edition-meta { margin: 1rem 0 1.6rem; font-size: .9rem; }
.meta-row { font-size: 1.05rem; }
.meta-circa { font-weight: bold; color: var(--accent); }
.meta-email { color: var(--muted); font-family: var(--font-mono); font-size: .85rem; }
.meta-note { color: var(--muted); font-style: italic; margin-top: .35rem; }
.meta-sources { margin-top: .5rem; color: var(--muted); }
.meta-sources .lbl { text-transform: uppercase; letter-spacing: .07em; font-size: .72rem; }
.meta-sources .dot { color: var(--border); }

/* sections + entries */
.cpl-section { margin: 2rem 0; }
.cpl-section h2 {
  font-family: var(--font-head); color: var(--section-fg);
  font-size: 1.25rem; border-bottom: 1px solid var(--border); padding-bottom: .3rem;
  display: flex; align-items: baseline; gap: .4rem; scroll-margin-top: 1rem;
}
.cpl-section { scroll-margin-top: 1rem; }
.entry { padding: .7rem 0 .8rem; border-bottom: 1px dotted var(--border); scroll-margin-top: 1rem; display: flex; align-items: flex-start; gap: .85rem; }
.entry-main { flex: 1 1 auto; min-width: 0; }
.entry-cover { line-height: 0; flex: 0 0 auto; }
.entry-cover img {
  width: 84px; height: auto; display: block; background: var(--card-bg);
  border: 1px solid var(--border); border-radius: 2px; box-shadow: 0 1px 3px rgba(0,0,0,.18);
}
.entry-cover-group { flex: 0 0 auto; display: flex; flex-wrap: wrap; align-items: flex-end; gap: .4rem; max-width: 188px; }
.entry-cover-group .entry-cover { margin: 0; }
.entry-cover-group img { height: 112px; width: auto; }
.check-inline { font-size: .92rem; display: inline-flex; align-items: center; gap: .35rem; padding-bottom: .15rem; }
.entry-head { display: flex; align-items: baseline; flex-wrap: wrap; gap: .4rem; }
.entry-title { font-weight: bold; color: var(--title-fg); letter-spacing: .01em; }
.entry-byline { color: var(--byline-fg); font-size: .95rem; }
.entry-byline-ed { font-style: italic; }
.entry-year { color: var(--muted); font-size: .9rem; }
.entry-title-link { color: inherit; text-decoration: none; border-bottom: 1px solid var(--accent); }
.entry-title-link:hover { color: var(--link); }
.entry-byline-link { color: inherit; text-decoration: none; border-bottom: 1px dotted var(--byline-fg); }
.entry-byline-link:hover { color: var(--link); }
.entry-desc { color: var(--fg); margin-top: .15rem; opacity: .92; }

.copy-link, .copy-note-link {
  border: none; background: transparent; cursor: pointer; font-size: .85rem;
  opacity: 0; transition: opacity .15s; padding: 0 .2rem; line-height: 1;
}
.entry:hover .copy-link, .entry:focus-within .copy-link,
.cpl-section h2:hover .copy-link, .cpl-section:focus-within > h2 .copy-link,
.editor-note:hover .copy-note-link, .editor-note:focus-within .copy-note-link { opacity: .65; }
.copy-link:hover, .copy-note-link:hover { opacity: 1 !important; }
.copy-link.copied::after, .copy-note-link.copied::after { content: " copied"; font-size: .7rem; }

/* editor note (annotation) — must be UNMISTAKABLY the editor's, not Bruce's */
.editor-note {
  margin: .6rem 0 .2rem; border-left: 3px solid var(--note-border);
  border-radius: 0 4px 4px 0; background: var(--note-bg);
}
.editor-note > summary {
  cursor: pointer; padding: .45rem .6rem; display: flex; align-items: center; gap: .5rem;
  list-style: none; user-select: none;
}
.editor-note > summary::-webkit-details-marker { display: none; }
.editor-note > summary::before { content: "\25B8"; transition: transform .15s; color: var(--muted); }
.editor-note[open] > summary::before { transform: rotate(90deg); }
.note-flag {
  background: transparent; color: var(--muted); border: 1px solid var(--border);
  font-size: .66rem; font-weight: 600; letter-spacing: .1em;
  padding: .1rem .4rem; border-radius: 3px; text-transform: uppercase;
}
.note-by { color: var(--muted); font-size: .8rem; font-style: italic; }
.copy-note-link { margin-left: auto; }
.note-body { padding: .1rem .8rem .8rem 1.1rem; }
.note-body p { margin: .5rem 0; }
.note-body ul { margin: .4rem 0 .4rem 1.1rem; padding: 0; }
.note-body blockquote {
  margin: .5rem 0; padding: .1rem 0 .1rem .8rem;
  border-left: 3px solid var(--border); color: var(--muted); font-style: italic;
}
.note-body blockquote p { margin: .25rem 0; }
.note-body code { font-family: var(--font-mono); font-size: .9em; }
.note-body a.entry-xref { border-bottom: 1px dashed currentColor; cursor: pointer; }
.note-body a.entry-xref::before { content: "\21B3 "; opacity: .6; font-size: .9em; }

/* reusable author material, presented in the library's annotation rail */
.author-section {
  margin-top: .9rem; padding-top: .7rem; border-top: 1px solid var(--border);
}
.author-section:first-child { margin-top: .2rem; padding-top: 0; border-top: 0; }
.author-heading {
  margin: 0 0 .4rem; color: var(--muted); font-family: var(--font-head);
  font-size: .9rem; letter-spacing: .04em; text-transform: uppercase;
}
.author-body p { margin: .5rem 0; }
.author-body ul { margin: .4rem 0 .4rem 1.1rem; padding: 0; }
.author-body blockquote {
  margin: .5rem 0; padding: .1rem 0 .1rem .8rem;
  border-left: 3px solid var(--border); color: var(--muted); font-style: italic;
}
.author-body code { font-family: var(--font-mono); font-size: .9em; }
.author-body a.entry-xref { border-bottom: 1px dashed currentColor; cursor: pointer; }
.author-body a.entry-xref::before { content: "\21B3 "; opacity: .6; font-size: .9em; }
.resource-links {
  margin-top: .65rem; border-top: 1px dotted var(--border);
}
.resource-links summary {
  cursor: pointer; padding: .5rem .1rem .25rem; display: flex;
  align-items: center; gap: .4rem; list-style: none; user-select: none;
  color: var(--muted); font-size: .72rem; font-weight: 600;
  letter-spacing: .08em; text-transform: uppercase;
}
.resource-links summary::-webkit-details-marker { display: none; }
.resource-links summary::before {
  content: "\25B8"; color: var(--muted); transition: transform .15s;
}
.resource-links[open] summary::before { transform: rotate(90deg); }
.resource-links-count {
  min-width: 1.35rem; padding: .02rem .35rem; border: 1px solid var(--border);
  border-radius: 999px; text-align: center; font-size: .65rem; letter-spacing: 0;
}
.resource-links-body { padding: .1rem .5rem .5rem 1.1rem; font-size: .9rem; }
.resource-links-body p { margin: .35rem 0; }
.resource-links-body ul { margin: .35rem 0 .35rem 1rem; padding: 0; }

/* deep-link flash */
.target-flash { animation: flash 1.6s ease-out; border-radius: 4px; }
@keyframes flash { 0% { background: var(--flash); } 100% { background: transparent; } }

/* downloads / footer */
.downloads { margin-top: 2.5rem; border-top: 2px solid var(--border); padding-top: 1rem; }
.downloads h2 { font-family: var(--font-head); font-size: 1.15rem; }
.downloads ul { list-style: none; padding: 0; }
.downloads li { margin: .3rem 0; }
.site-foot { margin-top: 2rem; color: var(--muted); font-size: .82rem; }

@media (max-width: 560px) {
  .control select { min-width: 0; width: 100%; }
  .controls { gap: .7rem; }
  .nav-links { margin-left: 0; }
}
