/* Quill's Edge landing page: the game's paper, ink and wax. */
:root {
  --paper: #efe2c4;
  --paper-light: #f8efd9;
  --paper-dark: #e3d4b2;
  --ink: #1b1612;
  --ink-soft: #3b2c16;
  --text-soft: #6a5534;
  --edge: #4a3a24;
  --wax: #a8231a;
  --ember: #d9472b;
  --font-display: 'IM Fell English SC', Georgia, serif;
  --font-italic: 'IM Fell English', Georgia, serif;
  --font-ui: Inter, 'Segoe UI', system-ui, sans-serif;
  --shadow-hard: 3px 3px 0 rgba(27, 22, 18, 0.85);
  --rough: 5px 11px 6px 12px / 11px 5px 12px 6px;
  --blob: 46% 54% 42% 58% / 55% 45% 55% 45%;
  --grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.75' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .32  0 0 0 0 .24  0 0 0 0 .13  0 0 0 .4 -.13'/%3E%3C/filter%3E%3Crect width='240' height='240' filter='url(%23n)'/%3E%3C/svg%3E");
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--paper) var(--grain);
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: 1.05rem;
  line-height: 1.6;
}

/* ---- The hero: a page of the game, alive ------------------------------------------------------ */

.hero {
  /* One unit of a drawing on screen: by the screen's width, and less on a low one. */
  --u: clamp(0.55px, min(0.6px + 0.05vw, 0.15svh), 1.6px);
  --mx: 0;
  --my: 0;
  --sy: 0;
  position: relative;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: clamp(1.4rem, 6svh, 4.5rem) 1.2rem 4.5rem;
  overflow: hidden;
  background:
    var(--grain),
    linear-gradient(rgba(74, 58, 36, 0.07) 1px, transparent 1px) 50% 0 / 3.2rem 3.2rem,
    linear-gradient(90deg, rgba(74, 58, 36, 0.07) 1px, transparent 1px) 50% 0 / 3.2rem 3.2rem,
    radial-gradient(ellipse at 50% 45%, var(--paper-light) 30%, var(--paper) 75%, var(--paper-dark) 120%);
  border-bottom: 2px solid var(--edge);
}

.scene {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

/* Everything in the scene stands at --x / --y and moves by how near it is (--d, in pixels at
   the pointer's furthest). */
.scene > * {
  --d: 14;
  position: absolute;
  left: calc(var(--x) * 1%);
  top: calc(var(--y) * 1%);
  translate:
    calc(-50% - var(--mx) * var(--d) * 1px)
    calc(-50% - var(--my) * var(--d) * 1px - var(--sy) * var(--d) * 0.012px);
}

.scene > .back {
  --d: 6;
  opacity: 0.13;
}

.scene > .front {
  --d: 26;
}

@media (min-aspect-ratio: 4/5) {
  .scene > .tall {
    display: none;
  }
}

@media (max-aspect-ratio: 4/5) {
  .scene > * {
    left: calc(var(--px, var(--x)) * 1%);
    top: calc(var(--py, var(--y)) * 1%);
  }

  .scene > .wide {
    display: none;
  }
}

/* A drawing from the game: its loop's frames lie side by side in one picture (picks.css). */
.pick {
  --s: 1;
  --flip: 1;
  width: calc(var(--w) * var(--s) * var(--u));
  height: calc(var(--h) * var(--s) * var(--u));
  scale: var(--flip) 1;
  background: var(--img) 0 0 / calc(var(--n) * 100%) 100% no-repeat;
  animation:
    frames calc(var(--n) * var(--frame, 0.125s)) steps(var(--n), jump-none) infinite,
    bob 4.6s ease-in-out infinite alternate;
  will-change: transform;
}

.p-wren,
.p-juno,
.p-aldous {
  --frame: 0.17s;
}

.pick:nth-child(3n) {
  animation-name: frames, sway;
  animation-duration: calc(var(--n) * var(--frame, 0.125s)), 5.7s;
}

.pick:nth-child(3n + 1) {
  animation-name: frames, drift;
  animation-duration: calc(var(--n) * var(--frame, 0.125s)), 3.9s;
}

.pick:nth-child(2n) {
  animation-delay: -0.4s, -2.1s;
}

.pick:nth-child(5n) {
  animation-delay: -0.2s, -3.3s;
}

.pick:nth-child(7n) {
  animation-delay: -0.7s, -1.2s;
}

@keyframes frames {
  to {
    background-position-x: 100%;
  }
}

@keyframes bob {
  from {
    transform: translateY(0.25rem) rotate(-2deg);
  }

  to {
    transform: translateY(-0.4rem) rotate(2deg);
  }
}

@keyframes sway {
  from {
    transform: translate(-0.4rem, 0.1rem) rotate(3deg);
  }

  to {
    transform: translate(0.4rem, -0.15rem) rotate(-3deg);
  }
}

@keyframes drift {
  from {
    transform: translate(-0.25rem, -0.25rem) rotate(-1.5deg);
  }

  to {
    transform: translate(0.3rem, 0.3rem) rotate(2.5deg);
  }
}

/* Ink left on the page. */
.stain {
  --d: 4;
  width: 30vmin;
  height: 26vmin;
  border-radius: var(--blob);
  opacity: 0.17;
  filter: blur(1px);
  animation: sway 11s ease-in-out infinite alternate;
}

.stain.tide {
  background: #2a4fb5;
}

.stain.ember {
  background: #d9472b;
  width: 34vmin;
  rotate: 40deg;
}

.stain.storm {
  background: #c9962e;
  width: 26vmin;
  rotate: -25deg;
  opacity: 0.22;
}

.stain.verdant {
  background: #2e8a5a;
  width: 24vmin;
  height: 22vmin;
  rotate: 110deg;
}

/* The stroke of a Seal round the middle of the page. */
.scene > .ring {
  --d: 3;
  left: 50%;
  top: 52%;
  width: 76%;
  height: 86%;
  border: 2px solid rgba(168, 35, 26, 0.2);
  border-radius: 50%;
  outline: 1px dashed rgba(168, 35, 26, 0.16);
  outline-offset: 0.9rem;
}

@media (max-aspect-ratio: 4/5) {
  .scene > .ring {
    width: 150%;
    height: 66%;
  }
}

/* Pickups: ink drops and Gilt. */
.bit {
  --d: 19;
  width: calc(15 * var(--u));
  height: calc(21 * var(--u));
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 22'%3E%3Cpath d='M8 1.5C11 6.5 14.5 10 14.5 14.2a6.5 6.5 0 0 1-13 0C1.5 10 5 6.5 8 1.5Z' fill='%2334b8ad' stroke='%23125e63' stroke-width='1.6' stroke-linejoin='round'/%3E%3Cpath d='M5 14.5c0 1.8 1.2 3 2.8 3.3' fill='none' stroke='%23d7f4ee' stroke-width='1.4' stroke-linecap='round'/%3E%3C/svg%3E") center / contain no-repeat;
  animation: bob 2.9s ease-in-out infinite alternate;
}

.bit.coin {
  width: calc(21 * var(--u));
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 22 22'%3E%3Ccircle cx='11' cy='11' r='9.5' fill='%23d6a531' stroke='%238a6516' stroke-width='1.6'/%3E%3Ccircle cx='11' cy='11' r='6' fill='none' stroke='%238a6516' stroke-width='1'/%3E%3Cpath d='M11 7.5v7M7.5 11h7M8.5 8.5l5 5M13.5 8.5l-5 5' stroke='%238a6516' stroke-width='1' stroke-linecap='round'/%3E%3C/svg%3E");
  animation-name: sway;
  animation-duration: 3.7s;
}

.bit:nth-child(2n) {
  animation-delay: -1.3s;
}

.bit:nth-child(3n) {
  animation-delay: -2.2s;
}

.hero.resting .scene > * {
  animation-play-state: paused;
}

.logo {
  position: relative;
  margin: 0;
  /* Never taller than a fifth of the screen (the logo is 4.35 times as wide as it is high). */
  width: min(36rem, 82vw, 87svh);
}

.logo img {
  display: block;
  width: 100%;
  height: auto;
}

.hero-text {
  position: relative;
  width: min(34rem, 100%);
  padding-top: 1.5rem;
  text-align: center;
}

/* The room left under the logo is shared out above and below the text: evenly on an upright
   screen, a third above on a wide one, whatever the screen's size. */
.hero::before,
.hero::after {
  content: '';
  flex: 1 0 0;
}

.hero::before {
  order: 1;
}

.hero-text {
  order: 2;
}

.hero::after {
  order: 3;
}

@media (min-aspect-ratio: 4/5) {
  .hero::before {
    flex-grow: 32;
  }

  .hero::after {
    flex-grow: 68;
  }
}

/* Soft patches of clean paper under logo and text, so nothing in the scene runs through them. */
.logo::before,
.hero-text::before {
  content: '';
  position: absolute;
  inset: -3.5rem -4rem;
  z-index: -1;
  background: radial-gradient(closest-side, rgba(248, 239, 217, 0.96) 55%, rgba(248, 239, 217, 0));
}

.logo::before {
  inset: -1.5rem -3rem;
}

.logo,
.hero-text {
  z-index: 1;
}

.tagline {
  margin: 0 0 1.4rem;
  font-family: var(--font-italic);
  font-style: italic;
  font-size: clamp(1.5rem, 1rem + 2.2vw, 2.3rem);
  line-height: 1.2;
  color: var(--ink-soft);
}

.stamp {
  display: inline-block;
  margin: 0;
  padding: 0.5em 0.85em 0.42em;
  font-family: var(--font-display);
  font-size: clamp(1.7rem, 0.9rem + 3.6vw, 3.2rem);
  line-height: 1.05;
  letter-spacing: 0.04em;
  color: var(--wax);
  border: 0.09em solid var(--wax);
  border-radius: var(--rough);
  outline: 0.04em solid var(--wax);
  outline-offset: 0.12em;
  transform: rotate(-2.5deg);
  mix-blend-mode: multiply;
  animation: stamp 0.55s cubic-bezier(0.2, 1.4, 0.4, 1) 0.15s both;
}

.stamp > span {
  display: block;
  font-size: 1.55em;
  letter-spacing: 0.06em;
}

@keyframes stamp {
  from {
    opacity: 0;
    transform: rotate(-9deg) scale(1.9);
  }
}

.pitch {
  display: inline-block;
  max-width: 17rem;
  margin: 2rem 0 0;
  padding: 0.25em 0.9em;
  font-size: clamp(1rem, 0.9rem + 0.5vw, 1.2rem);
  line-height: 1.4;
  text-wrap: balance;
  color: var(--ink-soft);
  background: rgba(248, 239, 217, 0.94);
  border-radius: var(--rough);
  box-shadow: 0 0 0.6rem 0.3rem rgba(248, 239, 217, 0.94);
}

@media (min-width: 40rem) {
  .pitch {
    max-width: none;
  }
}

.more {
  position: absolute;
  z-index: 1;
  bottom: 1.1rem;
  left: 50%;
  translate: -50%;
  display: grid;
  place-items: center;
  width: 2.75rem;
  height: 2.75rem;
  color: var(--ink);
  background: var(--paper-light);
  border: 2px solid var(--edge);
  border-radius: 50%;
  box-shadow: 2px 2px 0 rgba(27, 22, 18, 0.85);
  animation: nod 2.4s ease-in-out 1.5s infinite;
}

.more:hover,
.more:focus-visible {
  color: var(--wax);
  border-color: var(--wax);
}

@keyframes nod {
  50% {
    translate: -50% 5px;
  }
}

/* An upright screen: the Cartographers stand below the text. */
@media (max-aspect-ratio: 4/5) {
  .hero {
    padding-top: 13svh;
    padding-bottom: 27svh;
  }

  .hero-text::before {
    inset: -2.5rem -1rem;
  }

  .logo::before {
    inset: -0.6rem -1rem;
  }
}

/* A phone on its side: little room, so everything is set smaller. */
@media (max-height: 30rem) and (min-aspect-ratio: 4/5) {
  .hero {
    padding-top: 0.8rem;
    padding-bottom: 1rem;
  }

  .hero-text {
    padding-top: 0.6rem;
  }

  .hero-text::before {
    inset: -1rem -2rem;
  }

  .tagline {
    margin-bottom: 0.7rem;
    font-size: 1.3rem;
  }

  .stamp {
    font-size: 1.35rem;
  }

  .pitch {
    margin-top: 1rem;
    font-size: 0.95rem;
  }

  .more {
    display: none;
  }
}

/* ---- Below the hero --------------------------------------------------------------------------- */

main {
  max-width: 68rem;
  margin: 0 auto;
  padding: clamp(3rem, 8vw, 6rem) 1.25rem 2rem;
}

.about {
  max-width: 44rem;
  margin: 0 auto;
  text-align: center;
}

h2,
h3 {
  font-family: var(--font-display);
  font-weight: 400;
  line-height: 1.15;
}

h2 {
  margin: 0 0 1.2rem;
  font-size: clamp(1.8rem, 1.2rem + 2.6vw, 2.9rem);
  text-wrap: balance;
}

.lead {
  margin: 0;
  font-family: var(--font-italic);
  font-size: clamp(1.2rem, 1.05rem + 0.6vw, 1.45rem);
  line-height: 1.45;
  color: var(--ink-soft);
  text-wrap: pretty;
}

.shots {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(17rem, 1fr));
  gap: 1.6rem;
  margin: clamp(2.5rem, 6vw, 4.5rem) 0;
}

.shots figure {
  margin: 0;
  padding: 0.5rem 0.5rem 0;
  background: var(--paper-light);
  border: 2px solid var(--edge);
  border-radius: var(--rough);
  box-shadow: var(--shadow-hard);
}

.shots figure:nth-child(1) {
  rotate: -1.2deg;
}

.shots figure:nth-child(2) {
  rotate: 0.8deg;
}

.shots figure:nth-child(3) {
  rotate: -0.6deg;
}

.shots img {
  display: block;
  width: 100%;
  height: auto;
  border: 1px solid rgba(74, 58, 36, 0.45);
  border-radius: 3px;
}

.shots figcaption {
  padding: 0.45rem 0 0.55rem;
  font-family: var(--font-italic);
  font-style: italic;
  font-size: 1.15rem;
  text-align: center;
  color: var(--ink-soft);
}

.facts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
  gap: 1.5rem 2.5rem;
}

.facts div {
  padding-top: 1rem;
  border-top: 3px solid var(--ember);
  border-radius: 2px;
}

h3 {
  margin: 0 0 0.4rem;
  font-size: 1.55rem;
}

.facts p {
  margin: 0;
  color: var(--ink-soft);
}

.closing {
  margin: clamp(3rem, 8vw, 5rem) 0 1rem;
  text-align: center;
}

.stamp.small {
  font-size: clamp(1.2rem, 0.9rem + 1.6vw, 1.9rem);
  animation: none;
}

footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.4rem 1.6rem;
  padding: 1.6rem 1.25rem 2.2rem;
  font-size: 0.9rem;
  color: var(--text-soft);
  border-top: 1px dashed rgba(74, 58, 36, 0.35);
}

footer a {
  color: var(--text-soft);
}

footer a:hover,
footer a:focus-visible {
  color: var(--wax);
}

:focus-visible {
  outline: 3px solid var(--wax);
  outline-offset: 3px;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .stamp,
  .more,
  .scene > * {
    animation: none !important;
  }
}
