:root {
  --bg: #08090a;
  --surface: #111214;
  --surface-2: #17191c;
  --line: #23262b;
  --text: #ecedef;
  --muted: #8b9098;
  --accent: #6ee7b7;
  --radius: 14px;
  --ease: cubic-bezier(.2, .7, .2, 1);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 ui-sans-serif, system-ui, "Segoe UI Variable Text", "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.wrap { width: min(1440px, 100% - 40px); margin-inline: auto; }

/* Header */
.top {
  position: sticky; top: 0; z-index: 10;
  background: rgb(8 9 10 / .82);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.top__row { display: flex; align-items: center; gap: 20px; height: 64px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 600; letter-spacing: -.01em; text-decoration: none; white-space: nowrap; }
.brand__mark {
  width: 22px; height: 22px; border-radius: 6px;
  background: conic-gradient(from 210deg, var(--accent), #3b82f6, var(--accent));
}
.search {
  margin-left: auto; position: relative; display: flex; align-items: center;
  width: min(420px, 100%);
}
.search svg { position: absolute; left: 12px; width: 16px; height: 16px; fill: none; stroke: var(--muted); stroke-width: 2; }
.search input {
  width: 100%; height: 40px; padding: 0 40px 0 36px;
  background: var(--surface); color: var(--text);
  border: 1px solid var(--line); border-radius: 10px;
  font: inherit; outline: none;
  transition: border-color .2s var(--ease);
}
.search input:focus { border-color: var(--accent); }
.search kbd {
  position: absolute; right: 10px; font: 12px ui-monospace, monospace; color: var(--muted);
  border: 1px solid var(--line); border-radius: 5px; padding: 1px 6px;
}

/* Intro */
.intro { padding: 56px 0 28px; }
.intro h1 { margin: 0; font-size: clamp(34px, 5vw, 60px); line-height: 1.02; letter-spacing: -.035em; font-weight: 650; }
.intro p { margin: 12px 0 0; color: var(--muted); font-size: 17px; max-width: 52ch; }

/* Filters */
.filters {
  display: flex; flex-wrap: wrap; align-items: center; gap: 12px 20px;
  padding-bottom: 22px; border-bottom: 1px solid var(--line); margin-bottom: 24px;
}
.chips { display: flex; flex-wrap: wrap; gap: 8px; flex: 1 1 600px; }
.chip {
  height: 32px; padding: 0 13px; border-radius: 999px;
  background: var(--surface); color: var(--muted);
  border: 1px solid var(--line); font: inherit; font-size: 13.5px; cursor: pointer;
  transition: color .15s, border-color .15s, background .15s;
}
.chip:hover { color: var(--text); border-color: #353941; }
.chip[aria-selected="true"] { background: var(--text); color: var(--bg); border-color: var(--text); }
.chip small { opacity: .6; margin-left: 4px; }
.filters__right { display: flex; align-items: center; gap: 18px; margin-left: auto; }
.toggle { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13.5px; cursor: pointer; }
.toggle input { accent-color: var(--accent); }
.count { color: var(--muted); font-size: 13.5px; font-variant-numeric: tabular-nums; }

/* Grid */
.grid {
  list-style: none; margin: 0; padding: 0;
  display: grid; gap: 22px;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr));
}
.card { content-visibility: auto; contain-intrinsic-size: auto 280px; }
.card button {
  all: unset; display: block; width: 100%; cursor: pointer; border-radius: var(--radius);
}
.card button:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }
.thumb {
  position: relative; aspect-ratio: 16 / 10; overflow: hidden;
  border-radius: var(--radius); background: var(--surface);
  border: 1px solid var(--line);
  transition: transform .35s var(--ease), border-color .35s var(--ease);
}
.card button:hover .thumb { transform: translateY(-3px); border-color: #3a3f47; }
.thumb img, .thumb video {
  width: 100%; height: 100%; object-fit: cover; object-position: top center; display: block;
  opacity: 0; transition: opacity .4s var(--ease);
}
.thumb .is-ready { opacity: 1; }
.thumb--none {
  display: grid; place-items: center; padding: 20px;
  background: radial-gradient(120% 100% at 0% 0%, #1b2a25 0%, var(--surface) 55%);
}
.thumb--none span { font-size: 22px; font-weight: 600; letter-spacing: -.02em; text-align: center; color: #c9ccd1; }
.badge {
  position: absolute; top: 10px; left: 10px;
  font-size: 11px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase;
  padding: 3px 8px; border-radius: 6px; background: rgb(0 0 0 / .6); color: #fff; backdrop-filter: blur(6px);
}
.meta { display: flex; justify-content: space-between; gap: 12px; padding: 12px 2px 0; }
.meta h3 { margin: 0; font-size: 15px; font-weight: 550; letter-spacing: -.01em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.meta span { color: var(--muted); font-size: 13px; white-space: nowrap; }

#sentinel { height: 1px; }
.empty { color: var(--muted); text-align: center; padding: 80px 0; }

.foot {
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px;
  padding: 48px 0 40px; margin-top: 48px; border-top: 1px solid var(--line);
  color: var(--muted); font-size: 13.5px;
}

/* Modal */
.modal {
  width: min(1100px, 100% - 32px); max-height: calc(100dvh - 48px);
  padding: 0; border: 1px solid var(--line); border-radius: 18px;
  background: var(--surface); color: var(--text); overflow: hidden;
}
.modal::backdrop { background: rgb(0 0 0 / .72); backdrop-filter: blur(4px); }
.modal[open] { animation: pop .28s var(--ease); }
@keyframes pop { from { opacity: 0; transform: translateY(10px) scale(.985); } }
.modal__media { background: #000; aspect-ratio: 16 / 9; max-height: calc(100dvh - 180px); overflow: auto; }
.modal__media img, .modal__media video { display: block; width: 100%; }
.modal__media .thumb--none { aspect-ratio: 16 / 9; height: 100%; display: grid; }
.modal__body { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px; padding: 18px 22px; }
.modal__cat { margin: 0; color: var(--muted); font-size: 13px; }
.modal h2 { margin: 2px 0 0; font-size: 22px; letter-spacing: -.02em; }
.modal__actions { display: flex; gap: 10px; }
.btn {
  height: 40px; padding: 0 16px; display: inline-flex; align-items: center;
  border-radius: 10px; border: 1px solid var(--line); background: var(--surface-2);
  color: var(--text); font: inherit; font-size: 14px; font-weight: 550; text-decoration: none; cursor: pointer;
}
.btn--primary { background: var(--accent); border-color: var(--accent); color: #04130d; }
.btn:hover { filter: brightness(1.08); }

@media (max-width: 640px) {
  .top__row { gap: 12px; }
  .brand span:last-child { display: none; }
  .search kbd { display: none; }
  .intro { padding-top: 36px; }
  .chips { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin-inline: -20px; padding-inline: 20px; }
  .chip { flex: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
