:root{
  --bg: #ffffff;
  --gap: 32px;
  --pad: 40px;
  --cols: 4;
  --footer-h: 320px;
  --pink: #EECFDE;
  --col-w: calc((100vw - 2 * var(--pad) - (var(--cols) - 1) * var(--gap)) / var(--cols));
}

*{ box-sizing: border-box; }

html, body{
  margin: 0;
  padding: 0;
  width: 100%;
  min-height: 100%;
  background: var(--bg);
}

body{
  padding: 0;
}

/* ---------- page title ---------- */

.page-title{
  position: fixed;
  top: 28px;
  left: var(--pad);
  z-index: 50;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 24px;
  font-weight: 400;
  color: #000;
}

/* ---------- main layer (scrolls over footer) ---------- */

.page-main{
  position: relative;
  z-index: 1;
  background: var(--bg);
  padding: 96px var(--pad) 28px;
  margin-bottom: var(--footer-h);
}

/* ---------- masonry ---------- */

.masonry{
  column-count: var(--cols);
  column-gap: var(--gap);
  width: 100%;
}

.masonry-item{
  break-inside: avoid;
  margin: 0 0 var(--gap);
  display: block;
  width: 100%;
  background: #fff;
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 0.4s ease, transform 0.4s ease;
  transition-delay: var(--stagger, 0ms);
}

.masonry-item.is-visible{
  opacity: 1;
  transform: none;
}

.masonry-item img{
  display: block;
  width: 100%;
  height: auto;
  vertical-align: top;
}

.masonry-caption{
  margin-top: 8px;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 12px;
  font-weight: 400;
  color: #000;
  text-align: left;
}

/* ---------- reveal footer ---------- */

.reveal-footer{
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 0;
  height: auto;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 32px;
  padding: 40px var(--pad) calc(28px + 12px + 48px);
  background: var(--pink);
  color: #000;
}

.reveal-footer-book{
  display: block;
  width: var(--col-w);
  height: auto;
  flex: 0 0 auto;
  pointer-events: none;
}

.reveal-footer-text{
  display: flex;
  flex-direction: column;
  gap: 0;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 24px;
  font-weight: 400;
  line-height: 1.35;
  color: #000;
  max-width: 28em;
  text-decoration: none;
}

.reveal-footer-text:focus,
.reveal-footer-text:focus-visible{
  outline: none;
}

.reveal-footer-title,
.reveal-footer-cta{
  display: block;
}

.reveal-footer-author{
  display: block;
  font-size: 12px;
  line-height: 1.35;
  margin-bottom: calc(0.35em - 2px);
}

.reveal-footer-title{
  text-decoration: underline;
  text-decoration-color: rgb(50, 50, 50);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
}

.reveal-footer-arrow{
  display: inline-block;
  width: 1.2em;
  height: 1.2em;
  margin-left: 0.25em;
  vertical-align: -0.18em;
}

.reveal-footer-credit{
  position: absolute;
  left: var(--pad);
  bottom: 28px;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 12px;
  font-weight: 400;
  color: #000;
}

@media (max-width: 960px){
  :root{
    --cols: 3;
  }
}

@media (max-width: 640px){
  :root{
    --pad: 32px;
    --gap: 24px;
    --cols: 2;
  }

  .page-main{
    padding-top: 88px;
  }

  .page-title,
  .reveal-footer-text{
    font-size: 18px;
  }

  .reveal-footer{
    gap: 20px;
  }
}

@media (prefers-reduced-motion: reduce){
  .masonry-item{
    opacity: 1;
    transform: none;
    transition: none;
  }
}
