:root {
  --bg: #F8F9F8;
  --ink: #000000;
  --accent: #000000;
  --line: rgba(0, 0, 0, 0.14);
  --muted: #000000;
  --font-display: 'Work Sans', Helvetica, Arial, sans-serif;
  --font-body: 'Work Sans', Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }

/* Phones: keep text at the size set here (iPhones otherwise enlarge it when turned sideways) */
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-weight: 300;
  font-size: calc(16px - 0.5pt);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

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

/* Keep the bottom nav at the bottom of the screen on pages shorter than the window */
#site-content {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100svh;   /* phones: the visible screen height, not counting the browser's toolbars */
}

#site-content > main { flex: 1 0 auto; }

/* ---------- Site bar (bottom nav + contact) ---------- */
.site-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 14px;
  padding: 24px 40px;
}

.site-nav, .site-contact { display: flex; gap: 22px; flex-wrap: wrap; }

.site-bar a {
  font-size: calc(11px - 0.5pt);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink);
  padding-bottom: 2px;
  border-bottom: 1px solid transparent;
  transition: opacity 0.2s ease, border-color 0.2s ease;
}

.site-bar a:hover { opacity: 0.55; }

.site-bar a.active { border-bottom-color: var(--ink); }

.site-bar .copyright {
  font-size: calc(11px - 0.5pt);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink);
}

/* ---------- Logo (top left, every page except home) ---------- */
.site-logo {
  position: absolute;
  top: 28px;
  left: 40px;
  z-index: 20;
  display: block;
  line-height: 0;
  transition: opacity 0.2s ease;
}

.site-logo:hover { opacity: 0.55; }

/* Letter height = 3x the capital-letter height of the bottom nav text
   (nav text is 11px - 0.5pt; Work Sans capitals are 0.66 of the font size) */
.site-logo img {
  display: block;
  height: calc((11px - 0.5pt) * 0.66 * 3);
  width: auto;
}

/* ---------- Home gallery ---------- */
.page-home { overflow: hidden; }

.reel {
  position: fixed;
  inset: 0;
  display: block;
  overflow: hidden;
  cursor: pointer;
  background: var(--bg);
}

.reel-frame {
  position: absolute;
  top: 50%;
  left: 50%;
  /* Frames are centred on the screen, so the logo (at the exact centre of every frame) is too.
     Size: the full width, unless the window is short. Then the frame shrinks so the photos
     (which reach down to 92% of the frame's height) always end above the nav bar. */
  width: min(100vw, calc(100vh * 16 / 9), calc((50vh - 68px) * 4.2));
  height: auto;
  transform: translate(-50%, -50%);
  visibility: hidden;
  user-select: none;
  -webkit-user-drag: none;
  /* JPGs can't hold #F8F9F8 exactly (their flat areas come out one shade lighter),
     so each frame takes the darker of itself and the page: its edges land exactly on the page colour */
  mix-blend-mode: darken;
}

.reel-frame.is-active { visibility: visible; }

.page-home .site-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 10;
}

/* ---------- Projects ---------- */
/* Photo height in the rows: grows with the window, but stays short enough
   for all four rows to fit on a laptop screen */
main.projects {
  --thumb-h: clamp(72px, min(8vw, 11vh), 170px);
  min-height: calc(100vh - 70px);
  min-height: calc(100svh - 70px);
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: calc(var(--thumb-h) * 0.85);   /* space between the four rows */
  padding: 80px 40px 56px;
}

/* Each row runs edge to edge: photos keep their shapes, and the gaps holding
   the project name, location and year share out the remaining width */
.project-row {
  display: flex;
  align-items: center;
}

.thumb-pair {
  display: flex;
  gap: clamp(8px, 1.1vw, 20px);
}

.project-label {
  flex: 1 1 auto;
  margin: 0;
  padding: 0 24px;
  text-align: center;
  white-space: nowrap;
  font-size: calc(11px - 0.5pt);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  line-height: 1.75;
  color: var(--ink);
}

/* Tablets and phones: the photos spread evenly across the full width (first on the left
   margin, last on the right), and the name, location and year spread the same way underneath */
@media (max-width: 899px) {
  main.projects { --thumb-h: clamp(64px, 14vw, 110px); }
  .project-row { flex-wrap: wrap; justify-content: space-between; gap: 8px; }
  .thumb-pair { display: contents; }
  .project-row::before { content: ""; order: 1; flex-basis: 100%; height: 0; }
  .project-label { order: 2; flex: 0 0 auto; padding: 0; text-align: left; }
  .project-label--year { display: none; }   /* name on the left, location on the right; the year stays in the caption */
}

.project-thumb {
  display: block;
  padding: 0;
  margin: 0;
  border: none;
  background: none;
  cursor: zoom-in;
}

.project-thumb:focus-visible { outline: 1px solid var(--ink); outline-offset: 3px; }

/* Thumbnails sit in black and white at 85% opacity; full color on hover */
.project-thumb img {
  display: block;
  height: var(--thumb-h, clamp(64px, 7.2vw, 112px));
  width: auto;
  filter: grayscale(1);
  opacity: 0.85;
  transition: filter 0.3s ease, opacity 0.3s ease;
}

/* Pointing at any photo lights up that project's whole row in color
   (the per-photo rule stays as a fallback for older browsers) */
.project-row:has(.project-thumb:hover) .project-thumb img,
.project-row:has(.project-thumb:focus-visible) .project-thumb img,
.project-thumb:hover img,
.project-thumb:focus-visible img {
  filter: none;
  opacity: 1;
}

.hero-frame {
  width: 100%;
  max-width: 258px;
  aspect-ratio: 2 / 3;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: calc(12px - 0.5pt);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-align: center;
  line-height: 1.8;
  background: repeating-linear-gradient(135deg, transparent, transparent 10px, rgba(0,0,0,0.03) 10px, rgba(0,0,0,0.03) 11px);
}

.hero-frame img { width: 100%; height: 100%; object-fit: cover; display: block; }

.page-photo {
  margin: 0 auto 40px;
}

.project-description {
  text-align: center;
  max-width: 462px;
  margin: 0 auto 60px;
}

.project-description p {
  font-size: calc(11px - 0.5pt);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink);
  line-height: 1.75;
  margin: 0 0 20px;
}

.project-description p:last-child { margin-bottom: 0; }

.project-description .project-credit {
  font-style: italic;
  font-size: calc(11px - 2pt);
  margin-top: 32px;
}

.project-gallery {
  width: 768px;
  max-width: calc(100vw - 48px);
  position: relative;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.gallery-row {
  display: flex;
  gap: 24px;
}

.gallery-cell {
  flex: 1;
  overflow: hidden;
}

.gallery-cell img { width: 100%; height: 100%; object-fit: cover; display: block; }

.gallery-row--full .gallery-cell { aspect-ratio: 4 / 3; }
.gallery-row--pair .gallery-cell { aspect-ratio: 3 / 4; }

/* ---------- About & Press ---------- */
main.page {
  width: 100%;
  max-width: 640px;
  margin: 0 auto;
  padding: max(88px, calc(50vh - 265px)) 48px 96px;
}

main.page h1 {
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 300;
  font-size: calc(34px - 0.5pt);
  margin: 0 0 28px;
}

main.page h1.page-title {
  font-family: var(--font-body);
  font-style: normal;
  font-weight: 400;
  font-size: 12pt;
  text-transform: uppercase;
  letter-spacing: 0.075em;
  text-align: center;
}

.bio {
  max-width: 462px;
  margin: 0 auto;
}

.bio p {
  margin: 0 0 20px;
  color: var(--ink);
  font-size: calc(11px - 0.5pt);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  text-align: left;
  line-height: 1.75;
}

.about-contact {
  display: flex;
  justify-content: flex-start;   /* email lines up on the left with the text, on phones too */
  gap: 48px;
  margin-top: 0;      /* email sits on the line right after "To inquire…" */
  line-height: 1.75;  /* same line spacing as the text above */
}

/* "To inquire…" gets the extra space above it instead of below */
.bio p.bio-inquire { margin-top: 45px; margin-bottom: 0; }

.about-contact a {
  font-size: calc(11px - 0.5pt);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink);
  padding-bottom: 2px;
  border-bottom: 1px solid transparent;
  transition: opacity 0.2s ease, border-color 0.2s ease;
}

.about-contact a:hover { opacity: 0.55; }

/* Selected Clients list — same type as the bio, heading in Regular */
.about-clients { margin-top: 45px; }

.about-clients h2,
.about-clients li,
.press-heading {
  margin: 0;
  font-size: calc(11px - 0.5pt);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  line-height: 1.75;
  color: var(--ink);
}

.about-clients h2,
.press-heading { font-weight: 400; margin-bottom: 20px; }   /* Press page title matches "Selected Clients" */

/* "Audrey Hughes" at the start of the bio, in the same Regular weight as "Selected Clients" */
.bio strong { font-weight: 400; }

/* About page portrait at 85% opacity */
main.page--about .page-photo img { opacity: 0.85; }
main.page--press .page-photo img,
main.page--contact .page-photo img { filter: grayscale(1); }   /* Press and Contact photos always show in black and white, like the portrait */

/* Trace paper panel behind the photo (About and Press), offset up and to the right like the home gallery panels.
   The paper image is already semi-transparent, the same sheet the home page uses.
   Sizes are relative to the photo (258 x 387): panel is about 281 x 374, shifted 128px right and 42px up. */
main.page--about .page-photo {
  position: relative;
  z-index: 0;
  background: none;
}

main.page--about .page-photo::before {
  content: "";
  position: absolute;
  z-index: -1;
  left: 49.6%;
  top: -10.85%;
  width: 108.8%;
  height: 96.6%;
  background: url("images/trace-paper.png") center / cover;
}

/* Text sits on top of the part of the panel that sticks out */
main.page--about .page-body,
main.page--about .about-clients {
  position: relative;
  z-index: 1;
}

.about-clients ul { list-style: none; margin: 0; padding: 0; }

/* About page on computers: everything lines up on the left edge, with the logo and nav */
@media (min-width: 641px) {
  main.page--about {
    max-width: none;
    margin: 0;
    padding-top: max(144px, calc(50vh - 265px));   /* keeps the grey panel clear of the logo on short windows */
    padding-left: 40px;
    padding-right: 40px;
    padding-bottom: 56px;   /* with Selected Clients below the text, keeps the page on one laptop screen */
  }
  main.page--about .page-photo { margin: 0 0 40px; }
  main.page--about .bio { margin: 0; }
  main.page--about .about-contact { justify-content: flex-start; }
}

/* Wider screens: text sits to the right of the portrait, both starting at the same top line */
@media (min-width: 900px) {
  main.page--about {
    display: grid;
    grid-template-columns: 258px 462px;
    column-gap: 48px;
    row-gap: 45px;
    align-items: start;
    align-content: start;   /* rows keep their 45px spacing even when the window is tall */
  }
  /* the photo spans both rows, so Clients always sits 45px below the text, however tall the photo is */
  main.page--about .page-photo { margin: 0; grid-row: 1 / span 2; }
  main.page--about .about-clients { grid-column: 2; grid-row: 2; margin-top: 0; }
}

.meta-block {
  margin-top: 40px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
  font-size: calc(13px - 0.5pt);
  letter-spacing: 0.04em;
  color: var(--muted);
  line-height: 2;
}

.meta-block a { color: var(--ink); border-bottom: 1px solid var(--accent); }

.press-entries { margin: 0; max-width: 462px; }   /* same column width as the About text */

.press-entry {
  margin: 0 0 20px;
  color: var(--ink);
  font-size: calc(11px - 0.5pt);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  text-align: left;
  line-height: 1.75;
}

.press-entry a {
  color: var(--ink);
  padding-bottom: 1px;
  border-bottom: 1px solid transparent;
  transition: opacity 0.2s ease, border-color 0.2s ease;
}

.press-entry a:hover { opacity: 0.55; border-bottom-color: var(--ink); }

/* ---------- Lightbox ---------- */
.lightbox-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(248, 249, 248, 0.9);   /* the site background (#F8F9F8) at 90% */
  -webkit-backdrop-filter: blur(12px);     /* blurs the page behind the off-white layer */
  backdrop-filter: blur(12px);
  align-items: center;
  justify-content: center;
  z-index: 999;
  cursor: zoom-out;
}

.lightbox-overlay.open { display: flex; }

.lightbox-overlay img {
  max-width: 80vw;
  max-height: 80vh;
  object-fit: contain;
  cursor: default;
}

.lightbox-overlay--large img {
  max-width: 90vw;
  max-height: 90vh;
}

/* Projects page: project details sit just to the right of the enlarged image,
   level with its top edge, with the "next" arrow in the gap between them.
   The right padding keeps room for the details; the left padding for the "previous" arrow. */
.lightbox-overlay--captioned.open {
  padding: 0 312px 0 80px;
}

.lightbox-figure {
  position: relative;
  margin: 0;
}

.lightbox-media { position: relative; }

.lightbox-overlay--captioned img {
  display: block;
  max-width: calc(100vw - 392px);
  max-height: 90vh;
}

/* Gallery arrows: thin chevrons halfway down either side of the image,
   32px from its edge (the same gap as the caption). Hidden for single images. */
.lightbox-nav {
  display: none;
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  margin: 0;
  padding: 14px 12px;
  border: 0;
  background: none;
  color: var(--ink);
  line-height: 0;
  cursor: pointer;
}

.lightbox-overlay.has-nav .lightbox-nav { display: block; }
.lightbox-overlay.has-nav .lightbox-media img { cursor: pointer; }   /* click left or right half to step */

.lightbox-nav svg {
  display: block;
  width: 9px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1;
}

.lightbox-nav:hover { opacity: 0.55; }
.lightbox-nav:focus { outline: none; }
.lightbox-nav:focus-visible { outline: 1px solid var(--ink); outline-offset: -6px; }

.lightbox-prev { right: calc(100% + 20px); }
.lightbox-next { left: calc(100% + 20px); }

.lightbox-caption {
  position: absolute;
  top: 0;
  left: calc(100% + 64px);
  width: 220px;
  color: var(--ink);
  cursor: zoom-out;
}

.lightbox-caption p {
  margin: 0;
  font-size: calc(11px - 0.5pt);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  line-height: 1.75;
}

.lightbox-caption .lightbox-title { font-weight: 400; }

/* Scope, Project Team and Photography: label in Regular, details in Light, a line space between each */
.lightbox-credits { margin: 0; }

.lightbox-credits dt,
.lightbox-credits dd {
  margin: 0;
  font-size: calc(11px - 0.5pt);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  line-height: 1.75;
}

.lightbox-credits dt { font-weight: 400; margin-top: 1.75em; }
.lightbox-credits .credit-name { display: block; white-space: nowrap; }   /* one name per line */

/* Image Highlights: one item per line (long ones wrap); only shown for images that have them */
.lightbox-credits .highlight-line { display: block; }
.lightbox-credits .highlight-line + .highlight-line { margin-top: 0.6em; }
.lightbox-credits .lightbox-highlights { display: none; }
.lightbox-overlay.has-highlights .lightbox-credits .lightbox-highlights { display: block; }

.gallery-cell img, .lightbox-trigger { cursor: zoom-in; }

/* ---------- Mobile ---------- */
@media (max-width: 640px) {
  .site-bar { padding: 20px 24px; }
  main.home { padding: 32px 24px; }
  .hero-frame { max-width: 196px; }
  main.page { padding: max(80px, calc(50vh - 219px)) 24px 96px; }
  .project-gallery { width: 100%; max-width: 100%; position: static; left: auto; transform: none; }
  main.projects { padding: 80px 24px 48px; gap: 56px; --thumb-h: clamp(48px, 16vw, 110px); }   /* each project's photos fit on one line */
  .lightbox-overlay--captioned.open { overflow-y: auto; }
  .lightbox-overlay--captioned .lightbox-figure { margin: auto; padding: 24px 0; }   /* centred, and scrolls if the caption runs long */
  .lightbox-overlay--captioned img { max-height: 55vh; }
  .lightbox-overlay--captioned.open { padding: 0 44px; }
  .lightbox-overlay--captioned img { max-width: calc(100vw - 88px); max-height: 75vh; }
  .lightbox-prev { right: calc(100% + 2px); }   /* phones: arrows tuck into the narrower side margins */
  .lightbox-next { left: calc(100% + 2px); }
  .lightbox-caption { position: static; width: auto; padding-top: 16px; }
  main.page--about .page-photo::before { left: -22%; }   /* phones: panel shifts up-left so it stays on screen */
  .site-logo { top: 24px; left: 24px; }
  .site-logo img { max-width: calc(100vw - 48px); height: auto; }
}

/* Phones held upright: enlarge the home frames so the logo stays readable.
   The sides bleed off the screen a little; the logo stays at the centre. On unusually short
   phones the frame shrinks just enough to keep the photos above the two-line nav bar.
   (Tablets are wide enough to show the whole frame, so they keep the regular size.) */
@media (max-aspect-ratio: 1/1) and (max-width: 640px) {
  .reel-frame {
    width: min(170vw, calc((50vh - 104px) * 4.2));
    width: min(170vw, calc((50svh - 104px) * 4.2));   /* svh: the visible screen, with the browser toolbars showing */
  }
}
