:root {
  --bg: #fafaf9;
  --card: #ffffff;
  --ink: #1c1917;
  --muted: #57534e;
  --line: #e7e5e4;
  --accent: #0b6b5f;
  --accent-ink: #ffffff;
  --accent-soft: #e6f2f0;
  --radius: 8px;
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Inter, Roboto, "Helvetica Neue", Arial, sans-serif;
}
:root[data-theme="dark"] { color-scheme: dark; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #12100f; --card: #1c1917; --ink: #f5f5f4; --muted: #a8a29e;
    --line: #2e2a27; --accent: #5eead4; --accent-ink: #042f2a; --accent-soft: #17302c;
  }
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } * { transition: none !important; } }

body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 21.33px/1.6 var(--font); -webkit-font-smoothing: antialiased;
}
.wrap { width: 100%; max-width: 820px; margin: 0 auto; padding: 0 16px; }

.skip { position: absolute; left: -999px; top: 0; background: var(--ink); color: var(--bg); padding: 8px 12px; z-index: 10; }
.skip:focus { left: 8px; top: 8px; }

a { color: var(--accent); text-underline-offset: 3px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

/* topo */
.top { border-bottom: 1px solid var(--line); background: var(--bg); position: sticky; top: 0; z-index: 5; }
.top-row { display: flex; align-items: center; justify-content: space-between; min-height: 56px; }
.brand { font-weight: 600; letter-spacing: -0.01em; }
.lang { display: flex; gap: 4px; }
.lang a {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 44px; min-height: 44px; border: 1px solid transparent; color: var(--muted);
  font-size: 19.33px; font-weight: 600; border-radius: var(--radius); text-decoration: none;
  transition: color .15s, background-color .15s;
}
.lang a:hover { color: var(--ink); }
.lang a[aria-current="page"] { color: var(--accent); background: var(--accent-soft); }

/* hero */
.hero { padding-top: 56px; padding-bottom: 40px; }
.hero-row { display: flex; flex-direction: column; align-items: center; gap: 12px; text-align: center; }
.portrait { width: 128px; height: 128px; border-radius: 50%; object-fit: cover; object-position: center; flex: none; border: 1px solid var(--line); }
.portrait[hidden] { display: none; }
@media (min-width: 768px) { .portrait { width: 160px; height: 160px; } }
.eyebrow { margin: 0 0 12px; font-size: 14px; color: var(--muted); }
h1 { margin: 0; font-size: clamp(40px, 9vw, 60px); line-height: 1.1; letter-spacing: -0.03em; font-weight: 600; }
.role { display: block; margin: 16px 0 0; font-size: 23.33px; font-weight: 500; letter-spacing: 0; line-height: 1.45; }
.role span { display: block; }
.role span::before { content: "\2022"; margin-right: .6em; color: var(--accent); }
.lead { margin: 24px 0 0; max-width: 56ch; color: var(--muted); font-size: 23.33px; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 28px; }

/* botões */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 16px; border-radius: var(--radius); border: 1px solid transparent;
  font: inherit; font-size: 20.33px; font-weight: 600; text-decoration: none; cursor: pointer;
  transition: background-color .15s, border-color .15s, color .15s;
}
.btn.primary { background: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.secondary { border-color: var(--line); background: var(--card); color: var(--ink); }
.btn.secondary:hover { border-color: var(--muted); }
.btn.ghost { color: var(--ink); }
.btn.ghost:hover { background: var(--accent-soft); }
.btn:active { transform: scale(0.98); }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.ico { width: 20px; height: 20px; }

/* secções */
.sect { scroll-margin-top: 56px; padding-top: 40px; padding-bottom: 40px; border-top: 1px solid var(--line); }
h2 { margin: 0 0 16px; font-size: 27.33px; letter-spacing: -0.02em; font-weight: 600; }
h3 { margin: 0; font-size: 22.33px; font-weight: 600; }
.prose { max-width: 62ch; }
.prose p { margin: 0 0 12px; }
.muted { color: var(--muted); font-size: 20.33px; margin: 0; }

/* CV */
.tabs { display: flex; gap: 4px; margin: 20px 0 16px; border-bottom: 1px solid var(--line); }
.tabs button {
  min-height: 44px; padding: 0 16px; border: 0; border-bottom: 2px solid transparent; background: none;
  color: var(--muted); font: inherit; font-weight: 600; cursor: pointer; margin-bottom: -1px;
  transition: color .15s, border-color .15s;
}
.tabs button:hover { color: var(--ink); }
.tabs button[aria-selected="true"] { color: var(--accent); border-bottom-color: var(--accent); }
.cv-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.viewer summary {
  display: flex; align-items: center; min-height: 44px; cursor: pointer; font-weight: 600; color: var(--accent);
  list-style: none;
}
.viewer summary::-webkit-details-marker { display: none; }
.viewer summary::before { content: "+"; display: inline-block; width: 20px; font-weight: 600; }
.viewer[open] summary::before { content: "\2212"; }
.viewer iframe { display: none; width: min(1000px, calc(100vw - 32px)); position: relative; left: 50%; transform: translateX(-50%); height: 90vh; min-height: 640px; margin-top: 8px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); }
.viewer-fallback { display: block; margin-top: 8px; }
@media (min-width: 768px) {
  .viewer iframe { display: block; }
  .viewer-fallback { display: none; }
}

/* projetos */
.projects { list-style: none; margin: 0; padding: 0; }
.projects li { padding: 16px 0; border-bottom: 1px solid var(--line); }
.projects li:last-child { border-bottom: 0; }
.projects p { margin: 4px 0 0; color: var(--muted); max-width: 62ch; }
.projects h3 a { text-decoration: none; }
.projects h3 a:hover { text-decoration: underline; }
.projects h3 a::after { content: " ↗"; font-weight: 400; }

/* bot + contacto */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; }
.ask p { margin: 0 0 16px; max-width: 56ch; }
.links { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.links a { display: inline-block; padding: 8px 0; min-height: 44px; }

.foot { padding-top: 24px; padding-bottom: 48px; border-top: 1px solid var(--line); }

@media (min-width: 768px) {
  .hero { padding-top: 96px; padding-bottom: 64px; }
  .sect { padding-top: 56px; padding-bottom: 56px; }
}

/* competências */
.skills { list-style: none; margin: 0; padding: 0; display: grid; gap: 16px; }
.skills h3 { font-size: 20.33px; color: var(--accent); }
.skills p { margin: 4px 0 0; color: var(--muted); max-width: 62ch; }

/* QR */
.qr { display: flex; align-items: center; gap: 16px; margin: 24px 0 0; }
.qr img { width: 140px; height: 140px; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); flex: none; }
.qr figcaption { color: var(--muted); font-size: 20.33px; max-width: 28ch; }
.qr figcaption a { display: inline-block; padding: 8px 0; min-height: 44px; }

/* tudo centrado */
.hero, .sect, .foot { text-align: center; }
.hero .lead, .prose, .skills p, .projects p, .ask p { margin-left: auto; margin-right: auto; }
.actions, .cv-actions { justify-content: center; }
.tabs { justify-content: center; }
.skills li, .projects li { text-align: center; }
.links { justify-items: center; }
.viewer summary { justify-content: center; }
.viewer summary::before { margin-right: 4px; width: auto; }
.qr { flex-direction: column; text-align: center; }
.qr figcaption { max-width: 32ch; }

/* botões de contacto */
.btn.linkedin { background: #0a66c2; color: #fff; }
.btn.linkedin:hover { filter: brightness(1.12); }
.btn.mail { background: #fff; color: #1c1917; border-color: #e7e5e4; }
.btn.mail:hover { background: #f5f5f4; }

/* contactos em texto, para copiar e colar */
.contacts { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; justify-items: center; }
.contacts li { display: flex; align-items: center; justify-content: center; gap: 12px; min-height: 44px; }
.contacts .ico { color: var(--accent); flex: none; width: 24px; height: 24px; }
.contacts a { color: var(--ink); overflow-wrap: anywhere; user-select: all; }

/* certificações */
.certs { list-style: none; margin: 24px 0 0; padding: 0; display: grid; gap: 28px; }
.certs img { display: block; margin: 0 auto 12px; width: 64px; height: 48px; padding: 6px 8px; background: #fff; border-radius: var(--radius); object-fit: contain; }
.certs .meta { font-size: 18px; }
.certs h3 { font-size: 22.33px; }
.certs p { margin: 4px auto 0; color: var(--muted); max-width: 62ch; }

/* topo: nome à esquerda, línguas ao centro */
@media (min-width: 640px) {
  .top-row { display: grid; grid-template-columns: 1fr auto 1fr; }
  .top-row .brand { justify-self: start; }
  .top-row .lang { justify-self: center; }
}
