body.post-type-archive-project .site-footer {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 100;
}

/* The scroll container is the page; give it viewport height minus footer */
.projects-page {
  height: calc(100svh - var(--footer-h-mobile));
  overflow-y: auto;
  scroll-snap-type: y mandatory;
  scroll-padding-top: 0;
  display: block;
}

/* Desktop footer height */
@media (min-width: 900px) {
  .projects-page {
    height: calc(100svh - var(--footer-h-desktop));
  }
}

/* Rows are stacked; each row is a snap point on desktop/tablet */
.projects-grid {
  margin: 0;
  padding: 0;
}

/* Desktop / large screens: strict a / 2a / a spacing */
.projects-row {
  --card-w: 350px;
  --a: max(2rem, calc((100vw - (2 * var(--card-w))) / 4));

  min-height: calc(100svh - var(--footer-h-mobile));
  scroll-snap-align: start;

  display: grid;
  grid-template-columns: repeat(2, var(--card-w));
  column-gap: calc(var(--a) * 2);
  justify-content: start;
  align-content: center;
  padding-inline: var(--a);
  box-sizing: border-box;
}

@media (min-width: 900px) {
  .projects-row {
    min-height: calc(100svh - var(--footer-h-desktop));
  }
}

/* Tablet: true a / a / a spacing */
@media (min-width: 900px) and (max-width: 1366px) {
  .projects-row {
    --card-w: 300px;
    --a: max(2rem, calc((100vw - (2 * var(--card-w))) / 3));

    min-height: calc(100svh - var(--footer-h-desktop));
    grid-template-columns: repeat(2, var(--card-w));
    column-gap: var(--a);
    padding-inline: var(--a);
    justify-content: start;
    align-content: center;
  }

  .project-card {
    max-width: var(--card-w);
  }
}

/* Card hover overlay */
.project-card__media {
  position: relative;
  overflow: hidden;
}

.project-card__media::after {
  content: none;
}

/* Add smooth scaling to the image */
.project-card__media img {
  display: block;
  width: 100%;
  height: auto;
  transition: transform 0.4s ease;
  transform-origin: center center;
}

/* On hover (or focus on link) scale up the image */
.project-card__link:hover .project-card__media img,
.project-card__link:focus .project-card__media img {
  transform: scale(1.05);
}

/* Card sizing/text */
.project-card {
  max-width: 350px;
  width: 100%;
}

.project-card img {
  width: 100%;
  height: auto;
  display: block;
}

.project-card__head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
}

.project-title {
  font-family: "Noto Serif Display", GeorgiaCustom, Georgia, serif;
  font-weight: 800;
  font-style: italic;
  letter-spacing: 0.1rem;
  margin: 0.5rem 0 0;
  flex: 1;
}

.project-location {
  font-size: 1rem;
  white-space: nowrap;
  font-family: 'MinionPro', serif;
  font-weight: 600;
}

.project-card h2 {
  margin: 1rem 0 0;
  font-size: 1.15rem;
  letter-spacing: 0.4rem;
}

.project-subtitle {
  margin: 0.25rem 0 0;
  color: #949494;
  font-size: 1rem;
  font-family: 'MinionPro', serif;
  font-weight: 600;
  font-style: italic;
}

.project-card__link {
  display: block;
  text-decoration: none;
  color: inherit;
}

/* Mobile: single column stacking with snap per card */
@media (max-width: 899px) {
  html,
  body {
    height: 100%;
  }

  body.post-type-archive-project {
    overflow: hidden;
  }

  /* The scrollable viewport area (minus fixed footer) */
  .projects-page {
    height: calc(100svh - var(--footer-h-mobile));
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: y mandatory;
    scroll-padding-top: 0;
  }

  /* Don’t act like a grid container on mobile; the page snaps per card */
  .projects-grid {
    display: block;
    padding: 0;
    margin: 0;
  }

  /* Row wrappers shouldn’t interfere with snapping */
  .projects-row {
    display: contents;
    min-height: auto;
    grid-template-columns: none;
    column-gap: 0;
    padding: 0;
  }

  /* Each card is one “slide” */
  .project-card {
    scroll-snap-align: center;
    scroll-snap-stop: always;
    min-height: calc(100svh - var(--footer-h-mobile));
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 15% 10% 0 10%;
    box-sizing: border-box;
    max-width: none;
    width: 100%;
  }

  /* Make the link content a neat column */
  .project-card__link {
    display: grid;
    gap: 4px;
    width: 100%;
    max-width: min(92vw, 720px);
    margin: 0 auto;
  }

  /* Keep your hover zoom */
  .project-card__media {
    position: relative;
    overflow: hidden;
  }

  .project-card__media img {
    width: 100%;
    height: auto;
    display: block;
    transform: translateZ(0);
    transition: transform 0.4s ease;
    transform-origin: center center;
  }

  .project-card__link:hover .project-card__media img,
  .project-card__link:focus .project-card__media img {
    transform: scale(1.05);
  }

  /* Mobile type tweaks */
  .project-card h2 {
    font-size: 1rem;
    margin: 1rem 0 0;
  }

  .project-subtitle {
    font-size: 0.9rem;
    margin: 0;
  }

  .project-location {
    font-size: 0.9rem;
  }
}

/* Large screens: scale cards so a / 2a / a doesn't become too airy */
@media (min-width: 2000px) {
  .projects-row {
    --card-w: clamp(420px, 18vw, 520px);
  }

  .project-card {
    max-width: var(--card-w);
  }

  .project-card h2 {
    font-size: 1.35rem;
  }

  .project-subtitle,
  .project-location {
    font-size: 1.1rem;
  }
}