/* Sotto: paper by day, as in the app (ios/Shared/Tokens.swift). */

@font-face {
  font-family: 'Goudy Bookletter 1911';
  src: url('/fonts/GoudyBookletter1911.woff2') format('woff2');
  font-display: swap;
}
@font-face {
  font-family: 'Libre Caslon Text';
  src: url('/fonts/LibreCaslonText.woff2') format('woff2');
  font-display: swap;
}
@font-face {
  font-family: 'Libre Caslon Text';
  src: url('/fonts/LibreCaslonText-Italic.woff2') format('woff2');
  font-style: italic;
  font-display: swap;
}

:root {
  --paper0: #efe6d5;
  --paper1: #f7f1e5;
  --paper2: #fcf8f0;
  --paper3: #e3d3b6;
  --ink: #45301f;
  --ink-secondary: #65543f;
  --vermilion: #b23a25;
  --cut-shadow: 58 42 30;
  --rule: rgb(69 48 31 / 0.14);
  --display: 'Goudy Bookletter 1911', 'Iowan Old Style', Georgia, serif;
  --prose: 'Libre Caslon Text', 'Iowan Old Style', Georgia, serif;
  --column: 42rem;
  --gutter: 20px;
  /* The app's paper grain in two layers that never meet in step: fibres,
     flecks and pulp on a small tile, the dye on a large one of another
     size, so no pattern repeats. Printed on white, they are multiplied
     onto any paper colour (scripts/grain.swift). */
  --grain: url('/images/grain-fine.webp') 0 0 / 170px, url('/images/grain-dye.webp') 0 0 / 997px;
  color-scheme: light;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--grain), var(--paper0);
  background-blend-mode: multiply, multiply, normal;
  color: var(--ink);
  font: 17px/1.6 var(--prose);
  font-variant-numeric: oldstyle-nums;
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
  text-decoration-color: rgb(69 48 31 / 0.4);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
}
a:hover {
  text-decoration-color: var(--ink);
}
a:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 3px;
  border-radius: 2px;
}

h1,
h2,
h3 {
  font-family: var(--display);
  font-weight: normal;
  line-height: 1.15;
  margin: 0;
}

.skip {
  position: absolute;
  left: -999px;
}
.skip:focus {
  left: var(--gutter);
  top: 12px;
  background: var(--paper2);
  padding: 6px 12px;
  z-index: 2;
}

/* A sheet of paper lying on the ground: lighter, with a short hard warm
   shadow and a faint lift (PaperSheet). */
.sheet {
  background: var(--grain), var(--paper1);
  background-blend-mode: multiply, multiply, normal;
  border-radius: 14px;
  box-shadow:
    0 1.25px 0 rgb(var(--cut-shadow) / 0.24),
    0 2.25px 6px rgb(var(--cut-shadow) / 0.1);
}

.column {
  width: min(100% - 2 * var(--gutter), var(--column));
  margin-inline: auto;
}

/* The small header of an inner page. */
.masthead {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 28px 0 22px;
}
.masthead a {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
}
.masthead img {
  width: 40px;
  height: 40px;
  border-radius: 9px;
  box-shadow: 0 1.25px 0 rgb(var(--cut-shadow) / 0.24);
}
.masthead span {
  font: 26px/1 var(--display);
}

/* An inner page's text. */
.page {
  padding: 36px 24px 40px;
}
.page h1 {
  font-size: 40px;
}
.page .lede {
  color: var(--ink-secondary);
  font-style: italic;
  margin: 10px 0 0;
}
.page h2 {
  font-size: 27px;
  margin: 1.8em 0 0.4em;
}
.page h3 {
  font-size: 21px;
  margin: 1.6em 0 0.3em;
}
.page p,
.page ul {
  margin: 0 0 0.9em;
}
.page ul {
  padding-left: 1.2em;
}
.page li {
  margin-bottom: 0.45em;
}
.page li::marker {
  color: var(--ink-secondary);
}
.page strong {
  font-weight: normal;
  font-style: italic;
}
.page .contents {
  margin-top: 28px;
  padding: 16px 0 4px;
  border-block: 1px solid var(--rule);
  columns: 2;
  column-gap: 24px;
  list-style: none;
  padding-left: 0;
  font-size: 15px;
}
.page .contents li {
  break-inside: avoid;
  margin: 0;
  padding: 3px 0;
}
.page .after-contents {
  margin-top: 1.6em;
}
.address {
  white-space: nowrap;
}

/* A fleuron between parts, as in the app's Library. */
.fleuron {
  display: block;
  width: 14px;
  height: 17px;
  margin: 2.4em auto 0;
  opacity: 0.75;
}

.footer {
  padding: 28px 0 44px;
  color: var(--ink-secondary);
  font-size: 15px;
  text-align: center;
}
.footer nav {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 6px 22px;
  margin-bottom: 10px;
}
.footer p {
  margin: 0;
}

@media (min-width: 720px) {
  body {
    font-size: 18px;
  }
  .page {
    padding: 52px 64px 56px;
  }
  .page h1 {
    font-size: 48px;
  }
}

@media (max-width: 719px) {
  .page {
    padding-inline: 22px;
  }
  .page .contents {
    font-size: 14px;
    column-gap: 14px;
  }
}

@media (prefers-contrast: more) {
  body,
  .sheet {
    background-image: none;
  }
  .sheet {
    box-shadow: 0 0 0 1px rgb(69 48 31 / 0.6);
  }
}
