/* Page styles: grid */

.g-head {
  padding:2.25rem 0 1rem;
  display:grid;
  gap:.9rem;
  grid-template-columns:minmax(0,1fr);
}
.g-head h1 {
  font-size:clamp(2.6rem,5vw,3.6rem);
  line-height:1.2;
  margin:0;
}
.g-head p {
  margin:0;
  max-width:40rem;
  color:var(--muted);
}
.tools {
  position:sticky;
  top:var(--header-h);
  z-index:50;
  background:rgba(244,241,234,.94);
  -webkit-backdrop-filter:blur(8px);
  backdrop-filter:blur(8px);
  border-block:1px solid var(--line);
}
.tools-in {
  display:flex;
  flex-wrap:wrap;
  align-items:center;
  gap:.6rem 1rem;
  padding-block:.6rem;
}
.sort {
  display:flex;
  gap:.2rem;
  margin:0;
  padding:.2rem;
  list-style:none;
  background:var(--band);
  border-radius:.6rem;
}
.sort a {
  display:block;
  padding:.35rem .9rem;
  border-radius:.45rem;
  font-size:.9rem;
  font-weight:500;
}
.sort a:hover {
  background:rgba(255,255,255,.6);
}
.sort a[aria-current] {
  background:var(--slate-900);
  color:#fff;
}
.count {
  font-size:.9rem;
  color:var(--muted);
}
.dens {
  display:flex;
  gap:.3rem;
  margin-inline-start:auto;
}
.dens button {
  display:grid;
  place-items:center;
  width:2.4rem;
  height:2.4rem;
  padding:0;
  border:1px solid var(--line-2);
  border-radius:.5rem;
  background:var(--card);
  color:var(--muted);
  cursor:pointer;
  transition:background-color .15s,color .15s,border-color .15s;
}
.dens button svg {
  width:1.15rem;
  height:1.15rem;
}
.dens button:hover {
  color:var(--slate-900);
  border-color:var(--slate-900);
}
.dens button[aria-pressed=true] {
  background:var(--slate-900);
  color:#fff;
  border-color:var(--slate-900);
}
.dens button:focus-visible {
  outline:2px solid var(--primary);
  outline-offset:2px;
}

/* A phone has room for one or two columns, so the three- and four-column buttons would only mislead. */
@media(max-width:44.9375rem) {
  .dens button[data-c="3"],
  .dens button[data-c="4"] {
    display:none;
  }
}

/* The poster wall.

   data-cols is what the column buttons set; the starting value is the "Columns on a wide screen" setting and the
   visitor's own choice is remembered by modules/density.js. Narrow screens cap the count on purpose — four columns of
   posters on a phone are thumbnails nobody can read — and the phone default is its own setting (body.qhd-mcols-1). */
.wall {
  column-count:2;
  column-gap:1.1rem;
  padding:1.5rem 0 1rem;
  list-style:none;
  margin:0;
}
.wall[data-cols="1"] {
  column-count:1;
  max-width:36rem;
  margin-inline:auto;
}

/* Scoped to the phone so it cannot out-rank the data-cols rules further down. */
@media(max-width:44.9375rem) {
  body.qhd-mcols-1 .wall {
    column-count:1;
  }
}

@media(min-width:45rem) {
  .wall {
    column-count:3;
  }
  .wall[data-cols="2"] {
    column-count:2;
  }
}

@media(min-width:68.75rem) {
  .wall {
    column-count:4;
  }
  .wall[data-cols="2"] {
    column-count:2;
  }
  .wall[data-cols="3"] {
    column-count:3;
  }
}

.print {
  break-inside:avoid;
  margin:0 0 1.3rem;
}
.print figure {
  margin:0;
}
.print .pic {
  display:block;
  padding:.4rem;
  background:#fff;
  border:1px solid var(--line);
  box-shadow:var(--shadow-sm);
  transition:border-color .2s,box-shadow .2s;
}
.print .pic:hover {
  border-color:var(--amber-600);
  box-shadow:var(--shadow-md);
}
.print img {
  display:block;
  width:100%;
  height:auto;
  min-height:6rem;
  background:var(--band);
}
.print figcaption {
  display:flex;
  align-items:baseline;
  gap:.6rem;
  padding:.5rem .2rem 0;
  font-size:.8rem;
  color:var(--muted);
}
.print .s {
  font-family:var(--font-display);
  font-size:1.25rem;
  font-weight:700;
  line-height:1.2;
  color:var(--slate-900);
}
.print .s:hover {
  color:var(--primary);
}
.print .v {
  margin-inline-start:auto;
}
.print audio {
  display:none;
  width:100%;
  margin-top:.6rem;
}
.wall[data-cols="1"] .print audio {
  display:block;
}
.pager {
  padding:1rem 0 3.5rem;
}
.pager ul {
  display:flex;
  flex-wrap:wrap;
  justify-content:center;
  gap:.4rem;
  list-style:none;
  margin:0;
  padding:0;
}
.pager a {
  display:grid;
  place-items:center;
  min-width:2.7rem;
  height:2.7rem;
  padding:0 .7rem;
  border:1px solid var(--line-2);
  border-radius:.5rem;
  background:var(--card);
  font-weight:500;
}
.pager a:hover {
  border-color:var(--primary);
  color:var(--primary);
}
.pager a[aria-current] {
  background:var(--slate-900);
  border-color:var(--slate-900);
  color:#fff;
}

.g-empty {
  padding: 3rem 0 4rem;
  text-align: center;
  color: var(--muted);
}
.g-empty a {
  color: var(--primary);
  text-decoration: underline;
}

/* Banner archives (QHD_WIDE_CARD_CATEGORIES, e.g. al-Kahf): the posters are landscape, so the wall starts on one
   600px column as the old .post-grid { width: 600px } did. The column buttons still work here — they just stop at
   three, because a landscape poster in a quarter-width column is unreadable, and the extra columns only unlock once
   there is room for them. */
.qhd-wide-cards .wall {
  column-count:1;
  max-width:min(600px,100%);
  margin-inline:auto;
}

@media(min-width:45rem) {
  .qhd-wide-cards .wall[data-cols="2"] {
    column-count:2;
    max-width:100%;
  }
}

@media(min-width:68.75rem) {
  .qhd-wide-cards .wall[data-cols="3"] {
    column-count:3;
    max-width:100%;
  }
}

/* Phones.
   The sort tabs scroll instead of wrapping into three lines, the column buttons and the per-card links grow to a
   thumb-sized target, and the pager spreads out so the current page is easy to leave. */
@media (max-width:45rem) {
  .tools-in {
    gap:.4rem .6rem;
  }
  .sort {
    flex:1 1 100%;
    overflow-x:auto;
    scrollbar-width:none;
    -webkit-overflow-scrolling:touch;
  }
  .sort::-webkit-scrollbar {
    display:none;
  }
  .sort a {
    min-height:2.6rem;
    white-space:nowrap;
  }
  .dens {
    margin-inline-start:0;
  }
  .dens button {
    width:2.75rem;
    height:2.75rem;
  }
  .print figcaption {
    gap:.2rem .6rem;
  }
  .print figcaption a,
  .print .s {
    min-height:2.4rem;
    display:inline-flex;
    align-items:center;
  }
  .pager a {
    min-width:2.9rem;
    height:2.9rem;
  }
}
