/* ---------- Full-bleed override for this page ----------
   Minimal Mistakes / Academic Pages caps page content at a fixed max-width
   site-wide (independent of the sidebar). "classes: wide" in front matter
   only removes the sidebar's reserved space — it does NOT make the page
   span the full browser width. This override forces the photo grid's
   containers past that cap, specifically on this page only (since this
   stylesheet is only loaded here). */
#main,
.initial-content,
.page {
  max-width: 100% !important;
}

.page__inner-wrap {
  padding-left: 1em;
  padding-right: 1em;
}

/* ---------- Randomized photo grid ---------- */

.photo-scatter {
  --ink: #1b1b1b;
  --paper: #faf9f6;
  --accent: #b5462f;
  --row-unit: 10px;
  --grid-gap: 12px;

  width: 100%;
  padding: 40px 10px 80px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  grid-auto-rows: var(--row-unit);
  grid-auto-flow: dense;
  gap: var(--grid-gap);
}

.photo-tile {
  position: relative;
  overflow: hidden;
  background: var(--paper);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.18);
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  /* grid-column is set randomly by JS; grid-row is computed from each
     image's real aspect ratio once it loads, both re-rolled each load */
}

.photo-tile:hover,
.photo-tile:focus-visible {
  transform: scale(1.03);
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.3);
  z-index: 5;
}

.photo-tile img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: var(--paper);
}

.photo-tile .photo-tile-caption {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 18px 10px 8px;
  text-align: left;
  font-family: "Courier New", monospace;
  font-size: 0.72rem;
  letter-spacing: 0.03em;
  color: #fff;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.65), rgba(0, 0, 0, 0));
  opacity: 0;
  transition: opacity 0.2s ease;
}

.photo-tile:hover .photo-tile-caption,
.photo-tile:focus-visible .photo-tile-caption {
  opacity: 1;
}

/* ---------- Lightbox ---------- */

.photo-lightbox {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(20, 18, 16, 0.55);
  backdrop-filter: blur(6px) saturate(120%);
  -webkit-backdrop-filter: blur(6px) saturate(120%);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease;
}

.photo-lightbox.is-open {
  opacity: 1;
  visibility: visible;
}

.photo-lightbox-panel {
  position: relative;
  max-width: min(900px, 92vw);
  max-height: 90vh;
  overflow-y: auto;
  background: var(--paper);
  padding: 20px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  transform: scale(0.92);
  transition: transform 0.25s ease;
}

.photo-lightbox.is-open .photo-lightbox-panel {
  transform: scale(1);
}

.photo-lightbox-panel img {
  display: block;
  width: 100%;
  max-height: 65vh;
  object-fit: contain;
  background: #111;
  transition: opacity 0.15s ease;
}

.photo-lightbox-panel img.is-loading-full {
  opacity: 0.85;
  filter: blur(1px);
}

.photo-lightbox-meta {
  margin-top: 16px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.photo-lightbox-meta h3 {
  margin: 0 0 6px;
  font-size: 1.2rem;
  color: var(--ink);
}

.photo-lightbox-meta dl {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 4px 12px;
  margin: 10px 0 0;
  font-size: 0.9rem;
}

.photo-lightbox-meta dt {
  font-weight: 600;
  color: var(--accent);
}

.photo-lightbox-meta dd {
  margin: 0;
  color: var(--ink);
}

.photo-lightbox-close {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 34px;
  height: 34px;
  border: none;
  border-radius: 50%;
  background: var(--ink);
  color: var(--paper);
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
}

.photo-lightbox-close:hover {
  background: var(--accent);
}

@media (prefers-reduced-motion: reduce) {
  .photo-tile,
  .photo-lightbox,
  .photo-lightbox-panel {
    transition: none !important;
  }
}