*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:       #F5E4EB;
  --fg:       #111111;
  --fg-dim:   rgba(17, 17, 17, 0.38);
  --mono:     'Courier Prime', 'Courier New', Courier, monospace;
  --nav-h:    80px;
  --filter-h: 88px;
  --cols:     16;
  --gap:      3px;
}

html { background: var(--bg); color: var(--fg); }
body { font-family: var(--mono); overflow-x: hidden; }


/* ── Intro title overlay ───────────────────────────────────────
   Transparent background so the page shows through.
   The title uses a chromatic-aberration / anaglyph effect
   (overlapping red + blue ghost copies) for an old-film look.
────────────────────────────────────────────────────────────── */
#intro-overlay {
  position: fixed;
  inset: 0;
  z-index: 999;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: transparent;
  pointer-events: none;
  opacity: 1;
  transition: opacity 1.2s ease;
}

#intro-overlay.fade-out { opacity: 0; }

/*
  Three text layers via pseudo-elements:
    ::before  — red/magenta copy, offset left + down
    main text — dark ink, centre
    ::after   — cyan/blue copy, offset right + up

  mix-blend-mode: multiply blends against the white page so the
  colours deepen where they overlap, recreating the anaglyph look.
  The film-load keyframe adds a brief stutter like old film
  catching in a projector gate.
*/
#intro-title {
  position: relative;
  display: inline-block;
  font-family: 'Great Vibes', cursive;
  font-weight: 400;
  font-size: clamp(4.8rem, 16vw, 14rem);
  letter-spacing: normal;
  color: #FFF200;
  text-align: left;
  padding-left: 40px;
  animation: film-load 0.6s ease forwards;
}

#intro-title::before {
  content: attr(data-text);
  position: absolute;
  top: 0; left: 0;
  width: 100%;
  pointer-events: none;
  color: #000;
  transform: translate(4px, 4px);
  opacity: 0.45;
  z-index: -1;
}

/* Old-projector gate-catch: brief stutter on first appear */
@keyframes film-load {
  from { opacity: 0; }
  to   { opacity: 1; }
}


/* ── Nav ───────────────────────────────────────────────────── */
.project-nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--nav-h);
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  justify-content: space-between;
  padding: 28px 40px 0;
  z-index: 200;
  background: linear-gradient(to bottom, rgba(245,228,235,1) 0%, rgba(245,228,235,0.5) 50%, transparent 100%);
}

.brand {
  font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
  font-weight: 800;
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--fg);
  text-decoration: none;
}

.nav-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
}
.project-nav-links {
  display: flex;
  gap: 24px;
}
.project-nav-link {
  font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
  font-weight: 800;
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--fg-dim);
  text-decoration: none;
  transition: color 0.2s;
}
.project-nav-link:hover { color: var(--fg); }
.back-link {
  font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
  font-weight: 800;
  font-size: 0.6rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--fg-dim);
  text-decoration: none;
  transition: color 0.2s;
}
.back-link:hover { color: var(--fg); }


/* ── Project title header ──────────────────────────────────── */
.project-header {
  padding: calc(var(--nav-h) + 36px) 40px 32px;
}

.project-title {
  font-size: clamp(1rem, 2vw, 1.6rem);
  font-weight: 400;
  letter-spacing: 0.02em;
}


/* ── Filter bar ────────────────────────────────────────────── */
.filter-bar {
  position: fixed;
  top: var(--nav-h);
  left: 0;
  right: 0;
  height: var(--filter-h);
  z-index: 150;
  background: transparent;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 8px;
  padding: 0 40px;
}

.filter-row {
  display: flex;
  align-items: center;
  gap: 20px;
}

.filter-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-family: 'Times New Roman', 'Georgia', serif;
  font-weight: 200;
  font-style: italic;
  font-size: 0.9rem;
  letter-spacing: 0.06em;
  color: var(--fg-dim);
  padding: 4px 0;
  position: relative;
  transition: color 0.2s;
}

/* Underline indicator — invisible by default */
.filter-btn::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: var(--fg);
  transform: scaleX(0);
  transition: transform 0.2s ease;
}

.filter-btn:hover { color: var(--fg); }

/* Active state: full-width underline + dark text */
.filter-btn.active {
  color: var(--fg);
}
.filter-btn.active::after {
  transform: scaleX(1);
}


/* ── Sub-filter row ────────────────────────────────────────── */
.filter-sub {
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
}
.filter-sub-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-family: 'Times New Roman', 'Georgia', serif;
  font-weight: 200;
  font-style: italic;
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  color: var(--fg-dim);
  padding: 2px 0;
  transition: color 0.2s;
}
.filter-sub-btn:hover { color: var(--fg); }
.filter-sub-btn.active {
  color: var(--fg);
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 3px;
}


/* ── Photo grid ────────────────────────────────────────────── */
/*
  #photoGrid is a plain container — the CSS grid lives on
  .group-grid so it works both when photos are flat and when
  they're split into labelled groups.

  Each cell is square. Photos use object-fit: contain so they
  are never cropped:
    • Landscape → fills full width, white top/bottom
    • Portrait  → fills full height, white left/right
*/
#photoGrid {
  padding: calc(var(--nav-h) + var(--filter-h) + 16px) var(--gap) var(--gap);
}

.group-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr 0.8fr);
  gap: var(--gap);
}

.photo-group {
  margin-bottom: 48px;
}

.group-label {
  font-family: var(--mono);
  font-weight: 400;
  font-size: 0.9rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--fg);
  padding: 0 4px 14px;
}

.grid-cell {
  position: relative;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  cursor: pointer;
  background: transparent;
}

.grid-cell img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
  display: block;
  transition: opacity 0.25s;
}

.grid-cell:hover img { opacity: 0.80; }

.grid-cell--empty {
  cursor: default;
  pointer-events: none;
}
.grid-row-spacer {
  grid-column: 1 / -1;
  height: 0;
  padding-bottom: 5.556%; /* matches 0.8fr spacer-col fraction (0.8/14.4) */
  pointer-events: none;
}


/* ── Lightbox ──────────────────────────────────────────────── */
#lightbox {
  position: fixed;
  inset: 0;
  z-index: 500;
  background: rgba(0, 0, 0, 0.92);
  display: flex;
  flex-direction: column;
  align-items: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.28s ease;
}

#lightbox.active {
  opacity: 1;
  pointer-events: auto;
}

#lightbox img {
  max-width: 90vw;
  max-height: 90vh;
  object-fit: contain;
  display: block;
  user-select: none;
  pointer-events: none; /* clicks fall through to the zone divs */
}

/* Left / right invisible hit zones */
.lb-zone {
  position: absolute;
  top: 0; bottom: 0;
  width: 50%;
  cursor: pointer;
  z-index: 1;
}
#lb-prev { left: 0; }
#lb-next { right: 0; }

/* Arrow hints */
.lb-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  font-size: 1.6rem;
  color: rgba(255, 255, 255, 0.22);
  pointer-events: none;
  transition: color 0.2s;
  z-index: 2;
  line-height: 1;
}
#lb-arrow-left  { left: 22px; }
#lb-arrow-right { right: 22px; }

#lb-prev:hover ~ #lb-arrow-left,
#lb-next:hover ~ #lb-arrow-right { color: rgba(255, 255, 255, 0.65); }

/* Close button */
#lb-close {
  position: absolute;
  top: 24px; right: 28px;
  z-index: 2;
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.55);
  font-family: var(--mono);
  font-size: 0.65rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  cursor: pointer;
  padding: 8px 12px;
  transition: color 0.2s;
}
#lb-close:hover { color: #fff; }

/* Photo counter */
#lb-counter {
  position: absolute;
  bottom: 22px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.6rem;
  letter-spacing: 0.2em;
  color: rgba(255, 255, 255, 0.38);
  pointer-events: none;
  z-index: 2;
  white-space: nowrap;
}


/* ── Mobile ────────────────────────────────────────────────── */
@media (max-width: 900px) {
  :root { --cols: 8; }
  .group-grid { grid-template-columns: repeat(4, 1fr); }
  .grid-cell--empty { display: none; }
  .grid-row-spacer { display: none; }
}
@media (max-width: 500px) {
  :root { --cols: 4; }
  .group-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 600px) {
  .project-nav    { padding: 0 24px; }
  .project-header { padding: calc(var(--nav-h) + 20px) 24px 20px; }
  .filter-bar     { padding: 0 24px 20px; }
  #photoGrid      { padding: 0 var(--gap) var(--gap); }
}

/* ── Site credit ───────────────────────────────────────────── */
.site-credit {
  text-align: left;
  padding: 40px 20px 40px 40px;
  font-family: 'Times New Roman', 'Georgia', serif;
  font-weight: 200;
  font-style: italic;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  color: var(--fg);
  opacity: 0.45;
}
.site-credit a { color: inherit; text-decoration: underline; text-underline-offset: 3px; }

/* ── Page transition overlay ───────────────────────────────── */
#page-transition {
  position: fixed;
  inset: 0;
  background: #000;
  z-index: 9999;
  opacity: 1;
  pointer-events: none;
  transition: opacity 0.3s ease;
}
