:root {
  --bg: #f7f3ee;
  --surface: #ffffff;
  --text: #1f2937;
  --muted: #6b7280;
  --accent: #b7794b;
  --shadow: 0 10px 24px rgba(0, 0, 0, 0.08);
  --radius: 16px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Arial, Helvetica, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

.header {
  text-align: center;
  padding: 48px 20px 24px;
}

.header h1 {
  margin: 0 0 10px;
  font-size: clamp(2rem, 5vw, 2.8rem);
}

.header p {
  margin: 0;
  color: var(--muted);
  font-size: 1rem;
}

.gallery-page {
  width: min(960px, calc(100% - 32px));
  margin: 0 auto 60px;
}

.gallery-group {
  margin-bottom: 32px;
  padding: 20px;
  background: rgba(255, 255, 255, 0.75);
  border-radius: 22px;
}

.group-heading {
  margin-bottom: 18px;
}

.group-heading h2 {
  margin: 0 0 6px;
  font-size: 1.5rem;
}

.group-heading p {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 210px));
  justify-content: center;
  gap: 14px;
}

.gallery-card {
  position: relative;
  margin: 0;
  overflow: hidden;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  background: var(--surface);
  aspect-ratio: 4 / 3;
  max-height: 160px;
  cursor: pointer;
  outline: none;
}

.gallery-card img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  transition: transform 0.35s ease;
}

.card-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 14px;
  color: #fff;
  background: linear-gradient(
    to top,
    rgba(0, 0, 0, 0.8) 0%,
    rgba(0, 0, 0, 0.45) 45%,
    rgba(0, 0, 0, 0.08) 100%
  );
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 0.35s ease, transform 0.35s ease;
}

.card-overlay h3 {
  margin: 0 0 4px;
  font-size: 1rem;
}

.card-overlay p {
  margin: 0;
  font-size: 0.82rem;
  line-height: 1.35;
}

.gallery-card:hover img,
.gallery-card:focus img,
.gallery-card:focus-visible img {
  transform: scale(1.05);
}

.gallery-card:hover .card-overlay,
.gallery-card:focus .card-overlay,
.gallery-card:focus-visible .card-overlay {
  opacity: 1;
  transform: translateY(0);
}

.gallery-card:focus-visible {
  box-shadow:
    0 0 0 4px rgba(183, 121, 75, 0.25),
    var(--shadow);
}

@media (max-width: 700px) {
  .gallery-page {
    width: min(100% - 20px, 960px);
  }

  .gallery-group {
    padding: 16px;
  }

  .gallery-grid {
    grid-template-columns: repeat(auto-fit, minmax(150px, 180px));
    gap: 12px;
  }

  .gallery-card {
    max-height: 140px;
  }
}

@media (hover: none) {
  .card-overlay {
    opacity: 1;
    transform: translateY(0);
    inset: auto 0 0 0;
    min-height: 45%;
  }
}
