/* ==========================================================================
   simonlegrand.co.uk
   Typefaces: Bricolage Grotesque for headlines and figures, DM Sans for text,
   IBM Plex Mono for dates and labels.
   One stylesheet for the whole site. Sections, in order:
   1 Tokens  2 Fonts  3 Base  4 Layout  5 Type  6 Links and actions
   7 Header and menu  8 Ledger patterns  9 Homepage sections  10 Footer
   11 Motion
   ========================================================================== */

/* 1 Tokens ---------------------------------------------------------------- */
:root {
  /* Palette from the brief */
  --ink: #11151B;
  --paper: #F3F0E8;
  --green: #C7D77C;      /* Signal Green. Small markers only */
  --slate: #63788C;
  --white: #FFFFFF;
  --stone: #D9D6CD;
  --graphite: #353B43;
  --sage: #A7A99B;
  --terracotta: #B66C4B;
  --soft: #E7E3DA;

  --rule: rgb(17 21 27 / 0.2);
  --rule-on-ink: rgb(243 240 232 / 0.2);

  --display: "Bricolage Grotesque", "DM Sans", system-ui, sans-serif;
  --sans: "DM Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;

  --t-display: clamp(2.1rem, 1rem + 3.5vw, 4.25rem);
  --t-h2: clamp(1.8rem, 1.3rem + 2.1vw, 3.1rem);
  --t-h3: clamp(1.4rem, 1.2rem + 0.9vw, 1.9rem);
  --t-figure: clamp(2.4rem, 1.2rem + 3.6vw, 4.6rem);
  --t-row: clamp(1.1rem, 1rem + 0.4vw, 1.3rem);
  --t-lede: clamp(1.125rem, 1.05rem + 0.35vw, 1.25rem);
  --t-body: clamp(1rem, 0.97rem + 0.15vw, 1.0625rem);
  --t-meta: 0.8125rem;

  --gutter: clamp(1.25rem, 4.5vw, 5rem);
  --col-gap: clamp(1rem, 2vw, 2rem);
  --section: clamp(4rem, 2.5rem + 6vw, 8rem);
  --header-h: 4rem;

  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
  --fast: 180ms;
}

/* 2 Fonts ----------------------------------------------------------------- */
@font-face { font-family: "Bricolage Grotesque"; src: url("/bricolage-grotesque-variable.woff2") format("woff2"); font-weight: 200 800; font-style: normal; font-display: swap; }
@font-face { font-family: "DM Sans"; src: url("/dm-sans-variable.woff2") format("woff2"); font-weight: 100 1000; font-style: normal; font-display: swap; }
@font-face { font-family: "IBM Plex Mono"; src: url("/ibm-plex-mono-regular.woff2") format("woff2"); font-weight: 400; font-style: normal; font-display: swap; }

/* 3 Base ------------------------------------------------------------------ */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--header-h) + 1rem); }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font-family: var(--sans); font-size: var(--t-body); line-height: 1.6;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
img, svg { display: block; max-width: 100%; }
img { height: auto; }
h1, h2, h3, p, ul, ol, dl, dd, figure, blockquote { margin: 0; }
h1, h2, h3 { font-size: inherit; font-weight: 400; }
ul, ol { padding: 0; list-style: none; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
a { color: inherit; }
:focus-visible { outline: 2px solid currentColor; outline-offset: 4px; }
::selection { background: var(--ink); color: var(--paper); }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.skip-link { position: fixed; top: 0.5rem; left: 0.5rem; z-index: 100; padding: 0.75rem 1rem; background: var(--ink); color: var(--paper); transform: translateY(-200%); }
.skip-link:focus { transform: none; }

/* 4 Layout ---------------------------------------------------------------- */
.wrap { max-width: 100rem; margin-inline: auto; padding-inline: var(--gutter); }
.grid { display: grid; grid-template-columns: minmax(0, 1fr); column-gap: var(--col-gap); }
@media (min-width: 56rem) { .grid { grid-template-columns: repeat(12, minmax(0, 1fr)); } }
.section { padding-block: var(--section); }
.section--soft { background: var(--soft); }
.section--ink { background: var(--ink); color: var(--paper); }

/* Every section opens the same way: a heading on the left, a short
   introduction on the right, and a full rule beneath. */
.head { row-gap: 1rem; align-items: end; padding-bottom: clamp(1.5rem, 3vw, 2.5rem); border-bottom: 1px solid var(--ink); }
.section--ink .head { border-color: var(--paper); }
@media (min-width: 56rem) {
  .head__title { grid-column: 1 / span 7; }
  .head__intro { grid-column: 9 / span 4; }
}

/* 5 Type ------------------------------------------------------------------ */
.display, .h2, .h3 { font-family: var(--display); font-weight: 500; text-wrap: balance; }
.display { font-size: var(--t-display); line-height: 1.02; letter-spacing: -0.03em; }
.h2 { font-size: var(--t-h2); line-height: 1.06; letter-spacing: -0.03em; }
.h3 { font-size: var(--t-h3); line-height: 1.12; letter-spacing: -0.025em; }
.lede { font-size: var(--t-lede); line-height: 1.5; max-width: 33em; }
.prose { max-width: 36em; }
.prose > * + * { margin-top: 1em; }
.meta { font-family: var(--mono); font-size: var(--t-meta); line-height: 1.5; letter-spacing: 0.01em; color: var(--graphite); }
.section--ink .meta { color: var(--sage); }
/* The one small use of Signal Green: a marker beside a source or status */
.mark::before { content: ""; display: inline-block; width: 0.55rem; height: 0.55rem; margin-right: 0.5rem; background: var(--green); outline: 1px solid var(--ink); }
.section--ink .mark::before { outline: 0; }

/* 6 Links and actions ----------------------------------------------------- */
.link { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 0.28em; transition: background-color var(--fast), color var(--fast); }
.link:hover { background: var(--ink); color: var(--paper); text-decoration-color: transparent; }
.section--ink .link:hover { background: var(--paper); color: var(--ink); }
.action { display: inline-block; padding: 0.9rem 1.3rem; border: 1px solid var(--ink); font-weight: 500; line-height: 1.2; text-decoration: none; transition: background-color var(--fast), color var(--fast); }
.action--primary { background: var(--ink); color: var(--paper); }
.action--primary:hover { background: transparent; color: var(--ink); }
.action--quiet:hover { background: var(--ink); color: var(--paper); }
.actions { display: flex; flex-wrap: wrap; gap: 0.75rem; }

/* 7 Header and menu ------------------------------------------------------- */
.site-header {
  position: fixed; inset: 0 0 auto 0; z-index: 50; height: var(--header-h);
  display: flex; align-items: center; justify-content: space-between; padding-inline: var(--gutter);
  background: var(--paper); color: var(--ink); border-bottom: 1px solid transparent;
  transition: background-color var(--fast), color var(--fast), border-color var(--fast);
}
.site-header.is-scrolled { border-color: var(--rule); }
.site-header.is-menu-open { border-color: var(--ink); }
.wordmark { font-family: var(--display); font-weight: 500; font-size: 1.25rem; line-height: 1; text-decoration: none; letter-spacing: -0.02em; }
.menu-toggle, .menu-fallback { display: inline-flex; align-items: center; gap: 0.75rem; min-height: 2.75rem; padding-inline: 0.25rem; font-family: var(--mono); font-size: var(--t-meta); text-decoration: none; }
.menu-toggle__bars { position: relative; width: 1.75rem; height: 0.5rem; }
.menu-toggle__bars::before, .menu-toggle__bars::after { content: ""; position: absolute; left: 0; right: 0; height: 1px; background: currentColor; transition: transform 260ms var(--ease); }
.menu-toggle__bars::before { top: 0; }
.menu-toggle__bars::after { bottom: 0; }
.menu-toggle:hover .menu-toggle__bars::before { transform: translateX(-0.25rem); }
.menu-toggle:hover .menu-toggle__bars::after { transform: translateX(0.25rem); }
.menu-toggle[aria-expanded="true"] .menu-toggle__bars::before { transform: translateY(0.22rem) rotate(18deg); }
.menu-toggle[aria-expanded="true"] .menu-toggle__bars::after { transform: translateY(-0.22rem) rotate(-18deg); }
html:not(.js) .menu-toggle, .js .menu-fallback { display: none; }

.menu {
  position: fixed; inset: 0; z-index: 40; overflow-y: auto;
  padding: calc(var(--header-h) + clamp(1.5rem, 5vh, 3.5rem)) var(--gutter) 2rem;
  background: var(--paper); color: var(--ink);
  display: flex; flex-direction: column; justify-content: space-between; gap: 3rem;
  visibility: hidden; opacity: 0; transition: opacity 280ms var(--ease), visibility 0s linear 280ms;
}
.menu.is-open { visibility: visible; opacity: 1; transition-delay: 0s; }
html:not(.js) .menu { display: none; }
.menu-open { overflow: hidden; }
/* The menu is one more ledger: the page's sections, in page order */
.menu__list { border-top: 1px solid var(--ink); }
.menu__item { border-bottom: 1px solid var(--rule); }
.menu__link { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0.25rem; align-items: baseline; padding-block: clamp(0.8rem, 1.8vh, 1.1rem); text-decoration: none; }
.menu__name { font-family: var(--display); font-size: var(--t-h3); line-height: 1.12; letter-spacing: -0.025em; transition: transform 320ms var(--ease); }
.menu__note { font-family: var(--mono); font-size: var(--t-meta); color: var(--graphite); }
.menu__link:hover .menu__name, .menu__link:focus-visible .menu__name { transform: translateX(0.75rem); }
.menu__foot { display: flex; flex-wrap: wrap; gap: 0.5rem 2rem; font-family: var(--mono); font-size: var(--t-meta); }
.menu__foot a { text-underline-offset: 0.28em; }
@media (min-width: 56rem) { .menu__link { grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); gap: var(--col-gap); } }

/* 8 Ledger patterns -------------------------------------------------------- */
/* Figures: a large number or phrase, what it counts, and where it comes from */
.figures { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); border-top: 1px solid var(--ink); }
.figures li { padding: 1rem 1rem 1.4rem 0; border-bottom: 1px solid var(--rule); }
.figures li:nth-child(even) { padding-left: 1rem; border-left: 1px solid var(--rule); }
.figures b { display: block; font-family: var(--display); font-weight: 500; font-size: var(--t-figure); line-height: 0.95; letter-spacing: -0.02em; white-space: nowrap; }
.figures span { display: block; margin-top: 0.5rem; line-height: 1.35; }
.figures small { display: block; margin-top: 0.5rem; }
@media (min-width: 56rem) {
  .figures { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .figures li { padding: 1.1rem 1.5rem 1.75rem 0; border-bottom: 0; border-left: 0; }
  .figures li + li { padding-left: 1.5rem; border-left: 1px solid var(--rule); }
}

/* Rows: a dated or labelled line in a list of facts */
.rows li { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 0.15rem 1.5rem; align-items: baseline; padding-block: 0.65rem; border-bottom: 1px solid var(--rule); break-inside: avoid; }
.rows small { display: block; font-size: 0.9375rem; line-height: 1.45; color: var(--graphite); }
.rows .meta { white-space: nowrap; }
.rows--large .rows__what { font-family: var(--display); font-size: var(--t-row); line-height: 1.15; }
.rows--large small { font-family: var(--sans); margin-top: 0.3rem; max-width: 36em; }
@media (min-width: 56rem) { .rows--cols { columns: 2; column-gap: var(--col-gap); } }

/* Facts: label and value pairs beside a story */
.facts { border-top: 1px solid currentColor; }
.facts div { display: grid; grid-template-columns: 7.5rem minmax(0, 1fr); gap: 1rem; padding-block: 0.6rem; border-bottom: 1px solid var(--rule); }
.section--ink .facts div { border-color: var(--rule-on-ink); }
.facts dd { line-height: 1.4; }
.facts dd b { font-family: var(--display); font-weight: 400; font-size: var(--t-row); line-height: 1.1; }

/* 9 Homepage sections ------------------------------------------------------ */

/* Hero */
.hero { padding-top: calc(var(--header-h) + clamp(1.5rem, 4vh, 3rem)); }
.hero__role { margin-bottom: 1.25rem; }
.hero__lede { margin-top: 1.5rem; }
.hero .actions { margin-top: 1.75rem; }
.hero__portrait { margin-top: 2.5rem; max-width: 18rem; }
.hero__portrait img { width: 100%; aspect-ratio: 4 / 5; object-fit: cover; }
.hero__portrait figcaption { margin-top: 0.6rem; }
.hero .figures { margin-top: 2.5rem; }
@media (min-width: 56rem) {
  .hero__grid { min-height: calc(100svh - var(--header-h) - clamp(1.5rem, 4vh, 3rem)); align-content: space-between; row-gap: 2.5rem; }
  .hero__text { grid-column: 1 / span 8; }
  .hero__portrait { grid-column: 10 / span 3; grid-row: 1; margin-top: 0; max-width: none; }
  .hero .figures { grid-column: 1 / -1; margin-top: 0; }
}

/* How I think */
.think { padding-block: var(--section); }
.think__body { margin-top: 2rem; }
@media (min-width: 56rem) {
  .think__statement { grid-column: 1 / span 7; }
  .think__body { grid-column: 9 / span 4; margin-top: 0.5rem; }
}

/* Ventures */
.story { padding-block: clamp(2.5rem, 5vw, 4.5rem); row-gap: 2rem; border-bottom: 1px solid var(--rule); }
.story:last-child { border-bottom: 0; padding-bottom: 0; }
.story__label { margin-bottom: 0.75rem; }
.story .prose { margin-top: 1.25rem; }
.story .link { display: inline-block; margin-top: 1.25rem; }
@media (min-width: 56rem) {
  .story__text { grid-column: 1 / span 6; }
  .story__facts { grid-column: 8 / span 5; }
}
.sunstone { padding-block: var(--section); }
.sunstone__grid { row-gap: 2.5rem; }
.sunstone__figure b { display: block; font-family: var(--display); font-weight: 400; font-size: clamp(8rem, 26vw, 22rem); line-height: 0.78; letter-spacing: -0.04em; }
.sunstone__figure span { display: block; margin-top: 1.25rem; max-width: 22em; font-size: var(--t-lede); line-height: 1.4; }
.sunstone .prose { margin-top: 1.25rem; color: rgb(243 240 232 / 0.88); }
.sunstone .facts { margin-top: 2.5rem; }
.quote { margin-top: clamp(3rem, 6vw, 5rem); padding-top: 1.5rem; border-top: 1px solid var(--rule-on-ink); row-gap: 1rem; }
.quote blockquote p { font-family: var(--display); font-size: var(--t-h3); line-height: 1.2; text-wrap: pretty; }
@media (min-width: 56rem) {
  .sunstone__figure { grid-column: 1 / span 6; align-self: end; }
  .sunstone__text { grid-column: 8 / span 5; }
  .quote blockquote { grid-column: 1 / span 9; }
  .quote footer { grid-column: 10 / span 3; align-self: end; }
}

.middle { display: grid; grid-template-columns: minmax(0, 1fr); border: 1px solid var(--ink); margin-top: 0.5rem; }
.middle > div { padding: 0.9rem 1rem; min-height: 5rem; display: flex; flex-direction: column; justify-content: space-between; gap: 0.75rem; border-bottom: 1px solid var(--ink); }
.middle > div:last-child { border-bottom: 0; }
.middle strong { font-family: var(--display); font-weight: 400; font-size: 1.4rem; line-height: 1.1; }
.middle .middle__gap { background: var(--ink); color: var(--paper); }
.middle__gap .meta { color: var(--sage); }
/* Three across when there is room: on tablets, and again on wide screens
   where the diagram sits in a five-column slot */
@media (min-width: 40rem) and (max-width: 55.99rem), (min-width: 76rem) {
  .middle { grid-template-columns: 3fr 4fr 3fr; }
  .middle > div { min-height: 8rem; border-bottom: 0; border-right: 1px solid var(--ink); }
  .middle > div:last-child { border-right: 0; }
}

/* Journey: a chart of the four periods, then the chapters as rows */
.chart { display: none; }
@media (min-width: 56rem) {
  .chart { display: block; position: relative; height: 14.5rem; margin-top: 2.5rem; }
  .chart__axis { position: absolute; inset: auto 0 1.75rem 0; height: 1px; background: var(--ink); }
  .chart__axis i { position: absolute; top: 0; width: 1px; height: 0.4rem; background: var(--graphite); }
  .chart__axis i.is-major { height: 0.8rem; background: var(--ink); }
  .chart__axis span { position: absolute; top: 1.1rem; left: -0.1rem; font: normal var(--t-meta) var(--mono); color: var(--graphite); }
  .chart__bar { position: absolute; height: 2.25rem; padding: 0.4rem 0.75rem; display: flex; gap: 0.9rem; align-items: baseline; white-space: nowrap; background: var(--stone); }
  .chart__bar b { font-family: var(--display); font-weight: 400; font-size: 1.3rem; line-height: 1.1; }
  .chart__bar span { display: none; font-size: 0.875rem; }
  .chart__bar--ink { background: var(--ink); color: var(--paper); }
  .chart__bar--slate { background: var(--graphite); color: var(--paper); }
  .chart__bar--now { background: var(--green); outline: 1px solid var(--ink); padding: 0; }
  .chart__bar--now b { position: absolute; right: calc(100% + 0.75rem); top: 0.4rem; }
}
.chapters { margin-top: 2.5rem; border-top: 1px solid var(--ink); }
.chapters li { display: grid; grid-template-columns: 4rem minmax(0, 1fr); gap: 0.25rem 1rem; padding-block: 1rem; border-bottom: 1px solid var(--rule); align-items: baseline; }
.chapters h3 { font-family: var(--display); font-size: var(--t-row); line-height: 1.15; }
.chapters p:last-child { grid-column: 2; max-width: 40em; color: var(--graphite); }
@media (min-width: 56rem) {
  .chapters li { grid-template-columns: repeat(12, minmax(0, 1fr)); column-gap: var(--col-gap); }
  .chapters .meta { grid-column: 1 / span 1; }
  .chapters h3 { grid-column: 2 / span 4; }
  .chapters p:last-child { grid-column: 6 / span 7; }
}

@media (min-width: 76rem) { .chart__bar span { display: inline; } }

/* Record */
.record__group { padding-block: 1.25rem 2.5rem; row-gap: 0.5rem; border-bottom: 1px solid var(--ink); }
.record__group:last-child { border-bottom: 0; padding-bottom: 0; }
@media (min-width: 56rem) {
  .record__label { grid-column: 1 / span 2; padding-top: 0.75rem; }
  .record__group .rows { grid-column: 3 / -1; }
}

/* Idea Observatory: each question is marked against the two themes it crosses */
.cross { margin-top: 0; width: 100%; border-collapse: collapse; }
.cross th, .cross td { padding: 0.9rem 0.5rem; border-bottom: 1px solid var(--rule); text-align: left; vertical-align: middle; font-weight: 400; }
.cross thead th { vertical-align: bottom; padding-bottom: 0.75rem; border-bottom: 1px solid var(--ink); }
.cross th[scope="row"] { padding-left: 0; font-family: var(--display); font-size: var(--t-row); line-height: 1.15; text-wrap: balance; }
.cross th[scope="row"] .meta { display: block; margin-top: 0.4rem; font-family: var(--mono); }
.cross .theme { display: none; }
@media (min-width: 56rem) {
  .cross .theme { display: table-cell; width: 9.5%; text-align: center; }
  .cross thead .theme { text-align: left; }
  .cross th[scope="row"] .meta { display: none; }
  .cross td.theme { border-left: 1px solid var(--rule); }
  .cross .dot { display: inline-block; width: 0.8rem; height: 0.8rem; border-radius: 50%; background: var(--ink); }
}
.obs__note { margin-top: 1.5rem; }

/* Journal */
.journal__lead { padding-block: 1.5rem 2.5rem; border-bottom: 1px solid var(--ink); row-gap: 1rem; }
.journal__lead a { font-family: var(--display); font-size: var(--t-h2); line-height: 1.04; letter-spacing: -0.01em; text-decoration: none; text-wrap: balance; }
.journal__lead a:hover, .pieces a:hover { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 0.18em; }
.pieces li { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0.2rem 1.5rem; padding-block: 1rem; border-bottom: 1px solid var(--rule); align-items: baseline; }
.pieces a { font-family: var(--display); font-size: var(--t-row); line-height: 1.15; text-decoration: none; }
.pieces p:last-child { color: var(--graphite); }
@media (min-width: 56rem) {
  .journal__lead h3 { grid-column: 1 / span 7; }
  .journal__lead div { grid-column: 9 / span 4; align-self: end; }
  .pieces li { grid-template-columns: repeat(12, minmax(0, 1fr)); column-gap: var(--col-gap); }
  .pieces .meta { grid-column: 1 / span 2; }
  .pieces h3 { grid-column: 3 / span 5; }
  .pieces p:last-child { grid-column: 8 / span 5; }
}

/* Closing */
.close__body { margin-top: 2rem; }
.close__links { margin-top: 2rem; border-top: 1px solid var(--paper); }
.close__links a { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 0.25rem 1.5rem; padding: 1rem 0; border-bottom: 1px solid var(--rule-on-ink); text-decoration: none; transition: background-color var(--fast), color var(--fast), padding var(--fast); }
.close__links .name { font-family: var(--display); font-size: var(--t-h3); line-height: 1.1; }
.close__links a:hover, .close__links a:focus-visible { background: var(--paper); color: var(--ink); padding-inline: 1rem; }
.close__links a:hover .meta, .close__links a:focus-visible .meta { color: var(--ink); }
@media (min-width: 56rem) {
  .close__title { grid-column: 1 / span 8; }
  .close__body { grid-column: 7 / span 6; margin-top: clamp(2.5rem, 5vw, 4.5rem); }
}

/* Display face settings shared by the smaller headline-style elements */
.menu__name, .figures b, .sunstone__figure b, .journal__lead a, .close__links .name { font-weight: 500; letter-spacing: -0.03em; }
.sunstone__figure b { letter-spacing: -0.06em; }
.rows--large .rows__what, .facts dd b, .chapters h3, .cross th[scope="row"], .pieces a, .quote blockquote p, .chart__bar b, .middle strong { font-weight: 500; letter-spacing: -0.015em; }
.quote blockquote p { line-height: 1.25; }

/* 10 Footer ---------------------------------------------------------------- */
.site-footer { background: var(--ink); color: var(--sage); padding-block: 2rem 2.5rem; border-top: 1px solid var(--rule-on-ink); font-family: var(--mono); font-size: var(--t-meta); }
.site-footer .wrap { display: flex; flex-wrap: wrap; gap: 1rem 2.5rem; justify-content: space-between; align-items: baseline; }
.site-footer nav ul { display: flex; flex-wrap: wrap; gap: 0.25rem 1.5rem; }
.site-footer a { display: inline-block; padding-block: 0.6rem; color: var(--paper); text-decoration: none; }
.site-footer a:hover { text-decoration: underline; text-underline-offset: 0.28em; }

/* 11 Motion ---------------------------------------------------------------- */
/* Nothing moves on its own. Transitions answer hover, focus and the menu. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
}
