/* Measured from 1:1 screenshots of the reference site (2497px and 3822px wide):
   the gallery always fills the page - side margins stay ~188px and the gap ~64px
   on wide screens, so only the pictures grow. Below ~2500px both shrink with the
   viewport. Tiles are 4:3. Header is 124px tall. */

:root {
  --accent: #b0323a;
  --sans: "Helvetica Neue", Helvetica, Arial, sans-serif;
  --menu-weight: 500;                        /* "light bold" – adjust here */
  --margin: min(7.5vw, 188px);       /* gallery: left and right margin */
  --gap: min(2.56vw, 64px);          /* gallery: space between pictures, both directions */
  --pad-l: min(2.65vw, 66px);        /* header: left edge of the title */
  --pad-r: min(2.85vw, 71px);        /* header: right edge of the menu */
}

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

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: #fff;
  color: #000;
  font-family: var(--sans);
}
body.lb-lock { overflow: hidden; }

a { color: inherit; text-decoration: none; }

/* ---------- Header ---------- */

.site-header {
  position: relative;
  height: 124px;
  padding: 38px 0 0 var(--pad-l);
}

.brand {
  display: flex;
  align-items: center;
  height: 36px;
}

.brand-title {
  font: 500 30px/36px "Oswald", "Arial Narrow", sans-serif;
}

.brand-sub {
  margin-left: 25px;
  padding-left: 24px;
  border-left: 1px solid #222;
  font: 300 16px/24px var(--sans);
  letter-spacing: 0.12em;
}

.nav {
  position: absolute;
  top: 40px;
  right: calc(var(--pad-r) + 59px);          /* leaves room for the Instagram icon */
  display: flex;
  gap: 29px;
  font: var(--menu-weight) 15px/38px var(--sans);
}
.nav a { transition: color 0.2s; }
.nav a:hover,
.nav a.active { color: var(--accent); }

.nav-toggle { display: none; }

.ig {
  position: absolute;
  top: 37px;
  right: calc(var(--pad-r) - 7px);
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  transition: color 0.2s;
}
.ig svg { width: 30px; height: 30px; }
.ig:hover { color: var(--accent); }
.ig:focus-visible { outline: 2px solid var(--accent); }

/* ---------- Grid ---------- */

.grid {
  margin: 0 var(--margin);
  padding-bottom: var(--gap);
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--gap);
}

.tile {
  position: relative;
  display: block;
  aspect-ratio: 4 / 3;
  background: #f1f1ef;               /* shown while the thumbnail loads */
  cursor: zoom-in;
  isolation: isolate;
  -webkit-tap-highlight-color: transparent;
}

.tile img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  backface-visibility: hidden;
  transition: transform 0.4s cubic-bezier(0.2, 0.7, 0.2, 1), opacity 0.5s ease;
}
.js .tile img { opacity: 0; }
.js .tile img.is-loaded { opacity: 1; }

/* The shadow sits on its own layer so only transform/opacity animate (no repaints). */
.tile::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.22);
  opacity: 0;
  transition: transform 0.4s cubic-bezier(0.2, 0.7, 0.2, 1), opacity 0.4s ease;
}

@media (hover: hover) {
  .tile:hover { z-index: 2; }
  .tile:hover img,
  .tile:hover::before { transform: scale(1.03); }
  .tile:hover::before { opacity: 1; }
}

.tile:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }

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

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  touch-action: none;
  overscroll-behavior: contain;
  background: rgba(255, 255, 255, 0.72);
  -webkit-backdrop-filter: blur(18px) grayscale(1);
  backdrop-filter: blur(18px) grayscale(1);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.35s ease, visibility 0s 0.35s;
}
.lightbox.is-open {
  opacity: 1;
  visibility: visible;
  transition: opacity 0.35s ease;
}

.lb-figure {
  margin: 0;
  padding: 0 4vw;
  display: flex;
  flex-direction: column;
  align-items: center;
  transform: scale(0.96);
  transition: transform 0.45s cubic-bezier(0.2, 0.7, 0.2, 1);
}
.is-open .lb-figure { transform: none; }

.lb-img {
  display: block;
  width: auto;
  height: auto;
  max-width: 92vw;
  max-height: 76vh;
  max-height: 76dvh;
  transition: opacity 0.25s ease;        /* zoom transform is set by lightbox.js */
  will-change: transform;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-user-drag: none;
  -webkit-touch-callout: none;
}

.lb-caption {
  margin-top: 5vh;
  font: 600 14px/1.3 var(--sans);
  text-align: center;
  transition: opacity 0.2s ease;
}
.is-zoomed .lb-caption { opacity: 0; }

.lb-btn {
  position: absolute;
  z-index: 3;                              /* stays above a zoomed picture */
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
}
.lb-btn svg { fill: none; stroke: #000; stroke-width: 1.2; }
.lb-btn:focus-visible { outline: 2px solid var(--accent); }

.lb-close { top: 14px; right: 16px; }
.lb-close svg { width: 24px; height: 24px; }

.lb-prev, .lb-next { top: 42%; transform: translateY(-50%); }
.lb-prev { left: 1vw; }
.lb-next { right: 1vw; }
.lb-prev svg, .lb-next svg { width: 14px; height: 28px; }

/* ---------- Responsive ---------- */

@media (max-width: 900px) {
  .grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 600px) {
  :root { --gap: 3.1vw; }

  .site-header { height: 66px; padding: 14px 24px 0 9px; }
  .brand { flex-direction: column; align-items: flex-start; height: auto; }
  .brand-title { font-size: 22px; line-height: 26px; }
  .brand-sub { margin: 0; padding: 0; border: 0; font-size: 13px; line-height: 16px; }

  .nav-toggle {
    position: absolute;
    top: 10px;
    right: 13px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    width: 44px;
    height: 44px;
    padding: 11px;
    border: 0;
    background: none;
    cursor: pointer;
  }
  .nav-toggle span { display: block; height: 2px; background: #000; }

  .nav {
    display: none;
    top: 66px;
    left: 0;
    right: 0;
    z-index: 20;
    flex-direction: column;
    gap: 0;
    padding: 4px 9px 14px;
    background: #fff;
    font-size: 17px;
    line-height: 40px;
  }
  .nav-open .nav { display: flex; }
  .ig { top: 10px; right: 57px; }

  .grid { margin: 0; grid-template-columns: 1fr; }
  .grid + .site-footer { padding-top: 22px; }

  .lb-figure { padding: 0; }
  .lb-img { max-width: 100vw; max-height: 70vh; max-height: 70dvh; }
  .lb-prev, .lb-next { display: none; }   /* swipe instead */
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0.01ms !important; }
}

/* ---------- Info page ---------- */

.info {
  width: min(913px, 90vw);
  margin: 86px auto 0;
  display: grid;
  grid-template-columns: 1fr 391px;
  column-gap: 58px;
  align-items: center;                 /* text sits beside the middle of the photo */
}

.info-text {
  font: 300 12px/19.5px var(--sans);
  letter-spacing: 0.09em;
}
.info-text p { margin: 0 0 19.5px; }
.info-text p:last-child { margin-bottom: 0; }
.info-text strong { font-weight: 500; }
.info-text a:hover { color: var(--accent); }

.info-photo {
  display: block;
  width: 100%;
  height: auto;                        /* keep the photo's own proportions */
}

.site-footer {
  padding: 0 0 56px;
  text-align: center;
  color: #aaa;
  font: 300 15px/15px var(--sans);
  letter-spacing: 0.1em;
}
.info + .site-footer { padding-top: 132px; }

@media (max-width: 820px) {
  .info { display: block; width: calc(100% - 38px); max-width: 560px; margin: 20px auto 0; }
  .info-text { font-size: 15px; line-height: 23px; letter-spacing: 0.05em; }
  .info-text p { margin-bottom: 23px; }
  .info-photo { margin-top: 10px; }
  .info + .site-footer { padding: 45px 0 40px; }
}

/* Phones & tablets: a clearly visible close button, always above the picture */
@media (max-width: 600px), (pointer: coarse) {
  .lb-close {
    top: max(12px, env(safe-area-inset-top));
    right: max(12px, env(safe-area-inset-right));
    width: 46px;
    height: 46px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.92);
    box-shadow: 0 1px 8px rgba(0, 0, 0, 0.3);
  }
  .lb-close svg { width: 18px; height: 18px; }
  .lb-caption { margin-top: 16px; padding: 0 18px; }
}
