/* ===== Shared styles for gallery pages ===== */
:root {
  --bg:        #FFFFFF;
  --ink:       #0E0E0F;
  --muted:     #8A8A8A;
  --hairline:  rgba(14, 14, 15, 0.10);
  --hairline-strong: rgba(14, 14, 15, 0.18);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { background: var(--bg); color: var(--ink); }
html { scroll-behavior: smooth; }
body {
  font-family: 'Inter', system-ui, sans-serif;
  font-weight: 400; line-height: 1.55;
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}
a { color: inherit; text-decoration: none; }
button { background: none; border: 0; color: inherit; font: inherit; cursor: pointer; padding: 0; }
img { display: block; max-width: 100%; }

/* ===== NAV (same as index) ===== */
.nav {
  position: fixed; inset: 0 0 auto 0; z-index: 50;
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 24px;
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: saturate(140%) blur(14px);
  -webkit-backdrop-filter: saturate(140%) blur(14px);
  border-bottom: 1px solid var(--hairline);
}
.brand {
  font-size: 12px; letter-spacing: 0.24em; font-weight: 500; text-transform: uppercase;
  display: inline-flex; align-items: center; color: var(--ink);
}
.brand .sep { width: 4px; height: 4px; border-radius: 50%; background: currentColor; margin: 0 8px; transform: translateY(-1px); }
.menu-btn {
  font-size: 12px; letter-spacing: 0.24em; text-transform: uppercase; font-weight: 500;
  display: inline-flex; align-items: center; gap: 12px; color: var(--ink); padding: 6px 0;
}
.menu-btn .bars { display: inline-flex; flex-direction: column; gap: 4px; width: 22px; height: 12px; justify-content: center; }
.menu-btn .bars span { display: block; height: 1px; background: currentColor; width: 22px; transition: width 380ms cubic-bezier(.2,.7,.2,1); }
.menu-btn:hover .bars span:nth-child(2) { width: 14px; }

/* ===== MENU OVERLAY ===== */
.menu {
  position: fixed; inset: 0; z-index: 100;
  background: var(--bg); color: var(--ink);
  opacity: 0; visibility: hidden;
  transition: opacity 420ms cubic-bezier(.2,.7,.2,1), visibility 0s linear 420ms;
  display: grid; grid-template-rows: auto 1fr auto;
}
.menu.open {
  opacity: 1; visibility: visible;
  transition: opacity 420ms cubic-bezier(.2,.7,.2,1), visibility 0s linear 0s;
}
.menu-head { display: flex; align-items: center; justify-content: space-between; padding: 22px 32px; border-bottom: 1px solid var(--hairline); }
.menu-close { font-size: 12px; letter-spacing: 0.24em; text-transform: uppercase; font-weight: 500; display: inline-flex; align-items: center; gap: 10px; color: var(--ink); }
.menu-close svg { width: 12px; height: 12px; }
.menu-list { align-self: center; padding: 40px 32px; display: grid; gap: 14px; }
.menu-list a {
  font-family: 'Mulish', system-ui, sans-serif;
  font-size: clamp(28px, 5.4vw, 64px); font-weight: 400; letter-spacing: 0.05em; line-height: 1.05;
  display: flex; align-items: baseline; gap: 22px; padding: 14px 0;
  border-bottom: 1px solid var(--hairline);
  transition: transform 380ms cubic-bezier(.2,.7,.2,1), color 280ms ease;
  transform-origin: left center;
  text-transform: uppercase;
}
.menu-list a .num { font-size: 12px; letter-spacing: 0.24em; color: var(--muted); font-weight: 500; text-transform: uppercase; transform: translateY(-0.55em); }
.menu-list a:hover { transform: translateX(12px); }
.menu-list a:hover .num { color: var(--ink); }
.menu-list a[aria-current="page"] { color: var(--muted); }
.menu-list a[aria-current="page"]::after { content: '— current'; font-size: 12px; letter-spacing: 0.24em; color: var(--muted); margin-left: auto; font-weight: 500; text-transform: uppercase; transform: translateY(-0.6em); }
.menu-foot { padding: 22px 32px; display: flex; justify-content: space-between; align-items: center; border-top: 1px solid var(--hairline); font-size: 11px; letter-spacing: 0.24em; text-transform: uppercase; color: var(--muted); }
.menu-foot a { color: var(--ink); }
.menu .menu-list a { opacity: 0; transform: translateY(20px); transition: opacity 480ms cubic-bezier(.2,.7,.2,1), transform 520ms cubic-bezier(.2,.7,.2,1), color 280ms ease; }
.menu.open .menu-list a { opacity: 1; transform: translateY(0); }
.menu.open .menu-list a:nth-child(1) { transition-delay: 100ms, 100ms, 0s; }
.menu.open .menu-list a:nth-child(2) { transition-delay: 180ms, 180ms, 0s; }
.menu.open .menu-list a:nth-child(3) { transition-delay: 260ms, 260ms, 0s; }
.menu.open .menu-list a:nth-child(4) { transition-delay: 340ms, 340ms, 0s; }

/* ===== PAGE HEADER ===== */
.page-head {
  padding: 130px 32px 56px;
  border-bottom: 1px solid var(--hairline);
  max-width: 1200px;
  margin: 0 auto;
}
.page-head .crumb { font-size: 11px; letter-spacing: 0.26em; text-transform: uppercase; color: var(--muted); margin-bottom: 22px; }
.page-head .crumb a { color: var(--muted); transition: color 240ms ease; }
.page-head .crumb a:hover { color: var(--ink); }
.page-head h1 {
  font-family: 'Mulish', system-ui, sans-serif;
  font-size: clamp(32px, 5.4vw, 76px);
  font-weight: 400; letter-spacing: 0.05em; line-height: 1.05;
  margin-bottom: 24px;
  text-transform: uppercase;
}
.page-head .lede {
  color: var(--muted);
  font-size: 15px;
  line-height: 1.65;
  max-width: 60ch;
}

/* ===== GALLERY GRID ===== */
.gallery { padding: 64px 32px 80px; max-width: 1200px; margin: 0 auto; }
.gallery-section { margin-bottom: 88px; }
.gallery-section:last-child { margin-bottom: 0; }
.gallery-section h2 {
  font-size: 12px; letter-spacing: 0.26em; text-transform: uppercase; color: var(--muted);
  margin-bottom: 24px; font-weight: 500;
  display: flex; align-items: center; gap: 16px;
}
.gallery-section h2::after { content: ''; flex: 1; height: 1px; background: var(--hairline); }

.grid { display: grid; gap: 16px; }
.grid.cols-1 { grid-template-columns: 1fr; }
.grid.cols-2 { grid-template-columns: repeat(2, 1fr); }
.grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.grid.cols-4 { grid-template-columns: repeat(4, 1fr); }

.tile {
  position: relative; cursor: zoom-in; overflow: hidden;
  background: #f6f6f6;
  transition: transform 360ms cubic-bezier(.2,.7,.2,1), box-shadow 360ms cubic-bezier(.2,.7,.2,1);
}
.tile img {
  width: 100%; height: 100%; object-fit: cover; display: block;
  transition: transform 1100ms cubic-bezier(.2,.7,.2,1), opacity 700ms ease;
}
.tile:hover img { transform: scale(1.025); }
.tile:focus-visible { outline: 1px solid var(--ink); outline-offset: 4px; }
.tile.tall { aspect-ratio: 3 / 4; }
.tile.wide { aspect-ratio: 16 / 9; }
.tile.square { aspect-ratio: 1 / 1; }
.tile.full { aspect-ratio: 4 / 3; }
.tile.portrait { aspect-ratio: 2 / 3; }

/* Uncropped image — shown whole and centred (maps, diagrams, plans) */
.tile.whole {
  aspect-ratio: auto;
  background: transparent;
  display: grid;
  place-items: center;
  overflow: visible;
}
.tile.whole img {
  width: auto; height: auto;
  max-width: 100%;
  max-height: 82vh;
  object-fit: contain;
}
.tile.whole:hover img { transform: none; }
/* Whole image that fills the column width (no height cap) */
.tile.whole.fill img {
  max-width: 100%;
  max-height: none;
}

/* Vertical stack inside a grid cell (e.g. two images on one side) */
.stack-v { display: flex; flex-direction: column; gap: 16px; }
.stack-v .tile { flex: 1; }


/* ===== LIGHTBOX ===== */
.lightbox {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(8, 8, 9, 0.96);
  display: flex; align-items: center; justify-content: center;
  padding: 40px 90px;
  overflow: hidden;
  opacity: 0; visibility: hidden;
  transition: opacity 320ms ease, visibility 0s linear 320ms;
}
.lightbox.open {
  opacity: 1; visibility: visible;
  transition: opacity 320ms ease, visibility 0s linear 0s;
}
.lightbox img {
  display: block;
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  box-shadow: 0 30px 80px -30px rgba(0,0,0,0.6);
  cursor: zoom-in;
  transform: scale(0.96);
  transition: transform 480ms cubic-bezier(.2,.7,.2,1);
  user-select: none;
  -webkit-user-select: none;
  touch-action: none; /* JS handles pan/pinch */
}
.lightbox.open img { transform: scale(1); }
.lightbox.zoom img { cursor: grab; transition: none; }
.lightbox.zoom img.dragging { cursor: grabbing; }

/* Zoom controls */
.lb-zoom {
  position: absolute;
  bottom: 24px;
  right: 24px;
  display: flex;
  gap: 8px;
  z-index: 5;
}
.lb-zoom button {
  color: #fff;
  border: 1px solid rgba(255,255,255,0.35);
  border-radius: 999px;
  width: 38px; height: 38px;
  display: grid; place-items: center;
  font-size: 16px;
  font-weight: 400;
  background: rgba(0,0,0,0.3);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  transition: background 240ms ease, border-color 240ms ease;
}
.lb-zoom button:hover { background: rgba(255,255,255,0.14); border-color: #fff; }
.lb-zoom button:focus-visible { outline: 1px solid #fff; outline-offset: 3px; }
.lb-zoom .reset { display: none; }
.lightbox.zoom .lb-zoom .reset { display: grid; }
.lightbox.zoom .lb-zoom .zoom-in { display: none; }

.lb-close, .lb-prev, .lb-next {
  position: absolute;
  color: #fff;
  border: 1px solid rgba(255,255,255,0.35);
  border-radius: 999px;
  width: 44px; height: 44px;
  display: grid; place-items: center;
  transition: background 240ms ease, border-color 240ms ease, transform 240ms cubic-bezier(.2,.7,.2,1);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.lb-close:hover, .lb-prev:hover, .lb-next:hover { background: rgba(255,255,255,0.12); border-color: #fff; }
.lb-close { top: 24px; right: 24px; }
.lb-prev  { left: 24px; top: 50%; transform: translateY(-50%); }
.lb-next  { right: 24px; top: 50%; transform: translateY(-50%); }
.lb-prev:hover { transform: translateY(-50%) translateX(-2px); }
.lb-next:hover { transform: translateY(-50%) translateX(2px); }
.lb-count {
  position: absolute; bottom: 32px; left: 24px;
  color: rgba(255,255,255,0.7);
  font-size: 11px; letter-spacing: 0.24em; text-transform: uppercase; font-weight: 500;
  z-index: 5;
}

/* ===== PAGE FOOTER (next/prev project) ===== */
.next-block {
  padding: 80px 32px;
  border-top: 1px solid var(--hairline);
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 24px;
}
.next-block .label { font-family: 'Mulish', system-ui, sans-serif; font-size: 11px; letter-spacing: 0.26em; text-transform: uppercase; color: var(--muted); margin-bottom: 10px; }
.next-block .next-title {
  font-family: 'Mulish', system-ui, sans-serif;
  font-size: clamp(22px, 3.4vw, 40px);
  font-weight: 400;
  letter-spacing: 0.05em;
  line-height: 1.05;
  text-transform: uppercase;
}
.next-block .arrow {
  display: inline-flex; align-items: center; gap: 14px;
  font-size: 11px; letter-spacing: 0.24em; text-transform: uppercase; font-weight: 500;
}
.next-block .arrow svg { transition: transform 380ms cubic-bezier(.2,.7,.2,1); }
.next-block a:hover .arrow svg { transform: translateX(6px); }

footer.site {
  padding: 28px 32px 28px;
  border-top: 1px solid var(--hairline);
  display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 16px;
  color: var(--muted);
  font-size: 11px; letter-spacing: 0.24em; text-transform: uppercase;
}
footer.site a { color: var(--ink); }

/* ===== ANIM ===== */
.fade { opacity: 0; transform: translateY(16px); transition: opacity 700ms cubic-bezier(.2,.7,.2,1), transform 800ms cubic-bezier(.2,.7,.2,1); }
.fade.in { opacity: 1; transform: translateY(0); }

@media (max-width: 900px) {
  .grid.cols-3, .grid.cols-4 { grid-template-columns: repeat(2, 1fr); }
  .page-head { grid-template-columns: 1fr; padding: 120px 22px 48px; }
  .page-head .lede { text-align: left; max-width: none; }
  .gallery { padding: 48px 22px 64px; }
  .next-block { padding: 56px 22px; }
  footer.site { padding: 24px 22px; }
  .nav { padding: 18px 20px; }
}
@media (max-width: 600px) {
  .grid.cols-3, .grid.cols-4, .grid.cols-2 { grid-template-columns: 1fr; }
  .lightbox { padding: 24px; }
  .lb-prev, .lb-next, .lb-close { width: 38px; height: 38px; }
  .lb-prev { left: 12px; } .lb-next { right: 12px; } .lb-close { top: 12px; right: 12px; }
}
