/* Inference Aftermath: the shared sheet. Every page loads this file first, then its own
   (css/home.css, css/products.css, ...). It holds the tokens, the type scale, the stone ground and
   its light, the header, the footer, links, the button, focus, the Copy control and the layers the
   crowd is drawn on. A page's own file only places that page's content.

   The site is a sunlit square seen from above. Everything is measured in metres on that square
   (--u) and laid out on its paving (--s, one slab), so lettering sits in the courses of stone and
   the picture keeps its proportions on any screen. NOTES.md lists what a page may and may not change. */

@font-face {
  font-family: 'Archivo';
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url(../fonts/archivo-latin-wght-normal.woff2?v=8f704806) format('woff2-variations'), url(../fonts/archivo-latin-wght-normal.woff2?v=8f704806) format('woff2');
}
@font-face {
  font-family: 'Newsreader';
  font-style: normal;
  font-display: swap;
  font-weight: 200 800;
  src: url(../fonts/newsreader-latin-wght-normal.woff2?v=62981321) format('woff2-variations'), url(../fonts/newsreader-latin-wght-normal.woff2?v=62981321) format('woff2');
}

/* ---------- tokens ---------- */
:root {
  /* colour */
  --ink: #111215;
  --rust: #A9500E;
  --tangerine: #EA7317;
  --blue: #3066BE;
  --stone: #EFEDE8;
  --inlay: #2B2824;                             /* lettering set into the stone: dark bronze */
  --inlay-s: #3A3631;                           /* the same in small letters */

  /* measure. One metre grows with the window up to a laptop's width, then slower than it (so type
     never reaches poster size on a very wide screen), and gives way in a short window (a phone on
     its side) so seven courses of stone, which is the whole home page, fit a window 314 px tall. */
  --u: clamp(14px, min(max(20px, min(1.7vw, 10px + 1vw)), 4.2vh), 38px);
  --s: calc(var(--u) * 3.2);                    /* one paving slab: one course of the layout */
  --m: clamp(18px, calc(50vw - 290px), calc(var(--u) * 2.6));   /* the page margin; it gives way under 684 px so the header keeps one row */
  --ml: max(var(--m), env(safe-area-inset-left, 0px));    /* the margins, clear of a notch */
  --mr: max(var(--m), env(safe-area-inset-right, 0px));
  --tile-w: calc(var(--u) * 64);                /* the paving tile is 20 slabs by 15 */
  --tile-h: calc(var(--u) * 48);
  --sx: .765; --sy: .644;                       /* which way shadows fall (the crowd script turns it with the sun) */

  /* type: two families, one scale */
  --sans: 'Archivo', 'Helvetica Neue', Helvetica, Arial, sans-serif;
  --serif: 'Newsreader', 'Iowan Old Style', Georgia, serif;
  --t-display: calc(var(--u) * 3.02);                     /* the home headline only */
  --t-label: calc(var(--u) * 1.7);                        /* page labels: Products, About, Reach out, Legal */
  --t-title: calc(var(--u) * 1.3);                        /* names and section headings */
  --t-tagline: max(17px, calc(var(--u) * .98));           /* a line of sans under a title */
  --t-lead: clamp(17px, calc(var(--u) * .92), 32px);      /* serif: the support line, an address */
  --t-body: clamp(16px, calc(var(--u) * .74), 26px);      /* serif: running text */
  --t-ui: clamp(14px, calc(var(--u) * .63), 21px);        /* sans: header, links, the button */
  --t-small: clamp(13px, calc(var(--u) * .58), 19px);     /* the smallest text on the site */

  --ease: cubic-bezier(.3, .7, .1, 1);
}
/* the short window is measured with the browser's bars showing, where the browser can say so */
@supports (height: 1svh) {
  :root { --u: clamp(14px, min(max(20px, min(1.7vw, 10px + 1vw)), 4.2svh), 38px); }
}
/* Upright and narrow: the phone's own composition. The same square, a bigger metre for the width,
   type re-set for the hand. (The crowd script reads --narrow to know which composition it is in.)
   A phone on its side is not narrow: from 561 px wide it gets the wide composition, one row of header
   and the headline in two lines, which is the only one that fits a window 320 px tall. The metre here
   gives way in a squat window too, so the home page stays one screen down to about 480 px tall. */
:root { --narrow: 0; }
@media (max-width: 560px), (max-width: 760px) and (orientation: portrait) {
  :root {
    --narrow: 1;
    --u: clamp(17px, min(5.4vw, 6.65vh - 14.8px, 2.95vh + 1.8px), 24px);
    --m: clamp(14px, 4.6vw, 24px);
    --t-display: calc(var(--u) * 2.2);
    --t-label: calc(var(--u) * 1.5);
    --t-title: calc(var(--u) * 1.15);
    --t-tagline: clamp(17px, calc(var(--u) * 1), 22px);
    --t-lead: clamp(17px, calc(var(--u) * .93), 21px);
    --t-body: clamp(16px, calc(var(--u) * .82), 19px);
    --t-ui: clamp(14px, calc(var(--u) * .7), 16px);
    --t-small: clamp(13px, calc(var(--u) * .64), 15px);
  }
  @supports (height: 1svh) {
    :root { --u: clamp(17px, min(5.4vw, 6.65svh - 14.8px, 2.95svh + 1.8px), 24px); }
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; background: var(--stone); }
body {
  position: relative;
  display: flex; flex-direction: column;
  margin: 0;
  min-height: 100vh; min-height: 100svh;
  overflow-x: hidden; overflow-x: clip;
  background: var(--stone);
  color: var(--ink);
  font-family: var(--sans);
  font-synthesis: none;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  -webkit-tap-highlight-color: transparent;
}
main { flex: 1 0 auto; }
h1, h2, h3, p, ul, ol, address { margin: 0; padding: 0; font-weight: inherit; font-style: normal; }
ul, ol { list-style: none; }
a { color: inherit; }
button { background: none; color: inherit; }
img, svg { max-width: 100%; }

/* moving between pages is moving round one place: the square stays, what stands on it changes */
@view-transition { navigation: auto; }
::view-transition-old(root), ::view-transition-new(root) { animation-duration: .42s; animation-timing-function: ease; }
@media (prefers-reduced-motion: reduce) { @view-transition { navigation: none; } }

/* ---------- the ground ---------- */
/* Large square slabs in a plain grid. The middle of the page falls on the middle of a slab, and the
   first joint lies along the top edge, so every course of stone is one line of the layout. */
.ground {
  position: absolute; inset: 0;
  background-color: var(--stone);
  background-image: url(../assets/mottle.webp?v=02579a06), url(../assets/stone.webp?v=202a2bff);
  background-size: calc(var(--u) * 71) calc(var(--u) * 58), var(--tile-w) var(--tile-h);
  background-position: 0 0, calc(50% + var(--s) / 2) 0;
  background-blend-mode: multiply, normal;
}

/* light: one layer over everything. A low sun at the upper left: the stone nearest it is warm, and
   the light falls away across the frame to a cooler, darker far corner. The film's grain is in the
   same layer. Later light (peach-gold, falling away faster) fades in over it: the crowd script sets
   --late from the page's sun, and a page without the script may set it by hand. */
.light {
  position: fixed; left: 0; top: 0; width: 100%; height: 100vh; height: 100lvh; z-index: 7; pointer-events: none;
  mix-blend-mode: multiply;
  background: url(../assets/grain.webp?v=f16e7940) 0 0 / 128px 128px,
    radial-gradient(142% 148% at 2% -6%, #FFF6E4 0%, #FFF5E1 22%, #FAF0E0 45%, #EEE8DF 65%, #E1DEDF 82%, #D3D3DD 100%);
  background-blend-mode: multiply;
}
.light::after {
  content: ''; position: absolute; inset: 0;
  background: url(../assets/grain.webp?v=f16e7940) 0 0 / 128px 128px,
    radial-gradient(150% 160% at -4% 24%, #FFEFD4 0%, #FFEACB 22%, #FAE1C0 44%, #EFD4B8 64%, #DEC6B4 82%, #CBBCB6 100%);
  background-blend-mode: multiply;
  opacity: var(--late, 0);
}

/* ---------- the crowd's layers ---------- */
/* Two canvases that ride with the page (moved by js/plaza.js), shadows multiplied into the stone.
   They lie over the text, so people can walk across the large lettering; they take no pointer. */
.plaza { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }
.plaza canvas {
  position: absolute; left: 0; top: 0; width: 100%; height: 100vh;
  z-index: 5; opacity: 0; transition: opacity .7s cubic-bezier(.2, .6, .2, 1);
}
.plaza .shadows { mix-blend-mode: multiply; }
.plaza .people { z-index: 6; }
.plaza.on canvas { opacity: 1; }
@media (prefers-reduced-motion: reduce) { .plaza canvas { transition: none; } }
/* Without script: a still of the same square, shadows and people as two images, laid from the
   middle of the page at the square's own scale. A page names its stills with --still-*. */
.still { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }
.still::before, .still::after {
  content: ''; position: absolute; inset: 0;
  background: top center / calc(var(--u) * var(--still-w, 72)) auto no-repeat;
}
.still::before { z-index: 5; background-image: var(--still-shadows, none); mix-blend-mode: multiply; }
.still::after { z-index: 6; background-image: var(--still-people, none); }
@media (max-width: 560px), (max-width: 760px) and (orientation: portrait) {
  .still::before, .still::after { background-size: calc(var(--u) * var(--still-w-m, 18.53)) auto; }
  .still::before { background-image: var(--still-shadows-m, var(--still-shadows, none)); }
  .still::after { background-image: var(--still-people-m, var(--still-people, none)); }
}

/* ---------- lettering ---------- */
/* Set into the stone like bronze: dark, a little lighter where the sun comes from, and multiplied
   into the ground so the stone's grain, the joints and every passing shadow show in it. */
.inlay { color: var(--inlay); mix-blend-mode: multiply; }
@supports ((-webkit-background-clip: text) or (background-clip: text)) {
  .inlay {
    background: linear-gradient(104deg, #4A433A 0%, #322E29 38%, #262320 100%);
    -webkit-background-clip: text; background-clip: text;
    -webkit-text-fill-color: transparent;
  }
}
@media (forced-colors: active) {
  .inlay { color: CanvasText; background: none; -webkit-text-fill-color: currentColor; mix-blend-mode: normal; }
}

.top, main, .foot { position: relative; }

/* the type scale, as classes a page can put on its own text */
.display { font-size: var(--t-display); line-height: var(--s); font-weight: 440; letter-spacing: -0.036em; }
.label { font-size: var(--t-label); line-height: var(--s); font-weight: 440; letter-spacing: -0.03em; }
.title { font-size: var(--t-title); line-height: 1.25; font-weight: 540; letter-spacing: -0.022em; }
.tagline { font-size: var(--t-tagline); line-height: 1.24; font-weight: 440; letter-spacing: -0.018em; text-wrap: balance; }
.lead { font-family: var(--serif); font-size: var(--t-lead); line-height: 1.3; font-weight: 400; letter-spacing: -0.006em; color: var(--inlay-s); mix-blend-mode: multiply; }
.text { font-family: var(--serif); font-size: var(--t-body); line-height: 1.45; font-weight: 400; color: var(--inlay-s); mix-blend-mode: multiply; text-wrap: pretty; }
.small { font-family: var(--serif); font-size: var(--t-small); line-height: 1.45; font-weight: 400; color: var(--inlay-s); mix-blend-mode: multiply; }

/* A page's label (every page but home): <h1 class="label inlay" data-quiet>, in the middle, one clear
   course under the header. It stands in the same place on every page, so moving between pages
   changes the word and nothing else. */
main > h1.label { margin-top: var(--s); text-align: center; }

/* ---------- header: one course of stone ---------- */
.top {
  display: flex; justify-content: space-between; align-items: center; flex: none;
  min-height: var(--s); padding: env(safe-area-inset-top, 0px) var(--mr) 0 var(--ml);
  font-size: var(--t-ui);
  color: var(--inlay-s);
}
.brand { display: flex; align-items: center; gap: .85em; min-height: 44px; text-decoration: none; }
.logo { display: block; flex: none; height: 2.05em; width: auto; aspect-ratio: 456 / 180; }
.lockup { display: grid; line-height: 1.2; white-space: nowrap; mix-blend-mode: multiply; }
.name { font-weight: 620; letter-spacing: -0.008em; }
.desc { font-size: min(1em, max(var(--t-small), 2.3vw)); font-weight: 420; opacity: .78; letter-spacing: -0.002em; }   /* a size smaller under 610 px */
.top nav { display: flex; gap: clamp(16px, min(calc(var(--u) * 1.5), calc(6vw - 16px)), 52px); font-weight: 520; white-space: nowrap; mix-blend-mode: multiply; }
.top nav a { display: block; text-decoration: none; padding: 14px 8px; margin: 0 -8px; line-height: 1.2; }
.top nav a span { padding-bottom: 5px; background: linear-gradient(currentColor, currentColor) 0 100% / 0 1.5px no-repeat; transition: background-size .45s var(--ease); }
.top nav a[aria-current] span, .top nav a:focus-visible span { background-size: 100% 1.5px; }
@media (hover: hover) { .top nav a:hover span { background-size: 100% 1.5px; } }

/* ---------- links ---------- */
/* A link in running text or a list: sans, underlined, turning rust under the pointer. Give the <a>
   class="link" and wrap its words in a <span>; the <a> itself is the 44 px target. */
.link {
  display: inline-flex; align-items: center; min-height: 44px; padding: 0 4px; margin: 0 -4px;
  font: 520 var(--t-ui)/1.2 var(--sans); color: var(--inlay-s); text-decoration: none;
  transition: color .25s ease;
}
.link span { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: .28em; }
@media (hover: hover) { .link:hover, .copy:hover { color: var(--rust); } }

/* a press shows at once on anything that can be pressed */
.top a:active, .link:active, .copy:active, .addr:active, .foot a:active { opacity: .55; transition: none; }

:focus { outline: none; }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 5px; border-radius: 2px; }
.top nav a:focus-visible { outline-offset: -4px; }

/* ---------- the plate: the one button ---------- */
/* A bronze plate lying on the stone. It is a hair proud of the ground, so it throws a short shadow
   the same way everyone on the square does, and the shadow turns with the sun. */
.plate {
  --lift: 1;
  position: relative; display: inline-flex; align-items: center; justify-content: center;
  height: clamp(min(48px, var(--s)), calc(var(--u) * 2.1), 72px); padding: 0 clamp(26px, calc(var(--u) * 1.45), 50px);   /* never taller than its course */
  border-radius: 3px; text-decoration: none; white-space: nowrap; cursor: pointer;
  font: 520 clamp(15px, calc(var(--u) * .68), 23px)/1 var(--sans); letter-spacing: .004em;
  color: #F6F0E5;
  background: linear-gradient(112deg, #51493F 0%, #3A342E 44%, #2B2723 100%);
  box-shadow:
    inset 1px 1px 0 rgba(255, 236, 205, .26), inset -1px -1px 0 rgba(10, 8, 6, .38),
    calc(var(--sx) * 2.5px * var(--lift)) calc(var(--sy) * 2.5px * var(--lift)) calc(2px * var(--lift)) rgba(62, 76, 116, .6),
    calc(var(--sx) * 8px * var(--lift)) calc(var(--sy) * 8px * var(--lift)) calc(11px * var(--lift)) rgba(62, 76, 116, .26);
  transition: box-shadow .35s var(--ease), transform .35s var(--ease), filter .35s ease;
}
@media (hover: hover) { .plate:hover { --lift: 1.7; filter: brightness(1.16); transform: translate(calc(var(--sx) * -1px), calc(var(--sy) * -1px)); } }
.plate:active { --lift: .25; filter: brightness(.94); transform: translate(calc(var(--sx) * 1.5px), calc(var(--sy) * 1.5px)); transition-duration: .06s; }
@media (prefers-reduced-motion: reduce) { .plate { transition: none; } }

/* ---------- the address and its copy button ---------- */
/* <p class="address" data-quiet><a class="addr" href="mailto:...">...</a><button class="copy" type="button"
   data-copy="..." aria-label="Copy ..."> two icons </button></p>. The button is an icon with no word, a 44 px target beside the address on every width. The address itself stands on
   the page's centre line: an empty box the button's width balances it on the left. */
.address {
  display: flex; align-items: center; justify-content: center; gap: 0 .35em;
  color: var(--inlay-s); mix-blend-mode: multiply;
}
.address::before { content: ''; flex: none; width: 44px; }
.addr {
  display: inline-flex; align-items: center; min-height: 44px; white-space: nowrap;
  font-family: var(--serif); font-weight: 400; font-size: clamp(18px, calc(var(--u) * 1.02), 35px); letter-spacing: -0.008em;
  text-decoration: none;
  background: linear-gradient(currentColor, currentColor) 0 calc(50% + .66em) / 0 1px no-repeat; transition: background-size .5s var(--ease);
}
.addr:focus-visible { background-size: 100% 1px; }
@media (hover: hover) { .addr:hover { background-size: 100% 1px; } }
.copy {
  appearance: none; -webkit-appearance: none; border: 0; margin: 0; padding: 0; background: none; color: inherit;
  position: relative; flex: none; display: grid; place-items: center; width: 44px; height: 44px; border-radius: 8px; cursor: pointer;
  transition: color .25s ease;
}
.copy svg { grid-area: 1 / 1; width: clamp(18px, calc(var(--u) * .8), 27px); height: auto; aspect-ratio: 1; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; transition: opacity .2s ease, transform .3s var(--ease); }
.copy .i-done { opacity: 0; transform: scale(.7); stroke-width: 2; }
.copy.done .i-copy { opacity: 0; transform: scale(.7); }
.copy.done .i-done { opacity: 1; transform: none; }
.copy .said { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
@media (prefers-reduced-motion: reduce) { .copy svg { transition: none; } }

/* ---------- footer: cut straight into the stone, in the last course ---------- */
/* Small incised letters: the wall of each cut that faces away from the sun is in shade, the wall that
   faces it (lower and to the right) is lit. The line stands in the middle; Legal hangs beside it. */
.foot {
  display: flex; justify-content: center; align-items: center; flex: none;
  min-height: var(--s); padding: 0 var(--mr) env(safe-area-inset-bottom, 0px) var(--ml);
  font-family: var(--serif); font-size: var(--t-small); font-weight: 500; letter-spacing: .012em; line-height: 1.45;
  color: rgba(74, 61, 50, .9);
  text-shadow: .055em .07em 0 rgba(255, 251, 242, .9), -.028em -.036em 0 rgba(46, 34, 26, .3);
}
.rights { position: relative; text-align: center; }
.rights span { display: inline-block; }
.foot .legal {
  position: absolute; left: 100%; top: 50%; transform: translateY(-50%); margin-left: 1.6em;
  display: flex; align-items: center; min-height: 44px; padding: 0 10px;
  text-decoration: none; white-space: nowrap;
}
.foot .legal span { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: .3em; }
.foot .legal[aria-current] span { text-decoration-thickness: 2px; }

/* ---------- upright and narrow ---------- */
@media (max-width: 560px), (max-width: 760px) and (orientation: portrait) {
  /* the header in two rows, both on the page's centre line like everything under them: the mark and
     the name, then the three places to go, each one tap */
  .top {
    --logo-h: calc(var(--u) * 1.4);
    display: grid; grid-template-columns: 1fr; justify-items: center; align-content: start;
    padding-top: calc(env(safe-area-inset-top, 0px) + var(--u) * .8); padding-bottom: calc(var(--u) * .1);
  }
  .brand { gap: calc(var(--u) * .6); min-height: 0; padding-top: 12px; margin-top: -12px; }   /* 44 px to tap, upward into the margin */
  .logo { height: var(--logo-h); margin-top: .08em; }
  .lockup { line-height: 1.24; }
  .desc { font-size: var(--t-small); }
  .top nav { justify-content: center; gap: clamp(22px, calc(var(--u) * 1.5), 36px); margin: 2px 0 0; }
  .top nav a { padding: 14px 8px 12px; min-height: 44px; }
  main > h1.label { margin-top: calc(var(--u) * 1.4); line-height: 1.2; }
  /* the address and its button stay in one row, the address itself on the centre line: the row runs
     out into the page margins so the button and the empty box that balances it both fit, and the
     address is set a size smaller on the narrowest phones */
  .address { gap: 0; margin-left: calc(var(--ml) * -1); margin-right: calc(var(--mr) * -1); }
  .addr { font-size: clamp(14.5px, calc((100vw - 98px) / 14.9), 21px); }
  /* the footer: the line, and Legal close beneath it (its 44 px reach up and down into the margins) */
  .foot { display: block; padding: calc(var(--u) * .7) max(10px, env(safe-area-inset-right, 0px)) calc(env(safe-area-inset-bottom, 0px) + var(--u) * .3) max(10px, env(safe-area-inset-left, 0px)); text-align: center; letter-spacing: 0; }
  .foot .legal { position: static; transform: none; width: fit-content; margin: -6px auto 0; }
}
