:root {
  --paper: #edf1ec;
  --surface: #f8faf6;
  --ink: #16243f;
  --muted: #56627a;
  --line: #c8d5cd;
  --guilloche: #7fae9a;
  --verified: #15775a;
  --pending: #9a6a12;
  --opus: #4c3fa8;
  --sonnet: #0f7680;
  --haiku: #9a6a12;
  --term-bg: #16243f;
  --term-ink: #dfe7ef;
  --sans: "Schibsted Grotesk", "Helvetica Neue", Arial, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #0e1728; --surface: #15213a; --ink: #e3eaf2; --muted: #9aa8be; --line: #2b3a56;
    --guilloche: #3f6f60; --verified: #52c99d; --pending: #e2ab4c;
    --opus: #a093ff; --sonnet: #55c4cb; --haiku: #e2ab4c; --term-bg: #08101e; --term-ink: #dfe7ef;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #0e1728; --surface: #15213a; --ink: #e3eaf2; --muted: #9aa8be; --line: #2b3a56;
  --guilloche: #3f6f60; --verified: #52c99d; --pending: #e2ab4c;
  --opus: #a093ff; --sonnet: #55c4cb; --haiku: #e2ab4c; --term-bg: #08101e; --term-ink: #dfe7ef;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font: 17px/1.55 var(--sans); overflow-x: hidden; -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
:focus-visible { outline: 3px solid var(--verified); outline-offset: 2px; border-radius: 4px; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--ink); color: var(--paper); padding: 8px 12px; z-index: 50; }
.skip:focus { left: 8px; }

/* Bar */
.bar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 24px;
  padding: 10px max(16px, calc((100vw - 1120px) / 2));
  background: color-mix(in srgb, var(--paper) 90%, transparent); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.bar-name { font-weight: 800; text-decoration: none; letter-spacing: -.01em; }
.bar-links { display: flex; gap: 20px; }
.bar-links a { text-decoration: none; color: var(--muted); font-size: 15px; }
.bar-links a:hover { color: var(--ink); }
.bar-tools { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.lang { display: flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.lang button { border: 0; background: transparent; color: var(--muted); font: 600 13px var(--sans); padding: 7px 10px; cursor: pointer; }
.lang button[aria-pressed="true"] { background: var(--ink); color: var(--paper); }
.tool { border: 1px solid var(--line); background: transparent; color: var(--ink); border-radius: 8px; height: 34px; min-width: 34px; display: grid; place-items: center; cursor: pointer; font: 600 13px var(--sans); }
a.tool { text-decoration: none; color: var(--ink); }
.tool-text { padding: 0 12px; }

main { max-width: 1120px; margin: 0 auto; padding: 0 16px; }

/* Hero */
.hero { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 48px; padding: 56px 0 72px; align-items: stretch; }
.hero-left { display: flex; flex-direction: column; gap: 20px; }
.hero-left .btn { align-self: flex-start; }
.verify { display: flex; flex-direction: column; justify-content: center; }
.doc {
  position: relative; overflow: hidden; background: var(--surface); border: 1px solid var(--line);
  border-radius: 18px; padding: 22px 24px 0; isolation: isolate;
  display: flex; flex-direction: column; flex: none; height: 440px;
}
.guilloche { position: absolute; inset: 0; width: 100%; height: 100%; z-index: -1; opacity: .22; }
.doc-head { display: flex; justify-content: space-between; font-size: 14px; color: var(--muted); font-weight: 600; margin-bottom: 18px; }
.doc-no { font-family: var(--mono); font-weight: 500; }
.doc-body { display: grid; grid-template-columns: 132px 1fr; gap: 22px; flex: 1; padding-bottom: 22px; }
.doc-photo { width: 132px; height: auto; aspect-ratio: 243/324; object-fit: cover; border-radius: 6px; filter: grayscale(.25) contrast(1.05); border: 1px solid var(--line); }
.doc-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 18px; margin: 0; align-content: start; }
.doc-fields .f-wide { grid-column: 1 / -1; }
.doc-fields dt { font-size: 12.5px; color: var(--muted); }
.doc-fields dd { margin: 0; font-weight: 600; font-size: 15.5px; line-height: 1.3; }
.doc-name { font-size: 22px !important; font-weight: 800 !important; letter-spacing: -.01em; }
.mrz {
  margin: 0 -24px; padding: 14px 24px; background: color-mix(in srgb, var(--surface) 70%, var(--paper));
  border-top: 1px solid var(--line); font-family: var(--mono); font-size: clamp(10px, 1.45vw, 14px);
  letter-spacing: .12em; line-height: 1.6; color: var(--ink); white-space: pre; overflow: hidden;
}

.verify-title { font-size: clamp(22px, 2.6vw, 30px); line-height: 1.3; letter-spacing: -.01em; font-weight: 500; margin: 0; }
.verify-title::before { content: "“"; color: var(--verified); }
.verify-title::after { content: "”"; color: var(--verified); }
.quote { margin: 0 0 28px; }
.checks { list-style: none; padding: 0; margin: 0 0 14px; display: grid; gap: 2px; }
.checks li { display: grid; grid-template-columns: 22px 1fr; gap: 10px; align-items: start; padding: 7px 0; border-bottom: 1px solid var(--line); font-size: 16px; }
.checks .mark { width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; margin-top: 2px; border: 2px solid var(--pending); }
.checks li.pending .mark { border-color: var(--pending); border-right-color: transparent; animation: spin .7s linear infinite; }
.checks li.queued { color: var(--muted); }
.checks li.queued .mark { border-color: var(--line); }
.checks li.ok .mark { background: var(--verified); border-color: var(--verified); }
.checks li.ok .mark::after { content: ""; width: 5px; height: 9px; border: solid var(--surface); border-width: 0 2px 2px 0; transform: translate(0, -1px) rotate(45deg); }
@keyframes spin { to { transform: rotate(360deg); } }
.verify-status { font-weight: 700; color: var(--verified); min-height: 1.5em; margin: 0 0 22px; }

.btn {
  display: inline-flex; align-items: center; gap: 8px; padding: 12px 20px; border-radius: 10px;
  background: var(--ink); color: var(--paper); font-weight: 700; text-decoration: none; font-size: 16px;
}
.btn:hover { background: var(--verified); }

/* Blocks */
.block { padding: 64px 0; border-top: 1px solid var(--line); display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 0 40px; }
.block > h2 { font-size: 24px; letter-spacing: -.015em; margin: 0 0 24px; line-height: 1.2; position: sticky; top: 76px; align-self: start; }
.block > :not(h2) { grid-column: 2; }
.lede { font-size: 19px; max-width: 62ch; margin: 0 0 8px; }
.sub { font-size: 18px; margin: 40px 0 6px; letter-spacing: -.01em; }
.block > .sub:first-of-type { margin-top: 32px; }
.hint { color: var(--muted); margin: 0 0 16px; max-width: 65ch; }

.summary p { margin: 0 0 14px; max-width: 66ch; }
.summary p:first-child { font-size: 19px; }

/* Timeline */
.timeline { list-style: none; margin: 0; padding: 0; }
.job { position: relative; padding: 0 0 36px 28px; border-left: 2px solid var(--line); }
.job:last-child { padding-bottom: 0; }
.job::before { content: ""; position: absolute; left: -7px; top: 6px; width: 12px; height: 12px; border-radius: 50%; background: var(--paper); border: 2px solid var(--ink); }
.job.current::before { background: var(--verified); border-color: var(--verified); }
.job-dates { font-size: 14px; color: var(--muted); font-variant-numeric: tabular-nums; }
.job h3 { margin: 2px 0 2px; font-size: 20px; letter-spacing: -.01em; }
.job-org { font-weight: 600; color: var(--muted); margin: 0 0 10px; }
.job p { margin: 0 0 10px; max-width: 66ch; }
.job ul { margin: 0 0 10px; padding-left: 20px; max-width: 66ch; }
.job li { margin-bottom: 4px; }
.env { font-size: 14px; color: var(--muted); }
.job-toggle { background: none; border: 0; padding: 0; color: var(--verified); font: 700 15px var(--sans); cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.job-more[hidden] { display: none; }

.years { display: flex; gap: 6px; flex-wrap: wrap; margin: 18px 0 16px; }
.years button { border: 1px solid var(--line); background: var(--surface); color: var(--ink); font: 700 15px var(--sans); padding: 7px 14px; border-radius: 8px; cursor: pointer; font-variant-numeric: tabular-nums; }
.years button[aria-selected="true"] { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.year-note { color: var(--muted); margin: 0 0 12px; font-size: 15px; }
.projects { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.proj { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; }
.proj h4 { margin: 0; font-size: 16.5px; }
.proj-role { font-size: 14px; color: var(--muted); }
.proj p { margin: 6px 0 0; font-size: 15.5px; }
.proj .metric { display: inline-block; margin-top: 8px; font-size: 14px; font-weight: 700; color: var(--verified); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.chips span { font-size: 13px; color: var(--muted); border: 1px solid var(--line); border-radius: 6px; padding: 1px 7px; }

/* AI journey */
.journey { list-style: none; padding: 0; margin: 12px 0 0; display: grid; grid-template-columns: repeat(4, 1fr); gap: 0; }
.journey li { padding: 12px 14px 0 0; position: relative; }
.journey li::before { content: ""; position: absolute; top: -7px; left: 0; width: 12px; height: 12px; border-radius: 50%; background: var(--paper); border: 2px solid var(--ink); }
.journey li::before { z-index: 1; }
.journey li:not(:last-child)::after { content: ""; position: absolute; top: -1px; left: 0; right: 0; height: 2px; background: var(--ink); }
.journey li:last-child::before { background: var(--verified); border-color: var(--verified); }
.journey b { display: block; font-variant-numeric: tabular-nums; }
.journey span { font-size: 15px; color: var(--muted); }

/* Stages */
.stages { display: grid; grid-template-columns: repeat(6, 1fr); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.stages button { border: 0; border-right: 1px solid var(--line); background: var(--surface); color: var(--ink); padding: 12px 6px; font: 700 14.5px var(--sans); cursor: pointer; }
.stages button:last-child { border-right: 0; }
.stages button[aria-selected="true"] { background: var(--ink); color: var(--paper); }
.stage-panel { padding: 18px 2px 0; }
.stage-panel p { margin: 0 0 12px; max-width: 66ch; }
.split { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.split h4 { margin: 0 0 6px; font-size: 15px; }
.split ul { margin: 0; padding-left: 18px; }
.split li { margin-bottom: 4px; font-size: 15.5px; }

/* Agents */
.agents { display: grid; grid-template-columns: minmax(0, 380px) minmax(0, 1fr); gap: 32px; align-items: center; }
.ring { position: relative; width: 100%; aspect-ratio: 1; }
.ring::before { content: ""; position: absolute; inset: 15%; border: 1.5px dashed var(--line); border-radius: 50%; }
.ring-core { position: absolute; inset: 34%; border-radius: 50%; background: var(--ink); color: var(--paper); display: grid; place-items: center; font-family: var(--mono); font-size: clamp(10px, 2.4vw, 13px); text-align: center; }
.node { position: absolute; transform: translate(-50%, -50%); width: 23%; aspect-ratio: 1; border-radius: 50%; border: 2px solid var(--c); background: var(--surface); color: var(--ink); font: 700 clamp(10px, 2vw, 12.5px)/1.15 var(--sans); cursor: pointer; padding: 4px; }
.node[aria-pressed="true"] { background: var(--c); color: var(--surface); }
.agent-panel h4 { font-family: var(--mono); font-weight: 500; font-size: 17px; margin: 0 0 4px; }
.badge { display: inline-block; font-size: 13px; font-weight: 700; color: var(--c); border: 1.5px solid var(--c); border-radius: 6px; padding: 0 8px; margin-bottom: 10px; }
.agent-panel p { margin: 0 0 8px; }
.agent-panel ul { margin: 0; padding-left: 18px; }
.models { list-style: none; padding: 0; margin: 14px 0 28px; display: flex; flex-wrap: wrap; gap: 6px 22px; font-size: 14.5px; color: var(--muted); }
.models i { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--c); margin-right: 6px; }

/* Terminal */
.terminal { background: var(--term-bg); border-radius: 12px; overflow: hidden; margin-top: 8px; }
.term-bar { display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-bottom: 1px solid rgba(255,255,255,.1); }
.term-title { color: #9fb0c6; font-size: 14px; flex: 1; }
.term-btn { background: var(--term-ink); color: var(--term-bg); border: 0; border-radius: 6px; padding: 6px 12px; font: 700 14px var(--sans); cursor: pointer; }
.term-btn:disabled { opacity: .5; cursor: default; }
.term-body { margin: 0; padding: 16px 18px; min-height: 300px; color: var(--term-ink); font: 13px/1.7 var(--mono); white-space: pre-wrap; word-break: break-word; }
.t-m { color: #8295ad; } .t-ok { color: #6fd6a8; } .t-w { color: #f0c46a; } .t-a { color: #9fd2ff; } .t-v { color: #b9adff; }

.builds { list-style: none; padding: 0; margin: 12px 0 0; display: grid; grid-template-columns: 1fr 1fr; gap: 0 32px; }
.builds li { padding: 12px 0; border-bottom: 1px solid var(--line); }
.builds b { display: block; }
.builds code { font-family: var(--mono); font-size: 13.5px; color: var(--verified); }
.builds span { display: block; color: var(--muted); font-size: 15.5px; }

/* Skills */
.skills { display: grid; grid-template-columns: 1fr 1fr; gap: 20px 40px; }
.skills h3 { font-size: 16px; margin: 0 0 4px; }
.skills p { margin: 0; color: var(--muted); }

/* Education */
.edu { display: grid; grid-template-columns: 1fr 1fr; gap: 0 40px; }
.edu .sub:first-child { margin-top: 0; }
.plain { list-style: none; padding: 0; margin: 0; }
.plain li { padding: 8px 0; border-bottom: 1px solid var(--line); }
.plain small { display: block; color: var(--muted); font-size: 14.5px; }
.certs { list-style: none; padding: 0; margin: 0; }
.certs li { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); align-items: baseline; }
.certs a { color: var(--verified); font-weight: 700; font-size: 14.5px; white-space: nowrap; }

.contact .btn { justify-self: start; margin-top: 12px; }
.foot { text-align: center; color: var(--muted); font-size: 14px; padding: 32px 16px 40px; border-top: 1px solid var(--line); }

/* Process */
.steps { list-style: none; padding: 0; margin: 12px 0 0; }
.steps li { display: grid; grid-template-columns: 44px minmax(0, 1fr); gap: 14px; padding: 16px 0; }
.steps li + li { border-top: 1px solid var(--line); }
.step-n { font: 500 15px var(--mono); color: var(--verified); padding-top: 3px; }
.steps b { font-size: 17px; }
.steps p { margin: 4px 0 0; max-width: 62ch; color: var(--muted); font-size: 15.5px; }

/* Responsive */
@media (max-width: 920px) {
  .hero { grid-template-columns: minmax(0, 1fr); gap: 36px; padding-top: 32px; }
  .doc { height: auto; }
  .verify-title { font-size: 24px; }
  .block { grid-template-columns: minmax(0, 1fr); }
  .block > h2 { position: static; }
  .block > :not(h2) { grid-column: 1; }
  .agents { grid-template-columns: 1fr; }
  .ring { max-width: 360px; margin: 0 auto; }
  .bar-links { display: none; }
}
@media (max-width: 640px) {
  body { font-size: 16px; }
  .doc { padding: 16px 16px 0; }
  .doc-body { grid-template-columns: 92px 1fr; gap: 14px; }
  .doc-photo { width: 92px; }
  .doc-fields { grid-template-columns: 1fr; gap: 8px; }
  .doc-name { font-size: 18px !important; }
  .mrz { margin: 16px -16px 0; padding: 10px 16px; letter-spacing: .04em; }
  .stages { grid-template-columns: repeat(3, 1fr); }
  .stages button:nth-child(3) { border-right: 0; }
  .stages button:nth-child(-n+3) { border-bottom: 1px solid var(--line); }
  .split, .builds, .skills, .edu { grid-template-columns: 1fr; }
  .journey { grid-template-columns: 1fr; border-top: 0; border-left: 2px solid var(--ink); }
  .journey li { padding: 0 0 14px 20px; }
  .journey li::before { top: 4px; left: -7px; }
  .journey li::after { display: none; }
  .block { padding: 48px 0; }
  .tool-text { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  html { scroll-behavior: auto; }
}

/* Print: a clean CV */
@media print {
  :root { --paper: #fff; --surface: #fff; --ink: #111827; --muted: #4b5563; --line: #d1d5db; --verified: #15775a; }
  body { font-size: 11pt; }
  .bar, .skip, .terminal, .stages, .stage-panel, .agents, .models, #ai .hint, .contact .btn, .hero-left .btn, .years, .job-toggle, .foot { display: none !important; }
  .job-more[hidden] { display: block !important; }
  .hero { grid-template-columns: 1fr 1fr; padding: 0 0 16px; gap: 24px; }
  .guilloche { opacity: .25; }
  .block { padding: 16px 0; grid-template-columns: 1fr; break-inside: auto; }
  .block > h2 { position: static; margin-bottom: 8px; }
  .block > :not(h2) { grid-column: 1; }
  .proj, .job { break-inside: avoid; }
  .projects-all { display: block !important; }
  a { text-decoration: none; }
}
