/* =====================================================
   notes-bach.css — refined scholarly layout
   Work Sans body + Source Serif 4 headings
   Classic parchment tone
   ===================================================== */


/* --- Body with warm parchment tone --- */
body {
  font-family: "Work Sans", "Helvetica Neue", "Segoe UI", sans-serif;
  font-size: 1.08rem;
  line-height: 1.7;
  color: #222;
  background: #f9f7f2;
  background-image: radial-gradient(
    circle at 30% 20%,
    rgba(255, 255, 255, 0.6),
    rgba(0, 0, 0, 0.02) 80%
  );
  background-attachment: fixed;
  margin: 0;
  padding: 0;
}

/* --- Headings --- */
h1, h2, h3, h4 {
  font-family: "Source Serif 4", "Georgia", serif;
  color: #111;
  line-height: 1.25;
  margin-top: 1.6em;
  margin-bottom: 0.4em;
}

h1 {
  font-size: 1.9rem;
  margin-top: 0;
  letter-spacing: 0.01em;
}

h2 { font-size: 1.35rem; }
h3 { font-size: 1.15rem; }

/* --- Paragraphs and lists --- */
p, ul, ol {
  margin-top: 0.8em;
  margin-bottom: 0.8em;
}

/* --- Links --- */
a {
  color: #2f3d8f;
  text-decoration: none;
}
a:hover, a:focus {
  text-decoration: underline;
}

/* --- Header with banner image and navigation --- */
.site-header {
  text-align: center;
  margin-bottom: 1rem;
  border-bottom: 1px solid #e0dccc;
  background: #f4f1ea;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.site-header .header-image img {
  width: 100%;
  height: auto;
  display: block;
  max-height: 200px;
  object-fit: contain; /* keeps proportions */
  margin: 0 auto;
  filter: contrast(95%) brightness(102%) saturate(85%);
}

.site-nav {
  font-family: "Work Sans", "Helvetica Neue", sans-serif;
  font-size: 0.95rem;
  letter-spacing: 0.02em;
  background: #f4f1ea;
  padding: 0.4rem 0.8rem;
}

.site-nav a {
  color: #503a2c;
  text-decoration: none;
  padding: 0 0.3rem;
}

.site-nav a:hover {
  text-decoration: underline;
}

/* --- Table of Contents --- */
.table-of-contents {
  background: #f4f1ea;
  border: 1px solid #ddd;
  padding: 1rem 1.2rem;
  margin-bottom: 1.5rem;
  font-size: 0.95rem;
}
.table-of-contents ul {
  list-style: none;
  padding: 0;
  margin: 0;
}
.table-of-contents li {
  margin: 0.25rem 0;
}
.table-of-contents li.sub {
  margin-left: 1rem;
}
.table-of-contents a {
  color: #2f3d8f;
  text-decoration: none;
}
.table-of-contents a:hover {
  text-decoration: underline;
}


/* --- Layout grid (main + sidebar) --- */
/* Default: 3.3 : 0.9 ratio (main : sidebar) */
.wrap {
  display: grid;
  grid-template-columns: 3.3fr 0.9fr;
  gap: 2rem;
  max-width: 1200px;
  margin: 2rem auto;
  padding: 0 1.5rem;
  align-items: flex-start;
}

@media (max-width: 900px) {
  .wrap {
    display: block;
  }
}

/* --- Sidebar notes --- */
.aside-notes {
  position: sticky;
  top: 1rem;
  align-self: flex-start;
  height: calc(100vh - 2rem);
  overflow-y: auto;              /* keep this */
  border-left: 1px solid #ddd;
  padding-left: 1rem;
  background: #f9f7f2;
  scrollbar-width: thin;
  scrollbar-color: #bbb #f9f7f2;
  font-size: 0.9rem;
  line-height: 1.5;
  transform: translateZ(0);      /* helps stability in some browsers */
}

/* avoid outlines when clicked */
.aside-notes:focus,
.aside-notes *:focus { outline: none; }


.aside-notes ol {
  list-style: none;
  padding-left: 0;
  margin: 0;
  counter-reset: note;
}

.aside-notes li {
  counter-increment: note;
  margin-bottom: 0.8rem;
  transition: background-color 0.8s ease, color 0.8s ease;
  display: flex;
  align-items: flex-start;
  gap: 0.4em; /* small spacing between number and text */
}

.aside-notes li::before {
  content: "[" counter(note) "]";
  color: #555;
  font-size: 0.85rem;
  flex-shrink: 0;
  line-height: 1.4;
}

.aside-notes li.active {
  background-color: #f4f2ec;
  color: #222;
  box-shadow: 0 0 0.4rem rgba(0, 0, 0, 0.05);
  animation: fadeInNote 0.8s ease;
}

@keyframes fadeInNote {
  from {
    background-color: #ffffff;
    box-shadow: none;
  }
  to {
    background-color: #f4f2ec;
    box-shadow: 0 0 0.4rem rgba(0, 0, 0, 0.05);
  }
}

/* --- Images, figures, tables --- */
img, figure {
  max-width: 100%;
  height: auto;
  display: block;
  margin: 1.5rem auto;
}

figcaption {
  font-family: "Source Serif 4", "Georgia", serif;
  font-size: 0.9rem;
  color: #555;
  text-align: center;
  margin-top: 0.4rem;
}

/* --- Blockquotes --- */
blockquote {
  font-family: "Source Serif 4", "Georgia", serif;
  border-left: 3px solid #ddd;
  margin: 1.2rem 0;
  padding: 0.4rem 1rem;
  font-style: italic;
  color: #444;
  background: rgba(255, 255, 255, 0.4);
}

/* --- Footer --- */
footer {
  border-top: 1px solid #eee;
  margin-top: 3rem;
  padding: 1rem 2rem;
  font-size: 0.9rem;
  color: #666;
  text-align: center;
  background: #f4f1ea;
}

footer a {
  color: inherit;
  text-decoration: underline;
}

/* --- Responsive refinements --- */
@media (max-width: 700px) {
  body { font-size: 1rem; }
  .wrap { padding: 0 1rem; }
  h1 { font-size: 1.6rem; }
  .aside-notes {
    position: static;
    border-left: none;
    height: auto;
  }
}

/* --- Optional layout variants --- */
body.wide-notes .wrap {
  grid-template-columns: 2fr 1fr;
}
body.wide-notes .aside-notes {
  font-size: 0.92rem;
  line-height: 1.55;
}
/* =====================================================
   Optional layout: no sidebar (single-column article)
   ===================================================== */
body.no-sidebar .wrap {
  display: block;             /* disables grid layout */
  max-width: 800px;           /* readable line length */
  margin: 2rem auto;
  padding: 0 1.5rem;
}

body.no-sidebar .aside-notes {
  display: none;              /* hides sidebar entirely */
}

body.no-sidebar article {
  margin: 0 auto;
}
