/*
 * Styles specific to ebook content. This stylesheet constrains the width
 * of the Gutenberg text, improves typography, and prevents long words or
 * tables from breaking the overall layout. It is loaded on all pages via
 * layout.php but only affects elements within the .ebook-content wrapper.
 */

.ebook-content {
  max-width: 900px;
  margin: 0 auto;
  padding: 16px;
  /* Ensure long words and URLs wrap instead of overflowing */
  word-wrap: break-word;
  overflow-wrap: anywhere;
  line-height: 1.7;
  font-size: 16px;
}

.ebook-content p,
.ebook-content li {
  line-height: 1.7;
  font-size: 16px;
  margin-top: 0.5em;
  margin-bottom: 0.5em;
}

.ebook-content h1,
.ebook-content h2,
.ebook-content h3,
.ebook-content h4,
.ebook-content h5,
.ebook-content h6 {
  margin-top: 1.2em;
  margin-bottom: 0.6em;
  line-height: 1.3;
}

/* Images should never overflow their container */
.ebook-content img {
  max-width: 100%;
  height: auto;
  display: block;
  margin: 12px auto;
}

/* Preserve code blocks but allow wrapping for long lines */
.ebook-content pre,
.ebook-content code {
  font-family: monospace, Menlo, Consolas, 'Courier New', monospace;
  white-space: pre-wrap;
  overflow-x: auto;
  font-size: 15px;
  line-height: 1.5;
}

/* Make tables responsive by allowing horizontal scroll */
.ebook-content table {
  width: 100%;
  border-collapse: collapse;
  overflow-x: auto;
  display: block;
  margin-bottom: 1em;
}

.ebook-content th,
.ebook-content td {
  border: 1px solid #ccc;
  padding: 4px 8px;
  text-align: left;
}

/* Style blockquotes for emphasis */
.ebook-content blockquote {
  margin: 1em 0;
  padding-left: 1em;
  border-left: 4px solid #ccc;
  color: inherit;
}

/* Gutenberg source notice */
.ebook-content .pg-source {
  font-size: 0.8em;
  color: var(--muted, #666);
  margin-bottom: 1em;
  text-align: right;
}