/* museumofsorrow.com. Paper, ink, grain, one wash (docs/ART.md, docs/site.md).
   The tones are those of site/tools/make-art.py; keep them in step. */

@font-face {
  font-family: "Cormorant Garamond";
  src: url("/assets/fonts/cormorant-garamond-light.woff2") format("woff2");
  font-weight: 300;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Cormorant Garamond";
  src: url("/assets/fonts/cormorant-garamond-light-italic.woff2") format("woff2");
  font-weight: 300;
  font-style: italic;
  font-display: swap;
}

/* A subset of Source Sans 3 Light under another name: 'Source' is reserved. */
@font-face {
  font-family: "Sorrow Interface";
  src: url("/assets/fonts/sorrow-interface-light.woff2") format("woff2");
  font-weight: 300;
  font-style: normal;
  font-display: swap;
}

:root {
  color-scheme: light dark;
  --paper: #d9d4c9;
  --ink: #292b36;
  --quiet: #51535d;
  --grain: 0.15;
  --serif: "Cormorant Garamond", "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --sans: "Sorrow Interface", system-ui, -apple-system, "Segoe UI", sans-serif;
}

/* Dark is ink-dark paper, never black. */
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #1d1f25;
    --ink: #cec9c0;
    --quiet: #a09c95;
    --grain: 0.1;
  }
}

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

html {
  background: var(--paper);
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 1.3125rem;
  font-weight: 300;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

/* The grain lies over everything, ink included. */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  background: url("/assets/grain.webp") 0 0 / 256px 256px;
  opacity: var(--grain);
}

@media (prefers-color-scheme: dark) {
  body::after {
    filter: invert(1);
  }
}

h1,
h2,
p,
ul,
figure {
  margin: 0;
}

h1 {
  font-weight: 300;
  line-height: 1.05;
}

i,
em {
  font-style: italic;
}

/* One weight of the serif is here: emphasis is the italic, not a false bold. */
strong {
  font-style: italic;
  font-weight: 300;
}

a {
  color: inherit;
  text-decoration-line: underline;
  text-decoration-thickness: from-font;
  text-decoration-color: var(--quiet);
  text-underline-offset: 0.2em;
  transition: text-decoration-color 600ms ease;
}

a:hover {
  text-decoration-color: var(--ink);
}

a:not([href]) {
  text-decoration-line: none;
}

a:focus-visible {
  outline: 2px solid var(--quiet);
  outline-offset: 4px;
  border-radius: 2px;
}

img {
  display: block;
  max-width: 100%;
  height: auto;
}

/* --- The first page --- */

.hero {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 100vh;
  min-height: 100svh;
  padding: 5rem 1.5rem;
  overflow: hidden;
  text-align: center;
}

.wash {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  pointer-events: none;
}

.wash span {
  grid-area: 1 / 1;
  width: min(150vw, 58rem);
  aspect-ratio: 1;
  translate: -5% 0;
  background: url("/assets/wash-light.webp") center / contain no-repeat;
  animation: arrive 7s ease-out both;
}

.wash span + span {
  width: min(105vw, 40rem);
  translate: -3% -9%;
  rotate: 150deg;
  animation-duration: 10s;
}

@media (prefers-color-scheme: dark) {
  .wash span {
    background-image: url("/assets/wash-dark.webp");
  }
}

.title {
  position: relative;
  display: grid;
  justify-items: center;
  gap: 1.75rem;
}

.title picture {
  animation: arrive 2.4s ease both;
}

.title h1 {
  font-size: clamp(2rem, 10.4vw, 5.25rem);
  white-space: nowrap;
  letter-spacing: 0.01em;
  animation: arrive-text 3.2s ease 0.5s both;
}

.premise {
  max-width: 21rem;
  font-size: 1.4375rem;
  font-style: italic;
  line-height: 1.4;
  animation: arrive-text 3.2s ease 1.7s both;
}

main > section {
  max-width: 35rem;
  margin: 0 auto;
  padding: 4.5rem 1.5rem;
}

main > section > h2 {
  margin-bottom: 1.75rem;
  color: var(--quiet);
  font-family: var(--sans);
  font-size: 0.875rem;
  font-weight: 300;
  letter-spacing: 0.14em;
}

main > section > p + p {
  margin-top: 1.1em;
}

.word {
  text-align: center;
}

.word .native {
  font-size: clamp(3rem, 14vw, 4.5rem);
  line-height: 1.1;
}

.word .roman {
  margin-top: 0.4rem;
  font-size: 1.5625rem;
  font-style: italic;
}

.word .language,
.word .source {
  color: var(--quiet);
  font-family: var(--sans);
  font-size: 0.875rem;
  letter-spacing: 0.06em;
}

.word .language {
  margin-top: 0.6rem;
  letter-spacing: 0.14em;
}

.word .definition {
  margin-top: 2rem;
}

.word .example {
  font-style: italic;
}

.word .source {
  margin-top: 2rem;
  line-height: 1.7;
}

/* The sans subset is Latin: the word in its own script stays in the serif. */
.word .source [lang] {
  font-family: var(--serif);
  font-size: 1.2em;
  letter-spacing: 0;
}

/* The owner's picture of the app goes here (docs/site.md, "The plate"). */
.plate {
  max-width: 22rem;
  margin: 0 auto;
  padding: 2rem 1.5rem;
}

.plate figcaption {
  margin-top: 1rem;
  color: var(--quiet);
  font-family: var(--sans);
  font-size: 0.875rem;
  text-align: center;
}

.store {
  text-align: center;
}

.store a {
  font-style: italic;
}

/* --- Every page --- */

footer {
  padding: 4rem 1.5rem 5rem;
  color: var(--quiet);
  font-family: var(--sans);
  font-size: 0.9375rem;
  line-height: 1.7;
  text-align: center;
}

footer nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.25rem 1rem;
}

footer nav a {
  padding: 0.75rem 0.5rem;
  letter-spacing: 0.1em;
  text-decoration-line: none;
}

footer nav a:hover,
footer nav a[aria-current] {
  color: var(--ink);
}

footer p {
  max-width: 30rem;
  margin: 1.5rem auto 0;
  font-size: 0.875rem;
}

/* --- Privacy, support, credits, not found: flat paper, no wash --- */

.page header {
  padding: 2.5rem 1.5rem 0;
  text-align: center;
}

.page header a {
  display: inline-block;
  padding: 0.5rem;
  font-size: 1.5rem;
  text-decoration-line: none;
}

.page main {
  max-width: 37rem;
  margin: 0 auto;
  padding: 3.5rem 1.5rem 2rem;
}

.page h1 {
  font-size: clamp(2.5rem, 10vw, 3.5rem);
}

.page h2 {
  margin-top: 3rem;
  font-size: 1.75rem;
  font-weight: 300;
  line-height: 1.2;
}

.page p,
.page ul {
  margin-top: 1em;
}

.page ul {
  padding-left: 1.2em;
}

.page li + li {
  margin-top: 0.5em;
}

.page li::marker {
  color: var(--quiet);
}

.page .dated {
  color: var(--quiet);
  font-family: var(--sans);
  font-size: 0.9375rem;
  letter-spacing: 0.06em;
}

.page .verbatim {
  padding-left: 1.2em;
  font-size: 1.1875rem;
}

.lost main {
  display: grid;
  align-content: center;
  min-height: 55vh;
  text-align: center;
}

/* --- Motion: slow, and none where it is not wanted --- */

@keyframes arrive {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

/* Text does not start at zero: a browser does not count text that starts
   invisible as painted, and the page then has no largest paint to measure. */
@keyframes arrive-text {
  from {
    opacity: 0.02;
  }
  to {
    opacity: 1;
  }
}

@keyframes drift-a {
  from {
    translate: -9% -2%;
  }
  to {
    translate: -1% 3%;
  }
}

@keyframes turn-a {
  from {
    rotate: -4deg;
  }
  to {
    rotate: 5deg;
  }
}

@keyframes drift-b {
  from {
    translate: 1% -13%;
  }
  to {
    translate: -7% -5%;
  }
}

@keyframes turn-b {
  from {
    rotate: 156deg;
  }
  to {
    rotate: 143deg;
  }
}

@keyframes breathe {
  from {
    scale: 1;
  }
  to {
    scale: 1.09;
  }
}

/* Each property has its own period, and no two share a small common one,
   so the wash does not visibly repeat. Under Reduce Motion the wash only
   fades in and then lies still. */
@media (prefers-reduced-motion: no-preference) {
  .wash span {
    will-change: translate, rotate, scale;
    animation:
      arrive 7s ease-out both,
      drift-a 61s ease-in-out infinite alternate,
      turn-a 89s ease-in-out infinite alternate,
      breathe 37s ease-in-out infinite alternate;
  }

  .wash span + span {
    animation:
      arrive 10s ease-out both,
      drift-b 73s ease-in-out infinite alternate,
      turn-b 101s ease-in-out infinite alternate,
      breathe 43s ease-in-out infinite alternate;
  }
}

@media print {
  body::after,
  .wash {
    display: none;
  }
}
