@import url("https://fonts.googleapis.com/css2?family=Merriweather:wght@400;700&display=swap");

/* Palette — ink and signal yellow
   #1C1A17  ink        headings, logo, nav, rules
   #FBEEC1  band       hero + content-footer
   #F5B301  signal     area marks only, never text
   #8A6100  amber      accent text, hover, entry number
   #FAF7F0  paper      code + blockquote background
   #F2EFE9  shell      footer + nav card background
   #2B2925  body text
*/

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: "Merriweather", Georgia, serif;
  //-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  line-height: 1.8;
  color: #2B2925;
}

/* Header */
.header {
  background: #fff;
  padding: 1rem 2rem;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  //display: flex;
  align-items: center;
  gap: 1rem;
}

.hamburger {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: #1C1A17;
}

.logo {
  font-size: 1.25rem;
  font-weight: bold;
  color: #1C1A17;
  text-decoration: none;
}

.about {
  float: right;
  font-size: 1rem;
  font-weight: normal;
  color: #1C1A17;
  text-decoration: none;
  opacity: 0.5;
  margin-top: 0.4rem;
}

/* Offcanvas Menu */
.offcanvas {
  position: fixed;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100vh;
  background: #fff;
  z-index: 1001;
  transition: left 0.3s ease;
  padding: 2rem;
  overflow-y: auto;
}

.offcanvas.open {
  left: 0;
}

.offcanvas-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid #E8E3D9;
}

.close-btn {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: #1C1A17;
}

.nav-menu {
  list-style: none;
}

.nav-menu > li {
  margin-bottom: 1rem;
}

.nav-menu a {
  color: #1C1A17;
  text-decoration: none;
  font-size: 1.1rem;
  display: block;
  padding: 0.5rem 0;
}

.nav-menu a:hover {
  color: #8A6100;
}

.nav-section {
  font-weight: bold;
  border-bottom: 1px solid #E8E3D9;
  margin-bottom: 0.5rem;
}

.nav-submenu {
  list-style: none;
  margin-bottom: 1rem;
}

.nav-submenu li {
  margin-bottom: 0.5rem;
}

.nav-submenu a {
  font-size: 1.15rem;
  font-weight: normal;
  color: #1C1A17;
  border-bottom: none;
  padding: 0.25rem 0;
}

.nav-submenu a small {
  font-size: 1.15rem;
  font-weight: bold;
  color: #8A6100;
  border-bottom: none;
  padding: 0.25rem 0;
}
.nav-submenu a:hover {
  color: #8A6100;
}

.nav-part {
  margin-top: 1.5rem;
}

.nav-part-title {
  display: block;
  font-weight: bold;
  font-size: 1.2rem;
  color: #1C1A17;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.5rem 0;
  border-bottom: 2px solid #F5B301;
  margin-bottom: 0.5rem;
}

.nav-bottom-links {
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid #E8E3D9;
  display: flex;
  gap: 0.5rem;
}

.nav-bottom-links .nav-version-link {
  flex: 1;
  min-width: 0;
}

.nav-version-link {
  display: block;
  background: #F2EFE9;
  padding: 1rem;
  border-radius: 5px;
  text-decoration: none;
  color: #6B665C;
  font-size: 0.95rem;
  padding: 1rem !important;
}

.nav-version-link small {
  display: block;
  font-size: 0.75rem;
  color: #6B665C;
  margin-bottom: 0.25rem;
}

.nav-version-link:hover {
  background: #FBEEC1;
  color: #1C1A17;
}

/* Hero Section */
.hero {
  background: #FBEEC1;
  color: #1C1A17;
  padding: 8rem 2rem 0.5rem;
  text-align: left;
  border-bottom: 3px solid #F5B301;
}

.chapter-number {
  color: #8A6100;
  font-size: 0.85rem;
  font-weight: bold;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 0.75rem;
}

.hero h1 {
  font-size: 1.8rem;
  line-height: 2.8rem;
  margin-bottom: 1rem;
  font-weight: bold;
}

.hero p {
  font-size: 1.4rem;
  //max-width: 600px;
  margin: 0 auto 2rem;
}

.cta-button {
  background: #1C1A17;
  color: white;
  padding: 1rem 2rem;
  text-decoration: none;
  border-radius: 5px;
  font-weight: bold;
  display: inline-block;
  transition: background 0.3s ease;
}

.cta-button:hover {
  background: #0D0C0A;
}

.prev-chapter {
  margin-bottom: 1rem;
}

.prev-chapter a {
  color: #1C1A17;
  text-decoration: none;
  font-size: 0.9rem;
}

.prev-chapter a:hover {
  text-decoration: underline;
}

/* Content */
.content {
  background: white;
  padding: 2rem 1rem;
  min-height: 60vh;
  font-size: 1.15rem;
}

.container {
  max-width: 800px;
  margin: 0 auto;
}

.content h1 {
  color: #1C1A17;
  margin-bottom: 1rem;
  font-size: 1.8rem;
  scroll-margin-top: 60px;
}

.content h2 {
  color: #1C1A17;
  margin: 2rem 0 1rem;
  font-size: 1.4rem;
}

.content h3 {
  color: #1C1A17;
  margin: 1.5rem 0 0.5rem;
  font-size: 1.2rem;
}

.content p {
  margin-bottom: 2rem;
}

.content ul,
.content ol {
  margin-bottom: 1rem;
  padding-left: 2rem;
}

.content li {
  margin-bottom: 0.5rem;
}

.content blockquote {
  background: #FAF7F0;
  border-left: 4px solid #1C1A17;
  padding: 1rem;
  margin: 1.5rem 0;
  font-style: italic;
  font-size: 90%;
}

.content blockquote p {
  margin-bottom: 0;
}

.content code {
  background: #FAF7F0;
  padding: 0.2rem 0.4rem;
  border-radius: 3px;
  font-family: "Monaco", "Menlo", "Ubuntu Mono", monospace;
  font-size: 0.9rem;
}

.content pre {
  background: #FAF7F0;
  padding: 1rem;
  border-radius: 5px;
  overflow-x: auto;
  margin: 1rem 0;
}

.content pre code {
  background: none;
  padding: 0;
}

.content a {
  color: #1C1A17;
  text-decoration: underline;
  text-decoration-color: #F5B301;
  text-decoration-thickness: 2px;
  text-underline-offset: 3px;
  transition: background 0.15s ease;
}

/* Hover fills the mark in, like a highlighter passed over the line */
.content a:hover {
  color: #1C1A17;
  background: #F5B301;
  box-shadow: 0 0 0 2px #F5B301;
  text-decoration-color: transparent;
}

sup a {
  text-decoration: none;
  padding: 0 0.2rem;
}

/* The back-reference is navigation, not content: no highlighter on it */
.content .reversefootnote {
  text-decoration: none;
  color: #8A6100;
  padding: 0 0.2rem;
}

.content .reversefootnote:hover {
  background: none;
  box-shadow: none;
  color: #1C1A17;
}

.content .callout {
  padding: 20px;
  margin: 20px 0;
  border: 1px solid #E8E3D9;
  border-left-width: 5px;
  border-radius: 3px;
  font-size: 95%;
  opacity: 0.9;
}

.content .callout-hint {
  border-left-color: #5cb85c;
}

.content .callout-example {
  border-left-color: #5bc0de;
}

.content .callout-warning {
  border-left-color: #f0ad4e;
}

.reading-time {
  opacity: 0.6;
}

.comments {
 padding: 1rem;
}

.chapters-list {
  list-style: none;
  padding: 0;
}

.chapters-list li {
  margin-bottom: 1.5rem;
  padding: 1.5rem;
  border: 1px solid #E8E3D9;
  border-radius: 8px;
  transition: box-shadow 0.2s ease;
}

.chapters-list li:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.chapters-list a {
  color: #1C1A17;
  text-decoration: none;
  font-weight: bold;
  font-size: 1.2rem;
}

.chapters-list a:hover {
  color: #8A6100;
}

.chapter-description {
  color: #6B665C;
  margin-top: 0.5rem;
  font-size: 0.95rem;
  line-height: 1.5;
}

/* Content Footer */
.content-footer {
  background: #FBEEC1;
  border-top: 3px solid #F5B301;
  color: #2B2925;
  padding: 2rem;
  text-align: right;
}

.next-chapter {
  color: #1C1A17;
  font-size: 1.15em;
  font-weight: 200;
  text-decoration: none;
}

.next-chapter:hover {
  opacity: 0.8;
}

.chapter-navigation {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.prev-link,
.next-link {
  background: #1C1A17;
  color: white;
  padding: 0.8rem 1.5rem;
  text-decoration: none;
  border-radius: 5px;
  font-weight: bold;
  transition: background 0.3s ease;
}

.prev-link:hover,
.next-link:hover {
  background: #0D0C0A;
}

.prev-link.disabled,
.next-link.disabled {
  background: #CFC9BC;
  cursor: not-allowed;
  pointer-events: none;
}

/* Footer */
.footer {
  background: #F2EFE9;
  color: #1C1A17;
  opacity: 0.6;
  padding: 1rem 2rem 2rem;
  text-align: left;
}

.footer h3 {
  color: #1C1A17;
  margin-bottom: 1rem;
  font-size: 1.2rem;
}

.footer img {
  float: left;
  margin-right: 1rem;
  width: 100%;
  max-width: 64px;
  height: auto;
}

.footer-nav {
  list-style: none;
  display: flex;
  justify-content: left;
  gap: 2rem;
  margin: 1rem 0;
  flex-wrap: wrap;
}

.footer-nav a {
  color: #1C1A17;
  text-decoration: none;
  font-size: 0.9rem;
}

.footer-nav a:hover {
  color: #8A6100;
}

.copyright {
  font-size: 0.8rem;
  margin-top: 1rem;
  text-align: center;
}

.copyright img {
  max-width: 1em;
  max-height: 1em;
  margin-left: 0.2em;
  float: none;
}

.copyright a {
  color: #1C1A17;
}

/* Overlay for mobile menu */
.overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100vh;
  background: rgba(0, 0, 0, 0.5);
  z-index: 999;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease;
}

.overlay.show {
  opacity: 1;
  visibility: visible;
}

/* Better spacing for section headers and mobile lists */
.content p strong:only-child {
  display: inline-block;
  margin-top: 0.5rem;
}

/* Responsive */
@media (min-width: 768px) {
  .hero h1 {
    font-size: 1.8rem;
  }

  .offcanvas {
    width: 60%;
  }

  .chapter-navigation {
    flex-direction: row;
  }
}

@media (min-width: 1024px) {
  .content {
    padding: 3rem 2rem;
  }

  .hero {
    padding: 8rem 2rem 0.5rem;
  }
}

@media (max-width: 767px) {
  .chapter-navigation {
    flex-direction: column;
  }

  .hero {
    padding: 6rem 1rem 0.5rem;
  }

  .hero h1 {
    font-size: 1.8rem;
  }

  .content li {
    margin-bottom: 0.75rem;
  }
}

/* Anchor targets clear the fixed header */
.content [id] {
  scroll-margin-top: 80px;
}

/* Footnotes */
.content .footnotes {
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 1px solid #E8E3D9;
  font-size: 0.9rem;
  opacity: 0.85;
}

.content .footnotes ol {
  padding-left: 1.5rem;
}

.content .footnotes p {
  margin-bottom: 0.75rem;
  overflow-wrap: anywhere;
}

.content .footnotes li {
  margin-bottom: 1rem;
}
