:root {
  color-scheme: light;
  --bg: #f4f7f6;
  --surface: #ffffff;
  --surface-strong: #ffffff;
  --ink: #17211d;
  --muted: #68736d;
  --line: rgba(23, 33, 29, 0.12);
  --accent: #0f766e;
  --accent-dark: #115e59;
  --ember: #d97706;
  --shadow: 0 22px 70px rgba(30, 36, 33, 0.16);
  --soft-shadow: 0 12px 34px rgba(30, 36, 33, 0.11);
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  margin: 0;
  background:
    radial-gradient(circle at 8% 8%, rgba(15, 118, 110, 0.08), transparent 26rem),
    linear-gradient(135deg, #f4f7f6 0%, #edf3f5 48%, #faf8f4 100%);
  color: var(--ink);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

svg {
  width: 1.25rem;
  height: 1.25rem;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 34px 0 56px;
}

.gallery-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 420px);
  gap: 22px;
  align-items: end;
  margin-bottom: 22px;
}

.title-group {
  min-width: 0;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--accent-dark);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2.35rem, 6vw, 5.65rem);
  font-weight: 700;
  line-height: 0.95;
}

.gallery-tools {
  display: flex;
  justify-content: flex-end;
}

.search-field {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  width: 100%;
  min-height: 48px;
  padding: 0 14px;
  background: rgba(255, 255, 255, 0.86);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--soft-shadow);
  color: var(--muted);
  backdrop-filter: blur(12px);
  transition: border-color 180ms ease, box-shadow 180ms ease, transform 180ms ease;
}

.search-field:focus-within {
  border-color: rgba(15, 118, 110, 0.52);
  box-shadow: 0 16px 42px rgba(15, 118, 110, 0.16);
  transform: translateY(-1px);
}

.search-field input {
  width: 100%;
  min-width: 0;
  padding: 12px 0 12px 10px;
  background: transparent;
  border: 0;
  color: var(--ink);
  outline: 0;
}

.search-field input::placeholder {
  color: #7e8882;
}

.filter-bar {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 22px;
  overflow-x: auto;
  scrollbar-width: none;
}

.filter-bar::-webkit-scrollbar {
  display: none;
}

.filter-button {
  flex: 0 0 auto;
  min-height: 40px;
  padding: 0 16px;
  background: rgba(255, 255, 255, 0.64);
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-weight: 750;
  transition: background 180ms ease, border-color 180ms ease, color 180ms ease, transform 180ms ease;
}

.filter-button:hover {
  transform: translateY(-1px);
  color: var(--ink);
  border-color: rgba(15, 118, 110, 0.34);
}

.filter-button.active {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--surface-strong);
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 16px;
}

.gallery-card {
  position: relative;
  grid-column: span 4;
  min-height: 240px;
  overflow: hidden;
  isolation: isolate;
  border: 1px solid rgba(255, 255, 255, 0.58);
  border-radius: var(--radius);
  background: #d9ded9;
  box-shadow: var(--soft-shadow);
  animation: cardIn 460ms ease both;
  transition: transform 220ms ease, box-shadow 220ms ease;
}

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

.gallery-card:nth-child(6n + 5) {
  grid-column: span 8;
}

.gallery-card:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow);
}

.gallery-card:focus-visible {
  outline: 3px solid rgba(15, 118, 110, 0.5);
  outline-offset: 3px;
}

.gallery-card img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scale(1.02);
  transition: transform 520ms ease, filter 520ms ease;
}

.gallery-card:hover img {
  filter: saturate(1.06) contrast(1.04);
  transform: scale(1.09);
}

.gallery-card::after {
  position: absolute;
  inset: auto 0 0;
  height: 64%;
  content: "";
  background: linear-gradient(to top, rgba(8, 13, 12, 0.82), rgba(8, 13, 12, 0));
  opacity: 0.88;
  transition: opacity 220ms ease;
  z-index: 1;
}

.gallery-card:hover::after {
  opacity: 1;
}

.card-content {
  position: absolute;
  inset: auto 0 0;
  z-index: 2;
  display: grid;
  gap: 7px;
  padding: 18px;
  color: white;
  transform: translateY(4px);
  transition: transform 220ms ease;
}

.gallery-card:hover .card-content {
  transform: translateY(0);
}

.card-category {
  width: max-content;
  max-width: 100%;
  padding: 5px 9px;
  background: rgba(255, 255, 255, 0.16);
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 999px;
  color: rgba(255, 255, 255, 0.92);
  font-size: 0.72rem;
  font-weight: 850;
  text-transform: uppercase;
  backdrop-filter: blur(10px);
}

.card-title {
  margin: 0;
  font-size: clamp(1.1rem, 2vw, 1.55rem);
  line-height: 1.08;
}

.card-location {
  margin: 0;
  color: rgba(255, 255, 255, 0.82);
  font-size: 0.92rem;
}

.empty-state {
  margin: 28px 0 0;
  padding: 22px;
  background: rgba(255, 255, 255, 0.76);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--muted);
  text-align: center;
}

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: minmax(52px, 1fr) minmax(0, 1050px) minmax(52px, 1fr);
  align-items: center;
  gap: 14px;
  padding: 28px;
  background: rgba(10, 14, 13, 0.88);
  opacity: 0;
  pointer-events: none;
  transition: opacity 220ms ease;
}

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

.lightbox-panel {
  grid-column: 2;
  width: 100%;
  margin: 0;
  transform: translateY(12px) scale(0.985);
  transition: transform 260ms ease;
}

.lightbox.open .lightbox-panel {
  transform: translateY(0) scale(1);
}

.lightbox-panel img {
  display: block;
  width: 100%;
  max-height: min(74vh, 760px);
  object-fit: contain;
  border-radius: var(--radius);
  box-shadow: 0 28px 90px rgba(0, 0, 0, 0.34);
  transition: opacity 180ms ease, transform 180ms ease;
}

.lightbox-panel img.is-switching {
  opacity: 0;
  transform: scale(0.985);
}

.lightbox-caption {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  margin-top: 14px;
  color: white;
}

#lightboxTitle {
  font-weight: 800;
}

#lightboxMeta {
  color: rgba(255, 255, 255, 0.68);
}

.icon-button {
  display: inline-grid;
  place-items: center;
  width: 46px;
  height: 46px;
  padding: 0;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 999px;
  color: white;
  backdrop-filter: blur(14px);
  transition: background 180ms ease, transform 180ms ease, border-color 180ms ease;
}

.icon-button:hover {
  background: rgba(255, 255, 255, 0.2);
  border-color: rgba(255, 255, 255, 0.36);
  transform: scale(1.04);
}

.icon-button:focus-visible {
  outline: 3px solid rgba(255, 255, 255, 0.42);
  outline-offset: 3px;
}

.close-button {
  position: fixed;
  top: 22px;
  right: 22px;
}

.prev-button {
  grid-column: 1;
  justify-self: end;
}

.next-button {
  grid-column: 3;
  justify-self: start;
}

@keyframes cardIn {
  from {
    opacity: 0;
    transform: translateY(14px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 900px) {
  .shell {
    width: min(100% - 24px, 760px);
    padding-top: 24px;
  }

  .gallery-header {
    grid-template-columns: 1fr;
    align-items: start;
  }

  .gallery-tools {
    justify-content: stretch;
  }

  .gallery-grid {
    grid-template-columns: repeat(6, 1fr);
    gap: 12px;
  }

  .gallery-card,
  .gallery-card:nth-child(6n + 1),
  .gallery-card:nth-child(6n + 4),
  .gallery-card:nth-child(6n + 5) {
    grid-column: span 3;
    min-height: 250px;
  }

  .lightbox {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: minmax(0, 1fr) auto;
    align-items: center;
    padding: 20px;
  }

  .lightbox-panel {
    grid-column: 1 / -1;
    align-self: center;
  }

  .lightbox-panel img {
    max-height: 64vh;
  }

  .prev-button,
  .next-button {
    grid-column: auto;
    justify-self: center;
  }
}

@media (max-width: 620px) {
  .shell {
    width: min(100% - 20px, 520px);
    padding-bottom: 32px;
  }

  h1 {
    font-size: clamp(2.4rem, 16vw, 4.2rem);
  }

  .filter-bar {
    margin-left: -10px;
    margin-right: -10px;
    padding: 0 10px 2px;
  }

  .gallery-grid {
    display: block;
  }

  .gallery-card,
  .gallery-card:nth-child(6n + 1),
  .gallery-card:nth-child(6n + 4),
  .gallery-card:nth-child(6n + 5) {
    width: 100%;
    min-height: 320px;
    margin-bottom: 12px;
  }

  .card-content {
    padding: 16px;
  }

  .lightbox {
    padding: 14px;
  }

  .lightbox-panel img {
    max-height: 58vh;
  }

  .close-button {
    top: 12px;
    right: 12px;
  }

  .lightbox-caption {
    display: grid;
  }

  .icon-button {
    width: 44px;
    height: 44px;
  }
}

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