:root {
  --bg: #f5f7fb;
  --bg-accent: #e6edf8;
  --surface: rgba(255, 255, 255, 0.82);
  --surface-strong: #ffffff;
  --surface-soft: rgba(228, 235, 246, 0.72);
  --text: #172033;
  --text-soft: rgba(23, 32, 51, 0.66);
  --line: rgba(44, 72, 126, 0.14);
  --accent: #2b6ef2;
  --accent-soft: #dce8ff;
  --accent-deep: #1746b5;
  --shadow: 0 18px 48px rgba(28, 51, 94, 0.08);
  --radius: 24px;
  --radius-sm: 18px;
  --max-width: 1240px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Manrope", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(96, 154, 255, 0.15), transparent 28%),
    radial-gradient(circle at top right, rgba(30, 214, 184, 0.12), transparent 24%),
    linear-gradient(180deg, #f8fbff 0%, #f2f6fb 52%, #edf2f8 100%);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(rgba(255, 255, 255, 0.55) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.55) 1px, transparent 1px);
  background-size: 32px 32px;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.22), transparent 70%);
}

.page-shell {
  padding: 0 0 5rem;
}

.hero {
  width: min(var(--max-width), calc(100% - 2rem));
  margin: 1rem auto 0;
  padding: 3rem clamp(1.2rem, 3vw, 2.5rem) 2rem;
  border: 1px solid rgba(255, 255, 255, 0.75);
  border-radius: 32px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.9), rgba(233, 241, 252, 0.86)),
    linear-gradient(180deg, rgba(43, 110, 242, 0.03), rgba(43, 110, 242, 0));
  box-shadow: var(--shadow);
}

.hero__content {
  max-width: 720px;
}

.eyebrow {
  margin: 0 0 0.8rem;
  font-size: 0.76rem;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--text-soft);
}

.hero h1 {
  margin: 0;
  font-family: "Cormorant Garamond", serif;
  font-size: clamp(3.2rem, 8vw, 5.8rem);
  line-height: 0.96;
  font-weight: 600;
  letter-spacing: -0.03em;
}

.hero__lede {
  margin: 1rem 0 0;
  max-width: 34rem;
  font-size: 1.02rem;
  line-height: 1.72;
  color: var(--text-soft);
}

.hero__stats {
  display: flex;
  gap: 0.7rem;
  flex-wrap: wrap;
  margin-top: 1.35rem;
}

.stat-pill {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 0.7rem 0.95rem;
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid rgba(43, 110, 242, 0.12);
  color: var(--text);
}

.layout {
  width: min(var(--max-width), calc(100% - 2rem));
  margin: 1rem auto 0;
}

.controls {
  position: sticky;
  top: 0.75rem;
  z-index: 5;
  margin-bottom: 1.25rem;
  padding: 1rem;
  border: 1px solid rgba(255, 255, 255, 0.85);
  border-radius: 24px;
  background: rgba(248, 251, 255, 0.9);
  backdrop-filter: blur(18px);
  box-shadow: var(--shadow);
}

.search-field {
  display: grid;
  gap: 0.55rem;
  font-size: 0.76rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-soft);
}

.search-field input {
  width: 100%;
  padding: 0.92rem 1rem;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.88);
  font: inherit;
  color: var(--text);
}

.search-field input:focus-visible {
  outline: 2px solid rgba(43, 110, 242, 0.24);
  outline-offset: 2px;
}

.filters {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
  margin-top: 0.95rem;
}

.filter-chip {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.68rem 0.9rem;
  background: rgba(255, 255, 255, 0.8);
  color: var(--text);
  font: inherit;
  cursor: pointer;
  transition:
    transform 160ms ease,
    border-color 160ms ease,
    background 160ms ease,
    color 160ms ease;
}

.filter-chip:hover,
.filter-chip:focus-visible {
  transform: translateY(-1px);
  border-color: rgba(43, 110, 242, 0.24);
}

.filter-chip.is-active {
  color: #fff;
  background: var(--accent);
  border-color: transparent;
}

.gallery {
  display: grid;
  gap: 1.4rem;
}

.directory-section {
  padding: 1.15rem;
  border-radius: 26px;
  background: var(--surface);
  border: 1px solid rgba(255, 255, 255, 0.82);
  box-shadow: var(--shadow);
}

.directory-section__header {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 1rem;
  margin-bottom: 1rem;
}

.directory-section__title {
  margin: 0;
  font-family: "Cormorant Garamond", serif;
  font-size: clamp(1.65rem, 2.4vw, 2.3rem);
  font-weight: 600;
}

.directory-section__count {
  color: var(--text-soft);
  font-size: 0.93rem;
}

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

.photo-card {
  opacity: 0;
  animation: fade-up 320ms ease forwards;
}

.photo-card__frame {
  position: relative;
  aspect-ratio: 4 / 5;
  overflow: hidden;
  border-radius: var(--radius-sm);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.45), rgba(220, 230, 245, 0.7)),
    linear-gradient(135deg, rgba(43, 110, 242, 0.08), rgba(30, 214, 184, 0.08));
  box-shadow: 0 10px 24px rgba(28, 51, 94, 0.08);
}

.photo-card__button {
  width: 100%;
  height: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  text-align: left;
  cursor: pointer;
}

.photo-card__image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 240ms ease, filter 240ms ease;
}

.photo-card__button:hover .photo-card__image,
.photo-card__button:focus-visible .photo-card__image {
  transform: scale(1.03);
  filter: saturate(1.03);
}

.photo-card__download {
  position: absolute;
  top: 0.7rem;
  right: 0.7rem;
  z-index: 2;
  width: 2.3rem;
  height: 2.3rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 999px;
  background: rgba(18, 32, 60, 0.78);
  color: #fff;
  cursor: pointer;
  box-shadow: 0 10px 20px rgba(18, 32, 60, 0.18);
}

.photo-card__download:hover,
.photo-card__download:focus-visible {
  background: var(--accent);
}

.photo-card__meta {
  display: grid;
  gap: 0.18rem;
  padding: 0.7rem 0.2rem 0.1rem;
}

.photo-card__name {
  display: block;
  color: var(--text);
  font-size: 0.84rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.photo-card__context {
  display: block;
  color: var(--text-soft);
  font-size: 0.76rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.loading-state,
.empty-state {
  display: grid;
  justify-items: center;
  gap: 0.8rem;
  padding: 3.3rem 1.25rem;
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.68);
  border: 1px dashed var(--line);
  color: var(--text-soft);
}

.spinner {
  width: 2.2rem;
  height: 2.2rem;
  border-radius: 999px;
  border: 3px solid rgba(43, 110, 242, 0.14);
  border-top-color: var(--accent);
  animation: spin 1s linear infinite;
}

.lightbox {
  width: min(94vw, 1360px);
  max-width: none;
  padding: 0;
  border: 0;
  border-radius: 28px;
  background: rgba(12, 18, 29, 0.96);
  color: #f5f8ff;
  box-shadow: 0 32px 80px rgba(0, 0, 0, 0.42);
}

.lightbox::backdrop {
  background: rgba(12, 16, 24, 0.72);
  backdrop-filter: blur(8px);
}

.lightbox__chrome {
  display: flex;
  justify-content: end;
  padding: 1rem 1rem 0;
}

.lightbox__close,
.lightbox__nav,
.lightbox__action {
  border: 1px solid rgba(245, 248, 255, 0.14);
  border-radius: 999px;
  background: rgba(245, 248, 255, 0.08);
  color: inherit;
  font: inherit;
  cursor: pointer;
}

.lightbox__action,
.lightbox__close {
  padding: 0.72rem 1rem;
}

.lightbox__action {
  display: inline-flex;
  align-items: center;
  margin-right: 0.7rem;
  text-decoration: none;
}

.lightbox__body {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 1rem;
  padding: 0 1rem 1rem;
}

.lightbox__nav {
  padding: 0.85rem 1rem;
}

.lightbox__figure {
  margin: 0;
  display: grid;
  gap: 1rem;
  justify-items: center;
}

.lightbox__figure img {
  max-width: 100%;
  max-height: 78vh;
  border-radius: 18px;
  object-fit: contain;
}

.lightbox__figure figcaption {
  color: rgba(245, 248, 255, 0.72);
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes fade-up {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 820px) {
  .hero {
    width: min(100%, calc(100% - 1rem));
    padding: 2.2rem 1rem 1.4rem;
    border-radius: 26px;
  }

  .layout {
    width: min(100%, calc(100% - 1rem));
  }

  .controls {
    top: 0.45rem;
    padding: 0.9rem;
  }

  .directory-section {
    padding: 0.95rem;
  }

  .photo-grid {
    grid-template-columns: repeat(auto-fill, minmax(155px, 1fr));
  }

  .lightbox {
    width: min(100vw - 1rem, 100%);
    border-radius: 24px;
  }

  .lightbox__chrome {
    flex-wrap: wrap;
    gap: 0.6rem;
  }

  .lightbox__action {
    margin-right: 0;
  }

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

  .lightbox__nav {
    width: 100%;
  }
}
