/* Folder peeks in quick look (js/features/folderpeek.js), the hover preview card (hoverpreview.js) and
   hover-to-inspect (hoverinspect.js: no styles of its own). Owner: peek. Tokens from style.css only; the
   picture chips use quick look's own --v-chip (css/viewer.css). */

@keyframes pk-shimmer { to { background-position: -150% 0; } }
.pk-sk, .pk-peek .sk-box, .hp-th.sk {
  background: linear-gradient(100deg, var(--ph) 30%, var(--raised) 50%, var(--ph) 70%) 0 0 / 300% 100%;
  animation: pk-shimmer 1.4s infinite linear;
}

/* ---------- quick look: a folder's peek ---------- */
.ql-card[data-kind="folder"] .ql-stage { background: var(--bg); box-shadow: inset 0 0 0 1px var(--line); }
.ql-card[data-kind="folder"] .ql-media { display: block; }
.pk-peek { position: absolute; inset: 0; overflow-y: auto; overscroll-behavior: contain; padding: 14px 16px 18px;
  scrollbar-width: thin; scrollbar-color: var(--raised-2) transparent; }
.pk-head { display: flex; align-items: baseline; gap: 6px; margin: 2px 0 10px; }
.pk-head ~ .pk-head { margin-top: 20px; }
.pk-head-t { font-size: 13px; font-weight: 650; letter-spacing: -.005em; }
.pk-head-n { color: var(--faint); font-variant-numeric: tabular-nums; }

.pk-folders { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 14px 12px; }
.pk-fold { display: flex; flex-direction: column; min-width: 0; color: var(--text); text-decoration: none; }
.pk-cover { position: relative; aspect-ratio: 1; display: grid; grid-template: 1fr / 1fr; gap: 2px; border-radius: 9px; overflow: hidden;
  background: var(--mosaic); outline: 2px solid transparent; outline-offset: 2px; transition: outline-color .12s; }
a.pk-fold:hover .pk-cover, a.pk-fold:focus-visible .pk-cover { outline-color: var(--line-3); }
a.pk-fold:focus-visible { outline: none; }
.pk-cover.n0 { place-items: center; background: var(--panel); color: var(--dim); }
.pk-cover.n2 { grid-template-columns: 1fr 1fr; }
.pk-cover.n3, .pk-cover.n4 { grid-template: 1fr 1fr / 1fr 1fr; }
.pk-cover.n3 img:first-child { grid-row: span 2; }
.pk-cover img { width: 100%; height: 100%; min-height: 0; display: block; object-fit: cover; background: var(--ph); opacity: 0; transition: opacity .2s; }
.pk-cover img.ld { opacity: 1; }
.pk-cover .folder-ic { width: 30px; height: 30px; stroke-width: 1.3; }
.pk-linkbadge { position: absolute; left: 6px; bottom: 6px; width: 18px; height: 18px; display: grid; place-items: center; border-radius: 5px;
  background: var(--v-chip); color: var(--text); }
.pk-fname { margin-top: 7px; font-size: 12.5px; font-weight: 600; line-height: 17px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pk-fmeta { color: var(--muted); font-size: 11.5px; line-height: 16px; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pk-fsize { color: var(--faint); font-size: 11px; line-height: 15px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.pk-fold.broken { opacity: .5; }
.pk-fold.sk .pk-cover { outline: 0; }
.pk-fold.sk .sk-line { height: 9px; width: 78%; margin-top: 10px; border-radius: 4px; background: var(--panel); }
.pk-fold.sk .sk-line.short { width: 48%; margin-top: 7px; }

.pk-files { position: relative; }
.pk-file { position: absolute; left: 0; top: 0; display: block; overflow: hidden; border-radius: 7px; background: var(--ph); color: var(--text);
  text-decoration: none; outline: 2px solid transparent; outline-offset: 2px; transition: outline-color .12s; }
a.pk-file:hover, a.pk-file:focus-visible { outline-color: var(--line-3); }
.pk-file img.th { width: 100%; height: 100%; display: block; object-fit: cover; opacity: 0; transition: opacity .2s; }
.pk-file img.th.ld { opacity: 1; }
.pk-type { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  background: var(--panel); color: var(--dim); font-size: 10.5px; font-weight: 600; letter-spacing: .05em; }
.pk-play { position: absolute; left: 6px; top: 6px; width: 20px; height: 20px; display: grid; place-items: center; border-radius: 50%;
  background: var(--v-chip); color: var(--text); }
.pk-play .ic { margin-left: 1px; }
.pk-dur { position: absolute; right: 5px; bottom: 5px; padding: 1px 5px; border-radius: 5px; background: var(--v-chip); color: var(--text);
  font-size: 10.5px; font-variant-numeric: tabular-nums; }
.pk-more { margin-top: 10px; color: var(--faint); font-size: 12px; font-variant-numeric: tabular-nums; }
.pk-more kbd { font: inherit; border: 1px solid var(--line-2); border-radius: 5px; padding: 1px 6px; color: var(--muted); }
.pk-note { display: grid; place-items: center; min-height: 100%; padding: 24px; color: var(--faint); font-size: 13px; text-align: center; }
.pk-loading { display: block; padding: 24px 0; color: var(--faint); }

/* ---------- the hover preview card (beside the pointer) ---------- */
.hp-card { position: fixed; left: 0; top: 0; z-index: 50; pointer-events: none; padding: 6px; max-width: 344px;
  background: var(--pane); border: 1px solid var(--line-3); border-radius: 12px; box-shadow: 0 18px 50px rgba(0, 0, 0, .55);
  opacity: 0; transition: opacity .12s ease; will-change: transform; contain: layout style; }
.hp-card.on { opacity: 1; }
.hp-pic { position: relative; margin: 0 auto; overflow: hidden; border-radius: 8px; background: var(--sunk); }
.hp-img { position: absolute; inset: 0; width: 100%; height: 100%; display: block; object-fit: contain; }
.hp-hi { opacity: 0; transition: opacity .16s; }
.hp-hi.ld { opacity: 1; }
.hp-cap { min-width: 0; padding: 7px 5px 2px; display: flex; flex-direction: column; gap: 1px; }
.hp-name { font-size: 12.5px; font-weight: 600; line-height: 17px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hp-meta { color: var(--muted); font-size: 11.5px; line-height: 16px; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hp-size { color: var(--faint); font-size: 11px; line-height: 15px; font-variant-numeric: tabular-nums; }
.hp-thumbs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 3px; overflow: hidden; border-radius: 8px; }
.hp-thumbs.c1 { grid-template-columns: 1fr; }
.hp-thumbs.c2 { grid-template-columns: 1fr 1fr; }
.hp-th { aspect-ratio: 1; min-width: 0; overflow: hidden; background: var(--panel); }
.hp-thumbs.c1 .hp-th { aspect-ratio: 3 / 2; }
.hp-th img { width: 100%; height: 100%; display: block; object-fit: cover; opacity: 0; transition: opacity .2s; }
.hp-th img.ld { opacity: 1; }
.hp-thumbs.c0 { grid-template-columns: 1fr; }
.hp-th.empty { aspect-ratio: 3 / 1.2; display: grid; place-items: center; color: var(--dim); }

@media (hover: none), (pointer: coarse) { .hp-card { display: none !important; } }
@media (prefers-reduced-motion: reduce) {
  .hp-card, .hp-hi, .hp-th img { transition: none; }
  .pk-sk, .pk-peek .sk-box, .hp-th.sk { animation: none; }
}
