/* Studio Lachlan Turczan — redesigned static site styles.
   Same fonts and colours as the original; gallery-forward layout:
   full-screen slideshow + filterable grid on the home page, split-screen project pages.
   Site gutter 2vw (6vw on mobile). */

:root {
  --sqs-site-gutter: 2vw;
  --sqs-mobile-site-gutter: 6vw;
  --sqs-site-max-width: 2423px;
  --gutter: var(--sqs-site-gutter);
  --header-h: 78px; /* measured by site.js */
  --bg: #fafafa;
  --text: #1c1c1c;
  --ink: #000;
  --muted: #767676;
  --rule: rgba(0, 0, 0, 0.12);
  --font-body: "Crimson Pro", "Minion Pro", Georgia, serif;
  /* Crimson Pro matches Minion Pro's width at the same size; 350 matches its lighter colour. */
  --body-weight: 350;
  --font-display: "Libre Caslon Text", "Adobe Caslon Pro", Georgia, serif;
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

/* Pages fade into each other (Chrome, Edge, Safari 18+; others just load normally) */
@view-transition { navigation: auto; }
::view-transition-old(root), ::view-transition-new(root) { animation-duration: 0.35s; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  font-weight: var(--body-weight);
  line-height: 1.8;
}
strong, b { font-weight: 700; }

img, video { display: block; max-width: 100%; }
a { color: inherit; }
figure { margin: 0; }
button { font: inherit; color: inherit; }

/* Fade-in as things scroll into view (only when JavaScript is running, so nothing stays hidden without it) */
.js .reveal { opacity: 0; transform: translateY(28px); transition: opacity 0.9s var(--ease), transform 0.9s var(--ease); transition-delay: var(--d, 0s); }
.js .reveal.in { opacity: 1; transform: none; }

/* ---------- Header ---------- */
.site-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.5vw var(--gutter);
  color: var(--ink);
  background: rgba(250, 250, 250, 0.88);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  transition: background-color 0.4s, color 0.4s, transform 0.4s var(--ease);
}
/* Over the slideshow: transparent with white text, until the page scrolls past it */
.has-hero:not(.scrolled):not(.menu-open) .site-header {
  color: #fff;
  background: transparent;
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
}
/* Tucks away while scrolling down, comes back when scrolling up */
.header-hidden:not(.menu-open) .site-header { transform: translateY(-100%); }
body:not(.has-hero) main { padding-top: var(--header-h); }

.site-title {
  font-family: var(--font-display);
  font-size: min(calc(0.2 * 1.2vw + 1rem), max(calc(0.2 * 0.012 * 2423px + 1rem), 1.2rem));
  line-height: 1.4;
  letter-spacing: 0.02em;
  text-decoration: none;
}
.site-nav { display: flex; gap: 1.6vw; }
.site-nav a {
  text-decoration: none;
  line-height: 28.8px;
  padding: 1.6px 0;
  background: linear-gradient(currentColor, currentColor) no-repeat left bottom / 0 1px;
  transition: background-size 0.25s;
}
.site-nav a:hover, .site-nav a.active { background-size: 100% 1px; }
.burger { display: none; }

/* ---------- Home: slideshow ---------- */
.hero {
  position: relative;
  height: 100vh;
  height: 100svh;
  overflow: hidden;
  background: #0b0b0b;
  color: #fff;
}
.hero::after { /* soft shading so white text stays readable on bright photos */
  content: "";
  position: absolute; inset: 0;
  pointer-events: none;
  background: linear-gradient(rgba(0, 0, 0, 0.35), transparent 18%, transparent 75%, rgba(0, 0, 0, 0.4));
}
.hero-slide {
  position: absolute; inset: 0;
  opacity: 0;
  visibility: hidden;
  transition: opacity 1.6s ease, visibility 1.6s;
  color: #fff;
  text-decoration: none;
}
.hero-slide.is-active { opacity: 1; visibility: visible; z-index: 1; }
.hero-slide img { width: 100%; height: 100%; object-fit: cover; transform: scale(calc(var(--z, 1) * 1.06)); }
/* is-leaving keeps the drift going while a slide fades out, so it doesn't jump */
.hero-slide.is-active img, .hero-slide.is-leaving img { animation: drift 9s linear forwards; }
@keyframes drift { from { transform: scale(calc(var(--z, 1) * 1.06)); } to { transform: scale(var(--z, 1)); } }
/* Phones / portrait screens: each slide's own crop (--mx, --my, --mz set in build.py HERO) */
@media (max-aspect-ratio: 1/1) {
  .hero-slide { --z: var(--mz, 1); }
  .hero-slide img { object-position: var(--mx, 50%) var(--my, 50%) !important; transform-origin: var(--mx, 50%) var(--my, 50%); }
}
.hero-caption {
  position: absolute;
  left: var(--gutter);
  bottom: 2.4vw;
  z-index: 2;
  font-family: var(--font-display);
  font-size: 15px;
  letter-spacing: 0.02em;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.8s 0.5s, transform 0.8s 0.5s var(--ease);
}
.hero-slide.is-active .hero-caption { opacity: 1; transform: none; }
.hero-slide:hover .hero-caption { text-decoration: underline; text-underline-offset: 0.25em; text-decoration-thickness: 1px; }
.hero-count, .hero-down {
  position: absolute;
  bottom: 2.4vw;
  z-index: 3;
  font-family: var(--font-display);
  font-size: 15px;
  letter-spacing: 0.04em;
}
.hero-count { right: var(--gutter); font-variant-numeric: tabular-nums; }
.hero-down {
  left: 50%;
  transform: translateX(-50%);
  color: #fff;
  text-decoration: none;
  font-size: 20px;
  animation: nudge 2.4s ease-in-out infinite;
}
@keyframes nudge { 50% { transform: translate(-50%, 6px); } }

/* ---------- Home: works grid ---------- */
.works { padding: 6vw var(--gutter) 4vw; scroll-margin-top: var(--header-h); }
.filters {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.4em 1.6em;
  margin-bottom: 4vw;
  font-size: 19px;
}
.filters button {
  border: 0;
  background: linear-gradient(currentColor, currentColor) no-repeat left 88% / 0 1px;
  padding: 0 0 2px;
  cursor: pointer;
  color: var(--muted);
  transition: color 0.2s, background-size 0.25s;
}
.filters button:hover { color: var(--ink); }
.filters button.is-active { color: var(--ink); background-size: 100% 1px; }
.filters sup { font-size: 0.6em; margin-left: 0.15em; }

.works-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4vw 2vw;
  transition: opacity 0.3s;
}
.works-grid.is-filtering { opacity: 0; }
.work { text-decoration: none; color: var(--ink); }
.work[hidden] { display: none; }
.work-thumb { position: relative; aspect-ratio: 1 / 1; overflow: hidden; background: #eee; }
.work-thumb img { width: 100%; height: 100%; object-fit: cover; transition: transform 1.2s var(--ease), opacity 0.6s; }
.work-thumb .work-alt { position: absolute; inset: 0; opacity: 0; }
.work:hover .work-thumb img { transform: scale(1.04); }
.work:hover .work-alt { opacity: 1; }
.work-meta {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1em;
  margin-top: 10px;
  font-family: var(--font-display);
  font-size: 14px;
  letter-spacing: 0.02em;
}
.work-title { font-size: inherit; font-weight: 400; line-height: 1.6; margin: 0; }
.work-year { color: var(--muted); }
.work:hover .work-title { text-decoration: underline; text-underline-offset: 0.25em; text-decoration-thickness: 1px; }

/* ---------- Project pages: split screen ---------- */
.project { padding: 2vw var(--gutter) 0; }
.chapter {
  display: grid;
  grid-template-columns: minmax(280px, 32%) 1fr;
  gap: 4vw;
  margin-bottom: 8vw;
}
/* The text column runs the full height of the photos, so its contents can stay pinned while they scroll */
.chapter-text .sticky { position: sticky; top: var(--sticky-top, calc(var(--header-h) + 2vw)); }
.project-title {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(30px, 3vw, 56px);
  line-height: 1.12;
  letter-spacing: 0.01em;
  margin: 0 0 1.4rem;
}
.details {
  display: grid;
  grid-template-columns: 6.5em 1fr;
  margin: 0 0 1.8rem;
  border-top: 1px solid var(--rule);
}
.details dt, .details dd { margin: 0; padding: 0.55em 0; border-bottom: 1px solid var(--rule); line-height: 1.5; }
.details dt { font-size: 12px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); padding-top: 0.85em; }
.prose { max-width: 38em; margin-bottom: 1.8rem; }
.project-tags { display: flex; flex-wrap: wrap; gap: 0.3em 1em; margin: 0; font-size: 14px; }
.project-tags a { color: var(--muted); text-decoration: none; }
.project-tags a::before { content: "#"; }
.project-tags a:hover { color: var(--ink); }

.chapter-media { display: flex; flex-direction: column; gap: 2vw; min-width: 0; }
.chapter-media img { width: 100%; height: auto; }
.media-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 2vw; }
.media-grid figure { aspect-ratio: var(--aspect); overflow: hidden; }
.media-grid img { height: 100%; object-fit: cover; }
.media-grid .lead { grid-column: 1 / -1; aspect-ratio: auto; }
.media-grid .lead img { height: auto; }
.media video { width: 100%; height: auto; background: #000; }
[data-lightbox] { cursor: zoom-in; overflow: hidden; }
[data-lightbox] img { transition: transform 1.2s var(--ease); }
[data-lightbox]:hover img { transform: scale(1.015); }

.project-nav {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 2vw;
  margin: 0 var(--gutter);
  padding: 2.5vw 0;
  border-top: 1px solid var(--rule);
}
.project-nav a { text-decoration: none; color: var(--ink); }
.pag-prev, .pag-next { display: flex; align-items: center; gap: 1.2em; }
.pag-next { justify-self: end; flex-direction: row-reverse; text-align: right; }
.pag-thumb { width: 84px; aspect-ratio: 1; overflow: hidden; flex: none; }
.pag-thumb img { width: 100%; height: 100%; object-fit: cover; transition: transform 1s var(--ease); }
.project-nav a:hover .pag-thumb img { transform: scale(1.08); }
.pag-text { display: flex; flex-direction: column; line-height: 1.4; }
.pag-label { font-size: 12px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }
.pag-title { font-family: var(--font-display); font-size: 18px; letter-spacing: 0.01em; }
.pag-all { font-size: 14px; color: var(--muted) !important; }
.pag-all:hover { color: var(--ink) !important; }

/* ---------- Lightbox (click a project photo) ---------- */
.lightbox {
  position: fixed; inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(12, 12, 12, 0.96);
  color: #fff;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.35s, visibility 0.35s;
}
.lightbox.is-open { opacity: 1; visibility: visible; }
.lightbox img { max-width: 92vw; max-height: 88vh; width: auto; height: auto; object-fit: contain; transition: opacity 0.25s; }
.lightbox button {
  position: absolute;
  border: 0;
  background: none;
  color: #fff;
  cursor: pointer;
  font-family: var(--font-display);
  font-size: 15px;
  padding: 1.2em var(--gutter);
  opacity: 0.75;
}
.lightbox button:hover { opacity: 1; }
.lb-close { top: 0; right: 0; }
.lb-prev, .lb-next { top: 50%; transform: translateY(-50%); font-size: 26px !important; }
.lb-prev { left: 0; }
.lb-next { right: 0; }
.lb-count { position: absolute; bottom: 1.6em; left: 50%; transform: translateX(-50%); font-family: var(--font-display); font-size: 14px; opacity: 0.75; }
.lightbox-open { overflow: hidden; }

/* ---------- Sections (About / Exhibitions keep the original Squarespace layout) ---------- */
.page-section { position: relative; display: flex; flex-direction: column; justify-content: center; }
.fe-section .content-wrapper { width: 100%; }
.fe-section.height-small .content-wrapper { padding: 3.3vmax 0; }
.fe-section.height-medium .content-wrapper { padding: 6.6vmax 0; }
.fe-section.height-large .content-wrapper { padding: 10vmax 0; }
.fe-section.height-custom .content-wrapper { padding: 0.1vmax 0; }

/* Fluid-engine blocks: grid placement comes from each section's own <style>. */
.fe-block { position: relative; min-width: 0; }
.fe-block .sqs-block { height: 100%; display: flex; flex-direction: column; }
.fe-block .sqs-block-content { width: 100%; }
.block-image .sqs-block-content { position: relative; height: 100%; }
/* Absolutely positioned so the image fills its grid cell instead of sizing the grid rows. */
.img-fill, .img-fit { position: absolute; inset: 0; width: 100%; height: 100%; }
.img-fill { object-fit: cover; }
.img-fit { object-fit: contain; }
.block-video video { width: 100%; height: auto; background: #000; }
.block-hr hr { border: 0; border-top: 1px solid var(--ink); margin: 0; }
.embed { position: relative; height: 0; overflow: hidden; }
.embed iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }

.sqs-html-content p { margin: 1rem 0; }
.sqs-html-content p:first-child { margin-top: 0; }
.sqs-html-content p:last-child { margin-bottom: 0; }
.sqs-html-content p:empty::before { content: "\200b"; }
.sqs-html-content a { color: var(--ink); text-decoration-thickness: 1px; text-underline-offset: 0.2em; }
.sqs-html-content .sqsrte-small { font-size: 0.81em; line-height: 1.8; }

/* ---------- Galleries (About / Exhibitions) ---------- */
.gallery-section.width-full { padding: var(--gutter); }
.gallery-section.width-full-bleed { padding: 0; }
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(var(--cols), 1fr);
  gap: var(--gap);
}
.gallery-grid figure { aspect-ratio: var(--aspect); overflow: hidden; }
.gallery-grid img { width: 100%; height: 100%; object-fit: cover; }
.gallery-masonry { columns: var(--cols); column-gap: var(--gap); }
.gallery-masonry figure { break-inside: avoid; margin-bottom: var(--gap); }
.gallery-masonry img { width: 100%; height: auto; }

/* ---------- Footer ---------- */
.site-footer { padding-top: 2vw; }

/* ---------- Tablet ---------- */
@media (max-width: 1100px) {
  .works-grid { grid-template-columns: repeat(2, 1fr); }
  .chapter { grid-template-columns: minmax(240px, 38%) 1fr; }
}

/* ---------- Mobile ---------- */
@media (max-width: 767px) {
  :root { --gutter: var(--sqs-mobile-site-gutter); }
  .site-header { padding: 4vw var(--gutter); }
  .site-title { font-size: calc(0.2 * 0.012 * min(100vh, 900px) + 1rem); position: relative; z-index: 20; }
  .burger {
    display: flex; flex-direction: column; justify-content: center; gap: 6px;
    width: 32px; height: 32px; padding: 0; border: 0; background: none; cursor: pointer;
    position: relative; z-index: 20;
  }
  .burger span { display: block; height: 1px; background: currentColor; transition: transform 0.2s; }
  .site-nav {
    position: fixed; inset: 0; z-index: 10;
    height: 100vh; height: 100dvh;
    flex-direction: column; align-items: center; justify-content: center; gap: 24px;
    background: var(--bg); color: var(--ink); font-size: 26px;
    opacity: 0; visibility: hidden; transition: opacity 0.2s, visibility 0.2s;
  }
  body.menu-open .site-nav { opacity: 1; visibility: visible; }
  body.menu-open .burger span:first-child { transform: translateY(3.5px) rotate(45deg); }
  body.menu-open .burger span:last-child { transform: translateY(-3.5px) rotate(-45deg); }
  body.menu-open { overflow: hidden; }
  /* a blurred or moved header would trap the full-screen menu inside itself */
  body.menu-open .site-header { -webkit-backdrop-filter: none; backdrop-filter: none; transform: none; }

  .hero-caption, .hero-count { bottom: 6vw; }
  .hero-down { display: none; } /* collided with longer captions; swiping up is natural on a phone */
  .works { padding: 10vw var(--gutter) 8vw; }
  .filters { font-size: 17px; gap: 0.3em 1.2em; margin-bottom: 8vw; }
  .works-grid { grid-template-columns: 1fr; gap: 9vw; }

  .project { padding-top: 4vw; }
  .chapter { grid-template-columns: 1fr; gap: 6vw; margin-bottom: 12vw; }
  .chapter-text .sticky { position: static; }
  .chapter-media, .media-grid { gap: 3vw; }
  .project-nav { grid-template-columns: 1fr 1fr; padding: 6vw 0; }
  .pag-all { display: none; }
  .pag-thumb { width: 56px; }
  .pag-title { font-size: 16px; }
  .lb-prev, .lb-next { display: none; }

  .gallery-section.width-full { padding: 3vw var(--gutter); }
  .gallery-section.width-full-bleed { padding: 3vw 0; }
  .gallery-grid { grid-template-columns: 1fr; gap: 3vw; }
  .gallery-masonry { columns: 1; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .js .reveal { opacity: 1; transform: none; transition: none; }
  .hero-slide.is-active img, .hero-down { animation: none; }
  .hero-slide img { transform: scale(var(--z, 1)); }
  @view-transition { navigation: none; }
}
