:root {
  --bg-color: #fcfcf9;
  --text-color: #2b2b2b;
  --link-color: #8c2d19;
  --border-color: #e0e0dc;
  --font-book: "Georgia", "Garamond", "Baskerville", "Palatino Linotype", serif;
}

body {
  background-color: var(--bg-color);
  color: var(--text-color);
  font-family: var(--font-book);
  font-size: 1.2rem;
  line-height: 1.4;
  max-width: 68ch;
  margin: 0 auto;
  padding: 3rem 1.5rem;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  hyphens: auto;
}

h1, h2, h3, h4 {
  font-family: var(--font-book);
  font-weight: normal;
  line-height: 1.2;
  margin-top: 2rem;
  margin-bottom: 0.75rem;
  color: #111111;
}

h1 {
  font-size: 2.2rem;
  text-align: center;
  margin-bottom: 1.5rem;
}

h2 {
  font-size: 1.5rem;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 0.3rem;
}

/* ==========================================================================
   Paragraph & Book Indentation Rules
   ========================================================================== */

p {
  margin-top: 0;
  margin-bottom: 0;
  text-indent: 1.5em;
}

/* Remove indent on first paragraph following structural elements */
h1 + p,
h2 + p,
h3 + p,
h4 + p,
hr + p,
blockquote + p,
.playscript + p {
  text-indent: 0;
}

blockquote {
  margin: 1.4rem 0;
  padding-left: 1.2rem;
  border-left: 3px solid var(--link-color);
  font-style: italic;
  color: #555555;
}

.playscript {
  margin: 1.5em 0;
  padding-left: 1.5em;
  border-left: 3px solid var(--link-color);
  font-family: inherit;
}

.playscript p {
  margin-bottom: 0.5em;
  text-indent: 0;
}

code, pre {
  font-family: "DejaVu Sans Mono", "Consolas", monospace;
  font-size: 0.9em;
  background: #f1f1ed;
  border-radius: 3px;
}

pre {
  padding: 1rem;
  overflow-x: auto;
  line-height: 1.3; 
}

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

a:hover {
  text-decoration: underline;
}

nav {
  margin-top: 3rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  font-size: 1rem;
}

/* Images & Figures */
img {
  max-width: 100%;
  height: auto;
  display: block;
  margin: 1.5rem auto;
}

figure {
  margin: 1.5rem 0;
  max-width: 100%;
}

figure img {
  margin: 0 auto;
}

figcaption {
  font-size: 0.9rem;
  color: #666;
  text-align: center;
  margin-top: 0.5rem;
  font-style: italic;
}

/* ==========================================================================
   Footnotes & Endnotes Styling
   ========================================================================== */

.footnote-definition {
  display: flex;
  align-items: baseline;
  margin-bottom: 0.75rem;
  font-size: 0.95rem;
  line-height: 1.4;
}

.footnote-definition-label {
  top: 0;
  position: static;
  font-size: 1em;
  font-weight: bold;
  min-width: 1.75ch;
  margin-right: 0.5ch;
  flex-shrink: 0;
  text-align: right;
  color: var(--link-color);
}

.footnote-definition p {
  margin-bottom: 0;
  text-indent: 0;
  flex-grow: 1;
}

.footnote-definition a.footnote-backref,
.footnote-definition p a[href^="#fnref"] {
  display: inline-block;
  margin-left: 0.4ch;
  color: var(--link-color);
  font-family: system-ui, sans-serif;
  text-decoration: none;
}

.footnote-definition a.footnote-backref:hover,
.footnote-definition p a[href^="#fnref"]:hover {
  text-decoration: underline;
}

.footnote-definition:target {
  background-color: #f4f3ec;
  padding: 0.2rem 0.4rem;
  border-radius: 3px;
}

/* ==========================================================================
   Footnote Pop-up Card Styling
   ========================================================================== */

.footnote-popover {
  position: absolute;
  z-index: 9999;
  width: min(420px, calc(100vw - 2rem));
  background-color: #ffffff;
  color: var(--text-color);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
  padding: 1rem 2.2rem 1rem 1rem;
  font-size: 0.95rem;
  line-height: 1.45;
  display: none;
  opacity: 0;
  transition: opacity 0.15s ease;
}

.footnote-popover.visible {
  display: block;
  opacity: 1;
}

.footnote-popover .popover-content,
.footnote-popover .popover-content p {
  margin: 0;
}

.footnote-popover .footnote-definition-label {
  font-weight: bold;
  color: var(--link-color);
  margin-right: 0.4ch;
}

.popover-close {
  position: absolute;
  top: 0.4rem;
  right: 0.5rem;
  background: none;
  border: none;
  font-size: 1.2rem;
  line-height: 1;
  color: #888888;
  cursor: pointer;
  padding: 0.2rem 0.4rem;
}

.popover-close:hover {
  color: #111111;
}

a.active-note-ref {
  background-color: #f4f3ec;
  border-radius: 2px;
  padding: 0 2px;
}
/* Prevent inline targets and superscripts from inheriting paragraph indents */
sup[id^="fnref-"],
span[id^="fnref-"] {
  text-indent: 0;
  display: inline-block;
}

/* ==========================================================================
   Footnotes & Endnotes Styling (Hugo Goldmark Output)
   ========================================================================== */

.footnotes {
  margin-top: 2.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border-color);
  font-size: 0.95rem;
  line-height: 1.45;
}

.footnotes ol {
  list-style-type: decimal;
  list-style-position: outside;
  padding-left: 2rem;
}

.footnotes li {
  margin-bottom: 0.75rem;
  text-indent: 0;
}

/* Force override global paragraph indent inside native footnotes */
.footnotes li p,
.footnotes p {
  text-indent: 0 !important;
  display: inline;
  margin: 0;
}

.footnotes li a.footnote-backref {
  display: inline-block;
  margin-left: 0.4ch;
  color: var(--link-color);
  text-decoration: none;
  font-family: system-ui, sans-serif;
}

.footnotes li a.footnote-backref:hover {
  text-decoration: underline;
}

/* Highlight footnote definitions at the bottom when clicked */
.footnotes li:target {
  background-color: #f4f3ec;
  border-radius: 3px;
  padding: 0.1rem 0.3rem;
}

/* Smooth scrolling offset for targets */
:target {
  scroll-margin-top: 3rem;
}
/* Smooth scrolling offset for targets */
:target {
  scroll-margin-top: 3rem;
}

/* Smooth scrolling offset for targets */
:target {
  scroll-margin-top: 3rem;
}

.bordered-box {
  margin: 2rem 0;
  padding: 0;
  border: 2px solid #333;
  border-radius: 8px;
  background-color: #f9f9f9;
  box-shadow: 3px 3px 0px rgba(0, 0, 0, 0.1);
  overflow: hidden;
}

.bordered-box-content {
  padding: 1.25rem 1.5rem;
  color: #222;
}

/* Preserve poem line breaks strictly within paragraphs */
.bordered-box-content p {
  white-space: pre-wrap;
  margin-top: 0;
  margin-bottom: 1rem;
}

.bordered-box-content p:last-child {
  margin-bottom: 0;
}

.bordered-box-content h3 {
  white-space: normal;
  margin-top: 0;
  margin-bottom: 1rem;
}

.bordered-box-caption {
  font-size: 0.875rem;
  font-style: italic;
  text-align: center;
  padding: 0.5rem 1rem;
  background-color: #eaeaea;
  border-top: 1px solid #ddd;
  color: #555;
}
