*,
*::before,
*::after {
  box-sizing: border-box;
}

:root {
  font-size: 16px;
  --color-text: #050505;
  --color-text-alt: #6d6d6d;
  --color-faded: #c8c8c8;
  --color-bg: #ffffff;
  --color-card: #ffffff;
  --color-placeholder: #f5f5f5;
  --border-color: #d4d4d4;
  --color-link-hover: #8b8b8b;
  --font-size-s: 0.85rem;
  --font-size-l: clamp(1.15rem, 3vw, 1.75rem);
  --font-size-xl: clamp(2rem, 6vw, 4.6rem);
  --page-padding: clamp(1rem, 2vw, 2rem);
  --max-width: 1600px;
}

html {
  min-height: 100%;
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  margin: 0;
  padding: 0 var(--page-padding);
  color: var(--color-text);
  background: var(--color-bg);
  font-family: "Instrument Sans", Arial, Helvetica, sans-serif;
  font-variant-ligatures: none;
  -webkit-font-smoothing: antialiased;
  line-height: 1.2;
}

body.dialog-open {
  overflow: hidden;
}

a {
  color: inherit;
  text-decoration: none;
  transition: color 0.25s ease;
}

a:hover {
  color: var(--color-link-hover);
}

button,
input {
  font: inherit;
}

button {
  border: 0;
  padding: 0;
  color: inherit;
  background: none;
  cursor: pointer;
}

img {
  display: block;
  max-width: 100%;
}

hr {
  width: 100%;
  margin: 0;
  border: 0;
  border-top: 1px solid var(--border-color);
}

.skip-link {
  position: fixed;
  z-index: 200;
  top: 0.5rem;
  left: 0.5rem;
  transform: translateY(-150%);
  padding: 0.65rem 0.9rem;
  background: #000;
  color: #fff;
}

.skip-link:focus {
  transform: translateY(0);
}

.site-shell {
  width: min(100%, var(--max-width));
  margin-inline: auto;
}

.site-header {
  position: relative;
  z-index: 20;
}

.header-row {
  display: grid;
  grid-template-columns: min-content 1fr auto;
  align-items: center;
  gap: 1rem;
  min-height: 68px;
  font-weight: 700;
}

.brand {
  white-space: nowrap;
  font-size: 1rem;
}

.brand-subtitle {
  color: var(--color-text-alt);
  font-weight: 600;
}

.primary-nav {
  display: flex;
  justify-content: flex-end;
  gap: 1rem;
  list-style: none;
  margin: 0;
  padding: 0;
  font-weight: 700;
}

.primary-nav a[aria-current="page"] {
  color: var(--color-text-alt);
  pointer-events: none;
}

.mobile-menu-button {
  display: none;
  justify-self: end;
}

.mobile-nav {
  display: none;
  padding: 0.9rem 0;
  border-top: 1px solid var(--border-color);
}

.mobile-nav.is-open {
  display: grid;
  gap: 0.75rem;
}

.title-header {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 1rem;
  align-items: end;
  padding: clamp(2rem, 5vw, 5rem) 0 1.4rem;
  font-weight: 700;
}

.title-header h1,
.title-header h2 {
  margin: 0;
  font-size: var(--font-size-xl);
  line-height: 0.86;
  letter-spacing: -0.06em;
}

.title-header .title-meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 1rem;
  align-items: center;
}

.title-header .count {
  color: var(--color-text-alt);
}

.grid-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 0;
  font-weight: 700;
}

.grid-toolbar-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
}

.grid-toolbar button:hover,
.grid-toolbar a:hover {
  color: var(--color-link-hover);
}

.filter-wrap {
  position: relative;
  flex: 1;
  max-width: 420px;
}

.filter-input {
  width: 100%;
  border: 1px solid var(--border-color);
  border-radius: 999px;
  padding: 0.65rem 1rem;
  color: var(--color-text);
  background: var(--color-bg);
}

.filter-input:focus {
  outline: 2px solid #000;
  outline-offset: 2px;
}

.category-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1px;
  margin: 1rem 0 8rem;
  background: var(--border-color);
  border: 1px solid var(--border-color);
}

.category-card {
  position: relative;
  overflow: hidden;
  min-width: 0;
  background: var(--color-card);
}

.category-card-image {
  position: relative;
  aspect-ratio: 1;
  overflow: hidden;
  background: var(--color-placeholder);
}

.category-card-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: grayscale(100%);
  transition: transform 0.5s cubic-bezier(.2,.75,.2,1), filter 0.35s ease;
}

.category-card:hover .category-card-image img {
  transform: scale(1.035);
  filter: grayscale(0%);
}

.category-card-copy {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.6rem;
  padding: 0.8rem;
  min-height: 74px;
  align-content: start;
}

.category-card h2,
.category-card h3 {
  margin: 0;
  font-size: 1rem;
  line-height: 1.05;
}

.category-card p {
  margin: 0;
  color: var(--color-text-alt);
  font-size: var(--font-size-s);
}

.wallpaper-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.25rem;
  margin: 1.5rem 0 8rem;
}

.wallpaper-card {
  min-width: 0;
}

.wallpaper-card-image {
  overflow: hidden;
  aspect-ratio: 4 / 3;
  background: var(--color-placeholder);
}

.wallpaper-card-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s cubic-bezier(.2,.75,.2,1);
}

.wallpaper-card:hover .wallpaper-card-image img {
  transform: scale(1.025);
}

.wallpaper-card-copy {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.75rem;
  padding-top: 0.65rem;
}

.wallpaper-card h2,
.wallpaper-card h3 {
  margin: 0;
  font-size: 1rem;
  line-height: 1.12;
}

.wallpaper-card p {
  margin: 0;
  color: var(--color-text-alt);
  font-size: var(--font-size-s);
  white-space: nowrap;
}

.home-intro {
  max-width: 940px;
  padding: 1.5rem 0 0;
  font-size: clamp(1.1rem, 2.5vw, 1.75rem);
  line-height: 1.25;
}

.home-section {
  padding: 2rem 0 0;
}

.section-label {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.25rem 0 0.9rem;
}

.section-label h2 {
  margin: 0;
  font-size: var(--font-size-l);
}

.section-label a {
  font-weight: 700;
}

.detail-header {
  padding: clamp(2.5rem, 6vw, 6rem) 0 1.5rem;
}

.detail-header .eyebrow {
  margin: 0 0 0.65rem;
  color: var(--color-text-alt);
  font-weight: 700;
}

.detail-header h1 {
  max-width: 1200px;
  margin: 0;
  font-size: var(--font-size-xl);
  line-height: 0.88;
  letter-spacing: -0.055em;
}

.detail-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2rem;
  padding: 2rem 0 7rem;
}

.detail-hero {
  background: var(--color-placeholder);
  min-height: 280px;
}

.detail-hero img {
  width: 100%;
  height: 100%;
  max-height: 78vh;
  object-fit: contain;
  background: var(--color-placeholder);
}

.detail-copy {
  max-width: 640px;
}

.detail-copy h2,
.detail-gallery h2 {
  margin: 0 0 1rem;
  font-size: 1rem;
}

.detail-copy p {
  margin: 0 0 1rem;
  line-height: 1.55;
  font-weight: 500;
}

.detail-meta {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.75rem 1.25rem;
  margin: 2rem 0;
}

.detail-meta dt {
  font-weight: 700;
}

.detail-meta dd {
  margin: 0;
  color: var(--color-text-alt);
}

.download-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0.75rem 1rem;
  border: 1px solid #000;
  background: #000;
  color: #fff;
  font-weight: 700;
}

.download-primary:hover {
  color: #fff;
  background: #333;
}

.gallery-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
}

.gallery-item {
  margin: 0;
}

.gallery-image {
  display: block;
  overflow: hidden;
  background: var(--color-placeholder);
}

.gallery-image img {
  width: 100%;
  max-height: 78vh;
  object-fit: contain;
  margin-inline: auto;
}

.gallery-caption {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.75rem;
  align-items: start;
  padding-top: 0.6rem;
}

.gallery-caption strong {
  display: block;
  word-break: break-word;
}

.gallery-caption span {
  color: var(--color-text-alt);
  font-size: var(--font-size-s);
}

.gallery-caption a {
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.empty-image {
  display: grid;
  place-items: center;
  min-height: 320px;
  background: var(--color-placeholder);
}

.page-content {
  width: min(760px, 100%);
  min-height: 52vh;
  padding: clamp(3rem, 8vw, 8rem) 0;
}

.page-content h1 {
  margin: 0 0 1.5rem;
  font-size: var(--font-size-xl);
  line-height: 0.9;
  letter-spacing: -0.05em;
}

.page-content p {
  line-height: 1.55;
}

.search-results {
  display: grid;
  gap: 0;
  margin-top: 2rem;
  border-top: 1px solid var(--border-color);
}

.search-result {
  display: grid;
  grid-template-columns: 100px 1fr auto;
  gap: 1rem;
  align-items: center;
  padding: 1rem 0;
  border-bottom: 1px solid var(--border-color);
}

.search-result img {
  width: 100px;
  height: 75px;
  object-fit: cover;
  background: var(--color-placeholder);
}

.search-result h2 {
  margin: 0;
  font-size: 1rem;
}

.search-result p {
  margin: 0.25rem 0 0;
  color: var(--color-text-alt);
  font-size: var(--font-size-s);
}

.site-footer {
  padding: 2rem 0;
}

.footer-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
  padding: 2rem 0;
}

.footer-grid p {
  margin: 0;
  color: var(--color-text-alt);
  line-height: 1.4;
  font-weight: 600;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  font-weight: 700;
}

.faded {
  color: var(--color-faded);
}

.hidden-by-filter {
  display: none !important;
}

.fade-in {
  opacity: 0;
  transition: opacity 0.25s ease-out;
}

.fade-in.loaded {
  opacity: 1;
}

@media (min-width: 34em) {
  .category-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .wallpaper-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .gallery-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 52em) {
  .header-row {
    grid-template-columns: 20vw 1fr auto;
  }

  .category-grid {
    grid-template-columns: repeat(7, minmax(0, 1fr));
  }

  .wallpaper-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .detail-layout {
    grid-template-columns: minmax(300px, 38vw) minmax(260px, 1fr);
    align-items: start;
  }

  .detail-gallery {
    grid-column: 1 / -1;
  }

  .gallery-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .footer-grid {
    grid-template-columns: 1fr auto;
    align-items: end;
  }
}

@media (min-width: 78em) {
  .wallpaper-grid {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }

  .gallery-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  .primary-nav {
    display: none;
  }

  .mobile-menu-button {
    display: block;
  }

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

  .title-header .title-meta {
    justify-content: flex-start;
  }

  .search-result {
    grid-template-columns: 72px 1fr;
  }

  .search-result img {
    width: 72px;
    height: 54px;
  }

  .search-result > span {
    display: none;
  }
}
