/* The seed catalogue: a little catalogue printed in four risograph inks, on a white page. */
:root {
  --page: #ffffff;          /* the page of the site */
  --paper: #f6f3ea;         /* the catalogue's paper */
  --blue: #2b4a8b;          /* the four inks: blue for the words */
  --red: #ec5a47;
  --yellow: #f6c62f;
  --green: #1f8a5f;
  --ui: #23314f;            /* the arrows and the names under the catalogue */
  --w: min(280px, calc((100vw - 48px) / 2));   /* one page's width */
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  overflow-x: clip;
}

body {
  min-height: 100svh;
  background: var(--page);
  color: var(--ui);
  font-family: 'Bricolage Grotesque Variable', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.stage {
  min-height: 100svh;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  place-items: center;
  padding: 56px 16px 40px;
}

.catalogue {
  display: grid;
  justify-items: center;
  gap: 42px;
}

/* ---------------------------------------------------------------- the catalogue */
/* the box is the open catalogue, two pages with the spine in the middle; the canvas spills over it, because a page
   lifted towards you grows with the perspective and its shadow falls on the table */
.book {
  position: relative;
  width: calc(var(--w) * 2);
  height: calc(var(--w) * 1.38);
  outline: none;
  touch-action: pan-y;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
  cursor: grab;
}

.book.is-held {
  cursor: grabbing;
}

.book.is-empty:not(.is-held) {
  cursor: default;
}

.book__paper,
.book__ghost {
  position: absolute;
  pointer-events: none;
}

.book__paper {
  opacity: 0;
}

.book__ghost {
  opacity: 0;
}

/* the ring of the keyboard focus, round the pages that are there */
.book__ring {
  position: absolute;
  top: -8px;
  bottom: -8px;
  left: 0;
  width: 0;
  border-radius: 6px;
  box-shadow: 0 0 0 2px var(--ui);
  opacity: 0;
  pointer-events: none;
}

.book:focus-visible .book__ring {
  opacity: 1;
}

html[data-using='pointer'] .book:focus-visible .book__ring {
  opacity: 0;
}

/* the real pages, for screen readers: the canvas draws them */
.book__text {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* without WebGL the pages are drawn flat, and turn with a fade */
.no-gl .book {
  cursor: pointer;
}

/* ---------------------------------------------------------------- under the catalogue */
.leaf {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 16px;
}

.leaf__btn {
  position: relative;
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--ui);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  transition: opacity 0.3s ease, transform 0.35s cubic-bezier(0.34, 1.6, 0.5, 1);
}

/* the ring is a child, so the press can squash the button and not the ring's colour change */
.leaf__btn::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
  box-shadow: inset 0 0 0 1.5px rgba(35, 49, 79, 0.22);
  transition: box-shadow 0.25s ease, background-color 0.25s ease;
}

.leaf__btn svg {
  position: relative;
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform 0.35s cubic-bezier(0.34, 1.6, 0.5, 1);
}

@media (hover: hover) and (pointer: fine) {
  .leaf__btn:not(:disabled):hover::before {
    background: rgba(246, 198, 47, 0.28);
    box-shadow: inset 0 0 0 1.5px rgba(35, 49, 79, 0.75);
  }

  .leaf__btn--prev:not(:disabled):hover svg {
    transform: translateX(-2px);
  }

  .leaf__btn--next:not(:disabled):hover svg {
    transform: translateX(2px);
  }
}

.leaf__btn:not(:disabled):active {
  transform: scale(0.92);
}

.leaf__btn:disabled {
  opacity: 0.28;
  cursor: default;
}

.leaf__btn:focus-visible {
  outline: 2px solid var(--ui);
  outline-offset: 3px;
}

html[data-using='pointer'] .leaf__btn:focus-visible {
  outline: none;
}

/* the names of the pages that are open */
.leaf__where {
  display: grid;
  min-width: 15.5em;
  margin: 0;
  overflow: hidden;
  font-size: 15px;
  font-weight: 520;
  letter-spacing: -0.005em;
  text-align: center;
  white-space: nowrap;
}

.leaf__roll {
  display: inline-block;
}

/* on a phone one page at a time: the spine is on the left edge */
@media (max-width: 639px) {
  :root {
    --w: min(360px, calc(100vw - 48px));
  }

  .stage {
    padding-top: 40px;
  }

  .catalogue {
    gap: 34px;
  }

  .book {
    width: var(--w);
  }

  .leaf__where {
    min-width: 9.5em;
  }
}

.sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
