/* =========================================================
   Design tokens: change colours and fonts here.
   Light is the default; dark applies from the OS setting
   unless the visitor picks a theme with the toggle.
   ========================================================= */
:root {
  --bg: #f7f5f0;
  --surface: #fffdf8;
  --ink: #0f1e3d;        /* headings, strong text */
  --text: #3b4252;       /* body text */
  --muted: #6e7584;      /* labels, dates */
  --rule: #e2ddd1;       /* hairlines */
  --accent: #8c6a2c;     /* brass */
  --header-bg: rgba(247, 245, 240, 0.82);

  --serif: "Fraunces", Georgia, "Times New Roman", serif;
  --reading: "Newsreader", Georgia, serif;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;

  --max: 1200px;
  --gutter: clamp(16px, 4vw, 56px);
  --header-h: 64px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0c1424;
    --surface: #111c31;
    --ink: #eef1f6;
    --text: #b8c1cf;
    --muted: #8892a5;
    --rule: #222f48;
    --accent: #d4b26a;
    --header-bg: rgba(12, 20, 36, 0.82);
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg: #0c1424;
  --surface: #111c31;
  --ink: #eef1f6;
  --text: #b8c1cf;
  --muted: #8892a5;
  --rule: #222f48;
  --accent: #d4b26a;
  --header-bg: rgba(12, 20, 36, 0.82);
  color-scheme: dark;
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 24px);
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  transition: background-color .2s ease, color .2s ease;
}

a { color: inherit; }
p { margin: 0; }
img, svg { display: block; max-width: 100%; }

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

.skip {
  position: absolute; left: 16px; top: -48px; z-index: 100;
  background: var(--ink); color: var(--bg); padding: 8px 14px; border-radius: 6px; text-decoration: none;
}
.skip:focus { top: 12px; }

/* ===== Header / navigation ===== */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: var(--header-bg);
  -webkit-backdrop-filter: saturate(160%) blur(12px);
  backdrop-filter: saturate(160%) blur(12px);
  border-bottom: 1px solid var(--rule);
}

.nav-inner {
  max-width: var(--max); margin: 0 auto; padding: 0 var(--gutter);
  height: var(--header-h);
  display: flex; align-items: center; gap: 24px;
}

.wordmark {
  font-family: var(--serif); font-size: 21px; font-weight: 500; letter-spacing: -0.01em;
  color: var(--ink); text-decoration: none; margin-right: auto;
}

.nav-links { display: flex; align-items: center; gap: 28px; font-size: 14px; font-weight: 500; }
.nav-links a { color: var(--muted); text-decoration: none; transition: color .15s; }
.nav-links a:hover, .nav-links a.active { color: var(--ink); }
.nav-links a.active { box-shadow: inset 0 -1px var(--accent); }
.nav-links .nav-cta {
  color: var(--ink); border: 1px solid var(--rule); padding: 7px 14px; border-radius: 999px;
}
.nav-links .nav-cta:hover { border-color: var(--accent); }

.nav-tools { display: flex; align-items: center; gap: 4px; }
.icon-btn {
  width: 40px; height: 40px; display: grid; place-items: center;
  background: none; border: 0; border-radius: 999px; color: var(--ink); cursor: pointer;
}
.icon-btn:hover { background: var(--rule); }
.icon-btn svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.theme-toggle .i-sun { display: none; }
:root[data-theme="dark"] .theme-toggle .i-sun { display: block; }
:root[data-theme="dark"] .theme-toggle .i-moon { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .i-sun { display: block; }
  :root:not([data-theme="light"]) .theme-toggle .i-moon { display: none; }
}

.menu-toggle { display: none; }
.menu-toggle .i-close { display: none; }
.menu-toggle[aria-expanded="true"] .i-close { display: block; }
.menu-toggle[aria-expanded="true"] .i-menu { display: none; }

/* ===== Two-column layout ===== */
.layout {
  max-width: var(--max); margin: 0 auto; padding: 0 var(--gutter);
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.35fr); gap: clamp(48px, 7vw, 96px);
}

.profile {
  position: sticky; top: var(--header-h); align-self: start;
  padding: 72px 0 48px;
}

.eyebrow {
  font-size: 11px; font-weight: 600; letter-spacing: .2em; text-transform: uppercase; color: var(--accent);
}

h1 {
  font-family: var(--serif); font-weight: 400; color: var(--ink);
  font-size: clamp(48px, 6.4vw, 76px); line-height: 1; letter-spacing: -0.025em;
  margin: 18px 0 22px;
}

.role { color: var(--ink); font-weight: 500; font-size: 17px; }
.sub { margin-top: 10px; max-width: 390px; color: var(--muted); }

.facts { margin: 36px 0 0; padding-left: 20px; border-left: 2px solid var(--accent); max-width: 390px; }
.facts div { padding: 9px 0; border-bottom: 1px solid var(--rule); }
.facts div:last-child { border-bottom: 0; }
.facts dt { font-size: 11px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.facts dd { margin: 2px 0 0; color: var(--ink); font-size: 15px; font-weight: 500; }

main { padding: 72px 0 40px; min-width: 0; }

section + section { margin-top: 72px; }

h2 {
  font-size: 11px; font-weight: 600; letter-spacing: .2em; text-transform: uppercase; color: var(--muted);
  margin: 0; padding-bottom: 12px; border-bottom: 1px solid var(--rule);
}

/* ===== About ===== */
.intro { font-family: var(--reading); font-size: clamp(19px, 2vw, 22px); line-height: 1.55; color: var(--ink); }
.intro + .intro { margin-top: 18px; }
.intro em { color: var(--accent); }

.stats {
  list-style: none; margin: 40px 0 0; padding: 0;
  display: grid; grid-template-columns: repeat(3, 1fr);
  border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule);
}
.stats li { padding: 20px 16px 20px 0; display: flex; flex-direction: column; gap: 4px; }
.stats li + li { padding-left: 20px; border-left: 1px solid var(--rule); }
.stat-n { font-family: var(--serif); font-size: clamp(30px, 3.4vw, 40px); line-height: 1.1; color: var(--ink); letter-spacing: -0.02em; }
.stat-n small { font-size: .65em; color: var(--accent); }
.stat-k { font-size: 13px; color: var(--muted); line-height: 1.4; }

/* ===== Entries (experience & education) ===== */
.entry {
  display: grid; grid-template-columns: 136px minmax(0, 1fr); gap: 24px;
  padding: 26px 0; border-bottom: 1px solid var(--rule);
}
.dates { font-size: 13px; color: var(--muted); padding-top: 5px; font-variant-numeric: tabular-nums; }
.entry h3 { font-family: var(--serif); font-weight: 400; font-size: 21px; line-height: 1.3; color: var(--ink); margin: 0; }
.org { display: block; font-family: var(--sans); font-size: 14px; font-weight: 500; color: var(--accent); margin-top: 2px; }
.unit { font-size: 13px; color: var(--muted); margin: 2px 0 10px; }
.entry h3 + p:not(.unit) { margin-top: 8px; }
.entry p { font-size: 15px; }

.deals { margin-top: 18px; display: grid; gap: 12px; }
.deal {
  background: var(--surface); border: 1px solid var(--rule); border-left: 2px solid var(--accent);
  border-radius: 4px; padding: 16px 18px;
}
.deal-meta { font-size: 11px !important; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--accent); margin-bottom: 6px !important; }
.deal p:last-child { font-size: 14.5px; }

/* ===== Beyond work ===== */
.cards { margin-top: 24px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.card {
  background: var(--surface); border: 1px solid var(--rule); border-radius: 4px; padding: 18px 20px;
  text-decoration: none; transition: border-color .15s;
}
a.card:hover { border-color: var(--accent); }
.card-k { font-size: 11px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.card-h { font-family: var(--serif); font-size: 18px; color: var(--ink); margin-top: 4px; }

/* ===== Footer ===== */
.site-footer {
  max-width: var(--max); margin: 40px auto 0; padding: 28px var(--gutter) 40px;
  display: flex; justify-content: space-between; gap: 16px;
  font-size: 13px; color: var(--muted); border-top: 1px solid var(--rule);
}
.site-footer a { color: var(--muted); }

/* ===== Simple content pages (sub-pages, 404) ===== */
.page { max-width: 760px; margin: 0 auto; padding: 72px var(--gutter) 40px; }
.page h1 { font-size: clamp(40px, 6vw, 60px); }

/* ===== Tablet & phone ===== */
@media (max-width: 900px) {
  .layout { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .profile { position: static; padding: 48px 0 8px; }
  main { padding-top: 48px; }

  .menu-toggle { display: grid; }
  .nav-links {
    position: absolute; top: var(--header-h); left: 0; right: 0;
    flex-direction: column; align-items: stretch; gap: 0;
    background: var(--bg); border-bottom: 1px solid var(--rule);
    padding: 8px var(--gutter) 20px;
    display: none;
  }
  .nav-links.open { display: flex; }
  .nav-links a { padding: 14px 0; border-bottom: 1px solid var(--rule); font-size: 16px; }
  .nav-links a.active { box-shadow: none; color: var(--accent); }
  .nav-links .nav-cta { border: 0; border-radius: 0; padding: 14px 0; border-bottom: 0; }
}

@media (max-width: 560px) {
  .entry { grid-template-columns: minmax(0, 1fr); gap: 4px; }
  .dates { padding-top: 0; }
  .stats { grid-template-columns: minmax(0, 1fr); }
  .stats li, .stats li + li { padding: 16px 0; border-left: 0; }
  .stats li + li { border-top: 1px solid var(--rule); }
  .cards { grid-template-columns: minmax(0, 1fr); }
  .site-footer { flex-direction: column; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition: none !important; }
}

/* ===== Print: clean one-column CV ===== */
@media print {
  :root, :root[data-theme="dark"] {
    --bg: #fff; --surface: #fff; --ink: #000; --text: #222; --muted: #555; --rule: #ccc; --accent: #6b5020;
  }
  .site-header, .skip, .site-footer, #beyond { display: none; }
  .layout { display: block; }
  .profile { position: static; padding: 0; }
  main { padding: 24px 0 0; }
  .deal { break-inside: avoid; }
}
