:root {
  --bg: #f4f7fb;
  --surface: #ffffff;
  --surface-soft: #f8fafc;
  --surface-muted: #eef2f7;
  --border: #e2e8f0;
  --border-strong: #cbd5e1;
  --text: #0f172a;
  --muted: #475569;
  --muted-2: #64748b;
  --accent: #0f172a;
  --accent-hover: #111827;
  --shadow-sm: 0 8px 24px rgba(15, 23, 42, 0.05);
  --shadow-md: 0 20px 48px rgba(15, 23, 42, 0.08);
  --shadow-lg: 0 24px 70px rgba(15, 23, 42, 0.18);
  --radius-sm: 12px;
  --radius: 18px;
  --radius-lg: 24px;
  --container: 1280px;
  --transition: 0.22s ease;
}

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

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: "Inter", sans-serif;
  background:
    linear-gradient(180deg, #ffffff 0%, #f4f7fb 100%);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

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

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

button,
input,
textarea {
  font: inherit;
}

.gallery-shell {
  width: min(100% - 32px, var(--container));
  margin: 0 auto;
}

/* =========================
   HEADER
========================= */

.gallery-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(255, 255, 255, 0.94);
  border-bottom: 1px solid rgba(226, 232, 240, 0.9);
  backdrop-filter: blur(12px);
}

.header-inner {
  min-height: 78px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.brand-mark {
  width: 42px;
  height: 42px;
  object-fit: contain;
  flex-shrink: 0;
}

.brand-text {
  font-size: 1rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text);
  white-space: nowrap;
}



/* =========================
   HERO
========================= */

.gallery-hero {
  padding: 78px 0 34px;
}

.gallery-hero__content {
  max-width: 820px;
}

.gallery-eyebrow {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 12px;
  margin-bottom: 18px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.gallery-hero h1 {
  margin: 0 0 14px;
  font-size: clamp(2.25rem, 4vw, 4rem);
  line-height: 1.02;
  letter-spacing: -0.045em;
  color: var(--text);
}

.gallery-hero p {
  margin: 0;
  max-width: 720px;
  color: var(--muted);
  font-size: 1.05rem;
  line-height: 1.75;
}

/* =========================
   SECTION / TOOLBAR
========================= */

.gallery-section {
  padding: 18px 0 80px;
}

.gallery-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  flex-wrap: wrap;
  margin-bottom: 28px;
}

.gallery-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.filter-btn {
  appearance: none;
  border: 1px solid var(--border-strong);
  background: rgba(255, 255, 255, 0.96);
  color: var(--text);
  border-radius: 999px;
  min-height: 44px;
  padding: 0 16px;
  font-size: 0.94rem;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.03);
  transition:
    transform var(--transition),
    background-color var(--transition),
    color var(--transition),
    border-color var(--transition),
    box-shadow var(--transition);
}

.filter-btn:hover {
  transform: translateY(-1px);
  border-color: #94a3b8;
  box-shadow: 0 10px 22px rgba(15, 23, 42, 0.06);
}

.filter-btn.active {
  background: var(--accent);
  color: #ffffff;
  border-color: var(--accent);
  box-shadow: 0 14px 28px rgba(15, 23, 42, 0.14);
}

.gallery-results {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 14px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.85);
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 800;
}

/* =========================
   GRID
========================= */

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

.gallery-card {
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: var(--surface);
  border: 1px solid rgba(226, 232, 240, 0.96);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition:
    transform 0.24s ease,
    box-shadow 0.24s ease,
    border-color 0.24s ease;
}

.gallery-card:hover {
  transform: translateY(-4px);
  border-color: #cbd5e1;
  box-shadow: var(--shadow-md);
}

/* =========================
   MEDIA AREA
   This is the key fix:
   - frame stays consistent
   - image never crops
   - mixed image sizes still look clean
========================= */

.gallery-card__media {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 320px;
  padding: 18px;
  background:
    linear-gradient(180deg, #f8fafc 0%, #eef2f7 100%);
  border-bottom: 1px solid var(--border);
  overflow: hidden;
  cursor: zoom-in;
}

.gallery-card__media::before {
  content: "";
  position: absolute;
  inset: 14px;
  border-radius: 18px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(241, 245, 249, 0.98));
  box-shadow:
    inset 0 0 0 1px rgba(226, 232, 240, 0.95),
    0 10px 24px rgba(15, 23, 42, 0.04);
  pointer-events: none;
}

.gallery-card__media img {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 280px;
  object-fit: contain;
  object-position: center;
  transition: transform 0.28s ease;
}

.gallery-card:hover .gallery-card__media img {
  transform: scale(1.015);
}

.gallery-card__media.is-portrait img {
  max-height: 290px;
  width: auto;
}

.gallery-card__media.is-landscape img {
  max-width: 100%;
}

.gallery-card__media.is-square img {
  max-height: 270px;
}

.gallery-card__media.is-error {
  cursor: default;
}

.gallery-card__media.is-error::after {
  content: "Image unavailable";
  position: relative;
  z-index: 1;
  color: var(--muted);
  font-size: 0.95rem;
  font-weight: 700;
}

/* =========================
   CARD BODY
========================= */

.gallery-card__body {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 18px 18px 20px;
  flex: 1;
}

.gallery-card__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.gallery-card__tag {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0 10px;
  border-radius: 999px;
  background: #eef2f7;
  color: var(--text);
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.gallery-card__link {
  color: var(--muted-2);
  font-size: 0.9rem;
  font-weight: 800;
  transition: color var(--transition);
}

.gallery-card__link:hover {
  color: var(--text);
}

.gallery-card h3 {
  margin: 0;
  font-size: 1.08rem;
  line-height: 1.28;
  letter-spacing: -0.02em;
  color: var(--text);
}

.gallery-card p {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.72;
}

/* =========================
   EMPTY STATE
========================= */

.catalog-empty {
  grid-column: 1 / -1;
  padding: 44px 24px;
  text-align: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.catalog-empty h3 {
  margin: 0 0 8px;
  font-size: 1.2rem;
  color: var(--text);
}

.catalog-empty p {
  margin: 0;
  color: var(--muted);
}

/* =========================
   LIGHTBOX
========================= */

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 28px;
  background: rgba(15, 23, 42, 0.84);
}

.lightbox.is-open {
  display: flex;
}

.lightbox-content {
  width: min(1180px, 100%);
  max-height: calc(100vh - 56px);
  background: #ffffff;
  border-radius: 24px;
  overflow: hidden;
  box-shadow: var(--shadow-lg);
}

.lightbox-image-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 420px;
  max-height: 76vh;
  padding: 20px;
  background:
    linear-gradient(180deg, #f8fafc 0%, #eef2f7 100%);
  border-bottom: 1px solid var(--border);
}

.lightbox-image-wrap img {
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 70vh;
  object-fit: contain;
  object-position: center;
}

.lightbox-caption {
  padding: 18px 20px 22px;
  background: #ffffff;
}

.lightbox-caption h3 {
  margin: 0 0 4px;
  font-size: 1.12rem;
  line-height: 1.3;
  color: var(--text);
}

.lightbox-caption p {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 0.95rem;
}

.lightbox-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0 14px;
  border-radius: 10px;
  background: var(--accent);
  color: #ffffff;
  font-size: 0.92rem;
  font-weight: 800;
  transition:
    background-color var(--transition),
    transform var(--transition);
}

.lightbox-link:hover {
  background: var(--accent-hover);
  transform: translateY(-1px);
}

.lightbox-close,
.lightbox-nav {
  position: absolute;
  border: 0;
  background: rgba(255, 255, 255, 0.96);
  color: var(--text);
  cursor: pointer;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.12);
  transition:
    transform var(--transition),
    background-color var(--transition);
}

.lightbox-close:hover,
.lightbox-nav:hover {
  transform: translateY(-1px);
  background: #ffffff;
}

.lightbox-close {
  top: 18px;
  right: 18px;
  width: 48px;
  height: 48px;
  border-radius: 999px;
  font-size: 1.8rem;
  line-height: 1;
}

.lightbox-nav {
  top: 50%;
  transform: translateY(-50%);
  width: 52px;
  height: 52px;
  border-radius: 999px;
  font-size: 1.45rem;
  line-height: 1;
}

.lightbox-prev {
  left: 20px;
}

.lightbox-next {
  right: 20px;
}

/* =========================
   RESPONSIVE
========================= */

@media (max-width: 1180px) {
  .gallery-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 900px) {
  .header-inner {
    min-height: auto;
    padding: 14px 0;
    flex-direction: column;
    align-items: flex-start;
  }



  .gallery-hero {
    padding: 60px 0 24px;
  }

  .gallery-toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .gallery-results {
    justify-content: center;
  }

  .gallery-card__media {
    min-height: 300px;
  }

  .gallery-card__media img {
    max-height: 260px;
  }

  .lightbox {
    padding: 16px;
  }

  .lightbox-nav {
    display: none;
  }

  .lightbox-content {
    max-height: calc(100vh - 32px);
  }

  .lightbox-image-wrap {
    min-height: 320px;
    max-height: 68vh;
    padding: 16px;
  }

  .lightbox-image-wrap img {
    max-height: 62vh;
  }
}

@media (max-width: 640px) {
  .gallery-shell {
    width: min(100% - 24px, var(--container));
  }

  .gallery-grid {
    grid-template-columns: 1fr;
    gap: 18px;
  }

  .gallery-filters {
    width: 100%;
  }

  .filter-btn {
    width: 100%;
    justify-content: center;
    text-align: center;
  }



  .gallery-card__media {
    min-height: 260px;
    padding: 14px;
  }

  .gallery-card__media::before {
    inset: 10px;
    border-radius: 14px;
  }

  .gallery-card__media img {
    max-height: 228px;
  }

  .gallery-card__body {
    padding: 16px;
  }

  .gallery-card__top {
    align-items: flex-start;
    flex-direction: column;
  }

  .lightbox-close {
    top: 10px;
    right: 10px;
  }

  .lightbox-caption {
    padding: 16px;
  }
}

@media (max-width: 420px) {
  .gallery-hero h1 {
    font-size: 2rem;
  }

  .gallery-card__media {
    min-height: 230px;
  }

  .gallery-card__media img {
    max-height: 200px;
  }

  .lightbox-image-wrap {
    min-height: 260px;
  }
}