/* The design page (browse.js): a page of its own over the book, rising from the foot, with two tabs (Thema,
   Tekeningen) and the Klaar that closes it in a head that stays; under it large covers, a phone two to a row, each the
   customer's own front cover in that design with only its name under it. Closed, it waits below the screen as it was,
   painted and inert (browse.js), so it slides up on the compositor alone, with nothing to lay out or paint first */
.browse {
  position: fixed;
  inset: 0;
  z-index: 46;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  background: #faf8f4;
  color: var(--text);
  transform: translateY(100%);
  transition: transform 0.38s var(--ease);
}
.browse.is-open {
  transform: none;
  transition: transform 0.42s var(--ease);
}
.browse:not(.is-open) * {
  animation-play-state: paused;
}
.browse[hidden] {
  display: none;
}
/* the head across the screen, its tabs and Klaar at its edges in line with the covers under it, as big as the chrome is
   (app.css --ui: the screen's own lengths, its safe areas and the panel's sides, are divided by what zoom grows them) */
.browse-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: calc(var(--safe-top) / var(--ui) + 14px) calc(max(16px, env(safe-area-inset-right, 0px)) / var(--ui)) 12px
    calc(max(16px, env(safe-area-inset-left, 0px)) / var(--ui));
  border-bottom: 1px solid var(--line);
  zoom: var(--ui);
}
/* the tabs: one pill with the chosen tab lifted out of it in white */
.browse-tabs {
  display: flex;
  padding: 3px;
  border-radius: 999px;
  background: rgb(36 34 31 / 0.07);
}
.browse-tab {
  min-height: 40px;
  padding: 0 18px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--quiet);
  font: 600 15.5px/1 var(--ui-font);
  cursor: pointer;
  transition:
    background-color 0.2s,
    color 0.2s,
    box-shadow 0.2s;
}
.browse-tab[aria-selected='true'] {
  background: #fff;
  color: var(--text);
  box-shadow: 0 1px 4px rgb(36 34 31 / 0.14);
}
.browse-done {
  min-height: 44px;
  padding: 0 20px;
  border: 0;
  border-radius: 999px;
  background: var(--accent);
  color: var(--accent-ink);
  font: 600 15.5px/1 var(--ui-font);
  cursor: pointer;
}
.browse-body {
  overflow: hidden auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}
.browse-panel {
  padding: 6px max(16px, env(safe-area-inset-right, 0px)) calc(var(--safe-bottom) + 32px)
    max(16px, env(safe-area-inset-left, 0px));
}
.browse-panel[hidden] {
  display: none;
}
.browse-sub {
  margin: 14px 0 0;
  font: 400 14.5px/1.4 var(--ui-font);
  color: var(--quiet);
}
.browse-sub:empty {
  display: none;
}
.browse-label {
  margin: 22px 0 12px;
  font: 600 13px/1 var(--ui-font);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--quiet);
}
.browse-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(150px, 40vw), 1fr));
  gap: 22px 14px;
}
.browse-panel[data-tab='drawings'] .browse-grid {
  margin-top: 18px;
}
/* (as many covers a row as the screen's width holds, each as big as the chrome is) */
@media (min-width: 700px) {
  .browse-grid {
    grid-template-columns: repeat(auto-fill, minmax(calc(200px * var(--ui)), 1fr));
    gap: 30px 22px;
  }
}
/* a slot is the card (its cover and name) and, under it, the thumbs of the design on the book (browse.js) */
.browse-slot {
  position: relative;
  display: grid;
}
.browse-card {
  position: relative;
  display: grid;
  align-content: start;
  gap: 9px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--text);
  text-align: left;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.browse-cover {
  display: block;
  position: relative;
  /* each cover lays out and paints on its own, and only near sight: one drawn leaves the others as they are */
  contain: strict;
  content-visibility: auto;
  /* as tall as the book's front before its picture comes (browse.js sets it from the book's format, then its covers) */
  aspect-ratio: var(--browse-cover, 1);
  border-radius: 2px 4px 4px 2px;
  overflow: hidden;
  box-shadow:
    0 1px 2px rgb(0 0 0 / 0.16),
    3px 6px 14px rgb(0 0 0 / 0.14);
  transition:
    transform 0.25s var(--ease),
    box-shadow 0.25s;
}
.browse-cover .tb-preview {
  pointer-events: none;
}
/* a design whose cover is being drawn in its own style (designer.js drawAhead): the book's one pen writes on it, as on
   a drawing drawn again on the table (table.css .tb-drawing.is-redrawing) */
.browse-card.is-drawing .tb-preview::after {
  content: '';
  position: absolute;
  z-index: 1;
  left: 50%;
  top: 50%;
  width: clamp(22px, 24%, 40px);
  aspect-ratio: 1;
  translate: -30% -70%;
  background: var(--tb-pen) center / contain no-repeat;
  transform-origin: 15% 85%;
  animation: tb-write-page 1.1s ease-in-out infinite;
  pointer-events: none;
}
@media (prefers-reduced-motion: reduce) {
  .browse-card.is-drawing .tb-preview::after {
    animation: none;
  }
}
.browse-card:active .browse-cover {
  transform: scale(0.97);
}
@media (hover: hover) {
  .browse-card:hover .browse-cover {
    transform: translateY(-3px);
    box-shadow:
      0 1px 2px rgb(0 0 0 / 0.16),
      4px 10px 22px rgb(0 0 0 / 0.18);
  }
}
/* a drawing style: the book's cover illustration large on its paper, as tall as a cover */
.browse-style {
  display: grid;
  place-items: center;
  aspect-ratio: var(--browse-cover, 1);
  padding: 14%;
}
.browse-style svg {
  width: 100%;
  height: 100%;
  overflow: visible;
}
.browse-style .browse-none {
  width: 34%;
  fill: none;
  stroke: rgb(36 34 31 / 0.3);
  stroke-width: 1.4;
  stroke-linecap: round;
}
/* the one on the book: a dark ring round its cover and a check after its name */
.browse-card[aria-pressed='true'] .browse-cover {
  outline: 3px solid var(--text);
  outline-offset: 4px;
}
/* a name is one line: the design call names it in a word or two (prompts.ts), and a longer one ends in an ellipsis
   rather than pushing the row of cards apart */
.browse-name {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  font: 500 15px/1.3 var(--ui-font);
}
.browse-name-text {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.browse-card[aria-pressed='true'] .browse-name {
  font-weight: 650;
}
.browse-on {
  display: none;
  flex: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--text);
  color: #fbf9f5;
  font: 600 11px/18px var(--ui-font);
  text-align: center;
}
.browse-card[aria-pressed='true'] .browse-on {
  display: block;
}
/* a design after their own words or picture, until seen: the gold sticker new photos wear (arrived.css), on the
   cover's top edge, mostly above it, so it never covers a title set high on the cover; the row of fresh designs makes
   room for it under the heading */
.browse-mine:has(.browse-fresh) {
  padding-top: 12px;
}
.browse-fresh {
  position: absolute;
  z-index: 2;
  top: -18px;
  left: -6px;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 5px 10px 5px 8px;
  border-radius: 999px;
  background: var(--fresh, #f0b429);
  color: var(--fresh-ink, #3b2a00);
  font: 700 13px/1 var(--ui-font);
  letter-spacing: 0.02em;
  box-shadow:
    0 0 0 2px #fff,
    0 4px 10px -3px rgb(40 30 20 / 0.45);
  rotate: -5deg;
  animation: browse-fresh-pop 0.45s 0.2s cubic-bezier(0.34, 1.7, 0.5, 1) both;
}
.browse-fresh::before {
  content: '✦';
  font-size: 11px;
}
@keyframes browse-fresh-pop {
  from {
    opacity: 0;
    transform: scale(0.4);
  }
}
/* the thumbs on the design the book has: under its name, small; a given thumb fills */
.browse-thumbs {
  display: flex;
  gap: 2px;
  margin: 4px 0 0 -7px;
  animation: browse-thumbs-in 0.24s var(--ease);
}
.browse-thumbs[hidden] {
  display: none;
}
@keyframes browse-thumbs-in {
  from {
    opacity: 0;
    scale: 0.9;
  }
}
.browse-thumb {
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 50%;
  background: transparent center / 18px no-repeat;
  cursor: pointer;
  transition:
    background-color 0.2s,
    transform 0.2s var(--ease);
}
.browse-thumb:active {
  transform: scale(0.9);
}
.browse-thumb[aria-pressed='true'] {
  background-color: rgb(36 34 31 / 0.08);
}
.browse-thumb-up {
  background-image: var(--thumb-up);
}
.browse-thumb-down {
  background-image: var(--thumb-down);
}
.browse-thumb-up[aria-pressed='true'] {
  background-image: var(--thumb-up-on);
}
.browse-thumb-down[aria-pressed='true'] {
  background-image: var(--thumb-down-on);
}
/* Their own design and the one being made after their words: an empty cover with a star, as large as the others */
.browse-blank {
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 10px;
  text-align: center;
  aspect-ratio: var(--browse-cover, 1);
  padding: 12px;
  border: 1.5px dashed rgb(36 34 31 / 0.28);
  border-radius: 6px;
  box-shadow: none;
  color: var(--quiet);
}
/* the star, on their own design and the one being made, drawn in the chrome's line */
.browse-blank svg {
  display: block;
  width: 30px;
  height: 30px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linejoin: round;
}
/* their own design, still empty: what it's for in a line under its star */
.browse-why {
  max-width: 16em;
  font: 400 13.5px/1.35 var(--ui-font);
}
@media (hover: hover) {
  .browse-own:hover .browse-blank {
    border-color: var(--text);
    color: var(--text);
  }
}
/* Voor jou's heading as far over its cards as Meer ontwerpen's (22px), and Meer ontwerpen's twice that below the
   last card's name */
.browse-label-mine {
  margin: 14px 0 22px;
}
.browse-label-more {
  margin: 44px 0 22px;
}
.is-making {
  cursor: default;
}
.is-making .browse-blank {
  border-color: var(--fresh, #f0b429);
  background: linear-gradient(110deg, transparent 30%, rgb(240 180 41 / 0.16) 50%, transparent 70%) 0 0 / 250% 100%;
  animation: browse-making 1.8s linear infinite;
}
.is-making .browse-blank svg {
  stroke: var(--fresh, #f0b429);
}
@keyframes browse-making {
  to {
    background-position: -150% 0;
  }
}
@media (prefers-reduced-motion: reduce) {
  .browse,
  .browse.is-open {
    transition-duration: 0.15s;
  }
  .is-making .browse-blank,
  .browse-fresh {
    animation: none;
  }
}
