:root {
  color-scheme: light dark;
  --bg: #f6f5f0;
  --surface: #fffefa;
  --ink: #17211d;
  --muted: #56635d;
  --line: #d9d8cf;
  --accent: #0f6b4f;
  --accent-ink: #ffffff;
  --copper: #a85a22;
  --sans: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #101614;
    --surface: #161e1b;
    --ink: #e7ece9;
    --muted: #9aa8a1;
    --line: #2b3632;
    --accent: #5ccfa3;
    --accent-ink: #08130f;
    --copper: #dd9c68;
  }
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 1rem/1.6 var(--sans);
}

a { color: inherit; text-underline-offset: 3px; text-decoration-color: var(--accent); }
a:hover { color: var(--accent); }
a:focus-visible, button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

h1, h2, h3, p, ul { margin: 0; padding: 0; }
ul { list-style: none; }

.page {
  max-width: 1040px;
  margin: 0 auto;
  padding: 0 32px;
}

/* Navegação */
.site-nav {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding-top: 16px;
}

.site-nav a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 12px;
  border-bottom: 2px solid transparent;
  font: 500 .875rem/1 var(--mono);
  text-decoration: none;
}

.site-nav a[aria-current="page"] { border-bottom-color: var(--accent); color: var(--accent); }

/* Cabeçalho */
.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 48px;
  align-items: center;
  padding: 40px 0 48px;
}

.eyebrow {
  color: var(--accent);
  font: 500 .875rem/1.4 var(--mono);
}

h1 {
  margin-top: 8px;
  font-size: clamp(2.75rem, 7vw, 4.5rem);
  font-weight: 700;
  line-height: 1.05;
  letter-spacing: -.02em;
}

.focus {
  margin-top: 12px;
  color: var(--muted);
  font-size: 1.25rem;
  line-height: 1.4;
}

.contact {
  display: grid;
  gap: 2px;
  margin-top: 24px;
  font: 400 .875rem/1.7 var(--mono);
}

.contact a { overflow-wrap: anywhere; }

.email-line { display: flex; flex-wrap: wrap; align-items: center; gap: 0 4px; }

/* Texto discreto, com área de toque de 44 px que não empurra as linhas vizinhas. */
.copy-email {
  min-height: 44px;
  margin: -10px 0;
  padding: 0 8px;
  border: 0;
  background: transparent;
  color: var(--accent);
  font: 500 .8125rem/1 var(--mono);
  cursor: pointer;
}

.copy-email:hover { text-decoration: underline; }

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 24px;
}

.btn {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 20px;
  border: 1px solid var(--ink);
  border-radius: 4px;
  background: transparent;
  color: var(--ink);
  font: 500 .9375rem/1 var(--sans);
  text-decoration: none;
  cursor: pointer;
}

.btn:hover { border-color: var(--accent); color: var(--accent); }

.btn-primary {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--accent-ink);
}

.btn-primary:hover { color: var(--accent-ink); opacity: .9; }

/* Pinagem */
.pinout { display: block; width: 100%; height: auto; }
.pinout text { font-family: var(--mono); }
.pins path { fill: none; stroke: var(--copper); stroke-width: 3; }
.package { fill: var(--surface); stroke: var(--ink); stroke-width: 1.5; }
.notch { fill: none; stroke: var(--ink); stroke-width: 1.5; }
.pin-no text { fill: var(--muted); font-size: 11px; }
.pin-label text { fill: var(--ink); font-size: 13px; }
.chip-mark { fill: var(--accent); font-size: 36px; font-weight: 500; }
.chip-sub { fill: var(--muted); font-size: 11px; }

/* Destaques */
.highlights {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border-block: 1px solid var(--ink);
}

.highlights li {
  display: grid;
  align-content: start;
  gap: 4px;
  padding: 20px 24px;
  border-left: 1px solid var(--line);
}

.highlights li:first-child { padding-left: 0; border-left: 0; }
.highlights strong { font-size: 1.125rem; font-weight: 600; line-height: 1.3; }
.highlights span { color: var(--muted); font-size: .875rem; line-height: 1.45; }

/* Seções */
section {
  display: grid;
  grid-template-columns: 200px minmax(0, 1fr);
  gap: 32px;
  padding: 48px 0;
  border-bottom: 1px solid var(--line);
}

h2 {
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.4;
}

h2 span {
  display: block;
  margin-bottom: 2px;
  color: var(--accent);
  font: 500 .8125rem/1.4 var(--mono);
}

.body { max-width: 720px; }
.prose { display: grid; gap: 16px; }

.item + .item {
  margin-top: 24px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
}

.item-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  column-gap: 24px;
}

h3 { font-size: 1.0625rem; font-weight: 600; line-height: 1.4; }
.org { grid-column: 1; color: var(--muted); font-size: .9375rem; }

time {
  grid-column: 2;
  grid-row: 1;
  color: var(--muted);
  font: 400 .8125rem/1.8 var(--mono);
  white-space: nowrap;
}

.item-head + p, .item-head + ul { margin-top: 8px; }

.item ul li {
  position: relative;
  padding-left: 16px;
}

.item ul li::before {
  content: "";
  position: absolute;
  top: .72em;
  left: 0;
  width: 8px;
  height: 2px;
  background: var(--copper);
}

/* Competências */
.specs { width: 100%; border-collapse: collapse; }

.specs th, .specs td {
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.specs tr:first-child th, .specs tr:first-child td { padding-top: 0; }
.specs tr:last-child th, .specs tr:last-child td { padding-bottom: 0; border-bottom: 0; }
.specs th { width: 190px; padding-right: 24px; font-size: .9375rem; font-weight: 600; }

.tags { display: flex; flex-wrap: wrap; gap: 8px; }

.tags li {
  padding: 4px 12px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--surface);
  font-size: .9375rem;
}

/* Projetos */
.projects-head { padding: 40px 0 48px; border-bottom: 1px solid var(--ink); }
.projects-head .focus { max-width: 680px; }

.project { padding: 48px 0; border-bottom: 1px solid var(--line); }

.preview {
  display: block;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: inherit;
  text-decoration: none;
}

a.preview:hover { border-color: var(--accent); color: inherit; }

.preview-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font: 400 .8125rem/1.4 var(--mono);
}

.preview-dots,
.preview-dots::before,
.preview-dots::after {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--line);
}

.preview-dots { position: relative; flex: none; margin: 0 14px; }
.preview-dots::before, .preview-dots::after { content: ""; position: absolute; top: 0; }
.preview-dots::before { left: -14px; }
.preview-dots::after { left: 14px; }

.preview-browser img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  object-position: top;
}

.preview-serial {
  --term-bg: #101614;
  --term-line: #2b3632;
  --term-ink: #e7ece9;
  --term-muted: #9aa8a1;
  border-color: var(--term-line);
  background: var(--term-bg);
  color: var(--term-ink);
}

.preview-serial .preview-bar { border-color: var(--term-line); color: var(--term-muted); }
.preview-serial .preview-dots,
.preview-serial .preview-dots::before,
.preview-serial .preview-dots::after { background: var(--term-line); }

.serial-panes { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); }

.serial-panes pre {
  margin: 0;
  padding: 24px;
  overflow-x: auto;
  font: 400 .875rem/1.65 var(--mono);
}

.serial-panes code { font: inherit; }
.serial-output { border-left: 1px solid var(--term-line); }
.lvl-info { color: #5ccfa3; }
.lvl-debug { color: #dd9c68; }

.project-body { max-width: 860px; padding-top: 24px; }

.project-title {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 16px;
}

.project-title h2 { font-size: 1.75rem; font-weight: 700; line-height: 1.2; }
.project-meta { color: var(--muted); font: 400 .8125rem/1.5 var(--mono); }
.project-summary { margin-top: 12px; font-size: 1.0625rem; }
.project-summary code, .skills code { font: 400 .9em var(--mono); }

.skills {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 24px 40px;
  margin-top: 24px;
}

.skills h3 {
  margin-bottom: 8px;
  color: var(--accent);
  font: 500 .8125rem/1.4 var(--mono);
}

.skills li {
  position: relative;
  padding-left: 16px;
  font-size: .9375rem;
}

.skills li + li { margin-top: 6px; }

.skills li::before {
  content: "";
  position: absolute;
  top: .72em;
  left: 0;
  width: 8px;
  height: 2px;
  background: var(--copper);
}

.project-links { margin-top: 24px; }

footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px 24px;
  padding: 32px 0 48px;
  color: var(--muted);
  font: 400 .8125rem/1.5 var(--mono);
}

/* Telas menores */
@media (max-width: 860px) {
  .hero { grid-template-columns: 1fr; gap: 32px; padding-top: 48px; }
  .pinout { max-width: 400px; }
  section { grid-template-columns: 1fr; gap: 16px; padding: 36px 0; }
  .body { max-width: none; }
  h2 { font-size: 1.125rem; }
}

@media (max-width: 600px) {
  .page { padding: 0 16px; }
  .highlights { grid-template-columns: 1fr; }
  .highlights li, .highlights li:first-child { padding: 16px 0; border-left: 0; }
  .highlights li + li { border-top: 1px solid var(--line); }
  .item-head { grid-template-columns: minmax(0, 1fr); }
  time { grid-column: 1; grid-row: auto; }
  .specs th, .specs td { display: block; width: auto; padding: 0; border: 0; }
  .specs tr { display: block; padding: 12px 0; border-bottom: 1px solid var(--line); }
  .specs tr:first-child { padding-top: 0; }
  .specs tr:last-child { padding-bottom: 0; border-bottom: 0; }
  .serial-panes { grid-template-columns: minmax(0, 1fr); }
  .serial-panes pre { padding: 16px; font-size: .8125rem; }
  .serial-output { border-top: 1px solid var(--term-line); border-left: 0; }
  .skills { grid-template-columns: minmax(0, 1fr); }
}

/* Versão em PDF */
@media print {
  @page { margin: 14mm; }

  :root {
    color-scheme: light;
    --bg: #fff;
    --surface: #fff;
    --ink: #111;
    --muted: #444;
    --line: #ccc;
    --accent: #0f6b4f;
    --copper: #a85a22;
  }

  body { font-size: 10pt; line-height: 1.45; }
  .page { max-width: none; padding: 0; }
  .pinout, .actions, footer, .site-nav, .copy-email { display: none; }
  .project { padding: 12px 0; break-inside: avoid; }
  .preview-browser img { max-height: 70mm; }
  .hero { display: block; padding: 0 0 12px; }
  h1 { font-size: 26pt; }
  .focus { font-size: 12pt; margin-top: 4px; }
  .contact { display: flex; flex-wrap: wrap; gap: 0 16px; margin-top: 8px; font-size: 9pt; }
  .contact a { text-decoration: none; }
  .highlights li { padding: 8px 12px; }
  section { grid-template-columns: 110px minmax(0, 1fr); gap: 12px; padding: 12px 0; }
  .body { max-width: none; }
  h2 { font-size: 10pt; }
  h3 { font-size: 10.5pt; }
  .org, .highlights span, .specs th { font-size: 9.5pt; }
  .highlights strong { font-size: 10.5pt; }
  .item + .item { margin-top: 8px; padding-top: 8px; }
  .item, .specs tr, .highlights { break-inside: avoid; }
  h2 { break-after: avoid; }
  .specs th, .specs td { padding: 4px 16px 4px 0; }
  .specs th { width: 130px; }
  .tags li { padding: 2px 8px; font-size: 9pt; }
}
