:root {
  color-scheme: light;
  --paper: #fffefa;
  --surround: #f2f0e9;
  --ink: #262821;
  --accent: #205b4c;
  --line: #d8d9cf;
  --serif: Georgia, "Times New Roman", serif;
  --sans: system-ui, sans-serif;
}

body.archive-index,
body.archive-document {
  box-sizing: border-box;
  width: 100% !important;
  height: auto !important;
  min-height: 100vh;
  margin: 0 !important;
  padding: clamp(.65rem, 3vw, 2.5rem) !important;
  color: var(--ink);
  background: var(--surround);
  font: 1.0625rem/1.65 var(--serif);
}

.archive-index > main,
.archive-document > main {
  box-sizing: border-box;
  max-width: 68rem;
  margin-inline: auto;
  padding: clamp(.9rem, 4vw, 3rem);
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: .45rem;
  overflow-wrap: anywhere;
}

.archive-index h1,
.archive-document h1 {
  font-size: clamp(1.75rem, 5vw, 2.75rem);
  line-height: 1.16;
  margin: 0 0 .65em;
}

.archive-index h2,
.archive-document h2 {
  font-size: clamp(1.3rem, 3vw, 1.65rem);
  line-height: 1.25;
}

.archive-index a,
.archive-document a {
  color: var(--accent);
  text-underline-offset: .15em;
}

.archive-index a:visited,
.archive-document a:visited {
  color: #62436c;
}

.archive-index :focus-visible,
.archive-document :focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.archive-index img,
.archive-document img {
  max-width: 100%;
  height: auto !important;
}

.archive-index [style*="text-align: justify" i],
.archive-document [style*="text-align: justify" i] {
  text-align: start !important;
}

.archive-index h3,
.archive-document h3 {
  font-size: 1.2rem;
  line-height: 1.3;
}

.archive-table {
  max-width: 100%;
  overflow-x: auto;
  overflow-wrap: normal;
  margin-block: .75rem;
}

.archive-index pre,
.archive-document pre {
  max-width: 100%;
  overflow: auto;
}

.archive-path {
  display: flex;
  flex-wrap: wrap;
  gap: .2rem .55rem;
  margin-bottom: 1rem;
  font: .9rem/1.5 var(--sans);
}

.archive-intro {
  margin-block: 1rem 1.5rem;
}

.archive-list {
  list-style: none;
  padding: 0;
  margin: 0;
  border-top: 1px solid var(--line);
  font: 1rem/1.45 var(--sans);
}

.archive-list li {
  border-bottom: 1px solid var(--line);
}

.archive-list a {
  display: block;
  padding: .75rem .35rem;
}

.archive-list a:hover {
  background: #eef3ee;
}

.archive-index details {
  margin-top: 1.5rem;
}

.archive-table > table:has(td[colspan] > hr:only-child) {
  max-width: 100%;
  height: auto !important;
}

/* Word and Excel exports in Muhu/Allikad. Keep cell geometry and emphasis. */
.archive-source > main :is(div, p, span, table, caption, td, th, li, a, b, strong, i, em):not(pre *) {
  font-size: inherit !important;
  line-height: inherit !important;
}

.archive-source > main :is(div, p, span, table, caption, td, th, li, a, b, strong, i, em):not(pre *, [class*="MsoListBullet"]) {
  font-family: inherit !important;
}

.archive-source > main p {
  margin-block: .7em;
}

.archive-source > main [style*="text-align:justify" i] {
  text-align: start !important;
}

.archive-source > main h1.MsoNormal {
  margin: 0 0 .65em;
  font: bold clamp(1.75rem, 5vw, 2.75rem)/1.16 var(--serif);
}
