/* The shelf carousel: small front pages, side by side, swiped rather than
   paged. One home for the rules, loaded by the front page and the shelf alike;
   the tokens come from whichever stylesheet the host page already carries. */

/* A row is a band of the page. Where a category holds one volume, the band
   would be one tile wide and a screen tall, so a single-tile row sits beside
   the head instead of under it: the same height, a fifth of the width. */
.carousel {
  padding: clamp(20px, 3.4vh, 34px) 0 clamp(8px, 1.6vh, 14px);
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  row-gap: 0;
}
.carousel:has(.tile:only-child) {
  grid-template-columns: minmax(9rem, 13rem) minmax(0, 1fr);
  column-gap: clamp(20px, 3vw, 44px);
  align-items: start;
}
.carousel:has(.tile:only-child) .carousel__head {
  margin-bottom: 0;
  padding-top: 6px;
  align-self: start;
}

/* The row scrolls, and nothing in a row of equal covers says so. The mask is
   the affordance, not a second component: the tile at the right edge fades, and
   that is the whole signal a scrollable strip needs. It is set while the row has
   more to show and cleared at the reading edge (`carousel.js`); an edge mask
   leaves the column's own left edge hard, so the first tile keeps the measure.
   With no script, or no overflow, nothing fades. */
.carousel__track[data-more="1"] {
  -webkit-mask-image: linear-gradient(to right, #000 0, #000 calc(100% - 56px), transparent 100%);
  mask-image: linear-gradient(to right, #000 0, #000 calc(100% - 56px), transparent 100%);
}

/* The same affordance in a sheet, where `carousel.js` never runs: a row wider
   than its column fades at the right edge. A track that fits at the desktop
   measure cannot reach this rule, so it is a no-op there. */
@media (max-width: 900px) {
  .carousel__track {
    -webkit-mask-image: linear-gradient(to right, #000 0, #000 calc(100% - 56px), transparent 100%);
    mask-image: linear-gradient(to right, #000 0, #000 calc(100% - 56px), transparent 100%);
  }
}

@media (scripting: none) {
  .carousel__track {
    -webkit-mask-image: linear-gradient(to right, #000 0, #000 calc(100% - 56px), transparent 100%);
    mask-image: linear-gradient(to right, #000 0, #000 calc(100% - 56px), transparent 100%);
  }
}

.carousel__head {
  font-family: var(--mono, var(--of-mono, ui-monospace, monospace));
  font-size:0.5938rem;
  letter-spacing: .24em;
  text-transform: uppercase;
  color: var(--dim, var(--of-paper-3, #8a8a82));
  font-weight: 400;
  margin: 0 0 14px;
}

.carousel__track {
  display: flex;
  gap: 14px;
  list-style: none;
  margin: 0;
  /* The track's box is the page column and the first tile starts on it. The
     scroller clips at its padding box, so the cover's 1px frame and the focus
     ring are drawn inside the tile's own box (below), which is what lets the
     padding stay 0 on the inline axis and keeps the column's edge the edge. */
  padding: 6px 0 12px;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-snap-type: x mandatory;
  scroll-padding-inline: 0;
  scrollbar-width: thin;
  -webkit-overflow-scrolling: touch;
}

.carousel__track:focus-visible { outline: 2px solid var(--lime, #faff69); outline-offset: 4px; }

.tile { flex: 0 0 auto; scroll-snap-align: start; width: 158px; }

/* The row's tiles are covers of unequal titles, so the category line under
   them sits at whichever offset the title's last line left: one tile's label
   15px below its neighbour's. The link is the tile, and the link is a grid
   whose title row takes the tallest title, so every label in the row lands on
   one baseline and the covers stay level. */
.tile__link { display: grid; grid-template-rows: auto 1fr auto; height: 100%; border: 0; color: var(--paper, #f4f4ef); text-decoration: none; }

.tile__link:focus-visible { outline: 2px solid var(--lime, #faff69); outline-offset: -3px; }

.tile__cover {
  display: block;
  width: 158px;
  height: auto;
  border: 1px solid var(--line-2, rgba(244, 244, 239, .1));
  background: #101010;
  transition: border-color .16s ease;
}

.tile__link:hover .tile__cover { border-color: var(--lime, #faff69); }

.tile__title {
  display: block;
  margin-top: 8px;
  font-family: var(--display, var(--disp, system-ui, sans-serif));
  font-weight: 800;
  font-size:0.7188rem;
  line-height: 1.25;
  letter-spacing: -.01em;
}

.tile__label {
  display: block;
  margin-top: 5px;
  font-family: var(--mono, var(--of-mono, ui-monospace, monospace));
  font-size:0.5312rem;
  letter-spacing: .19em;
  text-transform: uppercase;
  color: var(--dim, var(--of-paper-3, #8a8a82));
}

@media (max-width: 700px) {
  .tile, .tile__cover { width: 125px; }
  .tile__title { font-size:0.6562rem; }
}

@media print {
  .carousel { padding: 8pt 0; }
  /* the row is a scroller of 14 tiles, and paper has no scroll: unwrapped it
     prints every tile instead of the five the viewport clipped */
  .carousel__track {
    display: flex;
    flex-wrap: wrap;
    gap: 8mm;
    overflow: visible;
    padding: 0;
    scroll-snap-type: none;
    -webkit-mask-image: none;
    mask-image: none;
  }
  .tile { width: 38mm; break-inside: avoid; }
  .tile__link { display: block; }
  .tile__cover, .tile__face { width: 38mm; height: auto; }
  .tile__face { height: 54mm; }
  .tile__title { font-size: 7.5pt; }
  .tile__label { font-size: 6pt; color: #55554f; }
}

/* A venture with no cover art of its own stands as a lettered face in the same
   frame as the paper covers, so the rail keeps one rhythm. */
.tile__face {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 158px;
  height: 223px;
  border: 1px solid var(--line-2, rgba(244, 244, 239, .1));
  background: #101010;
  color: var(--lime, #faff69);
  font-family: var(--display, var(--disp, system-ui, sans-serif));
  font-weight: 800;
  font-size:0.9375rem;
  letter-spacing: .02em;
}
@media (max-width: 700px) { .tile__face { width: 125px; height: 176px; font-size:0.8125rem; } }
