/* Directory page (D17 section 8) */
/* Plain canvas here: the home page's fixed colour glows sat behind the whole card grid as a haze. Dot grid only. */
body::before { background: radial-gradient(circle, rgba(255, 255, 255, .045) 1px, transparent 1.5px) 0 0 / 22px 22px; }
.dir-top { padding: calc(56px + clamp(48px, 6vw, 88px)) 0 32px; }
.dir-top .lead { margin: 16px 0 0; }
.dir-search { position: relative; max-width: 720px; margin-top: 32px; }
/* Sticky filter bar under the nav island */
/* Sticky filter bar. Once it sticks, a black strip fills the space above it, so the nav notch and the bar read as one black surface. */
.dir-bar { position: relative; padding: 14px 0 12px; }
/* Compact bar: one scrolling line of chips and filters. Black from the top edge down, so the nav notch melts into it. */
.dir-mini { position: fixed; left: 0; right: 0; top: 0; z-index: 45; padding-top: 38px; background: #000; border-bottom: 1px solid var(--line);
  translate: 0 -100%; transition: translate 420ms var(--ease-expo); }
.dir-mini.on { translate: 0 0; }
.dir-mini-in { display: flex; align-items: center; gap: 16px; height: 56px; }
.dir-mini-row { flex: 1; min-width: 0; display: flex; gap: 6px; overflow-x: auto; overscroll-behavior-x: contain; scrollbar-width: none; padding: 2px 0;
  -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 48px), transparent); mask-image: linear-gradient(90deg, #000 calc(100% - 48px), transparent); }
.dir-mini-row::-webkit-scrollbar { display: none; }
.dir-mini-row .chip { min-height: 34px; padding: 0 12px; font-size: 13px; }
.dir-mini-row .sep { flex: none; width: 1px; margin: 6px 4px; background: var(--line-strong); }
.dir-mini-count { flex: none; font-size: 13px; color: var(--ink-muted); }
.dir-mini-find { flex: none; display: grid; place-items: center; width: 40px; height: 40px; margin-right: -6px; border-radius: 50%; color: var(--ink);
  background: var(--tile-2); border: 1px solid var(--line); transition: background var(--m-base), transform var(--press) var(--ease); }
.dir-mini-find:active { transform: scale(.94); }
.dir-mini-find .ic { width: 18px; height: 18px; }
.dir-empty-x { margin-top: 20px; }
.dir-chips { display: flex; flex-wrap: wrap; gap: 8px; padding: 2px 0; }
.dir-chips::-webkit-scrollbar { display: none; }
.chip { flex: none; display: inline-flex; align-items: center; gap: 8px; min-height: 36px; padding: 0 14px; border-radius: 999px; font-size: 14px; white-space: nowrap;
  background: var(--tile-2); border: 1px solid var(--line); color: var(--ink-muted);
  transition: color var(--m-base), background var(--m-base), border-color var(--m-base), transform var(--press) var(--ease); }
.chip:hover { color: var(--ink); border-color: var(--line-strong); }
.chip:active { transform: scale(.96); }
.chip .num { font: 500 11px/1 var(--mono); color: var(--ink-faint); }
.chip[aria-pressed="true"] { background: var(--ink); color: #000; border-color: var(--ink); }
.chip[aria-pressed="true"] .num { color: rgba(0, 0, 0, .55); }
.dir-meta { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 10px; flex-wrap: wrap; }
.dir-toggles { display: flex; gap: 8px; flex-wrap: wrap; }
.dir-toggles .chip { min-height: 32px; font-size: 13px; }
.dir-count { display: flex; align-items: center; gap: 12px; font-size: 14px; color: var(--ink-muted); }
.dir-clear { color: var(--link); font-size: 14px; min-height: 32px; }
.dir-clear:hover { text-decoration: underline; text-underline-offset: 3px; }

.dir-grid-wrap { padding-top: 24px; padding-bottom: var(--section); }
.dir-grid { grid-template-columns: repeat(3, 1fr); }
.dir-grid .card { content-visibility: auto; contain-intrinsic-size: auto 210px; }
.dir-grid .card.hit .card-a { border-color: var(--line-strong); }
.dir-empty { padding: 64px 0; text-align: center; color: var(--ink-muted); }

/* Drawer: a glass sheet from the right on desktop, from the bottom on phones */
.drawer { position: fixed; inset: 0 0 0 auto; width: min(460px, 100%); height: 100%; max-width: none; max-height: none; margin: 0; padding: 0; border: 0; color: var(--ink);
  background: rgba(20, 20, 22, .94); backdrop-filter: blur(28px) saturate(1.6); -webkit-backdrop-filter: blur(28px) saturate(1.6);
  border-left: 1px solid var(--line-strong); overscroll-behavior: contain; }
.drawer[open] { animation: dr-in var(--m-medium) var(--ease-out); }
.drawer.closing { animation: dr-out 180ms var(--ease-inout) forwards; }
@keyframes dr-in { from { translate: 40px 0; opacity: 0; } }
@keyframes dr-out { to { translate: 40px 0; opacity: 0; } }
.drawer::backdrop { background: rgba(0, 0, 0, .5); animation: fade var(--m-medium) var(--ease-out); }
@keyframes fade { from { opacity: 0; } }
.dr-in { position: relative; height: 100%; overflow-y: auto; padding: 20px 24px 0; display: flex; flex-direction: column; }
.dr-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 44px; margin-bottom: 12px; }
.dr-g { font-size: 14px; color: var(--ink-muted); }
.dr-x { position: relative; flex: none; width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; background: rgba(255, 255, 255, .08); color: #fff;
  transition: background var(--m-base), transform var(--press) var(--ease); }
.dr-x::after { content: ""; position: absolute; inset: -4px; }
.dr-x:hover { background: rgba(255, 255, 255, .14); }
.dr-x:active { transform: scale(.94); }
.dr-x .ic { width: 18px; height: 18px; }
.dr-vis .stage { --cw: 760; --ch: 400; border-radius: 16px; }
.dr-vis .stage { --bz: 6px; }
.dr-vis .stage::after { border-width: 6px; }
.dr-name { margin-top: 22px; font-size: 30px; font-weight: 600; letter-spacing: -0.03em; line-height: 1.1; }
.dr-blurb { margin-top: 8px; color: var(--ink-muted); font-size: 17px; }
.dr-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 14px; }
.dr-list { margin-top: 10px; padding: 0 16px; border-radius: var(--r-md); background: var(--tile-1); font-size: 15px; }
/* Permissions as the Mac's own Privacy rows (sections.css .perm): icon, name, a switch that turns on */
.dr-perms { padding: 2px 12px; }
.dr-perms .perm { grid-template-columns: 28px 1fr auto; gap: 12px; padding: 10px 0; }
.dr-perms .perm-ic { width: 28px; height: 28px; padding: 5px; border-radius: 7px; }
.dr-perms b { font-weight: 400; }
.dr-perms .perm-none { padding: 13px 0; text-align: left; font-size: 15px; color: var(--ink-muted); }
.dr-path { display: flex; flex-wrap: wrap; align-items: center; padding-block: 13px; color: var(--ink-muted); }
.dr-path > li + li::before { content: ""; display: inline-block; width: 5px; height: 5px; margin: 0 10px 2px 8px; border: solid var(--ink-faint); border-width: 1.5px 1.5px 0 0; rotate: 45deg; }
.dr-path > li:last-child { color: var(--ink); }
.dr-h { margin-top: 28px; font-size: 15px; font-weight: 600; letter-spacing: -0.01em; }
/* Neighbours as small grid cards (base.css .card-a): their wallpaper slice and notch, then the name */
.dr-rel ul { margin-top: 10px; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.dr-rel .card-a { width: 100%; border-radius: var(--r-md); text-align: left; }
.dr-rel .card-vis { height: 58px; }
.dr-rel b { padding: 0 12px 12px; font-size: 14px; font-weight: 600; line-height: 1.25; letter-spacing: -0.01em; }
.dr-actions { position: sticky; bottom: 0; display: flex; align-items: center; gap: 20px; margin: auto -24px 0; padding: 16px 24px calc(16px + env(safe-area-inset-bottom)); background: rgba(20, 20, 22, .96); border-top: 1px solid var(--line); }

@media (max-width: 1068px) { .dir-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 734px) {
  .dir-top { padding-top: calc(38px + 48px); }
  .dir-bar { padding: 10px 0; }
  .dir-chips { flex-wrap: nowrap; overflow-x: auto; overscroll-behavior-x: contain; scrollbar-width: none; margin: 0 -16px; padding: 2px 16px;
    mask-image: linear-gradient(90deg, #000 calc(100% - 72px), transparent); -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 72px), transparent); }
  .chip, .dir-toggles .chip { min-height: 44px; }
  .dir-toggles { overflow-x: auto; flex-wrap: nowrap; scrollbar-width: none; margin: 0 -16px; padding: 0 16px; }
  .dir-meta { flex-direction: column; align-items: stretch; }
  .dir-grid { grid-template-columns: 1fr; gap: 12px; }
  .dir-grid .card-a { padding: 20px; }
  .drawer { inset: auto 0 0 0; width: 100%; height: min(88svh, 760px); border-left: 0; border-top: 1px solid var(--line-strong); border-radius: 28px 28px 0 0; }
  .drawer[open] { animation-name: sheet-in; }
  .drawer.closing { animation-name: sheet-out; }
  @keyframes sheet-in { from { translate: 0 100%; } }
  @keyframes sheet-out { to { translate: 0 100%; } }
  .dr-in { padding: 0 16px; overscroll-behavior: contain; }
  /* The top bar stays while the sheet scrolls, so Close is always in reach; it is also the handle you pull the sheet down by. */
  .dr-top { position: sticky; top: 0; z-index: 3; margin: 0 -16px 12px; padding: 22px 16px 10px; background: rgba(20, 20, 22, .96); touch-action: none; }
  .dr-top::before { content: ""; position: absolute; left: 50%; top: 8px; translate: -50% 0; width: 40px; height: 5px; border-radius: 3px; background: var(--line-strong); }
  .dr-actions { margin: auto -16px 0; padding-left: 16px; padding-right: 16px; }
  .dir-top { padding-bottom: 12px; }
  .dir-mini-in { height: 52px; gap: 12px; }
  .dir-mini-row .chip { min-height: 40px; }
}
@media (prefers-reduced-motion: reduce) {
  .drawer[open], .drawer.closing, .drawer::backdrop { animation-duration: 1ms; }
}
@media (prefers-reduced-transparency: reduce), (prefers-contrast: more) {
  .drawer { background: var(--tile-2); backdrop-filter: none; -webkit-backdrop-filter: none; }
  .dir-bar { background: #000; backdrop-filter: none; -webkit-backdrop-filter: none; }
}
