:root {
  --ink: #1f2937;
  --surface: #fff;
  --charcoal: #374151;
  --nav-hover: #e5e7eb;
  --border: #d1d5db;
  --focus-ring: #4b5563;
  --space-2: 0.5rem;
  --transition-fast: 0.2s ease;
  color: var(--ink);
  background: var(--surface);
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  min-width: 320px;
  margin: 0;
  line-height: 1.5;
}

a {
  color: inherit;
}

a:focus-visible,
input:focus-visible,
button:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 2px;
}

/* Navigation */
.site-nav {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 4rem;
  padding: var(--space-2) 1rem;
  background: rgb(255 255 255 / 0.8);
  backdrop-filter: blur(8px);
}

.site-nav__start,
.site-nav__end,
.site-nav__menu {
  display: flex;
  align-items: center;
}

.site-nav__brand {
  display: block;
  padding: 0.5rem 1rem;
  font-family: Georgia, serif;
  font-size: 1.25rem;
  font-weight: 700;
  text-decoration: none;
}

.site-nav__menu {
  margin: 0;
  padding: 0;
  list-style: none;
}

.site-nav__menu a,
.site-nav__author {
  display: block;
  padding: 0.5rem 1rem;
  text-decoration: none;
}

.site-nav__author {
  color: #fff;
  background: #000;
  font-size: 0.875rem;
  font-weight: 700;
  text-transform: lowercase;
}

.site-nav__brand:hover,
.site-nav__brand:focus,
.site-nav__menu a:hover,
.site-nav__menu a:focus,
.site-nav__author:hover,
.site-nav__author:focus {
  color: var(--ink);
  background: var(--nav-hover);
}

.site-nav__author:hover,
.site-nav__author:focus {
  color: #fff;
  background: var(--charcoal);
}

/* Page content */
.site-main {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  margin: 0 auto;
}

.home-title {
  margin: 3rem 0;
  font-family: Georgia, serif;
  font-size: 1.875rem;
  line-height: 2.25rem;
}

.home-title a {
  text-decoration: none;
}

.intro > p:not(.example-links) a,
.about-content a {
  text-decoration: underline;
  text-underline-offset: 2px;
}

.home-title a:hover,
.home-title a:focus,
.intro > p:not(.example-links) a:hover,
.intro > p:not(.example-links) a:focus,
.about-content a:hover,
.about-content a:focus {
  color: var(--charcoal);
}

.intro,
.about-content {
  padding: 0 1.25rem;
  text-align: center;
}

.intro {
  max-width: 64rem;
}

.about-content {
  max-width: 42rem;
  margin-top: 5rem;
}

.intro p,
.about-content p {
  margin: 0 0 1.25rem;
}

/* Example searches */
.example-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
}

.example-link {
  height: 1.75rem;
  margin: 0.375rem 0.25rem;
  padding: 0.25rem 0.75rem;
  border-radius: 0.5rem;
  color: #fff;
  font-size: 0.875rem;
  line-height: 1.25rem;
  text-decoration: none;
}

.example-link--pink {
  color: #000;
  background: #fbcfe8;
}

.example-link--pink:hover,
.example-link--pink:focus {
  background: #f9a8d4;
}

.example-link--charcoal {
  background: var(--charcoal);
}

.example-link--charcoal:hover,
.example-link--charcoal:focus {
  background: #6b7280;
}

.example-link--indigo {
  background: #4338ca;
}

.example-link--indigo:hover,
.example-link--indigo:focus {
  background: #6366f1;
}

.example-link--yellow {
  color: #000;
  background: #fef08a;
}

.example-link--yellow:hover,
.example-link--yellow:focus {
  background: #facc15;
}

/* Search form */
.search-form {
  display: flex;
  flex-direction: column;
  width: min(100% - 2rem, 14rem);
  margin-top: 3rem;
}

.search-box {
  display: flex;
  width: 100%;
}

.search-box__input {
  flex: 1;
  min-width: 0;
  padding: 0.5rem 0.75rem;
  border: 1px solid #9ca3af;
  border-right: 0;
  border-radius: 0.125rem 0 0 0.125rem;
  font: inherit;
  font-size: 0.875rem;
}

.search-box__submit {
  width: 2.5rem;
  border: 0;
  border-radius: 0 0.375rem 0.375rem 0;
  color: #fff;
  background: #000;
  cursor: pointer;
}

.search-box__submit:hover,
.search-box__submit:focus {
  background: var(--charcoal);
}

.search-box__icon {
  width: 1rem;
  height: 1rem;
  vertical-align: middle;
}

.department-options {
  margin-top: 0.75rem;
}

.department-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.35rem 0;
  cursor: pointer;
  font-size: 1rem;
}

.department-option input {
  width: 1.25rem;
  height: 1.25rem;
  accent-color: #000;
  cursor: pointer;
}

/* Product grid */
.product-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  width: calc(100% - 1rem);
  gap: 0.5rem;
  margin: 5rem 0.5rem 0.5rem;
}

.product-card {
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}

.product-card:focus-within {
  position: relative;
  z-index: 1;
  transform: scale(1.03);
  box-shadow: 0 0.5rem 1rem rgb(31 41 55 / 0.16);
}

.product-card:has(a:focus-visible) {
  outline: 2px solid var(--focus-ring);
  outline-offset: 2px;
}

.product-card a:focus-visible {
  outline: 0;
}

@media (hover: hover) {
  .product-card:hover {
    position: relative;
    z-index: 1;
    transform: scale(1.03);
    box-shadow: 0 0.5rem 1rem rgb(31 41 55 / 0.16);
  }
}

.product-card a {
  display: block;
  text-decoration: none;
}

.product-card figure {
  margin: 0;
}

.product-card img {
  display: block;
  width: 100%;
  height: auto;
}

.product-card__body {
  padding: 0.75rem 1rem;
}

.product-card__title,
.product-card__creator {
  overflow: hidden;
  margin: 0;
  font-size: 0.75rem;
  line-height: 1rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.product-card__title {
  font-weight: 700;
}

.product-card__creator {
  margin-top: -0.25rem;
}

/* Responsive grid */
@media (min-width: 640px) {
  .product-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (min-width: 768px) {
  .product-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (min-width: 1024px) {
  .product-grid {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }
}

@media (min-width: 1280px) {
  .product-grid {
    grid-template-columns: repeat(6, minmax(0, 1fr));
  }
}

@media (min-width: 1536px) {
  .product-grid {
    grid-template-columns: repeat(7, minmax(0, 1fr));
  }
}

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

  .product-card:hover,
  .product-card:focus-within {
    transform: none;
  }
}
