/* ==========================================================================
   jamet.co — Tommy Jamet
   Aesthetic: "audit trail" — a well-set annual report. Warm paper, hairline
   ledger rules, marginalia numbering, tabular figures. Restraint is the point.
   ========================================================================== */

/* ── Fonts ─────────────────────────────────────────────────────────────────
   Newsreader, SELF-HOSTED. The files are served from this repo and Google's
   CDN is never contacted by a visitor — fonts.gstatic.com logs visitor IPs
   in the US, which is a GDPR liability and pointedly off-brand for a site
   about EU data residency.

   Two static instances (400, 500) rather than the variable font. The
   variable file carries optical-size and weight axes and costs 129kB;
   narrowing the axis range does not shrink it, because Google serves the
   same file. These two are 45kB combined and cover every weight in use.

   Latin subset only — it covers the whole page (é in "Société", £, the
   em/en dashes). The ↗ glyph is outside it and falls back to the system
   serif, which is imperceptible at that size.
   ---------------------------------------------------------------------- */
@font-face {
  font-family: "Newsreader";
  src: url("/assets/fonts/newsreader-400.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;   /* never block render on a font */
}
@font-face {
  font-family: "Newsreader";
  src: url("/assets/fonts/newsreader-500.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

/* ── Tokens ─────────────────────────────────────────────────────────────── */
:root {
  /* Paper & ink */
  --paper:        #FBFAF8;
  --paper-raised: #FFFFFF;
  --ink:          #14161A;
  --ink-muted:    #565C66;
  /* Carries real content (dates, section labels, contact labels), so it has
     to clear WCAG AA 4.5:1 as small text — not just look quiet. 4.86:1. */
  --ink-faint:    #686F79;
  --rule:         #E6E2DB;
  --rule-strong:  #CFCAC1;

  /* Single accent, used sparingly */
  --navy:         #1F3A5F;
  --navy-hover:   #2E5183;
  --navy-ink:     #FFFFFF;

  --focus:        #1F3A5F;

  /* Type */
  --serif: "Newsreader", ui-serif, "New York", "Iowan Old Style", Georgia, serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;

  /* Fluid scale */
  --t-name:    clamp(2.75rem, 1.6rem + 5.2vw, 5.75rem);
  --t-title:   clamp(1.0625rem, 0.95rem + 0.55vw, 1.3125rem);
  --t-lede:    clamp(1.1875rem, 1.02rem + 0.8vw, 1.5rem);
  --t-h2:      clamp(1.625rem, 1.35rem + 1.3vw, 2.375rem);
  --t-h3:      clamp(1.1875rem, 1.08rem + 0.5vw, 1.4375rem);
  --t-body:    clamp(1rem, 0.97rem + 0.15vw, 1.0625rem);
  --t-small:   0.8125rem;
  --t-marker:  0.6875rem;

  /* Rhythm — the page is one centred document, not a full-width app.
     Container ≈ margin column + gutter + a single comfortable measure, so
     there is no dead space hanging off the right. */
  --container: 58rem;
  --measure:   62ch;
  --gutter:    clamp(1.5rem, 3.5vw, 3rem);
  --pad-x:     clamp(1.25rem, 5vw, 3rem);
  --sec-y:     clamp(3.5rem, 7vw, 6.5rem);
  --margin-col: 7rem;

  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper:        #101215;
    --paper-raised: #171A1F;
    --ink:          #E9E7E2;
    --ink-muted:    #9AA1AA;
    --ink-faint:    #7D848E;   /* AA on dark paper: 4.97:1 */
    --rule:         #24282E;
    --rule-strong:  #363C44;

    --navy:         #9CC0EA;   /* lifted for AA contrast on dark paper */
    --navy-hover:   #C2D9F5;
    --navy-ink:     #0C1520;

    --focus:        #9CC0EA;
  }
}

/* ── Reset ──────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }

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

body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: var(--t-body);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  font-variant-numeric: oldstyle-nums;
}

/* Every figure on this page is tabular — a finance-typography tell. */
.num, .role__years, .marker__num, time {
  font-variant-numeric: tabular-nums lining-nums;
  font-feature-settings: "tnum" 1, "lnum" 1;
}

img { max-width: 100%; display: block; }

a { color: inherit; }

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

::selection {
  background: var(--navy);
  color: var(--navy-ink);
}

.skip {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 100;
  background: var(--navy);
  color: var(--navy-ink);
  padding: 0.75rem 1.25rem;
  font-size: var(--t-small);
  text-decoration: none;
}
.skip:focus {
  left: 0.5rem;
  top: 0.5rem;
}

.nowrap { white-space: nowrap; }

/* ── Nav ────────────────────────────────────────────────────────────────── */
.nav {
  position: sticky;
  top: 0;
  z-index: 50;
  /* positioning context for the reading-progress hairline */
  isolation: isolate;
  background: color-mix(in srgb, var(--paper) 82%, transparent);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid transparent;
  transition: border-color 0.3s var(--ease);
}
.nav.is-stuck { border-bottom-color: var(--rule); }

.nav__inner {
  max-width: var(--container);
  margin-inline: auto;
  padding: 0.875rem var(--pad-x);
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.nav__mark {
  text-decoration: none;
  font-family: var(--serif);
  font-size: 1.0625rem;
  font-weight: 500;
  letter-spacing: 0.01em;
  margin-right: auto;
  white-space: nowrap;
}
.nav__mark-name { border-bottom: 1px solid transparent; transition: border-color 0.2s var(--ease); }
.nav__mark:hover .nav__mark-name { border-bottom-color: var(--rule-strong); }

.nav__links {
  display: flex;
  gap: clamp(1rem, 2.2vw, 2rem);
  font-size: var(--t-small);
  letter-spacing: 0.01em;
}
.nav__links a {
  color: var(--ink-muted);
  text-decoration: none;
  padding-block: 0.25rem;
  position: relative;
  transition: color 0.2s var(--ease);
}
/* Underline grows from the left on hover — same gesture as the ruled lines. */
.nav__links a::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 1px;
  background: var(--rule-strong);
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform 0.3s var(--ease), background 0.2s var(--ease);
}
.nav__links a:hover { color: var(--ink); }
.nav__links a:hover::after { transform: scaleX(1); }
.nav__links a.is-active { color: var(--ink); }
.nav__links a.is-active::after { transform: scaleX(1); background: var(--navy); }

@media (max-width: 46rem) {
  .nav__links { display: none; }
}

/* ── Buttons & links ────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--sans);
  font-size: var(--t-small);
  font-weight: 500;
  letter-spacing: 0.01em;
  text-decoration: none;
  padding: 0.6rem 1.05rem;
  border-radius: 3px;
  white-space: nowrap;
  transition: background 0.2s var(--ease), transform 0.2s var(--ease);
}
.btn--solid {
  background: var(--navy);
  color: var(--navy-ink);
}
.btn--solid:hover { background: var(--navy-hover); }
.btn--solid:active { transform: translateY(1px); }

.btn__arrow { transition: transform 0.25s var(--ease); }
.btn:hover .btn__arrow { transform: translateX(3px); }

.link {
  color: var(--ink-muted);
  text-decoration: none;
  border-bottom: 1px solid var(--rule-strong);
  padding-bottom: 1px;
  transition: color 0.2s var(--ease), border-color 0.2s var(--ease);
}
.link:hover { color: var(--ink); border-bottom-color: var(--navy); }

.sep {
  color: var(--ink-faint);
  margin-inline: 0.4em;
}

/* ── Shared grid ────────────────────────────────────────────────────────
   Marginalia column + content column. The hero uses the same grid as every
   section so the whole page hangs off one left edge. */
.grid {
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: var(--pad-x);
  display: grid;
  grid-template-columns: var(--margin-col) minmax(0, 1fr);
  gap: var(--gutter);
}

@media (max-width: 56rem) {
  .grid {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }
}

/* ── Hero ───────────────────────────────────────────────────────────────── */
.hero {
  padding-block: clamp(3.5rem, 9vw, 7rem) clamp(3rem, 7vw, 5.5rem);
}
.hero__inner {
  min-width: 0;
  display: flex;
  align-items: flex-start;
  gap: clamp(2rem, 4vw, 3.25rem);
}
.hero__text { min-width: 0; flex: 1; }

/* A letter opens the page: small serif line, completed by the masthead. */
.hero__greeting {
  font-family: var(--serif);
  font-style: italic;
  font-size: clamp(1.0625rem, 1rem + 0.35vw, 1.25rem);
  color: var(--ink-muted);
  margin-bottom: 0.9rem;
}

/* Portrait, mounted like a print: hairline frame, paper mat, mono-quiet. */
.hero__portrait {
  flex: 0 0 clamp(10rem, 15vw, 13rem);
  margin: 0.75rem 0 0;
  padding: 0.4rem;
  background: var(--paper-raised);
  border: 1px solid var(--rule-strong);
}
.hero__portrait img {
  width: 100%;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  display: block;
}
@media (max-width: 56rem) {
  .hero__inner { display: block; }
  .hero__portrait { width: 9.5rem; margin-top: 2rem; }
}

.eyebrow {
  font-family: var(--mono);
  font-size: var(--t-marker);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--ink-faint);
  display: flex;
  align-items: center;
  gap: 0.55rem;
  margin-bottom: 1.75rem;
}
.dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--navy);
  flex: none;
}

.hero__name {
  font-family: var(--serif);
  font-size: var(--t-name);
  font-weight: 400;
  line-height: 0.94;
  letter-spacing: -0.021em;
  margin-bottom: 1.5rem;
}

.hero__title {
  font-size: var(--t-title);
  color: var(--ink);
  line-height: 1.5;
  font-weight: 450;
  letter-spacing: 0.002em;
  padding-bottom: 1.5rem;
  margin-bottom: 1.5rem;
  border-bottom: 1px solid var(--rule);
  max-width: 40rem;

  display: flex;
  flex-wrap: wrap;
  column-gap: 0.85em;
  row-gap: 0.15em;
}
/* Separator rides with the claim it introduces, so it never ends a line. */
.hero__title > span + span::before {
  content: "·";
  color: var(--ink-faint);
  margin-right: 0.85em;
}

.hero__lede {
  font-family: var(--serif);
  font-size: var(--t-lede);
  line-height: 1.5;
  font-weight: 400;
  letter-spacing: -0.004em;
  color: var(--ink);
  max-width: 34ch;
  margin-bottom: 1.25rem;
  text-wrap: pretty;
}
@supports (text-wrap: balance) {
  .hero__lede { max-width: 38ch; }
}

.hero__sub {
  font-size: var(--t-small);
  color: var(--ink-muted);
  line-height: 1.65;
  max-width: 44ch;
  margin-bottom: 2.25rem;
}

.hero__cta {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  flex-wrap: wrap;
}
.hero__cta-secondary {
  font-size: var(--t-small);
  color: var(--ink-muted);
  display: inline-flex;
  align-items: center;
}

/* ── Section shell (marginalia grid) ────────────────────────────────────── */
.section {
  padding-block: var(--sec-y);
  border-top: 1px solid var(--rule);
  position: relative;
}

.section__margin { position: relative; }

.marker {
  position: sticky;
  top: 5.5rem;
  font-family: var(--mono);
  font-size: var(--t-marker);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--ink-faint);
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  line-height: 1.4;
}
.marker__num { color: var(--navy); }

.section__body { min-width: 0; }

.section__title {
  font-family: var(--serif);
  font-size: var(--t-h2);
  font-weight: 400;
  line-height: 1.14;
  letter-spacing: -0.014em;
  margin-bottom: 1rem;
  max-width: 22ch;
  text-wrap: balance;
}

.section__intro {
  font-size: var(--t-body);
  color: var(--ink-muted);
  max-width: 52ch;
  margin-bottom: 2.75rem;
  line-height: 1.6;
}

@media (max-width: 56rem) {
  .marker {
    position: static;
    flex-direction: row;
    gap: 0.7rem;
    align-items: baseline;
  }
}

/* ── Ledger entries (products + roles) ──────────────────────────────────── */
.ledger {
  list-style: none;
  padding: 0;
  margin: 0;
}

/* Track record has no intro line, so the title would otherwise crowd its
   first entry. Only applies when the ledger follows the title directly. */
.section__title + .ledger { margin-top: 2.5rem; }

.entry, .role {
  padding-block: 1.75rem;
  border-top: 1px solid var(--rule);
}
.entry:first-child, .role:first-child { border-top: 0; padding-top: 0; }
.entry:last-child, .role:last-child { padding-bottom: 0; }

/* Constrained to the measure so the meta sits at the right edge of the text
   column — not stranded against the container edge. */
.entry__head, .role__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.6rem;
  max-width: var(--measure);
}

.entry__name, .role__name {
  font-family: var(--serif);
  font-size: var(--t-h3);
  font-weight: 500;
  letter-spacing: -0.008em;
  line-height: 1.25;
}

.role__title {
  font-weight: 400;
  color: var(--ink-muted);
}

.entry__link {
  text-decoration: none;
  display: inline-flex;
  align-items: baseline;
  gap: 0.35rem;
  border-bottom: 1px solid transparent;
  transition: color 0.2s var(--ease), border-color 0.2s var(--ease);
}
.entry__link:hover {
  color: var(--navy);
  border-bottom-color: var(--navy);
}
.entry__arrow {
  font-size: 0.75em;
  color: var(--ink-faint);
  transition: transform 0.25s var(--ease), color 0.2s var(--ease);
}
.entry__link:hover .entry__arrow,
.contact__value:hover .entry__arrow {
  color: var(--navy);
  transform: translate(2px, -2px);
}

.entry__meta, .role__years {
  font-family: var(--mono);
  font-size: var(--t-marker);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--ink-faint);
  white-space: nowrap;
  flex: none;
}

.entry__body, .role__body {
  color: var(--ink-muted);
  max-width: var(--measure);
  line-height: 1.65;
  text-wrap: pretty;
}

@media (max-width: 34rem) {
  .entry__head, .role__head {
    flex-direction: column;
    gap: 0.3rem;
  }
}

/* ── Prose ──────────────────────────────────────────────────────────────── */
.prose {
  font-family: var(--serif);
  font-size: clamp(1.0625rem, 1rem + 0.4vw, 1.25rem);
  line-height: 1.68;
  color: var(--ink);
  max-width: 58ch;
  text-wrap: pretty;
}
.prose--tight {
  font-size: var(--t-body);
  font-family: var(--sans);
  color: var(--ink-muted);
  margin-bottom: 2.5rem;
}

/* An annual-report cue — quiet, not decorative. */
.dropcap {
  float: left;
  font-family: var(--serif);
  font-size: 3.1em;
  line-height: 0.82;
  font-weight: 400;
  padding-right: 0.09em;
  margin-top: 0.05em;
  color: var(--navy);
}
@media (max-width: 34rem) {
  .dropcap { font-size: 2.6em; }
}

/* ── Contact ────────────────────────────────────────────────────────────── */
.contact {
  list-style: none;
  padding: 0;
  margin: 0;
  max-width: 34rem;
}
.contact__row {
  display: grid;
  grid-template-columns: 6rem 1fr;
  gap: 1rem;
  align-items: baseline;
  padding-block: 1rem;
  border-top: 1px solid var(--rule);
}
.contact__row:last-child { border-bottom: 1px solid var(--rule); }

.contact__label {
  font-family: var(--mono);
  font-size: var(--t-marker);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--ink-faint);
}
.contact__value {
  text-decoration: none;
  color: var(--ink);
  display: inline-flex;
  align-items: baseline;
  gap: 0.4rem;
  border-bottom: 1px solid transparent;
  transition: color 0.2s var(--ease), border-color 0.2s var(--ease);
  justify-self: start;
  overflow-wrap: anywhere;
}
.contact__value:hover {
  color: var(--navy);
  border-bottom-color: var(--navy);
}

@media (max-width: 34rem) {
  .contact__row { grid-template-columns: 1fr; gap: 0.25rem; }
}

.section--last { padding-bottom: clamp(4rem, 8vw, 7rem); }

/* ── Footer ─────────────────────────────────────────────────────────────── */
.footer {
  border-top: 1px solid var(--rule);
  background: color-mix(in srgb, var(--ink) 2%, var(--paper));
}
.footer__inner {
  max-width: 78rem;
  margin-inline: auto;
  padding: 2rem var(--pad-x);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  font-size: var(--t-small);
  color: var(--ink-faint);
}
.footer__links {
  display: flex;
  gap: 1.5rem;
}

/* ── Motion ─────────────────────────────────────────────────────────────
   The concept is a ledger writing itself: words rise out of masks, hairline
   rules draw themselves left-to-right, and figures tally up to their final
   value. Nothing bounces, nothing floats — motion states a fact and stops.
   Everything here is gated on .js (a script failure can never blank the
   page) and fully disabled under prefers-reduced-motion. */

/* Hero name: masked word rise */
.hero__name .mask {
  display: inline-block;
  overflow: hidden;
  /* include descender space so y / J are never clipped */
  padding-bottom: 0.14em;
  margin-bottom: -0.14em;
  vertical-align: bottom;
}
.hero__name .mask__inner {
  display: inline-block;
  will-change: transform;
}
.js .hero__name .mask__inner {
  transform: translateY(112%);
  animation: word-rise 0.9s var(--ease) forwards;
  animation-delay: calc(var(--w, 0) * 120ms + 100ms);
}
@keyframes word-rise {
  to { transform: translateY(0); }
}

/* Fade-up reveals */
.js .reveal {
  opacity: 0;
  transform: translateY(12px);
}
.js .hero .reveal {
  animation: rise 0.75s var(--ease) forwards;
  animation-delay: calc(var(--i, 0) * 85ms + 60ms);
}
.js .section .reveal.is-in {
  animation: rise 0.7s var(--ease) forwards;
}
.js .section .reveal.is-in:nth-child(2) { animation-delay: 60ms; }
.js .section .reveal.is-in:nth-child(3) { animation-delay: 110ms; }

/* Hairline rules that draw themselves. The real border-top is replaced by a
   pseudo-element so it can scale from the left like a line being ruled. */
.section { border-top: 0; }
.section::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 1px;
  background: var(--rule);
  transform-origin: left center;
}
.js .section::before {
  transform: scaleX(0);
  transition: transform 1.1s var(--ease);
}
.js .section.is-in::before { transform: scaleX(1); }

.entry, .role { border-top: 0; position: relative; }
.entry::before, .role::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 1px;
  background: var(--rule);
  transform-origin: left center;
}
.entry:first-child::before, .role:first-child::before { display: none; }
.js .entry::before, .js .role::before {
  transform: scaleX(0);
  transition: transform 0.9s var(--ease) 0.15s;
}
.js .entry.is-in::before, .js .role.is-in::before { transform: scaleX(1); }

.contact__row { border-top: 0; position: relative; }
.contact__row::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 1px;
  background: var(--rule);
  transform-origin: left center;
}
.contact__row:last-child { border-bottom: 0; }
.contact__row:last-child::after {
  content: "";
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 1px;
  background: var(--rule);
  transform-origin: left center;
}
.js .contact__row::before, .js .contact__row:last-child::after {
  transform: scaleX(0);
  transition: transform 0.9s var(--ease) 0.15s;
}
.js .contact__row.is-in::before,
.js .contact__row.is-in:last-child::after { transform: scaleX(1); }

/* Ledger stagger */
.js .ledger > .reveal.is-in:nth-child(1) { animation-delay: 0ms; }
.js .ledger > .reveal.is-in:nth-child(2) { animation-delay: 90ms; }
.js .ledger > .reveal.is-in:nth-child(3) { animation-delay: 180ms; }
.js .ledger > .reveal.is-in:nth-child(4) { animation-delay: 270ms; }
.js .ledger > .reveal.is-in:nth-child(5) { animation-delay: 360ms; }

/* Reading-progress hairline: a navy rule under the nav that fills as you
   read down the ledger. Scroll-driven (direct manipulation), so it stays
   active under reduced-motion by convention. */
.progress {
  position: absolute;
  left: 0; bottom: -1px;
  height: 2px;
  width: 100%;
  background: var(--navy);
  transform: scaleX(0);
  transform-origin: left center;
  pointer-events: none;
}

@keyframes rise {
  to { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  .js .reveal,
  .js .hero .reveal,
  .js .section .reveal.is-in {
    opacity: 1 !important;
    transform: none !important;
    animation: none !important;
  }
  .js .hero__name .mask__inner {
    transform: none !important;
    animation: none !important;
  }
  .js .section::before,
  .js .entry::before, .js .role::before,
  .js .contact__row::before, .js .contact__row:last-child::after {
    transform: scaleX(1) !important;
    transition: none !important;
  }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ── Print ──────────────────────────────────────────────────────────────── */
@media print {
  .nav, .skip, .hero__cta, .footer__links { display: none; }
  .reveal { opacity: 1 !important; transform: none !important; }
  body { background: #fff; color: #000; }
  .section { break-inside: avoid; }
  a[href^="http"]::after { content: " (" attr(href) ")"; font-size: 0.75em; color: #555; }
}
