* { box-sizing: border-box; }

:root {
  color-scheme: dark;
  --black: #000;
  --white: #f6f6f6;
  --line: #777;
  --gap: 16px;
}

html, body { margin: 0; min-height: 100%; background: var(--black); }
body {
  color: var(--white);
  font-family: Arial, Helvetica, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.topbar {
  padding: 48px 24px 0;
}
.topnav {
  width: min(800px, 100%);
  margin: 0 auto 86px;
  display: grid;
  grid-template-columns: 1fr 300px 1fr;
  align-items: center;
  gap: 24px;
}
.brand {
  min-width: 0;
  min-height: 64px;
  display: flex;
  justify-content: center;
  align-items: center;
  color: var(--white);
  text-decoration: none;
}
.brand img {
  display: block;
  width: 100%;
  max-width: 400px;
  max-height: 120px;
  object-fit: contain;
}
.logo-fallback {
  font-size: 24px;
  font-weight: 800;
  letter-spacing: .06em;
  text-align: center;
  white-space: nowrap;
}
.category-button {
  width: 100%;
  min-height: 48px;
  padding: 16px 20px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: #050505;
  color: var(--white);
  font-size: 16px;
  font-weight: 700;
  letter-spacing: .13em;
  text-transform: uppercase;
  white-space: nowrap;
  cursor: pointer;
  transition: border-color .2s ease, background .2s ease, transform .2s ease;
}
.category-button:hover { border-color: #fff; transform: translateY(-1px); }
.category-button.active { border-color: #eee; box-shadow: inset 0 0 0 1px #eee; }

main { width: 100%; padding: 0 3% 56px; }
.gallery {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: var(--gap);
}
.gallery-item {
  position: relative;
  display: block;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  background: #101010;
  border: 1px solid #292929;
  text-decoration: none;
  transform: translateZ(0);
}
.gallery-item img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  transition: transform .35s ease, filter .35s ease;
}
.gallery-item:hover img, .gallery-item:focus-visible img {
  transform: scale(1.055);
  filter: brightness(1.08);
}
.gallery-item:focus-visible { outline: 2px solid #fff; outline-offset: 3px; }
.empty-state { padding: 40px 16px; color: #aaa; text-align: center; }
footer {
  padding: 24px 16px 28px;
  text-align: center;
  color: #686868;
  font-size: 11px;
  letter-spacing: .12em;
  text-transform: uppercase;
}

@media (max-width: 1050px) {
  .gallery { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .topnav { margin-bottom: 60px; }
}
@media (max-width: 760px) {
  .topbar { padding: 28px 16px 0; }
  .topnav {
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 34px;
  }
  .brand { grid-column: 1 / -1; grid-row: 1; margin-bottom: 6px; }
  .brand img { max-width: 250px; max-height: 120px; }
  .category-button { grid-row: 2; min-height: 44px; padding: 10px 8px; font-size: 10px; letter-spacing: .08em; }
  .gallery { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 9px; }
  main { padding: 0 14px 40px; }
}
@media (max-width: 480px) {
  .gallery { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; }
}
