/* ============================================================
   Photos section styles — loaded only on .photos-site pages
   Overrides the dark main-site palette with a white gallery aesthetic
   and converts the header to monochrome.
   ============================================================ */

/* ------- Global reset — neutralise main-site min/max-width constraints ------- */

.photos-site p,
.photos-site main h1,
.photos-site h2,
.photos-site hr,
.photos-site img,
.photos-site li {
  min-width: 0;
  max-width: none;
}

/* ------- Reset body & layout for gallery aesthetic ------- */

.photos-site {
  background: #fff;
  color: #111;
}

.photos-site main {
  background: #fff;
  display: block;
  padding: 0;
  max-width: none;
}

/* ------- Monochrome header ------- */

.photos-site header {
  border-top: 3px solid #111;
  background: #fff;
  padding: 1rem 2rem .5vh;
}

.photos-site header h1 a {
  color: #111;
}

.photos-site header h1 a:hover {
  color: #444;
}

.photos-site nav .nav li a {
  color: #333;
}

.photos-site nav .nav li a:hover,
.photos-site nav .nav li a:focus {
  color: #000;
  text-decoration: none;
}

.photos-site nav .nav .nav-item-active a {
  color: #000;
  border-bottom: 2px solid #111;
}

/* ------- Monochrome footer ------- */

.photos-site footer {
  background: #fff;
  border-top: 1px solid #e0e0e0;
  color: #888;
}

.photos-site footer small {
  color: #888;
}

/* ------- Photos landing page ------- */

.photos-site .tmpl-photos {
  background: #fff;
  padding: 2rem 3rem 4rem;
}

.photos-site .tmpl-photos h1 {
  font-size: 1.1rem;
  color: #888;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 3pt;
  font-style: normal;
  margin-bottom: 2.5rem;
  border-bottom: 1px solid #e0e0e0;
  padding-bottom: 1rem;
}

.photos-site ul.photo-stories-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 3rem;
  list-style: none;
  padding: 0;
  margin: 0;
}

.photos-site ul.photo-stories-grid li {
  margin: 0;
}

.photos-site a.photo-story-card {
  display: block;
  text-decoration: none;
  background: #fff;
  border: 1px solid #e8e8e8;
  transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.photos-site a.photo-story-card:hover,
.photos-site a.photo-story-card:focus {
  box-shadow: 0 4px 20px rgba(0,0,0,0.12);
  transform: translateY(-2px);
}

.photos-site .photo-story-cover {
  height: 220px;
  background-size: cover;
  background-position: center;
  border-bottom: none;
}

.photos-site .photo-story-info {
  padding: 1rem 1.25rem 1.25rem;
  background: #fff;
}

.photos-site .photo-story-info h2 {
  color: #111;
  font-size: 1.1rem;
  margin: 0 0 0.4rem;
  font-style: normal;
}

.photos-site .photo-story-info .story-description {
  color: #555;
  font-size: 0.9rem;
  margin: 0 0 0.6rem;
  min-width: 0; /* override base p { min-width: 310px } which causes card overflow */
  text-wrap: pretty; /* prevent orphan words on last line */
}

.photos-site .photo-story-info .story-meta {
  color: #999;
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 2pt;
  font-style: italic;
  font-family: laca, sans-serif;
  margin: 0;
}

/* ------- Individual story page ------- */

.photos-site .tmpl-photo-story {
  background: #fff;
}

.photos-site .story-header {
  margin-bottom: 0;
}

.photos-site .story-cover {
  height: calc(100vh - var(--header-h, 0px));
  background-size: cover;
  background-position: center;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.photos-site .story-cover::after {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 0;
}

.photos-site .story-cover-overlay {
  position: relative;
  z-index: 1;
  padding: 2rem 3rem;
  width: 100%;
  text-align: center;
}

.photos-site .story-cover-overlay h1 {
  color: #fff;
  font-size: 2.5rem;
  letter-spacing: 5pt;
  font-style: normal;
}

.photos-site .story-cover-overlay .story-intro {
  color: rgba(255,255,255,0.85);
  min-width: 0;
  max-width: 36em;
  margin: 0 auto 1rem;
  text-align: center;
}

.photos-site .story-cover-overlay .story-meta {
  color: rgba(255,255,255,0.65);
  font-family: laca, sans-serif;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 2pt;
  font-style: italic;
  min-width: 0;
  text-align: center;
}

.photos-site .story-back {
  color: rgba(255,255,255,0.75) !important;
}

.photos-site .story-back:hover {
  color: #fff !important;
}

/* Per-story centred section descriptions */

.photo-section-header--centered .photo-section-description {
  text-align: center;
}

/* ------- Story sections ------- */

.photo-section {
  padding: 3rem 0 0;
  border-top: 1px solid #e8e8e8;
}

.photo-section:first-child {
  border-top: none;
  padding-top: 0;
}

/* Section hero — full-screen image before title/grid */

.photo-section--has-hero {
  padding: 0;
  border-top: none;
  margin-top: 4rem;
}

.photo-section--has-hero:first-child {
  margin-top: 0;
}

.photo-section-hero {
  overflow: hidden;
}

.photo-section-hero-img {
  display: block;
  width: 100%;
  height: auto;
}

.photo-section-content {
  padding: 3rem 3rem 1rem;
  border-top: none;
}

.photo-section-header {
  margin-bottom: 1.5rem;
  padding: 0 3rem;
}

.photo-section-title {
  font-family: laca, sans-serif;
  font-size: 2rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 5pt;
  font-style: normal;
  color: #111;
  margin: 0 0 1.25rem;
  text-align: center;
}

.photos-site .photo-section-description {
  font-size: 1rem;
  line-height: 1.65;
  color: #333;
  max-width: 42em;
  min-width: 0;
  margin: 0 auto 0.75rem;
}

/* Centred section — text centred, full-width natural-ratio image grid */

.photos-site .photo-section--centered {
  padding: 0;
}

.photos-site .photo-section--centered .photo-section-header {
  text-align: center;
  padding: 2rem 3rem 1.5rem;
}

.photos-site .photo-section--centered .photo-section-title {
  margin-bottom: 0.75rem;
}

.photos-site .photo-section--centered .photo-section-description {
  max-width: 44em;
  min-width: 0;
  margin: 0 auto 0.75rem;
  text-align: left;
  font-size: 1rem;
  line-height: 1.6;
}

/* Image grid: CSS grid so rows dissolve and images sit at natural aspect ratio */
.photos-site .photo-section--centered .photo-rows {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3px;
  padding: 0;
}

.photos-site .photo-section--centered .photo-row {
  display: contents;
}

.photos-site .photo-section--centered .photo-item {
  flex: none;
  overflow: hidden;
}

.photos-site .photo-section--centered .photo-item img {
  width: 100%;
  height: auto;
  object-fit: unset;
  display: block;
}

@media (max-width: 600px) {
  .photos-site .photo-section--centered .photo-rows {
    grid-template-columns: 1fr;
  }

  .photos-site .photo-section--centered .photo-section-header {
    padding: 1.5rem 1.25rem 1rem;
  }
}

/* Text-only section (e.g. "About this collection") */

.photo-section--text-only {
  padding: 3rem 3rem;
  border-top: 1px solid #e8e8e8;
  max-width: 52em;
  margin: 0 auto;
}

.photo-section--text-only .photo-section-title {
  margin-bottom: 0.75rem;
}

.photo-section--text-only .photo-section-description {
  font-size: 1rem;
}

/* ------- Photo justified-row layout ------- */

.photo-rows {
  padding: 0 4rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.photo-section-content .photo-rows {
  padding: 0 1rem;
}

.photo-row {
  display: flex;
  flex-direction: row;
  gap: 0;
  height: auto;
}

.photo-row--single {
  height: auto;
  justify-content: center;
  background: #fff;
}

/* At desktop, pair divs are transparent — children act as direct flex children of the quad row */
.photo-row--pair {
  display: contents;
}

/* Full-bleed row — breaks out of photo-rows padding to span edge-to-edge */
.photo-row--full {
  margin-left: -4rem;
  margin-right: -4rem;
}

.photos-site .photo-row--full .photo-item {
  padding: 0;
  flex: 1 !important;
}

.photo-section-content .photo-row--full {
  margin-left: -1rem;
  margin-right: -1rem;
}

.photo-row--single .photo-item {
  flex: 0 1 auto !important;
  max-width: 100%;
  overflow: visible;
}

.photo-row--single .photo-item img {
  width: auto;
  max-width: 100%;
  height: auto;
  object-fit: unset;
  display: block;
}

.photos-site .photo-item {
  flex-shrink: 1;
  padding: 0 0.5rem;
  /* flex-grow set per-photo via inline style proportional to aspect ratio */
}

.photos-site .photo-item img {
  display: block;
  width: 100%;
  max-width: 100%;
  height: auto;
  object-fit: unset;
  border: none;
  transition: opacity 0.15s ease;
}

.photos-site .photo-item img:hover {
  opacity: 0.92;
}


@media (max-width: 900px) {
  .photo-row--full {
    margin-left: -1rem;
    margin-right: -1rem;
  }

  /* quad rows: split into two proportional pairs — each pair uses natural flex-grow */
  .photo-row--quad {
    flex-direction: column;
    gap: 1rem;
  }
  .photo-row--pair {
    display: flex;
    flex-direction: row;
  }

  /* rows of 3, 2: no override — natural proportional flex-grow preserved */

  .photo-rows {
    padding: 0 1rem;
  }

  .photo-section-content {
    padding-left: 0;
    padding-right: 0;
  }
}

@media (max-width: 600px) {
  .photo-row--full {
    margin-left: 0;
    margin-right: 0;
  }

  .photo-row {
    flex-direction: column;
  }

  .photos-site .photo-item {
    flex: none !important;
    width: 100%;
  }

  .photo-rows {
    padding: 0;
    gap: 2px;
  }

  .photo-section-content {
    padding-left: 0;
    padding-right: 0;
  }

  .photo-section {
    padding: 2rem 0 0;
  }

  .photo-section-header {
    padding: 0 1.25rem;
  }

  .photo-section--text-only {
    padding: 2rem 1rem;
  }

  .photos-site .tmpl-photos {
    padding: 1.5rem 1rem 3rem;
  }

  .photos-site ul.photo-stories-grid {
    grid-template-columns: 1fr;
  }

  .photos-site .story-cover-overlay h1 {
    font-size: 1.8rem;
  }
}


/* ------- Story footer (back link + author) ------- */

.story-footer {
  padding: 3rem;
  border-top: 1px solid #e8e8e8;
  margin-top: 2rem;
  max-width: 52em;
}

.story-footer-back {
  display: inline-block;
  color: #555;
  text-decoration: none;
  font-family: laca, sans-serif;
  font-size: 0.85rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 2pt;
  font-style: italic;
  margin-bottom: 2.5rem;
}

.story-footer-back:hover {
  color: #111;
}

.story-footer-author {
  overflow: hidden;
  font-family: laca, sans-serif;
  font-weight: 300;
  font-size: 1rem;
  color: #333;
}

.story-footer-author img {
  float: left;
  margin: 0 2rem 1rem 0;
  max-width: 9rem;
  height: auto;
  border: none;
  padding: 0;
}

.story-footer-author h5 {
  font-family: laca, sans-serif;
  font-size: 0.85rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 2pt;
  font-style: italic;
  color: #888;
  margin: 0 0 0.5rem;
}

.story-footer-author p {
  font-size: 0.95rem;
  line-height: 1.6;
  color: #333;
  margin: 0 0 0.5rem;
  min-width: 0;
}

.story-footer-author a {
  color: #555;
}

.story-footer-author a:hover {
  color: #111;
}

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

.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.9);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.lightbox[hidden] {
  display: none;
}

.lightbox-stage {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  height: 100vh;
  min-width: 0;
}

.lightbox-stage img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  display: block;
  border: none;
}

.lightbox-close {
  position: absolute;
  top: 1.25rem;
  right: 1.5rem;
  background: none;
  border: none;
  color: #fff;
  font-size: 1.75rem;
  cursor: pointer;
  opacity: 0.6;
  line-height: 1;
  padding: 0.25rem 0.5rem;
}

.lightbox-close:hover {
  opacity: 1;
}

.lightbox-prev,
.lightbox-next {
  background: none;
  border: none;
  color: #fff;
  font-size: 4rem;
  cursor: pointer;
  opacity: 0.4;
  padding: 1rem;
  line-height: 1;
  flex-shrink: 0;
  user-select: none;
  transition: opacity 0.15s ease;
}

.lightbox-prev:hover,
.lightbox-next:hover {
  opacity: 1;
}

@media (max-width: 600px) {
  .lightbox-stage {
    padding: 3rem 0.25rem;
  }

  .lightbox-prev,
  .lightbox-next {
    font-size: 2.5rem;
    padding: 0.5rem;
  }
}
