:root {
  --bg: #ffffff;
  --surface: #ffffff;
  --text: #111111;
  --muted: #666666;
  --line: #e7e7e7;
  --stroke: 1.25px;
  --radius: 20px;
  --chip: #efefef;
  --chip-active: #111111;
  --chip-active-text: #ffffff;
  --control-bg: #fafafa;
  --control-bg-hover: #f0f0f0;
  --control-border-hover: #d8d8d8;
  --control-focus-ring: rgb(17 17 17 / 14%);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Inter", system-ui, -apple-system, sans-serif;
}

.topbar {
  position: static;
  z-index: auto;
  background: var(--bg);
  border-bottom: 0;
  padding: 16px 24px 10px;
}

.topbar-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.brand-icon {
  font-size: 1.15rem;
  color: #3a3a3a;
}

.about-btn:hover {
  cursor: pointer;
}

.topbar-row h1 {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
}

.hero {
  margin: 42px auto 8px;
  max-width: 840px;
  text-align: center;
}

.hero h2 {
  margin: 0 auto;
  max-width: 760px;
  font-size: clamp(1.45rem, 2.6vw, 2.35rem);
  line-height: 1.12;
  letter-spacing: -0.02em;
}

.chips {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  flex: 1 1 auto;
  padding-top: 6px;
  padding-bottom: 6px;
}

.tags-strip {
  padding: 8px 0 10px;
  background: var(--bg);
  position: sticky;
  top: 0;
  z-index: 24;
  backdrop-filter: blur(8px);
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: var(--stroke) solid var(--line);
  border-radius: var(--radius);
  background: var(--chip);
  color: #333;
  font-size: 0.88rem;
  font-weight: 500;
  padding: 8px 14px;
  cursor: pointer;
  transition: background-color 160ms ease, border-color 160ms ease, color 160ms ease, transform 160ms ease;
}

.chip:hover {
  background: #e7e7e7;
  border-color: #d9d9d9;
  transform: translateY(-1px);
}

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

.chip-easter {
  background: linear-gradient(135deg, #fff3c4 0%, #ffe1ef 52%, #e9dcff 100%);
  border-color: #dfb8f5;
  color: #7a3261;
  box-shadow: 0 2px 8px rgb(201 147 242 / 28%);
  background-size: 180% 180%;
  animation: easter-gradient 4.2s ease-in-out infinite;
}

.chip-easter.active {
  background: linear-gradient(135deg, #f7d05a 0%, #f5a8d0 50%, #c8a8ff 100%);
  border-color: #c993f2;
  color: #4f2246;
  box-shadow: 0 5px 14px rgb(201 147 242 / 36%);
}

.chip-easter:hover {
  background: linear-gradient(135deg, #ffeeb0 0%, #ffd6ea 52%, #decfff 100%);
  border-color: #c993f2;
  color: #6f2e5b;
  box-shadow: 0 4px 12px rgb(201 147 242 / 38%);
}

.chip-easter.active:hover {
  background: linear-gradient(135deg, #f3c648 0%, #ef92c6 50%, #b897ff 100%);
  border-color: #b67ee6;
  color: #4f2246;
}

@keyframes easter-gradient {
  0% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
  100% {
    background-position: 0% 50%;
  }
}

.easter-emoji-burst {
  position: fixed;
  left: 0;
  top: 0;
  pointer-events: none;
  z-index: 1200;
  font-size: 1.2rem;
  line-height: 1;
  filter: drop-shadow(0 1px 2px rgb(0 0 0 / 18%));
}

.search-wrap {
  display: block;
  position: relative;
  margin: 42px auto 0;
  width: 100%;
  max-width: 350px;
}

.search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: #8a8a8a;
  font-size: 1.05rem;
  pointer-events: none;
}

#tagSearch {
  width: 100%;
  border: var(--stroke) solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 14px 18px 14px 40px;
  font-size: 16px;
  outline: none;
  transition: border-color 160ms ease, box-shadow 160ms ease, background-color 160ms ease;
}

#tagSearch:hover {
  border-color: #b8b8b8;
  background: #fff;
}

#tagSearch:focus {
  border-color: #8e8e8e;
  box-shadow: 0 0 0 2px rgb(0 0 0 / 10%);
}

.search-wrap:hover .search-icon,
.search-wrap:focus-within .search-icon {
  color: #4f4f4f;
}

main {
  padding: 16px 24px 30px;
}

.results-meta {
  display: none;
}

.ghost-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: var(--stroke) solid var(--line);
  background: var(--control-bg);
  border-radius: var(--radius);
  padding: 7px 12px;
  color: #222;
  cursor: pointer;
  transition: background-color 160ms ease, border-color 160ms ease, transform 160ms ease, box-shadow 160ms ease;
}

.grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 24px;
}

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

@media (max-width: 640px) {
  .topbar {
    position: static;
    padding-left: 16px;
    padding-right: 16px;
    padding-top: 14px;
    padding-bottom: 6px;
  }

  main {
    padding: 14px 16px 26px;
  }

  .hero {
    margin-top: 20px;
    margin-bottom: 0;
  }

  .hero h2 {
    text-align: center;
    font-size: clamp(1.5rem, 7.4vw, 2rem);
  }

  .tags-strip {
    padding-left: 0;
    padding-right: 0;
    top: 0;
    padding-top: 8px;
    padding-bottom: 8px;
  }

  .chips {
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: visible;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding-top: 8px;
    padding-bottom: 10px;
  }

  .chips::-webkit-scrollbar {
    display: none;
  }

  .chip {
    flex: 0 0 auto;
    white-space: nowrap;
  }

  .search-wrap {
    width: 100%;
    max-width: 100%;
    margin-top: 18px;
    margin-left: 0;
    margin-right: 0;
  }

  .grid {
    grid-template-columns: 1fr;
  }
}

.card {
  border: var(--stroke) solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  overflow: hidden;
  transition: border-color 180ms ease, box-shadow 180ms ease;
}

.card:hover,
.card:focus-within {
  border-color: #d7d7d7;
  box-shadow: 0 3px 12px rgb(0 0 0 / 4%);
}

.image-btn {
  border: 0;
  padding: 0;
  width: 100%;
  aspect-ratio: 5 / 4;
  background: #f6f6f6;
  cursor: zoom-in;
  overflow: hidden;
}

.card-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 240ms ease;
}

.card:hover .card-image,
.card:focus-within .card-image {
  transform: scale(1.03);
}

.card-meta {
  padding: 16px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
}

.card-text {
  flex: 1 1 auto;
  min-width: 0;
}

.card-title {
  margin: 0;
  font-size: 0.92rem;
  font-weight: 600;
}

.card-tags {
  margin: 6px 0 0;
  font-size: 0.78rem;
  color: var(--muted);
}

.download-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
  border: var(--stroke) solid var(--line);
  color: #222;
  background: var(--control-bg);
  border-radius: var(--radius);
  font-size: 0.82rem;
  padding: 7px 12px;
  transition: background-color 160ms ease, border-color 160ms ease, transform 160ms ease, box-shadow 160ms ease;
}

.ghost-btn:hover,
.download-btn:hover,
.close-btn:hover {
  background: #f0f0f0;
  border-color: var(--control-border-hover);
  transform: translateY(-1px);
}

.ghost-btn:focus-visible,
.download-btn:focus-visible,
.close-btn:focus-visible {
  outline: none;
  border-color: var(--control-border-hover);
  box-shadow: 0 0 0 3px var(--control-focus-ring);
}

.close-btn:focus-visible {
  box-shadow: none;
}

.chip i,
.download-btn i,
.close-btn i {
  font-size: 0.95rem;
  line-height: 1;
}

.download-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.card-download-actions {
  margin: 0;
  flex: 0 0 auto;
  justify-content: flex-end;
}

.lightbox {
  border: 0;
  border-radius: var(--radius);
  width: min(920px, calc(100vw - 20px));
  max-height: calc(100vh - 20px);
  background: var(--surface);
  padding: 14px;
  overflow: auto;
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 220ms ease, transform 220ms ease;
}

.about-lightbox {
  width: min(700px, calc(100vw - 20px));
  padding: 40px;
}

.about-content h2 {
  margin: 0 0 10px;
  font-size: 1.25rem;
}

.about-content p {
  margin: 0 0 10px;
  color: #3f3f3f;
  line-height: 1.5;
}

.about-content p:last-child {
  margin-bottom: 0;
}

.lightbox::backdrop {
  background: rgb(0 0 0 / 45%);
}

.lightbox.is-open {
  opacity: 1;
  transform: translateY(0);
}

.lightbox.is-closing {
  opacity: 0;
  transform: translateY(20px);
}

#lightboxImage {
  width: 100%;
  max-width: 100%;
  max-height: none;
  height: auto;
  object-fit: contain;
  background: transparent;
  border-radius: var(--radius);
  margin: 0 auto;
}

.lightbox-meta {
  margin-top: 10px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  column-gap: 12px;
  row-gap: 4px;
  align-items: end;
}

#lightboxTitle {
  margin: 0;
  font-size: 1rem;
  grid-column: 1;
  grid-row: 1;
}

#lightboxTags {
  margin: 0;
  color: var(--muted);
  font-size: 0.85rem;
  grid-column: 1;
  grid-row: 2;
}

.lightbox-meta .download-actions {
  grid-column: 2;
  grid-row: 1 / span 2;
  justify-self: end;
}

@media (max-width: 640px) {
  .lightbox-meta {
    grid-template-columns: 1fr;
    row-gap: 8px;
  }

  #lightboxTitle,
  #lightboxTags,
  .lightbox-meta .download-actions {
    grid-column: 1;
    grid-row: auto;
  }

  .lightbox-meta .download-actions {
    justify-self: start;
  }
}

.close-btn {
  position: absolute;
  right: 16px;
  top: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: var(--stroke) solid var(--line);
  border-radius: var(--radius);
  width: 34px;
  height: 34px;
  background: var(--control-bg);
  color: #222;
  cursor: pointer;
  transition: background-color 160ms ease, border-color 160ms ease, transform 160ms ease, box-shadow 160ms ease;
}
