/* =========================================================
   Material Interest
   Design reference: 1348px wide Figma frame.
   --u  = one design pixel for spacing & type (never smaller than 0.6px)
   --tu = one design pixel for image tiles (smaller floor so the collage fits phones)
   ========================================================= */

/* Serif: TeX Gyre Schola, a free Century Schoolbook clone that matches C059 in the design.
   License: GUST Font License, see fonts/README-TeX-Gyre-Schola.txt */
@font-face {
  font-family: "Schola";
  src: local("C059"), local("C059-Roman"), url("fonts/texgyreschola-regular.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

/* Sans: KH Teka (trial files supplied by the studio). Bold is installed; Medium falls back
   to Inter until fonts/KHTeka-Medium.woff2 is added. Swap in licensed files before launch. */
@font-face {
  font-family: "KH Teka";
  /* KH Teka Medium not supplied yet: add fonts/KHTeka-Medium.woff2 and append
     , url("fonts/KHTeka-Medium.woff2") format("woff2") to this line */
  src: local("KH Teka TRIAL Medium"), local("KH Teka Medium");
  font-weight: 500;
  font-display: swap;
}
@font-face {
  font-family: "KH Teka";
  src: local("KH Teka TRIAL Bold"), local("KH Teka Bold"), url("fonts/KHTeka-Bold.woff2") format("woff2");
  font-weight: 700;
  font-display: swap;
}

:root {
  --u: clamp(0.6px, 100vw / 1348, 1.25px);
  --tu: clamp(0.42px, 100vw / 1348, 1.25px);
  --ink: #000;
  --paper: #fff;
  --gutter: 8px;
  --serif: "Schola", "C059", "Century Schoolbook", "New Century Schoolbook", Georgia, serif;
  --sans: "KH Teka", "Inter", "Helvetica Neue", Arial, sans-serif;

  /* Motion (curves taken from wearecollins.com) */
  --ease-expo: cubic-bezier(0.19, 1, 0.22, 1);       /* long, soft settle: movement */
  --ease-sine: cubic-bezier(0.445, 0.05, 0.55, 0.95); /* gentle in-and-out: fades */
  --ease-cubic: cubic-bezier(0.215, 0.61, 0.355, 1);  /* quick settle: hovers, state changes */

  /* filled in by main.js */
  --hdr: 42px;
  --bar: 43px;
  --stack-h: 0px;
}

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

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

h1, h2, h3, p, ul { margin: 0; padding: 0; font-weight: inherit; font-size: inherit; }
ul { list-style: none; }
a { color: inherit; text-decoration: none; }
img { display: block; }

/* ---------- Type ---------- */
.label {
  font-family: var(--sans);
  font-weight: 700;
  font-size: 14px;
  line-height: 1.2;
  letter-spacing: 0.02em;
}
.body {
  font-family: var(--sans);
  font-weight: 500;
  font-size: 14px;
  line-height: 1.2;
  letter-spacing: 0;
}
.display {
  font-family: var(--serif);
  font-weight: 400;
  font-size: max(30px, calc(50 * var(--u)));
  line-height: 1;
  letter-spacing: -0.02em;
}

/* ---------- Header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 11px 9px 20px var(--gutter);
  background: var(--paper);
}
.logo {
  font-family: var(--serif);
  font-size: 20px;
  line-height: 1;
  letter-spacing: -0.09em;
}
.nav-link { font-size: 10px; }
.nav-link, .logo { transition: opacity 0.25s var(--ease-cubic); }
.nav-link:hover, .logo:hover { opacity: 0.6; }

/* ---------- Buttons ---------- */
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 218px;
  height: 48px;
  background: var(--ink);
  color: var(--paper);
  font-family: var(--sans);
  font-weight: 700;
  font-size: 14px;
  letter-spacing: 0.02em;
  transition: opacity 0.25s var(--ease-cubic);
}
.button:hover { opacity: 0.8; }

/* ---------- Section bars (full-bleed rule + label) ---------- */
.section-bar {
  border-top: 1px solid var(--ink);
  padding: 9px var(--gutter) 0;
}

/* ---------- Image tiles (shared by hero + projects) ---------- */
.tiles { position: relative; }
.tile {
  position: absolute;
  /* Keep each tile inside the frame even when tiles are scaled up on small screens */
  left: calc((100% - var(--w) * var(--tu)) * var(--x) / (1348 - var(--w)));
  top: calc(var(--y) * var(--tu));
  width: calc(var(--w) * var(--tu));
  height: calc(var(--h) * var(--tu));
  overflow: hidden;
}
.tile img.crop {
  position: absolute;
  max-width: none;
  width: calc(var(--iw) * 1%);
  height: calc(var(--ih) * 1%);
  left: calc(var(--il) * 1%);
  top: calc(var(--it) * 1%);
}
.tile img.cover {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.tile img.inset {
  position: absolute;
  left: calc(var(--ix) * var(--tu));
  top: calc(var(--iy) * var(--tu));
  width: calc(var(--iw2) * var(--tu));
  height: calc(var(--ih2) * var(--tu));
  object-fit: cover;
}

/* ---------- Hero ---------- */
.hero {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: calc(587 * var(--u));
  padding: calc(196 * var(--u)) var(--gutter) calc(24 * var(--u));
}
.hero-tiles {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
}
/* Collage is laid out from the very top of the page (it overlaps the header area),
   and sits above the header while it fades in and out */
.hero-tiles { top: calc(-1 * var(--hdr)); z-index: 60; }
.hero-tiles .tile { opacity: 0; } /* shown only during the intro fade (main.js) */
.hero-tiles--phone { display: none; }

.hero-title { position: relative; z-index: 1; text-align: center; }
.hero-intro { position: relative; z-index: 1; margin-top: auto; padding-top: 40px; max-width: 413px; }

/* ---------- Work with us ---------- */
.lock-outer { position: relative; display: flow-root; }
/* Shortening the outer box by the stack height makes the WORK WITH US bar
   and the pinned stack release on the same scroll frame. */
.lock-inner { margin-bottom: calc(-1 * var(--stack-h)); }
.work-bar {
  position: sticky;
  top: var(--hdr);
  z-index: 20;
  background: var(--paper);
  padding-bottom: 14px;
}
.statements {
  padding: calc(195 * var(--u) - var(--bar)) var(--gutter) 0;
  display: grid;
  gap: calc(120 * var(--u));
}
.statement {
  font-family: var(--serif);
  font-size: max(22px, calc(32 * var(--u)));
  line-height: 1;
  letter-spacing: -0.03em;
  max-width: 718px;
  will-change: opacity, transform;
  /* main.js sets the target opacity/offset on scroll; these smooth the steps */
  transition: opacity 0.6s var(--ease-cubic), transform 1.2s var(--ease-expo);
}

.lock-stack {
  position: sticky;
  top: calc(var(--hdr) + var(--bar));
  z-index: 10;
  background: var(--paper);
  margin-top: calc(166 * var(--u));
}
.work-para { padding: 0 var(--gutter); max-width: calc(383px + 2 * var(--gutter)); }

/* ---------- Our programs ---------- */
/* Locks with its line right under the header while 01 fades to 02 */
.programs-pin {
  position: sticky;
  top: var(--hdr);
  z-index: 10;
  background: var(--paper);
  padding-bottom: 22px;
}
.program-list {
  display: grid;
  grid-template-columns: calc(557 / 1348 * 100%) 1fr;
  padding: calc(189 * var(--u)) var(--gutter) 0;
}
.program {
  display: grid;
  grid-template-columns: 30px minmax(0, 383px);
  align-items: start;
  opacity: 0.2;
  transition: opacity 0.7s var(--ease-sine);
}
.program.is-active { opacity: 1; }
.program-num, .program-title {
  font-weight: 700;
  font-size: 14px;
  line-height: 1.2;
  letter-spacing: 0.02em;
}
.program-title { margin-bottom: 45px; }
.program .body + .body { margin-top: 1.2em; } /* blank line between paragraphs */
.work-hold { height: 60vh; }      /* white space while Work With Us is frozen */
.programs-hold { height: 100vh; } /* how long Our Programs stays locked; 01 → 02 at the halfway point */
.lock-compensate { height: var(--stack-h); }

.programs-cta { padding: calc(191 * var(--u)) var(--gutter) calc(20 * var(--u)); }

/* No room to pin (short or narrow screens): everything scrolls normally */
.no-pin .work-bar,
.no-pin .lock-stack { position: relative; top: auto; }
.no-pin .lock-inner { margin-bottom: 0; }
.no-pin .programs-pin { position: relative; top: auto; }
.no-pin .programs { margin-top: calc(23 * var(--u)); }
.no-pin .program-list { padding-top: calc(33 * var(--u)); }
.no-pin .lock-compensate,
.no-pin .pin-spacer { display: none; }

/* ---------- Process ---------- */
.process-text {
  font-family: var(--serif);
  font-size: max(22px, calc(32 * var(--u)));
  line-height: 1.2;
  letter-spacing: -0.03em;
  max-width: calc(1030px + 2 * var(--gutter));
  padding: calc(166 * var(--u)) var(--gutter) 0;
}
.process-text p + p { margin-top: 1.2em; }
.process .button { margin: calc(95 * var(--u)) var(--gutter) 0; }
.process { padding-bottom: calc(172 * var(--u)); }

/* ---------- Lock to top (Process, Recent Projects) ---------- */
.pin-block {
  position: sticky;
  top: var(--hdr);
  z-index: 10;
  background: var(--paper);
}
.pin-hold { height: 60vh; }               /* how long each section stays locked */
.projects .pin-hold { height: 45vh; }
.pin-section.no-fit .pin-block { position: relative; top: auto; }
.pin-section.no-fit .pin-hold,
.no-pin .pin-hold { display: none; }
.no-pin .pin-block { position: relative; top: auto; }

/* ---------- Recent projects ---------- */
.project-title {
  font-family: var(--serif);
  font-size: max(22px, calc(32 * var(--u)));
  line-height: 1.1;
  letter-spacing: -0.03em;
  padding: calc(97 * var(--u)) var(--gutter) 0;
  min-height: calc(97 * var(--u) + 2.2em); /* two lines reserved so swapping titles never shifts the grid */
}
/* 7 thumbnails per row, spread edge to edge */
.thumbs {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, calc(95 * var(--u))));
  justify-content: space-between;
  row-gap: calc(33 * var(--u));
  column-gap: 6px;
  margin-top: calc(30 * var(--u));
  padding: 0 var(--gutter);
}
.thumb {
  position: relative;
  aspect-ratio: 95 / 119;
  overflow: hidden;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
  opacity: 0.2;
  transition: opacity 0.2s var(--ease-cubic), clip-path 0.8s var(--ease-expo), transform 0.8s var(--ease-expo);
}
.thumb.is-active { opacity: 1; }
.thumb img { transition: transform 0.8s var(--ease-expo); }
.thumb:hover img { transform: scale(1.04); }
/* Wipe up into view, staggered (main.js sets --i) */
.js .thumbs:not(.is-in) .thumb { clip-path: inset(100% 0 0 0); transform: translateY(16px); }
.thumbs.is-in .thumb { transition-delay: 0s, calc(var(--i, 0) * 40ms), calc(var(--i, 0) * 40ms); }
.project-title span { display: inline-block; } /* title swap animation lives in main.js */
.thumb:focus-visible { outline: 1px solid var(--ink); outline-offset: 3px; }
.thumb img.cover { width: 100%; height: 100%; object-fit: cover; }
.thumb img.crop {
  position: absolute; max-width: none;
  width: calc(var(--iw) * 1%); height: calc(var(--ih) * 1%);
  left: calc(var(--il) * 1%); top: calc(var(--it) * 1%);
}
.thumb img.inset {
  position: absolute;
  left: calc(var(--ix) / 95 * 100%); top: calc(var(--iy) / 119 * 100%);
  width: calc(var(--iw2) / 95 * 100%); height: calc(var(--ih2) / 119 * 100%);
  object-fit: cover;
}
.thumb img.shade { filter: brightness(0.95); }

/* ---------- Footer ---------- */
.site-footer {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 16px;
  padding: calc(344 * var(--u)) 9px 11px var(--gutter);
}
.footer-location { text-align: right; letter-spacing: 0.02em; }

/* ---------- Small screens ---------- */
@media (max-width: 1100px) and (min-width: 701px) {
  .project-title { min-height: calc(97 * var(--u) + 3.3em); }
}

@media (max-width: 700px) {
  /* Scaled-down type so phones keep the desktop's proportions */
  .display { font-size: 28px; }
  .statement, .process-text, .project-title { font-size: 19px; }
  .body, .label { font-size: 12px; }
  .program-num, .program-title { font-size: 12px; }
  .logo { font-size: 18px; }
  .button { width: 150px; height: 38px; font-size: 11px; }

  .br-wide { display: none; }
  /* Phone landing (mobile frame): full-screen, headline centred, intro pinned to the bottom */
  .logo { font-size: 20px; }
  .nav-link { font-size: 8px; }
  .hero {
    height: calc(100svh - var(--hdr));
    min-height: 0;
    padding: 0 var(--gutter);
    justify-content: center;
    align-items: center;
  }
  .hero .hero-title { font-size: clamp(26px, 7.77vw, 34px); width: 69.6vw; margin-bottom: 12svh; }
  .hero .hero-intro {
    position: absolute; left: var(--gutter); bottom: 16px;
    margin: 0; padding: 0;
    font-size: 12px; width: 60.7vw; max-width: none;
  }
  .hero-tiles--desk { display: none; }
  .hero-tiles--phone { display: block; height: 100svh; }
  .hero-tiles--phone .tile {
    left: calc(var(--mx) / 402 * 100%);
    top: calc(var(--my) / 874 * 100%);
    width: 17.72vw;
    height: auto;
    aspect-ratio: 95 / 119;
  }
  .statements { gap: 56px; }
  .program-list { grid-template-columns: 1fr; gap: 64px; }
  .program-title { margin-bottom: 12px; }
  .work-para { max-width: 300px; }

  /* 12 thumbnails, 4 per row, evenly spaced */
  .thumb-extra { display: none; }
  .thumbs { grid-template-columns: repeat(4, 62px); justify-content: space-between; column-gap: 0; row-gap: 28px; margin-top: 24px; }
  .project-title { min-height: calc(97 * var(--u) + 4.4em); }
  .thumb:hover img { transform: none; }
  /* Same as desktop: button left, location right, bottoms aligned */
  .footer-location { text-align: right; }
  .site-footer .button { flex-shrink: 0; }
}

/* ---------- Fade-ins (Collins: 1s fade, 2s soft rise) ---------- */
.js .reveal, .js .intro-rise {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 1s ease, transform 2s var(--ease-expo);
}
.js .reveal.is-in, .js .intro-rise.is-in { opacity: 1; transform: none; }
.hero-intro.intro-rise { transition-delay: 0.25s; }
.hero-title.intro-rise { transition-delay: 0.1s; }

@media (prefers-reduced-motion: reduce) {
  .js .reveal, .js .intro-rise { opacity: 1; transform: none; transition: none; }
  .js .thumbs:not(.is-in) .thumb { clip-path: none; transform: none; }
  .statement, .thumb img { transition: none; }
  .program, .thumb { transition: none; }
}
