/* =====================================================
   scholar.css — unified layout with scholar2.css colors
   ===================================================== */

:root {
  --bg: #f5f5f5;
  --surface: #ffffff;
  --text: #222;
  --muted: #555;
  --link: #1661de;
  --maxw: 1200px;
  --gap: 2rem;
  --border: #e6e6e6;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }

/* --- Body --- */
body {
  font-family: "Work Sans", "Helvetica Neue", "Segoe UI", sans-serif;
  font-size: 1.08rem;
  line-height: 1.7;
  color: var(--text);
  background: var(--bg);
  background-attachment: fixed;
}

/* --- Headings --- */
h1, h2, h3, h4 {
  font-family: "Source Serif 4", "Georgia", serif;
  color: var(--text);
  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: var(--link);
  text-decoration: none;
}
a:hover, a:focus { text-decoration: underline; }

/* --- Header --- */
.site-header {
  text-align: center;
  margin-bottom: 1rem;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  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;
  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: var(--surface);
  padding: 0.4rem 0.8rem;
}
.site-nav a {
  color: var(--text);
  text-decoration: none;
  padding: 0 0.3rem;
}
.site-nav a:hover { text-decoration: underline; }

html { scroll-behavior: auto; }

/* --- Layout grid (main + sidebar) --- */
.wrap {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: var(--gap);
  max-width: var(--maxw);
  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;
  max-height: calc(100vh - 2rem);
  overflow-y: auto;
  border-left: 1px solid var(--border);
  padding-left: 1rem;
  background: var(--surface);
  scrollbar-width: thin;
  scrollbar-color: #bbb var(--bg);
  font-size: 0.9rem;
  line-height: 1.55;
  scroll-behavior: smooth;
  overscroll-behavior: contain;
}

.aside-notes li.active {
  background: #f2f6fc;
  border-left: 3px solid #b3c8f9;
  padding-left: 0.5rem;
  transition: background 0.3s ease, border-color 0.3s ease;
}

/* --- Table of Contents --- */
.table-of-contents {
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 1rem 1.2rem;
  margin-bottom: 1.5rem;
  font-size: 0.95rem;
}
.table-of-contents a { color: var(--link); }
.table-of-contents a:hover { text-decoration: underline; }

/* --- Blockquotes --- */
blockquote {
  font-family: "Source Serif 4", "Georgia", serif;
  border-left: 3px solid var(--border);
  margin: 1.2rem 0;
  padding: 0.4rem 1rem;
  font-style: italic;
  color: var(--muted);
  background: #fafafa;
}

/* --- Footer --- */
footer {
  border-top: 1px solid var(--border);
  margin-top: 3rem;
  padding: 1rem 2rem;
  font-size: 0.9rem;
  color: var(--muted);
  text-align: center;
  background: var(--surface);
}
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; }
body.no-sidebar .wrap {
  display: block;
  max-width: 800px;
  margin: 2rem auto;
  padding: 0 1.5rem;
}
body.no-sidebar .aside-notes { display: none; }
body.no-sidebar article { margin: 0 auto; }