#filter-bar-stage{
  background: rgba(243, 240, 233, .33); /* var(--bg) #f3f0e9 at 33% opacity */
  transition: top .3s ease, box-shadow .2s ease; /* .3s matches header's own padding transition (css/base.css) */
}
#filter-bar-stage.docked{
  box-shadow: 0 8px 24px rgba(28,28,26,.06);
}
.filter-bar{
  display:flex; align-items:center; justify-content:center; flex-wrap:wrap;
  gap: 10px 16px;
  max-width: 1500px;
  margin: 0 auto;
  padding: 20px 24px;
  font-size: 13px;
}
.filter-bar-spacer{
  /* height set by js/layout.js to match the fixed filter bar's rendered
     height, so removing it from flow doesn't make the grid jump up */
  height: 0;
}
.filter-chip{
  font-family:'Cascadia Code', monospace;
  font-size: 13px;
  padding: 8px 20px;
  border-radius: 999px;
  border: 1.5px solid var(--ink);
  background: var(--bg);
  color: var(--ink);
  cursor: pointer;
  transition: background .2s ease, color .2s ease;
}
.filter-chip.active{
  background: var(--ink);
  color: var(--bg);
}
.filter-toggle{
  display:flex; align-items:center; gap:8px;
  margin-left: 8px;
  cursor: pointer;
  user-select: none;
}
.filter-toggle input{ accent-color: var(--ink); width:16px; height:16px; }

.filter-sort, .filter-cat{
  font-family:'Cascadia Code', monospace;
  font-size: 13px;
  padding: 8px 40px 8px 18px; /* right padding leaves room for the custom arrow */
  border-radius: 999px;
  border: 1.5px solid var(--ink);
  background-color: var(--bg);
  /* Native arrow hugs the right edge; draw our own, inset from it. */
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6' fill='none' stroke='%231c1c1a' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M1 1l4 4 4-4'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 18px center;
  -webkit-appearance: none; appearance: none;
  color: var(--ink);
  cursor: pointer;
  margin-left: 8px;
}
.filter-cat{ display: none; } /* shown instead of the chips on narrow screens */

.grid{
  display:grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0;
  max-width: 1500px;
  margin: 0 auto;
}

.card{
  position: relative;
  display:flex; flex-direction:column; align-items:center;
  color: inherit; text-decoration: none;       /* the card is an <a> */
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;                 /* no link preview on long-press (iOS) */
}
.card img{ -webkit-user-drag: none; }

/* Photo container: 500x500, clips its own ring-field canvas at its edges */
.photo-frame{
  position: relative;
  width: 500px; height: 500px;
  overflow: hidden;
  display:flex; align-items:center; justify-content:center;
}
.ring-field{
  position:absolute;
  top:0; left:0;
  width: 500px; height:500px;
  pointer-events:none;
  z-index:1;
}

.photo-wrap{
  position: relative;
  width: 350px; height: 350px;
  border-radius: 108px;
  overflow: hidden;
  background: var(--card-bg);
  z-index: 2;
  cursor: pointer;
  box-shadow: 0 2px 0 rgba(0,0,0,0.02);
}
.photo-wrap img, .photo-wrap .art{
  width:100%; height:100%; object-fit: cover;
  filter: grayscale(1) opacity(0.55) contrast(0.95);
  transition: filter .5s ease;
}
.photo-wrap .photo-img{
  position: absolute; top:0; left:0;
}
/* "Selected" look of a card: the mouse hovering it (only where a mouse can hover —
   touch browsers fake :hover after a tap and leave it stuck on the last card) or
   the card sitting at the centre of the screen on a touch device (.in-focus,
   toggled by js/layout.js). */
@media (hover: hover){
  .card:hover .photo-wrap img,
  .card:hover .photo-wrap .art{
    filter: grayscale(0) opacity(1) contrast(1);
  }
}
.card.in-focus .photo-wrap img,
.card.in-focus .photo-wrap .art{
  filter: grayscale(0) opacity(1) contrast(1);
}

.new-badge{
  position: absolute;
  top: 24px; right: 24px;
  z-index: 3;
  font-family:'Cascadia Code', monospace;
  font-size: 15px;
  letter-spacing: .04em;
  font-weight: 700;
  padding: 6.5px 15.5px; /* no border anymore — padding keeps the badge's outer size unchanged */
  border-radius: 999px;
  background: var(--teal);
  color: #fff;
}

.label-slot{
  position: absolute;
  left: 50%;
  bottom: -12px;
  transform: translateX(-50%);
  height: 60px;
  display:flex; align-items:center; justify-content:center;
  z-index: 3;
  overflow: visible;
}
.capsule-ring{
  position:absolute;
  top:50%; left:50%;
  width: 640px; height:420px;
  transform: translate(-50%,-50%);
  pointer-events:none;
  z-index:1;
  opacity: 0;
  transition: opacity .35s ease;
}
@media (hover: hover){
  .card:hover .capsule-ring{ opacity: 1; }
}
.card.in-focus .capsule-ring{ opacity: 1; }
.capsule{
  position:relative;
  z-index:2;
  width: 200px;
  height: 40px;
  display:flex; align-items:center; justify-content:center;
  border: 2px solid var(--ring-hover);
  border-radius: 999px;
  background: var(--bg);
  font-family:'Cascadia Code', monospace;
  font-size: 18px;
  letter-spacing: .02em;
  opacity: 0;
  transform: translateY(-6px);
  transition: opacity .35s ease, transform .35s ease;
  white-space: nowrap;
}
@media (hover: hover){
  .card:hover .capsule{
    opacity: 1;
    transform: translateY(0);
  }
}
.card.in-focus .capsule{ opacity: 1; transform: translateY(0); }

.grid-sentinel{
  grid-column: 1 / -1;
  height: 1px;
}
.empty-state{
  grid-column: 1 / -1;
  text-align:center;
  padding: 80px 24px;
  color: #8a8a82;
  font-size: 14px;
}

@media (max-width: 820px){
  /* Chips don't fit in one row here — the same categories become a dropdown. */
  .filter-chip{ display: none; }
  .filter-cat{ display: inline-block; margin-left: 0; }
  .filter-bar{ justify-content:center; flex-wrap:wrap; padding: 14px 20px; gap: 10px 12px; }

  .grid{
    display: block;
    max-width: none;
    padding: 0 0 100px;
  }
  .card{
    display: flex; flex-direction: column; align-items: center;
    padding: 0;
    scroll-snap-align: center;
  }
  .photo-frame{
    width: 88vw; height: 88vw;
    margin: 0 auto;
    flex: none;
  }
  .photo-wrap{
    width: 68vw; height: 68vw;
    border-radius: 25vw;
  }
  .ring-field{ width: 88vw; height: 88vw; }

  .label-slot{
    position: absolute;
    left: 50%;
    bottom: -18px;
    transform: translateX(-50%);
    margin: 0;
    height: 44px;
  }
  /* The ring canvas around the plate is sized by js/catalog.js from the plate's
     real width and height (it used to be a fixed box here, which squeezed the
     desktop-sized drawing and made the rings no longer follow the plate's shape). */
  .capsule{ width: auto; min-width: 120px; padding: 0 18px; height: 34px; font-size: 13px; }
}

/* Until js/main.js has drawn the catalog and the filter bar, keep the footer and the bar
   out of sight: they would otherwise be painted in the wrong place and then jump
   (layout shift). Without JS the <noscript> style in the page head undoes this. */
body:not(.catalog-ready) footer,
body:not(.catalog-ready) #filter-bar-stage{
  visibility: hidden;
}
