/* mattffrench.com — "the record"
   Family system shared with madridaibuilders.com and madrilingo.com:
   Inter body, JetBrains Mono labels, one display face + one accent per site. */

:root {
  --bg: #f7f6f3;
  --surface: #ffffff;
  --ink: #16171a;
  --muted: #5b5e66;
  --line: #e2e0da;
  --accent: #1d4ed8;
  --accent-ink: #ffffff;
  --accent-soft: #e6ecfb;
  --display: "Newsreader", Georgia, "Times New Roman", serif;
  --body: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  --max: 1040px;
  --gutter: 16px;
  --radius: 14px;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1013;
    --surface: #17181c;
    --ink: #ecebe7;
    --muted: #a1a3aa;
    --line: #2a2c31;
    --accent: #8fb0ff;
    --accent-ink: #0f1013;
    --accent-soft: #1b2338;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 17px/1.6 var(--body);
  overflow-x: hidden;
  text-rendering: optimizeLegibility;
}

img { max-width: 100%; height: auto; display: block; }
a { color: inherit; text-decoration-color: color-mix(in srgb, currentColor 35%, transparent); text-underline-offset: 3px; }
a:hover { text-decoration-color: currentColor; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }

.skip { position: absolute; left: -9999px; top: 0; }
.skip:focus { left: var(--gutter); top: var(--gutter); background: var(--surface); padding: 8px 12px; z-index: 10; }

.wrap { max-width: var(--max); margin: 0 auto; padding: 0 var(--gutter); }
@media (min-width: 720px) { :root { --gutter: 32px; } }

/* Header */
.site-header { border-bottom: 1px solid var(--line); }
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 64px; }
.brand { font: 600 17px/1 var(--display); letter-spacing: -0.01em; text-decoration: none; font-size: 20px; }
.nav { display: flex; gap: 20px; font-size: 14px; color: var(--muted); }
.nav a { text-decoration: none; white-space: nowrap; }
.nav a:hover { color: var(--ink); }
@media (max-width: 560px) { .nav .opt { display: none; } }

/* Labels */
.eyebrow {
  font: 500 12px/1.2 var(--mono);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin: 0 0 14px;
}

h1, h2, h3 { font-family: var(--display); font-weight: 500; letter-spacing: -0.015em; margin: 0; }
h1 { font-size: clamp(40px, 6.4vw, 64px); line-height: 1.04; text-wrap: balance; }
h2 { font-size: clamp(28px, 4vw, 38px); line-height: 1.1; }
h3 { font-size: 22px; line-height: 1.2; }
p { margin: 0 0 1em; }
.lead { font-size: clamp(18px, 2.2vw, 21px); color: var(--muted); max-width: 40ch; }

/* Hero */
.hero { padding-top: 56px; padding-bottom: 48px; }
.hero-grid { display: grid; gap: 32px; align-items: center; }
@media (min-width: 800px) { .hero-grid { grid-template-columns: 1fr 260px; gap: 56px; } .hero { padding-top: 88px; padding-bottom: 72px; } }
.hero h1 { margin-bottom: 20px; }
.hero h1 em { font-style: italic; color: var(--accent); }
.portrait { width: 160px; aspect-ratio: 1; border-radius: 50%; object-fit: cover; border: 1px solid var(--line); order: -1; }
@media (min-width: 800px) { .portrait { width: 260px; border-radius: var(--radius); order: 0; } }

.actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 28px; }
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  min-height: 44px; padding: 0 18px; border-radius: 999px;
  font: 500 15px/1 var(--body); text-decoration: none;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink);
}
.btn:hover { border-color: var(--ink); }
.btn.primary { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.btn.primary:hover { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }

/* Sections */
section { padding: 56px 0; border-top: 1px solid var(--line); }
@media (min-width: 800px) { section { padding: 80px 0; } }
.section-head { display: grid; gap: 12px; margin-bottom: 36px; }
@media (min-width: 800px) { .section-head { grid-template-columns: 340px 1fr; gap: 56px; align-items: baseline; } }
.section-head p { color: var(--muted); max-width: 56ch; margin: 0; }

/* Stats ledger */
.ledger { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); border-top: 1px solid var(--line); border-left: 1px solid var(--line); }
@media (min-width: 800px) { .ledger { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.stat { padding: 22px 18px 20px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); background: var(--surface); }
.stat .num { font: 500 clamp(32px, 5vw, 46px)/1 var(--display); letter-spacing: -0.02em; display: block; margin-bottom: 8px; font-variant-numeric: lining-nums tabular-nums; }
.stat .what { font-size: 14px; color: var(--muted); line-height: 1.4; }
.asof { font: 400 12px/1.4 var(--mono); color: var(--muted); margin-top: 14px; }

/* Cards */
.cards { display: grid; gap: 16px; }
@media (min-width: 800px) { .cards { grid-template-columns: 1fr 1fr; } }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; display: flex; flex-direction: column; gap: 12px; }
.card p { color: var(--muted); margin: 0; }
.card .meta { font: 400 13px/1.5 var(--mono); color: var(--muted); }
.card .more { margin-top: auto; padding-top: 8px; font-weight: 500; color: var(--accent); text-decoration: none; }
.card .more:hover { text-decoration: underline; }

/* Research */
.paper { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 28px 24px; }
@media (min-width: 800px) { .paper { padding: 36px; display: grid; grid-template-columns: 1.3fr 1fr; gap: 40px; } }
.badge { display: inline-block; font: 500 12px/1 var(--mono); letter-spacing: .04em; padding: 6px 10px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); margin-bottom: 14px; }
.paper h3 { font-size: 26px; margin-bottom: 12px; }
.paper p { color: var(--muted); }
.paper ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; align-content: start; }
.paper li a { display: flex; justify-content: space-between; gap: 12px; padding: 14px 16px; border: 1px solid var(--line); border-radius: 10px; text-decoration: none; font-weight: 500; }
.paper li a:hover { border-color: var(--accent); color: var(--accent); }
.paper li a span { font: 400 13px var(--mono); color: var(--muted); }
@media (max-width: 799px) { .paper ul { margin-top: 20px; } }

.request { margin-top: 16px; background: var(--accent-soft); border-radius: var(--radius); padding: 24px; display: grid; gap: 16px; }
@media (min-width: 800px) { .request { grid-template-columns: 1fr auto; align-items: center; padding: 28px 36px; } }
.request h3 { margin-bottom: 6px; }
.request p { margin: 0; color: var(--muted); max-width: 60ch; }

/* Elsewhere / contact */
.links { display: flex; flex-wrap: wrap; gap: 10px; }
.contact { text-align: left; }
.contact h2 { margin-bottom: 14px; }
.contact .mail { font: 500 clamp(22px, 4vw, 34px)/1.2 var(--display); color: var(--accent); word-break: break-word; }

.site-footer { border-top: 1px solid var(--line); padding: 28px 0 40px; font-size: 13px; color: var(--muted); }
.site-footer .wrap { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px; }

/* 404 */
.notfound { min-height: 70vh; display: grid; place-items: center; text-align: center; padding-top: 64px; padding-bottom: 64px; }

/* Experience timeline */
.timeline { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.timeline li { display: grid; grid-template-columns: 1fr; gap: 4px; padding: 18px 0; border-bottom: 1px solid var(--line); }
.timeline .when { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.timeline b { font-weight: 600; }
.timeline p { margin: 4px 0 0; color: var(--muted); }
@media (min-width: 720px) { .timeline li { grid-template-columns: 140px 1fr; gap: 24px; } }

.timeline b a { color: inherit; text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }
