/* book-text.css — styles for HTML text versions of books */

.text-page {
  max-width: 800px;
  margin: 0 auto;
  padding: 1.5rem 2rem;
}

/* --- Navigation --- */

.text-nav {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--card-border);
  margin-bottom: 1rem;
}

.text-nav.text-nav-bottom {
  border-bottom: none;
  border-top: 1px solid var(--card-border);
  margin-bottom: 0;
  margin-top: 1rem;
}

.text-nav-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.text-nav-site-links {
  display: flex;
  gap: 0.5rem;
}

.text-nav-site-links a {
  font-size: 0.82rem;
  padding: 0.18rem 0.55rem;
  border-radius: 4px;
  box-shadow: 0 0 0 1px rgba(0,0,0,0.2), 0 2px 6px rgba(0,0,0,0.1);
  transition: background-color 0.2s ease, color 0.2s ease;
}

.text-nav-site-links a:hover {
  background-color: #333;
  color: #fff;
}

.text-nav-pages {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1rem;
}

.nav-prev, .nav-next {
  font-size: 0.82rem;
  padding: 0.18rem 0.55rem;
  border-radius: 4px;
  box-shadow: 0 0 0 1px rgba(0,0,0,0.2), 0 2px 6px rgba(0,0,0,0.1);
  transition: background-color 0.2s ease, color 0.2s ease;
  white-space: nowrap;
}

a.nav-prev:hover, a.nav-next:hover {
  background-color: #333;
  color: #fff;
}

.nav-disabled {
  opacity: 0.35;
  cursor: default;
  box-shadow: 0 0 0 1px rgba(0,0,0,0.1);
}

.page-indicator {
  font-size: 0.8rem;
  opacity: 0.55;
  text-align: left;
  margin-top: 1.5em;
}

.section-select {
  font-family: inherit;
  font-size: 0.82rem;
  padding: 0.18rem 0.4rem;
  border: 1px solid var(--card-border);
  border-radius: 4px;
  background-color: var(--bg-color);
  cursor: pointer;
  max-width: 200px;
}

/* --- Read Aloud --- */

.read-aloud-controls {
  display: flex;
  gap: 0.5rem;
}

.read-aloud-controls button {
  font-family: inherit;
  font-size: 0.78rem;
  padding: 0.18rem 0.55rem;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  box-shadow: 0 0 0 1px rgba(0,0,0,0.2), 0 2px 6px rgba(0,0,0,0.1);
  background-color: var(--bg-color);
  transition: background-color 0.2s ease, color 0.2s ease;
}

.read-aloud-controls button:hover:not(:disabled) {
  background-color: #333;
  color: #fff;
}

.read-aloud-controls button:disabled {
  opacity: 0.35;
  cursor: default;
}

/* --- Article content --- */

article {
  line-height: 2;
  font-size: 1.05rem;
  min-height: 20rem;
  padding: 1rem 0;
}

/* --- Table of contents --- */

.toc-header {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  margin-bottom: 2rem;
}

.toc-header h1 {
  margin: 0;
}

.toc-carousel-link {
  position: absolute;
  right: 0;
  font-size: 0.82rem;
  padding: 0.18rem 0.55rem;
  border-radius: 4px;
  box-shadow: 0 0 0 1px rgba(0,0,0,0.2), 0 2px 6px rgba(0,0,0,0.1);
  transition: background-color 0.2s ease, color 0.2s ease;
}

.toc-carousel-link:hover {
  background-color: #333;
  color: #fff;
}

.toc ol {
  list-style: none;
  padding-left: 0;
  line-height: 1.7;
}

.toc a:hover {
  text-decoration: underline;
}

/* --- Images --- */

.article-image {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 1.5rem 0;
  border: 1px solid rgba(0,0,0,0.2);
  box-shadow: 0 2px 8px rgba(0,0,0,0.12);
}

/* Poem layout: h3 + text on left, image on right aligned to h3 top */
.poem-with-art {
  display: grid;
  grid-template-columns: 1fr auto;
  column-gap: 2rem;
  align-items: start;
}

.poem-left {
  min-width: 0;
}

.poem-art {
  align-self: start;
}

.poem-art img {
  display: block;
  max-width: 220px;
  width: 100%;
  height: auto;
}

/* --- Translation & Notes --- */

.poem-translation {
  margin-top: 1.5rem;
  padding-top: 1rem;
  font-size: 0.92rem;
  line-height: 1.9;
  opacity: 0.8;
}

.poem-translation-label {
  font-size: 0.78rem;
  opacity: 0.6;
  margin: 0 0 0.4rem 0;
  letter-spacing: 0.05em;
}

.poem-translation p {
  margin: 0;
}

.poem-notes {
  margin-top: 1rem;
  font-size: 0.88rem;
}

.poem-notes summary {
  cursor: pointer;
  opacity: 0.6;
  font-size: 0.82rem;
  letter-spacing: 0.05em;
  user-select: none;
}

.poem-notes summary:hover {
  opacity: 1;
}

.poem-notes dl {
  margin: 0.75rem 0 0 0;
  padding: 0;
}

.poem-notes dt {
  font-weight: bold;
  margin-top: 0.5rem;
}

.poem-notes dd {
  margin: 0.2rem 0 0 1rem;
  line-height: 1.7;
  opacity: 0.85;
}

/* --- Mobile --- */

@media (max-width: 650px) {
  .toc ol {
    font-size: 0.85rem;
    line-height: 1.8;
  }

  .text-page {
    padding: 1rem;
  }

  .text-nav-pages {
    gap: 0.5rem;
  }

  .section-select {
    max-width: 130px;
    font-size: 0.9rem;
  }

  .poem-with-art {
    grid-template-columns: 1fr;
  }

  .poem-art img {
    max-width: 80%;
  }
}
