/* Reading Trainer — minimal hand-written CSS, no framework, no build step.
   Vendored JS dependency: htmx.org v2.0.4 (web/public/htmx.min.js). */

:root {
  color-scheme: light dark;
  --bg: #ffffff;
  --fg: #1a1a1a;
  --muted: #5b5b5b;
  --accent: #2454b8;
  --border: #d8d8d8;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #16181c;
    --fg: #e8e8e8;
    --muted: #a3a3a3;
    --accent: #7aa2f7;
    --border: #3a3d42;
  }
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  background: var(--bg);
  color: var(--fg);
  font-family: Georgia, 'Times New Roman', serif;
  font-size: 1.125rem;
  line-height: 1.7;
  max-width: 70ch;
  margin: 0 auto;
  padding: 2rem 1.25rem 4rem;
}

h1,
h2,
h3 {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  line-height: 1.3;
}

p {
  margin: 0 0 1.25em;
}

a {
  color: var(--accent);
}

textarea,
input,
button {
  font: inherit;
  color: inherit;
}

textarea,
input {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.6em 0.75em;
}

button {
  background: var(--accent);
  color: var(--bg);
  border: none;
  border-radius: 4px;
  padding: 0.6em 1.25em;
  cursor: pointer;
}

button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.muted {
  color: var(--muted);
  font-size: 0.9rem;
}

.word-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5em;
  padding: 0;
  margin: 0.75em 0;
  list-style: none;
}

.word-list li {
  display: flex;
  align-items: center;
  gap: 0.5em;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.3em 0.4em 0.3em 0.9em;
}

.word-list .word {
  font-weight: 600;
}

.word-list button {
  font-size: 0.8rem;
  padding: 0.3em 0.8em;
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--border);
}

.word-list button:hover {
  color: var(--fg);
  border-color: var(--fg);
}

.app-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1em;
  border-bottom: 1px solid var(--border);
  margin-bottom: 1.5em;
  padding-bottom: 0.75em;
}

.app-header form {
  margin: 0;
}

.app-header nav a {
  font-size: 0.9rem;
}

.app-header button {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--border);
  padding: 0.4em 0.9em;
}

textarea#text {
  min-height: 12em;
  resize: vertical;
}

#spinner {
  margin: 1em 0;
}

.reading-result {
  margin-top: 2em;
  padding-top: 1em;
  border-top: 1px solid var(--border);
}

.reading-result h2 {
  font-size: 1rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.error {
  color: #b3261e;
  border: 1px solid #b3261e;
  border-radius: 4px;
  padding: 0.75em 1em;
}

@media (prefers-color-scheme: dark) {
  .error {
    color: #ff8a80;
    border-color: #ff8a80;
  }
}

.scheduled {
  font-style: italic;
}

.reading-list {
  list-style: none;
  padding: 0;
  margin: 1em 0;
}

.reading-row {
  display: flex;
  flex-direction: column;
  gap: 0.15em;
  padding: 0.75em 0;
  border-bottom: 1px solid var(--border);
}

/* --- Word-list translation toggle (chapter 10) --- */

/* Translations are hidden until the eye is checked. Only /reading/{id}
   renders a word list, so this rule is scoped to .reading-result. */
.reading-result .translate {
  display: none;
}

.translations-toggle-input:checked ~ .word-list .translate {
  display: inline;
}

/* State holder — never seen, but remains in the tab order and accessibility
   tree so keyboard and screen-reader users operate the real checkbox. */
.translations-toggle-input,
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  border: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

.reading-result-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5em;
}

.translations-toggle {
  display: inline-flex;
  align-items: center;
  padding: 0.25em;
  border-radius: 4px;
  color: var(--muted);
  cursor: pointer;
}

.translations-toggle:hover {
  color: var(--fg);
}

/* Visible focus indicator on the label when the hidden input is focused. */
.translations-toggle-input:focus-visible + .reading-result-head .translations-toggle {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Icon reflects state: slashed eye while hidden, open eye while shown. */
.translations-toggle .eye-open {
  display: none;
}

.translations-toggle-input:checked + .reading-result-head .eye-open {
  display: block;
}

.translations-toggle-input:checked + .reading-result-head .eye-off {
  display: none;
}
