.count-pill {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  background: var(--surface-soft);
  color: var(--muted);
  font-weight: 700;
  transition:
    border-color 160ms ease,
    background-color 160ms ease,
    color 160ms ease;
}

.hero {
  padding: 24px 0 40px;
}

.eyebrow {
  margin-bottom: 12px;
  color: var(--accent-dark);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: var(--tracking-eyebrow);
  text-transform: uppercase;
}

h1 {
  max-width: 12ch;
  margin-bottom: 18px;
  line-height: 0.95;
}

.hero p,
.intro-text,
.gallery-card p,
.gallery-section-copy,
.subsection-label {
  color: var(--muted);
  line-height: var(--lh-body);
}

.gallery-section-heading h2 {
  margin-bottom: 8px;
}

.gallery-section-copy {
  max-width: 46rem;
  margin: 8px 0 0;
}

.gallery-section {
  padding: 0 0 72px;
  scroll-margin-top: 110px;
}

.gallery-section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 24px;
  border-top: 1px solid var(--line);
  padding-top: 28px;
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
  padding-bottom: 56px;
}

.project-hero-grid {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) minmax(0, 2fr);
  align-items: stretch;
  gap: 14px;
  padding-bottom: 20px;
}

.project-hero-support {
  grid-column: 2;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(2, minmax(0, 1fr));
  align-self: stretch;
  gap: 14px;
}

.project-hero-support .gallery-card {
  display: block;
  height: 100%;
}

.project-hero-support .gallery-card:first-child {
  grid-column: 1;
  grid-row: 1 / span 2;
}

.project-hero-support .gallery-card:first-child img {
  width: 100%;
  height: 100%;
  aspect-ratio: auto;
  object-fit: cover;
}

.project-hero-support .gallery-card:not(:first-child) img {
  width: 100%;
  height: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
}

.project-hero-support-even .gallery-card:first-child {
  grid-column: auto;
  grid-row: auto;
}

.project-hero-support-even .gallery-card:first-child img {
  aspect-ratio: 1 / 1;
}

.project-hero-text {
  grid-column: 1;
  grid-row: 1;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius-box);
  background: var(--surface-soft);
  text-align: left;
}

.project-hero-text h4 {
  margin: 0 0 8px;
  font-size: 1rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.project-hero-text p {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

.subsection-label {
  margin: 0 0 16px;
  font-size: 0.95rem;
  font-weight: 700;
}

.subgroup {
  margin-bottom: 28px;
}

.subgroup:last-child {
  margin-bottom: 0;
}

.subgroup-title {
  margin: 0 0 8px;
  font-size: 1.2rem;
}

.subgroup-copy {
  max-width: 42rem;
  margin: 0 0 16px;
  color: var(--muted);
  line-height: var(--lh-body);
}

.gallery-card {
  --crop-x: 50%;
  --crop-y: 50%;
  --thumb-scale: 1;
  position: relative;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-media);
  background: var(--surface);
  box-shadow: var(--shadow);
  transition:
    transform 180ms ease,
    border-color 180ms ease,
    box-shadow 180ms ease;
}

.gallery-card:hover,
.gallery-card:focus-visible {
  border-color: rgba(29, 78, 216, 0.22);
  box-shadow: 0 22px 40px rgba(15, 23, 42, 0.12);
}

.gallery-card-media {
  overflow: hidden;
  background: var(--surface-soft);
}

.gallery-card img {
  aspect-ratio: 1 / 1;
  object-fit: cover;
  object-position: var(--crop-x, 50%) var(--crop-y, 50%);
  transform: scale(var(--thumb-scale, 1));
  transform-origin: center;
  backface-visibility: hidden;
  image-rendering: auto;
  will-change: transform;
  background: var(--surface-soft);
  transition:
    transform 220ms ease,
    filter 220ms ease;
}

.gallery-card p {
  display: none;
}

.gallery-card > img {
  display: block;
}

.gallery-card > img,
.gallery-card-media {
  overflow: hidden;
  background: var(--surface-soft);
}

.gallery-card > img {
  aspect-ratio: 1 / 1;
  object-fit: cover;
  object-position: var(--crop-x, 50%) var(--crop-y, 50%);
  transform: scale(var(--thumb-scale, 1));
  transform-origin: center;
  backface-visibility: hidden;
  image-rendering: auto;
  will-change: transform;
  transition:
    transform 220ms ease,
    filter 220ms ease;
}

.gallery-card:hover img,
.gallery-card:focus-visible img {
  transform: scale(calc(var(--thumb-scale, 1) * 1.03));
  filter: saturate(1.04) brightness(1.02);
}

.gallery-card:hover p,
.gallery-card:focus-visible p {
  color: var(--text);
}

.featured-grid .gallery-card p {
  display: block;
  margin: 0;
  padding: 16px 16px 18px;
}

@media (max-width: 640px) {
  :root {
    --container: min(100% - 24px, 1180px);
  }

  .gallery-section {
    scroll-margin-top: 96px;
  }

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

  .project-hero-grid {
    grid-template-columns: 1fr;
  }

  .project-hero-support {
    grid-column: 1;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-rows: auto;
  }

  .project-hero-text {
    grid-column: 1;
    grid-row: auto;
  }

  .project-hero-support .gallery-card:first-child {
    grid-column: auto;
    grid-row: auto;
  }

}
