/* FDM Data Solutions
   Typeface: Instrument Sans (SIL OFL), self-hosted in fonts/. */

@font-face {
  font-family: "Instrument Sans";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("fonts/instrument-sans.woff2") format("woff2");
}

:root {
  --green: #0f2e26;
  --green-base: #0c2620;
  --green-hairline: #2a453d;
  --green-deep: #0b231d;
  --on-green: #f2f0e9;
  --on-green-muted: rgba(242, 240, 233, 0.66);
  --green-rule: rgba(242, 240, 233, 0.16);

  --paper: #f6f5f0;
  --ink: #141815;
  --muted: #5c615c;
  --line: #d9d7ce;
  --brass: #a8874a;

  --font: "Instrument Sans", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --wrap: 1180px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #101412;
    --ink: #ebe9e2;
    --muted: #a3a69f;
    --line: #2a302c;
    --green: #12362d;
    --green-base: #0e2b24;
    --green-hairline: #2d4c44;
    --green-deep: #0a1d18;
    --brass: #c4a466;
  }
}

*,
*::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-family: var(--font);
  font-size: 17px;
  font-weight: 400;
  line-height: 1.65;
  font-variant-numeric: tabular-nums lining-nums;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

::selection {
  background: var(--green);
  color: var(--on-green);
}

h1,
h2,
h3 {
  margin: 0;
  font-weight: 500;
  text-wrap: balance;
}

p,
ul,
dl,
dd {
  margin: 0;
}

a {
  color: inherit;
  text-decoration: underline;
  text-decoration-color: var(--line);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.22em;
  transition: text-decoration-color 0.2s ease, color 0.2s ease;
}

a:hover {
  text-decoration-color: currentColor;
}

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

.wrap {
  max-width: var(--wrap);
  margin: 0 auto;
  padding-left: 22px;
  padding-right: 22px;
}

.skip {
  position: absolute;
  left: -9999px;
  top: 12px;
  z-index: 10;
  padding: 6px 12px;
  background: var(--on-green);
  color: var(--green);
}

.skip:focus {
  left: 16px;
}

/* Small uppercase labels */

.label {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 560;
  letter-spacing: 0.16em;
  line-height: 1.4;
  text-transform: uppercase;
}

/* Header */

.top {
  background: var(--green);
  color: var(--on-green);
  border-bottom: 1px solid var(--green-rule);
}

.top-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px 36px;
  padding-top: 26px;
  padding-bottom: 26px;
}

.wordmark {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  color: var(--on-green);
  text-decoration: none;
  white-space: nowrap;
}

.wm-fdm {
  /* the tracking also adds space after the M; take it back so the rule
     sits optically centred between FDM and Data Solutions */
  margin-right: -0.24em;
  font-size: 1.02rem;
  font-weight: 600;
  letter-spacing: 0.24em;
}

.wm-sep {
  width: 1px;
  height: 18px;
  background: var(--green-rule);
}

.wm-rest {
  color: var(--on-green-muted);
  font-size: 0.95rem;
  letter-spacing: 0.02em;
}

.nav {
  display: flex;
  flex-wrap: wrap;
  order: 3;
  flex-basis: 100%;
  gap: 6px 30px;
  font-size: 0.93rem;
}

.lang-switch {
  display: flex;
  order: 2;
  gap: 10px;
  margin-left: auto;
  font-size: 0.8rem;
  font-weight: 560;
  /* 18px line box: the divider before it is then as tall as the one in the wordmark */
  line-height: 18px;
  letter-spacing: 0.14em;
}

/* larger tap area (about 30 x 42px) without moving anything */
.lang-switch > * {
  padding: 12px 5px;
  margin: -12px -5px;
}

/* drop the tracking after the last letter so ES ends on the content edge */
.lang-switch > :last-child {
  margin-right: calc(-5px - 0.14em);
}

.lang-switch span[aria-current] {
  color: var(--on-green);
}

.lang-switch a {
  color: var(--on-green-muted);
  text-decoration: none;
}

.lang-switch a:hover {
  color: var(--on-green);
}

.nav a {
  /* taller tap area (about 44px) without moving anything */
  padding-top: 9px;
  padding-bottom: 9px;
  margin-top: -9px;
  margin-bottom: -9px;
  color: var(--on-green-muted);
  text-decoration: none;
}

.nav a:hover {
  color: var(--on-green);
}

/* Hero */

.hero {
  --base-h: 176px;
  position: relative;
  isolation: isolate;
  overflow: hidden;
  color: var(--on-green);
  /* two tones: the main field, and a slightly darker base under the scale,
     separated by a hairline */
  background: linear-gradient(
    to bottom,
    var(--green) 0,
    var(--green) calc(100% - var(--base-h) - 1px),
    var(--green-hairline) calc(100% - var(--base-h) - 1px),
    var(--green-hairline) calc(100% - var(--base-h)),
    var(--green-base) calc(100% - var(--base-h))
  );
}

/* Chart gridlines: rise from the scale's 0, 0.25, 0.50, 0.75 and 1 marks and
   fade out upwards. Drawn from the scale bar itself, so they always line up. */
.hero .scale-bar::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: -1;
  height: 720px;
  background-image:
    repeating-linear-gradient(to right, rgba(242, 240, 233, 0.085) 0 1px, transparent 1px 25%),
    linear-gradient(to left, rgba(242, 240, 233, 0.085) 0 1px, transparent 1px);
  -webkit-mask-image: linear-gradient(to top, #000 0%, #000 22%, transparent 92%);
  mask-image: linear-gradient(to top, #000 0%, #000 22%, transparent 92%);
  pointer-events: none;
}

.hero-inner {
  padding-top: 72px;
  padding-bottom: 56px;
}

.hero h1 {
  max-width: 15ch;
  font-size: clamp(2.5rem, 6.4vw, 4.75rem);
  font-weight: 450;
  line-height: 1.04;
  letter-spacing: -0.03em;
}

.hero-sub {
  max-width: 35em;
  margin-top: 30px;
  color: var(--on-green-muted);
  font-size: 1.14rem;
  line-height: 1.6;
}

.hero-link {
  display: inline-block;
  margin-top: 36px;
  color: var(--on-green);
  font-weight: 500;
  text-decoration-color: var(--green-rule);
}

.hero-link:hover {
  text-decoration-color: var(--on-green);
}

/* Probability scale: a quiet 0-1 instrument scale with one marker */

.scale {
  --tick-major: rgba(242, 240, 233, 0.42);
  --tick-minor: rgba(242, 240, 233, 0.2);
  --axis: rgba(242, 240, 233, 0.4);
  --scale-text: var(--on-green-muted);
  --marker-text: var(--on-green);
  margin-top: 88px;
}

.scale-paper {
  --tick-major: var(--muted);
  --tick-minor: var(--line);
  --axis: var(--muted);
  --scale-text: var(--muted);
  --marker-text: var(--ink);
  margin-top: 36px;
}

.scale-bar {
  position: relative;
  height: 34px;
  border-bottom: 1px solid var(--axis);
  background-image:
    repeating-linear-gradient(to right, var(--tick-major) 0 1px, transparent 1px 25%),
    repeating-linear-gradient(to right, var(--tick-minor) 0 1px, transparent 1px 5%);
  background-position: left bottom, left bottom;
  background-size: 100% 16px, 100% 8px;
  background-repeat: no-repeat;
}

.scale-bar::after {
  content: "";
  position: absolute;
  right: 0;
  bottom: 0;
  width: 1px;
  height: 16px;
  background: var(--tick-major);
}

.scale-marker {
  position: absolute;
  left: 60%;
  bottom: 0;
  width: 1px;
  height: 34px;
  background: var(--brass);
}

.scale-marker::before {
  content: "";
  position: absolute;
  top: -4px;
  left: -4px;
  width: 9px;
  height: 9px;
  background: var(--brass);
  transform: rotate(45deg);
}

.scale-marker b {
  position: absolute;
  top: -9px;
  left: 14px;
  color: var(--marker-text);
  font-size: 0.86rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  line-height: 1;
}

.scale-labels {
  position: relative;
  height: 22px;
  margin-top: 10px;
  color: var(--scale-text);
  font-size: 0.8rem;
  letter-spacing: 0.03em;
}

.scale-labels span {
  position: absolute;
  top: 0;
  transform: translateX(-50%);
}

.scale-labels .at-0 {
  left: 0;
  transform: none;
}

.scale-labels .at-25 {
  left: 25%;
}

.scale-labels .at-50 {
  left: 50%;
}

.scale-labels .at-75 {
  left: 75%;
}

.scale-labels .at-100 {
  left: 100%;
  transform: translateX(-100%);
}

/* Sections */

.sec {
  padding-top: 64px;
  padding-bottom: 72px;
  border-top: 1px solid var(--line);
}

.sec:first-of-type {
  border-top: 0;
}

.grid {
  display: grid;
  gap: 18px;
}

.statement {
  max-width: 30em;
  font-size: clamp(1.4rem, 2.6vw, 2.05rem);
  font-weight: 420;
  line-height: 1.32;
  letter-spacing: -0.014em;
}

.statement-note {
  max-width: 40em;
  margin-top: 22px;
  color: var(--muted);
}

/* Services */

.services {
  display: grid;
  gap: 0 48px;
  padding: 0;
  list-style: none;
}

.services li {
  padding-top: 22px;
  padding-bottom: 26px;
  border-top: 1px solid var(--line);
}

.services .label {
  display: block;
  margin-bottom: 10px;
}

.services h3,
.rows h3 {
  font-size: 1.22rem;
  font-weight: 560;
  line-height: 1.3;
  letter-spacing: -0.01em;
}

.services p {
  margin-top: 8px;
  color: var(--muted);
}

/* Method: full width, picks up the hero's 0-1 scale */

.big-line {
  max-width: 17ch;
  margin-top: 44px;
  font-size: clamp(2rem, 5vw, 3.6rem);
  font-weight: 450;
  line-height: 1.08;
  letter-spacing: -0.028em;
}

.method-cols {
  display: grid;
  gap: 18px 40px;
  margin-top: 44px;
}

.method-cols p {
  color: var(--muted);
}

.techniques {
  margin-top: 56px;
  padding-top: 22px;
  border-top: 1px solid var(--line);
}

.tech-grid {
  display: grid;
  gap: 26px 32px;
  margin: 20px 0 0;
}

.tech-grid dt {
  margin-bottom: 8px;
  font-size: 0.98rem;
  font-weight: 560;
}

.tech-grid dd {
  margin: 0;
}

.tech-grid ul {
  margin: 0;
  padding: 0;
  list-style: none;
  color: var(--muted);
  font-size: 0.94rem;
  line-height: 1.75;
}

/* Principles (green band) */

.band {
  background: var(--green);
  color: var(--on-green);
  border-top: 0;
}

.band .label {
  color: var(--on-green-muted);
}

.rows {
  padding: 0;
  list-style: none;
}

.rows li {
  display: grid;
  gap: 6px 32px;
  padding-top: 20px;
  padding-bottom: 20px;
  border-top: 1px solid var(--green-rule);
}

.rows li:last-child {
  border-bottom: 1px solid var(--green-rule);
}

.rows p {
  color: var(--on-green-muted);
}

/* Company facts */

.facts {
  border-top: 1px solid var(--ink);
}

.facts div {
  display: grid;
  gap: 4px;
  padding-top: 15px;
  padding-bottom: 15px;
  border-bottom: 1px solid var(--line);
}

.facts dd {
  overflow-wrap: anywhere;
}

/* Contact */

.contact-email {
  margin-top: 6px;
  font-size: clamp(1.3rem, 5.6vw, 2.7rem);
  font-weight: 430;
  line-height: 1.2;
  letter-spacing: -0.02em;
  overflow-wrap: anywhere;
}

.contact-email a {
  text-decoration-color: var(--brass);
}

.contact-note {
  margin-top: 16px;
  color: var(--muted);
}

/* Footer */

.foot {
  background: var(--green-deep);
  color: var(--on-green-muted);
  font-size: 0.9rem;
}

.foot-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 32px;
  padding-top: 30px;
  padding-bottom: 36px;
}

.foot a {
  color: var(--on-green-muted);
  text-decoration-color: var(--green-rule);
}

.foot a:hover {
  color: var(--on-green);
}

.foot .wm-fdm {
  color: var(--on-green);
  font-size: 0.9rem;
}

/* Legal pages and 404 */

.page-head {
  background: var(--green);
  color: var(--on-green);
}

.page-head-inner {
  padding-top: 56px;
  padding-bottom: 52px;
}

.page-head .label {
  color: var(--on-green-muted);
}

.page-head h1 {
  margin-top: 12px;
  font-size: clamp(2.2rem, 5vw, 3.4rem);
  font-weight: 450;
  letter-spacing: -0.028em;
  line-height: 1.05;
}

.page-head p:last-child {
  margin-top: 12px;
  color: var(--on-green-muted);
}

.prose {
  max-width: 720px;
  padding-top: 56px;
  padding-bottom: 96px;
}

.prose h2 {
  margin-top: 36px;
  margin-bottom: 8px;
  font-size: 1.18rem;
  font-weight: 580;
  letter-spacing: -0.01em;
}

.prose h2:first-child {
  margin-top: 0;
}

.prose p + p {
  margin-top: 12px;
}

.notfound {
  min-height: 70vh;
  background: var(--green);
  color: var(--on-green);
}

.notfound-inner {
  padding-top: 96px;
  padding-bottom: 128px;
}

.notfound h1 {
  margin-top: 14px;
  font-size: clamp(2.4rem, 6vw, 4rem);
  font-weight: 450;
  letter-spacing: -0.03em;
}

.notfound p {
  margin-top: 14px;
  color: var(--on-green-muted);
}

.notfound .label {
  color: var(--on-green-muted);
}

/* Wider screens */

@media (min-width: 720px) {
  .wrap {
    padding-left: 40px;
    padding-right: 40px;
  }

  .hero {
    --base-h: 192px;
  }

  .hero-inner {
    padding-top: 112px;
    padding-bottom: 72px;
  }

  .sec {
    padding-top: 96px;
    padding-bottom: 104px;
  }

  .services {
    grid-template-columns: 1fr 1fr;
  }

  .facts div {
    grid-template-columns: 12em 1fr;
    gap: 24px;
    align-items: baseline;
  }

  .rows li {
    grid-template-columns: 14em 1fr;
    align-items: baseline;
  }

  .method-cols {
    grid-template-columns: repeat(3, 1fr);
  }

  .tech-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* Header on one row. In em, not px, so the switch moves with the reader's
   default text size: 50em = 800px at the usual 16px. Below it the header
   uses the two-row layout, which never runs out of room. */
@media (min-width: 50em) {
  .nav {
    order: 2;
    flex-basis: auto;
    margin-left: auto;
  }

  /* divider with 28px on both sides: the row gap is 36px, minus 8 */
  .lang-switch {
    order: 3;
    margin-left: -8px;
    padding-left: 28px;
    border-left: 1px solid var(--green-rule);
  }
}

/* Phones: the menu spans the full width, so its last item ends on the
   same edge as ES above it */
@media (max-width: 479px) {
  .nav {
    justify-content: space-between;
    column-gap: 16px;
  }
}

/* Very narrow phones (320-359px): keep the menu on one line and the
   headline from leaving "We" alone on the first line */
@media (max-width: 359px) {
  .nav {
    column-gap: 12px;
    font-size: 0.88rem;
  }

  .hero h1 {
    font-size: 2.25rem;
  }
}

@media (min-width: 1000px) {
  .tech-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

@media (min-width: 1000px) {
  .grid {
    grid-template-columns: repeat(12, 1fr);
    gap: 0 32px;
  }

  .grid > .label {
    grid-column: 1 / span 3;
    padding-top: 6px;
  }

  .grid > .body {
    grid-column: 4 / span 9;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  a {
    transition: none;
  }
}
