:root {
  --fg: #1b1b1b;
  --muted: #666;
  --accent: #6b3410;
  --bg: #fbf9f5;
  --bg-alt: #f1ede4;
  --rule: #d8d2c4;
  --link: #2a5d8f;
  --max: 920px;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

body {
  font: 16px/1.55 Georgia, "Iowan Old Style", Palatino, serif;
  color: var(--fg);
  background: var(--bg);
  margin: 0;
}

a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }

.site-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 1.1rem 1.5rem;
  border-bottom: 1px solid var(--rule);
  background: var(--bg-alt);
}
.site-title {
  font-weight: 600;
  font-size: 1.15rem;
  color: var(--accent);
  letter-spacing: 0.02em;
}
.site-header nav a { margin-left: 1rem; color: var(--fg); }

main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem 1.5rem 4rem;
}
main > article:not(.composer-chapter),
main > section:not(.works-index):not(.composer-chapter) {
  max-width: var(--max);
  margin-left: auto;
  margin-right: auto;
}

.site-footer {
  border-top: 1px solid var(--rule);
  padding: 1.4rem 1.5rem;
  color: var(--muted);
  font-size: 0.9rem;
  text-align: center;
}

h1 { font-size: 2rem; margin: 0 0 0.4rem; }
h2 { font-size: 1.3rem; margin: 2rem 0 0.6rem; padding-bottom: 0.2rem; border-bottom: 1px solid var(--rule); }
h3 { font-size: 1.1rem; margin: 1.4rem 0 0.4rem; }

.landing { max-width: 720px; margin: 0 auto 2rem; text-align: center; }
.landing h1 { margin-top: 0.5rem; font-weight: 400; font-variant: small-caps; letter-spacing: 0.04em; }
.landing-lede { color: #4a4a4a; font-size: 1.05rem; line-height: 1.6; }

.featured-composers, .composer-index {
  max-width: 960px;
  margin: 0 auto 2.5rem;
}
.featured-composers h2, .composer-index h2 {
  text-align: center;
  font-weight: 400;
  font-variant: small-caps;
  letter-spacing: 0.15em;
  border: none;
  color: var(--accent);
  margin-bottom: 1rem;
}
.composer-index-help { text-align: center; color: var(--muted); margin: 0 0 1.2rem; font-size: 0.9rem; font-style: italic; }

.featured-list {
  list-style: none;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1rem;
  margin: 0;
}
.featured-list li { background: var(--bg-alt); border: 1px solid var(--rule); border-radius: 4px; }
.featured-link {
  display: block;
  padding: 1rem 1.2rem;
  color: inherit;
  text-decoration: none;
}
.featured-link:hover { background: #ede8d8; }
.featured-name { display: block; font-size: 1.15rem; font-weight: 600; color: var(--accent); }
.featured-dates { display: block; color: var(--muted); font-size: 0.85rem; font-style: italic; margin: 0.15rem 0; }
.featured-count { display: block; color: var(--muted); font-size: 0.8rem; font-family: var(--mono); }

.composer-grid {
  list-style: none;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 0.2rem 1.4rem;
  margin: 0;
  font-size: 0.92rem;
}
.composer-grid li {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 0.25rem 0;
  border-bottom: 1px dotted var(--rule);
}
.composer-grid a { color: var(--fg); }
.composer-grid a:hover { color: var(--accent); }
.composer-grid-count { color: var(--muted); font-family: var(--mono); font-size: 0.78rem; }

.composer-stub { max-width: var(--max); margin: 0 auto 2.5rem; }
.composer-stub-body { color: #3a3a3a; line-height: 1.6; }

/* ─── Timeline strip (alternating, equal-spaced) ──────────────── */
.chapter-timeline {
  margin: 0 auto 2rem;
  max-width: 960px;
  padding: 1rem 1rem 1.5rem;
}
.timeline-bar {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  position: relative;
  border-top: 2px solid var(--accent);
  margin-top: 6rem;     /* room for the upper labels */
  padding: 1.6rem 0 5.6rem;  /* room for dots + lower labels */
}
.timeline-event {
  position: relative;
  text-align: center;
}
.timeline-dot {
  position: absolute;
  top: -1.85rem;
  left: 50%;
  width: 10px;
  height: 10px;
  background: var(--accent);
  border-radius: 50%;
  transform: translateX(-50%);
  box-shadow: 0 0 0 3px var(--bg);
}
.timeline-label {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  width: 9.5rem;
  text-align: center;
}
.timeline-up .timeline-label   { bottom: 2rem; }
.timeline-down .timeline-label { top: 2rem; }
.timeline-year {
  display: block;
  font-family: var(--mono);
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--accent);
}
.timeline-text {
  display: block;
  font-size: 0.78rem;
  line-height: 1.3;
  color: #3a3a3a;
  margin-top: 0.15rem;
}

@media (max-width: 720px) {
  .chapter-timeline { padding: 0; }
  .timeline-bar {
    display: block;
    border: none;
    margin: 0;
    padding: 0;
  }
  .timeline-event {
    display: grid;
    grid-template-columns: 4rem 1fr;
    column-gap: 0.8rem;
    padding: 0.4rem 0;
    border-bottom: 1px dotted var(--rule);
    text-align: left;
  }
  .timeline-dot { display: none; }
  .timeline-label {
    position: static;
    transform: none;
    width: auto;
    display: contents;
  }
  .timeline-year { text-align: right; }
}

/* ─── "Where to start" listening guide ───────────────────────── */
.listening-guide {
  max-width: 920px;
  margin: 1rem auto 2rem;
  background: #fdf8e8;
  border: 1px solid #e8d99a;
  border-left: 4px solid var(--accent);
  padding: 1.2rem 1.6rem 1.4rem;
  border-radius: 3px;
}
.listening-guide h3 {
  margin: 0 0 0.8rem;
  font-variant: small-caps;
  letter-spacing: 0.12em;
  color: var(--accent);
  font-weight: 400;
  font-size: 1rem;
}
.listening-guide ol {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.2rem;
  counter-reset: pick;
}
.listening-guide li {
  counter-increment: pick;
  position: relative;
  padding-left: 1.6rem;
}
.listening-guide li::before {
  content: counter(pick, decimal);
  position: absolute;
  left: 0;
  top: 0.1rem;
  font-family: var(--mono);
  font-size: 1.4rem;
  color: var(--accent);
  font-weight: 600;
  opacity: 0.6;
}
.pick-link {
  display: block;
  color: inherit;
  text-decoration: none;
  margin-bottom: 0.2rem;
}
.pick-link:hover .pick-title { text-decoration: underline; }
.pick-cat {
  display: block;
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--muted);
}
.pick-title {
  display: block;
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--accent);
}
.pick-blurb {
  margin: 0.3rem 0 0;
  font-size: 0.85rem;
  line-height: 1.45;
  color: #3a3a3a;
}
.pick-spotify {
  display: inline-block;
  margin-top: 0.35rem;
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.02em;
  text-decoration: none;
  color: #1db954;
  border: 1px solid #1db954;
  border-radius: 999px;
  padding: 0.12rem 0.6rem;
}
.pick-spotify::before { content: "\25B6  "; font-size: 0.6rem; }
.pick-spotify:hover { background: #1db954; color: #fff; }
.work-listen { margin: 0.4rem 0 0; }
.badge.spotify-badge {
  color: #1db954;
  border: 1px solid #1db954;
  background: transparent;
  text-decoration: none;
}
.badge.spotify-badge:hover { background: #1db954; color: #fff; }
.genre-tags { margin: 0.45rem 0 0; display: flex; flex-wrap: wrap; gap: 0.35rem; }
.genre-tag {
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.02em;
  color: var(--muted);
  background: rgba(0,0,0,0.04);
  border: 1px solid rgba(0,0,0,0.10);
  border-radius: 999px;
  padding: 0.1rem 0.6rem;
}
.scores-hint {
  margin: 0 0 0.9rem;
  font-size: 0.82rem;
  line-height: 1.45;
  color: var(--muted);
  border-left: 2px solid #1db954;
  padding-left: 0.6rem;
}

/* ─── Geographic map ─────────────────────────────────────────── */
.chapter-map {
  margin: 1.5rem auto 2rem;
  padding: 0;
}
.chapter-map svg {
  display: block;
  width: 100%;
  height: auto;
  border: 1px solid var(--rule);
  border-radius: 3px;
}
.chapter-map figcaption {
  font-size: 0.82rem;
  line-height: 1.5;
  color: var(--muted);
  margin: 0.6rem auto 0;
  font-style: italic;
  text-align: center;
  max-width: 760px;
}

/* Historic-map mode: real engraving + absolute-positioned pins */
.map-historic {
  position: relative;
  margin: 0 auto;
  box-shadow: 0 1px 3px rgba(0,0,0,0.12), 0 4px 14px rgba(0,0,0,0.06);
}
.map-historic img {
  display: block;
  width: 100%;
  height: auto;
  border: 1px solid #c9b88a;
}
.map-pin {
  position: absolute;
  transform: translate(-50%, -50%);
  pointer-events: none;
  font-family: Georgia, "Iowan Old Style", serif;
}
.map-pin-dot {
  display: block;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: #8b0000;
  border: 1.5px solid #fdf3da;
  box-shadow: 0 0 0 1px #8b0000, 0 1px 2px rgba(0,0,0,0.4);
  margin: 0 auto;
}
.map-pin-anchor .map-pin-dot {
  width: 15px;
  height: 15px;
  background: radial-gradient(circle at 35% 30%, #c83232, #6e0707);
}
.map-pin-footnote .map-pin-dot {
  width: 9px;
  height: 9px;
  background: #5a4423;
}
.map-pin-name,
.map-pin-role {
  position: absolute;
  white-space: nowrap;
  background: rgba(253, 243, 218, 0.94);
  border: 1px solid rgba(139, 0, 0, 0.4);
  border-radius: 2px;
  padding: 0.1rem 0.45rem;
  pointer-events: auto;
}
.map-pin-name {
  font-size: 0.85rem;
  font-weight: 700;
  color: #4a1a0a;
  letter-spacing: 0.02em;
}
.map-pin-role {
  font-size: 0.65rem;
  color: #5a3a1a;
  font-style: italic;
  font-weight: 400;
  margin-top: 0.05rem;
}

/* Label offset variants */
.map-label-right .map-pin-name,
.map-label-right .map-pin-role {
  left: 14px;
  transform: translateY(-50%);
}
.map-label-right .map-pin-name { top: 50%; }
.map-label-right .map-pin-role { top: calc(50% + 0.95rem); }

.map-label-top-right .map-pin-name { left: 12px; bottom: 6px; }
.map-label-top-right .map-pin-role { left: 12px; bottom: -8px; }

.map-label-bottom-right .map-pin-name { left: 12px; top: 6px; }
.map-label-bottom-right .map-pin-role { left: 12px; top: calc(6px + 1rem); }

.map-label-bottom-left .map-pin-name  { right: 12px; top: 6px; }
.map-label-bottom-left .map-pin-role  { right: 12px; top: calc(6px + 1rem); }

.map-label-left .map-pin-name,
.map-label-left .map-pin-role {
  right: 14px;
  transform: translateY(-50%);
}
.map-label-left .map-pin-name { top: 50%; }
.map-label-left .map-pin-role { top: calc(50% + 0.95rem); }

.map-pin-anchor .map-pin-name { font-size: 0.95rem; }
.map-pin-footnote .map-pin-name { color: #5a4423; font-weight: 600; }
.map-pin-footnote .map-pin-role { color: #6a5433; }

@media (max-width: 720px) {
  .map-pin-name { font-size: 0.7rem; padding: 0.05rem 0.3rem; }
  .map-pin-role { display: none; }
}


/* ─── Composer page: book-chapter layout ──────────────────────── */

.composer-chapter {
  max-width: 1080px;
  margin: 0 auto 3rem;
  padding: 0 1rem;
}

.chapter-header {
  text-align: center;
  padding: 1rem 0 2rem;
  border-bottom: 1px solid var(--rule);
  margin-bottom: 2.5rem;
}
.chapter-eyebrow {
  font-family: var(--mono);
  font-size: 0.75rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 0.5rem;
}
.chapter-header h1 {
  font-size: 2.4rem;
  margin: 0 0 0.4rem;
  font-weight: 400;
  font-variant: small-caps;
  letter-spacing: 0.02em;
}
.chapter-header .dates {
  color: var(--muted);
  font-style: italic;
  margin: 0;
  font-size: 1rem;
}

.chapter-body {
  font-size: 1.05rem;
  line-height: 1.7;
  hyphens: auto;
  text-align: justify;
}
.chapter-body p { margin: 0 0 1rem; }
.chapter-body h2 {
  text-align: center;
  font-weight: 400;
  font-variant: small-caps;
  letter-spacing: 0.15em;
  font-size: 1.1rem;
  color: var(--accent);
  border: none;
  margin: 2.5rem 0 1.2rem;
  position: relative;
}
.chapter-body h2::before,
.chapter-body h2::after {
  content: "";
  display: inline-block;
  width: 2.5rem;
  border-top: 1px solid var(--rule);
  vertical-align: middle;
  margin: 0 0.8rem;
}
.chapter-body hr {
  display: none;  /* markdown --- is decorative; we use h2 dividers instead */
}

.chapter-body .dropcap {
  font-size: 4.2rem;
  float: left;
  line-height: 0.9;
  padding: 0.25rem 0.7rem 0 0;
  color: var(--accent);
  font-family: Georgia, serif;
}

.chapter-body blockquote {
  border-left: 3px solid var(--accent);
  background: var(--bg-alt);
  margin: 1.5rem 0;
  padding: 0.9rem 1.2rem;
  font-size: 1rem;
  font-style: italic;
  color: #4a3a25;
}
.chapter-body blockquote p { margin: 0 0 0.6rem; }
.chapter-body blockquote p:last-child { margin-bottom: 0; }
.chapter-body blockquote em { font-style: normal; color: var(--muted); font-size: 0.9rem; }

.chapter-body figure {
  margin: 0.6rem 0 1.2rem;
  padding: 0;
}
.chapter-body figure img {
  display: block;
  max-width: 100%;
  height: auto;
  border: 1px solid var(--rule);
  background: #fff;
}
.chapter-body figcaption {
  font-size: 0.82rem;
  line-height: 1.45;
  color: var(--muted);
  margin: 0.45rem 0 0;
  font-style: italic;
  text-align: left;
}
.chapter-body figcaption em { font-style: italic; }

.chapter-body .fig-right {
  float: right;
  width: 38%;
  max-width: 360px;
  margin: 0.3rem 0 1rem 1.6rem;
}
.chapter-body .fig-left {
  float: left;
  width: 38%;
  max-width: 360px;
  margin: 0.3rem 1.6rem 1rem 0;
}
.chapter-body .fig-center {
  clear: both;
  margin: 1.5rem auto;
  max-width: 600px;
}
.chapter-body .fig-portrait { width: 32%; max-width: 300px; }
.chapter-body .fig-score img { background: #fafafa; }

/* Floats must not bleed past the section break */
.chapter-body h2 { clear: both; }

@media (max-width: 720px) {
  .chapter-body { text-align: left; hyphens: manual; }
  .chapter-body .fig-right,
  .chapter-body .fig-left,
  .chapter-body .fig-portrait {
    float: none;
    width: auto;
    max-width: 100%;
    margin: 1rem 0;
  }
  .chapter-body .dropcap { font-size: 3.2rem; }
  .chapter-header h1 { font-size: 1.8rem; }
}

.works-index {
  max-width: var(--max);
  margin: 0 auto;
  padding: 2rem 0 0;
  border-top: 1px solid var(--rule);
}
.works-index h2 {
  text-align: center;
  font-weight: 400;
  font-variant: small-caps;
  letter-spacing: 0.15em;
  border: none;
}

table.works {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}
table.works th,
table.works td {
  text-align: left;
  padding: 0.4rem 0.6rem;
  border-bottom: 1px solid var(--rule);
}
table.works th { background: var(--bg-alt); font-weight: 600; }
table.works td.buxwv { font-family: var(--mono); color: var(--muted); white-space: nowrap; }
table.works td.instr { color: var(--muted); font-size: 0.85rem; }
table.works td.badges { text-align: right; white-space: nowrap; }
.badge {
  display: inline-block;
  font-size: 0.7rem;
  padding: 0.1rem 0.45rem;
  border-radius: 3px;
  margin-left: 0.25rem;
  background: var(--bg-alt);
  color: var(--muted);
  font-family: var(--mono);
}
.badge.hints { background: #e7dfb8; color: #5a4a10; }
.badge.midi  { background: #cce0d6; color: #155033; }

.crumbs { color: var(--muted); font-size: 0.9rem; margin: 0 0 0.5rem; }

.work-header .meta {
  color: var(--muted);
  font-size: 0.95rem;
  margin: 0 0 1.5rem;
}
.work-header .meta .buxwv { font-family: var(--mono); }

.forscore-bar { margin: 0 0 0.8rem; }
.forscore-btn {
  display: inline-block;
  padding: 0.35rem 0.7rem;
  background: var(--accent);
  color: #fff !important;
  border-radius: 3px;
  font-size: 0.85rem;
  text-decoration: none;
  font-family: var(--mono);
}
.forscore-btn:hover { background: #4a2308; }
.forscore-help { color: var(--muted); font-size: 0.8rem; margin-left: 0.6rem; }

.pdf-entry { position: relative; }
.forscore-direct-btn {
  position: absolute;
  top: 0.3rem;
  right: 0.3rem;
  z-index: 2;
  padding: 0.2rem 0.5rem;
  background: rgba(107, 52, 16, 0.92);
  color: #fff !important;
  font-family: var(--mono);
  font-size: 0.7rem;
  border-radius: 3px;
  text-decoration: none;
  letter-spacing: 0.04em;
}
.forscore-direct-btn:hover { background: var(--accent); text-decoration: none; }

.forscore-direct-btn {
  position: absolute;
  top: 0.4rem;
  right: 0.4rem;
  z-index: 2;
  display: inline-block;
  padding: 0.2rem 0.5rem;
  background: rgba(107, 52, 16, 0.95);
  color: #fff !important;
  border-radius: 3px;
  font-size: 0.72rem;
  text-decoration: none !important;
  font-family: var(--mono);
  letter-spacing: 0.04em;
}
.forscore-direct-btn:hover { background: #4a2308; }
.pdf-entry { position: relative; }

.pdf-list { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 1rem; }
.pdf-entry { border: 1px solid var(--rule); border-radius: 4px; background: #fff; overflow: hidden; }
.pdf-link { display: block; color: inherit; }
.pdf-link:hover { text-decoration: none; background: var(--bg-alt); }
.thumb { display: block; width: 100%; height: 240px; object-fit: contain; background: var(--bg-alt); border-bottom: 1px solid var(--rule); }
.thumb-placeholder {
  display: flex; align-items: center; justify-content: center;
  font-family: var(--mono); color: var(--muted); font-size: 1.4rem;
}
.pdf-meta { display: block; padding: 0.55rem 0.7rem; font-size: 0.85rem; }
.pdf-name { display: block; font-weight: 600; word-break: break-word; }
.pdf-desc { display: block; color: var(--muted); margin-top: 0.2rem; font-size: 0.8rem; }
.pdf-ref { display: block; font-family: var(--mono); color: var(--muted); font-size: 0.75rem; margin-top: 0.2rem; }

.midi-row { background: #fff; border: 1px solid var(--rule); border-radius: 4px; padding: 0.6rem 0.8rem; margin-bottom: 0.6rem; }
.midi-name { margin: 0 0 0.4rem; font-family: var(--mono); font-size: 0.8rem; color: var(--muted); word-break: break-all; }
midi-player { width: 100%; }
midi-visualizer { width: 100%; }

.hints-list { display: grid; grid-template-columns: max-content 1fr; column-gap: 1rem; row-gap: 0.4rem; }
.hints-list dt { font-weight: 600; color: var(--accent); }
.hints-list dd { margin: 0; }

.context p { margin: 0 0 0.9rem; }

.structure p,
.wikipedia p { margin: 0 0 0.5rem; }
.wikipedia p:first-of-type { font-style: italic; color: #3a3a3a; }
.src-link { font-size: 0.9rem; }

.src-list { list-style: none; padding: 0; margin: 0; font-size: 0.9rem; }
.src-list li { padding: 0.25rem 0; }
.src-list .ext-links { color: var(--muted); word-break: break-word; }

@media (max-width: 640px) {
  table.works td.instr { display: none; }
  .pdf-list { grid-template-columns: 1fr 1fr; }
}
