:root {
  color-scheme: dark;
  --bg: #050505;
  --ink: #f7f7f2;
  --muted: #aaa;
  --line: rgba(255, 255, 255, 0.16);
  --soft: rgba(255, 255, 255, 0.06);
  --hard: #fff;
  --shadow: rgba(0, 0, 0, 0.72);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.055), transparent 22rem),
    var(--bg);
  color: var(--ink);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

body::before {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  content: "";
  opacity: 0.18;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.08) 1px, transparent 1px);
  background-size: 42px 42px;
  mask-image: linear-gradient(to bottom, #000, transparent 70%);
}

a {
  color: inherit;
  text-decoration: none;
}

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

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 68px;
  padding: 0 clamp(18px, 4vw, 56px);
  border-bottom: 1px solid var(--line);
  background: rgba(5, 5, 5, 0.74);
  backdrop-filter: blur(18px);
}

.brand {
  font-size: 0.95rem;
  font-weight: 800;
  text-transform: uppercase;
}

.nav {
  display: flex;
  gap: clamp(14px, 3vw, 28px);
  color: var(--muted);
  font-size: 0.9rem;
}

.nav a {
  transition: color 180ms ease;
}

.nav a:hover,
.nav a:focus-visible {
  color: var(--hard);
}

.intro {
  display: grid;
  grid-template-columns: minmax(0, 0.95fr) minmax(280px, 0.75fr);
  gap: clamp(28px, 5vw, 72px);
  align-items: end;
  min-height: clamp(440px, 76vh, 740px);
  padding: clamp(52px, 8vw, 108px) clamp(18px, 4vw, 56px) clamp(30px, 5vw, 56px);
}

.intro-copy {
  animation: liftIn 760ms ease both;
}

.eyebrow {
  margin: 0 0 18px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

h1 {
  max-width: 11ch;
  margin: 0;
  font-size: clamp(4rem, 13vw, 10.6rem);
  line-height: 0.82;
  letter-spacing: 0;
  text-transform: uppercase;
}

.lede {
  max-width: 560px;
  margin: 26px 0 0;
  color: var(--muted);
  font-size: clamp(1rem, 2vw, 1.25rem);
  line-height: 1.65;
}

.spotlight {
  min-height: 62vh;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: #111 center / cover no-repeat;
  box-shadow: 0 32px 90px var(--shadow);
  transform-origin: bottom right;
  animation: revealImage 940ms 160ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.controls {
  display: flex;
  gap: 18px;
  align-items: end;
  justify-content: space-between;
  padding: 0 clamp(18px, 4vw, 56px) 28px;
}

.search {
  display: grid;
  gap: 10px;
  width: min(100%, 520px);
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

.search input {
  width: 100%;
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: 8px;
  outline: 0;
  background: rgba(255, 255, 255, 0.04);
  color: var(--ink);
  font: inherit;
  font-size: 1rem;
  font-weight: 500;
  text-transform: none;
  padding: 0 16px;
  transition:
    border-color 180ms ease,
    background 180ms ease;
}

.search input:focus {
  border-color: rgba(255, 255, 255, 0.52);
  background: rgba(255, 255, 255, 0.08);
}

.stats {
  min-height: 48px;
  display: flex;
  align-items: center;
  color: var(--muted);
  white-space: nowrap;
}

.gallery {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: clamp(10px, 1.5vw, 18px);
  padding: 0 clamp(18px, 4vw, 56px) 70px;
}

.tile {
  padding: 0;
  position: relative;
  grid-column: span 4;
  min-height: 260px;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  isolation: isolate;
  background: var(--soft);
  color: inherit;
  cursor: pointer;
  font: inherit;
  text-align: left;
  opacity: 0;
  transform: translateY(18px);
  animation: liftIn 620ms ease both;
}

.tile:nth-child(6n + 1),
.tile:nth-child(6n + 4) {
  grid-column: span 6;
  min-height: 390px;
}

.tile:nth-child(8n + 3) {
  grid-column: span 3;
}

.tile img {
  width: 100%;
  height: 100%;
  min-height: inherit;
  object-fit: cover;
  filter: grayscale(1) contrast(1.08);
  transform: scale(1.02);
  transition:
    filter 360ms ease,
    transform 520ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

.tile::after {
  position: absolute;
  inset: 0;
  z-index: 1;
  content: "";
  background:
    linear-gradient(to top, rgba(0, 0, 0, 0.78), transparent 48%),
    linear-gradient(110deg, rgba(255, 255, 255, 0.12), transparent 38%);
  opacity: 0.85;
  transition: opacity 260ms ease;
}

.tile-title {
  position: absolute;
  left: 16px;
  right: 16px;
  bottom: 14px;
  z-index: 2;
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 14px;
  color: var(--hard);
  font-size: 0.85rem;
}

.tile-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tile-action {
  flex: 0 0 auto;
  color: #050505;
  background: var(--hard);
  border-radius: 8px;
  padding: 7px 9px;
  font-weight: 800;
}

.tile:hover img,
.tile:focus-visible img {
  filter: grayscale(0) contrast(1);
  transform: scale(1.08);
}

.tile:hover::after,
.tile:focus-visible::after {
  opacity: 0.52;
}

.tile:focus-visible,
.viewer-close:focus-visible,
.viewer-download:focus-visible {
  outline: 2px solid var(--hard);
  outline-offset: 3px;
}

.viewer {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding: 80px clamp(16px, 4vw, 52px) 34px;
  background: rgba(0, 0, 0, 0.88);
  opacity: 0;
  pointer-events: none;
  transition: opacity 240ms ease;
}

.viewer.is-open {
  opacity: 1;
  pointer-events: auto;
}

.viewer img {
  max-height: calc(100vh - 170px);
  border: 1px solid var(--line);
  border-radius: 8px;
  object-fit: contain;
  box-shadow: 0 28px 80px var(--shadow);
  transform: scale(0.96);
  transition: transform 280ms ease;
}

.viewer.is-open img {
  transform: scale(1);
}

.viewer-close,
.viewer-download {
  position: absolute;
  top: 22px;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.06);
  padding: 0 16px;
  font: inherit;
  cursor: pointer;
}

.viewer-close {
  right: 22px;
}

.viewer-download {
  left: 22px;
  display: inline-flex;
  align-items: center;
}

.viewer p {
  max-width: min(820px, 92vw);
  margin: 18px 0 0;
  color: var(--muted);
  text-align: center;
  overflow-wrap: anywhere;
}

.empty {
  grid-column: 1 / -1;
  min-height: 220px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
}

@keyframes liftIn {
  from {
    opacity: 0;
    transform: translateY(22px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes revealImage {
  from {
    opacity: 0;
    transform: translateY(28px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@media (max-width: 980px) {
  .intro {
    grid-template-columns: 1fr;
    min-height: auto;
  }

  .spotlight {
    min-height: 48vh;
  }

  .tile,
  .tile:nth-child(6n + 1),
  .tile:nth-child(6n + 4),
  .tile:nth-child(8n + 3) {
    grid-column: span 6;
    min-height: 300px;
  }
}

@media (max-width: 640px) {
  .topbar {
    min-height: 60px;
  }

  .nav {
    display: none;
  }

  h1 {
    font-size: clamp(3.15rem, 18vw, 5.5rem);
  }

  .controls {
    display: grid;
  }

  .stats {
    min-height: auto;
  }

  .tile,
  .tile:nth-child(6n + 1),
  .tile:nth-child(6n + 4),
  .tile:nth-child(8n + 3) {
    grid-column: 1 / -1;
    min-height: 280px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 1ms !important;
    scroll-behavior: auto !important;
    transition-duration: 1ms !important;
  }
}
