/* Combined CSS file for Tufte-inspired blog */

/* Tufte-inspired CSS */
:root {
  --text-color: #393431;
  --h2-color: #393431;
  --background-color: #EDEAE5;
  --accent-color: #807A62;
  --link-color: #A90216;
  --visited-color: #A90216;
}

html {
  font-size: 1.2rem;
}

body {
  width: 800px;
  margin-left: auto;
  margin-right: auto;
  padding-left: 12.5%;
  font-family: et-book, Palatino, "Palatino Linotype", "Palatino LT STD", "Book Antiqua", Georgia, serif;
  background-color: var(--background-color);
  color: var(--text-color);
  max-width: 1400px;
  counter-reset: sidenote-counter;
  line-height: 1.5;
}

h1, h2, h3, h4, h5, h6 {
  font-weight: 400;
  margin-top: 2rem;
  margin-bottom: 1.5rem;
  line-height: 1;
}

h1 {
  font-size: 2.5rem;
  line-height: 1.4;
}

h2 {
  font-size: 2.2rem;
}

h3 {
  font-size: 1.7rem;
}

img {
  margin-bottom: 20px;
}

p {
  margin-top: 0 !important;
  margin-bottom: 0 !important;
  padding-right: 0;
  vertical-align: baseline;
}

a {
  color: var(--link-color);
  text-decoration: none;
}

a:visited {
  color: var(--visited-color);
}

a:hover {
  text-decoration: underline;
}

p.book-description a, a:visited, a:hover {
  text-decoration: none;
}

.sidenote, .marginnote {
  float: right;
  clear: right;
  margin-top: 0;
  margin-bottom: 0;
  font-size: 0.9rem;
  line-height: 1.5;
  vertical-align: baseline;
  position: relative;
  color: var(--text-color);
  opacity: 0.9;
  background-color: var(--sidenote-background-color);
  padding: 0.8rem;
  width: 35%;
}

.sidenote-number {
  counter-increment: sidenote-counter;
}

.sidenote-number:after, .sidenote:before {
  content: counter(sidenote-counter);
  position: relative;
  vertical-align: baseline;
  font-size: 0.7rem;
  top: -0.5rem;
  display: none;
}

.sidenote:before {
  content: counter(sidenote-counter) ". ";
  top: 0;
}

blockquote {
  font-style: italic;
  margin-left: 2rem;
  margin-right: 2rem;
  padding-left: 1rem;
  border-left: 3px solid var(--accent-color);
}

img {
  max-width: 100%;
}

code {
  font-family: Consolas, "Liberation Mono", Menlo, Courier, monospace;
  font-size: 0.9rem;
  background-color: var(--sidenote-background-color);
  padding: 0.2rem 0.4rem;
  border-radius: 3px;
}

pre {
  background-color: var(--sidenote-background-color);
  padding: 1rem;
  overflow-x: auto;
}

pre code {
  background-color: transparent;
  padding: 0;
}

table {
  border-collapse: collapse;
  width: 100%;
  margin: 2rem 0;
}

th, td {
  border-bottom: 1px solid #ddd;
  padding: 0.5rem;
  text-align: left;
}

th {
  font-weight: 600;
}

/* Navigation */
.main-nav {
  padding: 1rem 0;
  border-bottom: 1px solid #ddd;
  margin-bottom: 2rem;
  position: relative;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
}

.site-title {
  font-size: 1.5rem;
  font-weight: 400;
  margin-right: 2rem;
}

.site-title a {
  text-decoration: none;
  color: var(--text-color);
  transition: color 0.2s ease;
}

.site-title a:hover {
  color: var(--link-color);
}

.nav-links {
  list-style-type: none;
  margin: 0;
  padding: 0;
  display: flex;
  gap: 1.5rem;
}

.nav-links li {
  margin: 0;
}

/* Hamburger menu */
.hamburger-menu {
  display: none;
  cursor: pointer;
  margin-left: auto;
}

.hamburger-icon {
  width: 30px;
  height: 24px;
  position: relative;
  transition: all 0.3s ease;
}

.hamburger-icon span {
  display: block;
  position: absolute;
  height: 3px;
  width: 100%;
  background: var(--text-color);
  border-radius: 3px;
  opacity: 1;
  left: 0;
  transform: rotate(0deg);
  transition: all 0.25s ease-in-out;
}

.hamburger-icon span:nth-child(1) {
  top: 0px;
}

.hamburger-icon span:nth-child(2) {
  top: 10px;
}

.hamburger-icon span:nth-child(3) {
  top: 20px;
}

.hamburger-icon.active span:nth-child(1) {
  top: 10px;
  transform: rotate(135deg);
}

.hamburger-icon.active span:nth-child(2) {
  opacity: 0;
  left: -60px;
}

.hamburger-icon.active span:nth-child(3) {
  top: 10px;
  transform: rotate(-135deg);
}

/* Footer */
footer {
  margin-top: 2rem;
}
.oo {
  margin-top: 4rem;
  padding: 1rem 0;
  border-top: 1px solid #ddd;
  font-size: 0.9rem;
  color: var(--sidenote-color);
}

/* Category and post lists */
.post-list, .category-list {
  list-style-type: none;
  padding: 0;
}

.post-list li, .category-list li {
  margin-bottom: 1rem;
}

.post-date {
  color: var(--sidenote-color);
  font-size: 0.9rem;
}

/* Responsive adjustments */
@media (max-width: 1200px) {
  body {
    width: 65%;
    padding-left: 5%;
    padding-right: 5%;
  }
  
  .sidenote, .marginnote {
    font-size: 0.85rem;
    width: 35%;
  }
}

@media (max-width: 760px) {
  body {
    width: 88%;
    padding-left: 6%;
    padding-right: 6%;
  }
  
  .sidenote, .marginnote {
    display: block;
    float: none;
    background-color: var(--sidenote-background-color);
    font-size: 0.95rem;
    line-height: 1.6;
    color: var(--text-color);
    opacity: 0.95;
    width: 100%
  }
  
  h1 {
    font-size: 2.5rem;
  }
  
  h2 {
    font-size: 1.8rem;
  }
  
  h3 {
    font-size: 1.4rem;
  }
  
  nav ul {
    flex-direction: column;
    gap: 0.5rem;
  }
}

/* Category page styles */
.category-list > li {
  margin-bottom: 2rem;
}

.category-list .post-list {
  margin-top: 0.5rem;
  margin-left: 1.5rem;
  font-size: 0.9rem;
}

.category-list h3 {
  margin-bottom: 0.5rem;
}

.category-name {
  font-size: 1.4rem;
  font-weight: normal;
  margin-bottom: 0.5rem;
}

/* Add a new breakpoint for medium-sized screens */
@media (min-width: 761px) and (max-width: 980px) {
  body {
    width: 70%;
    padding-left: 5%;
    padding-right: 5%;
  }
  
  .sidenote, .marginnote {
    position: relative;
    float: right;
    font-size: 0.88rem;
    padding: 0.7rem;
  }
}

/* Add a new breakpoint for screens between 981px and 1100px */
@media (min-width: 981px) and (max-width: 1100px) {
  body {
    width: 60%;
    padding-left: 5%;
    padding-right: 5%;
  }
  
  .sidenote, .marginnote {
    position: relative;
    float: right;
    font-size: 0.85rem;
    padding: 0.7rem;
  }
}

/* Post navigation styles */
.post-navigation {
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 1px solid #ddd;
}

.category-navigation {
  margin-bottom: 1.5rem;
}

.category-navigation h4 {
  margin-bottom: 0.5rem;
  font-size: 1.1rem;
  font-weight: normal;
  font-style: italic;
}

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

.prev-post, .next-post {
  flex: 1;
  padding: 0.7rem;
  background-color: var(--sidenote-background-color);
  border-radius: 3px;
  border-left: 3px solid var(--accent-color);
  transition: background-color 0.2s ease;
  display: flex;
  align-items: center;
}

.prev-post {
  text-align: left;
}

.next-post {
  text-align: right;
  justify-content: flex-end;
}

.nav-arrow {
  font-size: 1.2rem;
  margin: 0 0.5rem;
}

.nav-title {
  font-size: 0.9rem;
}

.nav-placeholder {
  flex: 1;
}

.prev-post:hover, .next-post:hover {
  background-color: #f0f0f0;
  text-decoration: none;
}

@media (max-width: 760px) {
  .nav-links {
    flex-direction: column;
  }
  
  .prev-post, .next-post {
    width: 100%;
  }
}

/* Footer links styling */
.footer-links {
  margin-top: 0.5rem;
  font-size: 0.85rem;
}

.footer-links a {
  color: var(--link-color);
  margin-right: 0.5rem;
}

.footer-links a:hover {
  color: var(--link-color);
}

/* Book description styling */
.book-description {
  font-size: 0.95rem;
  line-height: 1.5;
  margin-top: 0.5rem;
  margin-bottom: 1rem;
  color: var(--text-color);
  font-style: italic;
  max-width: 90%;
}

/* Poem styling */
.poem {
  margin: 2rem 0;
}

.poem-content h1 {
  margin-bottom: 2rem;
}

.poem-text {
  font-family: et-book, Palatino, "Palatino Linotype", "Palatino LT STD", "Book Antiqua", Georgia, serif;
  font-size: 1rem;
  line-height: 1.4;
  white-space: pre-wrap !important;
  background: none;
  border: none;
  padding: 0;
  margin: 0;
  overflow-wrap: break-word;
}

.poem-text .stanza {
  margin-bottom: 1.5rem;
  display: block;
}

.poem-text .line {
  display: block !important;
  line-height: 1.4;
  white-space: pre-wrap !important;
}

.poem-books {
  font-size: 0.9rem;
  margin-bottom: 2rem;
}

/* Override any parent styles that might affect spacing */
.poem-content {
  white-space: pre-wrap !important;
}

ul {
  padding-inline-start: 0;
  list-style-type: none;
}

.book-list > li {
  margin-bottom: 2.5rem;
  list-style-type: none;
}

.book-name {
  margin-bottom: 0.2rem;
}

/* Mobile navigation styles */
@media (max-width: 760px) {
  .hamburger-menu {
    display: block;
  }
  
  .main-nav {
    flex-direction: row;
    align-items: center;
  }
  
  .main-nav .nav-links {
    flex-direction: column;
    width: 100%;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out;
    gap: 0;
    order: 3;
  }
  
  .main-nav .nav-links.active {
    max-height: 200px;
    margin-top: 1rem;
  }
  
  .main-nav .nav-links li {
    width: 100%;
    padding: 0.7rem 0;
    border-bottom: 1px solid #eee;
  }
  
  .main-nav .nav-links li:last-child {
    border-bottom: none;
  }
  
  .main-nav .nav-links li a {
    display: block;
    width: 100%;
  }
}

/* Keyboard navigation hint */
.keyboard-hint {
  font-size: 0.8rem;
  color: #777;
  margin-top: 1rem;
  text-align: center;
  font-style: italic;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.book-navigation:hover .keyboard-hint {
  opacity: 1;
}

.keyboard-hint kbd {
  display: inline-block;
  padding: 0.1rem 0.4rem;
  font-size: 0.7rem;
  line-height: 1;
  color: #444;
  background-color: #f7f7f7;
  border: 1px solid #ccc;
  border-radius: 3px;
  box-shadow: 0 1px 0 rgba(0,0,0,0.2);
  margin: 0 0.2rem;
}

/* Poem navigation styles */
.poem-navigation {
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 1px solid #ddd;
}

.book-navigation h4 {
  margin-bottom: 1rem;
  font-size: 1.1rem;
  font-weight: normal;
  font-style: italic;
}

.book-navigation .nav-links {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.prev-poem, .next-poem {
  flex: 1;
  padding: 0.7rem;
  background-color: var(--sidenote-background-color, #f8f8f8);
  border-radius: 3px;
  border-left: 3px solid var(--accent-color);
  transition: background-color 0.2s ease;
  display: flex;
  align-items: center;
}

.prev-poem {
  text-align: left;
}

.next-poem {
  text-align: right;
  justify-content: flex-end;
  border-left: none;
  border-right: 3px solid var(--accent-color);
}

.nav-arrow {
  font-size: 1.2rem;
  margin: 0 0.5rem;
}

.nav-title {
  font-size: 0.9rem;
}

.nav-placeholder {
  flex: 1;
}

.prev-poem:hover, .next-poem:hover {
  background-color: #f0f0f0;
  text-decoration: none;
}

/* Fix for mobile navigation confusion */
@media (max-width: 760px) {
  /* Ensure main navigation and poem navigation don't conflict */
  .main-nav .nav-links {
    flex-direction: column;
    width: 100%;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out;
    gap: 0;
    order: 3;
  }
  
  .main-nav .nav-links.active {
    max-height: 200px;
    margin-top: 1rem;
  }
  
  /* Book navigation should always be visible */
  .book-navigation .nav-links {
    flex-direction: column;
    gap: 0.5rem;
    display: flex !important; /* Force display on mobile */
    max-height: none !important; /* Override any max-height */
    overflow: visible !important; /* Ensure visibility */
    width: 100%;
    margin-top: 1rem;
  }
  
  .prev-poem, .next-poem {
    width: 100%;
    justify-content: flex-start;
    display: flex !important; /* Force display on mobile */
  }
  
  .next-poem {
    justify-content: flex-end;
  }
  
  .nav-placeholder {
    display: none;
  }
  
  /* Ensure the book navigation container is visible */
  .book-navigation {
    display: block !important;
    width: 100%;
  }
}

/* Global keyboard shortcuts hint */
.keyboard-shortcuts-hint {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  background-color: rgba(247, 247, 247, 0.95);
  padding: 8px 15px;
  border-radius: 5px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  font-size: 0.8rem;
  color: #444;
  text-align: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
  z-index: 1000;
  border: 1px solid #ddd;
}

.keyboard-shortcuts-hint.visible {
  opacity: 1;
  visibility: visible;
}

.keyboard-shortcuts-hint p {
  margin: 0;
}

.keyboard-shortcuts-hint kbd {
  display: inline-block;
  padding: 0.1rem 0.4rem;
  font-size: 0.7rem;
  line-height: 1;
  color: #444;
  background-color: #fff;
  border: 1px solid #ccc;
  border-radius: 3px;
  box-shadow: 0 1px 0 rgba(0,0,0,0.2);
  margin: 0 0.2rem;
}

@media (max-width: 760px) {
  .keyboard-shortcuts-hint {
    font-size: 0.75rem;
    padding: 6px 12px;
    max-width: 90%;
  }
}

/* Book list keyboard navigation styles */
.book-item {
  padding: 0.5rem;
  border-radius: 4px;
  transition: background-color 0.2s ease;
}

.book-item.focused {
  background-color: rgba(0, 0, 0, 0.05);
  outline: 1px solid rgba(0, 0, 0, 0.1);
}

.books-keyboard-hint {
  margin-top: 2rem;
  font-size: 0.8rem;
  color: #777;
  text-align: center;
  font-style: italic;
}

/* Poem list keyboard navigation styles */
.poem-item {
  padding: 0.5rem;
  border-radius: 4px;
  transition: background-color 0.2s ease;
}

.poem-item.focused {
  background-color: rgba(0, 0, 0, 0.05);
  outline: 1px solid rgba(0, 0, 0, 0.1);
}

.poems-keyboard-hint {
  margin-top: 2rem;
  font-size: 0.8rem;
  color: #777;
  text-align: center;
  font-style: italic;
}
