@charset "UTF-8";
@font-face {
  font-family: "Crimson Pro";
  font-style: normal;
  font-weight: 400;
  src: url("/static/fonts/crimson-pro-latin-400-normal.woff2") format("woff2"), url("/static/fonts/crimson-pro-latin-400-normal.woff") format("woff");
}
@font-face {
  font-family: "Crimson Pro";
  font-style: normal;
  font-weight: 700;
  src: url("/static/fonts/crimson-pro-latin-700-normal.woff2") format("woff2"), url("/static/fonts/crimson-pro-latin-700-normal.woff") format("woff");
}
@font-face {
  font-family: "Crimson Pro";
  font-style: italic;
  font-weight: 400;
  src: url("/static/fonts/crimson-pro-latin-400-italic.woff2") format("woff2"), url("/static/fonts/crimson-pro-latin-400-italic.woff") format("woff");
}
@font-face {
  font-family: "Crimson Pro";
  font-style: italic;
  font-weight: 700;
  src: url("/static/fonts/crimson-pro-latin-700-italic.woff2") format("woff2"), url("/static/fonts/crimson-pro-latin-700-italic.woff") format("woff");
}
:root {
  --bg: #f5f0e8;
  --bg-editor: #faf8f4;
  --bg-preview: #eee9df;
  --bg-header: #f5f0e8;
  --border: #d9d0c1;
  --border-light: #e6dfd3;
  --hairline: 0.5px solid var(--text-heading);
  --text: #3a322a;
  --text-muted: #8c8177;
  --text-heading: #2a231c;
  --accent: #8b6f4e;
  --accent-light: #c8b88a;
  --parchment: #f8f6f0;
  --splitter: #cdc3b3;
  --splitter-hover: #b0a48e;
  --font-book: "Crimson Pro", "Times New Roman", times, serif;
  --baseline: 12.5px;
  --lines-per-page: 48;
}

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  font-size: 15px;
  color: var(--text);
  background: var(--bg);
  overflow: hidden;
}

.app {
  display: flex;
  flex-direction: column;
  height: 100vh;
}
@supports (height: 1dvh) {
  .app {
    height: 100dvh;
  }
}

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.25rem;
  height: 48px;
  min-height: 48px;
  background: var(--bg-header);
  border-bottom: 1px solid var(--border);
}

.app-title {
  font-family: var(--font-book);
  font-size: 1.6rem;
  font-weight: 400;
  letter-spacing: 0.06em;
  color: var(--text-heading);
  text-transform: lowercase;
  font-variant: small-caps;
}

.app-footer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0 1.25rem;
  height: 32px;
  min-height: 32px;
  font-size: 0.68rem;
  color: var(--text-muted);
  background: var(--bg-header);
  border-top: 1px solid var(--border);
}

.app-footer a {
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.15s;
}

.app-footer a:hover {
  color: var(--text);
}

.footer-sep {
  opacity: 0.5;
}

.editor-layout {
  display: flex;
  flex: 1;
  min-height: 0;
}

.editor-pane {
  display: flex;
  flex-direction: column;
  flex: 1 1 50%;
  min-width: 280px;
  background: var(--bg-editor);
}

.preview-pane {
  display: flex;
  flex-direction: column;
  flex: 1 1 50%;
  min-width: 280px;
  background: var(--bg-preview);
}

.pane-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1rem;
  height: 36px;
  min-height: 36px;
  border-bottom: 1px solid var(--border-light);
}

.pane-label {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}

.toolbar-left {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.toolbar-right {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.doc-stats {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.help-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: transparent;
  color: var(--text-muted);
  font-size: 0.68rem;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.help-toggle:hover,
.help-toggle[aria-expanded=true] {
  color: var(--text);
  border-color: var(--accent-light);
  background: rgba(139, 111, 78, 0.06);
}

.syntax-help {
  overflow: hidden;
  max-height: 0;
  border-bottom: 0 solid var(--border-light);
  background: var(--bg-header);
  transition: max-height 0.3s ease, border-bottom-width 0.3s ease, padding 0.3s ease;
  padding: 0 1rem;
}

.syntax-help.open {
  max-height: 260px;
  border-bottom-width: 1px;
  padding: 0.6rem 1rem;
}

.syntax-help-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.72rem;
  color: var(--text);
}

.syntax-help-table th {
  text-align: left;
  font-weight: 600;
  font-size: 0.66rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  padding: 0 0 0.35rem;
  border-bottom: 1px solid var(--border-light);
}

.syntax-help-table td {
  padding: 0.25rem 0;
  vertical-align: top;
}

.syntax-help-table td:first-child {
  width: 45%;
  padding-right: 1rem;
}

.syntax-help-table code {
  font-family: "SF Mono", "Fira Code", Menlo, Consolas, monospace;
  font-size: 0.88em;
  background: rgba(0, 0, 0, 0.04);
  padding: 0.1em 0.35em;
  border-radius: 3px;
}

.option-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: transparent;
  color: var(--text-muted);
  font-size: 0.68rem;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.option-toggle:hover,
.option-toggle[aria-expanded=true] {
  color: var(--text);
  border-color: var(--accent-light);
  background: rgba(139, 111, 78, 0.06);
}

.preview-options {
  overflow: hidden;
  max-height: 0;
  border-bottom: 0 solid var(--border-light);
  background: var(--bg-header);
  transition: max-height 0.3s ease, border-bottom-width 0.3s ease, padding 0.3s ease;
  padding: 0 1rem;
}

.preview-options.open {
  max-height: 120px;
  border-bottom-width: 1px;
  padding: 0.6rem 1rem;
}

.option-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.2rem 0;
}

.option-row label {
  font-size: 0.72rem;
  color: var(--text);
  white-space: nowrap;
}

.option-input {
  width: 8rem;
  padding: 0.2em 0.4em;
  font-size: 0.72rem;
  font-family: inherit;
  color: var(--text);
  background: var(--parchment);
  border: 1px solid var(--border);
  border-radius: 3px;
}

.option-input:focus {
  outline: none;
  border-color: var(--accent);
}

#markdown-input {
  flex: 1;
  border: none;
  outline: none;
  resize: none;
  padding: 1.25rem 1.5rem;
  font-family: "SF Mono", "Fira Code", "Fira Mono", "Roboto Mono", "Cascadia Code", Menlo, Consolas, monospace;
  font-size: 0.88rem;
  line-height: 1.7;
  color: var(--text);
  background: transparent;
  tab-size: 4;
}

#markdown-input::placeholder {
  color: var(--text-muted);
  opacity: 0.6;
}

#markdown-input:focus {
  outline: none;
}

.editor-actions {
  display: flex;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  border-top: 1px solid var(--border-light);
  background: var(--bg-editor);
}

.editor-btn {
  padding: 0.3rem 0.75rem;
  font-size: 0.72rem;
  font-family: inherit;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 3px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.editor-btn:disabled {
  opacity: 0.35;
  cursor: default;
}

.editor-btn:hover:not(:disabled) {
  color: var(--text);
  border-color: var(--accent-light);
  background: rgba(139, 111, 78, 0.06);
}

#btn-sample {
  margin-left: auto;
}

.splitter {
  flex: 0 0 5px;
  background: var(--border);
  cursor: col-resize;
  position: relative;
  transition: background 0.15s;
  z-index: 10;
}

.splitter::before {
  content: "";
  position: absolute;
  inset: 0 -4px;
  z-index: 1;
}

.splitter:hover,
.splitter.dragging {
  background: var(--splitter-hover);
}

.splitter-handle {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 3px;
  height: 32px;
  border-radius: 2px;
  opacity: 0;
  background: var(--text-muted);
  transition: opacity 0.15s;
}

.splitter:hover .splitter-handle,
.splitter.dragging .splitter-handle {
  opacity: 0.4;
}

.preview-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 1.5rem;
}

.page-nav {
  display: none;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  padding: 0.75rem 0;
  user-select: none;
}

.page-nav.visible {
  display: flex;
}

.page-nav-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--parchment);
  color: var(--text);
  font-size: 0.9rem;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.page-nav-btn:disabled {
  opacity: 0.35;
  cursor: default;
}

.page-nav-btn:hover:not(:disabled) {
  background: var(--bg-editor);
  border-color: var(--accent-light);
}

.page-nav-info {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.78rem;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.page-nav-input {
  width: 3em;
  text-align: center;
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 0.2em 0.3em;
  font-size: 0.78rem;
  font-family: inherit;
  color: var(--text);
  background: var(--parchment);
  font-variant-numeric: tabular-nums;
}

.page-nav-input:focus {
  outline: none;
  border-color: var(--accent);
}

.preview-scroll::-webkit-scrollbar,
#markdown-input::-webkit-scrollbar {
  width: 8px;
}

.preview-scroll::-webkit-scrollbar-track,
#markdown-input::-webkit-scrollbar-track {
  background: transparent;
}

.preview-scroll::-webkit-scrollbar-thumb,
#markdown-input::-webkit-scrollbar-thumb {
  background: var(--splitter);
  border-radius: 4px;
}

.preview-scroll::-webkit-scrollbar-thumb:hover,
#markdown-input::-webkit-scrollbar-thumb:hover {
  background: var(--splitter-hover);
}

::selection {
  background: rgba(139, 111, 78, 0.18);
}

body.resizing {
  cursor: col-resize;
  user-select: none;
}

body.resizing iframe,
body.resizing textarea {
  pointer-events: none;
}

/* Header page links */
.header-links {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.nav-menu-btn {
  display: none;
}

.header-link {
  font-size: 0.72rem;
  color: var(--text-muted);
  text-decoration: none;
  font-family: inherit;
  letter-spacing: 0.04em;
  transition: color 0.15s;
}

.header-link:hover {
  color: var(--text);
}

/* Page modal */
.page-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.45);
  opacity: 0;
  transition: opacity 0.2s ease;
  pointer-events: none;
}

.page-modal.open {
  opacity: 1;
  pointer-events: auto;
}

.page-modal-content {
  position: relative;
  width: 90%;
  max-width: 600px;
  max-height: 80vh;
  background: var(--parchment, #faf6ee);
  border-radius: 6px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
  padding: 2rem 2.25rem;
  overflow-y: auto;
  font-family: var(--font-book);
  color: var(--text);
  transform: translateY(8px);
  transition: transform 0.2s ease;
}

.page-modal.open .page-modal-content {
  transform: translateY(0);
}

.page-modal-close {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  width: 28px;
  height: 28px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 1.3rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: background 0.15s, color 0.15s;
}

.page-modal-close:hover {
  background: rgba(0, 0, 0, 0.06);
  color: var(--text);
}

.page-modal-title {
  font-size: 1.3rem;
  font-weight: 600;
  margin-bottom: 1rem;
  padding-right: 2rem;
}

.page-modal-body {
  font-size: 0.95rem;
  line-height: 1.7;
}

.page-modal-body h2 {
  font-size: 1.1rem;
  font-weight: 600;
  margin-top: 1.5rem;
  margin-bottom: 0.4rem;
}

.page-modal-body p {
  margin-bottom: 0.8rem;
  text-align: justify;
}

.page-modal-body ul,
.page-modal-body ol {
  margin-bottom: 0.8rem;
  padding-left: 1.25rem;
}

.page-modal-body li {
  margin-bottom: 0.3rem;
}

.page-modal-body code {
  font-family: "SF Mono", Menlo, Consolas, monospace;
  font-size: 0.88em;
  background: rgba(0, 0, 0, 0.04);
  padding: 0.1em 0.35em;
  border-radius: 3px;
}

.mobile-tabs {
  display: none;
}

#book-content:empty::before {
  content: "Your rendered text will appear here…";
  color: var(--text-muted);
  font-style: italic;
  opacity: 0.5;
}

#book-content > .summary {
  font-style: italic;
  text-indent: 0;
  text-align: justify;
  font-size: 0.7rem;
  line-height: var(--baseline);
  margin-bottom: var(--baseline);
}

#book-content .columns .summary {
  font-style: italic;
  text-indent: 0;
  text-align: justify;
  font-size: 0.7rem;
  line-height: var(--baseline);
  margin-bottom: var(--baseline);
}

#book-content table {
  width: 100%;
  border-collapse: collapse;
  margin: var(--baseline) 0;
  font-size: 0.95em;
}

#book-content th,
#book-content td {
  text-align: left;
  padding: 0.5em 0.75em;
  border-bottom: 1px solid var(--border-light);
}

#book-content th {
  font-weight: 600;
  border-bottom-color: var(--accent-light);
}

.book-page {
  position: relative;
  width: 480px;
  height: 696px;
  margin: 0 auto;
  padding: 47px 38px;
  overflow: hidden;
  background-color: var(--parchment);
  background-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.02) 0%, transparent 40%, transparent 60%, rgba(0, 0, 0, 0.02) 100%);
  border: 1px solid var(--accent-light);
  border-radius: 2px 6px 6px 2px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06), 0 4px 16px rgba(0, 0, 0, 0.04), inset 0 0 40px rgba(0, 0, 0, 0.02);
}

.running-header {
  position: absolute;
  top: 0;
  left: 38px;
  right: 38px;
  height: 47px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  padding-bottom: 10px;
  font-family: var(--font-book);
  font-size: 0.55rem;
  line-height: 1;
  color: var(--text-heading);
  letter-spacing: 0.03em;
  text-transform: uppercase;
  pointer-events: none;
}

.running-header-left,
.running-header-right {
  white-space: nowrap;
}

.book-page::after {
  content: "";
  display: block;
  position: absolute;
  bottom: 47px;
  left: 38px;
  right: 38px;
  border-top: var(--hairline);
}

.book-page:has(#book-content:empty)::after,
.book-page:has(.page-footnotes)::after {
  display: none;
}

.book-page-measure {
  font-family: var(--font-book);
  font-size: 0.7rem;
  line-height: var(--baseline);
  color: #2c2c2c;
  text-align: justify;
  hyphens: auto;
  position: absolute;
  left: -9999px;
  top: 0;
  display: flex;
  flex-direction: column;
}

.book-page-measure .columns {
  column-count: 2;
  column-gap: 1rem;
  column-fill: auto;
  flex: 1;
  min-height: 0;
  position: relative;
}

.book-page-measure p {
  margin-bottom: var(--baseline);
  text-indent: 1.5em;
}

.book-page-measure h2 {
  font-family: var(--font-book);
  font-size: 0.87rem;
  font-weight: 400;
  text-transform: uppercase;
  text-align: center;
  letter-spacing: 0.1em;
  margin-top: var(--baseline);
  margin-bottom: 0;
  color: var(--text-heading);
  line-height: calc(var(--baseline) * 2);
}

.book-page-measure h1 {
  font-family: var(--font-book);
  font-size: 1.4rem;
  font-weight: 400;
  text-transform: uppercase;
  text-align: center;
  letter-spacing: 0.06em;
  margin-top: 0;
  margin-bottom: var(--baseline);
  color: var(--text-heading);
  line-height: calc(var(--baseline) * 2);
}

.book-page-measure .summary {
  font-style: italic;
  text-indent: 0;
  text-align: justify;
  font-size: 0.7rem;
  line-height: var(--baseline);
  margin-bottom: var(--baseline);
}

.book-page-measure .columns .summary {
  margin-bottom: var(--baseline);
}

.book-page-measure .drop-cap {
  text-indent: 0;
  margin: 0;
}

.book-page-measure .initial-cap {
  float: left;
  font-family: var(--font-book);
  font-size: calc(var(--baseline) * 4.2);
  font-weight: 400;
  line-height: calc(var(--baseline) * 3);
  margin-right: 0.3rem;
  margin-bottom: 0;
  color: var(--text-heading);
}

.book-page-measure .first-word {
  font-variant: small-caps;
}

.book-page-measure p.chapter-open {
  text-indent: 0;
  margin: 0;
}

.book-page-measure p[data-verse] {
  text-indent: 0.2rem;
  margin: 0;
}

.book-page-measure p[data-verse]::before {
  content: attr(data-verse) " ";
  font-size: 1em;
  font-weight: 400;
  vertical-align: baseline;
  color: inherit;
}

.book-page-measure .columns sup > a {
  vertical-align: text-top;
  position: relative;
  top: -0.25rem;
  margin-right: 0.025rem;
}

.book-page-measure p.continuation {
  text-indent: 0;
  margin: 0;
}

.book-page-measure p.continuation::before {
  content: none;
}

.book-page-measure .page-footnotes {
  margin-top: auto;
  padding-top: 6px;
  border-top: var(--hairline);
  position: relative;
}

.book-page-measure .page-footnotes ol {
  list-style: none;
  padding: 0;
  margin: 0;
  column-count: 3;
  column-gap: 0.6rem;
  column-fill: auto;
  font-family: var(--font-book);
  font-size: 0.46rem;
  line-height: 0.54rem;
  text-align: left;
}

.book-page-measure .page-footnotes .fn-hairline {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 0;
  border-left: var(--hairline);
  pointer-events: none;
}

.book-page-measure .page-footnotes .fn-hairline-1 {
  left: 33.3333333333%;
}

.book-page-measure .page-footnotes .fn-hairline-2 {
  left: 66.6666666667%;
}

.book-page-measure .page-footnotes li {
  margin: 0;
  padding: 0;
  break-inside: avoid;
}

.book-page-measure .page-footnotes li p {
  margin: 0;
  text-indent: 0;
}

.book-page-measure .page-footnotes a[data-footnote-backref] {
  display: none;
}

.book-page-measure sup:has(a[data-footnote-ref]) {
  font-size: 0;
  line-height: 0;
  vertical-align: baseline;
}

.book-page-measure sup a[data-footnote-ref] {
  font-family: var(--font-book);
  font-style: italic;
  font-size: 0.36rem;
  text-decoration: none;
  color: inherit;
  vertical-align: super;
  line-height: 0;
}

.book-page-measure .page-footnotes .fn-label {
  font-weight: 700;
}

#book-content {
  font-family: var(--font-book);
  font-size: 0.7rem;
  line-height: var(--baseline);
  color: #2c2c2c;
  text-align: justify;
  hyphens: auto;
  height: 100%;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

#book-content p {
  text-indent: 1.5em;
}

#book-content h3 + p,
#book-content p:first-child {
  text-indent: 0;
}

#book-content h1,
#book-content h2,
#book-content h3,
#book-content h4,
#book-content h5,
#book-content h6 {
  font-family: var(--font-book);
  color: var(--text-heading);
  margin-top: calc(var(--baseline) * 2);
  margin-bottom: var(--baseline);
  text-align: left;
  line-height: calc(var(--baseline) * 2);
}

#book-content h1 {
  font-size: 1.4rem;
  font-weight: 400;
  text-transform: uppercase;
  text-align: center;
  letter-spacing: 0.06em;
  border-bottom: none;
  padding-bottom: 0;
  margin-top: calc(var(--baseline) * 2);
  margin-bottom: var(--baseline);
}

#book-content h1:first-child {
  margin-top: 0;
}

#book-content h2 {
  font-size: 0.87rem;
  font-weight: 400;
  text-transform: uppercase;
  text-align: center;
  letter-spacing: 0.1em;
  margin-top: var(--baseline);
  margin-bottom: 0;
}

#book-content h3 {
  font-size: 1.1rem;
  font-style: italic;
}

#book-content blockquote {
  border-left: 3px solid var(--accent-light);
  margin: var(--baseline) 0 var(--baseline) 1em;
  padding: 0.4em 0 0.4em 1.2em;
  font-style: italic;
  color: #555;
}

#book-content code {
  font-family: "SF Mono", "Fira Code", Menlo, Consolas, monospace;
  background-color: rgba(0, 0, 0, 0.04);
  padding: 0.15em 0.4em;
  border-radius: 3px;
  font-size: 0.88em;
}

#book-content pre {
  background-color: rgba(0, 0, 0, 0.04);
  border: 1px solid var(--accent-light);
  border-radius: 3px;
  padding: 1em;
  overflow-x: auto;
  font-size: 0.85em;
  line-height: var(--baseline);
}

#book-content pre code {
  background: none;
  padding: 0;
}

#book-content hr {
  border: none;
  border-top: 0.5px solid var(--accent-light);
  margin: calc(var(--baseline) * 2) auto;
  width: 40%;
}

#book-content ul,
#book-content ol {
  padding-left: 2em;
  margin-bottom: var(--baseline);
}

#book-content li {
  margin-bottom: 0;
}

#book-content a {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-color: var(--accent-light);
  text-underline-offset: 2px;
}

#book-content a:hover {
  text-decoration-color: var(--accent);
}

#book-content img {
  max-width: 100%;
  height: auto;
  margin: var(--baseline) 0;
  border-radius: 2px;
}

#book-content .summary {
  font-style: italic;
  text-indent: 0;
  text-align: justify;
  font-size: 0.7rem;
  line-height: var(--baseline);
  margin-bottom: var(--baseline);
}

#book-content .columns .summary {
  margin-bottom: var(--baseline);
}

#book-content .columns {
  column-count: 2;
  column-gap: 1rem;
  column-fill: auto;
  flex: 1;
  min-height: 0;
  overflow: hidden;
  position: relative;
}

#book-content .columns::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  border-left: var(--hairline);
  pointer-events: none;
}

#book-content .columns p {
  margin: 0;
}

#book-content .page-footnotes {
  margin-top: auto;
  padding-top: 6px;
  border-top: var(--hairline);
  position: relative;
}

#book-content .page-footnotes ol {
  list-style: none;
  padding: 0;
  margin: 0;
  column-count: 3;
  column-gap: 0.6rem;
  column-fill: auto;
  font-family: var(--font-book);
  font-size: 0.46rem;
  line-height: 0.54rem;
  text-align: left;
}

#book-content .page-footnotes .fn-hairline {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 0;
  border-left: var(--hairline);
  pointer-events: none;
}

#book-content .page-footnotes .fn-hairline-1 {
  left: 33.3333333333%;
}

#book-content .page-footnotes .fn-hairline-2 {
  left: 66.6666666667%;
}

#book-content .page-footnotes li {
  margin: 0;
  padding: 0;
  break-inside: avoid;
}

#book-content .page-footnotes li p {
  margin: 0;
  text-indent: 0;
}

#book-content .page-footnotes a[data-footnote-backref] {
  display: none;
}

#book-content sup:has(a[data-footnote-ref]) {
  font-size: 0;
  line-height: 0;
  vertical-align: baseline;
}

#book-content sup a[data-footnote-ref] {
  font-family: var(--font-book);
  font-style: italic;
  font-size: 0.36rem;
  text-decoration: none;
  color: inherit;
  vertical-align: super;
  line-height: 0;
}

#book-content .page-footnotes .fn-label {
  font-weight: 700;
}

#book-content .drop-cap {
  text-indent: 0;
  margin: 0;
}

#book-content .initial-cap {
  float: left;
  font-family: var(--font-book);
  font-size: calc(var(--baseline) * 4.2);
  font-weight: 400;
  line-height: calc(var(--baseline) * 3);
  margin-right: 0.3rem;
  margin-bottom: 0;
  color: var(--text-heading);
}

#book-content .first-word {
  font-variant: small-caps;
}

#book-content p.chapter-open {
  text-indent: 0;
  margin: 0;
}

#book-content p[data-verse] {
  text-indent: 0.2rem;
  margin: 0;
}

#book-content p[data-verse]::before {
  content: attr(data-verse) " ";
  font-size: 1em;
  font-weight: 400;
  vertical-align: baseline;
  color: inherit;
}

#book-content p.continuation {
  text-indent: 0;
  margin: 0;
}

#book-content p.continuation::before {
  content: none;
}

#book-content .columns sup > a {
  vertical-align: text-top;
  position: relative;
  top: -0.25rem;
  margin-right: 0.025rem;
}

.page-timeframe {
  position: absolute;
  bottom: 0;
  font-family: var(--font-book);
  font-size: 0.42rem;
  line-height: 1;
  color: var(--text-heading);
  pointer-events: none;
  max-width: 33.3333333333%;
}

.page-timeframe-recto {
  right: 0;
  text-align: right;
}

.page-timeframe-verso {
  left: 0;
  text-align: left;
}

@media (width <= 768px) {
  .app-header {
    height: 40px;
    min-height: 40px;
    padding: 0 0.75rem;
  }
  .app-title {
    font-size: 1.3rem;
  }
  .header-links {
    gap: 0;
    position: relative;
  }
  .header-link {
    display: none;
  }
  .nav-menu-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-size: 1.1rem;
    cursor: pointer;
    border-radius: 3px;
    transition: background 0.15s, color 0.15s;
  }
  .nav-menu-btn:hover,
  .nav-menu-btn[aria-expanded=true] {
    color: var(--text);
    background: rgba(139, 111, 78, 0.08);
  }
  .header-links.nav-open {
    position: fixed;
    top: 40px;
    right: 0;
    flex-direction: column;
    background: var(--bg-header);
    border: 1px solid var(--border);
    border-top: none;
    border-right: none;
    border-radius: 0 0 0 4px;
    z-index: 500;
    padding: 0.25rem 0;
    min-width: 120px;
    box-shadow: -2px 4px 12px rgba(0, 0, 0, 0.12);
  }
  .header-links.nav-open .header-link {
    display: block;
    padding: 0.65rem 1.25rem;
    font-size: 0.8rem;
  }
  .page-modal-content {
    width: 95%;
    padding: 1.5rem;
    max-height: 85vh;
  }
  .app-footer {
    height: 28px;
    min-height: 28px;
    font-size: 0.62rem;
  }
  .mobile-tabs {
    display: flex;
    height: 36px;
    min-height: 36px;
    background: var(--bg-header);
    border-bottom: 1px solid var(--border);
  }
  .mobile-tab {
    flex: 1;
    border: none;
    background: transparent;
    font-family: inherit;
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    cursor: pointer;
    transition: color 0.15s, border-color 0.15s;
    border-bottom: 2px solid transparent;
  }
  .mobile-tab.active {
    color: var(--text);
    border-bottom-color: var(--accent);
  }
  .editor-layout {
    flex-direction: column;
  }
  .splitter {
    display: none;
  }
  .editor-pane,
  .preview-pane {
    min-width: 0;
    flex: 1 1 100% !important;
  }
  .editor-pane.mobile-hidden,
  .preview-pane.mobile-hidden {
    display: none;
  }
  .pane-toolbar {
    height: 32px;
    min-height: 32px;
    padding: 0 0.75rem;
  }
  .pane-label {
    display: none;
  }
  #markdown-input {
    padding: 0.75rem;
    font-size: 0.82rem;
  }
  .editor-actions {
    flex-shrink: 0;
    padding: 0.4rem 0.75rem;
  }
  .preview-scroll {
    padding: 0.75rem;
    display: flex;
    flex-direction: column;
    align-items: center;
  }
  .book-page {
    --book-scale: 0.68;
    zoom: var(--book-scale);
  }
  .page-nav {
    width: 100%;
    padding: 0.5rem 0;
  }
}
