/* Story version: an engineer's spec sheet. Tokens first; no raw colours below the token blocks. */
:root {
  --bg: #f4f4f0;
  --surface: #fff;
  --ink: #11161f;
  --ink-2: #353d4a;
  --muted: #586170;
  --line: #d6d8d0;
  --line-strong: #11161f;
  --accent: #1f45c9;
  --accent-soft: #e4e9fb;
  --on-accent: #fff;
  --switch-top: #e9eae4;
  --switch-bottom: #d5d7cf;
  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
  --wrap: 1200px;
  --gutter: 16px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0d1117;
    --surface: #151b24;
    --ink: #e9ecf1;
    --ink-2: #c4cad4;
    --muted: #9aa3b2;
    --line: #283140;
    --line-strong: #e9ecf1;
    --accent: #85a6ff;
    --accent-soft: #1a2440;
    --on-accent: #0d1117;
    --switch-top: #222a37;
    --switch-bottom: #1a212c;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0d1117;
  --surface: #151b24;
  --ink: #e9ecf1;
  --ink-2: #c4cad4;
  --muted: #9aa3b2;
  --line: #283140;
  --line-strong: #e9ecf1;
  --accent: #85a6ff;
  --accent-soft: #1a2440;
  --on-accent: #0d1117;
  color-scheme: dark;
}
@media (min-width: 768px) { :root { --gutter: 40px; } }

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 80px; text-size-adjust: 100%; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 17px/1.6 var(--sans);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
img { max-width: 100%; height: auto; display: block; }
a { color: inherit; }
a:focus-visible, button:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 2px; }
h1, h2, h3 { margin: 0; font-weight: 650; letter-spacing: -0.02em; line-height: 1.1; text-wrap: balance; }
p { margin: 0 0 1em; }
ul, ol { margin: 0; padding: 0; list-style: none; }
.wrap { width: 100%; max-width: var(--wrap); margin: 0 auto; padding: 0 var(--gutter); }
.mono { font-family: var(--mono); font-size: 12.5px; letter-spacing: 0.04em; text-transform: uppercase; }
.muted { color: var(--muted); }
.skip { position: absolute; left: -9999px; top: 8px; background: var(--ink); color: var(--bg); padding: 8px 12px; z-index: 50; }
.skip:focus { left: 8px; }

/* Top bar */
.topbar { position: sticky; top: 0; z-index: 20; background: var(--bg); border-bottom: 1px solid var(--line); }
.topbar .wrap { display: flex; align-items: center; gap: 24px; min-height: 64px; }
.brand { font-weight: 650; text-decoration: none; white-space: nowrap; }
.brand span { color: var(--muted); font-weight: 400; }
.brand i { font-style: normal; }
.topnav { display: none; gap: 22px; margin-left: auto; }
.topnav a { text-decoration: none; color: var(--ink-2); font-size: 15px; white-space: nowrap; }
.topnav a:hover, .topnav a[aria-current="true"] { color: var(--accent); }
.switches { display: flex; gap: 16px; margin-left: auto; align-items: center; padding: 2px 14px; border-radius: 14px; background: linear-gradient(180deg, var(--switch-top), var(--switch-bottom)); }
@media (min-width: 1240px) { .topnav { display: flex; } .topnav + .switches { margin-left: 8px; } }
.seg { display: inline-flex; gap: 14px; }
.seg a, .seg span { font-size: 15px; color: var(--muted); padding: 0 2px; min-height: 36px; display: inline-flex; align-items: center; text-decoration: none; border-bottom: 3px solid transparent; }
.seg [aria-current="page"] { color: var(--ink); font-weight: 600; border-bottom-color: var(--accent); }
.seg a:hover { color: var(--accent); }
.seg-lang { gap: 0; padding-left: 16px; position: relative; }
.seg-lang::before { content: ""; position: absolute; left: 0; top: 50%; height: 18px; margin-top: -9px; border-left: 1px solid var(--muted); }
.seg-lang a, .seg-lang span { font-size: 13px; }
.seg-lang > :last-child { position: relative; margin-left: 14px; }
.seg-lang > :last-child::before { content: "·"; position: absolute; left: -10px; color: var(--muted); font-weight: 400; }

/* Hero */
.hero { padding: 28px 0 40px; border-bottom: 1px solid var(--line); }
.hero-grid { display: grid; gap: 40px; }
.eyebrow { color: var(--accent); margin-bottom: 20px; }
.hero h1 { font-size: clamp(36px, 4.6vw, 62px); max-width: 17ch; }
.hero h1 em { font-style: normal; color: var(--accent); }
.lead { font-size: clamp(18px, 1.5vw, 20px); color: var(--ink-2); max-width: 54ch; margin-top: 22px; }
.cta { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 28px; }
.btn { display: inline-flex; align-items: center; gap: 10px; min-height: 48px; padding: 0 22px; border-radius: 999px; font-weight: 600; font-size: 16px; text-decoration: none; border: 1px solid var(--line-strong); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn-primary:hover { filter: brightness(1.08); }
.btn-ghost:hover { background: var(--accent-soft); }
.hero-side { display: grid; gap: 20px; align-content: start; }
.portrait { position: relative; max-width: 320px; }
.portrait img { border-radius: 4px; filter: grayscale(1) contrast(1.05); aspect-ratio: 4 / 5; object-fit: cover; }
.portrait figcaption { margin-top: 10px; color: var(--muted); }
@media (min-width: 900px) {
  .hero { padding: 28px 0 44px; }
  .hero-grid { grid-template-columns: minmax(0, 1fr) 294px; gap: 56px; align-items: start; }
  .portrait { max-width: none; }
}

/* Signal chain: the career as a chain of stages */
.chain { margin-top: 40px; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); border-top: 2px solid var(--line-strong); }
.chain a { position: relative; padding: 18px 12px 0 0; text-decoration: none; display: block; }
.chain a::before { content: ""; position: absolute; top: -7px; left: 0; width: 12px; height: 12px; border-radius: 50%; background: var(--bg); border: 2px solid var(--line-strong); }
.chain a:last-child::before { background: var(--accent); border-color: var(--accent); }
.chain b { display: block; font-size: 16px; font-weight: 650; line-height: 1.25; }
.chain small { display: block; font: 12px/1.4 var(--mono); color: var(--muted); margin-top: 4px; }
.chain a:hover b { color: var(--accent); }
@media (max-width: 699px) {
  .chain { grid-template-columns: 1fr; border-top: 0; border-left: 2px solid var(--line-strong); margin-left: 6px; gap: 2px; }
  .chain a { padding: 6px 0 10px 20px; }
  .chain a::before { top: 11px; left: -7px; }
}

.facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0; margin-top: 28px; border-top: 1px solid var(--line); }
.facts div { padding: 16px 16px 0 0; }
.facts strong { display: block; font-size: clamp(26px, 3vw, 36px); font-weight: 650; letter-spacing: -0.02em; line-height: 1.1; }
.facts span { display: block; color: var(--muted); font-size: 14px; line-height: 1.45; margin-top: 6px; }
@media (min-width: 900px) { .facts { grid-template-columns: repeat(4, minmax(0, 1fr)); } }

/* Sections */
.section { padding: 64px 0; border-bottom: 1px solid var(--line); }
@media (min-width: 900px) {
  .section { padding: 80px 0; }
  .section-head { grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); column-gap: 56px; align-items: center; }
  .section-head .mono { grid-column: 1 / -1; }
  .section-head p { margin: 0; }
}
.section-head { display: grid; gap: 12px; margin-bottom: 40px; }
.section-head .mono { color: var(--accent); }
.section-head h2 { font-size: clamp(30px, 4vw, 48px); max-width: 20ch; }
.section-head p { color: var(--ink-2); max-width: 60ch; margin: 8px 0 0; }
.section-head:not(:has(p)) { grid-template-columns: minmax(0, 1fr); }
.section-head:not(:has(p)) h2 { max-width: none; }

/* How I can help */
.bring { display: grid; gap: 0; }
.bring li { padding: 28px 0 28px 40px; border-top: 1px solid var(--line); display: grid; gap: 10px; align-content: start; }
.bring h3 { position: relative; font-size: 22px; }
.bring h3 .ico { position: absolute; left: -40px; top: -1px; width: 28px; height: 28px; fill: none; stroke: var(--accent); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.bring p { color: var(--ink-2); margin: 0; }
.bring div.proof { display: grid; gap: 8px; }
.bring .proof p { color: inherit; }
.bring .bring-steps { margin: 0; padding-left: 1.4em; list-style: decimal; display: grid; gap: 6px; }
.bring .bring-main { display: grid; gap: 8px; align-content: start; }
.bring .bring-steps li { padding: 0; border: 0; display: list-item; }
.bring .proof { font-size: 15px; color: var(--muted); border-left: 2px solid var(--accent); padding-left: 12px; margin-top: 6px; }
@media (min-width: 900px) {
  .bring { grid-template-columns: 1fr 1fr; column-gap: 64px; }
  .bring li { padding: 32px 0 36px 40px; }
  .bring .bring-wide { grid-column: 1 / -1; grid-template-columns: 1fr 1fr; column-gap: 104px; }
  .bring .bring-wide h3 { grid-column: 1 / -1; }
  .bring .bring-wide .proof { margin-top: 0; align-self: start; }
}

/* Story: sticky rail + chapters */
.story { display: grid; gap: 32px; }
.rail { display: none; }
@media (min-width: 1000px) {
  .story { grid-template-columns: 240px minmax(0, 1fr); gap: 72px; }
  .rail { display: block; position: sticky; top: 104px; align-self: start; }
  .rail ol { border-left: 2px solid var(--line); }
  .rail a { display: block; padding: 8px 0 8px 18px; margin-left: -2px; border-left: 2px solid transparent; text-decoration: none; color: var(--muted); }
  .rail a b { display: block; color: var(--ink-2); font-weight: 600; font-size: 15px; }
  .rail a small { font: 12px/1.4 var(--mono); }
  .rail a[aria-current="true"] { border-left-color: var(--accent); }
  .rail a[aria-current="true"] b { color: var(--accent); }
}
.chapter { padding: 0 0 40px; scroll-margin-top: 96px; }
.chapter + .chapter { padding-top: 40px; border-top: 1px solid var(--line); }
.chapter:last-child { padding-bottom: 0; }
.chapter header { display: grid; gap: 8px; margin-bottom: 20px; }
.chapter header .mono { color: var(--muted); }
.chapter h3 { font-size: clamp(24px, 2.6vw, 32px); }
.chapter > p { max-width: 64ch; color: var(--ink-2); }
.roles { display: grid; gap: 0; margin-top: 8px; }
.roles li { display: grid; gap: 4px; padding: 14px 0; border-top: 1px solid var(--line); }
.roles .when { font: 13px/1.5 var(--mono); color: var(--muted); }
.roles b { font-weight: 600; }
.roles span { color: var(--ink-2); }
@media (min-width: 700px) { .roles li { grid-template-columns: 120px minmax(0, 1fr); gap: 20px; } }
.role-block { margin-top: 28px; }
.role-block h4 { margin: 0 0 4px; font-size: 18px; }
.role-block .mono { color: var(--muted); }
.ticks { display: grid; gap: 10px; margin-top: 14px; }
.ticks li { position: relative; padding-left: 22px; color: var(--ink-2); }
.ticks li::before { content: ""; position: absolute; left: 0; top: 0.72em; width: 10px; height: 2px; background: var(--accent); }
@media (min-width: 900px) { .ticks.two { grid-template-columns: 1fr 1fr; column-gap: 40px; } }
.note { font-size: 15px; color: var(--muted); max-width: 64ch; margin-top: 20px; }

/* AI in practice */
.cases { display: grid; gap: 0; }
.case { display: grid; gap: 20px; padding: 36px 0; border-top: 2px solid var(--line-strong); }
.case-meta { display: grid; gap: 10px; align-content: start; }
.case-meta h3 { font-size: 26px; }
.tag { justify-self: start; font: 600 11.5px/1 var(--mono); letter-spacing: 0.08em; text-transform: uppercase; padding: 6px 9px; border: 1px solid var(--line-strong); border-radius: 999px; }
.tag.public { border-color: var(--accent); color: var(--accent); }
.case-meta a { justify-self: start; padding: 10px 0; font-weight: 600; text-decoration-thickness: 1px; text-underline-offset: 4px; color: var(--accent); overflow-wrap: anywhere; }
.case-body p { color: var(--ink-2); max-width: 62ch; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 0; border-top: 1px solid var(--line); margin-top: 20px; }
.stats div { padding: 14px 16px 0 0; }
.stats strong { display: block; font-size: 26px; font-weight: 650; letter-spacing: -0.02em; }
.stats span { color: var(--muted); font-size: 14px; line-height: 1.4; display: block; }
.result { margin-top: 20px; padding: 16px 18px; background: var(--accent-soft); border-radius: 4px; color: var(--ink); }
@media (min-width: 900px) { .case { grid-template-columns: 300px minmax(0, 1fr); gap: 64px; } }

/* Principles and start plan */
.two-col { display: grid; gap: 56px; }
@media (min-width: 900px) { .two-col { grid-template-columns: 1fr 1fr; gap: 80px; } }
.principles li { padding: 16px 0; border-top: 1px solid var(--line); }
.principles b { display: block; font-weight: 650; }
.principles span { color: var(--ink-2); }
.steps { counter-reset: step; }
.steps li { counter-increment: step; display: grid; align-content: start; grid-template-columns: 44px minmax(0, 1fr); gap: 4px 12px; padding: 16px 0; border-top: 1px solid var(--line); }
.steps li::before { content: counter(step); grid-row: span 2; width: 32px; height: 32px; border-radius: 50%; border: 2px solid var(--accent); color: var(--accent); font: 700 14px/28px var(--mono); text-align: center; }
.steps b { font-weight: 650; }
.steps span { color: var(--ink-2); }
.sub-h { font-size: 24px; margin-bottom: 12px; }

/* Quote, education */
.quote blockquote { margin: 0; font-size: clamp(24px, 3vw, 34px); line-height: 1.25; letter-spacing: -0.01em; font-weight: 500; }
.quote cite { display: block; margin-top: 12px; font-style: normal; color: var(--muted); }
.edu li { padding: 12px 0; border-top: 1px solid var(--line); display: grid; gap: 2px; }
.edu span { color: var(--muted); font-size: 15px; }

/* Contact */
.contact { padding: 80px 0 96px; }
.contact h2 { font-size: clamp(34px, 5vw, 60px); max-width: 34ch; }
.contact p { color: var(--ink-2); max-width: 52ch; margin-top: 20px; font-size: 19px; }
footer { border-top: 1px solid var(--line); padding: 24px 0 40px; }
footer .wrap { display: flex; flex-wrap: wrap; gap: 12px 24px; justify-content: space-between; color: var(--muted); font-size: 14px; }
footer a { display: inline-block; padding: 12px 0; color: var(--ink-2); }

@media print {
  .topbar, .rail, .cta, .switches { display: none !important; }
  body { background: var(--surface); color: var(--ink); font-size: 12pt; }
  .section { padding: 24px 0; }
}

/* Small screens: keep the top bar on one line */
@media (max-width: 520px) {
  .topbar .wrap { gap: 10px; }
  .brand { font-size: 15px; }
  .brand span, .brand .first { display: none; }
  .switches { gap: 10px; padding: 0 10px; }
  .seg { gap: 10px; }
  .seg-lang { gap: 0; padding-left: 10px; }
}

.kicker { color: var(--accent); }

/* Touch screens: larger targets */
@media (pointer: coarse) {
  .seg a, .seg span { min-height: 44px; }
  .topbar .wrap { min-height: 60px; }
}
@media (max-width: 699px) {
  .chain { gap: 0; }
  .chain a { padding: 10px 0 12px 20px; min-height: 48px; }
  .chain a::before { top: 15px; }
}

/* Small screens: compact portrait above the headline */
@media (max-width: 899px) {
  .hero-grid { gap: 0; }
  .hero-side.portrait { order: -1; display: flex; align-items: center; gap: 16px; margin: 0 0 24px; max-width: none; }
  .hero-side.portrait img { width: 96px; height: 120px; }
  .hero-side.portrait figcaption { margin: 0; }
}

.chapter .ticks + p { margin-top: 20px; }

/* Contact link next to the portrait */
.contact-link { display: inline-block; white-space: nowrap; font-size: 16px; margin-top: 8px; padding: 6px 0; font-weight: 600; color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 4px; }
@media (pointer: coarse) { .contact-link { padding: 12px 0; } }
.portrait figcaption > .mono { display: block; line-height: 1.5; }
.facts-list { list-style: none; margin: 24px 0 0; padding: 0; border-top: 1px solid var(--line); }
.facts-list li { padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 16px; color: var(--ink-2); }
.facts-list b { color: var(--ink); font-weight: 650; }
.facts small { display: block; font: 12px/1.4 var(--mono); letter-spacing: 0.04em; text-transform: uppercase; color: var(--accent); margin-bottom: 6px; }
.two-col .section-head { grid-template-columns: minmax(0, 1fr); }
.case-links { display: flex; flex-wrap: wrap; column-gap: 20px; }
.hero .cta { margin-top: 24px; }
.hero .cta + .lead { margin-top: 24px; }

/* First steps and education: two columns on wide screens */
@media (min-width: 900px) {
  .steps-grid { display: grid; grid-template-columns: 1fr 1fr; column-gap: 64px; }
}

/* Offer line and work terms */
.offer { margin: 28px 0 0; padding: 16px 20px; background: var(--accent-soft); border-left: 3px solid var(--accent); border-radius: 4px; font-size: clamp(17px, 1.4vw, 19px); font-weight: 600; color: var(--ink); }
.work-terms { display: block; margin-top: 6px; font-size: 14px; line-height: 1.45; color: var(--ink-2); }

.edu-cols { display: grid; gap: 32px; }
.edu-h { font: 600 12.5px/1.4 var(--mono); letter-spacing: 0.04em; text-transform: uppercase; color: var(--accent); margin-bottom: 8px; }
@media (min-width: 900px) { .edu-cols { grid-template-columns: 1fr 1fr; column-gap: 64px; } }
.cv-link { display: block; margin-top: 0; }

/* Brief: compact variant of the "bring" cards */
.bring-brief li { padding: 22px 0 24px 40px; gap: 8px; }
.bring-brief h3 { font-size: 20px; }
.bring-brief h3 .ico { width: 26px; height: 26px; top: 0; }
.bring-list { margin-top: 0; }
.bring-list li { padding: 14px 0; line-height: 1.55; }
.section-brief .section-head { grid-template-columns: minmax(0, 1fr); gap: 8px; margin-bottom: 20px; }
.section-brief .section-head h2 { font-size: 28px; max-width: none; }
.section-brief .section-head p { margin: 0; }
.section-brief .bring-list li { font-size: 17px; }
.hero-brief h1 { font-size: clamp(30px, 3.2vw, 42px); max-width: 22ch; }
.hero-brief .lead { font-size: 18px; margin-top: 16px; }
.hero-brief .facts-list li { font-size: 17px; }
.chapter .also { margin-top: 24px; color: var(--ink-2); }
.more-link { margin-top: 32px; }
.chapter > p.wide { max-width: none; }
@media (min-width: 900px) {
  .ticks.cols { display: block; column-count: 2; column-gap: 40px; }
  .ticks.cols li { break-inside: avoid; margin-bottom: 10px; }
}
.chapter-split .proof { font-size: 15px; color: var(--muted); border-left: 2px solid var(--accent); padding-left: 12px; display: grid; gap: 4px; margin-top: 16px; }
.chapter-split .proof p { margin: 0; }
@media (min-width: 900px) {
  .chapter-split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); column-gap: 64px; }
  .chapter-split > header { grid-column: 1 / -1; }
  .chapter-split .proof { margin-top: 0; align-self: start; }
}
.chapter-split .proof .proof-gap { margin-top: 10px; }
.chapter-split .proof b { color: var(--ink); font-weight: 650; }
#skills .role-block { margin-top: 40px; }
#skills .note { margin-top: 12px; font-size: 14px; color: var(--muted); }
@media (min-width: 900px) { .section-brief { padding: 48px 0; } }
.section-brief { padding-top: 40px; padding-bottom: 40px; }
