/* ---------- Tokens ---------- */
:root {
  --bg: #f6f4ef;
  --bg-alt: #efece4;
  --surface: #fffdf8;
  --ink: #17171a;
  --ink-2: #3a3936;
  --muted: #6b6862;
  --line: #e2ddd2;
  --accent: #d9481f;
  --accent-soft: #f6dfd3;
  --on-accent: #fffaf5;
  --grid: #d9d4c8;
  --wall: #2a2a2e;
  --explored: rgba(217, 72, 31, .13);
  --shadow: 0 1px 0 rgba(0,0,0,.03), 0 18px 40px -24px rgba(30,20,10,.25);

  --serif: "Instrument Serif", "Iowan Old Style", Georgia, serif;
  --sans: "Geist", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "Geist Mono", ui-monospace, "SF Mono", Menlo, monospace;

  --wrap: 1160px;
  --gutter: clamp(16px, 4vw, 40px);
  --radius: 18px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0e0f11;
    --bg-alt: #131417;
    --surface: #17181b;
    --ink: #edebe6;
    --ink-2: #cfccc5;
    --muted: #96938b;
    --line: #26272b;
    --accent: #ff7a4d;
    --accent-soft: #3a1f15;
    --on-accent: #1a0d07;
    --grid: #2b2c31;
    --wall: #d6d3cb;
    --explored: rgba(255, 122, 77, .14);
    --shadow: 0 1px 0 rgba(255,255,255,.02), 0 24px 50px -28px rgba(0,0,0,.8);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0e0f11;
  --bg-alt: #131417;
  --surface: #17181b;
  --ink: #edebe6;
  --ink-2: #cfccc5;
  --muted: #96938b;
  --line: #26272b;
  --accent: #ff7a4d;
  --accent-soft: #3a1f15;
  --on-accent: #1a0d07;
  --grid: #2b2c31;
  --wall: #d6d3cb;
  --explored: rgba(255, 122, 77, .14);
  --shadow: 0 1px 0 rgba(255,255,255,.02), 0 24px 50px -28px rgba(0,0,0,.8);
  color-scheme: dark;
}

/* ---------- Language switch ---------- */
html[data-lang="pt"] [data-l="en"],
html[data-lang="en"] [data-l="pt"] { display: none !important; }

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 84px; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  transition: background-color .3s ease, color .3s ease;
}
img, svg, canvas { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
h1, h2, h3, h4 { margin: 0; font-weight: 500; }
p { margin: 0; }
ul, ol { margin: 0; padding: 0; list-style: none; }
em { font-style: italic; }
strong { font-weight: 600; }
::selection { background: var(--accent); color: var(--on-accent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 6px; }

.wrap { width: 100%; max-width: var(--wrap); margin: 0 auto; padding: 0 var(--gutter); }
.mono { font-family: var(--mono); font-size: .78rem; letter-spacing: .02em; }

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

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: .5em;
  padding: .85em 1.35em;
  border-radius: 999px;
  background: var(--ink); color: var(--bg);
  font-weight: 500; font-size: .95rem;
  border: 1px solid var(--ink);
  transition: transform .2s ease, background-color .2s ease, color .2s ease, border-color .2s ease;
}
.btn:hover { background: var(--accent); border-color: var(--accent); color: var(--on-accent); transform: translateY(-1px); }
.btn--ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn--ghost:hover { background: var(--surface); color: var(--ink); border-color: var(--ink); }
.btn--sm { padding: .55em 1.05em; font-size: .85rem; }

.icon-btn, .chip {
  display: inline-flex; align-items: center; justify-content: center;
  height: 36px; border-radius: 999px;
  border: 1px solid var(--line); background: transparent; color: var(--ink);
  cursor: pointer; transition: border-color .2s, background-color .2s;
}
.icon-btn { width: 36px; }
.icon-btn:hover, .chip:hover { border-color: var(--ink); }
.chip { padding: 0 12px; gap: 4px; font-family: var(--mono); font-size: .75rem; }
.chip__sep { color: var(--muted); }
.chip__opt { color: var(--muted); transition: color .2s; }
html[data-lang="pt"] .chip__opt[data-opt="pt"],
html[data-lang="en"] .chip__opt[data-opt="en"] { color: var(--ink); font-weight: 500; }

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

.link-arrow {
  display: inline-flex; align-items: center; gap: .35em;
  font-weight: 500; border-bottom: 1px solid var(--line); padding-bottom: 2px;
  transition: border-color .2s, color .2s;
}
.link-arrow:hover { color: var(--accent); border-color: var(--accent); }
.link-btn { background: none; border: 0; border-bottom: 1px solid var(--line); font: inherit; color: inherit; cursor: pointer; padding: 0 0 2px; }

/* ---------- Nav ---------- */
.nav {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(1.4) blur(14px);
  -webkit-backdrop-filter: saturate(1.4) blur(14px);
  border-bottom: 1px solid transparent;
  transition: border-color .3s, background-color .3s;
}
.nav.is-scrolled { border-bottom-color: var(--line); }
.nav__inner { display: flex; align-items: center; gap: 24px; height: 68px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 500; }
.brand__mark {
  display: grid; place-items: center; width: 32px; height: 32px; border-radius: 9px;
  background: var(--ink); color: var(--bg);
  font-family: var(--serif); font-size: 1.05rem; letter-spacing: .02em;
}
.nav__links { display: flex; gap: 4px; margin-left: auto; }
.nav__links a {
  padding: 6px 12px; border-radius: 999px; font-size: .9rem; color: var(--muted);
  transition: color .2s, background-color .2s;
}
.nav__links a:hover, .nav__links a.is-active { color: var(--ink); background: var(--surface); }
.nav__tools { display: flex; align-items: center; gap: 8px; }

@media (max-width: 860px) {
  .nav__links { display: none; }
  .nav__tools { margin-left: auto; }
}
@media (max-width: 420px) {
  .brand__name { display: none; }
}

/* ---------- Hero ---------- */
.hero { padding: clamp(48px, 9vw, 110px) 0 clamp(56px, 8vw, 96px); position: relative; }
.hero::before {
  content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background-image: radial-gradient(var(--grid) 1px, transparent 1px);
  background-size: 28px 28px;
  mask-image: radial-gradient(ellipse 80% 60% at 70% 30%, #000 20%, transparent 75%);
  -webkit-mask-image: radial-gradient(ellipse 80% 60% at 70% 30%, #000 20%, transparent 75%);
  opacity: .7;
}
.hero__grid { display: grid; grid-template-columns: 1.15fr .85fr; gap: clamp(32px, 5vw, 72px); align-items: center; }
.eyebrow {
  display: inline-flex; align-items: center; gap: 10px;
  font-family: var(--mono); font-size: .78rem; color: var(--muted);
  padding: 6px 12px 6px 10px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface);
}
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); animation: pulse 2.4s ease-in-out infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 7px transparent; } }

.hero__title {
  font-family: var(--serif); font-weight: 400;
  font-size: clamp(2.6rem, 6.4vw, 5.1rem);
  line-height: 1.02; letter-spacing: -.02em;
  margin: 26px 0 26px;
}
.hero__title em, .section__title em, .contact__title em { color: var(--accent); }
.hero__lead { font-size: clamp(1.02rem, 1.4vw, 1.14rem); color: var(--ink-2); max-width: 58ch; }
.hero__cta { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 34px; }

/* Planner card */
.planner {
  margin: 0; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden;
}
.planner__bar {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px; border-bottom: 1px solid var(--line); color: var(--muted);
}
.planner__dots { display: flex; gap: 6px; }
.planner__dots i { width: 9px; height: 9px; border-radius: 50%; background: var(--line); }
.planner__status { margin-left: auto; color: var(--accent); }
#planner { width: 100%; aspect-ratio: 4 / 3.2; }
.planner__cap { padding: 12px 16px 14px; color: var(--muted); border-top: 1px solid var(--line); font-size: .72rem; }

/* Stats */
.stats {
  display: grid; grid-template-columns: repeat(4, 1fr);
  margin: clamp(56px, 8vw, 96px) 0 0;
  border-top: 1px solid var(--line);
}
.stat { padding: 24px 24px 0 0; display: flex; flex-direction: column-reverse; gap: 6px; }
.stat + .stat { padding-left: 24px; border-left: 1px solid var(--line); }
.stat dt { color: var(--muted); font-size: .9rem; }
.stat dd { margin: 0; font-family: var(--serif); font-size: clamp(2.4rem, 4.4vw, 3.4rem); line-height: 1; }
.stat dd small { font-family: var(--sans); font-size: .95rem; color: var(--muted); margin-left: 2px; }

@media (max-width: 900px) {
  .hero__grid { grid-template-columns: 1fr; }
  .planner { max-width: 560px; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .stat:nth-child(3) { padding-left: 0; border-left: 0; }
  .stat:nth-child(n+3) { border-top: 1px solid var(--line); margin-top: 24px; }
}

/* ---------- Sections ---------- */
.section { padding: clamp(72px, 10vw, 128px) 0; }
.section--alt { background: var(--bg-alt); }
.section__head { margin-bottom: clamp(36px, 5vw, 60px); max-width: 760px; }
.kicker { color: var(--accent); text-transform: uppercase; letter-spacing: .12em; font-size: .72rem; margin-bottom: 18px; }
.section__title {
  font-family: var(--serif); font-weight: 400;
  font-size: clamp(2rem, 4.2vw, 3.3rem); line-height: 1.08; letter-spacing: -.015em;
}
.section__sub { margin-top: 20px; color: var(--ink-2); max-width: 60ch; }

.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(32px, 6vw, 88px); align-items: start; }
.two-col .section__head { margin-bottom: 0; position: sticky; top: 110px; }
@media (max-width: 900px) {
  .two-col { grid-template-columns: 1fr; }
  .two-col .section__head { position: static; }
}

.prose p { color: var(--ink-2); }
.prose p + p { margin-top: 1.1em; }
.prose strong { color: var(--ink); }

/* Pillars */
.pillars { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; margin-top: clamp(56px, 7vw, 88px); }
.pillar {
  position: relative; padding: 30px 28px 32px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  transition: transform .3s ease, border-color .3s ease;
}
.pillar:hover { transform: translateY(-4px); border-color: var(--ink); }
.pillar__num {
  display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px;
  background: var(--accent-soft); color: var(--accent); margin-bottom: 26px; font-weight: 500;
}
.pillar h3 { font-size: 1.2rem; margin-bottom: 10px; }
.pillar p { color: var(--muted); font-size: .96rem; }
@media (max-width: 900px) { .pillars { grid-template-columns: 1fr; } }

.callout {
  margin-top: 18px; padding: clamp(28px, 4vw, 44px);
  border-radius: var(--radius); background: var(--ink); color: var(--bg);
}
.callout .kicker { color: var(--accent); }
.callout__text { font-family: var(--serif); font-size: clamp(1.35rem, 2.6vw, 2rem); line-height: 1.25; max-width: 34ch; }

/* ---------- Timeline ---------- */
.timeline { position: relative; }
.job {
  display: grid; grid-template-columns: 200px 1fr; gap: 32px;
  padding: 34px 0; border-top: 1px solid var(--line);
}
.job:last-child { border-bottom: 1px solid var(--line); }
.job__meta { display: flex; flex-direction: column; gap: 4px; color: var(--muted); padding-top: 6px; }
.job__meta .mono { color: var(--ink); font-size: .82rem; }
.job__place { font-size: .88rem; }
.job__org { font-family: var(--serif); font-size: clamp(1.6rem, 2.6vw, 2.1rem); font-weight: 400; line-height: 1.1; margin-bottom: 14px; }
.role + .role { margin-top: 22px; padding-top: 22px; border-top: 1px dashed var(--line); }
.role__head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px 12px; margin-bottom: 8px; }
.role__head h4 { font-size: 1.05rem; font-weight: 600; }
.role__date { color: var(--muted); margin-left: auto; }
.role p { color: var(--ink-2); max-width: 70ch; }
.tag {
  font-family: var(--mono); font-size: .68rem; text-transform: uppercase; letter-spacing: .08em;
  padding: 3px 8px; border-radius: 999px; border: 1px solid var(--line); color: var(--muted);
}
.tag--accent { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.ticks { margin-top: 14px; display: grid; gap: 8px; }
.ticks li { position: relative; padding-left: 22px; color: var(--ink-2); font-size: .96rem; }
.ticks li::before {
  content: ""; position: absolute; left: 2px; top: .62em; width: 9px; height: 1.5px; background: var(--accent);
}
.job--featured .job__org::after {
  content: ""; display: inline-block; width: 10px; height: 10px; border-radius: 50%;
  background: var(--accent); margin-left: 12px; vertical-align: middle; box-shadow: 0 0 0 5px var(--accent-soft);
}
@media (max-width: 760px) {
  .job { grid-template-columns: 1fr; gap: 10px; }
  .job__meta { flex-direction: row; gap: 12px; padding-top: 0; }
  .role__date { margin-left: 0; width: 100%; }
}

/* ---------- Leadership ---------- */
.lead-cards { display: grid; gap: 16px; }
.lead-card {
  padding: 28px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface);
  transition: border-color .3s;
}
.lead-card:hover { border-color: var(--accent); }
.lead-card__date { color: var(--accent); margin-bottom: 10px; }
.lead-card h3 { font-size: 1.12rem; font-weight: 600; margin-bottom: 8px; }
.lead-card__path { color: var(--ink); margin-bottom: 10px; font-size: .95rem; }
.lead-card p:last-child { color: var(--muted); font-size: .95rem; }

/* ---------- Research (inverted) ---------- */
.section--ink { background: var(--ink); color: var(--bg); }
.section--ink .section__sub { color: color-mix(in srgb, var(--bg) 72%, var(--ink)); }
.section--ink .kicker { color: var(--accent); }
.research { display: grid; grid-template-columns: .8fr 1.2fr; gap: clamp(32px, 6vw, 80px); }
.small-title { text-transform: uppercase; letter-spacing: .12em; font-size: .7rem; color: var(--muted); margin-bottom: 18px; font-weight: 500; }
.small-title--gap { margin-top: 34px; }
.section--ink .small-title { color: color-mix(in srgb, var(--bg) 55%, var(--ink)); }
.tags { display: flex; flex-wrap: wrap; gap: 8px; }
.tags li {
  padding: 7px 13px; border-radius: 999px; font-size: .86rem;
  border: 1px solid color-mix(in srgb, var(--bg) 22%, var(--ink));
}
.tags--plain li { border-color: var(--line); color: var(--ink-2); }
.research__links { display: flex; gap: 22px; margin-top: 30px; }
.section--ink .link-arrow { border-color: color-mix(in srgb, var(--bg) 30%, var(--ink)); }
.pubs li {
  display: grid; grid-template-columns: 42px 1fr; gap: 12px; align-items: baseline;
  padding: 20px 0; border-top: 1px solid color-mix(in srgb, var(--bg) 16%, var(--ink));
  font-family: var(--serif); font-size: clamp(1.15rem, 1.9vw, 1.45rem); line-height: 1.25;
  transition: color .2s;
}
.pubs li:last-child { border-bottom: 1px solid color-mix(in srgb, var(--bg) 16%, var(--ink)); }
.pubs li:hover { color: var(--accent); }
.pubs__n { color: var(--accent); font-size: .74rem; }
@media (max-width: 900px) { .research { grid-template-columns: 1fr; } }

/* ---------- Education ---------- */
.edu-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.edu { padding: 30px 28px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.edu__list { display: grid; gap: 20px; }
.edu__list li { display: grid; gap: 3px; }
.edu__list strong { font-weight: 600; font-size: 1rem; line-height: 1.35; }
.edu__list span { color: var(--muted); font-size: .9rem; }
.edu__plain { display: grid; gap: 10px; }
.edu__plain li { color: var(--ink-2); font-size: .95rem; padding-left: 18px; position: relative; }
.edu__plain li::before { content: ""; position: absolute; left: 0; top: .65em; width: 6px; height: 6px; border-radius: 50%; border: 1.5px solid var(--accent); }
.langs { display: grid; gap: 14px; }
.langs li { display: grid; grid-template-columns: 92px 1fr; gap: 4px 12px; align-items: center; font-size: .95rem; }
.langs small { grid-column: 2; color: var(--muted); font-size: .8rem; }
.meter { height: 4px; border-radius: 4px; background: var(--line); position: relative; overflow: hidden; }
.meter::after { content: ""; position: absolute; inset: 0; width: calc(var(--v) * 100%); background: var(--accent); border-radius: 4px; }
@media (max-width: 1000px) { .edu-grid { grid-template-columns: 1fr 1fr; } .edu:last-child { grid-column: 1 / -1; } }
@media (max-width: 680px) { .edu-grid { grid-template-columns: 1fr; } }

/* ---------- Contact ---------- */
.contact { padding-bottom: clamp(80px, 10vw, 140px); }
.contact__inner { text-align: center; display: flex; flex-direction: column; align-items: center; }
.contact__title {
  font-family: var(--serif); font-weight: 400;
  font-size: clamp(2.2rem, 5.6vw, 4.4rem); line-height: 1.05; letter-spacing: -.02em; max-width: 18ch;
}
.contact__mail {
  margin-top: 36px; font-size: clamp(1.15rem, 2.6vw, 1.7rem); font-weight: 500;
  border-bottom: 2px solid var(--accent); padding-bottom: 4px; transition: color .2s;
  overflow-wrap: anywhere;
}
.contact__mail:hover { color: var(--accent); }
.contact__links { display: flex; flex-wrap: wrap; justify-content: center; gap: 26px; margin-top: 34px; }

/* ---------- Footer ---------- */
.footer { border-top: 1px solid var(--line); padding: 26px 0; color: var(--muted); font-size: .88rem; }
.footer__inner { display: flex; flex-wrap: wrap; gap: 12px 24px; justify-content: space-between; }
.footer a:hover { color: var(--ink); }

/* ---------- Toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px);
  background: var(--ink); color: var(--bg); padding: 10px 18px; border-radius: 999px;
  font-size: .9rem; opacity: 0; pointer-events: none; transition: opacity .25s, transform .25s; z-index: 60;
}
.toast.is-on { opacity: 1; transform: translate(-50%, 0); }

/* ---------- Reveal ---------- */
.js .reveal { opacity: 0; transform: translateY(18px); transition: opacity .8s cubic-bezier(.2,.7,.2,1), transform .8s cubic-bezier(.2,.7,.2,1); }
.js .reveal.is-in { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .js .reveal { opacity: 1; transform: none; transition: none; }
  .dot { animation: none; }
  .pillar:hover { transform: none; }
}

/* In dark mode the research band inverts to light — deepen the accent for contrast */
:root[data-theme="dark"] .section--ink { --accent: #c2410c; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .section--ink { --accent: #c2410c; }
}

/* Prevent long content from widening grid tracks on small screens */
.hero__grid > *, .two-col > *, .research > *, .job > * { min-width: 0; }
.eyebrow { flex-wrap: wrap; max-width: 100%; line-height: 1.4; }
@media (max-width: 520px) {
  .nav__tools .btn--sm { display: none; }
  .eyebrow { border-radius: 14px; }
}
@media (max-width: 520px) {
  .eyebrow { display: inline-block; }
  .eyebrow .dot { display: inline-block; vertical-align: middle; margin: -2px 8px 0 2px; }
  .planner__status { white-space: nowrap; font-size: .7rem; }
}
