/* Voynichizer web site: every page is a folio of the Voynich manuscript as the Beinecke photographs show it, a leaf
   of vellum on black, written in brown ink, with a real drawing from the manuscript beside the text.
   The whole look is driven by the tokens below: change them to restyle the site. */
:root {
  --night: #12100e;              /* the black of the photographs */
  --night-text: #e2d3ba;
  --night-muted: #a4947c;
  --vellum: #d8c6ab;             /* fallback under the vellum texture */
  --ink: #3a2717;                /* iron-gall brown, darkened for reading */
  --ink-soft: #6a4f37;
  --ink-faint: rgba(70, 45, 25, .35);
  --red: #7f3a27;                /* the red-brown of the roots and of the marks on f1r */
  --red-deep: #652c1d;
  --green: #4f6a42;
  --blue: #405a6f;
  --field: rgba(255, 249, 236, .42);
  --error: #8e2216;
  --focus: #9a5a1c;
  --parchment: #ddccb0;          /* the sheets of the scribe and of the preview */
  --sheet-ink: #463220;
  --shadow: 0 2px 4px rgba(0, 0, 0, .5), 0 18px 50px rgba(0, 0, 0, .55);
  --text-font: "EB Garamond", "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --mono: ui-monospace, "Cascadia Mono", Consolas, "Liberation Mono", monospace;
  color-scheme: dark;
}

@font-face {
  font-family: "EB Garamond";
  src: url("../fonts/eb-garamond-latin-wght-normal.woff2") format("woff2");
  font-weight: 400 800;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "EB Garamond";
  src: url("../fonts/eb-garamond-latin-wght-italic.woff2") format("woff2");
  font-weight: 400 800;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: "Voynichizer EVA";
  src: url("../engine/v21/VoynichizzatoreEVA.ttf") format("truetype");
  font-display: block;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--night);
  color: var(--night-text);
  font: 20px/1.55 var(--text-font);
}
a { color: var(--red); text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:hover { color: var(--red-deep); }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

/* ---------------------------------------------------------------- on the black: title, pages, colophon */
.masthead { max-width: 1000px; margin: 0 auto; padding: 26px 16px 20px; text-align: center; }
.title {
  display: inline-flex;
  align-items: baseline;
  gap: 12px;
  color: var(--night-text);
  text-decoration: none;
  font-size: 30px;
  font-variant-caps: small-caps;
  letter-spacing: .12em;
}
.title:hover { color: #fff3dc; }
.title .mark { font-family: "Voynichizer EVA"; font-variant-caps: normal; letter-spacing: 0; color: #c98a6c; font-size: 28px; }
.masthead nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 2px 26px;
  margin-top: 8px;
  font-size: 18px;
  letter-spacing: .06em;
}
.masthead nav a { color: var(--night-muted); text-decoration: none; padding: 2px 0; border-bottom: 1px solid transparent; }
.masthead nav a:hover { color: var(--night-text); }
.masthead nav a[aria-current="page"] { color: var(--night-text); border-bottom-color: #c98a6c; }
.colophon {
  max-width: 900px;
  margin: 0 auto;
  padding: 26px 16px 44px;
  text-align: center;
  color: var(--night-muted);
  font-size: 16px;
  font-style: italic;
}
.colophon a { color: inherit; }

/* ---------------------------------------------------------------- the folio */
.folio {
  position: relative;
  max-width: 940px;
  margin: 0 auto;
  padding: 58px 64px 64px;
  background: url("../img/vellum-tile.jpg") 0 0 / 900px 900px repeat, var(--vellum);
  color: var(--ink);
  border-radius: 3px 6px 4px 2px;
  box-shadow: inset 0 0 70px rgba(95, 62, 30, .38), inset 0 0 8px rgba(95, 62, 30, .35), var(--shadow);
}
.folio-no {                       /* the folio number, top right, as in the manuscript */
  position: absolute;
  right: 30px;
  top: 18px;
  font-size: 22px;
  font-style: italic;
  color: var(--ink-soft);
}
.spread { display: grid; grid-template-columns: minmax(0, 1fr) 36%; gap: 8px 40px; align-items: start; }
.spread.narrow { grid-template-columns: minmax(0, 1fr) 26%; }
.side { display: flex; flex-direction: column; align-items: center; justify-content: space-between; gap: 34px; align-self: stretch; }
.side .illus { width: 100%; }
.spread > .text { min-width: 0; }
.illus { margin: 0; text-align: center; }
.illus img { width: 100%; height: auto; display: block; mix-blend-mode: multiply; }
.illus figcaption { margin-top: 4px; font-size: 15px; font-style: italic; color: var(--ink-soft); }

/* ---------------------------------------------------------------- writing on the folio */
.tag {                           /* a Voynich-like label above the title, as next to the drawings */
  display: block;
  margin-bottom: 2px;
  font-family: "Voynichizer EVA";
  font-size: 22px;
  color: var(--red);
  opacity: .85;
}
h1 { margin: 0 0 18px; font-size: 42px; line-height: 1.1; font-weight: 500; color: var(--ink); letter-spacing: .01em; }
h2 { margin: 36px 0 10px; font-size: 26px; font-weight: 500; color: var(--red); }
h3 { margin: 24px 0 6px; font-size: 21px; font-weight: 600; color: var(--ink); }
p { margin: 0 0 14px; }
.lead { font-size: 22px; line-height: 1.5; margin-bottom: 28px; }
.lead::first-letter { font-size: 1.9em; line-height: 1; color: var(--red); font-weight: 500; }
.note { font-size: 17px; color: var(--ink-soft); }
.prose ul { padding-left: 1.2em; }
.prose li { margin-bottom: 6px; }
.prose li::marker { color: var(--red); }
.prose table { border-collapse: collapse; width: 100%; font-size: 18px; margin: 12px 0 22px; }
.prose th, .prose td { border-bottom: 1px solid var(--ink-faint); padding: 7px 8px; text-align: left; vertical-align: top; }
.prose th { color: var(--red); font-weight: 500; }
.prose code { font-family: var(--mono); font-size: .8em; background: var(--field); padding: 1px 5px; border-radius: 2px; }

/* ---------------------------------------------------------------- forms, written in the same ink */
.field { margin-bottom: 22px; }
.field > label, .field > .label { display: block; margin-bottom: 6px; font-size: 21px; color: var(--red); }
textarea, input[type="text"], input[type="password"], select {
  width: 100%;
  font: 19px/1.5 var(--text-font);
  color: var(--ink);
  background: var(--field);
  border: 1px solid var(--ink-faint);
  border-radius: 2px;
  padding: 10px 12px;
}
textarea::placeholder, input::placeholder { color: rgba(90, 64, 42, .6); }
textarea:focus, input:focus, select:focus { outline: 2px solid rgba(154, 90, 28, .45); outline-offset: 0; border-color: var(--focus); }
textarea { min-height: 200px; resize: vertical; }
.hint { font-size: 17px; color: var(--ink-soft); margin-top: 6px; }
.hint.bad { color: var(--error); }
.key-row { display: flex; gap: 8px; }
.key-row input { flex: 1; min-width: 0; }
.check, .field > label.check {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin: 6px 0;
  font-size: inherit;
  color: var(--ink);
}
.check input { margin-top: 7px; accent-color: var(--red); }
details { margin: 4px 0 22px; }
summary { cursor: pointer; color: var(--ink-soft); font-style: italic; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 24px 12px;
  font: 500 20px/1 var(--text-font);
  letter-spacing: .03em;
  color: #f4e8d3;
  background: var(--red);
  border: 1px solid var(--red-deep);
  border-radius: 2px;
  box-shadow: 0 1px 2px rgba(50, 20, 5, .35);
  cursor: pointer;
  text-decoration: none;
}
.btn:hover { color: #fff6e6; background: var(--red-deep); }
.btn.secondary { color: var(--red); background: transparent; border-color: rgba(127, 58, 39, .6); box-shadow: none; }
.btn.secondary:hover { background: rgba(127, 58, 39, .08); color: var(--red-deep); }
.btn.small { padding: 7px 14px 8px; font-size: 17px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.actions { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; margin-top: 10px; }

.message { padding: 10px 14px; margin: 18px 0; border-left: 3px solid currentColor; background: rgba(255, 240, 230, .45); }
.message.error { color: var(--error); }
.privacy { display: flex; gap: 12px; align-items: flex-start; font-size: 17px; color: var(--ink-soft); margin-top: 22px; font-style: italic; }
.privacy svg { flex: none; margin-top: 4px; }

/* ---------------------------------------------------------------- the scribe at work: a leaf on black, as in the photographs */
.scriptorium { text-align: center; }
.desk {
  position: relative;
  display: flex;
  justify-content: center;
  margin: 4px 0 18px;
  padding: 26px 16px 34px;
  background: var(--night);
  border-radius: 2px;
  perspective: 1400px;
  overflow: hidden;
}
.sheet {
  position: relative;
  width: min(330px, 100%);
  aspect-ratio: 6 / 8.6;
  background: url("../img/vellum.jpg") center / cover, var(--parchment);
  color: var(--sheet-ink);
  border-radius: 2px 4px 3px 2px;
  box-shadow: inset 0 0 36px rgba(95, 62, 30, .4), 0 6px 18px rgba(0, 0, 0, .6);
  padding: 9% 10% 12%;
  text-align: left;
  transform-origin: left center;
}
.sheet .lines { height: 100%; font-family: "Voynichizer EVA"; font-size: 16px; line-height: 1.75; overflow: hidden; }
.sheet .line { white-space: nowrap; height: 1.75em; }
.sheet .line.para { margin-top: .875em; }
.sheet .folio-label, .page .folio-label {
  position: absolute;
  right: 7%;
  top: 3%;
  font: italic 14px var(--text-font);
  color: #6f5841;
}
.sheet.turning { animation: turn .7s ease-in forwards; }
@keyframes turn { to { transform: rotateY(-70deg) translateX(-12%); opacity: 0; } }
.quill {
  position: absolute;
  left: 0;
  top: 0;
  pointer-events: none;
  transition: transform 80ms linear;
  filter: drop-shadow(2px 5px 3px rgba(0, 0, 0, .45));
}
.quill .vane { fill: #f3ead8; stroke: #6b5a44; stroke-width: 1.2; }
.quill .barbs { stroke: #b9a98c; stroke-width: 1; fill: none; }
.quill .shaft { stroke: #5a4630; stroke-width: 2.4; fill: none; }
.quill .nib { fill: #2b2117; }
.quill.writing svg { animation: scratch .32s ease-in-out infinite alternate; transform-origin: 3px 99px; }
@keyframes scratch { from { transform: rotate(-2.5deg); } to { transform: rotate(2deg); } }
.caption { font-size: 21px; font-style: italic; min-height: 1.5em; margin: 0 0 10px; }
.progress { height: 6px; max-width: 420px; margin: 0 auto; background: var(--ink-faint); border-radius: 3px; overflow: hidden; }
.progress > div { height: 100%; width: 0; background: var(--red); transition: width .4s ease; }
.meta { font-size: 17px; color: var(--ink-soft); margin-top: 8px; }

/* ---------------------------------------------------------------- the finished manuscript */
.downloads { display: grid; gap: 12px; margin: 22px 0 30px; }
.download {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 18px;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border: 1px solid var(--ink-faint);
  background: var(--field);
}
.download strong { display: block; font-weight: 600; }
.download .note { margin: 0; }
.viewer { background: var(--night); padding: 22px 16px 26px; border-radius: 2px; }
.viewer-bar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; margin-bottom: 16px; color: var(--night-text); }
.viewer-bar .nav { display: flex; gap: 6px; align-items: center; }
.viewer-bar select { width: auto; padding: 5px 10px; font-size: 17px; color: var(--night-text); background: #1d1915; border-color: #3a322a; }
.viewer .btn.secondary { color: var(--night-text); border-color: #5a4d40; }
.viewer .btn.secondary:hover { background: #241f1a; color: #fff3dc; }
.toggle { display: inline-flex; border: 1px solid #5a4d40; border-radius: 2px; overflow: hidden; }
.toggle button { font: 17px var(--text-font); padding: 6px 14px 7px; border: 0; background: transparent; color: var(--night-muted); cursor: pointer; }
.toggle button[aria-pressed="true"] { background: #e2d3ba; color: var(--night); }
.page {
  position: relative;
  width: min(540px, 100%);
  aspect-ratio: 6 / 8.6;
  margin: 0 auto;
  background: url("../img/vellum.jpg") center / cover, var(--parchment);
  color: var(--sheet-ink);
  border-radius: 2px 4px 3px 2px;
  box-shadow: inset 0 0 50px rgba(95, 62, 30, .4), 0 6px 18px rgba(0, 0, 0, .6);
  padding: 7.5% 10% 9%;
}
.page .lines { font-family: "Voynichizer EVA"; line-height: 1.75; height: 100%; overflow: hidden; }
.page.illustrated { padding: 0; background: none; box-shadow: 0 6px 18px rgba(0, 0, 0, .6); }
.page.illustrated canvas { width: 100%; height: 100%; display: block; border-radius: 2px 4px 3px 2px; }
.page.eva .lines { font-family: var(--mono); }
.page .line { white-space: nowrap; }
.page .line.para { margin-top: .875em; }

/* ---------------------------------------------------------------- reading */
.drop, .field > label.drop {
  display: block;
  margin: 0;
  font-size: inherit;
  color: var(--ink-soft);
  padding: 22px 16px;
  text-align: center;
  border: 1.5px dashed var(--ink-faint);
  background: var(--field);
  cursor: pointer;
}
.drop.over { border-color: var(--red); color: var(--ink); }
.drop strong { color: var(--ink); font-weight: 600; }
.drop input { display: none; }
.output { min-height: 220px; white-space: pre-wrap; }
.file-status { margin: 10px 0 0; font-size: 17px; min-height: 0; }
.file-status:empty { display: none; }
.file-status.ok { color: var(--green); padding: 8px 12px; border-left: 3px solid var(--green); background: rgba(240, 248, 230, .45); }
.file-status.bad { color: var(--error); padding: 8px 12px; border-left: 3px solid var(--error); background: rgba(255, 240, 230, .45); }
/* research page */
.subtitle { font-size: 22px; font-style: italic; color: var(--ink-soft); margin: -6px 0 14px; }
.byline { font-size: 19px; margin-bottom: 22px; }
.byline .aff { color: var(--ink-soft); font-size: .9em; }
.download.paper { margin: 6px 0 8px; }
.paper-links { margin: 0 0 26px; }
ol.findings .prior { display: block; margin-top: 4px; font-size: .9em; font-style: italic; color: var(--ink-soft); }
.abstract p { text-align: justify; hyphens: auto; }
ol.findings { padding-left: 1.6em; }
ol.findings li { margin-bottom: 10px; }
ol.findings li::marker { color: var(--red); font-weight: 600; }
code.eva { font-family: var(--mono); font-size: .82em; background: none; border: 0; padding: 0; color: var(--red-deep); }
.cite { padding: 10px 14px; border-left: 3px solid var(--ink-faint); background: var(--field); }
.soon { text-align: center; padding: 10px 0 20px; font-size: 24px; font-style: italic; color: var(--ink-soft); }
.totop {
  position: fixed;
  right: 22px;
  bottom: 26px;
  width: 46px;
  height: 46px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  font-size: 24px;
  line-height: 1;
  text-decoration: none;
  color: #f4e8d3;
  background: var(--red);
  border: 1px solid var(--red-deep);
  box-shadow: 0 2px 8px rgba(0, 0, 0, .45);
  z-index: 10;
}
.totop:hover { background: var(--red-deep); color: #fff6e6; }
.colophon-note { font-style: italic; color: var(--ink-soft); border-left: 2px solid var(--red); padding: 2px 0 2px 14px; margin: 0 0 24px; }
.note.closing { margin-top: 30px; padding-top: 14px; border-top: 1px solid var(--ink-faint); }
.tech table { border-collapse: collapse; width: 100%; font-size: 17px; margin: 8px 0 4px; }
.tech td { border-bottom: 1px solid var(--ink-faint); padding: 6px 8px; vertical-align: top; }
.tech td:first-child { color: var(--ink-soft); width: 45%; }
.tech code { font-family: var(--mono); font-size: .78em; word-break: break-all; }

/* real folios beside the scribe and beside the preview */
.desk { gap: 26px; align-items: center; }
.desk-real { margin: 0; width: min(230px, 40%); flex: none; text-align: center; }
.desk-real img { width: 100%; height: auto; display: block; box-shadow: 0 6px 18px rgba(0, 0, 0, .6); }
.desk-real figcaption { margin-top: 6px; font: italic 15px var(--text-font); color: var(--night-muted); }
.pair { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 18px; align-items: start; }
.pair .page { width: 100%; }
.real { margin: 0; text-align: center; }
.real img { width: 100%; height: auto; display: block; box-shadow: 0 6px 18px rgba(0, 0, 0, .6); }
.real figcaption { margin-top: 8px; font: italic 15px var(--text-font); color: var(--night-muted); }
.toc { margin: 6px 0 26px; padding: 14px 18px 8px; border: 1px solid var(--ink-faint); background: var(--field); }
.toc ol { margin: 0; padding-left: 1.4em; columns: 2; column-gap: 34px; font-size: 18px; }
.toc li { break-inside: avoid; margin-bottom: 3px; }
.toc a { text-decoration: none; }
.toc a:hover { text-decoration: underline; }
.diagram { margin: 8px 0 18px; }
.diagram svg { width: 100%; height: auto; display: block; }
.formula { display: block; text-align: center; font-style: italic; margin: 8px 0 12px; font-size: 1.05em; }
pre.file { font-family: var(--mono); font-size: 13px; line-height: 1.5; background: var(--field); border: 1px solid var(--ink-faint);
  padding: 10px 12px; overflow-x: auto; white-space: pre; }
.table-wrap { overflow-x: auto; }
.prose h2 { scroll-margin-top: 16px; }

[hidden] { display: none !important; }

@media (max-width: 760px) {
  body { font-size: 18px; }
  .masthead { padding-top: 18px; }
  .title { font-size: 26px; }
  .masthead nav { font-size: 17px; gap: 2px 18px; }
  .folio { padding: 46px 22px 50px; border-radius: 0; }
  .folio-no { right: 18px; top: 12px; font-size: 19px; }
  .spread, .spread.narrow { grid-template-columns: 1fr; }
  .spread > .side { order: -1; flex-direction: row; justify-content: center; margin: 0 auto 8px; }
  .side .extra { display: none; }
  .side .illus img { width: auto; max-width: 100%; max-height: 260px; margin: 0 auto; }
  .spread.narrow > .side { display: none; }
  .toc ol { columns: 1; }
  .pair { grid-template-columns: 1fr; }
  .desk-real { display: none; }
  h1 { font-size: 34px; }
  .lead { font-size: 19px; }
}
@media (prefers-reduced-motion: reduce) {
  .quill, .quill.writing svg, .sheet.turning, .progress > div { animation: none; transition: none; }
}
