/*
 * The two typefaces, served from this site (media/fonts). Each file holds every weight the page uses.
 * The "latin" files cover English and French; the "latin-ext" ones are only fetched if a character
 * outside them turns up, a Polish or Czech name for instance.
 */
@font-face {
  font-family: "Syne";
  font-weight: 600 800;
  font-display: swap;
  src: url(media/fonts/syne-latin.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Syne";
  font-weight: 600 800;
  font-display: swap;
  src: url(media/fonts/syne-latin-ext.woff2) format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "IBM Plex Sans";
  font-weight: 400 500;
  font-display: swap;
  src: url(media/fonts/ibm-plex-sans-latin.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "IBM Plex Sans";
  font-weight: 400 500;
  font-display: swap;
  src: url(media/fonts/ibm-plex-sans-latin-ext.woff2) format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
  --night: #16161A;
  /* a touch deeper than the #FF5722 of the logo file: 3.9:1 on white instead of 3.2:1, so it can carry large text */
  --orange: #E64A19;
  --coral: #FF8A65;
  --sand: #FFD3BF;
  --paper: #F9F8F6;
  --muted: #5D5D66;

  --display: "Syne", system-ui, sans-serif;
  --body: "IBM Plex Sans", system-ui, sans-serif;
  --gutter: clamp(1.25rem, 5vw, 5rem);
  --corner: .5rem;
  --soft: 12%;
  /* the room above and below the content of a section */
  --band: clamp(4.5rem, 13vh, 8.5rem);

  /*
   * Graph paper, as on the labs site: a faint line every cell and a slightly stronger one every fifth,
   * showing only where a light falls on the sheet and fading to nothing away from it.
   * --grid is the paper itself; its first strong vertical line falls on the left margin, so the content
   * stands on it, and it starts half a cell up so that no line runs along the top edge of a section. --light is where the light falls in a section (across, down) and --reach how far it carries.
   * To make the lines fainter or stronger, change the two --rule colours; to change their scale, --cell.
   */
  --cell: 1.75rem;
  --rule: rgba(22, 22, 26, .04);
  --rule-strong: rgba(22, 22, 26, .075);
  --grid:
    linear-gradient(to right, var(--rule-strong) 1px, transparent 1px) var(--gutter) calc(var(--cell) / -2) / calc(var(--cell) * 5) calc(var(--cell) * 5),
    linear-gradient(to bottom, var(--rule-strong) 1px, transparent 1px) var(--gutter) calc(var(--cell) / -2) / calc(var(--cell) * 5) calc(var(--cell) * 5),
    linear-gradient(to right, var(--rule) 1px, transparent 1px) var(--gutter) calc(var(--cell) / -2) / var(--cell) var(--cell),
    linear-gradient(to bottom, var(--rule) 1px, transparent 1px) var(--gutter) calc(var(--cell) / -2) / var(--cell) var(--cell);
  --light: 82% 24%;
  --reach: max(22rem, 46vw);
}

/*
 * Corners. Nothing on the page is perfectly sharp, and nothing is round.
 * The square mark (the full stops, and the big square of the opening) has its corners eased by a share of
 * its side (--soft), so it keeps the same shape at every size; site.js uses the same share.
 * Everything that is a surface, cards, buttons, pictures, gets one small radius (--corner).
 */
*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--night);
  font: 400 1.125rem/1.6 var(--body);
  -webkit-font-smoothing: antialiased;
}

/*
 * The grounds of the page. Each is graph paper under a wash of its own colour that is clear where the
 * light falls and solid away from it, so the lines fade out with a soft edge, as light does.
 *
 * Paper and white take turns down the page. "Selected work" is out of the page for now, so the turns
 * are: services on paper, clients on white, contact and footer on paper. When it comes back it takes
 * the white after the services, and .clients, .contact and .foot swap grounds again.
 */
.pin, .services, .contact {
  background:
    radial-gradient(circle var(--reach) at var(--light), rgba(249, 248, 246, 0) 0%, rgba(249, 248, 246, .3) 35%, rgba(249, 248, 246, .78) 68%, #F9F8F6 100%),
    var(--grid),
    var(--paper);
}
.work, .clients {
  background:
    radial-gradient(circle var(--reach) at var(--light), rgba(255, 255, 255, 0) 0%, rgba(255, 255, 255, .3) 35%, rgba(255, 255, 255, .78) 68%, #fff 100%),
    var(--grid),
    #fff;
}
/*
 * Where the light falls, section by section. It wanders down the page: to the right, low on the left,
 * off the bottom edge, in from a corner. Never the same place or the same size twice running.
 * It must die out before it reaches a rule (the one above the logos, the one above the footer): grid
 * lines running into a rule and stopping there make the rule look like a mistake in the grid.
 */
.pin { --light: 76% 36%; --reach: max(24rem, 52vw); }
.services { --light: 10% 82%; --reach: max(18rem, 36vw); }
.work { --light: 58% 104%; --reach: max(20rem, 42vw); }
.clients { --light: 100% 0%; --reach: max(12rem, 22vw); }
.contact { --light: 66% 40%; --reach: max(16rem, 28vw); }

h1, h2, h3 { font-family: var(--display); margin: 0; }
h2, h3 { text-wrap: balance; }
p { margin: 0 0 1rem; }
/* links keep the colour of the text around them; it is their underline that is orange */
a { color: inherit; border-radius: calc(var(--corner) / 2); text-underline-offset: .22em; text-decoration-thickness: 2px; text-decoration-color: var(--orange); }

/*
 * The focus ring is dark, not orange: orange on the off-white page falls just short of the 3:1
 * a focus indicator needs to be seen.
 */
a:focus-visible {
  outline: 3px solid var(--night);
  outline-offset: 3px;
}
/* main only takes focus when the skip link sends it there; it needs no ring of its own */
main:focus { outline: none; }

/* The first stop for a keyboard: out of sight until it has focus */
.skip {
  border-radius: var(--corner);
  position: absolute;
  z-index: 10;
  top: .75rem;
  left: var(--gutter);
  padding: .9rem 1.2rem;
  background: var(--night);
  color: var(--paper);
  font: 700 1rem/1 var(--display);
  text-decoration: none;
  transform: translateY(-400%);
}
.skip:focus { transform: none; }

h2 {
  font-weight: 800;
  font-size: clamp(2.25rem, 5.4vw, 5rem);
  line-height: .98;
  letter-spacing: -.035em;
}

/* ---------- Hero: paper, with an orange full stop that swallows the screen ---------- */

/*
 * The hero is a sheet lying over the top of the page. It stays put while the page scrolls up behind it,
 * and the full stop grows with the scroll: first an orange disc, then a ring with the next section
 * showing through its middle (site.js). When the ring has left the screen the next section is already
 * in place, so no scrolling is spent on an empty screen.
 *
 * The staying put only happens under .motion, which site.js sets. Without it (no script, or a visitor
 * who asked for less motion) the hero and the banner are ordinary content that scrolls away.
 */
.pin {
  /* at least one screen tall, and taller when the text needs it: on a short or zoomed-in screen nothing is cut off */
  min-height: 100vh;
  min-height: 100svh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  /* the top padding keeps the headline clear of the banner */
  padding: 5.5rem var(--gutter) clamp(2rem, 6vh, 4rem);
}
/*
 * Held still, the hero is ordinary content and need not fill a window far taller than a screen. That is
 * the window a search engine lays the page out in: without this, its picture of the page would be one
 * enormous empty sheet with the rest of the content far below it.
 */
html:not(.motion) .pin {
  min-height: min(100vh, 90rem);
  min-height: min(100svh, 90rem);
}
.motion .hero {
  position: sticky;
  /* --stick is 0, or negative when the hero is taller than the screen, so that its bottom is reached first */
  top: var(--stick, 0px);
  z-index: 2;
  /* once the sheet is fully open it must not catch clicks meant for the page under it */
  pointer-events: none;
}
.motion .pin { pointer-events: auto; }
/* fully open: nothing of the sheet or the banner is left to see or to click */
.opened .pin, .opened .top { opacity: 0; pointer-events: none; }

/* The banner lies across the top of the hero */
.top {
  position: absolute;
  inset: 0 0 auto 0;
  z-index: 3;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 0 var(--gutter);
}
/* it stays with the hero, and takes no room of its own so the page under it is not pushed down */
.motion .top {
  position: sticky;
  top: var(--stick, 0px);
  height: 0;
}
.brand { margin-top: 1.4rem; }
.brand img { display: block; height: 1.75rem; width: auto; }
.top nav { margin-top: 1.25rem; }
.top nav { display: flex; gap: clamp(1rem, 2.5vw, 2.25rem); }
.top nav a {
  padding: .5rem 0;
  font: 700 1rem/1 var(--display);
  text-decoration: none;
}
.top nav a {
  background: linear-gradient(var(--orange), var(--orange)) 0 100% / 0 2px no-repeat;
  transition: background-size .25s ease;
}
.top nav a:hover { background-size: 100% 2px; }

h1 {
  font-weight: 800;
  /* as large as the screen allows in both directions */
  font-size: min(15.2vw, 30vh);
  line-height: .86;
  letter-spacing: -.05em;
  margin: 0 0 clamp(1.5rem, 4vh, 3rem) -.04em;
}
/*
 * Each line is sized to fit on one row. If a visitor widens the letter spacing, a line is allowed to break,
 * even inside a word, because losing the end of the headline off the edge would be worse.
 */
h1 .line { display: block; overflow-wrap: anywhere; }
/* the full stop of every title: a small square standing on the baseline, as in the logo */
/* keeps a title's last word and its full stop on the same line */
.end { white-space: nowrap; }
.dot {
  display: inline-block;
  width: .18em;
  height: .18em;
  margin-left: .05em;
  background: var(--orange);
  border-radius: var(--soft);
}

.intro {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem 3rem;
}
.intro p { margin: 0; max-width: 34rem; font-size: clamp(1.125rem, 1.5vw, 1.3rem); font-weight: 500; }
.actions { display: flex; align-items: center; flex-wrap: wrap; gap: .75rem 1.75rem; }
.button {
  border-radius: var(--corner);
  display: inline-block;
  padding: 1rem 1.6rem;
  background: var(--night);
  color: var(--paper);
  font: 700 1rem/1 var(--display);
  text-decoration: none;
  transition: background-color .2s ease;
}
.button:hover { background: #34343C; }
.quiet { padding: .5rem 0; font-weight: 500; }
.quiet:hover { text-decoration-thickness: 3px; }

/*
 * As the square takes over, the headline and its text draw back a little: they slide away from it and
 * swell very slightly, as if the sheet were being pushed towards the viewer. --open goes from 0 to 1
 * with the scroll (site.js).
 */
.motion .pitch {
  transform-origin: 0 100%;
  transform: translate3d(calc(var(--open, 0) * -2.5rem), calc(var(--open, 0) * -1rem), 0) scale(calc(1 + var(--open, 0) * .04));
}

/* The orange square that grows from the full stop; site.js sets its shape */
.flood {
  position: absolute;
  inset: 0;
  background: var(--orange);
  clip-path: inset(50%);
  pointer-events: none;
}

/* The one entrance on the page: the two lines of the headline rise into place */
h1 .line, .intro { animation: rise .9s cubic-bezier(.2, .8, .2, 1) both; }
h1 .line:nth-child(2) { animation-delay: .09s; }
.intro { animation-name: fade; animation-delay: .5s; }
@keyframes rise { from { opacity: 0; transform: translateY(.25em); } }
@keyframes fade { from { opacity: 0; } }

/* ---------- Services: three white cards ---------- */

/*
 * Sections are told apart by their ground: paper and white take turns down the page,
 * and each section has the same room above and below its content.
 */
.services { padding: var(--band) var(--gutter); }
.services h2 { max-width: 16ch; margin-bottom: clamp(1.25rem, 3vh, 2rem); }
/* one sentence under the title, about how the three steps below are carried out */
.services .note { max-width: 36rem; margin-bottom: clamp(2.5rem, 7vh, 4.5rem); font-size: clamp(1.125rem, 1.5vw, 1.3rem); font-weight: 500; }
.cols { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: clamp(1rem, 2vw, 2rem); }
.service { padding: clamp(1.5rem, 2.5vw, 2.5rem); border-radius: var(--corner); background: #fff; }
.service h3 {
  font-weight: 800;
  font-size: clamp(1.3rem, 2.2vw, 2.1rem);
  line-height: 1;
  letter-spacing: -.035em;
  margin-bottom: 1.25rem;
  /* orange is only used for text this large: at reading sizes it is too pale on white to read comfortably */
  color: var(--orange);
  /* keeps the full stop on the same line as its word */
  white-space: nowrap;
}
.service h3::after {
  content: "";
  display: inline-block;
  width: .18em;
  height: .18em;
  margin-left: .06em;
  /* the logo turned inside out: orange word, dark full stop */
  background: var(--night);
  border-radius: var(--soft);
}
.service p:last-child { margin: 0; }

/* ---------- The small paper dioramas at the top of the service cards ---------- */

/*
 * A box with sheets of cut paper at different depths. The box leans a little with the pointer and the
 * scroll (--turn and --tip, set by site.js), which makes the sheets slide over one another.
 * Nothing here moves on its own.
 */
.scene3d {
  border-radius: var(--corner);
  position: relative;
  height: 9.5rem;
  margin-bottom: 1.5rem;
  overflow: hidden;
  background: #EFEDE9;
  perspective: 480px;
}
/* the inside of the box is a little in shadow along its top edge */
.scene3d::after {
  border-radius: inherit;
  content: "";
  position: absolute;
  inset: 0;
  box-shadow: inset 0 .6rem .9rem -.6rem rgba(22, 22, 26, .28);
  pointer-events: none;
}
.world {
  position: relative;
  height: 100%;
  transform-style: preserve-3d;
  transform: rotateX(var(--tip, 0deg)) rotateY(var(--turn, 0deg));
}
.motion .world { transition: transform .4s ease-out; }
/*
 * A sheet further away would look smaller, so each one is scaled back up by exactly as much (480 is the
 * distance of the viewer, the same as the perspective above): at rest the scene looks flat and correct,
 * and the depth only shows when the box leans.
 */
.sheet {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  /* the sheets run past the edges of the drawing, so leaning the box never shows where they end */
  overflow: visible;
  transform: translateZ(calc(var(--z) * 1px)) scale(calc(1 - var(--z) / 480));
  /* every sheet drops a soft shadow on the one behind it */
  filter: drop-shadow(0 -.12rem .3rem rgba(22, 22, 26, .2));
}
.paper { fill: #fff; }
/* people and what they work on are dark; what they make or hold is orange */
.fig { fill: var(--night); }
.fig .limb { fill: none; stroke: var(--night); stroke-linecap: round; stroke-linejoin: round; }
.fig .paper { fill: #fff; stroke: var(--night); stroke-width: 4; stroke-linejoin: round; }
.fig .device { fill: var(--orange); }
.fig .ink { fill: none; stroke: var(--orange); stroke-linecap: round; }

/* ---------- Work: no cards here, the screenshots sit straight on the page ---------- */

/* The section is out of the page until there are real projects to show; these rules wait for its return. */

.work { padding: var(--band) var(--gutter); }
.work .head { margin-bottom: clamp(2.5rem, 7vh, 4.5rem); }
.projects {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(3rem, 8vh, 5rem) clamp(1.5rem, 3vw, 3rem);
}
/* the first project takes the full width, with its text beside the screenshot */
.project:first-child {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: minmax(0, 1.8fr) minmax(0, 1fr);
  gap: clamp(1.5rem, 3vw, 3rem);
  align-items: end;
}
.shot {
  border-radius: var(--corner);
  aspect-ratio: 16 / 10;
  overflow: hidden;
  margin-bottom: 1.5rem;
  transition: transform .3s cubic-bezier(.3, 1.4, .5, 1), box-shadow .2s ease;
}
.project:first-child .shot { margin-bottom: 0; }
.shot img { display: block; width: 100%; height: 100%; object-fit: cover; }
/* a slot still waiting for its screenshot */
.shot.empty {
  display: grid;
  place-items: center;
  border: 1.5px dashed rgba(22, 22, 26, .3);
  color: var(--muted);
  font-size: .9375rem;
}
/* the screenshot lifts a little when its project is pointed at */
.project:hover .shot { transform: translateY(-.4rem) rotate(-.6deg); box-shadow: 0 0 0 2px var(--orange); }
.project h3 { font-weight: 700; font-size: clamp(1.4rem, 2.2vw, 2.1rem); line-height: 1.08; letter-spacing: -.025em; margin-bottom: .5rem; }
.project:first-child h3 { font-size: clamp(1.6rem, 3vw, 2.9rem); }
.project p { max-width: 34rem; }
.project p.meta { font-weight: 500; margin-bottom: .75rem; }
.project p.role { margin: 0; color: var(--muted); font-size: 1rem; }

/* ---------- Clients: plain rows of logos under a rule ---------- */

.clients { padding: var(--band) var(--gutter); }
.clients h2 { margin-bottom: clamp(2rem, 6vh, 4rem); }
.clients ul {
  list-style: none;
  margin: 0;
  position: relative;
  padding: clamp(2rem, 5vh, 3.5rem) 0 0;
  /* rows of four, three or two logos, each logo starting at the left of its column */
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  align-items: center;
  gap: clamp(2.5rem, 6vh, 4rem) clamp(1.5rem, 4vw, 4rem);
}
.clients ul::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 1px;
  background: rgba(22, 22, 26, .2);
  transform-origin: left;
}
/*
 * Every logo starts from the same height; --s then corrects it for the logo's shape, so that a long thin
 * logo and a compact one carry about the same weight (--s is set on each image, see index.html).
 * A logo wider than its column is fitted inside it without being stretched.
 */
.clients img {
  display: block;
  height: calc(clamp(2.5rem, 4.2vw, 4rem) * var(--s, 1));
  width: auto;
  max-width: 100%;
  object-fit: contain;
  object-position: left center;
}

/* ---------- Contact: the address in large type, underlined in orange, well under the size of the title ---------- */

.contact { padding: var(--band) var(--gutter); }
.contact h2 { max-width: 18ch; }
.mail { margin: clamp(2.5rem, 8vh, 5rem) 0 1.5rem; }
.mail a {
  /* never below 18.7px: under that, bold orange on white is no longer large enough to read comfortably */
  font: 800 clamp(1.17rem, 3.4vw, 3.25rem)/1 var(--display);
  letter-spacing: -.04em;
  color: var(--orange);
  text-decoration: none;
  padding-bottom: .1em;
  background: linear-gradient(var(--orange), var(--orange)) 0 100% / 100% .06em no-repeat;
  transition: background-size .2s ease;
  overflow-wrap: anywhere;
}
.mail a:hover { background-size: 100% .11em; }
.more { display: flex; flex-wrap: wrap; gap: .25rem 2.5rem; font-weight: 500; }
.more a { padding: .5rem 0; }
.more a:hover { text-decoration-thickness: 3px; }

/* ---------- Footer: the small print, on the same ground as the contact section above it ---------- */

.foot {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0 2rem;
  padding: 1.25rem var(--gutter) 2rem;
  background: var(--paper);
  color: var(--muted);
  font-size: .9375rem;
}
/* the rule above it, kept inside the page margins */
.foot::before {
  content: "";
  position: absolute;
  inset: 0 var(--gutter) auto;
  border-top: 1px solid rgba(22, 22, 26, .2);
}
.foot p, .foot address { margin: 0; font-style: normal; }

/* ---------- Motion: everything slides a short way into place as it fades in, quickly ---------- */

/*
 * One movement for the whole page: a short rise with a fade, easing out, done in under half a second.
 * All of it sits under .motion, which site.js sets only for visitors who have not asked their system
 * for less motion. Without it everything is simply there.
 */
.motion [data-reveal],
.motion [data-reveal="row"] li {
  opacity: 0;
  transform: translateY(1rem);
  transition: opacity .4s ease-out, transform .45s cubic-bezier(.2, .8, .2, 1);
  /* --i puts neighbours a beat apart, so a group settles from first to last */
  transition-delay: calc(var(--i, 0) * 60ms);
}
.motion [data-reveal].in,
.motion [data-reveal="row"].in li { opacity: 1; transform: none; }

/* a row stays put itself; its items are what move, one after the other */
.motion [data-reveal="row"] { opacity: 1; transform: none; }
.motion [data-reveal="row"] li:nth-child(4n + 2) { --i: 1; }
.motion [data-reveal="row"] li:nth-child(4n + 3) { --i: 2; }
.motion [data-reveal="row"] li:nth-child(4n + 4) { --i: 3; }

/*
 * The sheets of a diorama come up from under the stage one after the other, like stage flats: the far
 * hill, then the people, then the near ground. They are never faded: each is fully there as it rises,
 * hidden only by the edge of its box. For that the card must already be opaque when they start, so a
 * service card fades in twice as fast as the rest of the page (.2s) and the first sheet leaves just as
 * that ends; any longer a wait reads as a hitch.
 * The sky, the furthest sheet, does not move: it is there with the card.
 */
.motion .service { transition-duration: .2s, .45s; }
.motion .sheet {
  transition: translate .45s cubic-bezier(.2, .8, .2, 1);
  transition-delay: calc(var(--i, 0) * 60ms + (var(--d, 1) - 1) * 50ms + .18s);
}
/* a little more than the height of the box, because a sheet further away moves less on the screen */
.motion .service:not(.in) .sheet:not(:first-child) { translate: 0 125%; }

/* ---------- Narrow screens ---------- */

@media (max-width: 900px) {
  body { font-size: 1.0625rem; }
  h1 { font-size: min(14.4vw, 30vh); }
  .cols, .projects, .project:first-child { grid-template-columns: minmax(0, 1fr); }
  .project:first-child .shot { margin-bottom: 0; }
  .top nav a[href="#clients"] { display: none; }
  .clients ul { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 560px) {
  .clients ul { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  h1 .line, .intro { animation: none; }
  .flood { display: none; }
  .shot { transition: none; }
  .project:hover .shot { transform: none; }
}
