/* Directory: grouped tiles, jump chips, category sheet, search results */

/* The tiles are buttons now (they open the sheet). Same look as before. */
.tile {
  display: flex; flex-direction: column; gap: 6px; width: 100%; padding: 6px 6px 10px;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  color: inherit; font: inherit; font-weight: 600; font-size: .95rem; line-height: 1.25; text-align: center;
  cursor: pointer; transition: transform .12s, border-color .12s, box-shadow .12s;
}
.tile:active { transform: scale(.97); }
.tile:hover, .tile:focus-visible { border-color: var(--ink); box-shadow: 0 6px 16px rgba(0,0,0,.12); outline: none; }
.tile:focus-visible { outline: 3px solid var(--ink); outline-offset: 2px; }
.tile img, .tile .ph { width: 100%; aspect-ratio: 1 / 1; border-radius: 10px; display: block; }
.tile img { object-fit: cover; background: var(--bg); }
.tile > span { display: block; padding: 0 2px; }

/* Placeholder until the artwork exists: emoji on brand yellow */
.ph {
  display: flex; align-items: center; justify-content: center;
  background: var(--yellow); color: var(--black); font-size: 4.6rem; line-height: 1.35; padding-top: .5em;
  overflow: hidden;
}

/* Group headings */
.group { margin-bottom: 22px; scroll-margin-top: 10px; }
.group h3 {
  margin: 0 0 10px; padding-left: 10px; font-size: 1.05rem; letter-spacing: .1px;
  border-left: 6px solid var(--yellow);
}

/* Row of chips that jump to a group */
.jump {
  display: flex; gap: 8px; overflow-x: auto; margin: 0 -14px 14px; padding: 2px 14px 6px;
  scroll-snap-type: x proximity; scroll-padding-left: 14px; -webkit-overflow-scrolling: touch; scrollbar-width: none;
}
.jump::-webkit-scrollbar { display: none; }
.jump[hidden], #groups[hidden], .results[hidden] { display: none; }
.jump-chip {
  flex: none; scroll-snap-align: start; min-height: 40px; display: flex; align-items: center;
  padding: 6px 14px; border-radius: 999px; background: var(--card); border: 1.5px solid var(--line);
  color: inherit; text-decoration: none; font-weight: 600; font-size: .92rem; white-space: nowrap;
}
.jump-chip:hover, .jump-chip:focus-visible { border-color: var(--ink); outline: none; }
.jump-chip:active { background: var(--yellow); color: var(--black); border-color: var(--black); }

/* Search results */
.results { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.results a {
  display: flex; flex-direction: column; gap: 2px; min-height: var(--tap); padding: 10px 14px;
  background: var(--card); border: 1px solid var(--line); border-radius: 12px; color: inherit; text-decoration: none;
}
.results a:hover, .results a:focus-visible { border-color: var(--ink); outline: none; }
.results .path { color: var(--muted); font-size: .85rem; }

/* Category sheet: slides up from the bottom on phones, centred card on larger screens */
#cat-dialog {
  border: 0; padding: 18px 16px calc(18px + env(safe-area-inset-bottom)); color: var(--ink); background: var(--card);
  width: 100%; max-width: 100%; max-height: 82vh; max-height: 82dvh; overflow-y: auto;
  margin: auto 0 0; border-radius: 20px 20px 0 0;
}
#cat-dialog::backdrop { background: rgba(0,0,0,.55); }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 4px; }
.sheet-head h2 { margin: 0; font-size: 1.3rem; }
.icon-btn {
  flex: none; width: var(--tap); height: var(--tap); border-radius: 50%; border: 1.5px solid var(--line);
  background: var(--bg); color: inherit; font-size: 1.1rem; cursor: pointer;
}
.icon-btn:hover, .icon-btn:focus-visible { border-color: var(--ink); outline: none; }
#cat-dialog .hint { margin: 0 0 12px; }
#cat-all { margin-bottom: 14px; }
.sub-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: 1fr; gap: 8px; }
.sub-list a {
  display: flex; align-items: center; min-height: var(--tap); padding: 10px 14px;
  border: 1.5px solid var(--line); border-radius: 12px; color: inherit; text-decoration: none; font-weight: 600;
}
.sub-list a:hover, .sub-list a:focus-visible { border-color: var(--ink); background: var(--bg); outline: none; }
.sub-list a:active { background: var(--yellow); color: var(--black); border-color: var(--black); }

@media (min-width: 600px) {
  .jump { margin: 0 0 14px; padding-left: 0; padding-right: 0; flex-wrap: wrap; overflow: visible; }
  #cat-dialog { width: min(560px, calc(100vw - 32px)); margin: auto; border-radius: var(--radius); border: 1px solid var(--line); }
  .sub-list { grid-template-columns: 1fr 1fr; }
  .ph { font-size: 5rem; }
}

#browse { scroll-margin-top: 8px; }
