/* ---------- Design tokens (editable live with the tweak panel: add ?tweak to any URL) ---------- */
:root {
  --bg: #000000;
  --fg: #ffffff;
  --muted: #6e6e6e;
  --panel: #0d0d0d;
  --radius: 20px;
  --pad: 20px;
  --gap: 12px;
  --scale: 1;
  --font: "Helvetica Neue", Helvetica, "Inter Tight", Arial, sans-serif;
  --line: color-mix(in srgb, var(--fg) 30%, transparent);
}
* { box-sizing: border-box; }
html { background: var(--bg); color: var(--fg); -webkit-text-size-adjust: 100%; }
body { margin: 0; min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; font: 500 13px/1.3 var(--font); letter-spacing: -0.01em; -webkit-font-smoothing: antialiased; }
main { flex: 1; }
/* Every text link rolls over to its own colour: --hover, set per link in js/site.js from the palette in js/wada.js. */
a { color: inherit; text-decoration: none; }
img, video { display: block; width: 100%; height: 100%; object-fit: cover; }
h1, h2, h3, p { margin: 0; font-weight: 500; }
.h-lg { font-size: calc(clamp(28px, 3.5vw, 60px) * var(--scale)); line-height: 1; letter-spacing: -0.035em; font-weight: 500; text-wrap: balance; }
.muted, .h-lg .muted { color: var(--muted); }
a.muted:hover { color: var(--hover, var(--fg)); }
.rule { border: 0; border-top: 1px solid var(--line); margin: 0 var(--pad); }

/* ---------- Header ---------- */
.site-header { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between; padding: 14px var(--pad); background: var(--bg); }
.logo { display: block; font-size: 40px; font-weight: 700; letter-spacing: -0.05em; line-height: 1; }
.logo img { height: 48px; width: auto; object-fit: contain; }
.site-header nav { display: flex; gap: 32px; font-size: 26px; letter-spacing: -0.03em; }
.site-header nav a[aria-current] { color: var(--muted); }
.site-header nav a { transition: color .15s; }
.site-header nav a:hover, .site-header nav a:focus-visible { color: var(--hover, var(--muted)); }

/* ---------- Loading screen (homepage, first visit of a session) ----------
   The Mason London mark sits at 25% and the full-white version wipes in from the left as the 3D scene
   loads (--p runs 0 to 1, driven from js/site.js). */
.loader { display: none; position: fixed; inset: 0; z-index: 300; place-items: center; background: #000; transition: opacity .5s; }
html.is-loading .loader { display: grid; }
html.is-loading { overflow: hidden; }
.loader.done { opacity: 0; pointer-events: none; }
.loader-mark { position: relative; width: min(72vw, 620px); aspect-ratio: 1200 / 154; }
.loader-mark img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; opacity: .25; }
.loader-mark .loader-fill { opacity: 1; clip-path: inset(0 calc(100% - var(--p, 0) * 100%) 0 0); }

/* ---------- Home ---------- */
.hero { position: relative; width: calc(100% - var(--pad) * 2); max-width: 1500px; margin: 6px auto 0; aspect-ratio: 16 / 9; max-height: calc(100vh - 120px); border-radius: var(--radius); overflow: hidden; }
/* Grade for the 3D scene: more contrast, a little darker, hue shifted -7. */
.hero canvas { display: block; width: 100%; height: 100%; filter: contrast(1.22) brightness(.94) saturate(1.12) hue-rotate(-7deg); }

.intro { padding: clamp(36px, 5vw, 80px) var(--pad) clamp(60px, 9vw, 150px); }
/* A full-width type box: the size is fixed, so a wider window means fewer, longer lines. */
.intro p { font-size: calc(48px * var(--scale)); text-wrap: wrap; }

/* Client links in the intro: white like the rest of the text, underlined so they read as links. */
.intro-link { color: var(--fg); text-decoration: underline; text-decoration-thickness: .06em; text-underline-offset: .12em; }
.intro-link { transition: color .15s; }
.intro-link:hover, .intro-link:focus-visible { color: var(--hover, var(--muted)); }
/* Keeps "others." and the arrow together so the arrow never wraps onto a line by itself. */
.keep { white-space: nowrap; }
/* The "deal three different clients" button at the end of the intro. */
.reroll { all: unset; cursor: pointer; display: inline-block; line-height: 1; margin-left: .06em; position: relative; top: .11em; /* sits a touch lower, clear of the line above */ transition: transform .5s cubic-bezier(.3, 1.3, .5, 1), color .15s; }
/* Drawn to sit with the type: as tall as a capital letter, with a stroke the weight of the letters' stems. */
.reroll svg { display: block; width: .74em; height: .74em; fill: none; stroke: currentColor; stroke-width: 3.5; stroke-linecap: butt; stroke-linejoin: miter; }
.reroll:hover, .reroll:focus-visible { color: var(--hover, var(--muted)); }
/* Sentence filter (homepage): one line in the intro's type; the discipline words are the filter. */
.sentence { margin: 0; font-size: calc(48px * var(--scale)); font-weight: 500; line-height: 1; letter-spacing: -0.035em; }
/* The pointing-down emoji sits a touch lower so it doesn't crowd the line above. */
.sentence .nudge { display: inline-block; transform: translateY(.11em); }
.sentence-head { padding: 0 var(--pad) clamp(28px, 4vw, 60px); }
.sentence-top { padding-top: clamp(20px, 3vw, 44px); }
.sentence-foot { padding: clamp(20px, 3vw, 50px) var(--pad) 0; }
.sentence button { all: unset; cursor: pointer; text-decoration: underline; text-decoration-thickness: .06em; text-underline-offset: .12em; transition: color .15s, opacity .15s; }
.sentence button:hover, .sentence button:focus-visible, .sentence button[aria-pressed="true"] { color: var(--hover, var(--fg)); }
.sentence.is-filtered button:not([aria-pressed="true"]):not(:hover) { color: var(--muted); }
.see-all { display: inline-block; text-decoration: underline; text-decoration-thickness: .06em; text-underline-offset: .12em; transition: color .15s; }
.see-all:hover, .see-all:focus-visible { color: var(--hover, var(--muted)); }
/* Same width as the intro box. Heading on the left; the Discipline filter is pinned to the right edge. */
.section-head { display: flex; gap: clamp(20px, 4vw, 70px); padding: 0 var(--pad) clamp(28px, 4vw, 60px); align-items: flex-start; }
.section-head h2, .section-head h1 { grid-column: 1 / span 3; }
.small-link { grid-column: 4 / span 3; font-size: 12px; color: var(--muted); padding-top: 4px; }
a.small-link:hover, a.small-link:focus-visible { color: var(--hover, var(--fg)); }
.filter { margin-left: auto; display: grid; grid-template-columns: auto 1fr; gap: 0 10px; font-size: 12px; line-height: 1.25; }
.filter ul { list-style: none; margin: 0; padding: 0; }
.filter button { all: unset; cursor: pointer; color: var(--muted); }
.filter button[aria-pressed="true"] { color: var(--fg); }
.filter button:hover { color: var(--hover, var(--fg)); }
.filter:not(.is-filtered) button { color: var(--fg); }
.filter:not(.is-filtered) button:hover { color: var(--hover, var(--muted)); }

/* ---------- Project grid ---------- */
.grid { padding: 0 var(--pad); }
.row { display: flex; gap: var(--gap); width: var(--w, 100%); margin-bottom: clamp(18px, 2.4vw, 36px); align-items: flex-start; }
.card { display: block; min-width: 0; }
.card .cap { display: flex; gap: 8px; padding: 8px 2px 0; font-size: 12px; }
.card .cap .muted { margin-left: auto; white-space: nowrap; }
.media { position: relative; overflow: hidden; border-radius: var(--radius); background: var(--panel); }
.card .media { transition: opacity .25s; }
.card:hover .media { opacity: .82; }
.card .cap span:first-child { transition: color .15s; }
.card:hover .cap span:first-child, .card:focus-visible .cap span:first-child { color: var(--hover, var(--fg)); }
.empty { padding: 40px 0 80px; color: var(--muted); }

/* ---------- Video sound badge ---------- */
.media.is-video.is-clickable { cursor: pointer; }
.sound { position: absolute; right: 12px; bottom: 12px; padding: 6px 10px; border-radius: 999px; background: rgba(0,0,0,.55); color: #fff; font-size: 11px; backdrop-filter: blur(8px); pointer-events: none; opacity: 0; transition: opacity .2s; }
.media:hover .sound, .media.sound-on .sound { opacity: 1; }
@media (hover: none) { .sound { opacity: 1; } }

/* ---------- Project page ---------- */
.project-head { padding: clamp(20px, 3vw, 44px) var(--pad) clamp(40px, 6vw, 96px); }
.project-head h1 { max-width: 16em; }
.project-head .year { margin-top: 12px; font-size: calc(clamp(15px, 1.4vw, 22px) * var(--scale)); letter-spacing: -0.02em; color: var(--muted); }
.brief { display: grid; grid-template-columns: repeat(12, 1fr); gap: var(--gap); padding: 16px var(--pad) clamp(40px, 6vw, 90px); }
.brief h2 { grid-column: 1 / span 5; font-size: calc(clamp(22px, 2.2vw, 36px) * var(--scale)); letter-spacing: -0.035em; line-height: 1; }
.brief .body { grid-column: 7 / span 5; font-size: 14px; line-height: 1.35; max-width: 46em; }
.brief .tags { margin-top: 18px; display: flex; flex-wrap: wrap; gap: 6px; }
.tag { font-size: 11px; padding: 3px 8px; border-radius: 999px; background: color-mix(in srgb, var(--fg) 12%, transparent); }
.gallery { padding: var(--pad); display: flex; flex-direction: column; gap: var(--gap); }
.g-row { display: flex; gap: var(--gap); justify-content: center; }
/* x100: flex shares that add up to less than 1 leave part of the row empty, which made lone pieces come out small */
.g-item { flex: calc(var(--ar) * 100) 1 0; min-width: 0; margin: 0; }
/* All-video projects: each video fills the window height (or the page width, if that comes first). */
.g-row.scatter.full .g-item { --wd: min(100%, (100vh - 90px) * var(--ar)); }
/* Feature opening: hero video with two stills stacked beside it, sized so both sides are exactly the same
   height (--a0 = hero's width/height, --s = the stacked pair's combined height per unit width).
   Like the portrait rows, it never grows taller than the window. */
.g-feature { display: flex; align-items: flex-start; gap: var(--gap); width: 100%; margin-inline: auto;
  max-width: calc((100vh - 90px) * var(--a0) + var(--gap) + (100vh - 90px - var(--gap)) / var(--s)); }
.g-feature .g-hero { flex: 1 1 0; }
.g-feature .g-stack { flex: none; display: flex; flex-direction: column; gap: var(--gap);
  width: calc(((100% - var(--gap)) / var(--a0) - var(--gap)) / (var(--s) + 1 / var(--a0))); }
.g-feature .g-stack .g-item { flex: none; width: 100%; }
/* Single-row projects: one piece per row, 1.5x its shared-row size, scattered left to right (--x is 0 to 1). */
.g-row.scatter { display: block; }
.g-row.scatter .g-item {
  /* never wider than the page, and never taller than the window */
  --wd: min(100%, (100vh - 90px) * var(--ar), calc(1.5 * var(--share) * min(100% - var(--gap) * (var(--n) - 1), (100vh - 90px) * var(--sum))));
  width: var(--wd); margin-left: calc((100% - var(--wd)) * var(--x));
}
.g-item figcaption { padding: 8px 2px 10px; font-size: 12px; }
/* rows of portrait pieces never grow taller than the window */
.g-row.portraits { width: 100%; max-width: calc((100vh - 90px) * var(--sum) + var(--gap) * (var(--n) - 1)); margin-inline: auto; }
.related { padding: 16px var(--pad) clamp(50px, 7vw, 110px); }
.related h2 { font-size: calc(clamp(22px, 2.2vw, 36px) * var(--scale)); letter-spacing: -0.035em; line-height: 1; margin-bottom: clamp(24px, 3vw, 44px); }
.related-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--gap); }
.related-grid .media { aspect-ratio: 4 / 5 !important; }

/* ---------- Image viewer (click a still on a project page) ---------- */
.media.is-zoomable { cursor: zoom-in; }
html.viewer-open { overflow: hidden; }
.viewer { position: fixed; inset: 0; z-index: 200; display: grid; place-items: center; cursor: zoom-out;
  background: color-mix(in srgb, var(--bg) 45%, transparent);
  -webkit-backdrop-filter: blur(34px) saturate(1.3); backdrop-filter: blur(34px) saturate(1.3);
  opacity: 0; transition: opacity .2s; }
.viewer.open { opacity: 1; }
/* As large as fits with 20px clear of the nearest window edges. */
.viewer-frame { position: relative; margin: 0; width: min(100vw - 40px, (100vh - 40px) * var(--ar)); width: min(100vw - 40px, (100dvh - 40px) * var(--ar)); aspect-ratio: var(--ar); }
.viewer-frame img { width: 100%; height: 100%; object-fit: contain; border-radius: var(--radius); }
/* A small X just outside the top-right corner (it sits within the 20px margin when the image is full width). */
.viewer-x { all: unset; position: absolute; top: 0; left: calc(100% + 4px); width: 14px; font-size: 13px; line-height: 1; text-align: center; color: var(--fg); cursor: pointer; }
.viewer-x:focus-visible { outline: 1px solid var(--fg); outline-offset: 2px; }

/* ---------- Contact ---------- */
.contact { padding: clamp(20px, 3vw, 44px) var(--pad); min-height: 55vh; }
.contact-copy { margin-top: clamp(28px, 4vw, 60px); max-width: 30em; font-size: calc(clamp(17px, 1.6vw, 24px) * var(--scale)); line-height: 1.2; letter-spacing: -0.02em; display: grid; gap: 1em; }
.contact-copy a { color: var(--fg); text-decoration: underline; text-decoration-thickness: .06em; text-underline-offset: .12em; transition: color .15s; }
.contact-copy a:hover, .contact-copy a:focus-visible { color: var(--hover, var(--fg)); }

/* ---------- Footer ---------- */
.site-footer { padding: clamp(50px, 8vw, 130px) var(--pad) 14px; overflow: hidden; }
.big-contact { display: block; white-space: nowrap; font-weight: 700; letter-spacing: -0.06em; line-height: .78; font-size: 20vw; padding-bottom: .06em; }
.big-contact span { display: inline-block; transform-origin: left; }
.big-contact { transition: color .15s; }
.big-contact:hover, .big-contact:focus-visible { color: var(--hover, var(--muted)); }
.copyright { margin-top: 18px; font-size: 11px; }

/* ---------- Mobile ---------- */
@media (max-width: 760px) {
  :root { --pad: 12px; --gap: 8px; }
  .site-header nav { gap: 18px; font-size: 20px; }
  .logo img { height: 40px; }
  .hero { aspect-ratio: 4 / 5; }
  .intro p, .sentence { font-size: calc(30px * var(--scale)); }
  .section-head { display: grid; grid-template-columns: 1fr 1fr; gap: 22px var(--gap); }
  .section-head h2, .section-head h1 { grid-column: 1; }
  .small-link { grid-column: 2; text-align: right; padding-top: 10px; }
  .filter { grid-column: 1 / -1; margin-left: 0; }
  .filter ul { display: flex; flex-wrap: wrap; gap: 4px 14px; }
  .row, .row.pair { display: block; width: auto; margin-bottom: 0; }
  .card { margin-bottom: 22px; }
  .brief { display: block; }
  .brief .body { margin-top: 18px; }
  .g-row { flex-direction: column; }
  .g-row.portraits { max-width: none; }
  .g-item { flex: none; width: 100%; }
  .g-row.scatter .g-item { width: 100%; margin-left: 0; }
  .g-feature { flex-direction: column; max-width: none; }
  .g-feature .g-hero { flex: none; width: 100%; }
  .g-feature .g-stack { width: 100%; }
  .related-grid { grid-template-columns: 1fr; gap: 22px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* ---------- Tweak panel ---------- */
.tweaks { position: fixed; right: 14px; bottom: 14px; z-index: 100; width: 270px; max-height: calc(100vh - 28px); overflow: auto; padding: 14px; border-radius: 14px; background: #1b1b1b; color: #fff; font: 500 12px/1.3 "Helvetica Neue", Helvetica, Arial, sans-serif; letter-spacing: 0; box-shadow: 0 10px 40px rgba(0,0,0,.5), 0 0 0 1px rgba(255,255,255,.12); }
.tweaks h3 { font-size: 13px; font-weight: 700; display: flex; justify-content: space-between; margin-bottom: 10px; }
.tweaks label { display: grid; grid-template-columns: 1fr 110px; align-items: center; gap: 8px; margin: 7px 0; }
.tweaks input[type=color] { width: 100%; height: 26px; padding: 0; border: 1px solid #444; border-radius: 6px; background: none; }
.tweaks input[type=range] { width: 100%; height: auto; }
.tweaks select { width: 100%; background: #2a2a2a; color: #fff; border: 1px solid #444; border-radius: 6px; padding: 4px; font: inherit; }
.tweaks .btns { display: flex; gap: 6px; margin-top: 12px; }
.tweaks button { flex: 1; cursor: pointer; padding: 7px 8px; border-radius: 8px; border: 1px solid #555; background: #2a2a2a; color: #fff; font: inherit; }
.tweaks button:hover { background: #3a3a3a; }
.tweaks button.x { flex: none; border: 0; background: none; padding: 0 4px; }
.tweaks p { margin-top: 10px; color: #999; font-weight: 400; }
