/* ==========================================================================
   R2 Finance — site styles
   One typeface, Fira Sans, the face the r2-finance logo is drawn in.
   Capitals mark structure (navigation, headings, buttons); everything that
   is read as a sentence is in sentence case. White page, Rob's own
   photographs, hairline rules instead of cards. Light on every device.
   No scripts, no cookies, no third-party requests.
   ========================================================================== */

@font-face {
  font-family: "Fira Sans";
  src: url("/assets/fonts/fira-sans-latin-300-normal.woff2") format("woff2");
  font-weight: 300; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Fira Sans";
  src: url("/assets/fonts/fira-sans-latin-400-normal.woff2") format("woff2");
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Fira Sans";
  src: url("/assets/fonts/fira-sans-latin-400-italic.woff2") format("woff2");
  font-weight: 400; font-style: italic; font-display: swap;
}
@font-face {
  font-family: "Fira Sans";
  src: url("/assets/fonts/fira-sans-latin-600-normal.woff2") format("woff2");
  font-weight: 600; font-style: normal; font-display: swap;
}

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

:root {
  --paper: #FFFFFF;        /* page */
  --tint: #F3F5F4;         /* quiet bands and panels */
  --ink: #0F2A2E;          /* text: deep petrol */
  --ink-soft: #485C5F;     /* secondary text */
  --rule: #D2DAD8;         /* hairlines */
  --accent: #A3195B;       /* chart magenta: fitted line, link underlines, numerals */
  --mark: #1F5C63;         /* petrol: data points and bars */

  --font: "Fira Sans", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;

  --t-small: 0.875rem;
  --t-body: 1.0625rem;
  --t-lede: clamp(1.1875rem, 1rem + 0.8vw, 1.375rem);
  --t-h2: clamp(1.3125rem, 1.1rem + 1vw, 1.75rem);
  --t-h1: clamp(1.75rem, 1.05rem + 3vw, 3rem);

  --gutter: clamp(1.25rem, 4vw, 2.5rem);
  --section: clamp(3.5rem, 8vw, 6rem);

  /* The site has one colour scheme. This stops browsers darkening it themselves. */
  color-scheme: only light;
}

/* ---------- Base --------------------------------------------------------- */

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font);
  font-size: var(--t-body);
  font-weight: 400;
  line-height: 1.6;
  font-variant-numeric: lining-nums;
  font-synthesis: none;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, p, dl, dd, ol, ul, figure { margin: 0; }
h1, h2, h3 { text-wrap: balance; }
p, dd, li { text-wrap: pretty; }
svg, img { max-width: 100%; height: auto; }

a {
  color: inherit;
  text-decoration-line: underline;
  text-decoration-color: var(--accent);
  text-decoration-thickness: 1.5px;
  text-underline-offset: 0.2em;
}
a:hover { color: var(--accent); }
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 2px;
}

/* Headings are set in capitals with open spacing. The capitals are applied here,
   so the text in the pages stays in ordinary sentence case. */
h1, h2, h3 { text-transform: uppercase; }
h1 {
  font-weight: 300;
  font-size: var(--t-h1);
  line-height: 1.16;
  letter-spacing: 0.04em;
}
h2 {
  font-weight: 300;
  font-size: var(--t-h2);
  line-height: 1.25;
  letter-spacing: 0.07em;
}
h3 {
  font-size: 0.875rem;
  font-weight: 600;
  line-height: 1.4;
  letter-spacing: 0.09em;
}
strong, b { font-weight: 600; }

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

.vh {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip {
  position: absolute; left: -999px; top: 0; z-index: 10;
  background: var(--ink); color: #FFFFFF; padding: 0.5rem 1rem;
}
.skip:focus { left: 1rem; top: 1rem; }

/* A plain line above a page's main heading, saying what kind of page it is. */
.eyebrow {
  color: var(--ink-soft);
  margin-bottom: 0.875rem;
}
.lede {
  font-size: var(--t-lede);
  font-weight: 300;
  line-height: 1.5;
  max-width: 36rem;
  margin-top: 1.5rem;
}

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

.site-header { border-bottom: 1px solid var(--rule); }
.site-header__in {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: 0.375rem 2rem;
  padding-block: 0.875rem;
}
.logo { display: block; line-height: 0; }
.logo img { display: block; width: 11.5rem; }
.site-nav ul {
  display: flex; flex-wrap: wrap; gap: 0 1.75rem;
  list-style: none; padding: 0;
}
.site-nav a {
  display: inline-block;
  padding-block: 0.375rem;
  font-size: 0.8125rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  text-decoration-color: transparent;
}
.site-nav a:hover,
.site-nav a[aria-current="page"] { color: var(--ink); text-decoration-color: var(--accent); }
@media (max-width: 30rem) {
  .logo img { width: 9.5rem; }
  .site-nav ul { gap: 0 1rem; }
  .site-nav a { font-size: 0.75rem; letter-spacing: 0.07em; }
}

/* ---------- Hero and page heads ----------------------------------------- */

.hero {
  display: grid; gap: 2.5rem; align-items: center;
  padding-block: clamp(2.5rem, 6vw, 5rem) clamp(2.5rem, 6vw, 4.5rem);
}
@media (min-width: 60rem) {
  .hero { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 3.5rem; }
}
.actions {
  display: flex; flex-wrap: wrap; align-items: center; gap: 1rem 1.75rem;
  margin-top: 2rem;
}
.btn {
  display: inline-block;
  padding: 0.9375rem 1.5rem;
  background: var(--ink);
  border: 1px solid var(--ink);
  border-radius: 2px;
  color: #FFFFFF;
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  text-decoration: none;
}
.btn:hover { background: var(--accent); border-color: var(--accent); color: #FFFFFF; }
.more { font-weight: 600; }
.place { margin-top: 1.5rem; font-size: var(--t-small); color: var(--ink-soft); }

.page-head { padding-block: clamp(2.5rem, 6vw, 4.5rem) clamp(2rem, 5vw, 3.5rem); }
.page-head h1 { max-width: 24ch; }
.page-head .lede { max-width: 38rem; }
.page-head .letters { margin-top: 1rem; color: var(--ink-soft); letter-spacing: 0.02em; }

/* A page head with a photograph beside it. */
.page-head--split { display: grid; gap: 2rem; align-items: center; }
@media (min-width: 60rem) {
  .page-head--split { grid-template-columns: minmax(0, 7fr) minmax(0, 4fr); gap: 4rem; }
}

/* ---------- Figures and photographs ------------------------------------- */

.fig img { display: block; width: 100%; }
.fig figcaption {
  max-width: 34rem;
  margin-top: 0.875rem; padding-top: 0.875rem;
  border-top: 1px solid var(--rule);
  font-size: var(--t-small); line-height: 1.5;
  color: var(--ink-soft);
}
.fig figcaption i { font-style: italic; color: var(--ink); }
.prose .fig { margin-top: 2rem; max-width: 34rem; }
.fig--small img { max-width: 17rem; }

/* Rob's portrait: larger beside the About heading, small beside the teaser on the home page. */
.portrait img { display: block; width: 100%; max-width: 12rem; }
@media (min-width: 60rem) {
  .page-head--split .portrait img { max-width: 17rem; margin-left: auto; }
}
.rail__head .portrait { margin-top: 1.5rem; }
.rail__head .portrait img { max-width: 9.5rem; }

/* A tall photograph beside a page heading. On a phone it is cropped to a landscape shape. */
.tall img {
  display: block; width: 100%;
  aspect-ratio: 4 / 3; object-fit: cover; object-position: 50% 62%;
}
@media (min-width: 60rem) {
  .tall img { aspect-ratio: 4 / 5; object-position: 50% 50%; }
}

/* A photograph across the full width of the page. */
.banner img {
  display: block; width: 100%;
  height: clamp(12rem, 34vw, 26rem);
  object-fit: cover; object-position: 50% 58%;
}

.chart { display: block; width: 100%; max-width: 28rem; }
.chart .gridline line { stroke: var(--rule); stroke-width: 1; }
.chart .axis { fill: none; stroke: var(--ink-soft); stroke-width: 1; }
.chart .res line { stroke: var(--mark); stroke-width: 1; opacity: 0.4; }
.chart .fit { stroke: var(--accent); stroke-width: 2.25; stroke-linecap: round; }
.chart .pts circle { fill: var(--mark); }
.chart .stat { font-family: var(--font); font-weight: 300; font-size: 27px; fill: var(--ink); }
.chart .note,
.chart .axis-label { font-family: var(--font); font-size: 12.5px; letter-spacing: 0.04em; fill: var(--ink-soft); }
/* The drawing scales with its width, so its labels are set larger on a phone to stay legible. */
@media (max-width: 30rem) {
  .chart .note,
  .chart .axis-label { font-size: 17.5px; letter-spacing: 0.02em; }
}

/* Timetable: a small Gantt chart built from a list. 36 weeks across. */
.tt { list-style: none; padding: 0; display: grid; gap: 0.75rem; }
.tt li {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center;
  gap: 0.375rem 0.75rem;
  font-size: 0.9375rem;
}
.tt__label { font-weight: 600; }
.tt__wk { font-size: var(--t-small); color: var(--ink-soft); font-variant-numeric: lining-nums tabular-nums; }
.tt__track {
  grid-column: 1 / -1;
  display: block; height: 0.625rem;
  background:
    linear-gradient(to right, var(--rule) 1px, transparent 1px) 0 0 / 25% 100% repeat-x,
    linear-gradient(var(--rule), var(--rule)) 100% 0 / 1px 100% no-repeat;
}
.tt__bar {
  display: block; height: 100%;
  margin-left: calc(var(--a) / 36 * 100%);
  width: calc(var(--n) / 36 * 100%);
  background: var(--mark);
  border-radius: 1px;
}
.tt-1 { --a: 0;  --n: 3; }
.tt-2 { --a: 3;  --n: 6; }
.tt-3 { --a: 7;  --n: 7; }
.tt-4 { --a: 13; --n: 9; }
.tt-5 { --a: 21; --n: 5; }
.tt-6 { --a: 25; --n: 11; }
.tt__dot {
  display: block; width: 0.625rem; height: 0.625rem;
  margin-left: calc(100% - 0.3125rem);
  background: var(--accent);
  transform: rotate(45deg);
}
.tt__ticks { position: relative; height: 1.25rem; grid-column: 1 / -1; }
.tt__ticks span {
  position: absolute; top: 0;
  transform: translateX(-50%);
  font-size: 0.8125rem; color: var(--ink-soft);
  font-variant-numeric: lining-nums tabular-nums;
}
.tt__ticks .t0 { left: 0; transform: none; }
.tt__ticks .t9 { left: 25%; }
.tt__ticks .t18 { left: 50%; }
.tt__ticks .t27 { left: 75%; }
.tt__ticks .t36 { right: 0; transform: none; }
@media (min-width: 44rem) {
  .tt li { grid-template-columns: 14rem minmax(0, 1fr) 6.5rem; gap: 0 1.25rem; }
  .tt__label { grid-column: 1; grid-row: 1; }
  .tt__track { grid-column: 2; grid-row: 1; }
  .tt__wk { grid-column: 3; grid-row: 1; text-align: right; }
  .tt__ticks { grid-column: 2; }
}

/* ---------- Standing strip ---------------------------------------------- */

.standing { border-block: 1px solid var(--rule); background: var(--tint); }
.standing dl {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(13.5rem, 1fr));
  gap: 0 2.5rem;
}
.standing dl > div { padding-block: 1.25rem; }
.standing dt { font-weight: 600; }
.standing dd { font-size: var(--t-small); line-height: 1.45; color: var(--ink-soft); }

/* ---------- Sections ----------------------------------------------------- */

.section { padding-block: var(--section); }
.section + .section { border-top: 1px solid var(--rule); }
.standing + .section { border-top: 0; }
.section--surface { background: var(--tint); border-block: 1px solid var(--rule); }
.section--surface + .section { border-top: 0; }

.rail { display: grid; gap: 2rem; }
@media (min-width: 60rem) {
  .rail { grid-template-columns: minmax(0, 4fr) minmax(0, 8fr); gap: 4rem; }
}
.rail__head p { margin-top: 1rem; max-width: 26rem; color: var(--ink-soft); }

/* Ruled rows: a term on the left, its explanation on the right. */
.ledger > div {
  display: grid; gap: 0.375rem 2rem;
  padding-block: 1.375rem;
  border-top: 1px solid var(--rule);
}
.ledger > div:last-child { border-bottom: 1px solid var(--rule); }
@media (min-width: 44rem) {
  .ledger > div { grid-template-columns: 13.5rem minmax(0, 1fr); }
}
.ledger dt { font-weight: 600; }
.ledger dd { max-width: 38rem; }

/* Larger third-level headings: groups of services, stages, and the points under "How I work". */
.group > h3,
.tenets h3,
.stages h3 {
  font-size: 1.0625rem; font-weight: 400;
  line-height: 1.35; letter-spacing: 0.1em;
}

.group + .group { margin-top: 3rem; }
.group > h3 { margin-bottom: 1rem; }
.group > p { max-width: 40rem; }

.pairs { display: grid; gap: 2rem 3rem; list-style: none; padding: 0; }
@media (min-width: 40rem) { .pairs { grid-template-columns: 1fr 1fr; } }
.pairs h3 { margin-bottom: 0.5rem; }
.pairs p { color: var(--ink-soft); }

.note {
  max-width: 40rem;
  margin-top: 2.5rem; padding: 1.125rem 1.25rem;
  background: var(--tint);
  border-left: 3px solid var(--accent);
}

/* Two columns that fill downwards, so short and long items sit without gaps. */
.tenets { columns: 2 17rem; column-gap: 3rem; list-style: none; padding: 0; }
.tenets li { break-inside: avoid; padding-bottom: 2.25rem; }
.tenets h3 { margin-bottom: 0.5rem; }
.tenets p { max-width: 30rem; color: var(--ink-soft); }

/* Numbered steps: the numbers are real, the stages happen in this order. */
.process__head {
  display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between;
  gap: 1rem 3rem;
  margin-bottom: 2.5rem;
}
.process__head p { margin-top: 1rem; max-width: 34rem; color: var(--ink-soft); }
.steps { display: grid; gap: 0 3rem; list-style: none; padding: 0; counter-reset: step; }
@media (min-width: 40rem) { .steps { grid-template-columns: 1fr 1fr; } }
@media (min-width: 64rem) { .steps { grid-template-columns: repeat(3, 1fr); } }
.steps li {
  counter-increment: step;
  display: grid; grid-template-columns: 2.5rem minmax(0, 1fr); gap: 0.25rem 0.5rem;
  padding-block: 1.25rem 1.5rem;
  border-top: 1px solid var(--rule);
}
.steps li::before {
  content: counter(step);
  grid-row: 1 / span 2;
  font-weight: 300; font-size: 1.875rem; line-height: 1;
  color: var(--accent);
}
.steps h3, .steps p { grid-column: 2; }
.steps h3 { padding-top: 0.3125rem; }
.steps p { font-size: 0.9688rem; color: var(--ink-soft); }

.stages { list-style: none; padding: 0; counter-reset: stage; }
.stages > li {
  counter-increment: stage;
  display: grid; gap: 0.5rem 1.5rem;
  padding-block: 1.75rem;
  border-top: 1px solid var(--rule);
}
.stages > li:last-child { border-bottom: 1px solid var(--rule); }
@media (min-width: 44rem) {
  .stages > li { grid-template-columns: 3.5rem minmax(0, 1fr); }
}
.stages > li::before {
  content: counter(stage);
  font-weight: 300; font-size: 2.5rem; line-height: 1;
  color: var(--accent);
}
.stages h3 { padding-top: 0.375rem; }
.stages .when {
  margin-top: 0.25rem;
  font-size: var(--t-small);
  color: var(--ink-soft);
}
.stages p { max-width: 38rem; margin-top: 0.75rem; }
.stages .out { font-size: 0.9688rem; color: var(--ink-soft); }
.stages .out b { color: var(--ink); }

.ticks { list-style: none; padding: 0; }
.ticks li {
  position: relative;
  max-width: 44rem;
  padding: 0.875rem 0 0.875rem 1.625rem;
  border-top: 1px solid var(--rule);
}
.ticks li:last-child { border-bottom: 1px solid var(--rule); }
.ticks li::before {
  content: ""; position: absolute; left: 0; top: 1.4rem;
  width: 0.5rem; height: 0.5rem;
  background: var(--accent);
}

.qa > div { padding-block: 1.375rem; border-top: 1px solid var(--rule); }
.qa > div:last-child { border-bottom: 1px solid var(--rule); }
.qa dt { font-weight: 600; }
.qa dd { max-width: 38rem; margin-top: 0.375rem; }

.table-scroll { overflow-x: auto; }
.quals { width: 100%; border-collapse: collapse; }
.quals th, .quals td {
  padding: 0.875rem 1.25rem 0.875rem 0;
  border-top: 1px solid var(--rule);
  text-align: left; vertical-align: top;
}
.quals tbody tr:last-child th, .quals tbody tr:last-child td { border-bottom: 1px solid var(--rule); }
.quals thead th {
  padding-top: 0; border-top: 0;
  font-size: 0.8125rem; font-weight: 600; letter-spacing: 0.09em; text-transform: uppercase;
  color: var(--ink-soft);
}
.quals tbody th { font-weight: 600; }
.quals td { color: var(--ink-soft); }
.quals .yr { font-variant-numeric: lining-nums tabular-nums; white-space: nowrap; }

.prose { max-width: 40rem; }
.prose h2 {
  font-size: 1.0625rem; font-weight: 400; letter-spacing: 0.1em; line-height: 1.35;
  margin-top: 2.75rem; margin-bottom: 0.75rem;
}
.prose h2:first-child { margin-top: 0; }
.prose p + p, .prose ul + p, .prose p + ul { margin-top: 1rem; }
.prose ul { padding-left: 1.2rem; }
.prose li + li { margin-top: 0.375rem; }
.prose .dated { color: var(--ink-soft); font-size: var(--t-small); }
.tbc { border-bottom: 1px dashed currentColor; }
.stack > * + * { margin-top: 1rem; }
.aside { margin-top: 2.5rem; font-size: var(--t-small); color: var(--ink-soft); max-width: 38rem; }

/* ---------- Contact panel ------------------------------------------------ */

.contact { padding-block: var(--section); background: var(--tint); border-top: 1px solid var(--rule); }
.banner + .contact { border-top: 0; }
.contact .rail__head p { color: var(--ink-soft); }
.contact dl > div {
  display: grid; gap: 0.25rem 2rem;
  padding-block: 1.125rem;
  border-top: 1px solid var(--rule);
}
.contact dl > div:last-child { border-bottom: 1px solid var(--rule); }
@media (min-width: 36rem) {
  .contact dl > div { grid-template-columns: 8rem minmax(0, 1fr); align-items: baseline; }
}
.contact dt { font-size: var(--t-small); color: var(--ink-soft); }
.contact dd { font-size: 1.125rem; overflow-wrap: anywhere; }
.contact dd.big {
  font-weight: 300;
  font-size: clamp(1.375rem, 1rem + 1.8vw, 1.875rem); line-height: 1.25;
}

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

.site-footer {
  padding-block: 2.5rem 3rem;
  border-top: 1px solid var(--rule);
  font-size: var(--t-small); color: var(--ink-soft);
}
.site-footer__top {
  display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between;
  gap: 0.75rem 2rem;
  margin-bottom: 1.5rem; padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--rule);
}
.wordmark {
  font-size: 0.8125rem; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--ink);
}
.site-footer ul { display: flex; flex-wrap: wrap; gap: 0.125rem 1.5rem; list-style: none; padding: 0; }
.site-footer li a { display: inline-block; padding-block: 0.25rem; }
.site-footer p { max-width: 52rem; }
.site-footer p + p { margin-top: 0.75rem; }

@media print {
  .site-nav, .actions, .skip, .banner { display: none; }
  .contact, .standing, .section--surface { background: none; }
}
