/* PhilCorley gallery – CSS Grid + Stack for mobile (no Gridzy) */

:root {
  --pc-gap: 22px;
  --pc-mat: 20px;
  --pc-border: rgba(0, 0, 0, 0.18);
  --pc-shadow: 0 10px 28px rgba(0, 0, 0, 0.10);
}

/* Gallery wrapper */
.pc-gallery {
  margin-top: 2.5rem;
}

/* Two-column grid: images flow left to right (1→left, 2→right, 3→left, 4→right...) */
.pc-gallery-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  grid-auto-rows: auto;
  gap: var(--pc-gap);
  margin-top: 0;
  align-items: start;
}

/* Panos span both columns */
.pc-gallery-grid .pc-ar-pano {
  grid-column: 1 / -1;
}
@media (max-width: 767px) {
  .pc-gallery-grid {
    display: none !important;
  }
}

/* Cards: matted image at natural size */
.pc-gallery-grid > a.pc-card {
  display: block;
  box-sizing: border-box;
  background: #fff;
  border: 1px solid var(--pc-border);
  box-shadow: var(--pc-shadow);
  border-radius: 2px;
  overflow: hidden;
  text-decoration: none;
}

.pc-gallery-grid .pc-card .pc-mat {
  position: relative;
  display: block;
  padding: 0;
}

.pc-gallery-grid .pc-card .pc-mat img {
  display: block;
  width: 100%;
  height: auto;
}

/* Dark overlay on hover */
.pc-gallery-grid .pc-card .pc-mat::after {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0);
  transition: background 0.25s ease;
  pointer-events: none;
}
.pc-gallery-grid .pc-card:hover .pc-mat::after,
.pc-gallery-grid .pc-card:focus-within .pc-mat::after {
  background: rgba(0, 0, 0, 0.5);
}

/* Stack: shown < 768px only, pure CSS flex */
.pc-gallery-stack {
  display: none;
}
@media (max-width: 767px) {
  .pc-gallery-stack {
    display: flex;
    flex-direction: column;
  }
}
.pc-gallery-stack > a.pc-card {
  width: 100%;
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
  background: #fff;
  border: 1px solid var(--pc-border);
  box-shadow: var(--pc-shadow);
  border-radius: 2px;
  overflow: hidden;
  text-decoration: none;
}
.pc-gallery-stack > a.pc-card .pc-mat {
  position: relative;
  display: block;
  flex: none;
  padding: 0;
}
.pc-gallery-stack .pc-card .pc-mat img {
  flex: none;
  height: auto;
  object-fit: unset;
  display: block;
  width: 100%;
}
.pc-gallery-stack .pc-stack-br {
  display: block;
  height: 10px;
  line-height: 10px;
  font-size: 0;
  margin: 0;
  padding: 0;
}

/* Header row */
.pc-genre-header {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-bottom: 2rem;
}

.gallery-header-row,
.project-header-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 2rem;
  width: 100%;
}

.gallery-header-row h2,
.project-header-row h1 {
  flex: 1 1 auto;
  margin: 0;
}

.gallery-meta-right,
.project-meta-right {
  flex: 0 0 auto;
  font-size: 0.875rem;
  color: #737373;
  white-space: nowrap;
}

.gallery-intro,
.project-intro {
  font-size: 0.9375rem;
  line-height: 1.6;
  color: #525252;
}

@media (max-width: 767px) {
  .gallery-header-row,
  .project-header-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
  }
}

.pc-genre-count {
  font-size: 0.875rem;
  opacity: 0.7;
  white-space: nowrap;
}

/* ============================= */
/* Hover caption */
/* ============================= */

.pc-hovercap {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.25s ease;
  z-index: 50;
  transform: translateZ(0);

  display: flex;
  justify-content: center;
  align-items: center;
}

.pc-gallery-grid .pc-card:hover .pc-hovercap,
.pc-gallery-grid .pc-card:focus-within .pc-hovercap {
  opacity: 1;
}
.pc-gallery-stack .pc-card:hover .pc-hovercap,
.pc-gallery-stack .pc-card:focus-within .pc-hovercap {
  opacity: 1;
}
.pc-gallery-stack .pc-card .pc-mat::after {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0);
  transition: background 0.25s ease;
  pointer-events: none;
}
.pc-gallery-stack .pc-card:hover .pc-mat::after,
.pc-gallery-stack .pc-card:focus-within .pc-mat::after {
  background: rgba(0, 0, 0, 0.5);
}

.pc-hovercap-inner {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, 20%);
  text-align: center;
  padding: 0 12px;
  max-width: min(90%, 520px);
  width: 100%;
}

.pc-hovercap-title {
  font-family: ui-sans-serif, system-ui, sans-serif;
  font-size: 1.05rem;
  font-weight: 600;
  line-height: 1.2;
  color: #fff;
  text-shadow: 0 2px 14px rgba(0, 0, 0, 0.55);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pc-hovercap-place {
  margin-top: 6px;
  font-family: ui-sans-serif, system-ui, sans-serif;
  font-size: 0.9rem;
  font-weight: 500;
  line-height: 1.2;
  color: rgba(255, 255, 255, 0.9);
  text-shadow: 0 2px 14px rgba(0, 0, 0, 0.55);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ============================= */
/* Dark mode: 3D lift + crisp border (avoids fuzzy baked-in mat edge) */
/* ============================= */
[data-theme="dark"] .pc-gallery-grid > a.pc-card,
[data-theme="dark"] .pc-gallery-stack > a.pc-card {
  /* 3D lift: layered light shadow on dark bg */
  box-shadow:
    0 2px 4px rgba(255, 255, 255, 0.08),
    0 4px 8px rgba(255, 255, 255, 0.1),
    0 8px 16px rgba(255, 255, 255, 0.12),
    0 16px 32px rgba(255, 255, 255, 0.15),
    0 24px 48px rgba(255, 255, 255, 0.12) !important;
  /* Crisp border: defines edge against dark bg, reduces fuzzy baked-in mat appearance */
  border-color: rgba(255, 255, 255, 0.35) !important;
  isolation: isolate;
}

/* ============================= */
/* PhotoSwipe Custom Styling */
/* ============================= */

.pswp {
  --pswp-bg: #2a2a2a !important;
}

.pswp,
.pswp * {
  transition: none !important;
  animation: none !important;
}

.pswp__img {
  padding: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  outline: none !important;
}

.pswp__zoom-wrap > img.pswp__img {
  display: none !important;
}

.pswp-mat-wrapper {
  z-index: 10 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  overflow: hidden;
}

.pswp-mat-wrapper img {
  width: auto !important;
  height: auto !important;
  max-width: 100% !important;
  max-height: 100% !important;
  object-fit: contain !important;
}

.pswp__custom-caption-title {
  font-family: "Caveat", ui-sans-serif, system-ui, sans-serif;
  font-size: 1.5rem;
  line-height: 1.2;
  color: rgba(0, 0, 0, 0.85);
  text-align: left;
  flex-shrink: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pswp__custom-caption-place {
  font-family: ui-sans-serif, system-ui, sans-serif;
  font-size: 1rem;
  line-height: 1.2;
  color: rgba(0, 0, 0, 0.55);
  text-align: right;
  flex-shrink: 0;
  white-space: nowrap;
}

.pswp__caption {
  display: none !important;
}

.pswp__button {
  background-color: rgba(255, 255, 255, 0.1) !important;
}

.pswp__button:hover {
  background-color: rgba(255, 255, 255, 0.2) !important;
}

.pswp__zoom-wrap {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
}

/* ============================= */
/* Dark mode: 3D lift + crisp border */
/* ============================= */
[data-theme="dark"] .pc-gallery-grid > a.pc-card,
[data-theme="dark"] .pc-gallery-stack > a.pc-card {
  /* overflow: visible so box-shadow is not clipped */
  overflow: visible;
  /* 3D lift: tight directional shadow below (no soft halo – crisp edge) */
  box-shadow: 0 6px 16px rgba(255, 255, 255, 0.12) !important;
  /* Crisp border: prevents fuzzy edge where baked-in mat meets dark bg */
  border-color: rgba(255, 255, 255, 0.35) !important;
  isolation: isolate;
}
