/*
 * Plain CSS for the Latin Reader -- no build step, no framework.
 */

:root {
  color-scheme: light;
  --ink: #2a241d;
  --paper: #faf6ee;
  --muted: #9a8f7c;
  --hover: #ece2cc;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  padding: 3rem 1.5rem 6rem;
  background: var(--paper);
  color: var(--ink);
  font-family: "Iowan Old Style", "Palatino Linotype", "Book Antiqua", Palatino, Georgia, serif;
  font-size: 1.15rem;
  line-height: 1.9;
}

.reader {
  max-width: 34em;
  margin: 0 auto;
}

body:has(dialog#gloss-modal[open]) {
  overflow: hidden;
}

.site-nav {
  max-width: 34em;
  margin: 0 auto 2rem;
  font-size: 0.85rem;
}

.site-nav a {
  color: var(--muted);
  text-decoration: none;
}

.site-nav a:hover {
  color: var(--ink);
  text-decoration: underline;
}

.site-nav a + a {
  margin-left: 1.2em;
}

.glossary {
  max-width: 34em;
  margin: 0 auto;
}

.glossary h1 {
  font-size: 1.4em;
  font-weight: normal;
  font-style: italic;
  margin: 0 0 0.3em;
}

.glossary-intro,
.glossary-empty {
  color: var(--muted);
  font-size: 0.95em;
  margin: 0 0 2em;
}

.lemma-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.lemma-entry {
  padding: 0.75em 0;
  border-bottom: 1px solid var(--hover);
}

.lemma-headword {
  font-style: italic;
  font-size: 1.05em;
}

.lemma-pos {
  color: var(--muted);
  font-size: 0.8em;
  margin-left: 0.5em;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.lemma-count {
  float: right;
  color: var(--muted);
  font-size: 0.8em;
}

.lemma-gloss {
  display: block;
  margin-top: 0.2em;
}

.line-row {
  display: flex;
  align-items: baseline;
  gap: 0.6em;
}

.line-row .verse {
  flex: 1;
}

form.translate-line {
  flex: none;
}

form.translate-line button {
  font: inherit;
  font-size: 0.7em;
  background: none;
  border: 1px dashed var(--hover);
  border-radius: 0.35em;
  padding: 0.15em 0.5em;
  color: var(--muted);
  cursor: pointer;
}

form.translate-line.translated button {
  border-style: solid;
  color: var(--ink);
}

form.translate-line button:hover {
  background: var(--hover);
  color: var(--ink);
}

.verse {
  margin: 0 0 0.15em;
  white-space: normal;
}

.verse.spurious {
  opacity: 0.5;
}

.line-number {
  display: inline-block;
  width: 2.5em;
  margin-right: 0.5em;
  text-align: right;
  color: var(--muted);
  font-size: 0.75em;
  font-variant-numeric: tabular-nums;
  user-select: none;
}

.token {
  display: inline-block;
  color: inherit;
  text-decoration: none;
  border-radius: 0.2em;
  padding: 0 0.05em;
}

.token:hover {
  background: var(--hover);
}

.token.unglossed {
  text-decoration: underline;
  text-decoration-style: dotted;
  text-decoration-color: var(--muted);
  text-underline-offset: 0.2em;
}

dialog#gloss-modal {
  position: fixed;
  box-sizing: border-box;
  width: calc(100% - 2.5rem);
  max-width: 30em;
  max-height: 80vh;
  overflow-y: auto;
  margin: auto;
  padding: 1.75rem;
  border: none;
  border-radius: 0.75em;
  color: var(--ink);
  background: var(--paper);
  box-shadow: 0 1rem 3rem rgba(20, 16, 10, 0.35);
}

dialog#gloss-modal::backdrop {
  background: rgba(20, 16, 10, 0.45);
}

dialog#gloss-modal turbo-frame#gloss {
  display: block;
}

.modal-close {
  position: absolute;
  top: 0.5rem;
  right: 0.75rem;
  border: none;
  background: none;
  font: inherit;
  font-size: 1.5rem;
  line-height: 1;
  color: var(--muted);
  cursor: pointer;
  padding: 0.25em 0.4em;
}

.modal-close:hover {
  color: var(--ink);
}

.gloss-heading {
  margin: 0 0 0.5em;
  font-size: 1.3em;
  font-weight: normal;
  font-style: italic;
}

.definition {
  margin: 0 0 1em;
}

.definition dt {
  color: var(--muted);
  font-size: 0.8em;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-top: 0.6em;
}

.definition dd {
  margin: 0;
}

.translation {
  margin: 0 0 1em;
}

.no-definition {
  color: var(--muted);
  font-style: italic;
  margin: 0 0 1em;
}

.gloss-form p {
  margin: 0 0 0.75em;
}

.gloss-form label {
  display: block;
  font-size: 0.8em;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.2em;
}

.gloss-form input[type="text"],
.gloss-form textarea {
  width: 100%;
  font: inherit;
  font-size: 0.95em;
  padding: 0.4em 0.5em;
  border: 1px solid var(--hover);
  border-radius: 0.25em;
  background: #fff;
  color: inherit;
}

.gloss-form textarea {
  min-height: 3.5em;
  resize: vertical;
}

.gloss-form input[type="submit"] {
  font: inherit;
  background: var(--ink);
  color: var(--paper);
  border: none;
  border-radius: 0.25em;
  padding: 0.5em 1.2em;
  cursor: pointer;
}

.errors {
  color: #a33;
  font-size: 0.9em;
  margin: 0 0 1em;
  padding-left: 1.2em;
}

.suggestions {
  margin: 0 0 1.25em;
}

.suggestions-label {
  margin: 0 0 0.4em;
  font-size: 0.8em;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.suggestion {
  display: block;
  width: 100%;
  text-align: left;
  font: inherit;
  font-size: 0.9em;
  line-height: 1.5;
  color: inherit;
  background: var(--hover);
  border: none;
  border-radius: 0.35em;
  padding: 0.5em 0.7em;
  margin: 0 0 0.4em;
  cursor: pointer;
}

.suggestion:hover {
  filter: brightness(0.96);
}

.suggestion-pos {
  color: var(--muted);
  font-size: 0.85em;
  margin: 0 0.3em;
}

.suggestion-gloss {
  display: block;
  font-size: 0.95em;
}

form.ask-claude {
  margin: 0 0 1.25em;
}

form.ask-claude button {
  font: inherit;
  font-size: 0.85em;
  background: none;
  border: 1px dashed var(--muted);
  border-radius: 0.35em;
  padding: 0.4em 0.7em;
  color: var(--ink);
  cursor: pointer;
}

form.ask-claude button:hover {
  background: var(--hover);
}

.ask-claude-hint {
  color: var(--muted);
  font-size: 0.9em;
}
