:root {
  color-scheme: dark;
  --bg: #090d12;
  --bg-soft: #0d151d;
  --panel: #121c25;
  --text: #ffffff;
  --muted: #b6c2cc;
  --line: rgba(255,255,255,.10);
  --accent: #00b8f5;
  --accent-soft: rgba(0,184,245,.14);
  --shadow: 0 24px 70px rgba(0,0,0,.28);
  --max: 1160px;
}

html[data-theme="light"] {
  color-scheme: light;
  --bg: #eef3f6;
  --bg-soft: #dfe9ee;
  --panel: #ffffff;
  --text: #08131b;
  --muted: #425563;
  --line: rgba(8,19,27,.18);
  --accent: #007ca8;
  --accent-soft: rgba(0,124,168,.14);
  --shadow: 0 24px 70px rgba(8,31,45,.14);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; }
img { max-width: 100%; display: block; }
button, a { -webkit-tap-highlight-color: transparent; }

.shell { width: min(calc(100% - 40px), var(--max)); margin-inline: auto; }
.skip-link { position: absolute; left: -9999px; top: 10px; }
.skip-link:focus { left: 10px; z-index: 999; background: var(--text); color: var(--bg); padding: .7rem 1rem; border-radius: 8px; }

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(16px);
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  border-bottom: 1px solid var(--line);
}

.nav-wrap { height: 72px; display: flex; align-items: center; gap: 2rem; }
.brand {
  width: 42px; height: 42px; display: grid; place-items: center;
  border: 1px solid var(--line); border-radius: 12px;
  text-decoration: none; font-weight: 850; letter-spacing: -.04em;
}
.nav { margin-left: auto; display: flex; gap: 1.6rem; }
.nav a { text-decoration: none; color: var(--muted); font-size: .92rem; }
.nav a:hover { color: var(--text); }
.theme-toggle {
  width: 42px; height: 42px; border-radius: 12px; border: 1px solid var(--line);
  background: transparent; color: var(--text); cursor: pointer; font-size: 1.15rem;
}

.hero { padding: 92px 0 112px; overflow: hidden; }
.hero-grid { display: grid; grid-template-columns: 1.2fr .8fr; align-items: center; gap: 7vw; }
.eyebrow, .section-kicker { color: var(--accent); text-transform: uppercase; letter-spacing: .16em; font-size: .76rem; font-weight: 800; }
h1, h2, h3, p { margin-top: 0; }
h1 { font-family: "Trebuchet MS", ui-sans-serif, sans-serif; font-size: clamp(4.2rem, 10vw, 8.4rem); line-height: .92; letter-spacing: -.035em; margin: 1rem 0 2rem; font-weight: 800; }
.lead { max-width: 670px; font-size: clamp(1.15rem, 2vw, 1.45rem); color: var(--muted); line-height: 1.55; }
.hero-actions { display: flex; gap: .8rem; margin-top: 2.3rem; flex-wrap: wrap; }
.button { text-decoration: none; padding: .86rem 1.15rem; border-radius: 11px; border: 1px solid var(--line); font-weight: 750; font-size: .92rem; }
.button.primary { background: var(--accent); color: #071013; border-color: transparent; }
.button.ghost:hover { background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); }

.portrait-card { position: relative; width: min(100%, 420px); justify-self: end; }
.portrait-card img { position: relative; border-radius: 50%; border: 1px solid var(--line); box-shadow: var(--shadow); }
.portrait-glow { position: absolute; inset: 4% -8% -8% 10%; background: radial-gradient(circle, var(--accent-soft), transparent 68%); filter: blur(20px); }

.section { padding: 105px 0; border-top: 1px solid var(--line); }
.section.alt { background: var(--bg-soft); }
.two-col, .education-layout, .personal-grid { display: grid; grid-template-columns: .85fr 1.15fr; gap: 8vw; }
h2 { font-family: "Trebuchet MS", ui-sans-serif, sans-serif; font-size: clamp(2.5rem, 5vw, 4.8rem); line-height: 1.08; letter-spacing: -.025em; margin-bottom: 0; font-weight: 800; }
.prose { font-size: 1.12rem; color: var(--muted); max-width: 670px; }
.prose p + p { margin-top: 1.35rem; }

.section-heading { display: grid; grid-template-columns: 1.2fr .8fr; gap: 6vw; align-items: end; margin-bottom: 4.5rem; }
.section-heading > p { color: var(--muted); max-width: 430px; margin-bottom: .4rem; }
.timeline { border-top: 1px solid var(--line); }
.role { display: grid; grid-template-columns: 180px 1fr; gap: 2rem; padding: 2.1rem 0; border-bottom: 1px solid var(--line); }
.role.featured { padding-top: 2.6rem; padding-bottom: 2.6rem; }
.role-period { color: var(--muted); font-variant-numeric: tabular-nums; font-size: .86rem; text-transform: uppercase; letter-spacing: .08em; }
.org { margin-bottom: .25rem; color: var(--accent); font-weight: 800; font-size: .88rem; }
.role h3 { font-size: clamp(1.35rem, 2vw, 1.8rem); letter-spacing: -.025em; margin-bottom: .45rem; }
.role-body > p:last-child { color: var(--muted); margin: 0; max-width: 760px; }
.earlier-career { margin-top: 2rem; border: 1px solid var(--line); border-radius: 16px; background: var(--panel); overflow: hidden; }
.earlier-career summary { cursor: pointer; padding: 1.2rem 1.35rem; font-weight: 800; list-style: none; }
.earlier-career summary::-webkit-details-marker { display: none; }
.earlier-career summary::after { content: "+"; float: right; color: var(--accent); }
.earlier-career[open] summary::after { content: "–"; }
.career-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1px; background: var(--line); border-top: 1px solid var(--line); }
.career-grid > div { background: var(--panel); padding: 1.2rem 1.35rem; }
.career-grid span { display: block; color: var(--muted); font-size: .78rem; text-transform: uppercase; letter-spacing: .08em; margin-bottom: .3rem; }
.career-grid strong { display: block; }
.career-grid p { color: var(--muted); margin: .2rem 0 0; font-size: .9rem; }
.zzp-note { margin: 0; padding: 1.2rem 1.35rem; border-top: 1px solid var(--line); color: var(--muted); }
.zzp-note strong { color: var(--text); }

.cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; margin-top: 4rem; }
.card { min-height: 285px; padding: 1.6rem; border: 1px solid var(--line); border-radius: 18px; background: var(--panel); }
.card-number { color: var(--accent); font-size: .8rem; letter-spacing: .12em; }
.card h3 { font-size: 1.55rem; margin: 4.5rem 0 .7rem; letter-spacing: -.03em; }
.card p { color: var(--muted); margin: 0; }

.education-list { border-top: 1px solid var(--line); }
.education-list article { padding: 1.35rem 0; border-bottom: 1px solid var(--line); }
.education-list span { color: var(--muted); font-size: .78rem; text-transform: uppercase; letter-spacing: .08em; }
.education-list h3 { margin: .35rem 0 .15rem; font-size: 1.2rem; }
.education-list p { color: var(--muted); margin: 0; }
.training-strip { display: flex; flex-wrap: wrap; gap: .7rem; margin-top: 3.5rem; }
.training-strip span, .interest-cloud span { border: 1px solid var(--line); border-radius: 999px; padding: .65rem .9rem; color: var(--muted); background: var(--panel); }

.interest-cloud { display: flex; flex-wrap: wrap; align-content: start; gap: .75rem; }
.personal { padding-bottom: 120px; }

.footer { padding: 2rem 0 3rem; border-top: 1px solid var(--line); }
.footer-inner { display: flex; justify-content: space-between; gap: 2rem; align-items: center; }
.footer strong { font-size: 1.05rem; }
.footer p { margin: .2rem 0 0; color: var(--muted); font-size: .86rem; }
.footer a { color: var(--accent); text-decoration: none; }

@media (max-width: 820px) {
  .nav { display: none; }
  .theme-toggle { margin-left: auto; }
  .hero { padding-top: 58px; }
  .hero-grid, .two-col, .education-layout, .personal-grid, .section-heading { grid-template-columns: 1fr; }
  .portrait-card { justify-self: start; width: min(78vw, 340px); margin-top: 1rem; }
  
  .section { padding: 78px 0; }
  .section-heading { margin-bottom: 3rem; }
  .role { grid-template-columns: 1fr; gap: .55rem; }
  .cards { grid-template-columns: 1fr; }
  .card { min-height: 210px; }
  .card h3 { margin-top: 2.8rem; }
  .career-grid { grid-template-columns: 1fr; }
}

@media (max-width: 520px) {
  .shell { width: min(calc(100% - 28px), var(--max)); }
  h1 { font-size: clamp(3.7rem, 18vw, 5.2rem); }
  .portrait-card { width: 82vw; }
  
  .footer-inner { align-items: flex-start; flex-direction: column; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

/* Compact expertise cards */
#expertise .card {
  padding-top: 1.5rem;
  padding-bottom: 1.5rem;
}
#expertise .card h3 {
  margin-top: 0;
  margin-bottom: .55rem;
}
#expertise .card p {
  margin-top: 0;
  margin-bottom: 0;
}

/* v14: consistent section headings */
.section h2 {
  font-size: clamp(2rem, 4vw, 3.25rem);
  line-height: 1.05;
  font-weight: 800;
  letter-spacing: -0.035em;
}

/* v16: consistent spacing when navigating to anchors */
html {
  scroll-padding-top: 88px;
}
#top,
.section {
  scroll-margin-top: 88px;
}


/* v17: print action */
.print-button {
  margin-left: auto;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: .55rem .9rem;
  background: var(--panel);
  color: var(--text);
  font: inherit;
  font-size: .82rem;
  font-weight: 800;
  cursor: pointer;
}
.print-button:hover { border-color: var(--accent); }
.theme-toggle { margin-left: .5rem; }

@media (max-width: 820px) {
  .print-button { margin-left: auto; }
  .theme-toggle { margin-left: .5rem; }
}

@media print {
  @page {
    size: A4;
    margin: 14mm 15mm;
  }

  html,
  body {
    background: #fff !important;
    color: #111 !important;
    font-size: 10pt;
  }

  html {
    scroll-padding-top: 0;
  }

  .site-header,
  .hero-actions,
  .portrait-card,
  .personal,
  .footer {
    display: none !important;
  }

  .hero,
  .section,
  .personal {
    padding: 0 !important;
  }

  .hero {
    min-height: 0 !important;
    margin-bottom: 8mm;
  }

  .hero-grid,
  .two-col,
  .education-layout,
  .section-heading {
    display: block !important;
  }

  .shell {
    width: 100% !important;
    max-width: none !important;
  }

  .eyebrow,
  .section-kicker,
  .role-period,
  .education-list span,
  .career-grid span {
    color: #555 !important;
  }

  h1 {
    font-size: 28pt !important;
    line-height: .95 !important;
    margin: 0 0 4mm !important;
  }

  .lead {
    max-width: none !important;
    font-size: 12pt !important;
    margin: 0 !important;
  }

  .section {
    border: 0 !important;
    background: #fff !important;
    margin: 0 0 7mm !important;
  }

  .section h2 {
    font-size: 17pt !important;
    margin: 0 0 4mm !important;
  }

  .prose p,
  .section-heading > p,
  .role-body > p:last-child,
  .card p,
  .education-list p,
  .career-grid p,
  .zzp-note {
    color: #333 !important;
  }

  .timeline {
    border-top: 1px solid #bbb;
  }

  .role {
    grid-template-columns: 30mm 1fr !important;
    gap: 5mm !important;
    padding: 3mm 0 !important;
    border-bottom: 1px solid #ddd !important;
    break-inside: avoid;
  }

  .role.featured {
    padding: 3mm 0 !important;
  }

  .role h3 {
    font-size: 12pt !important;
    margin: 0 0 1mm !important;
  }

  .org {
    color: #111 !important;
    font-size: 9pt !important;
  }

  .earlier-career {
    margin-top: 5mm !important;
    border: 1px solid #bbb !important;
    background: #fff !important;
  }

  .earlier-career summary {
    padding: 3mm 4mm !important;
  }

  .earlier-career summary::after {
    display: none !important;
  }

  .career-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    background: #ddd !important;
  }

  .career-grid > div {
    background: #fff !important;
    padding: 3mm 4mm !important;
    break-inside: avoid;
  }

  .zzp-note {
    padding: 3mm 4mm !important;
  }

  .cards {
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 3mm !important;
    margin-top: 4mm !important;
  }

  .card {
    min-height: 0 !important;
    padding: 4mm !important;
    border: 1px solid #bbb !important;
    background: #fff !important;
    break-inside: avoid;
  }

  .card h3 {
    font-size: 12pt !important;
    margin: 0 0 2mm !important;
  }

  .education-list article {
    padding: 2.5mm 0 !important;
    break-inside: avoid;
  }

  .training-strip {
    gap: 2mm !important;
    margin-top: 4mm !important;
  }

  .training-strip span {
    padding: 1.5mm 2.5mm !important;
    border: 1px solid #bbb !important;
    background: #fff !important;
    color: #333 !important;
  }

  a {
    color: inherit !important;
    text-decoration: none !important;
  }
}


/* v18: cleaner paper CV — omit website section labels */
@media print {
  #profile .section-kicker,
  #experience .section-kicker,
  #expertise .section-kicker {
    display: none !important;
  }
}


/* v20: keep expertise cards visually balanced */
#expertise .card h3 {
  font-size: 1.45rem;
  line-height: 1.15;
}
#expertise .card p {
  font-size: .95rem;
  line-height: 1.55;
}


/* v21: one extra line of breathing room in expertise cards */
#expertise .card {
  min-height: calc(100% + 1.55rem);
}


/* v23: give expertise cards enough room in the printed CV */
@media print {
  #expertise .cards {
    align-items: stretch !important;
  }

  #expertise .card {
    min-height: 48mm !important;
    padding: 4mm 5mm !important;
  }

  #expertise .card p {
    line-height: 1.45 !important;
  }
}


/* v24: keep Expertise section label visible in print */
@media print {
  #expertise .section-kicker {
    display: block !important;
  }
}


/* v26: keep the Expertise heading together with its cards when printing */
@media print {
  #expertise {
    break-inside: avoid-page !important;
    page-break-inside: avoid !important;
  }

  #expertise .section-heading {
    break-after: avoid-page !important;
    page-break-after: avoid !important;
  }

  #expertise .cards {
    break-before: avoid-page !important;
    page-break-before: avoid !important;
  }
}


/* v28: mobile expertise cards — override the desktop percentage height */
@media (max-width: 820px) {
  #expertise .cards {
    gap: 1rem;
  }

  #expertise .card {
    min-height: 230px;
  }
}
