/* The cover's photo picker (coverpick.ts): the whole screen on a phone, a big card over the dimmed book on a wider one,
   as the cloud's sheet (cloud.css); a row of the moments to jump to, then square thumbnails in columns as many as fit */
.cover-pick {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  display: grid;
  /* one cell of the screen's size, so the card's height is a real one and its body scrolls, not the card */
  grid-template: minmax(0, 1fr) / minmax(0, 1fr);
  place-items: center;
  background: rgb(30 26 22 / 0.42);
  color: var(--text);
  font-family: var(--ui-font);
}
.cover-pick:not([open]) {
  display: none;
}
.cover-pick::backdrop {
  background: none;
}
/* it rises by CSS alone (cloud.css says why: a partner's frame in WebKit) */
.cover-pick[open] {
  animation: cover-pick-dim 0.3s;
}
.cover-pick[open] .cover-pick-card {
  animation: cover-pick-rise 0.36s var(--ease);
}
@keyframes cover-pick-dim {
  from {
    background: rgb(30 26 22 / 0);
  }
}
@keyframes cover-pick-rise {
  from {
    transform: translateY(24px);
    opacity: 0;
  }
}
.cover-pick-card {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  width: 100%;
  height: 100%;
  background: var(--sheet-paper);
}
@media (min-width: 700px) and (min-height: 560px) {
  .cover-pick-card {
    width: min(880px, 100% - 48px);
    height: min(820px, 100% - 48px);
    border-radius: max(var(--radius), 20px);
    box-shadow: 0 30px 80px -24px rgb(30 20 10 / 0.55);
    overflow: hidden;
  }
}
.cover-pick-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: max(16px, env(safe-area-inset-top)) 12px 10px 20px;
}
.cover-pick-heading {
  margin: 6px 0 0;
  font-size: 19px;
  font-weight: 650;
}
.cover-pick-sub {
  margin: 4px 0 0;
  color: var(--quiet);
  font-size: 14.5px;
  line-height: 1.35;
}
.cover-pick-close {
  display: grid;
  place-items: center;
  flex: none;
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 999px;
  background: none;
  color: var(--text);
  cursor: pointer;
}
.cover-pick-close:hover {
  background: rgb(36 34 31 / 0.06);
}
.cover-pick-close svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
}
/* the moments, one row that scrolls sideways under the head */
.cover-pick-jumps {
  display: flex;
  gap: 6px;
  padding: 2px 16px 12px;
  overflow-x: auto;
  scrollbar-width: none;
  border-bottom: 1px solid var(--line);
}
.cover-pick-jumps[hidden] {
  display: none;
}
.cover-pick-jump {
  flex: none;
  min-height: 34px;
  max-width: 14em;
  padding: 0 14px;
  border: 0;
  border-radius: 999px;
  background: rgb(36 34 31 / 0.06);
  color: var(--text);
  font: 500 14px/1 var(--ui-font);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: pointer;
}
.cover-pick-jump:hover {
  background: rgb(36 34 31 / 0.11);
}
.cover-pick-body {
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 4px 16px calc(var(--safe-bottom) + 28px);
}
.cover-pick-group {
  padding-top: 18px;
}
.cover-pick-title {
  margin: 0 0 10px;
  font: 600 13px/1.2 var(--ui-font);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--quiet);
}
.cover-pick-line {
  margin: -4px 0 10px;
  color: var(--quiet);
  font-size: 14px;
}
.cover-pick-grid {
  display: grid;
  grid-template-columns: repeat(var(--cols, 3), minmax(0, 1fr));
  gap: 8px;
}
.cover-pick-photo {
  position: relative;
  aspect-ratio: 1;
  padding: 0;
  border: 0;
  border-radius: 6px;
  overflow: hidden;
  background: rgb(36 34 31 / 0.07);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.2s var(--ease);
}
.cover-pick-photo img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.cover-pick-photo:active {
  transform: scale(0.96);
}
@media (hover: hover) {
  .cover-pick-photo:hover img {
    filter: brightness(1.06);
  }
}
/* the photo on the cover now: a dark ring inside its edge and a check in its corner */
.cover-pick-photo[aria-pressed='true'] {
  box-shadow: inset 0 0 0 3px var(--text);
}
.cover-pick-photo[aria-pressed='true'] img {
  padding: 3px;
  border-radius: 6px;
}
.cover-pick-photo[aria-pressed='true']::after {
  content: '✓';
  position: absolute;
  right: 7px;
  bottom: 7px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--text);
  color: #fbf9f5;
  font: 600 13px/22px var(--ui-font);
  text-align: center;
}
@media (prefers-reduced-motion: reduce) {
  .cover-pick[open],
  .cover-pick[open] .cover-pick-card {
    animation: none;
  }
}
