:root {
  --paper: #F4F2EC;
  --ink: #16150F;
  --accent: #D6462A;
  --muted: #6B675C;
  --body: #3E3B34;
  --body-2: #4A473F;
  --rule: rgba(0, 0, 0, 0.14);
  --mono: 'IBM Plex Mono', ui-monospace, monospace;
  --sans: 'Archivo', system-ui, sans-serif;

  --pad-x: 64px;
  --head-pad-y: 64px;
  --name-size: 66px;
  --lead-size: 24px;
}

@media (max-width: 859px) {
  :root { --pad-x: 40px; --head-pad-y: 40px; --name-size: 52px; --lead-size: 21px; }
}
@media (max-width: 559px) {
  :root { --pad-x: 24px; --name-size: 38px; --lead-size: 19px; }
}

*, *::before, *::after { box-sizing: border-box; }

html { background: var(--paper); }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, p, ul, address { margin: 0; }
address { font-style: normal; }
a { color: inherit; text-decoration: none; }
a:hover { text-decoration: underline; text-decoration-color: var(--accent); text-underline-offset: 3px; }
::selection { background: var(--accent); color: #fff; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Language toggle: hide whichever language is not active */
html[data-lang="en"] [data-l="pt"],
html[data-lang="pt"] [data-l="en"] { display: none !important; }

.page {
  width: 100%;
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 var(--pad-x);
}

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

/* Header */
.masthead {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 32px;
  padding: var(--head-pad-y) 0 40px;
  border-bottom: 2px solid var(--ink);
}
.identity { display: flex; gap: 28px; align-items: flex-start; }
.identity-text { display: flex; flex-direction: column; gap: 14px; }

.portrait {
  position: relative;
  flex: none;
  width: 112px;
  height: 140px;
  background: color-mix(in srgb, var(--ink) 8%, transparent);
  border: 1px solid color-mix(in srgb, var(--ink) 25%, transparent);
  display: grid;
  place-items: center;
  overflow: hidden;
}
.portrait span { font-family: var(--mono); font-size: 20px; letter-spacing: 0.08em; color: var(--muted); }
.portrait img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: 46% 50%; }

h1 {
  font-size: var(--name-size);
  font-weight: 700;
  letter-spacing: -0.035em;
  line-height: 0.92;
}
.role { font-size: 19px; font-weight: 500; color: var(--accent); }

.contact { display: flex; flex-direction: column; gap: 14px; align-items: flex-end; }
.contact-list {
  display: flex;
  flex-direction: column;
  gap: 5px;
  align-items: flex-end;
  font-size: 14px;
  line-height: 1.45;
}

.lang-switch { display: flex; gap: 6px; font-family: var(--mono); font-size: 12px; letter-spacing: 0.06em; }
.lang-switch button {
  background: var(--ink);
  color: var(--paper);
  border: none;
  padding: 8px 14px;
  cursor: pointer;
  font: inherit;
  opacity: 0.35;
  transition: opacity 0.15s;
}
.lang-switch button:hover,
.lang-switch button[aria-pressed="true"] { opacity: 1; }

.downloads { display: flex; gap: 8px; font-family: var(--mono); font-size: 11px; letter-spacing: 0.05em; }
.downloads a { border: 1px solid var(--ink); padding: 7px 12px; }
.downloads a:hover { background: var(--ink); color: var(--paper); text-decoration: none; }

@media (max-width: 859px) {
  .masthead { flex-direction: column; align-items: stretch; }
  .contact, .contact-list { align-items: flex-start; }
}
@media (max-width: 559px) {
  .identity { flex-direction: column; gap: 20px; }
}

/* Sections */
.section {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 0 48px;
  padding: 34px 0;
  border-bottom: 1px solid var(--rule);
}
.section:first-child { padding-top: 38px; }

/* Sections are numbered automatically; hidden ones don't take a number */
main { counter-reset: section; }
.section { counter-increment: section; }
.label::before { content: counter(section, decimal-leading-zero) " — "; }
.projects-section:not(:has(.project)) { display: none; }
.section:last-child { border-bottom: none; }

.label {
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 400;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  padding-top: 6px;
}

.lead {
  font-size: var(--lead-size);
  line-height: 1.42;
  letter-spacing: -0.012em;
  text-wrap: pretty;
}

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px 40px;
  font-size: 15px;
  line-height: 1.55;
}
.grid-2.edu { gap: 28px 40px; }
.item-title { font-size: inherit; font-weight: 600; }
.grid-2:not(.edu) .item-title { margin-bottom: 4px; }
.body-2 { color: var(--body-2); }

@media (max-width: 859px) {
  .section { grid-template-columns: 1fr; gap: 14px; }
}
@media (max-width: 559px) {
  .grid-2 { grid-template-columns: 1fr; }
}

/* Experience */
.jobs { display: flex; flex-direction: column; gap: 30px; }
.job-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: baseline;
  gap: 6px 24px;
}
.job h3 { font-size: 22px; font-weight: 600; letter-spacing: -0.02em; }
.date { font-family: var(--mono); font-size: 12px; color: var(--muted); white-space: nowrap; }
.job ul {
  margin-top: 10px;
  padding-left: 17px;
  font-size: 15px;
  line-height: 1.6;
  color: var(--body);
  display: flex;
  flex-direction: column;
  gap: 7px;
}

/* Projects */
.projects { gap: 16px; }
.project {
  display: flex;
  flex-direction: column;
  gap: 7px;
  padding: 20px;
  border: 1px dashed rgba(0, 0, 0, 0.3);
  transition: border-color 0.15s;
}
.project:hover { border-color: var(--accent); text-decoration: none; }
.project-title { font-size: 18px; font-weight: 600; }
.project-desc { font-size: 14px; color: var(--muted); line-height: 1.5; }
.project-link { font-family: var(--mono); font-size: 11px; color: var(--accent); }

/* Footer */
.footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 12px;
  padding: 28px 0 48px;
  border-top: 2px solid var(--ink);
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  color: var(--muted);
}

@media print {
  .lang-switch, .downloads { display: none; }
  .project { border-style: solid; }
}
