:root {
  color-scheme: light;
  --ink: #202020;
  --muted: #6b6258;
  --rule: #d8d1c8;
  --paper: #fbfaf7;
  --accent: #6d1f18;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: Georgia, "Times New Roman", serif;
  line-height: 1.55;
}
main, header, nav {
  max-width: 860px;
  margin: 0 auto;
  padding: 1.25rem;
}
header {
  padding-top: 2.5rem;
  border-bottom: 1px solid var(--rule);
}
h1, h2 {
  font-weight: 500;
  line-height: 1.15;
}
h1 { font-size: clamp(2.1rem, 5vw, 3.5rem); margin: 0; }
h2 { font-size: 1.55rem; margin-top: 2rem; }
.subtitle, .meta { color: var(--muted); }
.meta { font-size: 0.95rem; }
.toc {
  columns: 3 12rem;
  column-gap: 2rem;
  padding-left: 1.2rem;
}
.toc li { break-inside: avoid; margin: 0.15rem 0; }
a { color: var(--accent); text-decoration-thickness: 0.06em; text-underline-offset: 0.14em; }
.navline {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
  margin: 1rem 0 2rem;
  padding: 0.7rem 0;
  font-size: 0.95rem;
}
article {
  font-size: 1.13rem;
}
article p { margin: 0 0 0.85rem; }
article h2 {
  border-top: 1px solid var(--rule);
  font-size: 1.35rem;
  margin: 1.65rem 0 0.8rem;
  padding-top: 1rem;
}
blockquote {
  margin: 1rem 0 1rem 1.5rem;
  padding-left: 1rem;
  border-left: 3px solid var(--rule);
  font-style: italic;
}
.smallcaps { font-variant: small-caps; letter-spacing: 0.02em; }
.synopsis p { margin-left: var(--indent, 0); }
footer {
  max-width: 860px;
  margin: 2rem auto 0;
  padding: 1.25rem;
  color: var(--muted);
  border-top: 1px solid var(--rule);
  font-size: 0.9rem;
}

html { scroll-behavior: smooth; }
.interlinear-header,
main.interlinear-main,
.interlinear-footer {
  max-width: 900px;
}
.interlinear-header h1 {
  font-size: 3rem;
  letter-spacing: 0;
}
.interlinear-header .subtitle { margin-bottom: 0.25rem; }
.interlinear-header .meta { margin-top: 0.25rem; }
.interlinear-main { padding-top: 1.75rem; }
.interlinear-toc {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem 1.25rem;
  margin: 0;
  padding: 0 0 1.5rem;
  border-bottom: 1px solid var(--rule);
  list-style: none;
}
.interlinear-toc a {
  display: inline-block;
  padding: 0.2rem 0;
  font-variant-numeric: tabular-nums;
}
.interlinear-section {
  margin-top: 3rem;
  scroll-margin-top: 1rem;
}
.interlinear-section h2 {
  margin: 0 0 1.5rem;
  padding-top: 0.9rem;
  border-top: 1px solid var(--rule);
  font-size: 1.35rem;
  letter-spacing: 0;
}
.sentence-pair {
  margin: 0 0 1.9rem;
  padding-left: 1rem;
  border-left: 2px solid var(--rule);
}
.sentence-pair .latin,
.sentence-pair .english {
  max-width: 76ch;
  letter-spacing: 0;
}
.sentence-pair .latin {
  margin: 0 0 0.65rem;
  font-size: 1.16rem;
  line-height: 1.66;
}
.sentence-pair .english {
  margin: 0;
  color: #514a43;
  font-size: 1.03rem;
  line-height: 1.62;
}
.interlinear-text .smallcaps {
  font-variant-caps: all-small-caps;
  letter-spacing: 0;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
@media (max-width: 600px) {
  .interlinear-header h1 { font-size: 2.25rem; }
  .interlinear-section { margin-top: 2.4rem; }
  .sentence-pair {
    margin-bottom: 1.65rem;
    padding-left: 0.75rem;
  }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

.interlinear-v2 .section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.5rem;
  padding-top: 0.9rem;
  border-top: 1px solid var(--rule);
}
.interlinear-v2 .section-heading h2 {
  flex: 0 0 auto;
  margin: 0;
  padding: 0;
  border: 0;
}
.mode-switcher {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  width: min(100%, 22rem);
}
.mode-button {
  min-width: 0;
  min-height: 2.25rem;
  padding: 0.35rem 0.7rem;
  border: 1px solid var(--rule);
  border-right: 0;
  border-radius: 0;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 0.88rem;
  letter-spacing: 0;
  line-height: 1.2;
  cursor: pointer;
}
.mode-button:first-child { border-radius: 4px 0 0 4px; }
.mode-button:last-child {
  border-right: 1px solid var(--rule);
  border-radius: 0 4px 4px 0;
}
.mode-button:hover { background: #f1ece6; }
.mode-button[aria-pressed="true"] {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}
.mode-button[aria-pressed="true"] + .mode-button { border-left-color: var(--accent); }
.mode-button:focus-visible {
  position: relative;
  z-index: 1;
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.section-view[hidden] { display: none; }
.line-sentence,
.word-sentence {
  margin: 0 0 2rem;
  padding-left: 1rem;
  border-left: 2px solid var(--rule);
}
.line-pair { margin: 0 0 1rem; }
.line-pair:last-child { margin-bottom: 0; }
.line-pair .latin-line,
.line-pair .english-line {
  max-width: 76ch;
  letter-spacing: 0;
}
.line-pair .latin-line {
  margin: 0 0 0.32rem;
  font-size: 1.09rem;
  line-height: 1.55;
}
.line-pair .english-line {
  margin: 0;
  color: #514a43;
  font-size: 0.98rem;
  line-height: 1.5;
}
.word-lines {
  display: grid;
  gap: 1rem;
}
.word-line {
  display: flex;
  flex-wrap: nowrap;
  align-items: start;
  gap: 0.65rem 0.3rem;
  padding-bottom: 0.25rem;
  overflow-x: auto;
  scrollbar-color: var(--rule) transparent;
  scrollbar-width: thin;
}
.word-unit {
  display: inline-grid;
  flex: 0 0 auto;
  grid-template-rows: minmax(1.65rem, auto) minmax(1.55rem, auto);
  min-width: 1.2rem;
  max-width: 12rem;
  align-items: stretch;
  justify-items: center;
  font-variant-numeric: tabular-nums;
  line-height: 1.25;
  text-align: center;
}
.word-latin,
.word-english {
  display: block;
  width: 100%;
  padding: 0.15rem 0.2rem;
  overflow-wrap: anywhere;
  letter-spacing: 0;
}
.word-latin {
  align-self: end;
  border-bottom: 1px solid var(--rule);
  font-size: 1rem;
}
.word-english {
  align-self: start;
  color: #514a43;
  font-size: 0.84rem;
}
.word-unit.has-latin-gap,
.word-unit.has-english-gap { min-width: 0.75rem; }
.word-unit.has-latin-gap .word-latin,
.word-unit.has-english-gap .word-english { color: transparent; }

@media (max-width: 600px) {
  .interlinear-v2 .section-heading {
    align-items: stretch;
    flex-direction: column;
  }
  .mode-switcher { width: 100%; }
  .mode-button {
    min-height: 2.5rem;
    padding-inline: 0.45rem;
    font-size: 0.84rem;
  }
  .line-sentence,
  .word-sentence { padding-left: 0.75rem; }
  .word-line { gap: 0.6rem 0.22rem; }
  .word-unit { max-width: 9rem; }
}
