/* ==========================================================================
   Category / genre listing page
   --------------------------------------------------------------------------
   Two modes, driven by the query string:

     category.html              genre directory (all 13 genres)
     category.html?genre=<key>  every game on one genre shelf

   Layout notes:
   - The hero strip summarises the shelf (count, round-length range, pace).
   - The game grid is intentionally a different rhythm from the home page
     clusters: a dense auto-fit grid, since this page is a complete listing.
   ========================================================================== */

/* --------------------------------------------------------------------------
   Genre "All" link on the home page rail
   -------------------------------------------------------------------------- */
.pop-genre__all {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  align-self: flex-start;
  margin-top: 0.35rem;
  padding: 0.3rem 0.7rem;
  border-radius: var(--pop-r-pill);
  background: var(--pop-ink);
  color: var(--pop-white);
  font-family: var(--pop-display);
  font-size: 0.76rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  transition:
    background var(--pop-fast) var(--pop-ease),
    color var(--pop-fast) var(--pop-ease),
    gap var(--pop-fast) var(--pop-spring),
    transform var(--pop-fast) var(--pop-spring);
}

.pop-genre__all svg {
  flex: 0 0 auto;
  transition: transform var(--pop-fast) var(--pop-spring);
}

.pop-genre__all:hover {
  gap: 0.5rem;
  background: var(--pop-orange);
  color: var(--pop-ink);
  transform: translateY(-2px);
}

.pop-genre__all:hover svg {
  transform: translateX(2px);
}

/* --------------------------------------------------------------------------
   Category hero
   -------------------------------------------------------------------------- */
.pop-cathero {
  padding-block: clamp(1.25rem, 2.6vw, 2rem) clamp(1.5rem, 3vw, 2.25rem);
}

.pop-cathero__top {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem 1.5rem;
}

.pop-cathero h1 {
  margin-top: 0.7rem;
  font-size: clamp(2rem, 1.3rem + 3vw, 3.2rem);
  line-height: 1.04;
}

.pop-cathero__lede {
  max-width: 48ch;
  margin-top: 0.85rem;
  font-size: clamp(1rem, 0.96rem + 0.24vw, 1.08rem);
  line-height: 1.68;
  color: var(--pop-ink-2);
}

/* Summary chips: count, length range, pace mix */
.pop-catstats {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  margin-top: 1.35rem;
}

.pop-catstat {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.85rem;
  border-radius: var(--pop-r-pill);
  background: var(--pop-white);
  box-shadow: var(--pop-shadow-sm);
  font-size: 0.86rem;
  font-weight: 700;
  color: var(--pop-ink-2);
}

.pop-catstat i {
  display: grid;
  place-items: center;
  width: 1.65rem;
  height: 1.65rem;
  border-radius: 50%;
  font-style: normal;
  font-size: 0.78rem;
  background: var(--pop-cream-deep);
}

.pop-catstat b {
  font-family: var(--pop-display);
  font-size: 0.95rem;
  color: var(--pop-ink);
}

/* --------------------------------------------------------------------------
   Genre switcher (pills linking to sibling shelves)
   -------------------------------------------------------------------------- */
.pop-catswitch {
  display: flex;
  gap: 0.45rem;
  padding-bottom: 0.6rem;
  margin-top: 1.5rem;
  overflow-x: auto;
  scrollbar-width: thin;
  scroll-snap-type: x proximity;
}

.pop-catswitch a {
  flex: 0 0 auto;
  scroll-snap-align: start;
}

/* --------------------------------------------------------------------------
   Full game grid
   -------------------------------------------------------------------------- */
.pop-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(15.5rem, 1fr));
  gap: clamp(0.6rem, 1.3vw, 0.95rem);
  align-items: stretch;
}

/* On this page every card stands alone, so give it a taller portrait ratio and
   always show the description — there is no surrounding cluster to carry it. */
.pop-grid .pop-gcard {
  min-height: 12.5rem;
}

.pop-grid .pop-gcard__desc {
  display: block;
  margin-top: 0.2rem;
  font-size: 0.84rem;
  line-height: 1.5;
  color: rgba(32, 41, 52, 0.76);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.pop-grid .pop-gcard__play {
  opacity: 1;
  transform: none;
}

/* Result bar above the grid */
.pop-gridbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem 1rem;
  margin-bottom: clamp(0.9rem, 1.8vw, 1.25rem);
  padding-bottom: 0.7rem;
  border-bottom: 2px dashed var(--pop-line-strong);
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--pop-ink-2);
}

.pop-gridbar b {
  color: var(--pop-ink);
}

/* --------------------------------------------------------------------------
   Genre directory cards (no ?genre= param)
   -------------------------------------------------------------------------- */
.pop-dir {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(17rem, 1fr));
  gap: clamp(0.7rem, 1.6vw, 1.15rem);
}

.pop-dircard {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  padding: 1.1rem 1.15rem 1.2rem;
  border-radius: var(--pop-r-lg);
  background: var(--pop-white);
  box-shadow: var(--pop-shadow-sm);
  overflow: hidden;
  transition:
    transform var(--pop-mid) var(--pop-spring),
    box-shadow var(--pop-mid) var(--pop-ease);
}

.pop-dircard:hover {
  transform: translateY(-4px);
  box-shadow: var(--pop-shadow-lg);
}

/* Tone accent bar down the left edge */
.pop-dircard::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 0.32rem;
  background: var(--pop-orange);
}

.pop-dircard[data-tone="sage"]::before { background: var(--pop-mint); }
.pop-dircard[data-tone="coral"]::before { background: #ffb894; }
.pop-dircard[data-tone="pine"]::before { background: var(--pop-sky); }
.pop-dircard[data-tone="lav"]::before { background: var(--pop-lav); }
.pop-dircard[data-tone="pink"]::before { background: var(--pop-pink); }
.pop-dircard[data-tone="marigold"]::before { background: var(--pop-sun); }

.pop-dircard__no {
  font-family: var(--pop-display);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  color: var(--pop-orange-text);
}

.pop-dircard__name {
  font-size: 1.18rem;
  line-height: 1.15;
}

.pop-dircard__blurb {
  font-size: 0.88rem;
  line-height: 1.55;
  color: var(--pop-ink-2);
}

.pop-dircard__foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  margin-top: auto;
  padding-top: 0.75rem;
  font-family: var(--pop-display);
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--pop-ink-2);
}

.pop-dircard__go {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  color: var(--pop-orange-text);
  transition: gap var(--pop-fast) var(--pop-spring);
}

.pop-dircard:hover .pop-dircard__go {
  gap: 0.55rem;
}

/* --------------------------------------------------------------------------
   Responsive
   -------------------------------------------------------------------------- */
@media (max-width: 720px) {
  .pop-grid {
    grid-template-columns: repeat(auto-fill, minmax(9.5rem, 1fr));
    gap: 0.55rem;
  }

  .pop-grid .pop-gcard {
    min-height: 10.5rem;
    padding: 0.65rem;
  }

  .pop-grid .pop-gcard__desc {
    -webkit-line-clamp: 2;
    font-size: 0.78rem;
  }

  .pop-grid .pop-gcard__name {
    font-size: 0.9rem;
  }

  .pop-grid .pop-gcard__play {
    display: none;
  }

  .pop-dir {
    grid-template-columns: minmax(0, 1fr);
  }

  .pop-cathero__top {
    align-items: flex-start;
  }
}

@media (max-width: 420px) {
  .pop-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* --------------------------------------------------------------------------
   Height reservation
   --------------------------------------------------------------------------
   The listing renders after parse, so these values reserve the measured height
   of each container up front. They come from real measurements at three
   viewports; filling the container then causes no shift.

   `:empty` guarantees the reservation vanishes the instant content lands, so
   it can never fight the rendered layout.
   -------------------------------------------------------------------------- */

/* stats: 42px desktop/tablet, 94px phone (chips wrap) */
[data-category-stats]:empty {
  min-height: 42px;
}

@media (max-width: 420px) {
  [data-category-stats]:empty {
    min-height: 94px;
  }
}

/* switcher pills: 51px at every width */
[data-category-switch]:empty {
  min-height: 51px;
}

/* body: measured per mode and breakpoint */
[data-category-body]:empty {
  min-height: 211px;
}

/* genre listing */
[data-catmode="genre"] [data-category-body]:empty {
  min-height: 211px;
}

@media (max-width: 900px) {
  [data-catmode="genre"] [data-category-body]:empty {
    min-height: 410px;
  }
}

@media (max-width: 720px) {
  [data-catmode="genre"] [data-category-body]:empty {
    min-height: 522px;
  }
}

/* genre directory */
[data-catmode="dir"] [data-category-body]:empty {
  min-height: 669px;
}

@media (max-width: 900px) {
  [data-catmode="dir"] [data-category-body]:empty {
    min-height: 1148px;
  }
}

@media (max-width: 720px) {
  [data-catmode="dir"] [data-category-body]:empty {
    min-height: 2129px;
  }
}
