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

:root {
  --bg:        #111110;
  --surface:   #1a1a18;
  --border:    #2a2a28;
  --text:      #e8e8e4;
  --muted:     #888884;
  --radius:    8px;

  --c-awwwards: #5b8dd9;
  --c-fwa:      #d97b5b;
  --c-codrops:  #7bc47b;
  --c-shadertoy:#b57bd9;
  --c-threejs:  #d9c45b;
}

html { font-size: 16px; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ── Header ── */
header {
  padding: 2rem 2rem 1.25rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

h1 {
  font-size: 1.25rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text);
}

/* ── Filter pills ── */
.pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.pill {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--muted);
  border-radius: 999px;
  padding: 0.3rem 0.85rem;
  font-size: 0.8rem;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
  white-space: nowrap;
}

.pill:hover { border-color: var(--text); color: var(--text); }

.pill.active {
  background: var(--text);
  border-color: var(--text);
  color: var(--bg);
}

.pill[data-source="awwwards"].active  { background: var(--c-awwwards);  border-color: var(--c-awwwards);  color: #fff; }
.pill[data-source="fwa"].active       { background: var(--c-fwa);       border-color: var(--c-fwa);       color: #fff; }
.pill[data-source="codrops"].active   { background: var(--c-codrops);   border-color: var(--c-codrops);   color: #111; }
.pill[data-source="threejs"].active   { background: var(--c-threejs);   border-color: var(--c-threejs);   color: #111; }

/* Dot inside filter pills */
.pill__dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
  /* Thin grey border so the dot remains visible when the pill is active
     and the pill background matches the dot colour */
  box-shadow: 0 0 0 1.5px var(--border);
}

/* Make pill a flex row to align dot + label */
.pill:not([data-source=""]) {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

/* ── Featured row (Awwwards + FWA) ── */
.featured {
  display: flex;
  justify-content: center;
  padding: 1.5rem 2rem;
  border-bottom: 1px solid var(--border);
}

.featured--hidden {
  display: none;
}

.featured__inner {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
  width: 50%;
}

@media (max-width: 1200px) {
  .featured__inner { width: 70%; }
}

@media (max-width: 900px) {
  .featured__inner { width: 100%; }
}

@media (max-width: 560px) {
  .featured { padding: 1rem; }
  .featured__inner { grid-template-columns: 1fr; width: 100%; }
}

/* ── Grid ── */
.grid {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 1.25rem;
  padding: 1.5rem 2rem;
  align-content: start;
}

@media (max-width: 1200px) {
  .grid { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 900px) {
  .grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 560px) {
  .grid { grid-template-columns: 1fr; padding: 1rem; }
  header { padding: 1.25rem 1rem 1rem; }
}

/* ── Card ── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  text-decoration: none;
  color: inherit;
  display: flex;
  flex-direction: column;
  transition: border-color 0.15s, transform 0.15s;
}

.card:hover {
  border-color: #444440;
  transform: translateY(-2px);
}

.card__thumb {
  aspect-ratio: 16 / 10;
  width: 100%;
  object-fit: cover;
  background: var(--border);
  display: block;
}

.card__thumb--placeholder {
  aspect-ratio: 16 / 10;
  background: var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  color: var(--muted);
}

.card__body {
  padding: 0.85rem 1rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  flex: 1;
}

.card__source {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.72rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.card__dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}

.dot--awwwards  { background: var(--c-awwwards); }
.dot--fwa       { background: var(--c-fwa); }
.dot--codrops   { background: var(--c-codrops); }
.dot--shadertoy { background: var(--c-shadertoy); }
.dot--threejs   { background: var(--c-threejs); }

.card__title {
  font-size: 0.92rem;
  font-weight: 600;
  line-height: 1.35;
  color: var(--text);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card__desc {
  font-size: 0.8rem;
  color: var(--muted);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ── Empty / loading states ── */
.state {
  grid-column: 1 / -1;
  text-align: center;
  color: var(--muted);
  padding: 4rem 0;
  font-size: 0.9rem;
}

/* ── Footer ── */
footer {
  padding: 1.25rem 2rem;
  border-top: 1px solid var(--border);
  font-size: 0.75rem;
  color: var(--muted);
  text-align: center;
}
