@font-face {
  font-family: "Geist";
  src: url("fonts/Geist-Variable.woff2") format("woff2-variations"),
       url("fonts/Geist-Variable.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg: #0a0a0a;
  --surface: #191919;
  --surface-hover: #232323;
  --border: #343434;
  --text: #f5f5f5;
  --text-muted: #9a9a9a;
  --accent: #f5f5f5;
  --radius: 14px;
  --max-width: 1280px;
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: "Geist", "Geist Fallback", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
}

.site-header {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 64px 32px 24px;
  text-align: center;
}

.site-header h1 {
  margin: 0 0 12px;
  line-height: 0;
}

.header-logo {
  width: clamp(220px, 32vw, 420px);
  height: auto;
}

.subtitle {
  color: var(--text-muted);
  font-size: 1.05rem;
  margin: 0;
}

.filters {
  max-width: var(--max-width);
  margin: 32px auto 8px;
  padding: 0 32px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  position: sticky;
  top: 0;
  z-index: 10;
  background: linear-gradient(var(--bg) calc(100% - 20px), transparent);
  padding-top: 16px;
  padding-bottom: 28px;
}

.filter-btn {
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-muted);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 9px 18px;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
  white-space: nowrap;
}

.filter-btn:hover {
  background: var(--surface-hover);
  color: var(--text);
}

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

main {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 24px 32px 96px;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 20px;
}

@keyframes card-enter {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  transition: transform 0.18s ease, background 0.18s ease, border-color 0.18s ease,
    box-shadow 0.18s ease;
  animation: card-enter 0.45s cubic-bezier(0.2, 0.6, 0.3, 1) both;
  animation-delay: var(--card-delay, 0ms);
}

@media (prefers-reduced-motion: reduce) {
  .card {
    animation: none;
  }
}

.card:hover,
.card:focus-visible {
  background: var(--surface-hover);
  border-color: rgb(var(--accent-rgb) / 55%);
  transform: translateY(-3px);
  box-shadow: 0 0 16px 2px rgb(var(--accent-rgb) / 22%), 0 0 36px 6px rgb(var(--accent-rgb) / 12%);
}

.card img {
  width: 100%;
  aspect-ratio: 2 / 1;
  object-fit: contain;
  border-radius: 6px;
}

.card-title {
  font-size: 0.85rem;
  font-weight: 500;
  text-align: center;
  color: var(--text);
  line-height: 1.35;
}

.empty-state {
  grid-column: 1 / -1;
  text-align: center;
  color: var(--text-muted);
  padding: 64px 0;
}

/* Modal */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.88);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 100;
}

.modal.open {
  display: flex;
}

.modal-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  max-width: min(90vw, 1600px);
  max-height: 85vh;
  padding: 0 24px;
}

.modal-content img {
  max-width: 100%;
  max-height: 90vh;
  object-fit: contain;
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.modal-title {
  font-size: 1.1rem;
  font-weight: 500;
  color: var(--text);
  margin: 0;
  text-align: center;
  transition: opacity 0.2s ease;
}

.modal-link {
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--bg);
  background: var(--text);
  border-radius: 999px;
  padding: 10px 20px;
  text-decoration: none;
  margin-top: -6px;
  transition: opacity 0.2s ease;
}

.modal-link:hover {
  opacity: 0.85;
}

.modal-link[hidden] {
  display: none;
}

.modal.flying #modalImage {
  visibility: hidden;
}

.flying-plate {
  position: fixed;
  z-index: 200;
  object-fit: contain;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  pointer-events: none;
  will-change: transform, left, top, width, height;
}

.modal-close,
.modal-nav {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  width: 52px;
  height: 52px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease;
}

.modal-close {
  position: absolute;
  top: 20px;
  right: 24px;
}

.modal-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
}

.modal-close .icon,
.modal-nav .icon {
  width: 26px;
  height: 26px;
}

.modal-close:hover,
.modal-nav:hover {
  background: var(--surface-hover);
}

.modal-nav:disabled {
  opacity: 0.3;
  cursor: default;
}

.modal-prev {
  left: 24px;
}

.modal-next {
  right: 24px;
}

@media (max-width: 640px) {
  .modal-close,
  .modal-nav {
    width: 42px;
    height: 42px;
  }
  .modal-close .icon,
  .modal-nav .icon {
    width: 20px;
    height: 20px;
  }
  .modal-prev { left: 8px; }
  .modal-next { right: 8px; }
  .modal-close { top: 10px; right: 12px; }
}
