/* Vitabrevis — серифная типографика, минимализм */

:root {
  --bg: #f7f4ee;
  --bg-card: #fffdf8;
  --ink: #1c1814;
  --ink-soft: #4a4036;
  --ink-muted: #8a7e6e;
  --rule: #d8cfbf;
  --accent: #6b3a1f;
  --shadow: 0 1px 0 rgba(28, 24, 20, 0.04);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, "Times New Roman", serif;
  font-size: 18px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a { color: var(--accent); text-decoration: none; border-bottom: 1px solid rgba(107, 58, 31, 0.3); }
a:hover { border-bottom-color: var(--accent); }

.page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.container {
  max-width: 700px;
  margin: 0 auto;
  padding: 60px 24px;
  width: 100%;
}

/* === Главная === */
.home {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 40px 24px 80px; /* нижний padding под fixed footer */
  position: relative;
}

.home-inner {
  width: 100%;
  max-width: 560px;
  text-align: center;
}

.epigraph {
  font-style: italic;
  color: var(--ink-muted);
  font-size: 0.95em;
  margin: 0 0 0.2em;
  line-height: 1.2;
}

.logo {
  font-size: 2.8em;
  font-weight: 400;
  letter-spacing: 0.02em;
  margin: 0 0 2em 0;
  line-height: 1;
}

.intro {
  color: var(--ink-soft);
  font-size: 0.92em;
  line-height: 1.5;
  margin: 0 0 1.6em;
  max-width: 480px;
  margin-left: auto;
  margin-right: auto;
}

.form-block {
  display: flex;
  flex-direction: column;
  gap: 18px;
  text-align: left;
}

.book-input {
  width: 100%;
  padding: 14px 18px;
  font-family: inherit;
  font-size: 1.05em;
  background: var(--bg-card);
  border: 1px solid var(--rule);
  border-radius: 2px;
  color: var(--ink);
  box-shadow: var(--shadow);
}
.book-input:focus {
  outline: none;
  border-color: var(--accent);
}

.length-row {
  display: flex;
  gap: 8px;
}

.length-btn {
  flex: 1;
  padding: 12px 8px;
  background: var(--bg-card);
  border: 1px solid var(--rule);
  border-radius: 2px;
  font-family: inherit;
  font-size: 0.95em;
  color: var(--ink-soft);
  cursor: pointer;
  transition: all 0.15s;
}
.length-btn:hover { border-color: var(--ink-muted); }
.length-btn.active {
  background: var(--ink);
  color: var(--bg-card);
  border-color: var(--ink);
}

.original-toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--ink-soft);
  font-size: 0.9em;
  user-select: none;
}
.original-toggle input { accent-color: var(--accent); }

.submit-btn {
  padding: 14px 24px;
  background: var(--accent);
  color: var(--bg-card);
  border: none;
  border-radius: 2px;
  font-family: inherit;
  font-size: 1em;
  cursor: pointer;
  transition: background 0.15s;
  letter-spacing: 0.02em;
}
.submit-btn:hover { background: #532d18; }
.submit-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.status {
  margin-top: 12px;
  min-height: 1.4em;
  font-size: 0.92em;
  color: var(--ink-muted);
  text-align: center;
}
.status.error { color: #8a3015; }

/* === Reader === */
.reader-page {
  padding: 50px 24px 80px;
}
.reader-content {
  max-width: 700px;
  margin: 0 auto;
}
.reader-content h1 {
  font-size: 1.9em;
  font-weight: 400;
  margin: 0 0 0.5em 0;
  line-height: 1.25;
}
.reader-content h2 {
  font-size: 1.35em;
  font-weight: 400;
  margin: 2em 0 0.6em;
  padding-bottom: 0.3em;
  border-bottom: 1px solid var(--rule);
}
.reader-content h3 {
  font-size: 1.1em;
  font-weight: 400;
  margin: 1.6em 0 0.4em;
  color: var(--ink-soft);
  font-style: italic;
}
.reader-content p {
  margin: 0.9em 0;
  text-align: justify;
  hyphens: auto;
}
.reader-content ul, .reader-content ol {
  padding-left: 1.4em;
}
.reader-content li { margin: 0.3em 0; }
.reader-content blockquote {
  border-left: 3px solid var(--rule);
  margin: 1em 0;
  padding: 0.2em 1em;
  color: var(--ink-soft);
  font-style: italic;
}
.reader-content code {
  background: var(--bg-card);
  padding: 1px 5px;
  border-radius: 2px;
  font-family: "Source Code Pro", monospace;
  font-size: 0.92em;
}

.reader-footer {
  max-width: 700px;
  margin: 60px auto 0;
  padding-top: 30px;
  border-top: 1px solid var(--rule);
  display: flex;
  flex-direction: column;
  gap: 16px;
  font-size: 0.95em;
  color: var(--ink-soft);
}
.reader-footer .row {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
}
.reader-footer a { font-size: 0.95em; }
.ttl-note {
  color: var(--ink-muted);
  font-size: 0.88em;
  font-style: italic;
}
.ttl-note.expired { color: #8a3015; }

/* === Общий футер === */
.page-footer {
  padding: 16px 24px;
  text-align: center;
  font-size: 0.82em;
  color: var(--ink-muted);
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.page-footer .dot { opacity: 0.6; }
.page-footer a {
  color: var(--ink-muted);
  border-bottom-color: transparent;
}
.page-footer a:hover {
  color: var(--accent);
  border-bottom-color: rgba(107, 58, 31, 0.3);
}

/* Главная: футер прижат к низу viewport */
.home > .page-footer {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(to top, var(--bg) 70%, rgba(247, 244, 238, 0));
  pointer-events: none;
}
.home > .page-footer a,
.home > .page-footer span { pointer-events: auto; }

/* Reader: футер в потоке */
.reader-page .page-footer {
  max-width: 700px;
  margin: 40px auto 0;
}

/* === Stub pages === */
.stub {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 40px 24px;
  text-align: center;
}
.stub-inner { max-width: 480px; }
.stub h1 {
  font-size: 1.7em;
  font-weight: 400;
  margin: 0 0 0.6em;
}
.stub p {
  color: var(--ink-soft);
  font-size: 1.05em;
  line-height: 1.6;
}
.stub .home-link {
  display: inline-block;
  margin-top: 2em;
  color: var(--ink-muted);
  font-size: 0.9em;
}

/* мобилка */
@media (max-width: 600px) {
  html, body { font-size: 17px; }
  .logo { font-size: 2.2em; }
  .container, .reader-content, .reader-footer { padding-left: 18px; padding-right: 18px; }
  .reader-page { padding: 30px 0 60px; }
}
