/* code-video-kit gallery. No framework, no external fonts. */
:root {
  --bg: #0a0b0e;
  --surface: #111318;
  --surface-2: #171a21;
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.16);
  --text: #eef0f4;
  --text-2: #a4aab6;
  --text-3: #6f7685;
  --accent: #8f84ff;
  --accent-soft: rgba(143, 132, 255, 0.14);
  --focus: #b3abff;

  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 14px;

  --s-1: 4px;
  --s-2: 8px;
  --s-3: 12px;
  --s-4: 16px;
  --s-5: 24px;
  --s-6: 32px;
  --s-7: 48px;
  --s-8: 64px;

  --sans: Inter, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: "JetBrains Mono", "SF Mono", "Fira Code", Menlo, Consolas, monospace;
  color-scheme: dark;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.55 var(--sans);
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
}

:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
  border-radius: var(--r-sm);
}

.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

.skip-link {
  position: absolute;
  left: var(--s-4);
  top: -48px;
  padding: var(--s-2) var(--s-3);
  background: var(--text);
  color: var(--bg);
  border-radius: var(--r-sm);
  z-index: 10;
}
.skip-link:focus {
  top: var(--s-3);
}

.wrap {
  width: min(1200px, 100% - 2 * var(--s-5));
  margin-inline: auto;
}

/* Header */
.site-header {
  border-bottom: 1px solid var(--border);
}
.header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 56px;
}
.wordmark {
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  font-weight: 650;
  letter-spacing: -0.01em;
  text-decoration: none;
}
.wordmark svg {
  color: var(--accent);
}
.header-links {
  display: flex;
  gap: var(--s-5);
}
.header-links a {
  color: var(--text-2);
  text-decoration: none;
  font-size: 14px;
}
.header-links a:hover {
  color: var(--text);
}

/* Hero */
.hero {
  padding: var(--s-8) 0 var(--s-7);
  max-width: 820px;
  margin-left: max(var(--s-5), (100% - 1200px) / 2);
}
.eyebrow {
  margin: 0 0 var(--s-3);
  color: var(--text-3);
  font: 500 13px/1 var(--mono);
  letter-spacing: 0.02em;
}
h1 {
  margin: 0;
  font-size: clamp(32px, 5vw, 52px);
  line-height: 1.06;
  letter-spacing: -0.03em;
  font-weight: 700;
}
.lead {
  margin: var(--s-4) 0 var(--s-5);
  max-width: 640px;
  color: var(--text-2);
  font-size: 17px;
}
.install {
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  max-width: 100%;
  padding: var(--s-1) var(--s-1) var(--s-1) var(--s-4);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-md);
  background: var(--surface);
}
.install code {
  font: 14px/1.4 var(--mono);
  overflow-x: auto;
  white-space: nowrap;
}
.install code::before {
  content: "$ ";
  color: var(--text-3);
}
.stats {
  margin: var(--s-4) 0 0;
  color: var(--text-3);
  font-size: 13px;
  min-height: 1.5em;
}

/* Buttons */
.btn-copy {
  flex-shrink: 0;
  appearance: none;
  border: 1px solid var(--border-strong);
  background: var(--surface-2);
  color: var(--text);
  font: 500 13px/1 var(--sans);
  padding: var(--s-2) var(--s-3);
  border-radius: var(--r-sm);
  cursor: pointer;
}
.btn-copy:hover {
  border-color: var(--text-3);
}
.btn-copy[data-state="copied"] {
  color: #7ee2a8;
  border-color: rgba(126, 226, 168, 0.4);
}

/* Toolbar */
.toolbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-3);
  padding: var(--s-3) 0;
  margin-bottom: var(--s-4);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-2);
}
.chip {
  appearance: none;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-2);
  font: 500 13px/1 var(--sans);
  padding: var(--s-2) var(--s-3);
  border-radius: 999px;
  cursor: pointer;
}
.chip:hover {
  color: var(--text);
  border-color: var(--border-strong);
}
.chip[aria-pressed="true"] {
  color: var(--text);
  background: var(--accent-soft);
  border-color: var(--accent);
}
.chip .count {
  margin-left: 6px;
  color: var(--text-3);
  font-variant-numeric: tabular-nums;
}
.search {
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  padding: 0 var(--s-3);
  height: 34px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  color: var(--text-3);
  background: var(--surface);
}
.search:focus-within {
  border-color: var(--focus);
}
.search input {
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  font: 14px var(--sans);
  width: 200px;
}

/* Grid + cards */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: var(--s-4);
  padding-bottom: var(--s-8);
}
.grid:focus {
  outline: none;
}
.card {
  display: flex;
  flex-direction: column;
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  background: var(--surface);
  overflow: hidden;
  transition: border-color 160ms ease;
}
.card:hover,
.card:focus-within {
  border-color: var(--border-strong);
}
.media {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  padding: 0;
  border: 0;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
  cursor: pointer;
  overflow: hidden;
  border-radius: 0;
}
.media:focus-visible {
  outline-offset: -3px;
  border-radius: var(--r-lg) var(--r-lg) 0 0;
}
.media img,
.media video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.media video {
  opacity: 0;
  transition: opacity 160ms ease;
}
.media[data-playing="true"] video {
  opacity: 1;
}
.media .placeholder {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: var(--text-3);
  font: 13px var(--mono);
}
.play {
  position: absolute;
  z-index: 1;
  right: var(--s-3);
  bottom: var(--s-3);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px var(--s-2);
  border-radius: var(--r-sm);
  background: rgba(10, 11, 14, 0.72);
  color: var(--text);
  font: 500 12px/1 var(--sans);
  backdrop-filter: blur(6px);
}
.play svg {
  width: 10px;
  height: 10px;
}
.body {
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
  padding: var(--s-4);
  flex: 1;
}
.title-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--s-3);
}
.card h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.tag {
  flex-shrink: 0;
  color: var(--text-3);
  font: 12px var(--mono);
}
.desc {
  margin: 0;
  color: var(--text-2);
  font-size: 14px;
}
.meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-3);
  margin: 0;
  color: var(--text-3);
  font: 12px var(--mono);
  font-variant-numeric: tabular-nums;
}
details.usage {
  margin-top: auto;
  border-top: 1px solid var(--border);
  padding-top: var(--s-3);
}
details.usage summary {
  cursor: pointer;
  color: var(--text-2);
  font-size: 13px;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 6px;
  width: fit-content;
}
details.usage summary::-webkit-details-marker {
  display: none;
}
details.usage summary::before {
  content: "";
  width: 6px;
  height: 6px;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: rotate(-45deg);
  transition: transform 160ms ease;
}
details.usage[open] summary::before {
  transform: rotate(45deg);
}
.snippet {
  position: relative;
  margin-top: var(--s-3);
}
.snippet pre {
  margin: 0;
  padding: var(--s-3);
  padding-right: 72px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  overflow-x: auto;
  font: 12px/1.6 var(--mono);
  color: var(--text-2);
}
.snippet .btn-copy {
  position: absolute;
  top: var(--s-2);
  right: var(--s-2);
}

/* States */
.skeleton {
  aspect-ratio: 16 / 13;
  background: linear-gradient(100deg, var(--surface) 30%, var(--surface-2) 50%, var(--surface) 70%);
  background-size: 300% 100%;
  animation: shimmer 1.4s linear infinite;
}
@keyframes shimmer {
  from {
    background-position: 100% 0;
  }
  to {
    background-position: 0 0;
  }
}
.state {
  padding: var(--s-7) var(--s-5);
  margin-bottom: var(--s-8);
  border: 1px dashed var(--border-strong);
  border-radius: var(--r-lg);
  text-align: center;
  color: var(--text-2);
}
.state strong {
  display: block;
  margin-bottom: var(--s-1);
  color: var(--text);
}
.state code {
  font-family: var(--mono);
  font-size: 13px;
}

/* Footer */
.site-footer {
  border-top: 1px solid var(--border);
  color: var(--text-3);
  font-size: 13px;
}
.footer-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: var(--s-3);
  padding: var(--s-5) 0;
}

@media (max-width: 560px) {
  .grid {
    grid-template-columns: 1fr;
  }
  .search,
  .search input {
    width: 100%;
  }
  .search {
    flex: 1 1 100%;
  }
  .hero {
    padding: var(--s-7) 0 var(--s-6);
  }
}

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

@media (forced-colors: active) {
  .chip[aria-pressed="true"] {
    border: 2px solid CanvasText;
  }
}
