/* ============================================================
   A Contemporary Guide to Wargame Design — Custom Styles
   ============================================================ */

/* ----- Typography ----- */
body,
.main-content {
  font-family: 'Lora', Georgia, 'Times New Roman', serif;
  font-size: 17px;
  line-height: 1.75;
  color: #2c2c3a;
}

h1, h2, h3, h4, h5, h6,
.site-title {
  font-family: 'Playfair Display', Georgia, serif;
  color: #1c1c2e;
}

h1 { font-weight: 800; }
h2 { font-weight: 700; margin-top: 2.5rem; }
h3 { font-weight: 700; margin-top: 2rem; }

/* ----- Color Palette ----- */
body,
.main {
  background-color: #fdfbf7;
}

a {
  color: #7a3b1e;
}

a:hover {
  color: #8a702d;
  text-decoration: underline;
}

/* ----- Content & Layout ----- */
.main-content,
.main-content-wrap {
  max-width: 680px;
}

/* Let .main fill remaining viewport — no right-side dead space */
.main {
  max-width: none;
}

.main-header {
  max-width: none;
}

/* Match header background to page background */
.main-header,
.side-bar + .main .main-header {
  background-color: #fdfbf7 !important;
  border-bottom: 1px solid #c4b49a;
}

/* ----- Chapter Heading ----- */
.chapter-heading {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 2.2rem;
  font-weight: 800;
  color: #1c1c2e;
  margin-bottom: 1.5rem;
  margin-top: 0.5rem;
  line-height: 1.2;
}

/* ----- Sidebar ----- */
.side-bar {
  background-color: #1c1c2e;
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
  padding-top: env(safe-area-inset-top, 0px);
}

.site-header {
  flex-shrink: 0;
}

.site-nav {
  flex: 1 1 auto;
  overflow-y: auto;
  overflow-x: hidden;
  padding-bottom: 2rem;
  border-top: 1px solid rgba(224, 213, 197, 0.25);
  scrollbar-width: thin;
  scrollbar-color: rgba(196, 180, 154, 0.3) transparent;
}

.site-nav::-webkit-scrollbar {
  width: 6px;
}

.site-nav::-webkit-scrollbar-track {
  background: transparent;
}

.site-nav::-webkit-scrollbar-thumb {
  background: rgba(196, 180, 154, 0.3);
  border-radius: 3px;
}

.site-nav::-webkit-scrollbar-thumb:hover {
  background: rgba(196, 180, 154, 0.5);
}

/* Expand all nav items by default */
.site-nav .nav-list .nav-list {
  display: block !important;
}

.nav-list-expander {
  display: none !important;
}

/* Kill ALL theme background gradients on nav links */
.nav-list-link {
  background-image: none !important;
}

/* Site title */
.site-title,
.site-title:hover,
.site-title:active,
.site-title:visited,
a.site-title,
a.site-title:hover {
  color: #fdfbf7 !important;
  background-image: none !important;
  background-color: transparent !important;
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 1.1rem !important;
  font-weight: 700 !important;
  letter-spacing: 0.01em;
  padding-top: max(1.25rem, env(safe-area-inset-top, 1.25rem)) !important;
  padding-bottom: 1rem;
}

/* Part titles (top-level) — white, uppercase, bold */
.side-bar .nav-list > .nav-list-item > .nav-list-link {
  color: #fdfbf7 !important;
  background-image: none !important;
  background-color: transparent !important;
  font-weight: 700 !important;
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Active Part link */
.side-bar .nav-list > .nav-list-item > .nav-list-link.active {
  color: #ffffff !important;
  border-left: 3px solid #b5933a;
}

/* Chapter links (children) — warm tan, normal case */
.side-bar .nav-list .nav-list .nav-list-link {
  color: #c4b49a !important;
  background-image: none !important;
  background-color: transparent !important;
  font-weight: 400 !important;
  font-size: 0.82rem;
  text-transform: none !important;
  letter-spacing: normal;
}

/* Active chapter link */
.side-bar .nav-list .nav-list .nav-list-link.active {
  color: #ffffff !important;
  font-weight: 600 !important;
  background-color: rgba(181, 147, 58, 0.15) !important;
  border-left: 3px solid #b5933a;
  padding-left: 29px;
}

/* Hover for all sidebar links */
.side-bar .nav-list-link:hover,
.side-bar .nav-list .nav-list-link:hover {
  color: #ffffff !important;
  background-image: none !important;
  background-color: #2a2a42 !important;
}

/* ----- Search ----- */
.search {
  width: 100%;
}

.search-input-wrap {
  width: 100%;
  max-width: 500px;
}

.search-input {
  background-color: #fdfbf7 !important;
  border: 1px solid #c4b49a !important;
  border-radius: 4px;
  color: #2c2c3a !important;
  font-family: 'Lora', Georgia, serif;
  font-size: 0.9rem;
}

.search-input::placeholder {
  color: #7a6a5a !important;
}

.search-input:focus {
  border-color: #7a3b1e !important;
  outline: none;
  box-shadow: 0 0 0 2px rgba(122, 59, 30, 0.2);
}

/* Aux nav (Buy on Amazon link) */
.aux-nav {
  display: flex;
  align-items: center;
  padding-right: 1rem;
}

.aux-nav-list-item a {
  font-family: 'Lora', Georgia, serif;
  font-size: 0.85rem;
  color: #7a3b1e !important;
  text-decoration: none;
  border: 1px solid #c4b49a;
  padding: 0.4rem 1rem;
  border-radius: 4px;
  white-space: nowrap;
  transition: 0.2s;
}

.aux-nav-list-item a:hover {
  background-color: #7a3b1e;
  color: #fdfbf7 !important;
  border-color: #7a3b1e;
}

/* ----- Homepage Hero ----- */
.book-hero {
  text-align: center;
  padding: 3rem 1rem 2rem;
  border-bottom: 2px solid #c4b49a;
  margin-bottom: 2.5rem;
}

.book-title {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 2.6rem;
  font-weight: 900;
  color: #1c1c2e;
  line-height: 1.15;
  margin-bottom: 0.5rem;
}

.book-author {
  font-family: 'Lora', Georgia, serif;
  font-size: 1.15rem;
  color: #7a3b1e;
  margin-bottom: 1rem;
  font-style: italic;
}

.book-tagline {
  font-family: 'Lora', Georgia, serif;
  font-size: 1.05rem;
  color: #5a5a6e;
  max-width: 540px;
  margin: 0 auto 1.5rem;
  line-height: 1.65;
}

.btn-read {
  display: inline-block;
  background-color: #7a3b1e;
  color: #fdfbf7 !important;
  padding: 0.75rem 2rem;
  border-radius: 4px;
  font-family: 'Lora', Georgia, serif;
  font-size: 1rem;
  font-weight: 600;
  text-decoration: none;
  transition: background-color 0.2s ease;
}

.btn-read:hover {
  background-color: #5a2c14;
  color: #fdfbf7 !important;
  text-decoration: none;
}

.section-divider {
  border: none;
  border-top: 1px solid #c4b49a;
  margin: 2rem auto;
  max-width: 200px;
}

/* ----- Chapter Navigation ----- */
.chapter-nav {
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 2px solid #c4b49a;
}

.chapter-nav-links {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
}

.chapter-nav-links a {
  display: inline-block;
  padding: 0.5rem 1.25rem;
  border: 1px solid #c4b49a;
  border-radius: 4px;
  color: #7a3b1e;
  text-decoration: none;
  font-size: 0.9rem;
  transition: all 0.2s ease;
}

.chapter-nav-links a:hover {
  background-color: #7a3b1e;
  color: #fdfbf7;
  border-color: #7a3b1e;
}

/* Single next link → right-aligned; single prev → left-aligned */
.chapter-nav-links .next-chapter:first-child:last-child {
  margin-left: auto;
}

.chapter-nav-links .prev-chapter:first-child:last-child {
  margin-right: auto;
}

.prev-chapter::before {
  content: none;
}

.next-chapter::after {
  content: none;
}

/* ----- In-Page Chapter TOC ----- */
.chapter-toc {
  background-color: #f5f0e8;
  border: 1px solid #c4b49a;
  border-radius: 6px;
  padding: 1rem 1.5rem;
  margin-bottom: 2rem;
}

.chapter-toc .toc-label {
  font-family: 'Playfair Display', Georgia, serif;
  font-weight: 700;
  font-size: 0.95rem;
  color: #1c1c2e;
  margin-bottom: 0.5rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.chapter-toc ul {
  list-style: none;
  padding-left: 0;
  margin: 0;
}

.chapter-toc ul ul {
  padding-left: 1rem;
}

.chapter-toc li {
  margin: 0.25rem 0;
}

.chapter-toc a {
  color: #7a3b1e;
  text-decoration: underline;
  font-size: 0.9rem;
}

.chapter-toc a:hover {
  color: #5a2c14;
}

/* ----- Clickable Diagrams ----- */
.main-content img {
  cursor: pointer;
  transition: opacity 0.2s ease;
  max-width: 100%;
  height: auto;
}

.main-content img:hover {
  opacity: 0.85;
}

/* ----- Footer ----- */

/* The theme's .site-footer is INSIDE .side-bar — hide it */
.side-bar > .site-footer {
  display: none !important;
}

/* Our custom footer in .main-content-wrap */
.main-content-wrap > footer {
  text-align: center;
  padding: 1.5rem 1rem;
  border-top: 1px solid #c4b49a;
  font-size: 0.85rem;
  color: #2c2c3a;
}

.main-content-wrap > footer a {
  color: #7a3b1e;
  text-decoration: underline;
}

.main-content-wrap > footer a:hover {
  color: #5a2c14;
}

.footer-links {
  margin-top: 0.35rem;
}

.footer-links a {
  margin: 0 0.75rem;
}

/* ----- Warm Borders on blockquotes ----- */
blockquote {
  border-left-color: #b5933a;
}

/* ----- Tables ----- */
table {
  border-color: #c4b49a;
}

th {
  background-color: #f5f0e8;
  color: #1c1c2e;
}

/* ----- Focus Indicators ----- */
a:focus-visible,
.btn-read:focus-visible,
.chapter-nav-links a:focus-visible,
.chapter-toc a:focus-visible {
  outline: 2px solid #7a3b1e;
  outline-offset: 2px;
}

.side-bar a:focus-visible,
.side-bar .nav-list a:focus-visible {
  outline: 2px solid #b5933a;
  outline-offset: 2px;
}

.search-input:focus-visible {
  outline: 2px solid #b5933a;
  outline-offset: 2px;
  border-color: #b5933a;
}

/* ----- Responsive ----- */
@media (max-width: 800px) {
  .book-title {
    font-size: 1.8rem;
  }

  .chapter-nav-links {
    flex-direction: column;
  }

  .chapter-nav-links a {
    text-align: center;
  }
}
