/* ERHML: components shared by the public library and the curator console */

@keyframes rise-in { from { opacity: 0; transform: translateY(24px); filter: blur(10px); } to { opacity: 1; transform: none; filter: blur(0); } }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }

.icon-nudge { transition: transform .35s var(--ease); }

.js [data-reveal] { opacity: 0; transform: translateY(30px); filter: blur(8px); transition: opacity 1s var(--ease), transform 1s var(--ease), filter 1s var(--ease); transition-delay: calc(var(--i, 0) * 80ms); }
.js [data-reveal].in { opacity: 1; transform: none; filter: none; }

.lib-search {
  display: flex; align-items: center; gap: 12px; padding: 4px 20px;
  background: var(--white); border: 1px solid var(--line-2); border-radius: 18px;
  transition: border-color .3s var(--ease-soft), box-shadow .3s var(--ease-soft);
}
.lib-search:focus-within { border-color: var(--green); box-shadow: 0 0 0 4px rgba(17, 128, 75, .14); }
.lib-search > .icon { width: 22px; height: 22px; color: var(--muted); }
.lib-search input { flex: 1; min-width: 0; padding: 14px 0; border: 0; outline: none; background: transparent; font-size: 1.15rem; }
.lib-count { font-weight: 700; color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }

.pills-wrap { margin-top: 18px; overflow-x: auto; scrollbar-width: none; }
.pills-wrap::-webkit-scrollbar { display: none; }
.pills { position: relative; display: inline-flex; gap: 2px; padding: 4px; border-radius: 999px; background: var(--surface); }
.pill { position: relative; z-index: 1; display: inline-flex; align-items: center; gap: 8px; padding: 9px 16px; border: 0; border-radius: 999px; background: none; color: var(--ink-2); font-weight: 700; white-space: nowrap; cursor: pointer; transition: color .35s var(--ease-soft); }
.pill .n { font-size: .88rem; font-weight: 400; color: var(--muted); transition: color .35s var(--ease-soft); }
.pill:hover { color: var(--black); }
.pill[aria-selected="true"] { color: var(--white); }
.pill[aria-selected="true"] .n { color: rgba(255, 255, 255, .8); }
.pill-indicator { position: absolute; z-index: 0; top: 4px; bottom: 4px; left: 0; width: 0; border-radius: 999px; background: var(--green); transition: transform .55s var(--ease), width .55s var(--ease); }

.views { position: relative; display: inline-flex; padding: 3px; border-radius: 10px; background: var(--surface); }
.views button { position: relative; z-index: 1; width: 38px; height: 32px; display: grid; place-items: center; padding: 0; border: 0; border-radius: 8px; background: none; color: var(--ink-2); cursor: pointer; transition: color .35s var(--ease-soft); }
.views button[aria-pressed="true"] { color: var(--white); }
.views-indicator { position: absolute; top: 3px; left: 3px; width: 38px; height: 32px; border-radius: 8px; background: var(--black); transition: transform .5s var(--ease); }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 5px 8px 5px 12px; border: 0; border-radius: 999px; background: var(--black); color: var(--white); font-size: .9rem; font-weight: 700; cursor: pointer; animation: chip-in .4s var(--ease) both; transition: background-color .25s; }
.chip .icon { width: .9em; height: .9em; stroke-width: 2.4; }
.chip:hover { background: #333; }
.chip.clear { background: none; color: var(--ink-2); text-decoration: underline; text-underline-offset: 3px; }
@keyframes chip-in { from { opacity: 0; transform: scale(.8); } to { opacity: 1; transform: none; } }

.card { position: relative; display: grid; gap: 2px; align-content: start; width: 100%; padding: 0; border: 0; background: none; color: var(--ink); text-align: left; cursor: pointer; }
.card-media { position: relative; aspect-ratio: 4 / 3; margin-bottom: 14px; overflow: hidden; border-radius: var(--r); background: var(--surface); transition: transform .55s var(--ease), box-shadow .55s var(--ease); }
.card-media img { width: 100%; height: 100%; object-fit: cover; opacity: 0; filter: blur(14px); transform: scale(1.08); transition: opacity .8s var(--ease-soft), filter 1s var(--ease-soft), transform 1.2s var(--ease); }
.card-media img.loaded { opacity: 1; filter: none; transform: scale(1); }
.card:hover .card-media, .card:focus-visible .card-media { transform: translateY(-6px); box-shadow: 0 26px 44px -22px rgba(0, 0, 0, .45); }
.card:hover .card-media img.loaded { transform: scale(1.06); }
.card-cat { position: absolute; top: 12px; left: 12px; z-index: 1; padding: 3px 10px; border-radius: 999px; background: rgba(255, 255, 255, .94); font-size: .78rem; font-weight: 700; color: var(--ink); }
.card-excerpt { position: absolute; left: 0; right: 0; bottom: 0; z-index: 1; padding: 56px 16px 14px; background: linear-gradient(transparent, rgba(0, 0, 0, .8)); color: var(--white); font-size: .95rem; line-height: 1.45; transform: translateY(101%); transition: transform .55s var(--ease); }
.card:hover .card-excerpt, .card:focus-visible .card-excerpt { transform: none; }
.card-title { font-family: var(--display); font-size: 1.45rem; line-height: 1.15; }
.card-sub { color: var(--muted); }

/* Links used as pills (status tabs in the console) */
.pill[aria-current="page"] { color: var(--white); }
.pill[aria-current="page"] .n { color: rgba(255, 255, 255, .8); }
a.pill { text-decoration: none; }

@media (prefers-reduced-motion: reduce) {
  .js [data-reveal] { opacity: 1; transform: none; filter: none; }
}
