.post-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 2rem;
  margin: 3rem 0;
}

.post-card {
  position: relative;
  border: none;
  border-radius: var(--card-radius);
  background: var(--white);
  box-shadow: var(--shadow-md);
  transition:
    transform var(--anim-duration) ease,
    box-shadow var(--anim-duration) ease;
  isolation: isolate;
}

.post-card::before {
  content: "";
  position: absolute;
  background: linear-gradient(
    135deg,
    rgba(0, 35, 149, 0.06) 0%,
    rgba(0, 35, 149, 0.12) 100%
  );
  opacity: 0;
  transition: opacity var(--anim-duration) ease;
  z-index: 1;
}

.post-card:hover {
  box-shadow: var(--shadow-lg);
  transform: scale(1.05);
}

.post-card:hover::before {
  opacity: 1;
}

.post-card .thumb {
  width: 100%;
  height: 250px;
  overflow: hidden;
  border-top-left-radius: var(--card-radius);
  border-top-right-radius: var(--card-radius);
}
.post-card img {
  width: 100%;
  height: 100%;
  transition: transform var(--anim-duration) ease;
}

.post-body {
  padding: 1.5rem;
  position: relative;
  z-index: 2;
}

.post-body h3 {
  margin: 0 0 0.5rem 0;
  color: var(--primary);
  font-size: 1.25rem;
  transition: color 0.3s ease;
}

.post-body p {
  color: var(--gray-600);
  margin: 0;
  line-height: 1.6;
  transition: color 0.3s ease;
}

/* Project page styles */
.project-hero {
  position: relative;
  min-height: 60vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #1a1a1a;
  background-size: cover;
  background-position: center;
  background-attachment: scroll;
  color: var(--white);
  margin-bottom: 2.5rem;
  overflow: hidden;
  padding: 70px 1rem 1rem;
}

.project-hero .hero-inner {
  position: relative;
  z-index: 2;
  text-align: center;
  max-width: 1200px;
  margin: auto;
  padding: 0 2.5rem;
}

.project-title {
  font-size: 3rem;
  margin: 0 0 1rem 0;
  text-shadow: 2px 2px 8px rgba(0, 0, 0, 0.8);
}

.project-meta {
  display: flex;
  gap: 1.5rem;
  align-items: center;
  justify-content: center;
  color: rgba(255, 255, 255, 0.95);
  font-size: 1.1rem;
  font-weight: 500;
  text-shadow: 1px 1px 4px rgba(0, 0, 0, 0.8);
}

.project-content {
  max-width: 1200px;
  margin: 2.5rem auto;
  padding: 0 2rem;
}

/* Make rich content images responsive but constrained */
.project-content img {
  display: block;
  width: 100%;
  max-width: 640px; /* limit width so images take less space */
  height: auto;
  margin: 1rem auto;
  border-radius: 10px;
  box-shadow: var(--shadow-sm);
  cursor: zoom-in; /* indicate lightbox availability */
}
/* 3-column wrapping grid for consecutive images */
.project-content .inline-image-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin: 1.25rem 0;
}
.project-content .inline-image-grid figure {
  margin: 0;
}
.project-content .inline-image-grid img {
  width: 100%;
  max-width: 100%;
  height: 250px; /* consistent thumbnail height */
  object-fit: cover;
  border-radius: 10px;
  box-shadow: var(--shadow-sm);
  margin: 0; /* override generic image margin */
  cursor: zoom-in;
}
/* Align images using Quill's align classes preserved in HTML */
.project-content .ql-align-left img {
  float: left;
  margin: 0.5rem 1rem 1rem 0;
}
.project-content .ql-align-right img {
  float: right;
  margin: 0.5rem 0 1rem 1rem;
}
.project-content .ql-align-center img {
  float: none;
  margin-left: auto;
  margin-right: auto;
}
/* Clear floats after content block to contain wrapping */
.project-content::after {
  content: "";
  display: table;
  clear: both;
}

/* Legacy mini-gallery markup flattening */
.project-content .mini-gallery {
  display: contents;
}
.project-content .mini-gallery figure {
  display: block;
  margin: 1rem auto;
  max-width: 640px;
}
.project-content .mini-gallery img {
  width: 100%;
  height: auto;
  object-fit: cover;
  border-radius: 10px;
}
/* no custom scrollbar needed when not scrolling */

.project-overview {
  margin-bottom: 2.5rem;
  color: var(--gray-800);
  line-height: 1.75;
  font-size: 1.05rem;
}

.project-content h2 {
  margin-top: 1.25rem;
  margin-bottom: 0.5rem;
  color: var(--primary);
  font-size: 1.5rem;
}

.project-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.25rem;
}
.project-gallery img {
  width: 100%;
  height: 280px;
  object-fit: cover;
  border-radius: 10px;
  transition:
    transform var(--anim-duration) ease,
    box-shadow var(--anim-duration) ease;
}

.project-back {
  display: inline-block;
  margin-top: 1.5rem;
  color: var(--primary);
  text-decoration: underline;
}

/* Lightbox styles */
.lightbox {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(0, 0, 0, 0.85);
  z-index: 2000;
  opacity: 0;
  transition: opacity 220ms ease;
}
.lightbox.open {
  opacity: 1;
}
.lightbox-inner {
  position: relative;
  max-width: 95%;
  max-height: 95%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
}
.lightbox-img {
  max-width: calc(100vw - 160px);
  max-height: calc(100vh - 160px);
  border-radius: 8px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.6);
}
.lightbox-caption {
  color: #fff;
  text-align: center;
  margin-top: 8px;
  font-size: 0.95rem;
}
.lightbox-close,
.lightbox-prev,
.lightbox-next {
  position: absolute;
  background: rgba(255, 255, 255, 0.06);
  border: 0;
  color: #fff;
  padding: 8px 10px;
  border-radius: 6px;
  cursor: pointer;
}
.lightbox-close {
  right: 14px;
  top: 14px;
}
.lightbox-prev {
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
}
.lightbox-next {
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
}

@media (max-width: 700px) {
  .lightbox-img {
    max-width: calc(100vw - 48px);
    max-height: calc(100vh - 140px);
  }
  .lightbox-prev,
  .lightbox-next {
    display: none;
  }
}

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

  .project-hero {
    min-height: 36vh;
    padding: 50px 1rem 1rem;
  }
}

@media (max-width: 520px) {
  .project-gallery {
    grid-template-columns: 1fr;
  }

  .project-hero .hero-inner {
    padding: 0 1rem;
  }

  .project-title {
    font-size: 2rem;
  }
}

/* Project-specific hero images (add a modifier class on the page) */
.project-hero.patio-arvada {
  background-image: url("/branding/hero.jpg");
}
.project-hero.xeriscape-denver {
  background-image: url("/branding/hero.jpg");
}
