:root {
  --bg: #1d1c1a;
  --ink: #f2f0ea;
  --mute: #9c9a94;
  --panel: #2a2926;
  --line: rgb(242 240 234 / .18);
  --sans: "Instrument Sans", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --wide: "Anybody", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --pad: 16px;
  --gap: 20px;
  --ease: cubic-bezier(.7, 0, .2, 1);
  --ease-out: cubic-bezier(.2, .7, .1, 1);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scrollbar-width: none; }
/* no scrollbar: it would appear on long pages only and shift the whole layout sideways when changing pages */
html::-webkit-scrollbar { display: none; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.4 var(--sans); transition: background-color 1.2s ease, color 1.2s ease; }
/* the intro starts on a white table and turns dark as the cards deal out */
body.is-white { --bg: #fff; --ink: #111; --mute: #75716a; --panel: #f1f1f1; --line: #e2e2e2; }
/* live colour behind everything (driven from v3.js), and one grain layer over the whole page */
body { isolation: isolate; }
.bg { position: fixed; inset: 0; z-index: -1; overflow: hidden; pointer-events: none; transition: opacity 1.4s ease; }
.pool { position: absolute; left: 0; top: 0; width: 77vmax; height: 62vmax; opacity: 0; will-change: transform, opacity; }
.pool.warm { background: radial-gradient(closest-side, rgb(120 72 38), rgb(120 72 38 / 0)); }
.pool.cool { background: radial-gradient(closest-side, rgb(38 62 104), rgb(38 62 104 / 0)); }
body.is-white .bg { opacity: 0; }
body.is-white .grain { opacity: .5; }
/* outside the home page the grain sits behind the content, so case study boards stay clean */
body:not(.home) .grain { z-index: -1; }
.grain {
  position: fixed;
  inset: -120px;
  z-index: 100;
  pointer-events: none;
  background-size: 130px;
  transition: opacity 1.2s ease;
  will-change: transform;
  /* moving the whole layer is cheaper than repainting it */
  animation: grain .9s steps(1) infinite;
}
@keyframes grain {
  0% { transform: translate(0, 0); }
  20% { transform: translate(-37px, 23px); }
  40% { transform: translate(51px, -64px); }
  60% { transform: translate(-82px, -17px); }
  80% { transform: translate(14px, 76px); }
}
img { display: block; max-width: 100%; height: auto; }
a { color: inherit; text-decoration: none; }
a:focus-visible { outline: 1px solid var(--ink); outline-offset: 3px; }
h1, h2, h3, p, figure, ul, blockquote { margin: 0; padding: 0; }
ul { list-style: none; }
#view:focus { outline: none; }

.grid { display: grid; grid-template-columns: repeat(4, 1fr); column-gap: var(--gap); padding: 0 var(--pad); }
.label, .bar, .foot { font-size: 17px; line-height: 1.2; text-transform: uppercase; letter-spacing: .01em; }
/* names, nav and headings in the extra wide face; reading text stays in the plain one */
.bar, .label, .title, #cta { font-family: var(--wide); font-stretch: 150%; }

/* header: name on the left, the three links together on the right */
.bar { display: flex; gap: 48px; padding-top: 18px; align-items: baseline; }
.bar > * { display: block; flex: none; overflow: hidden; white-space: nowrap; }
.bar > * > span { display: block; }
.name { margin-right: auto; }
.bar a.name { color: var(--ink); }
/* the current page is shown in bold */
.bar a { color: var(--mute); transition: color .3s; }
.bar a[aria-current] { color: var(--ink); font-weight: 700; }
/* each link keeps room for its bold width, so switching pages doesn't nudge its neighbours */
.bar a > span::after { content: attr(data-label); display: block; height: 0; overflow: hidden; visibility: hidden; font-weight: 700; }
.bar a:hover { color: var(--ink); }

/* page change */
#view { transition: opacity .35s ease; }
#view.leaving { opacity: 0; }

/* home: fills the window, one looping strip of equal tiles */
/* other pages: the footer sits at the bottom of the window even when the page is short */
body:not(.home) { display: flex; flex-direction: column; min-height: 100vh; min-height: 100svh; }
body:not(.home) #view { flex: 1 0 auto; }
body.home { height: 100vh; height: 100svh; overflow: hidden; display: flex; flex-direction: column; }
body.home #view { flex: 1; min-height: 0; display: flex; flex-direction: column; }
body.home .strip { margin: auto 0; }
body.home .foot { display: none; }
body.home #view { touch-action: none; }

.strip {
  --h: clamp(260px, calc(100svh - 212px), 820px);
  --w: calc(var(--h) * .91);
  --gap: var(--pad);
  position: relative;
  overflow-x: clip; overflow-y: visible;
  padding: 48px 0;   /* room for the intro shadows */
  touch-action: none;
  cursor: grab;
  user-select: none;
}
.strip.dragging { cursor: grabbing; }
.track { display: flex; gap: var(--gap); padding-left: var(--pad); will-change: transform; }
.tile { position: relative; flex: none; width: var(--w); -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; }
.tile > .label { position: absolute; top: 14px; left: 16px; right: 16px; z-index: 1; display: flex; gap: 8px; color: #fff; mix-blend-mode: difference; white-space: nowrap; overflow: hidden; }
.tile > .label .n { opacity: .6; }
.tile .frame { position: relative; display: block; width: var(--w); height: var(--h); overflow: hidden; background: var(--panel); }
.tile .pan { display: block; width: 100%; height: 100%; transform: scale(1.14); will-change: transform; }
/* covers shown whole: no zoom and no drift inside the frame */
.tile.fit .pan { transform: none !important; }
.tile img { width: 100%; height: 100%; object-fit: cover; transition: transform 1.1s var(--ease-out); pointer-events: none; }
.tile:hover img { transform: scale(1.05); }
.tile > .label > span:last-child { transition: transform .5s var(--ease-out); }
.tile:hover > .label > span:last-child { transform: translateX(6px); }
.dot { display: inline-block; width: 7px; height: 7px; margin-right: 6px; border-radius: 50%; background: #d43; vertical-align: 1px; animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .25; } }

/* short note that appears in the room opened beside the card in focus (below it on phones) */
.info { position: absolute; top: 0; left: calc(100% + 24px); width: 260px; display: flex; flex-direction: column; gap: 10px; opacity: 0; transform: translateX(-12px); transition: opacity .9s ease, transform 1.4s var(--ease-out); pointer-events: none; }
.tile.before .info { left: auto; right: calc(100% + 24px); transform: translateX(12px); }
.strip.handover .info { transition: none; }
.tile.hot .info { opacity: 1; transform: none; transition-delay: .5s; }
.info-sub { font-family: var(--wide); font-stretch: 150%; font-size: 17px; line-height: 1.2; text-transform: uppercase; }
.info-text { font-size: 15px; line-height: 1.4; color: var(--ink); }
.info-meta { font-size: 12px; color: var(--mute); }
.home-foot { display: flex; justify-content: space-between; align-items: baseline; padding: 0 var(--pad) 18px; font-size: 13px; color: var(--mute); }
.home-foot > :last-child { font-variant-numeric: tabular-nums; }
.home-foot a { transition: color .3s; }
.home-foot a:hover { color: var(--ink); }

/* first visit: pictures start close up on the pile and settle as they deal out */
.tile .frame img { transition: transform 1.8s var(--ease-out); }
.tile.stacked .frame img { transform: scale(1.35); }
/* during the intro the cards cast soft shadows like prints on a white table */
.tile .frame { transition: box-shadow 1s ease; }
.tile.on-table .frame { box-shadow: 0 2px 3px rgba(0,0,0,.10), 0 12px 24px rgba(0,0,0,.14), 0 40px 80px rgba(0,0,0,.18); }
.tile > .label { transition: opacity 1.4s ease; }
.is-intro .tile > .label { opacity: 0; }
.bar > * > span { transition: transform .9s var(--ease-out); }
.bar > :nth-child(2) > span { transition-delay: .05s; }
.bar > :nth-child(3) > span { transition-delay: .1s; }
.bar > :nth-child(4) > span { transition-delay: .15s; }
.is-intro .bar > * > span { transform: translateY(110%); }
.home-foot { transition: opacity .9s ease .3s; }
.is-intro .home-foot { opacity: 0; }

/* archive */
.cards { margin-top: 64px; row-gap: 48px; }
.card { display: block; }
.card-img { display: block; aspect-ratio: 4 / 3; overflow: hidden; background: var(--panel); }
.card-img img { width: 100%; height: 100%; object-fit: cover; transition: transform 1.1s var(--ease-out); }
.card:hover .card-img img { transform: scale(1.05); }
.card-empty { display: flex; align-items: flex-start; height: 100%; padding: 14px 16px; }
.card .label { display: flex; gap: 8px; margin-top: 12px; }
.card .label .n { color: var(--mute); }
.card-sub { display: block; margin-top: 2px; color: var(--mute); }

/* project page */
.hero { row-gap: 0; margin-top: 28px; }
.hero-img { grid-column: 1 / 5; height: clamp(360px, 68vh, 820px); overflow: hidden; background: var(--panel); }
.hero-img img { width: 100%; height: 100%; object-fit: cover; }
.title {
  grid-column: 1 / 3;
  margin-top: 88px;
  font-size: clamp(34px, 5vw, 80px);
  font-weight: 400;
  line-height: .95;
  letter-spacing: -.02em;
  text-transform: lowercase;
}
.intro { grid-column: 3 / 5; margin-top: 88px; font-size: clamp(22px, 2.5vw, 36px); line-height: 1.14; letter-spacing: -.02em; }
.meta { grid-column: 1 / 5; display: grid; grid-template-columns: subgrid; margin-top: 40px; }
.meta > div:nth-child(1) { grid-column: 1; }
.meta > div:nth-child(2) { grid-column: 2; }
.meta > div:nth-child(3) { grid-column: 3 / 5; }
.meta a { text-decoration: underline; text-underline-offset: 2px; }
/* project header: cover, then a big name, the summary with its facts beside it, and the tags */
.case .title { grid-column: 1 / -1; margin-top: 56px; font-size: clamp(48px, 9vw, 150px); line-height: .9; }
.case .intro { grid-column: 1 / 3; margin-top: 32px; font-size: 18px; line-height: 1.45; letter-spacing: 0; max-width: 62ch; }
.case .intro p + p { margin-top: .7em; }
.case .facts { grid-column: 4; margin-top: 32px; font-size: 18px; line-height: 1.6; }
.case .facts a { text-decoration: underline; text-underline-offset: 3px; }
.case .facts a.plink { display: inline-flex; align-items: center; gap: 8px; text-decoration: none; }
.case .facts a.plink span { text-decoration: underline; text-underline-offset: 3px; }
.case .facts a.plink svg { width: 16px; height: 16px; fill: currentColor; flex: none; }
.case .facts a.plink:hover { color: var(--mute); }
.chips { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 8px; margin-top: 24px; }
.chips li { padding: 5px 9px 4px; border: 1px solid currentColor; font-size: 13px; line-height: 1.2; text-transform: uppercase; letter-spacing: .03em; }

.body { margin-top: 120px; row-gap: 56px; }
.quote { grid-column: 1 / 4; font-size: clamp(26px, 3.4vw, 50px); line-height: 1.08; letter-spacing: -.03em; }
.quote figcaption { margin-top: 16px; }
.boards { grid-column: 1 / 5; }
.boards img, .boards video { display: block; width: 100%; height: auto; background: var(--panel); }
.boards video.pitch { margin-bottom: 64px; background: #000; }
/* a short note between board parts, in the site's own type */
.board-note { display: grid; grid-template-columns: repeat(4, 1fr); column-gap: var(--gap); padding: 64px 0 40px; }
.board-note .label { grid-column: 1 / 3; }
.board-note .text { grid-column: 3 / 5; font-size: 18px; line-height: 1.45; max-width: 52ch; }
.chapter { grid-column: 1 / 5; display: grid; grid-template-columns: subgrid; row-gap: 20px; }
.chapter .label { grid-column: 1 / 3; }
.chapter .text { grid-column: 3 / 5; font-size: 18px; line-height: 1.4; }
.chapter .text p + p { margin-top: .8em; }
.chapter pre { grid-column: 3 / 5; font: 13px/1.5 var(--sans); white-space: pre-wrap; }
.chapter figure { grid-column: 2 / 5; }
.pics { grid-column: 1 / 5; display: flex; gap: 8px; }
.pics figure { min-width: 0; }
.pics img, .chapter img { width: 100%; background: var(--panel); }
.caption { margin-top: 8px; color: var(--mute); }

.next { display: block; margin-top: 160px; padding: 0 var(--pad); }
.next .title { display: block; margin-top: 6px; transition: color .3s; }
.next:hover .title { color: var(--mute); }

.board iframe { display: block; grid-column: 1 / 5; width: 100%; height: 72vh; border: 0; background: var(--panel); }

/* about */
.about-text { grid-column: 3 / 5; margin-top: 40px; font-size: clamp(22px, 2.5vw, 36px); line-height: 1.14; letter-spacing: -.02em; }
.about-text p + p { margin-top: .6em; }
.portrait { grid-column: 1; margin-top: 40px; }
.portrait img { width: 100%; aspect-ratio: 5 / 6; object-fit: cover; background: var(--panel); }
.rows { margin-top: 120px; row-gap: 48px; }
.row { grid-column: 1 / 5; display: grid; grid-template-columns: subgrid; padding-top: 12px; border-top: 1px solid var(--line); }
.row > .label { grid-column: 1 / 3; }
.row > .content { grid-column: 3 / 5; }
.row li + li { margin-top: 6px; }
.row a { text-decoration: underline; text-underline-offset: 2px; }
.photos { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.photos img { aspect-ratio: 4 / 3; object-fit: cover; background: var(--panel); }
.movies { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.movies img { aspect-ratio: 2 / 3; object-fit: cover; background: var(--panel); }
.movies a { text-decoration: none; }
.spot iframe { display: block; width: 100%; height: 80px; border: 0; }
.spot + .spot { margin-top: 8px; }
.plain { grid-column: 3 / 5; margin-top: 40px; font-size: 18px; }
.plain p + p { margin-top: .8em; }

/* footer */
.foot { margin-top: 160px; padding-bottom: 20px; align-items: end; }
#cta { grid-column: 1 / 3; font-size: clamp(24px, 2.8vw, 42px); line-height: 1; letter-spacing: -.01em; text-transform: none; }
#cta .x { color: var(--mute); }
#links { grid-column: 3; align-self: center; }
#links { display: flex; gap: 18px; align-items: center; }
#links svg { display: block; width: 22px; height: 22px; fill: currentColor; transition: transform .4s var(--ease-out); }
#links a:hover svg { transform: translateY(-3px); }
#links a:hover, #copy a:hover { color: var(--mute); }
.foot { row-gap: 40px; }
#copy { grid-column: 1; grid-row: 2; color: var(--mute); white-space: nowrap; }
#privacy { grid-column: 4; grid-row: 2; justify-self: end; }
#privacy:hover { color: var(--mute); }

/* text that rises in line by line */
.lines .ln { display: block; overflow: hidden; }
.lines .ln > span { display: block; transform: translateY(105%); transition: transform 1s var(--ease-out); }
.lines.in .ln > span { transform: none; }

/* image that grows from the strip into the project page */
.fly { position: fixed; z-index: 30; margin: 0; overflow: hidden; pointer-events: none; contain: strict; will-change: left, top, width, height; }
.fly img { width: 100%; height: 100%; object-fit: cover; will-change: transform; }

@media (max-width: 760px) {
  .grid { grid-template-columns: 1fr 1fr; }
  .bar { gap: 12px; font-size: 10px; }
  .label, .foot { font-size: 12px; }
  .cards { grid-template-columns: 1fr; }
  /* the cards run top to bottom behind the header and loop */
  body.home .strip { position: fixed; inset: 0; margin: 0; padding: 0; overflow: clip; --w: 84vw; --h: 105vw; }
  body.home .track { flex-direction: column; align-items: center; padding: 0; }
  .info { top: calc(100% + 14px); left: 0; width: 100%; transform: translateY(-10px); gap: 6px; }
  .info-sub { font-size: 13px; }
  .info-text { font-size: 14px; }
  /* where the cards slide under the header and the bottom line they go soft and dark */
  body.home .bar, body.home .home-foot { position: relative; z-index: 2; isolation: isolate; }
  body.home .home-foot { margin-top: auto; }
  .is-white .bar::before { opacity: 0; }
  body.home .bar::before, body.home .home-foot::before {
    content: ""; position: absolute; left: 0; right: 0; z-index: -1; pointer-events: none; transition: opacity 1.2s ease;
    -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
  }
  body.home .bar::before {
    top: 0; height: calc(130px + env(safe-area-inset-top));
    background: linear-gradient(#000 0%, rgb(0 0 0 / .7) 35%, transparent);
    -webkit-mask-image: linear-gradient(#000 30%, transparent); mask-image: linear-gradient(#000 30%, transparent);
  }
  body.home .home-foot::before {
    bottom: 0; height: calc(110px + env(safe-area-inset-bottom));
    background: linear-gradient(transparent, rgb(0 0 0 / .7) 65%, #000);
    -webkit-mask-image: linear-gradient(transparent, #000 70%); mask-image: linear-gradient(transparent, #000 70%);
  }
  body.home #view { justify-content: center; }
  .home-foot .of { display: none; }
  .hero-img, .title, .intro, .meta, .quote, .boards, .chapter, .chapter .label, .chapter .text, .chapter pre,
  .about-text, .plain, .row, .row > .label, .row > .content, .pics, .board iframe { grid-column: 1 / -1; }
  .meta, .chapter, .row { grid-template-columns: 1fr 1fr; }
  .board-note { grid-template-columns: 1fr; row-gap: 8px; padding: 40px 0 24px; }
  .board-note .label, .board-note .text { grid-column: 1; font-size: 16px; }
  .meta > div:nth-child(3) { grid-column: 1 / -1; margin-top: 16px; }
  .title, .intro, .about-text { margin-top: 36px; }
  .hero-img { height: auto; aspect-ratio: 4 / 3; }
  .case .title { margin-top: 32px; }
  .case .intro, .case .facts { grid-column: 1 / -1; font-size: 16px; }
  .case .intro { margin-top: 20px; }
  .case .facts { margin-top: 16px; }
  .body { margin-top: 64px; }
  .pics { flex-direction: column; }
  .movies { grid-template-columns: repeat(3, 1fr); }
  .foot { row-gap: 24px; }
  #cta { grid-column: 1 / -1; }
  #links { grid-column: 1 / -1; grid-row: 2; }
  #copy { grid-column: 1; grid-row: 3; }
  #privacy { grid-column: 2; grid-row: 3; }
}
@media (prefers-reduced-motion: reduce) {
  .dot, .grain { animation: none; }
  .lines .ln > span { transform: none; transition: none; }
  #view, .fly, .tile, .tile img, .bar > * > span { transition: none; }
}

/* the page runs under the notch and the home bar; keep the text clear of them */
.bar { padding-top: calc(18px + env(safe-area-inset-top)); }
.bar, .home-foot, .grid, .next { padding-left: calc(var(--pad) + env(safe-area-inset-left)); padding-right: calc(var(--pad) + env(safe-area-inset-right)); }
.home-foot { padding-bottom: calc(18px + env(safe-area-inset-bottom)); }
.foot { padding-bottom: calc(20px + env(safe-area-inset-bottom)); }
