:root {
  --black: #0a0a0a;
  --white: #ffffff;
  --grey-100: #f4f4f4;
  --grey-200: #e6e6e6;
  --grey-400: #b0b0b0;
  --grey-600: #6f6f6f;
  --grey-800: #1c1c1c;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.12);
  --radius: 14px;
}

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

html {
  scroll-behavior: smooth;
}

body {
  font-family: "Poppins", system-ui, sans-serif;
  background: var(--white);
  color: var(--black);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* ---------------- Header ---------------- */
.site-header {
  background: var(--black);
  color: var(--white);
  padding: 32px 12px 28px;
  text-align: center;
  border-bottom: 4px solid var(--black);
}

.header-inner {
  max-width: 1200px;
  margin: 0 auto;
}

.logo {
  font-weight: 800;
  font-size: clamp(2.2rem, 6vw, 4rem);
  letter-spacing: 0.18em;
  line-height: 1;
}

.logo span {
  font-weight: 300;
  color: var(--grey-400);
}

.tagline {
  margin-top: 16px;
  font-weight: 300;
  font-size: clamp(0.9rem, 2vw, 1.05rem);
  color: var(--grey-200);
  letter-spacing: 0.04em;
}

/* ---------------- Controls ---------------- */
main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 40px 24px 80px;
}

.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  align-items: flex-end;
  justify-content: center;
  padding: 24px;
  border: 2px solid var(--black);
  border-radius: var(--radius);
  margin-bottom: 28px;
}

.control-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.search-group {
  flex: 1 1 260px;
}

.control-label {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--grey-600);
}

.search-input,
.select {
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 400;
  color: var(--black);
  background: var(--white);
  border: 2px solid var(--black);
  border-radius: 999px;
  padding: 12px 18px;
  outline: none;
  transition: box-shadow 0.2s ease, transform 0.1s ease;
}

.search-input {
  width: 100%;
}

.select {
  cursor: pointer;
  min-width: 170px;
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--black) 50%),
    linear-gradient(135deg, var(--black) 50%, transparent 50%);
  background-position: calc(100% - 20px) center, calc(100% - 14px) center;
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
  padding-right: 40px;
}

.search-input:focus,
.select:focus {
  box-shadow: 0 0 0 4px var(--grey-200);
}

.result-count {
  font-size: 0.82rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  color: var(--grey-600);
  margin-bottom: 20px;
  text-align: center;
}

/* ---------------- Grid ---------------- */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 28px;
}

.card {
  border: 2px solid var(--black);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--white);
  display: flex;
  flex-direction: column;
  transition: transform 0.22s ease, box-shadow 0.22s ease;
}

.card:hover {
  transform: translateY(-6px);
  box-shadow: var(--shadow);
}

.card-media {
  position: relative;
  aspect-ratio: 1 / 1;
  background: var(--grey-100);
  overflow: hidden;
  cursor: pointer;
}

.card-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.35s ease;
}

.card:hover .card-media img {
  transform: scale(1.04);
}

.badge {
  position: absolute;
  top: 12px;
  left: 12px;
  background: var(--black);
  color: var(--white);
  font-size: 0.66rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  padding: 5px 12px;
  border-radius: 999px;
}

.count-pill {
  position: absolute;
  bottom: 12px;
  right: 12px;
  background: var(--white);
  color: var(--black);
  border: 1.5px solid var(--black);
  font-size: 0.68rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  gap: 5px;
}

.card-body {
  padding: 18px 20px 22px;
  border-top: 2px solid var(--black);
  text-align: center;
}

.card-name {
  font-weight: 600;
  font-size: 1.08rem;
  letter-spacing: 0.01em;
}

.card-year {
  margin-top: 4px;
  font-weight: 300;
  font-size: 0.9rem;
  color: var(--grey-600);
  letter-spacing: 0.06em;
}

.card-desc {
  margin-top: 6px;
  display: inline-block;
  font-weight: 500;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--black);
  background: var(--grey-100);
  border: 1px solid var(--grey-200);
  padding: 3px 10px;
  border-radius: 999px;
}

/* ---------------- Thumbnails ---------------- */
.thumbs {
  display: flex;
  gap: 6px;
  padding: 12px 14px 0;
  flex-wrap: wrap;
  justify-content: center;
}

.thumb {
  width: 38px;
  height: 38px;
  border-radius: 8px;
  border: 1.5px solid var(--grey-200);
  object-fit: cover;
  cursor: pointer;
  filter: grayscale(100%);
  transition: filter 0.2s ease, border-color 0.2s ease;
}

.thumb:hover,
.thumb.active {
  filter: grayscale(0%);
  border-color: var(--black);
}

/* ---------------- Empty / Footer ---------------- */
.empty-state {
  text-align: center;
  font-weight: 300;
  color: var(--grey-600);
  padding: 60px 0;
}

.site-footer {
  background: var(--black);
  color: var(--grey-400);
  text-align: center;
  padding: 14px 12px;
  font-size: 0.82rem;
  font-weight: 300;
  letter-spacing: 0.08em;
}

.site-footer a {
  color: var(--white);
  font-weight: 500;
  text-decoration: none;
  border-bottom: 1px solid var(--grey-600);
  transition: border-color 0.2s ease, color 0.2s ease;
}

.site-footer a:hover {
  border-color: var(--white);
}

.footer-powered {
  margin-top: 6px;
  font-size: 0.76rem;
  color: var(--grey-600);
}

/* ---------------- Lightbox ---------------- */
.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.92);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  z-index: 100;
  padding: 24px;
}

.lightbox[hidden] {
  display: none;
}

.lightbox-figure {
  max-width: 80vw;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}

.lightbox-figure img {
  max-width: 80vw;
  max-height: 75vh;
  object-fit: contain;
  border-radius: 8px;
  background: var(--white);
}

.lightbox-figure figcaption {
  color: var(--white);
  font-weight: 400;
  letter-spacing: 0.05em;
  text-align: center;
}

.lightbox-close,
.lightbox-nav {
  background: transparent;
  border: 2px solid var(--white);
  color: var(--white);
  cursor: pointer;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s ease, color 0.2s ease;
}

.lightbox-close {
  position: absolute;
  top: 24px;
  right: 24px;
  width: 46px;
  height: 46px;
  font-size: 1.6rem;
  line-height: 1;
}

.lightbox-nav {
  width: 54px;
  height: 54px;
  font-size: 2rem;
  line-height: 1;
  flex-shrink: 0;
}

.lightbox-close:hover,
.lightbox-nav:hover {
  background: var(--white);
  color: var(--black);
}

@media (max-width: 600px) {
  main {
    padding: 28px 14px 64px;
  }
  .site-header {
    padding: 44px 18px 38px;
  }
  .controls {
    flex-direction: column;
    align-items: stretch;
    padding: 18px;
    gap: 14px;
  }
  .control-group {
    width: 100%;
  }
  .search-group {
    flex: 0 0 auto;
  }
  .select {
    width: 100%;
  }

  /* Two jerseys side by side on mobile. */
  .grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 14px;
  }
  .card-body {
    padding: 12px 10px 14px;
  }
  .card-name {
    font-size: 0.85rem;
  }
  .card-year {
    font-size: 0.75rem;
  }
  .card-desc {
    font-size: 0.6rem;
    padding: 2px 8px;
    letter-spacing: 0.04em;
  }
  .badge {
    font-size: 0.56rem;
    padding: 4px 8px;
    top: 8px;
    left: 8px;
  }

  .lightbox-nav {
    width: 44px;
    height: 44px;
    font-size: 1.5rem;
  }
  .lightbox-figure img {
    max-width: 90vw;
  }
}

/* ---------------- Back to top ---------------- */
.back-to-top {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  border: 2px solid var(--white);
  background: var(--black);
  color: var(--white);
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
  z-index: 90;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(12px);
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease, background 0.2s ease,
    color 0.2s ease;
}

.back-to-top.show {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.back-to-top:hover {
  background: var(--white);
  color: var(--black);
  border-color: var(--black);
}

@media (max-width: 600px) {
  .back-to-top {
    width: 44px;
    height: 44px;
    font-size: 1.2rem;
    bottom: 16px;
    right: 16px;
  }
}
