/* www.sitesocial.co.uk. Theme "the drawing" (BRIEF.md section 2): ink grounds with a faint drawing grid, dimension lines
   under headings, section numbers set like plot references, orange used like hi-vis. Mobile first; desktop at 900 up.
   Every movement is off under prefers-reduced-motion. */

@font-face { font-family: 'Archivo'; font-style: normal; font-weight: 100 900; font-stretch: 62% 125%; font-display: swap; src: url(/assets/fonts/archivo-var.woff2) format('woff2'); }
@font-face { font-family: 'IBM Plex Mono'; font-style: normal; font-weight: 400; font-display: swap; src: url(/assets/fonts/ibm-plex-mono-400.woff2) format('woff2'); }
@font-face { font-family: 'IBM Plex Mono'; font-style: normal; font-weight: 500; font-display: swap; src: url(/assets/fonts/ibm-plex-mono-500.woff2) format('woff2'); }

:root {
  /* brand, the same tokens as roam.sitesocial.co.uk */
  --orange: #f59c0c;
  --orange-deep: #bf7807;
  --orange-ink: #8a5806;     /* orange text on light grounds (AA) */
  --ink: #161616;
  --ink-2: #1f1f1f;
  --ink-line: #333333;
  --paper: #ffffff;
  --paper-2: #f6f6f6;
  --paper-line: #d9d9d9;
  --charcoal: #3a3f45;
  --muted-on-dark: #a9a9a9;
  --muted-on-light: #575757;

  --sans: 'Archivo', 'Helvetica Neue', sans-serif;
  --mono: 'IBM Plex Mono', ui-monospace, 'SF Mono', Menlo, monospace;
  --wide: 112%;              /* headings a little wide on the width axis */

  /* type scale: body 17px; hero about 4x body on desktop */
  --body: 1.0625rem;
  --small: 0.875rem;
  --label: 0.8125rem;
  --h1: clamp(2.5rem, 1.4rem + 4.4vw, 5.25rem);
  --h2: clamp(2.125rem, 1.4rem + 2.9vw, 3.75rem);
  --h3: clamp(1.25rem, 1.1rem + 0.5vw, 1.5rem);
  --lead: clamp(1.125rem, 1rem + 0.4vw, 1.3125rem);

  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px; --s6: 32px; --s7: 48px; --s8: 64px; --s9: 96px; --s10: 128px;
  --gutter: clamp(20px, 5vw, 64px);
  --max: 1200px;
  --section: clamp(88px, 10vw, 152px);
  --bar-h: 72px;
  --ease: cubic-bezier(0.2, 0.7, 0.1, 1);
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: var(--bar-h); }
body { margin: 0; overflow-x: clip; background: var(--ink); color: #f2f2f2; font: 400 var(--body)/1.65 var(--sans); -webkit-font-smoothing: antialiased; }
img, video { display: block; max-width: 100%; }
h1, h2, h3 { margin: 0; font-weight: 500; font-stretch: var(--wide); text-wrap: balance; }
h2 { font-size: var(--h2); line-height: 1.06; letter-spacing: -0.015em; margin-bottom: var(--s5); }
h3 { font-size: var(--h3); line-height: 1.25; margin-bottom: var(--s2); }
p { margin: 0 0 var(--s4); text-wrap: pretty; }
ul { margin: 0; padding: 0; list-style: none; }
figure { margin: 0; }
address { font-style: normal; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
.mono { font-family: var(--mono); font-size: var(--label); letter-spacing: 0.01em; line-height: 1.5; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* grounds */
.dark { background-color: var(--ink); color: #f2f2f2; --muted: var(--muted-on-dark); --line: var(--ink-line); --focus: var(--orange); }
.light { background-color: var(--paper-2); color: var(--ink); --muted: var(--muted-on-light); --line: var(--paper-line); --focus: var(--ink); }
/* the drawing grid: minor 24px, major 120px, barely there */
.grid-bg {
  background-image:
    linear-gradient(rgb(255 255 255 / 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgb(255 255 255 / 0.035) 1px, transparent 1px),
    linear-gradient(rgb(255 255 255 / 0.018) 1px, transparent 1px),
    linear-gradient(90deg, rgb(255 255 255 / 0.018) 1px, transparent 1px);
  background-size: 120px 120px, 120px 120px, 24px 24px, 24px 24px;
  background-position: center top;
}
/* light sections: a faint 45 degree hatch, like a section cut on a drawing */
.hatch-bg { background-image: repeating-linear-gradient(-45deg, rgb(22 22 22 / 0.028) 0 1px, transparent 1px 14px); }

:focus-visible { outline: 2px solid var(--focus, var(--orange)); outline-offset: 3px; }
.skip { position: absolute; left: var(--s4); top: -100px; z-index: 100; padding: var(--s3) var(--s4); background: var(--orange); color: var(--ink); font-weight: 500; }
.skip:focus { top: var(--s4); }

.wrap { width: 100%; max-width: calc(var(--max) + 2 * var(--gutter)); margin: 0 auto; padding: 0 var(--gutter); }
.narrow { max-width: calc(820px + 2 * var(--gutter)); }
.sec { padding: var(--section) 0; }
.intro { max-width: 40em; font-size: var(--lead); line-height: 1.55; color: var(--muted); margin-bottom: var(--s8); }
.sec-end { margin: var(--s8) 0 0; }

/* buttons and links */
.btn {
  display: inline-flex; align-items: center; justify-content: center; min-height: 52px; padding: 0 var(--s6);
  background: var(--orange); color: var(--ink); border: 0; border-radius: 2px; cursor: pointer;
  font-weight: 500; font-stretch: var(--wide); text-decoration: none; transition: background-color 0.2s;
}
.btn:hover { background: var(--orange-deep); }
.dark .btn:focus-visible { outline-color: #fff; }
.btn-sm { min-height: 40px; padding: 0 var(--s5); font-size: var(--small); }
.link { text-decoration: underline; text-decoration-color: var(--orange); text-decoration-thickness: 1px; text-underline-offset: 0.22em; transition: text-decoration-thickness 0.15s; }
.link:hover { text-decoration-thickness: 2px; }
.light .link, .link-light { text-decoration-color: var(--orange-ink); }

/* the plot reference: section number, then a dimension line with end ticks that draws across */
.ref { display: flex; align-items: center; gap: var(--s4); margin-bottom: var(--s5); color: var(--orange); }
.light .ref { color: var(--orange-ink); }
.ref-n { font-weight: 500; }
.ref-line { position: relative; flex: 1; max-width: 360px; height: 9px; transform-origin: left center; }
.ref-line::before { content: ''; position: absolute; left: 0; right: 0; top: 4px; height: 1px; background: currentColor; opacity: 0.7; }
.ref-line::after { content: ''; position: absolute; inset: 0; border-left: 1px solid currentColor; border-right: 1px solid currentColor; }

/* top bar */
.bar { position: fixed; inset: 0 0 auto; z-index: 50; height: var(--bar-h); color: #fff; transition: background-color 0.3s, border-color 0.3s; border-bottom: 1px solid transparent; }
.bar.solid { background: rgb(22 22 22 / 0.94); border-bottom-color: var(--ink-line); }
.bar-in { display: flex; align-items: center; justify-content: space-between; height: 100%; max-width: calc(var(--max) + 2 * var(--gutter)); margin: 0 auto; padding: 0 var(--gutter); }
.bar-logo img { width: auto; height: 44px; }
.bar-nav { display: none; }
.bar-nav ul { display: flex; gap: var(--s6); }
.bar-nav ul a { font-size: var(--small); text-decoration: none; padding: var(--s2) 0; border-bottom: 1px solid transparent; }
.bar-nav ul a:hover { border-bottom-color: var(--orange); }
.bar-menu { display: inline-flex; align-items: center; gap: var(--s3); min-width: 44px; min-height: 44px; padding: 0 var(--s2); background: none; border: 0; color: #fff; cursor: pointer; }
.bar-menu-word { font-family: var(--mono); font-size: var(--label); }
.bar-menu-lines { position: relative; width: 20px; height: 9px; border-top: 1px solid currentColor; border-bottom: 1px solid currentColor; }
.bar.open { background: var(--ink); border-bottom-color: var(--ink-line); }
.bar.open .bar-nav {
  display: flex; flex-direction: column; gap: var(--s6); position: absolute; top: var(--bar-h); left: 0; right: 0;
  padding: var(--s6) var(--gutter) var(--s7); background: var(--ink); border-bottom: 1px solid var(--ink-line);
}
.bar.open .bar-nav ul { flex-direction: column; gap: 0; }
.bar.open .bar-nav ul a { display: block; padding: var(--s3) 0; font-size: 1.375rem; font-stretch: var(--wide); border-bottom: 1px solid var(--ink-line); }
.bar.open .bar-nav .btn { min-height: 52px; }

/* hero */
.hero { position: relative; display: flex; align-items: flex-end; min-height: 700px; height: 100svh; max-height: 860px; overflow: hidden; background: var(--ink); }
.hero-media, .hero-poster, .hero-video, .hero-shade { position: absolute; inset: 0; width: 100%; height: 100%; }
.hero-poster, .hero-video { object-fit: cover; }
.hero-video { opacity: 0; transition: opacity 1.6s ease; }
.hero-video.on { opacity: 1; }
.hero-shade { background: linear-gradient(180deg, rgb(22 22 22 / 0.6) 0, rgb(22 22 22 / 0.15) 18%, rgb(22 22 22 / 0.25) 34%, rgb(22 22 22 / 0.78) 62%, rgb(22 22 22 / 0.92) 100%); }
.hero-copy { position: relative; padding-bottom: var(--s8); }
.hero-h { font-size: var(--h1); line-height: 0.98; letter-spacing: -0.025em; margin: 0 0 var(--s5) -0.04em; max-width: 14ch; }
.hero-h span { display: inline-block; }
.hero-lead { max-width: 34em; font-size: var(--lead); line-height: 1.5; color: #ececec; margin-bottom: var(--s6); }
.hero .btn { width: 100%; }
.hero-cue { display: none; }

/* tiles */
.tiles { display: grid; gap: var(--s8) var(--s6); }
.tile p { color: var(--muted); max-width: 36em; margin: 0; }
.tile-media { position: relative; height: 220px; margin-bottom: var(--s5); background: var(--ink-2); overflow: hidden; outline: 1px solid var(--ink-line); outline-offset: -1px; }
.tile-media img, .tile-media video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.tile-media video { opacity: 0; transition: opacity 0.6s ease; }
.tile-media video.on { opacity: 1; }
.tile-media figcaption { position: absolute; left: 0; bottom: 0; z-index: 1; padding: var(--s1) var(--s3); background: rgb(22 22 22 / 0.82); color: #dcdcdc; font-size: 0.75rem; }


/* the feature band: full width, edge to edge, no frame; 60% of the screen on phones, 70% from 900 up */
.feature { position: relative; height: 60vh; height: 60svh; min-height: 360px; margin: 0; overflow: hidden; background: var(--ink); }
.feature img, .feature video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
/* the wide version (landscape screens) sits a little higher in the band so the lower-left window shows */
@media not all and (max-aspect-ratio: 1/1) { .feature img, .feature video { object-position: center 65%; } }
.feature video { opacity: 0; transition: opacity 0.6s ease; }
.feature video.on { opacity: 1; }
.feature figcaption { position: absolute; z-index: 1; left: max(var(--gutter), calc((100% - var(--max)) / 2)); bottom: var(--s5); padding: var(--s1) var(--s3); background: rgb(22 22 22 / 0.82); color: #dcdcdc; font-size: 0.75rem; }

/* client logos: one tone, one visual height, colour back on hover or focus */
.logos { display: grid; grid-template-columns: 1fr 1fr; border-top: 1px solid var(--line); border-left: 1px solid var(--line); }
.logos li { display: flex; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.logos li:last-child:nth-child(odd) { grid-column: 1 / -1; }
.logos a, .logos span { display: flex; align-items: center; justify-content: center; width: 100%; min-height: 120px; padding: var(--s5); }
.logos img { width: 100%; max-width: 200px; height: 40px; object-fit: contain; filter: grayscale(1) brightness(0) opacity(0.72); transition: filter 0.25s; }
.logos .logo-boxed img { height: 52px; filter: grayscale(1) opacity(0.8); }
.logos .logo-small img { height: 56px; }
.logos a:hover img, .logos a:focus-visible img { filter: none; }
.logo-name { font-size: 1.125rem; font-weight: 500; font-stretch: var(--wide); color: var(--charcoal); text-decoration: none; text-align: center; }
a.logo-name:hover { color: var(--ink); }

/* about */
.prose p { font-size: var(--lead); line-height: 1.6; max-width: 38em; }
.creds { display: flex; flex-wrap: wrap; gap: var(--s3); margin: var(--s7) 0; }
.creds li { padding: var(--s2) var(--s4); border: 1px solid var(--ink-line); font-family: var(--mono); font-size: var(--label); }
.creds li::before { content: ''; display: inline-block; width: 6px; height: 6px; margin-right: var(--s3); vertical-align: 0.1em; background: var(--orange); }
.before { padding-top: var(--s6); border-top: 1px solid var(--ink-line); }
.before-label { color: var(--muted); margin-bottom: var(--s3); }
.before-names { font-size: var(--h3); font-stretch: var(--wide); line-height: 1.5; margin: 0; }

/* contact */
.contact { display: grid; gap: var(--s7); }
.contact-side p { max-width: 28em; }
.mail { font-size: var(--h3); font-stretch: var(--wide); }
.form { display: grid; gap: var(--s5); }
.f label { display: block; margin-bottom: var(--s2); font-family: var(--mono); font-size: var(--label); color: var(--muted); }
.f input, .f select, .f textarea {
  display: block; width: 100%; min-height: 52px; padding: var(--s3) var(--s4); background: var(--paper); color: var(--ink);
  border: 1px solid #8f8f8f; border-radius: 2px; font-size: 1rem;
}
.f textarea { min-height: 140px; resize: vertical; line-height: 1.5; }
.f select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--ink) 50%), linear-gradient(135deg, var(--ink) 50%, transparent 50%); background-position: calc(100% - 22px) 50%, calc(100% - 16px) 50%; background-size: 6px 6px; background-repeat: no-repeat; padding-right: var(--s7); }
.f input:focus-visible, .f select:focus-visible, .f textarea:focus-visible { outline: 2px solid var(--ink); outline-offset: 1px; border-color: var(--ink); }
.f [aria-invalid='true'] { border-color: #b3261e; }
.f-err { margin: var(--s2) 0 0; font-size: var(--small); color: #b3261e; min-height: 0; }
.f-err:empty { display: none; }
.f-privacy { font-size: var(--small); color: var(--muted); margin: 0; }
.form .btn { width: 100%; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.form-msg { padding: var(--s6); border: 1px solid var(--line); border-left: 3px solid var(--orange-ink); background: var(--paper); }
.form-msg-h { font-size: var(--h3); font-stretch: var(--wide); font-weight: 500; margin-bottom: var(--s2); }
.form-msg p:last-child { margin: 0; }

/* footer */
.foot { padding: var(--s9) 0 var(--s8); border-top: 1px solid var(--ink-line); font-size: var(--small); color: var(--muted-on-dark); }
.foot-in { display: grid; gap: var(--s7); }
.foot-logo { width: auto; height: 56px; margin-bottom: var(--s5); }
.foot li + li { margin-top: var(--s3); }
.foot a { color: #e6e6e6; }

/* desktop */
@media (min-width: 900px) {
  .bar-menu { display: none; }
  .bar-nav { display: flex; align-items: center; flex: 1; justify-content: space-between; margin-left: var(--s9); }
  .bar-nav ul { margin: 0 auto; }
  .hero { height: 760px; max-height: none; min-height: 0; }
  .hero-copy { padding-bottom: var(--s9); }
  .hero .btn { width: auto; }
  .hero-cue { display: flex; flex-direction: column; align-items: center; gap: var(--s3); position: absolute; right: var(--gutter); bottom: var(--s9); color: #cfcfcf; text-decoration: none; }
  .hero-cue::after { content: ''; width: 1px; height: 56px; background: linear-gradient(var(--orange) 0 40%, rgb(255 255 255 / 0.3) 40%); background-size: 1px 200%; animation: cue 2.4s var(--ease) infinite; }
  .tiles { grid-template-columns: 1fr 1fr; gap: var(--s8) var(--s6); }
  .tile-media { height: 300px; }
  .feature { height: 70vh; height: 70svh; min-height: 480px; }
  .logos { grid-template-columns: repeat(3, 1fr); }
  .logos li:last-child:nth-child(odd) { grid-column: auto; }
  .logos a, .logos span { min-height: 160px; }
  .contact { grid-template-columns: 5fr 7fr; gap: var(--s9); align-items: start; }
  .form { grid-template-columns: 1fr 1fr; gap: var(--s5) var(--s5); }
  .f-wide { grid-column: 1 / -1; }
  .contact > .form-msg { grid-column: 2; }
  .foot-in { grid-template-columns: 1.2fr 1fr 1fr; }
}
@keyframes cue { from { background-position: 0 100%; } to { background-position: 0 -100%; } }

/* motion: only when the script is running and the visitor has not asked for less */
@media (prefers-reduced-motion: no-preference) {
  .js [data-line] { opacity: 0; transform: translateY(0.6em); }
  .js .loaded [data-line] { opacity: 1; transform: none; transition: opacity 0.9s var(--ease) var(--d, 0s), transform 0.9s var(--ease) var(--d, 0s); }

  .js [data-ref] .ref-line { transform: scaleX(0); }
  .js [data-ref] .ref-n { opacity: 0; }
  .js [data-ref].in .ref-line { transform: none; transition: transform 1.1s var(--ease) 0.1s; }
  .js [data-ref].in .ref-n { opacity: 1; transition: opacity 0.6s ease; }

  .js .reveal { opacity: 0; transform: translateY(16px); }
  .js .reveal.in { opacity: 1; transform: none; transition: opacity 0.7s var(--ease), transform 0.7s var(--ease); }

  .js [data-logos] li { opacity: 0; }
  .js [data-logos].in li { opacity: 1; transition: opacity 0.4s ease; }
  .js [data-logos].in li:nth-child(2) { transition-delay: 0.06s; }
  .js [data-logos].in li:nth-child(3) { transition-delay: 0.12s; }
  .js [data-logos].in li:nth-child(4) { transition-delay: 0.18s; }
  .js [data-logos].in li:nth-child(5) { transition-delay: 0.24s; }
  .js [data-logos].in li:nth-child(6) { transition-delay: 0.30s; }
  .js [data-logos].in li:nth-child(7) { transition-delay: 0.36s; }
  .js [data-logos].in li:nth-child(8) { transition-delay: 0.42s; }
  .js [data-logos].in li:nth-child(9) { transition-delay: 0.48s; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .hero-video, .tile-media video, .feature video { display: none; }
}
