/* ===========================================================================
   Divine Monuments — sitemap page blocks
   acf/dm-page-index, acf/dm-photo-grid and acf/dm-contact-form. Everything
   here reuses the tokens and the .collection-image-unavailable placeholder
   already defined in site.css / landing.css.
   See docs/superpowers/specs/2026-09-03-site-structure-page-builder-design.md.
   =========================================================================== */

/* ---- Page index (category landing card grid) ----------------------------- */
.pi-cards {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(20px, 2.4vw, 32px);
}
@media (max-width: 640px) {
  .pi-cards { grid-template-columns: 1fr; }
}
.pi-card {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--bg-alt);
  overflow: hidden;
  transition: border-color .3s var(--ease), transform .4s var(--ease);
}
.pi-card:hover { border-color: var(--brass); transform: translateY(-2px); }
/* An odd card count leaves the last card alone on its row; stretch it across
   both columns as a wide, side-by-side card so the grid has no hole. */
@media (min-width: 641px) {
  .pi-card:last-child:nth-child(odd) { grid-column: 1 / -1; flex-direction: row; }
  .pi-card:last-child:nth-child(odd) .pi-card__media { flex: 0 0 50%; }
  /* The placeholder's dashed rule separates image from text: in the side-by-side layout that is a right edge, not a bottom one. */
  .pi-card:last-child:nth-child(odd) .pi-card__media .collection-image-unavailable { height: 100%; border-bottom: 0; border-right: 1px dashed var(--brass); }
  .pi-card:last-child:nth-child(odd) .pi-card__body { flex: 1; align-self: center; }
}
.pi-card__media { display: block; aspect-ratio: 4/3; overflow: hidden; }
.pi-card__media img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pi-card__media .collection-image-unavailable { aspect-ratio: 4/3; border: 0; border-bottom: 1px dashed var(--brass); }
.pi-card__body { display: block; padding: clamp(20px, 2.4vw, 28px); }
.pi-card__title { display: block; font-family: var(--serif); font-size: 26px; color: var(--text); }
.pi-card__blurb { display: block; margin-top: 10px; font-size: 14.5px; color: var(--text-soft); max-width: 42ch; }
.pi-card__cta {
  display: inline-flex; align-items: center; gap: 8px; margin-top: 18px;
  font-size: 12px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase;
  color: var(--brass-light);
}
.pi-card__cta .arr { transition: transform .35s var(--ease); }
.pi-card:hover .pi-card__cta .arr { transform: translateX(4px); }

/* ---- Photo grid (gallery pages) ------------------------------------------ */
.pg-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: clamp(16px, 2vw, 26px);
}
.pg-tile { margin: 0; border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; background: var(--bg-alt); }
.pg-tile img { width: 100%; aspect-ratio: 4/5; object-fit: cover; display: block; transition: transform .4s var(--ease); }
.pg-tile .collection-image-unavailable { aspect-ratio: 4/5; border: 0; }
.pg-tile__caption {
  padding: 12px 16px 14px;
  font-size: 13px; color: var(--text-soft);
  border-top: 1px solid var(--line);
}
.pg-tile__open {
  display: block; width: 100%; padding: 0; margin: 0;
  border: 0; background: none; cursor: zoom-in; overflow: hidden;
}
.pg-tile__open:hover img { transform: scale(1.04); }
.pg-tile__open:focus-visible { outline: 2px solid var(--brass-light); outline-offset: -2px; }

/* ---- Lightbox (full-size photo, opened from a photo-grid tile) ----------- */
body.dm-lightbox-open { overflow: hidden; }
.dm-lightbox {
  position: fixed; inset: 0; z-index: 200;
  display: flex; align-items: center; justify-content: center;
  padding: clamp(20px, 6vw, 72px);
  background: color-mix(in oklch, var(--ink) 92%, transparent);
  backdrop-filter: blur(6px);
}
/* An author `display` rule beats the browser's default [hidden]{display:none},
   so without this override the modal was visible the instant it was
   appended to the page, before any click ever happened. */
.dm-lightbox[hidden] { display: none; }
.dm-lightbox__img {
  max-width: 100%; max-height: 100%;
  border-radius: var(--r);
  box-shadow: 0 30px 80px rgba(0, 0, 0, .5);
}
.dm-lightbox__close {
  position: fixed; top: clamp(14px, 3vw, 28px); right: clamp(14px, 3vw, 28px);
  width: 44px; height: 44px; padding: 0; border: 1px solid var(--line-strong);
  border-radius: 999px; background: color-mix(in oklch, var(--ink) 70%, transparent);
  color: var(--warm-white); cursor: pointer;
  transition: border-color .25s var(--ease), color .25s var(--ease);
}
.dm-lightbox__close:hover,
.dm-lightbox__close:focus-visible { border-color: var(--brass-light); color: var(--brass-light); }
.dm-lightbox__close::before,
.dm-lightbox__close::after {
  content: ""; position: absolute; top: 50%; left: 50%;
  width: 16px; height: 2px; background: currentColor;
  transform-origin: center;
}
.dm-lightbox__close::before { transform: translate(-50%, -50%) rotate(45deg); }
.dm-lightbox__close::after { transform: translate(-50%, -50%) rotate(-45deg); }

/* ---- Contact form -------------------------------------------------------- */
.contact-b .contact-grid { display: grid; grid-template-columns: 1fr 1.1fr; gap: clamp(40px, 6vw, 90px); align-items: start; }
.contact-b .eyebrow { color: var(--brass-light); }
.contact-b h2 { font-size: clamp(34px, 4.6vw, 58px); margin: 18px 0 22px; }
.contact-b .lead { color: var(--text-soft); max-width: 42ch; }
.form-error {
  margin-bottom: 20px; padding: 12px 14px;
  border: 1px solid var(--brass); border-radius: var(--r);
  background: color-mix(in oklch, var(--brass) 12%, transparent);
  color: var(--text); font-size: 14px;
}
@media (max-width: 900px) {
  .contact-b .contact-grid { grid-template-columns: 1fr; }
}
