/* What Remains: a page from the register. Ledger paper, ink, a red margin rule. */

:root {
  --paper: #e6eae1;
  --paper-deep: #d8ded1;
  --ink: #1c2633;
  --ink-soft: #46505c;
  --feint: #b4c4d1;
  --margin: #b03a2e;
  --ochre: #8a6a2f;
  --serif: "Literata", Georgia, serif;
  --display: "Libre Caslon Display", "Literata", Georgia, serif;
  --hand: "Homemade Apple", cursive;
  --gutter: clamp(16px, 5vw, 64px);
  --rule-x: clamp(10px, 3vw, 48px);
  --line: 1.75rem;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #141a20;
    --paper-deep: #1c242c;
    --ink: #dfe4dc;
    --ink-soft: #a9b2ad;
    --feint: #2d3b48;
    --margin: #d45a4c;
    --ochre: #c9a45e;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #141a20;
  --paper-deep: #1c242c;
  --ink: #dfe4dc;
  --ink-soft: #a9b2ad;
  --feint: #2d3b48;
  --margin: #d45a4c;
  --ochre: #c9a45e;
  color-scheme: dark;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 1.0625rem;
  line-height: 1.7;
  overflow-x: hidden;
}

/* The double red line down the left of every ledger page. */
.margin-rule {
  position: fixed;
  top: 0;
  bottom: 0;
  left: var(--rule-x);
  width: 5px;
  border-left: 1px solid var(--margin);
  border-right: 1px solid var(--margin);
  opacity: 0.7;
  pointer-events: none;
}

header, main > section, footer {
  max-width: 48rem;
  margin-left: calc(var(--rule-x) + var(--gutter));
  margin-right: var(--gutter);
}

a { color: inherit; text-decoration-color: var(--margin); text-underline-offset: 0.18em; }
a:hover { color: var(--margin); }
:focus-visible { outline: 2px solid var(--margin); outline-offset: 3px; }

h1, h2, h3 { font-family: var(--display); font-weight: 400; line-height: 1.15; }
h2 { font-size: clamp(1.7rem, 3.5vw, 2.2rem); margin: 0 0 1rem; }
h3 { font-size: 1.35rem; margin: 0 0 0.5rem; }
p { margin: 0 0 1rem; }
em { font-style: italic; }

/* The register entry */

.register { padding: clamp(3rem, 10vh, 7rem) 0 4rem; }

.register-source {
  font-size: 0.9rem;
  color: var(--ink-soft);
  margin-bottom: 0.25rem;
}

.register-line {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1.5rem;
  padding: 0.6rem 0 0.4rem;
  border-bottom: 1px solid var(--feint);
  border-top: 1px solid var(--feint);
  max-width: 40rem;
  background: repeating-linear-gradient(to bottom, transparent 0 calc(var(--line) - 1px), var(--feint) calc(var(--line) - 1px) var(--line));
}

.hand { font-family: var(--hand); font-size: clamp(1.2rem, 4vw, 2rem); line-height: 1.6; color: var(--ink); }

.age { position: relative; white-space: nowrap; padding-right: 0.5rem; }
.age .hand { font-size: clamp(1.8rem, 6vw, 2.8rem); line-height: 1; }
.struck { position: relative; opacity: 0.55; }
.struck::after {
  content: "";
  position: absolute;
  left: -0.2em;
  right: -0.25em;
  top: 52%;
  border-top: 2px solid var(--margin);
  transform: rotate(-14deg) scaleX(0);
  transform-origin: left;
  animation: strike 0.5s 0.9s ease-out forwards;
}
.correction {
  color: var(--margin);
  margin-left: 0.45em;
  opacity: 0;
  display: inline-block;
  transform: translateY(-0.35em) rotate(-6deg);
  animation: appear 0.4s 1.45s ease-out forwards;
}
@keyframes strike { to { transform: rotate(-14deg) scaleX(1); } }
@keyframes appear { to { opacity: 1; } }

@media (prefers-reduced-motion: reduce) {
  .struck::after { animation: none; transform: rotate(-14deg) scaleX(1); }
  .correction { animation: none; opacity: 1; }
}

.register-note { max-width: 40rem; margin-top: 1rem; color: var(--ink-soft); font-size: 0.98rem; }

.title {
  font-size: clamp(3.4rem, 13vw, 7.5rem);
  letter-spacing: -0.01em;
  margin: clamp(3rem, 9vh, 5rem) 0 0.5rem;
  line-height: 0.95;
}
.subtitle { font-size: clamp(1.1rem, 2.6vw, 1.35rem); margin: 0; }
.byline { margin-top: 1.5rem; color: var(--ink-soft); }

/* Sections */

main > section { padding: 3.5rem 0; border-top: 1px solid var(--feint); }
.lede { color: var(--ink-soft); max-width: 38rem; }

.cover { margin: 2.5rem 0 0; max-width: 15rem; }
.cover img { width: 100%; height: auto; display: block; box-shadow: 6px 8px 0 var(--paper-deep); }
.blurb p { max-width: 38rem; }

@media (min-width: 64rem) {
  header.register { max-width: 68rem; display: grid; grid-template-columns: minmax(0, 1fr) minmax(16rem, 22rem); gap: 4rem; align-items: end; }
  .cover { margin: 0; max-width: none; }
}

table { width: 100%; border-collapse: collapse; margin-top: 1.5rem; font-size: 0.98rem; }
th { font-family: var(--display); font-weight: 400; font-size: 1.15rem; text-align: left; padding: 0 1rem 0.5rem 0; border-bottom: 2px solid var(--ink); }
td { vertical-align: top; padding: 0.8rem 1rem 0.8rem 0; border-bottom: 1px solid var(--feint); width: 50%; }
td:first-child { font-style: italic; color: var(--ink-soft); }
@media (max-width: 34rem) {
  thead { display: none; }
  tr, td { display: block; width: auto; }
  td { padding: 0.15rem 0; border: 0; }
  td:first-child::before { content: "The family said: "; font-style: normal; }
  td:last-child { padding-bottom: 1rem; margin-bottom: 1rem; border-bottom: 1px solid var(--feint); }
  td:last-child::before { content: "The papers say: "; color: var(--margin); }
}

.map-list { list-style: none; padding: 0; margin: 1.5rem 0 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(8.5rem, 1fr)); gap: 1.25rem; }
.map-list a { display: block; text-decoration: none; }
.map-list img { width: 100%; height: 11rem; object-fit: cover; object-position: top; display: block; border: 1px solid var(--feint); background: #fff; }
.map-list span { display: block; font-size: 0.88rem; line-height: 1.35; margin-top: 0.5rem; }
.map-list a:hover img { border-color: var(--margin); }

blockquote { margin: 0 0 1.5rem; padding-left: 1.25rem; border-left: 2px solid var(--ochre); font-size: 1.15rem; }

.button, button {
  display: inline-block;
  font: inherit;
  font-size: 1rem;
  color: var(--paper);
  background: var(--ink);
  border: 1px solid var(--ink);
  padding: 0.65rem 1.3rem;
  text-decoration: none;
  cursor: pointer;
  border-radius: 2px;
}
.button:hover, button:hover:not(:disabled) { background: var(--margin); border-color: var(--margin); color: #fff; }
button:disabled { background: transparent; color: var(--ink-soft); border-color: var(--feint); cursor: default; }

.editions { display: grid; grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr)); gap: 2rem; }
.edition { border-top: 2px solid var(--ink); padding-top: 1rem; }
.price { font-family: var(--display); font-size: 1.8rem; margin: 0.5rem 0 1rem; }
.small { font-size: 0.88rem; color: var(--ink-soft); margin-top: 0.75rem; }

.inline-form { display: flex; flex-wrap: wrap; gap: 0.6rem; max-width: 30rem; }
input[type="email"], input[type="password"] {
  flex: 1 1 14rem;
  font: inherit;
  color: var(--ink);
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--ink);
  padding: 0.55rem 0.1rem;
  min-width: 0;
}
input::placeholder { color: var(--ink-soft); opacity: 0.7; }

.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

footer { padding: 2rem 0 3rem; border-top: 1px solid var(--feint); font-size: 0.88rem; color: var(--ink-soft); }

/* The sample chapter */

.chapter { padding: 3rem 0 4rem; }
.chapter .mark, .sheet .mark { font-size: 0.9rem; color: var(--ink-soft); }
.chapter h1 { font-size: clamp(2.2rem, 7vw, 3.4rem); margin: 2rem 0 0.25rem; }
.chapter .chapter-title { font-family: var(--display); font-size: 1.5rem; margin: 0 0 2.5rem; }
.chapter h2 { font-size: 1.35rem; margin: 2.5rem 0 1rem; }
.chapter p { max-width: 38rem; }
.chapter .end { margin-top: 3rem; border-top: 1px solid var(--feint); padding-top: 1.5rem; }

/* Pages served by the worker: login, thank you, errors */

body.plain { min-height: 100vh; }
.sheet { max-width: 34rem; margin: 0 auto; padding: 4rem var(--gutter); }
.sheet h1 { font-size: 2.2rem; margin: 1.5rem 0 1rem; }
.stack { display: flex; flex-direction: column; gap: 0.75rem; align-items: flex-start; }
.stack input { width: 100%; }
.error { color: var(--margin); }
.files { padding-left: 1.2rem; }
.files li { margin-bottom: 0.75rem; }
.link { word-break: break-all; font-size: 0.9rem; background: var(--paper-deep); padding: 0.5rem 0.75rem; }
