/* ───────────── Tokens ───────────── */
:root {
  --bg: #fbfaf7;
  --surface: #ffffff;
  --text: #1d1f23;
  --muted: #5f646d;
  --faint: #8a8f98;
  --line: #e6e3dc;
  --accent: #2c4a7a;
  --accent-soft: #eef2f8;
  --ok: #2f7d4f;
  --ok-soft: #edf6f0;
  --err: #b3261e;
  --err-soft: #fbeeed;
  --serif: "Source Serif 4", Georgia, serif;
  --sans: "Inter", system-ui, -apple-system, sans-serif;
  --bar-h: 64px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #15171b;
    --surface: #1c1f24;
    --text: #e8e6e1;
    --muted: #a4a8b0;
    --faint: #7d828b;
    --line: #2c3037;
    --accent: #9db7e3;
    --accent-soft: #212835;
    --ok: #7cc99a;
    --ok-soft: #1b2a21;
    --err: #f2a49d;
    --err-soft: #2e1d1c;
  }
}

/* ───────────── Base ───────────── */
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 16px/1.65 var(--sans); -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 6px; }
.wrap { max-width: 800px; margin: 0 auto; padding: 0 20px; }
.print-only { display: none; }
.skip { position: absolute; left: -9999px; }
.skip:focus { left: 16px; top: 12px; z-index: 100; background: var(--surface); padding: 8px 14px; border-radius: 8px; }

/* ───────────── Top bar ───────────── */
.topbar {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(160%) blur(12px); -webkit-backdrop-filter: saturate(160%) blur(12px);
  border-bottom: 1px solid transparent;
  transition: border-color .2s, box-shadow .2s;
}
.topbar.scrolled { border-bottom-color: var(--line); box-shadow: 0 6px 24px -18px rgba(0,0,0,.35); }
.bar { max-width: 1080px; margin: 0 auto; padding: 0 20px; height: var(--bar-h); display: flex; align-items: center; gap: 16px; }

.brand { display: flex; align-items: center; gap: 10px; color: var(--text); flex-shrink: 0; }
.brand:hover { text-decoration: none; }
.mono {
  width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center;
  background: var(--accent); color: var(--bg); font: 600 14px/1 var(--serif); letter-spacing: .02em;
}
.brand-name { font: 600 16px/1.2 var(--serif); white-space: nowrap; }

.menu { display: flex; align-items: center; gap: 2px; margin-left: auto; }
.menu a {
  position: relative; padding: 8px 12px; border-radius: 8px;
  color: var(--muted); font-size: 14px; font-weight: 500; transition: color .15s, background .15s;
}
.menu a:hover { color: var(--text); background: var(--accent-soft); text-decoration: none; }
.menu a.active { color: var(--accent); }
.menu a.active::after {
  content: ""; position: absolute; left: 12px; right: 12px; bottom: 2px; height: 2px; border-radius: 2px; background: var(--accent);
}

.actions { display: flex; align-items: center; gap: 8px; }
.lang {
  display: inline-flex; padding: 3px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface);
}
.lang a, .lang span {
  font-size: 12px; font-weight: 600; letter-spacing: .04em; padding: 4px 9px; border-radius: 999px; color: var(--muted);
}
.lang a:hover { color: var(--text); text-decoration: none; }
.lang [aria-current] { background: var(--accent-soft); color: var(--accent); }

.icon-btn {
  width: 36px; height: 36px; display: grid; place-items: center; border-radius: 999px;
  border: 1px solid var(--line); background: var(--surface); color: var(--text); transition: border-color .15s, color .15s;
}
.icon-btn:hover { border-color: var(--accent); color: var(--accent); text-decoration: none; }
.cta {
  display: inline-flex; align-items: center; gap: 7px; height: 36px; padding: 0 16px; border-radius: 999px;
  background: var(--accent); color: var(--bg); font-size: 14px; font-weight: 600; white-space: nowrap;
  transition: transform .15s, box-shadow .15s;
}
.cta:hover { text-decoration: none; transform: translateY(-1px); box-shadow: 0 6px 16px -8px var(--accent); }

.burger {
  display: none; width: 38px; height: 38px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--surface); color: var(--text); cursor: pointer; padding: 0; place-items: center;
}
.burger svg { display: block; }
.burger .close { display: none; }
.topbar.open .burger .open-i { display: none; }
.topbar.open .burger .close { display: block; }

.progress { position: absolute; left: 0; bottom: -1px; height: 2px; width: 0; background: var(--accent); opacity: .7; }

@media (max-width: 880px) {
  .burger { display: grid; }
  .menu {
    position: absolute; top: var(--bar-h); left: 0; right: 0; margin: 0;
    flex-direction: column; align-items: stretch; gap: 2px; padding: 10px 16px 18px;
    background: var(--bg); border-bottom: 1px solid var(--line); box-shadow: 0 18px 30px -24px rgba(0,0,0,.4);
    opacity: 0; transform: translateY(-8px); pointer-events: none; transition: opacity .18s, transform .18s;
  }
  .topbar.open .menu { opacity: 1; transform: none; pointer-events: auto; }
  .menu a { padding: 12px 14px; font-size: 16px; }
  .menu a.active { background: var(--accent-soft); }
  .menu a.active::after { display: none; }
  .actions { margin-left: auto; }
}
@media (max-width: 520px) {
  .brand-name { display: none; }
  .icon-btn.pdf { display: none; }
  .cta { padding: 0 13px; }
  .cta .cta-icon { display: none; }
}

/* ───────────── Hero ───────────── */
.hero { padding: 64px 0 44px; }
.hero-grid { display: grid; grid-template-columns: 168px 1fr; gap: 36px; align-items: center; }
.hero img { width: 168px; height: 168px; border-radius: 50%; object-fit: cover; object-position: center 25%; border: 1px solid var(--line); }
.hero h1 { font: 600 40px/1.15 var(--serif); margin: 0 0 8px; letter-spacing: -0.01em; }
.hero .role { color: var(--muted); margin: 0 0 20px; font-size: 17px; }
.links { display: flex; gap: 10px; flex-wrap: wrap; }
.btn {
  display: inline-flex; align-items: center; gap: 8px; padding: 8px 16px; border-radius: 999px;
  font-size: 14px; font-weight: 500; border: 1px solid var(--line); color: var(--text); background: var(--surface);
}
.btn:hover { text-decoration: none; border-color: var(--accent); }
.btn.primary { background: var(--accent); color: var(--bg); border-color: var(--accent); }
@media (max-width: 640px) {
  .hero { padding: 40px 0 28px; }
  .hero-grid { grid-template-columns: 1fr; gap: 20px; }
  .hero img { width: 120px; height: 120px; }
  .hero h1 { font-size: 32px; }
}

/* ───────────── Sections ───────────── */
section { padding: 44px 0; border-top: 1px solid var(--line); scroll-margin-top: calc(var(--bar-h) - 1px); }
h2 {
  font: 600 12px/1.4 var(--sans); letter-spacing: 0.14em; text-transform: uppercase; color: var(--faint); margin: 0 0 24px;
}
h3 { font: 600 19px/1.35 var(--serif); margin: 0; }
p { margin: 0 0 14px; }
.lead { font-family: var(--serif); font-size: 19px; line-height: 1.6; }

.tags { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; padding: 0; list-style: none; }
.tags li { font-size: 13px; padding: 4px 12px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); }

.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { display: grid; grid-template-columns: 130px 1fr; gap: 20px; padding: 18px 0; }
.timeline li + li { border-top: 1px dashed var(--line); }
.when { color: var(--faint); font-size: 14px; padding-top: 3px; font-variant-numeric: tabular-nums; }
.where { color: var(--muted); font-size: 15px; margin: 2px 0 8px; }
.timeline p { font-size: 15px; margin: 0; }
.sub { margin-top: 40px; }
@media (max-width: 640px) { .timeline li { grid-template-columns: 1fr; gap: 4px; } }

.thesis { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 24px; }
.thesis .title { font: italic 18px/1.5 var(--serif); margin-bottom: 10px; }
.thesis ul { margin: 14px 0 0; padding-left: 20px; font-size: 15px; }
.thesis li { margin-bottom: 6px; }
.meta { color: var(--muted); font-size: 14px; }

.pubs { list-style: none; margin: 0; padding: 0; }
.pubs li { padding: 12px 0; font-size: 15px; }
.pubs li + li { border-top: 1px dashed var(--line); }
.pubs .yr { color: var(--faint); font-variant-numeric: tabular-nums; margin-right: 6px; }
.pubs em { font-family: var(--serif); }
.pubs .venue { color: var(--muted); }
h4 { font-size: 14px; font-weight: 600; margin: 26px 0 4px; }
h4:first-of-type { margin-top: 0; }

.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 28px; }
.grid2 ul { margin: 0; padding-left: 18px; font-size: 15px; }
.grid2 li { margin-bottom: 6px; }
@media (max-width: 640px) { .grid2 { grid-template-columns: 1fr; } }

/* ───────────── Contact ───────────── */
form { display: grid; gap: 14px; margin-top: 8px; }
form[hidden] { display: none; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 640px) { .row { grid-template-columns: 1fr; } }
label { font-size: 13px; color: var(--muted); display: block; margin-bottom: 6px; }
input, textarea {
  width: 100%; font: inherit; color: var(--text); background: var(--surface);
  border: 1px solid var(--line); border-radius: 8px; padding: 11px 13px;
}
input:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
textarea { min-height: 140px; resize: vertical; }
button.send {
  justify-self: start; font: 500 15px var(--sans); padding: 11px 24px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--accent); background: var(--accent); color: var(--bg);
}
button.send:disabled { opacity: .6; cursor: wait; }
.hp { position: absolute; left: -9999px; }
#form-status { font-size: 14px; margin: 0; }
#form-status:empty { display: none; }
#form-status.error {
  padding: 12px 14px; border-radius: 8px; color: var(--err); background: var(--err-soft);
  border: 1px solid color-mix(in srgb, var(--err) 30%, transparent);
}
.sent {
  margin-top: 8px; padding: 36px 28px; text-align: center; border-radius: 12px;
  background: var(--ok-soft); border: 1px solid color-mix(in srgb, var(--ok) 30%, transparent);
  animation: pop .35s ease-out;
}
.sent[hidden] { display: none; }
.sent .check { width: 56px; height: 56px; margin: 0 auto 14px; border-radius: 50%; display: grid; place-items: center; background: var(--ok); color: var(--bg); }
.sent h3 { font-size: 22px; margin-bottom: 8px; }
.sent p { color: var(--muted); margin: 0 auto 20px; max-width: 440px; }
.sent button {
  font: 500 15px var(--sans); padding: 10px 22px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--accent); background: transparent; color: var(--accent);
}
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(.98); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .sent { animation: none; } }

footer { padding: 32px 0 48px; border-top: 1px solid var(--line); color: var(--faint); font-size: 13px; }
footer .wrap { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }

/* ───────────── Print / PDF ───────────── */
@page { size: A4; margin: 12mm 15mm; }
@media print {
  :root {
    --bg: #fff; --surface: #fff; --text: #111; --muted: #444; --faint: #666; --line: #d9d9d9;
    --accent: #2c4a7a; --accent-soft: #eef2f8;
  }
  html, body { background: #fff; font-size: 9.5pt; line-height: 1.4; }
  p { margin-bottom: 6pt; }
  .meta { font-size: 9pt; }
  .tags { margin-top: 8pt; gap: 5pt; }
  h4 { font-size: 9.5pt; margin: 10pt 0 2pt; }
  .topbar, .links, #contact, footer, .skip, .cf-turnstile { display: none !important; }
  .print-only { display: block; }
  .wrap { max-width: none; padding: 0; }
  .hero { padding: 0 0 12pt; }
  .hero-grid { grid-template-columns: 82pt 1fr; gap: 18pt; }
  .hero img { width: 82pt; height: 82pt; }
  .hero h1 { font-size: 22pt; margin-bottom: 4pt; }
  .hero .role { font-size: 10.5pt; margin-bottom: 6pt; }
  .print-contact { font-size: 9.5pt; color: var(--muted); }
  section { padding: 8pt 0; break-inside: auto; }
  h2 { margin-bottom: 4pt; font-size: 8pt; color: var(--accent); }
  h3 { font-size: 10.5pt; }
  .lead { font-size: 10.5pt; line-height: 1.45; }
  .tags li { font-size: 8pt; padding: 0 6pt; }
  .timeline li { grid-template-columns: 70pt 1fr; gap: 10pt; padding: 4pt 0; break-inside: avoid; }
  .timeline p, .where, .pubs li, .thesis ul, .grid2 ul { font-size: 9pt; }
  .where { margin: 0 0 2pt; }
  .when { font-size: 8.5pt; padding-top: 1pt; }
  .thesis { padding: 8pt 10pt; break-inside: avoid; }
  .thesis .title { font-size: 10pt; margin-bottom: 4pt; }
  .thesis ul { margin-top: 6pt; }
  .thesis li, .grid2 li { margin-bottom: 2pt; }
  .pubs li { padding: 3pt 0; break-inside: avoid; }
  .sub { margin-top: 8pt; }
  .grid2 { gap: 16pt; }
  #skills, #competences { break-inside: avoid; }
  h2, h3, h4 { break-after: avoid; }
  a { color: inherit; }
}
