/* Portfolio index — location mosaics (Style A / Rebecca mockup) */

.nsi-portfolio {
  background: #fff;
  color: var(--color-charcoal);
  padding: clamp(2.5rem, 6vh, 4rem) 0 clamp(3.5rem, 8vh, 5.5rem);
}

.nsi-portfolio__intro {
  max-width: 40rem;
  margin: 0 auto clamp(2.5rem, 6vh, 3.5rem);
  padding: 0 clamp(1.25rem, 4vw, 3rem);
  text-align: center;
}

.nsi-portfolio__title {
  margin: 0;
  font-family: var(--font-sans);
  font-weight: 500;
  font-size: clamp(1.15rem, 2vw, 1.45rem);
  letter-spacing: 0.28em;
  text-transform: uppercase;
  line-height: 1.2;
  color: var(--color-charcoal);
}

.nsi-portfolio__sections {
  display: flex;
  flex-direction: column;
  gap: clamp(3rem, 8vh, 5rem);
  max-width: 72rem;
  margin: 0 auto;
  padding: 0 clamp(1.25rem, 4vw, 3rem);
}

.nsi-portfolio__project {
  text-align: center;
}

.nsi-portfolio__location {
  margin: 0 0 1.35rem;
  font-family: var(--font-sans);
  font-weight: 500;
  font-size: clamp(0.78rem, 1.2vw, 0.92rem);
  letter-spacing: 0.22em;
  text-transform: uppercase;
  line-height: 1.3;
}

.nsi-portfolio__location a {
  color: inherit;
  text-decoration: none;
}

.nsi-portfolio__location a:hover,
.nsi-portfolio__location a:focus-visible {
  text-decoration: underline;
  text-underline-offset: 0.2em;
}

.nsi-portfolio__location::after {
  content: "";
  display: block;
  width: min(12rem, 40%);
  height: 1px;
  margin: 0.85rem auto 0;
  background: rgba(60, 56, 53, 0.28);
}

.nsi-portfolio__mosaic {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.45rem;
}

.nsi-portfolio__shot {
  display: block;
  position: relative;
  overflow: hidden;
  aspect-ratio: 1;
  background: rgba(60, 56, 53, 0.06);
}

.nsi-portfolio__shot img {
  position: absolute;
  inset: 0;
  width: 100% !important;
  height: 100% !important;
  max-width: none !important;
  object-fit: cover;
  display: block;
  transition: transform 0.7s var(--ease-out, ease);
}

.nsi-portfolio__shot:hover img,
.nsi-portfolio__shot:focus-visible img {
  transform: scale(1.03);
}

.nsi-portfolio__caption {
  margin: 1.5rem auto 0;
  max-width: 36rem;
  font-family: var(--font-display);
  font-style: italic;
  font-size: clamp(1rem, 1.4vw, 1.15rem);
  line-height: 1.55;
  color: rgba(60, 56, 53, 0.88);
}

.nsi-portfolio__empty {
  padding: 2rem clamp(1.5rem, 5vw, 4.5rem) 4rem;
  text-align: center;
  font-family: var(--font-display);
  font-style: italic;
  color: rgba(60, 56, 53, 0.72);
}

@media (max-width: 720px) {
  .nsi-portfolio__mosaic {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 420px) {
  .nsi-portfolio__mosaic {
    grid-template-columns: 1fr;
  }
}

/* —— Single project —— */
.nsi-project {
  background: var(--color-canvas);
  color: var(--color-ink, #1c1917);
}

.nsi-project__hero {
  position: relative;
  min-height: clamp(22rem, 48vw, 34rem);
  display: flex;
  align-items: flex-end;
  overflow: hidden;
  color: #ffffff;
}

.nsi-project__hero-media {
  position: absolute;
  inset: 0;
}

.nsi-project__hero-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.nsi-project__hero-veil {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    180deg,
    rgba(28, 25, 23, 0.15) 0%,
    rgba(28, 25, 23, 0.55) 100%
  );
}

.nsi-project__hero-meta {
  position: relative;
  z-index: 1;
  padding: clamp(2rem, 6vw, 4rem) clamp(1.5rem, 5vw, 4.5rem);
  max-width: 40rem;
}

.nsi-project__eyebrow {
  margin: 0 0 0.75rem;
  font-family: var(--font-sans);
  font-size: 0.6875rem;
  letter-spacing: 0.28em;
  text-transform: uppercase;
}

.nsi-project__title {
  margin: 0 0 0.85rem;
  font-family: var(--font-display);
  font-weight: 500;
  font-size: clamp(2.75rem, 7vw, 4.75rem);
  line-height: 0.98;
  letter-spacing: -0.02em;
}

.nsi-project__lede {
  margin: 0;
  font-family: var(--font-display);
  font-style: italic;
  font-size: clamp(1.05rem, 1.5vw, 1.25rem);
  line-height: 1.45;
  max-width: 34ch;
}

.nsi-project__toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem 1.75rem;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem clamp(1.5rem, 5vw, 4.5rem);
  border-bottom: 1px solid rgba(181, 154, 125, 0.22);
}

.nsi-project__back,
.nsi-project__pdf {
  font-family: var(--font-sans);
  font-size: 0.6875rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--color-ink, #1c1917);
  border-bottom: 1px solid rgba(28, 25, 23, 0.35);
  padding-bottom: 0.2rem;
}

.nsi-project__back:hover,
.nsi-project__pdf:hover {
  opacity: 0.75;
}

.nsi-project__gallery {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  grid-auto-rows: minmax(12rem, auto);
  gap: clamp(0.65rem, 1.4vw, 1.1rem);
  padding: clamp(1.75rem, 4vw, 3rem) clamp(1.25rem, 4vw, 3.5rem) clamp(3.5rem, 7vw, 5.5rem);
  max-width: 90rem;
  margin: 0 auto;
}

.nsi-project__shot {
  position: relative;
  margin: 0;
  overflow: hidden;
  background: #ebe4da;
  grid-column: span 6;
}

.nsi-project__shot--feature {
  grid-column: 1 / -1;
}

.nsi-project__shot--tall {
  grid-column: span 6;
}

.nsi-project__shot-link {
  position: relative;
  display: block;
  height: 100%;
  overflow: hidden;
  color: inherit;
  text-decoration: none;
  cursor: zoom-in;
}

.nsi-project__shot img {
  width: 100%;
  height: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  object-position: center;
  display: block;
  transition: transform 0.6s cubic-bezier(0.22, 1, 0.36, 1);
}

.nsi-project__shot--feature img {
  aspect-ratio: 21 / 10;
  min-height: clamp(16rem, 42vw, 28rem);
}

.nsi-project__shot--tall img {
  aspect-ratio: 4 / 5;
  min-height: clamp(18rem, 36vw, 26rem);
}

.nsi-project__zoom {
  position: absolute;
  inset: auto 1rem 1rem auto;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 999px;
  background: rgba(250, 248, 244, 0.92);
  opacity: 0;
  transform: scale(0.9);
  transition: opacity 0.25s ease, transform 0.25s ease;
  pointer-events: none;
}

.nsi-project__zoom::before,
.nsi-project__zoom::after {
  content: "";
  position: absolute;
  background: #1c1917;
}

.nsi-project__zoom::before {
  width: 12px;
  height: 1px;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
}

.nsi-project__zoom::after {
  width: 1px;
  height: 12px;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
}

.nsi-project__shot-link:hover img,
.nsi-project__shot-link:focus-visible img {
  transform: scale(1.04);
}

.nsi-project__shot-link:hover .nsi-project__zoom,
.nsi-project__shot-link:focus-visible .nsi-project__zoom {
  opacity: 1;
  transform: scale(1);
}

.nsi-project__shot figcaption {
  padding: 0.7rem 0.15rem 0;
  font-family: var(--font-sans);
  font-size: 0.6875rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--color-muted, #78716c);
}

.nsi-project__content {
  max-width: 42rem;
  margin: 0 auto;
  padding: 0 clamp(1.5rem, 5vw, 4.5rem) clamp(3rem, 6vw, 5rem);
  font-family: var(--font-display);
  font-size: 1.1rem;
  line-height: 1.65;
}

/* Lightbox */
.nsi-lightbox-open,
.nsi-lightbox-open body {
  overflow: hidden;
}

.nsi-lightbox {
  position: fixed;
  inset: 0;
  z-index: 100000;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  grid-template-rows: auto 1fr auto;
  align-items: center;
  justify-items: center;
  gap: 0.5rem 0.75rem;
  padding: 1rem;
  background: rgba(18, 16, 14, 0.92);
  backdrop-filter: blur(6px);
}

.nsi-lightbox[hidden] {
  display: none !important;
}

.nsi-lightbox__close {
  grid-column: 3;
  grid-row: 1;
  justify-self: end;
  appearance: none;
  border: 0;
  background: transparent;
  color: #faf8f4;
  font-size: 2rem;
  line-height: 1;
  cursor: pointer;
  padding: 0.35rem 0.6rem;
}

.nsi-lightbox__figure {
  grid-column: 2;
  grid-row: 2;
  margin: 0;
  max-width: min(96vw, 1200px);
  max-height: calc(100vh - 7rem);
  display: flex;
  flex-direction: column;
  align-items: center;
}

.nsi-lightbox__img {
  display: block;
  max-width: 100%;
  max-height: calc(100vh - 9rem);
  width: auto;
  height: auto;
  object-fit: contain;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.35);
}

.nsi-lightbox__cap {
  margin-top: 0.85rem;
  font-family: var(--font-sans);
  font-size: 0.72rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: rgba(250, 248, 244, 0.78);
  text-align: center;
}

.nsi-lightbox__nav {
  grid-row: 2;
  appearance: none;
  border: 0;
  background: rgba(250, 248, 244, 0.08);
  color: #faf8f4;
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 999px;
  font-size: 1.75rem;
  line-height: 1;
  cursor: pointer;
}

.nsi-lightbox__nav--prev {
  grid-column: 1;
}

.nsi-lightbox__nav--next {
  grid-column: 3;
}

.nsi-lightbox__count {
  grid-column: 1 / -1;
  grid-row: 3;
  margin: 0;
  font-family: var(--font-sans);
  font-size: 0.7rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgba(250, 248, 244, 0.65);
}

@media (max-width: 767px) {
  .nsi-project__gallery {
    grid-template-columns: 1fr;
    gap: 0.85rem;
  }

  .nsi-project__shot,
  .nsi-project__shot--feature,
  .nsi-project__shot--tall {
    grid-column: 1 / -1;
  }

  .nsi-project__shot img,
  .nsi-project__shot--feature img,
  .nsi-project__shot--tall img {
    aspect-ratio: 4 / 3;
    min-height: 0;
  }

  .nsi-lightbox {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr auto auto;
  }

  .nsi-lightbox__close {
    grid-column: 1;
  }

  .nsi-lightbox__figure {
    grid-column: 1;
  }

  .nsi-lightbox__nav {
    grid-row: 3;
  }

  .nsi-lightbox__nav--prev {
    grid-column: 1;
    justify-self: start;
  }

  .nsi-lightbox__nav--next {
    grid-column: 1;
    justify-self: end;
    grid-row: 3;
  }

  .nsi-lightbox__count {
    grid-row: 4;
  }
}

@media (max-width: 899px) {
  .nsi-portfolio__grid {
    grid-template-columns: 1fr;
  }

  .nsi-portfolio .chapter {
    min-height: clamp(20rem, 62vw, 26rem);
  }

  .nsi-portfolio .chapter__meta {
    max-width: none;
    width: 100%;
    justify-content: flex-end;
    padding-bottom: clamp(1.75rem, 5vh, 2.5rem);
    background: linear-gradient(
      180deg,
      transparent 0%,
      rgba(28, 25, 23, 0.45) 100%
    );
  }

  .nsi-portfolio .chapter__veil {
    background: linear-gradient(
      180deg,
      rgba(28, 25, 23, 0.12) 0%,
      rgba(28, 25, 23, 0.35) 100%
    );
  }
}
