html {
  overflow-x: hidden;
}
body {
  font-family: Georgia, "Iowan Old Style", Palatino, "Book Antiqua", serif;
  margin: 0;
  padding: 1rem 2rem;
  background: #f0ebe1;
  color: #3a3330;
  line-height: 1.5;
  overflow-x: hidden;
}
a { color: #6b4c2a; text-decoration: none; }
a:hover { text-decoration: underline; color: #4a3018; }
header {
  margin-bottom: 1.5rem;
}
.chapter-list {
  list-style: none;
  padding: 0;
}
.chapter-list li {
  margin-bottom: 0.5rem;
}
.chapter-meta {
  font-size: 0.85rem;
  color: #7a6f65;
}
h1, h2, h3, .chapter-title {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #2c2420;
}
.chapter {
  max-width: 800px;
  margin: 0 auto;
  background: #faf7f2;
  padding: 1.5rem 2rem;
  border-radius: 6px;
  box-shadow: 0 1px 3px rgba(60,40,20,0.08);
}
.tweet {
  position: relative;
  border-bottom: 1px solid #e8e0d6;
  padding: 0.5rem 0;
}
.tweet:last-child {
  border-bottom: none;
}
.tweet-meta {
  font-size: 0.75rem;
  color: #8a7e72;
  margin-bottom: 0.2rem;
}
.tweet-text {
  font-size: 0.95rem;
  line-height: 1.55;
}
.tweet-media {
  font-size: 0.8rem;
  margin-top: 0.25rem;
}
.ext-flags {
  font-size: 0.75rem;
  color: #a04030;
  margin-bottom: 0.5rem;
}
.nav {
  margin-top: 1rem;
  font-size: 0.85rem;
}



/* === BOOK NAV (generated) === */
.book-nav{
  max-width: 800px;
  margin: 0.75rem auto;
  display: flex;
  gap: 0.5rem;
  align-items: center;
  font-size: 0.8rem;
  padding: 0.5rem 0.75rem;
  border: 1px solid #d9d0c4;
  border-radius: 6px;
  background: #f5f0e8;
}
.book-nav .nav-left,
.book-nav .nav-center,
.book-nav .nav-right{
  flex: 1;
  min-width: 0;
}
.book-nav .nav-left{ text-align: left; }
.book-nav .nav-center{ text-align: center; }
.book-nav .nav-right{ text-align: right; }

.nav-link{
  text-decoration: none;
  color: #5a4e42;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  max-width: 100%;
}
.nav-link .nav-label{
  overflow: hidden;
  text-overflow: ellipsis;
  font-weight: 600;
  color: #3a3330;
}
.nav-link .nav-arrow{
  flex-shrink: 0;
  font-size: 1.1em;
  font-weight: 700;
  color: #8a7e72;
}
.nav-prev .nav-arrow{ margin-right: 0.4em; }
.nav-next .nav-arrow{ margin-left: 0.4em; }
.nav-link.nav-toc{
  font-weight: 600;
  color: #5a4e42;
  font-size: 0.85em;
  letter-spacing: 0.02em;
}
.nav-link:hover{ text-decoration: underline; color: #6b4c2a; }
.nav-link:hover .nav-label{ color: #6b4c2a; }
.nav-link:hover .nav-arrow{ color: #6b4c2a; }
.nav-link.disabled{
  opacity: 0.3;
  pointer-events: none;
}

/* Ensure page wrapper doesn't fight existing chapter box styling */
.page{ padding: 0.5rem 0; }
.page-content{ padding: 0; }

/* === TABLE OF CONTENTS === */
.toc-list{
  list-style: none;
  padding: 0;
  margin: 1rem 0;
}
.toc-list .toc-item{
  margin: 0.3rem 0;
  padding-left: 0;
  position: relative;
}
.toc-list .toc-item a{
  color: #5a4e42;
  text-decoration: none;
  font-size: 0.92rem;
  line-height: 1.5;
}
.toc-list .toc-item a:hover{
  text-decoration: underline;
  color: #6b4c2a;
}
/* Preface and Singles get bold treatment */
.toc-list .toc-preface,
.toc-list .toc-singletons{
  margin-top: 0.6rem;
  margin-bottom: 0.6rem;
}
.toc-list .toc-preface a,
.toc-list .toc-singletons a{
  font-weight: 700;
  color: #2c2420;
  font-size: 0.95rem;
}

/* ToC date after title */
.toc-date{
  color: #a89a8c;
  font-size: 0.82em;
  font-weight: 400;
}
/* ToC hover tooltip */
.toc-tooltip{
  display: none;
  position: absolute;
  left: 30rem;
  top: -0.3rem;
  z-index: 10;
  width: 18rem;
  padding: 0.6rem 0.85rem;
  background: #fefce8;
  color: #4a4035;
  border: 1px solid #e5d9a0;
  font-size: 0.82rem;
  font-style: italic;
  font-weight: 400;
  line-height: 1.45;
  border-radius: 5px;
  box-shadow: 0 2px 8px rgba(60,40,20,0.12);
  pointer-events: none;
}
.toc-tooltip::before{
  content: "";
  position: absolute;
  left: -6px;
  top: 0.65rem;
  border-top: 5px solid transparent;
  border-bottom: 5px solid transparent;
  border-right: 6px solid #e5d9a0;
}
.toc-tooltip::after{
  content: "";
  position: absolute;
  left: -5px;
  top: 0.65rem;
  border-top: 5px solid transparent;
  border-bottom: 5px solid transparent;
  border-right: 6px solid #fefce8;
}
.toc-item.has-tooltip:hover .toc-tooltip{
  display: block;
}
/* Suppress tooltips on mobile/touch */
@media (hover: none), (max-width: 600px) {
  .toc-tooltip{ display: none !important; }
}

/* Quoted tweets: indentation + vertical bar */
blockquote.quote-box{
  margin: 0.5rem 0;
  padding-left: 0.85rem;
  border-left: 3px solid #d9d0c4;
  color: #4a4035;
}
blockquote.quote-box .quote-text{ font-size: 0.95em; }

/* Media sizing: keep embedded images/videos modest */
.tweet-media img,
.tweet-media video{
  max-width: 50%;
  height: auto;
  display: block;
  margin-top: 0.35rem;
}

/* ToC list should inherit chapter box styling */
.chapter-list{ padding-left: 1.2rem; }
.chapter-list li{ margin: 0.25rem 0; }

/* === CHAPTER SUBTITLE (date) === */
.chapter-subtitle{
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 1.1rem;
  font-weight: 600;
  color: #6b5e50;
  margin-bottom: 1rem;
}

/* === CHAPTER SUMMARY === */
.chapter-summary{
  margin: 0.5rem 0 1.25rem;
  padding: 0.75rem 1rem;
  background: #f3efe8;
  border-left: 3px solid #c8b99a;
  border-radius: 0 4px 4px 0;
  font-size: 0.9rem;
  line-height: 1.5;
  color: #4a4035;
}

/* === COVER PAGE === */
.cover{
  text-align: center;
}
.cover .cover-image{
  max-width: 100%;
  height: auto;
}

/* === TITLE PAGE === */
.titlepage{
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  min-height: 70vh;
}
.titlepage h1{
  font-size: 2.8rem;
  font-weight: 700;
  margin: 0 0 0.6rem;
  letter-spacing: -0.02em;
  color: #2c2420;
}
.titlepage .subtitle{
  font-size: 1.15rem;
  font-weight: 400;
  color: #6b5e50;
  margin: 0 0 2.5rem;
}
.titlepage .byline{
  font-size: 1.35rem;
  font-weight: 500;
  color: #3a3330;
  margin: 0;
}
.titlepage .byline a{
  color: inherit;
  text-decoration: none;
}
.titlepage .byline a:hover{
  text-decoration: underline;
  color: #6b4c2a;
}
.titlepage .edition-note{
  font-size: 0.9rem;
  color: #6b5e50;
  margin: 1.5rem 0 0;
  line-height: 1.5;
}
.titlepage .production-note{
  text-align: left;
  max-width: 32rem;
  margin: 2rem auto 0;
  padding: 1.25rem 1.5rem 1.25rem 1.75rem;
  background: #f7f4ef;
  border: 1px solid #d9d0c4;
  border-left: 3px solid #a89880;
  border-radius: 2px 6px 6px 2px;
  font-size: 0.82rem;
  color: #4a4035;
  line-height: 1.6;
}
.titlepage .production-note h3{
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 0.88rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: #2c2420;
  margin: 0 0 0.75rem;
}
.titlepage .production-note p{
  margin: 0 0 0.7rem;
}
.titlepage .production-note p:last-child{
  margin-bottom: 0;
  padding-top: 0.5rem;
  border-top: 1px solid #e0d8cd;
  font-style: italic;
}
.titlepage .copyright{
  font-size: 0.85rem;
  font-weight: 400;
  color: #8a7e72;
  margin: 1.5rem 0 0;
}

/* === ENDNOTES === */
.chapter-endnotes{
  margin-top: 2rem;
  padding-top: 1rem;
  border-top: 1px solid #d9d0c4;
}
.endnotes-title{
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 1rem;
  font-weight: 600;
  color: #2c2420;
  margin: 0 0 0.5rem;
}
.endnotes-list{
  padding-left: 1.5rem;
  font-size: 0.85rem;
  color: #6b5e50;
}
.endnote-item{
  margin-bottom: 0.3rem;
}
.endnote-ref a{
  font-size: 0.75rem;
  color: #a89a8c;
  text-decoration: none;
}
.endnote-ref a:hover{
  text-decoration: underline;
  color: #6b4c2a;
}

/* === TWEET PERMALINKS === */
.tweet-permalink{
  position: absolute;
  top: 0.5rem;
  right: 0.4rem;
  font-size: 0.75rem;
  text-decoration: none;
  opacity: 0.25;
  transition: opacity 0.15s;
  cursor: pointer;
}
.tweet:hover .tweet-permalink{
  opacity: 0.6;
}
.tweet-permalink:hover{
  opacity: 1 !important;
}
/* Permalink highlight (persistent until another tweet is selected) */
.tweet.permalink-highlight{
  outline: 2px solid #c5a96a;
  outline-offset: 2px;
  border-radius: 4px;
  background: #f5edd8;
}
/* "Link copied!" tooltip */
.copy-tooltip{
  position: absolute;
  top: -1.6rem;
  right: 0;
  background: #4a4035;
  color: #faf6f0;
  font-size: 0.65rem;
  font-family: system-ui, -apple-system, sans-serif;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  white-space: nowrap;
  pointer-events: none;
  animation: tooltip-fade 1.8s ease-out forwards;
}
@keyframes tooltip-fade{
  0%, 60% { opacity: 1; }
  100%    { opacity: 0; }
}

/* === CHAPTER TITLE PERMALINK === */
.chapter-permalink{
  font-size: 0.55em;
  text-decoration: none;
  opacity: 0.2;
  transition: opacity 0.15s;
  cursor: pointer;
  position: relative;
  vertical-align: middle;
}
.chapter-title:hover .chapter-permalink{
  opacity: 0.5;
}
.chapter-permalink:hover{
  opacity: 1 !important;
}

/* === FLOATING PAGE NAVIGATION === */
/* Shared button style for all floating nav buttons */
.float-nav,
.float-nav-btn{
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 3rem;
  height: 3.2rem;
  text-decoration: none;
  font-family: system-ui, -apple-system, sans-serif;
  color: #6b5e50;
  background: rgba(245, 240, 232, 0.9);
  border: 1px solid #d9d0c4;
  border-radius: 6px;
  opacity: 0.65;
  transition: opacity 0.2s, background 0.15s, color 0.15s, box-shadow 0.15s;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  cursor: pointer;
}
.float-nav:hover,
.float-nav-btn:hover{
  opacity: 1;
  background: #f5f0e8;
  color: #4a3520;
  box-shadow: 0 1px 6px rgba(60,40,20,0.15);
}
.float-nav-chevron{
  font-size: 1.5rem;
  line-height: 1;
  font-weight: 300;
}
.float-nav-label{
  font-size: 0.55rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  margin-top: 0.1rem;
}
/* Prev button: fixed left, vertically centered */
/* Chapter box is max-width:800px + 2rem padding each side = ~864px total.
   Half = ~432px from center. Place buttons outside with a small gap. */
.float-nav-prev{
  position: fixed;
  z-index: 100;
  top: 50%;
  transform: translateY(-50%);
  right: calc(50% + 432px + 0.5rem);
}
/* Right cluster: ToC stacked above Next */
.float-nav-right{
  position: fixed;
  z-index: 100;
  top: 50%;
  transform: translateY(-50%);
  left: calc(50% + 432px + 0.5rem);
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}
/* ToC button: slightly smaller */
.float-nav-toc{
  height: 2.6rem;
}
.float-nav-toc .float-nav-chevron{
  font-size: 1.2rem;
}
