/* ============================================================
   content.css, project detail page styling
   spencer allan

   B1. Grid layout
   B2. Project header (title + year)
   B3. Body text
   B4. Gallery (bottom)
   B5. Mobile
   B6. PhotoSwipe / collage gallery
   ============================================================ */


/* ── B1. GRID LAYOUT ────────────────────────────────────────── */

html, body {
  margin: 0;
  padding: 0;
  overflow-x: hidden;
}

.container {
  display: grid;
  width: 100vw;
  height: auto;
  grid-template-columns: 400px 1fr;
  grid-template-rows: auto auto auto;
  grid-gap: 0;
  grid-template-areas:
    "sidebar project-header"
    "sidebar project-body"
    "sidebar project-gallery";
}

.sidebar {
  grid-area: sidebar;
}


/* ── B2. PROJECT HEADER (title + year) ──────────────────────── */

.project-header {
  grid-area: project-header;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 39px 50px 0;
}

.project-header h2 {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 13px;
  font-weight: 500;
  color: #333;
  line-height: 1.8;
  margin: 0;
  max-width: 72%;
}

.project-year {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 13px;
  font-weight: 400;
  color: #999;
  flex-shrink: 0;
}


/* ── B3. BODY TEXT ──────────────────────────────────────────── */

.project-body {
  grid-area: project-body;
  padding: 108px 50px 0;
}

.project-body p {
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  line-height: 1.8;
  color: #333;
  margin-bottom: 22px;
  margin-top: 0;
  margin-right: 0;
}

.project-body p[style*="italic"],
.project-body p[style*="oblique"] {
  font-family: 'Inter', sans-serif;
}

table img {
  max-width: 20px !important;
}


/* ── B4. GALLERY (bottom) ───────────────────────────────────── */

.project-gallery {
  grid-area: project-gallery;
  padding: 20px 50px 100px;
}

.project-gallery img {
  max-width: 100%;
}


/* ── B5. MOBILE ─────────────────────────────────────────────── */

@media (max-width: 1100px) {

  .container {
    grid-template-columns: 100vw;
    grid-template-rows: auto auto auto;
    grid-template-areas:
      "project-header"
      "project-body"
      "project-gallery";
  }

  .project-header {
    padding: 16px 24px 0;
    flex-direction: column;
    gap: 4px;
  }

  .project-header h2 {
    max-width: 100%;
  }

  .project-body {
    padding: 24px 24px 0;
  }

  .project-body p {
    margin-right: 0;
  }

  .project-gallery {
    padding: 16px 24px 60px;
  }

  .pswp-gallery {
    width: 100%;
  }

  /* Collage galleries stack single-column on mobile */
  .collage-gallery {
    gap: 8px;
  }

  .collage-gallery > .pswp-gallery__item {
    width: 100% !important;
    height: auto !important;
    transform: none !important;
    margin-top: 0 !important;
    flex-grow: 0;
    flex-shrink: 0;
  }

  .collage-gallery > .pswp-gallery__item img {
    height: auto;
    object-fit: unset;
  }

}


/* ── B6. COLLAGE GALLERY (justified-row + manual overrides) ─── */

/* Flex container — JS sets each item's width/height to fill rows.
   overflow:visible so rotated items can spill outside bounds.      */
.collage-gallery {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 20px;
  margin-bottom: 20px;
  overflow: visible;
}

.collage-gallery > .pswp-gallery__item {
  overflow: hidden;
  flex-shrink: 0;
  flex-grow: 0;
  /* width + height injected by justifiedLayout() in gallery.js,
     unless data-w is set (manual override).                       */
}

.collage-gallery > .pswp-gallery__item a {
  display: block;
  width: 100%;
  height: 100%;
}

.collage-gallery > .pswp-gallery__item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: filter 0.15s;
}

.collage-gallery > .pswp-gallery__item img:hover {
  filter: brightness(1.06);
}

/* Manual-width items show natural height — no cropping */
.collage-gallery > .pswp-gallery__item[data-w] img {
  height: auto;
  object-fit: unset;
}

/* Paper / desk effect: subtle shadow for rotated items */
.collage-gallery > .pswp-gallery__item[data-rotate] {
  box-shadow: 2px 4px 14px rgba(0, 0, 0, 0.13);
  position: relative;
  z-index: 1;
}

/* Stacked items sit on top of neighbours */
.collage-gallery > .pswp-gallery__item[data-mt] {
  position: relative;
  z-index: 2;
}
