/*
 * Suffolk Web.
 *
 * Replaces the stylesheet this codebase was forked with, which was built for
 * a children's food publication: berry and apricot variables, floating
 * doodles, wave-shaped section dividers, and buttons with a 5px solid drop
 * shadow and a springy cubic-bezier. All of it fine on a snack blog and all
 * of it wrong for a firm selling systems to businesses.
 *
 * The rules this one is built on:
 *
 *   Restraint reads as expensive. One accent colour, two type families, no
 *   gradients, no drop shadows on cards. Borders and space do the work that
 *   decoration was doing.
 *
 *   Space is the layout. Generous vertical rhythm and a wide measure signal
 *   confidence far more reliably than any ornament.
 *
 *   Type carries the hierarchy. A large display size with tight tracking at
 *   the top, a comfortable reading size beneath, and nothing in between
 *   competing.
 *
 *   Motion is for feedback, not for delight. 120ms, ease, opacity and colour
 *   only. Nothing bounces, nothing floats.
 */

/* ---------- Typefaces ---------- */

/*
 * These are the reason the site looked like an unstyled document.
 *
 * Both files have been sitting in public/fonts since the project started,
 * both serving 200, and neither had an @font-face rule — so every page
 * rendered in Georgia and the OS UI font. Meanwhile the layout preloaded
 * fredoka and nunito, which came from the fork and have never existed here,
 * so the browser fetched two 404s on every page load.
 *
 * Variable fonts, so one file covers the whole weight range. font-display:
 * swap because a blank headline is worse than a brief fallback.
 */
@font-face {
  font-family: 'Inter';
  src: url('/fonts/Inter.woff2') format('woff2-variations'),
       url('/fonts/Inter.woff2') format('woff2');
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Fraunces';
  src: url('/fonts/Fraunces.woff2') format('woff2-variations'),
       url('/fonts/Fraunces.woff2') format('woff2');
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

/* ---------- Tokens ---------- */

:root {
  /* Paper and ink. Barely-warm white so it is not clinical, near-black
     rather than #000 so large type does not vibrate. */
  --paper: #FBFAF7;
  --surface: #FFFFFF;
  --ink: #0E1417;
  --ink-soft: #5A6570;
  --ink-faint: #8A939B;
  --line: #E4E7E8;
  --line-strong: #CDD3D5;

  /* One accent. Estuary teal rather than the default agency blue, and far
     enough from the sister site's amber that the two read as siblings. */
  --teal: #0B6B6B;
  --teal-deep: #064A4A;
  --teal-wash: #E8F1F0;

  /* Used once or twice, for a genuinely important thing. */
  --signal: #C2410C;

  /* The dark band. A single inverted section is the cheapest way to make a
     page look art-directed rather than templated. */
  --dark: #0E1417;
  --dark-soft: #1A2226;
  --dark-line: #2A3338;

  --display: 'Fraunces', Georgia, 'Times New Roman', serif;
  --body: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;

  --wrap: 1180px;
  --gutter: 24px;
  --radius: 10px;
  --radius-lg: 16px;

  /* Legacy names from the forked stylesheet, pointed at the new palette so
     any rule still referencing them resolves to something sane. Nothing new
     should use these. */
  --paper-bg: var(--paper);
  --cream: var(--paper);
  --sand: var(--teal-wash);
  --sun: var(--teal-wash);
  --wash: var(--teal-wash);
  --amber: var(--teal);
  --amber-deep: var(--teal-deep);
  --berry: var(--teal);
  --berry-deep: var(--teal-deep);
  --leaf: var(--teal);
  --leaf-deep: var(--teal-deep);
  --leaf-bright: var(--teal);
  --apricot: var(--signal);
  --blueberry: var(--teal);
  --evidence: var(--teal);
  --caution: var(--signal);
  --sister: var(--signal);
  --pill: 6px;
  --hand: var(--display);
}

/* ---------- Reset ---------- */

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 1.0625rem/1.65 var(--body);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img, svg, video { max-width: 100%; height: auto; display: block; }

h1, h2, h3, h4 {
  font-family: var(--display);
  font-weight: 600;
  /* Tight tracking is most of what separates a considered display face from
     a default one. It matters more the larger the type gets. */
  letter-spacing: -0.022em;
  line-height: 1.12;
  margin: 0 0 .5em;
  text-wrap: balance;
}

h1 { font-size: clamp(2.5rem, 5.4vw, 4rem); }
h2 { font-size: clamp(1.75rem, 3vw, 2.4rem); }
h3 { font-size: clamp(1.2rem, 1.8vw, 1.45rem); letter-spacing: -0.012em; }

p { margin: 0 0 1.15em; }

a { color: var(--teal); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--teal-deep); }

::selection { background: var(--teal); color: #fff; }

:focus-visible { outline: 2px solid var(--teal); outline-offset: 3px; border-radius: 3px; }

/* ---------- Layout ---------- */

.wrap { width: min(100% - var(--gutter) * 2, var(--wrap)); margin-inline: auto; }
.narrow { width: min(100% - var(--gutter) * 2, 720px); margin-inline: auto; }

.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--ink); color: #fff; padding: 10px 16px; border-radius: var(--radius); z-index: 100; }
.skip:focus { left: 8px; }

.section { padding: clamp(56px, 8vw, 110px) 0; }
.section--tight { padding: clamp(40px, 5vw, 72px) 0; }
.section + .section { border-top: 1px solid var(--line); }

/* The inverted band. */
.section--dark { background: var(--dark); color: #EDF1F2; border-top: 0; }
.section--dark h2, .section--dark h3 { color: #fff; }
.section--dark a { color: #7FD4D0; }
.section--dark .card { background: var(--dark-soft); border-color: var(--dark-line); }
.section--dark .card h3 a { color: #fff; }
.section--dark .card p { color: #AAB6BC; }

.icon { width: 1.25em; height: 1.25em; flex: none; }

/* ---------- Kicker ---------- */

.kicker {
  font: 600 .75rem/1 var(--body);
  letter-spacing: .13em;
  text-transform: uppercase;
  color: var(--teal);
  margin: 0 0 1.1rem;
  display: flex;
  align-items: center;
  gap: .7em;
}
.kicker::after { content: ''; flex: 1; height: 1px; background: var(--line-strong); max-width: 90px; }

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .5em;
  font: 600 .98rem/1 var(--body);
  letter-spacing: -0.005em;
  padding: .95em 1.5em;
  border-radius: var(--radius);
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--ink);
  text-decoration: none;
  cursor: pointer;
  /* Feedback, not delight. No transform, no bounce, no coloured shadow. */
  transition: background .12s ease, border-color .12s ease, color .12s ease;
}
.btn:hover { border-color: var(--ink); color: var(--ink); }

.btn--green,
.btn--primary { background: var(--teal); border-color: var(--teal); color: #fff; }
.btn--green:hover,
.btn--primary:hover { background: var(--teal-deep); border-color: var(--teal-deep); color: #fff; }

.btn--berry { background: var(--ink); border-color: var(--ink); color: #fff; }
.btn--ghost { background: transparent; }
.btn--small { font-size: .9rem; padding: .7em 1.1em; }

/* ---------- Header ---------- */

.announce {
  background: var(--ink);
  color: #C9D2D6;
  text-align: center;
  font: 500 .8125rem/1.4 var(--body);
  padding: .65em var(--gutter);
  letter-spacing: .005em;
}
.announce a { color: #fff; text-decoration-color: rgba(255, 255, 255, .45); }

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(251, 250, 247, .88);
  backdrop-filter: saturate(1.2) blur(12px);
  border-bottom: 1px solid var(--line);
}
.site-header__row { display: flex; align-items: center; gap: 18px; min-height: 74px; }

.brand { display: inline-flex; align-items: center; text-decoration: none; margin-right: auto; }
.brand img { width: auto; height: 34px; }

.nav { display: flex; align-items: center; gap: 2px; list-style: none; margin: 0; padding: 0; }
.nav a {
  display: block;
  padding: .55em .85em;
  border-radius: var(--radius);
  font: 500 .95rem/1 var(--body);
  color: var(--ink-soft);
  text-decoration: none;
  transition: color .12s ease, background .12s ease;
}
.nav a:hover { color: var(--ink); background: rgba(14, 20, 23, .04); }
.nav a[aria-current] { color: var(--ink); font-weight: 600; }

.header-tools { display: flex; align-items: center; gap: 8px; }
.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 40px; height: 40px;
  border-radius: var(--radius);
  border: 0;
  background: transparent;
  color: var(--ink-soft);
  cursor: pointer;
  transition: color .12s ease, background .12s ease;
}
.icon-btn:hover { color: var(--ink); background: rgba(14, 20, 23, .04); }
.nav-toggle { display: none; }

@media (max-width: 900px) {
  .nav-toggle { display: inline-grid; }
  .site-nav {
    position: fixed; inset: 0 0 0 auto; width: min(320px, 84vw);
    background: var(--surface); border-left: 1px solid var(--line);
    padding: 80px 20px 20px; transform: translateX(100%);
    transition: transform .2s ease; z-index: 60;
  }
  .site-nav[data-open] { transform: none; }
  .nav { flex-direction: column; align-items: stretch; gap: 2px; }
  .nav a { padding: .8em 1em; font-size: 1.05rem; }
  .nav-close { position: absolute; top: 18px; right: 18px; }
}
@media (min-width: 901px) { .nav-close { display: none; } }

/* ---------- Hero ---------- */

.hero, .section--hero { padding: clamp(56px, 9vw, 128px) 0 clamp(48px, 7vw, 96px); }

.hero-lede {
  font-size: clamp(1.15rem, 1.8vw, 1.35rem);
  line-height: 1.55;
  color: var(--ink-soft);
  max-width: 58ch;
}

.hero-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 2rem; }

/* ---------- Cards ---------- */

.grid { display: grid; gap: 20px; }
.grid--2 { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.grid--3 { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.grid--4 { grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 26px 24px 24px;
  display: flex;
  flex-direction: column;
  gap: .4rem;
  /* Border colour, not a shadow and not a lift. A card that jumps under the
     cursor is the single most dated interaction still in wide use. */
  transition: border-color .12s ease;
}
.card:hover { border-color: var(--line-strong); }

.card .icon,
.card__icon { color: var(--teal); width: 26px; height: 26px; margin-bottom: .6rem; }

.card h3 { margin: 0 0 .25em; font-size: 1.15rem; }
.card h3 a { color: var(--ink); text-decoration: none; }
.card h3 a:hover { color: var(--teal); }
.card p { color: var(--ink-soft); font-size: .96rem; line-height: 1.6; margin: 0; }
.card__meta { margin-top: auto; padding-top: .9rem; font: 500 .8rem/1 var(--body); color: var(--ink-faint); }

/* ---------- Prose ---------- */

.prose { max-width: 70ch; }
.prose > * + * { margin-top: 1.15em; }
.prose h2 { margin-top: 2.2em; }
.prose h3 { margin-top: 1.8em; }
.prose ul, .prose ol { padding-left: 1.3em; }
.prose li + li { margin-top: .4em; }
.prose strong { font-weight: 650; }

.prose blockquote {
  margin: 1.8em 0;
  padding: 0 0 0 1.4em;
  border-left: 3px solid var(--teal);
  color: var(--ink-soft);
  font-size: 1.08rem;
}

.prose code {
  font: 500 .88em/1.4 ui-monospace, SFMono-Regular, Menlo, monospace;
  background: rgba(14, 20, 23, .05);
  padding: .18em .42em;
  border-radius: 4px;
}

.prose table { width: 100%; border-collapse: collapse; font-size: .95rem; margin: 1.6em 0; }
.prose th, .prose td { text-align: left; padding: .7em .8em; border-bottom: 1px solid var(--line); }
.prose th { font: 600 .8rem/1.3 var(--body); text-transform: uppercase; letter-spacing: .06em; color: var(--ink-soft); }

.prose hr { border: 0; border-top: 1px solid var(--line); margin: 2.4em 0; }

/* ---------- Page head ---------- */

.page-head { padding: clamp(44px, 6vw, 84px) 0 clamp(24px, 3vw, 40px); }
.page-head p.lede { font-size: 1.15rem; color: var(--ink-soft); max-width: 62ch; }

.breadcrumb { font: 500 .85rem/1 var(--body); color: var(--ink-faint); margin-bottom: 1rem; }
.breadcrumb a { color: var(--ink-soft); text-decoration: none; }
.breadcrumb a:hover { color: var(--teal); }

/* ---------- Lists ---------- */

.latest { list-style: none; margin: 0; padding: 0; }
.latest li { padding: 1.1em 0; border-bottom: 1px solid var(--line); display: flex; flex-wrap: wrap; gap: .3em 1em; align-items: baseline; justify-content: space-between; }
.latest li:first-child { border-top: 1px solid var(--line); }
.latest a { font: 600 1.05rem/1.35 var(--display); letter-spacing: -0.012em; color: var(--ink); text-decoration: none; flex: 1 1 300px; }
.latest a:hover { color: var(--teal); }
.latest__meta { font: 500 .82rem/1 var(--body); color: var(--ink-faint); }

/* ---------- Footer ---------- */

.site-footer { background: var(--dark); color: #AAB6BC; padding: clamp(48px, 6vw, 80px) 0 40px; font-size: .95rem; }
.footer-grid { display: grid; gap: 34px; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
.footer-brand { grid-column: span 2; min-width: 240px; }
.footer-brand img { height: 32px; width: auto; margin-bottom: 1rem; }
.footer-brand p { color: #8A969C; max-width: 42ch; }
.footer-since { color: #7FD4D0; font: 500 .85rem/1.4 var(--body); letter-spacing: .02em; }

.site-footer h2 { font: 600 .78rem/1 var(--body); letter-spacing: .12em; text-transform: uppercase; color: #6F7C83; margin: 0 0 1rem; }
.site-footer ul { list-style: none; margin: 0; padding: 0; }
.site-footer li + li { margin-top: .6em; }
.site-footer a { color: #C9D2D6; text-decoration: none; }
.site-footer a:hover { color: #fff; text-decoration: underline; text-underline-offset: 3px; }

.footer-social { margin-top: 34px; }
.footer-social ul { display: flex; flex-wrap: wrap; gap: 18px; }

.footer-legal { margin-top: 40px; padding-top: 26px; border-top: 1px solid var(--dark-line); font-size: .8rem; line-height: 1.6; color: #6F7C83; }
.footer-legal p { margin: 0 0 .6em; max-width: 92ch; }

@media (max-width: 640px) { .footer-brand { grid-column: span 1; } }

/* ---------- Search ---------- */

.search-pop { position: fixed; inset: 0; z-index: 80; background: rgba(14, 20, 23, .45); display: grid; place-items: start center; padding-top: 14vh; }
.search-pop[hidden] { display: none; }
.search-pop__box { background: var(--surface); border-radius: var(--radius-lg); padding: 22px; width: min(560px, 92vw); border: 1px solid var(--line); }
.search-form { display: flex; gap: 10px; }
.search-form input {
  flex: 1; font: 400 1.05rem var(--body); padding: .8em 1em;
  border: 1px solid var(--line-strong); border-radius: var(--radius);
  background: var(--paper); color: var(--ink);
}
.search-form input:focus { outline: 2px solid var(--teal); outline-offset: 0; border-color: var(--teal); }

/* ---------- Motion ---------- */

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition-duration: .01ms !important; animation-duration: .01ms !important; }
}

/* ---------- Dark mode ---------- */

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #0E1417;
    --surface: #161E22;
    --ink: #EDF1F2;
    --ink-soft: #A3AFB5;
    --ink-faint: #7C888E;
    --line: #242E33;
    --line-strong: #35424A;
    --teal: #5FC6C2;
    --teal-deep: #8BDDD9;
    --teal-wash: #12292A;
    --dark: #0A0F11;
    --dark-soft: #161E22;
    --dark-line: #242E33;
  }
  :root:not([data-theme="light"]) .site-header { background: rgba(14, 20, 23, .88); }
  :root:not([data-theme="light"]) .announce { background: #0A0F11; }
  :root:not([data-theme="light"]) .nav a:hover,
  :root:not([data-theme="light"]) .icon-btn:hover { background: rgba(255, 255, 255, .06); }
  :root:not([data-theme="light"]) .prose code { background: rgba(255, 255, 255, .07); }
}

/* ---------- Hero, with actual presence ---------- */

/*
 * The previous version of this was a heading and a paragraph on a white
 * background, which is why the site read as an unstyled document however
 * carefully the spacing was set. A homepage needs one element with weight.
 *
 * Dark, full-bleed, oversized type, and the brand's own arc mark blown up
 * to 900px as a background graphic. The mark is used rather than stock
 * photography deliberately: a Suffolk agency using the same Unsplash office
 * shot as everyone else is worse than no image at all, and the arcs are
 * already the identity.
 */
.hero--dark {
  position: relative;
  overflow: hidden;
  background: var(--dark);
  color: #EDF1F2;
  padding: clamp(72px, 12vw, 160px) 0 clamp(64px, 10vw, 140px);
  border-top: 0;
}

/* The mark, enormous, bled off the right edge and dimmed to a texture. */
.hero--dark::before {
  content: '';
  position: absolute;
  top: 50%;
  right: -14%;
  width: min(900px, 78vw);
  aspect-ratio: 1;
  transform: translateY(-50%);
  background: url('/img/mark.svg') center / contain no-repeat;
  opacity: .1;
  pointer-events: none;
}

/* A soft teal wash from the lower left, so the black is not flat. */
.hero--dark::after {
  content: '';
  position: absolute;
  inset: auto auto -40% -20%;
  width: 70%;
  aspect-ratio: 1;
  background: radial-gradient(circle, rgba(11, 107, 107, .38), transparent 68%);
  pointer-events: none;
}

.hero--dark .wrap { position: relative; z-index: 1; }

.hero--dark h1 {
  color: #fff;
  font-size: clamp(2.9rem, 7.2vw, 5.6rem);
  letter-spacing: -0.032em;
  line-height: 1.02;
  max-width: 15ch;
  margin-bottom: .45em;
}

.hero--dark .kicker { color: #7FD4D0; }
.hero--dark .kicker::after { background: rgba(127, 212, 208, .32); }

.hero--dark .hero-lede {
  color: #B4C0C6;
  font-size: clamp(1.1rem, 1.7vw, 1.4rem);
  max-width: 54ch;
}

.hero--dark .btn { background: transparent; border-color: rgba(237, 241, 242, .3); color: #EDF1F2; }
.hero--dark .btn:hover { border-color: #EDF1F2; background: rgba(237, 241, 242, .08); }
.hero--dark .btn--green { background: var(--teal); border-color: var(--teal); color: #fff; }
.hero--dark .btn--green:hover { background: #0D8080; border-color: #0D8080; }

/* A strip of facts under the hero. Cheap credibility, and it fills the
   space a case-study row would occupy on an agency with clients. */
.hero-facts {
  display: flex; flex-wrap: wrap; gap: 0;
  margin-top: clamp(40px, 5vw, 68px);
  border-top: 1px solid rgba(237, 241, 242, .14);
}
.hero-facts div { flex: 1 1 190px; padding: 22px 26px 0 0; }
.hero-facts dt { font: 600 .72rem/1 var(--body); letter-spacing: .13em; text-transform: uppercase; color: #7FD4D0; margin-bottom: .55rem; }
.hero-facts dd { margin: 0; font: 500 .95rem/1.5 var(--body); color: #B4C0C6; }

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .hero--dark { background: #080C0E; }
}

/* ---------- Artwork ---------- */

/*
 * Generated from the brand's own arcs (brand/make-artwork.mjs), not bought.
 * The hero previously used the logo mark blown up, which worked but was
 * literally just the logo again; this is a field of arcs radiating from a
 * point off the lower-left, so the background has depth and direction
 * rather than being one shape at low opacity.
 */
.hero--dark::before {
  top: 0; right: 0; bottom: 0; left: 0;
  width: auto; aspect-ratio: auto;
  transform: none;
  background: url('/img/art/signal-field.svg') right bottom / cover no-repeat;
  opacity: .5;
}

/* Punctuation between long bands. */
.rule-arc { display: block; width: 100%; height: 56px; background: url('/img/art/rule-arc.svg') center / 100% 100% no-repeat; opacity: .8; }

/* The larger per-service glyphs, used at the head of a service page. */
.glyph { width: 84px; height: 84px; margin-bottom: 1.4rem; }

/* ---------- Reveal on scroll ---------- */

/*
 * Deliberately almost nothing: 14px of travel and a fade, once, on entry.
 * Anything more and a page full of content turns into a slideshow the
 * reader has to wait for. Set by JS adding .reveal-ready to <html>, so with
 * JS off everything is simply visible — the content must never depend on
 * the animation having run.
 */
.reveal-ready [data-reveal] {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity .5s cubic-bezier(.22, .61, .36, 1), transform .5s cubic-bezier(.22, .61, .36, 1);
}
.reveal-ready [data-reveal].is-in { opacity: 1; transform: none; }

/* Children stagger very slightly, so a row of cards resolves left to right
   rather than snapping as one block. */
.reveal-ready [data-reveal-stagger] > * { opacity: 0; transform: translateY(14px); transition: opacity .5s cubic-bezier(.22,.61,.36,1), transform .5s cubic-bezier(.22,.61,.36,1); }
.reveal-ready [data-reveal-stagger].is-in > * { opacity: 1; transform: none; }
.reveal-ready [data-reveal-stagger].is-in > *:nth-child(2) { transition-delay: .06s; }
.reveal-ready [data-reveal-stagger].is-in > *:nth-child(3) { transition-delay: .12s; }
.reveal-ready [data-reveal-stagger].is-in > *:nth-child(4) { transition-delay: .18s; }
.reveal-ready [data-reveal-stagger].is-in > *:nth-child(n+5) { transition-delay: .24s; }

@media (prefers-reduced-motion: reduce) {
  .reveal-ready [data-reveal],
  .reveal-ready [data-reveal-stagger] > * { opacity: 1 !important; transform: none !important; transition: none !important; }
}
