/* base.css — reset, tipografia, shell (header/footer), controles (idioma/tema) e componentes. */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0; min-height: 100vh; display: flex; flex-direction: column;
  background: var(--bg); color: var(--text);
  font-family: var(--font-ui); font-size: 1rem; line-height: 1.65;
}
img, svg, video { max-width: 100%; height: auto; }
a { color: var(--accent); text-underline-offset: .18em; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 3px; }
h1, h2, h3, h4 { line-height: 1.2; letter-spacing: -.01em; }
code, kbd, samp, pre { font-family: var(--font-mono); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip-link { position: absolute; left: .5rem; top: -4rem; background: var(--accent); color: var(--on-accent); padding: .5rem .9rem; border-radius: var(--radius-sm); z-index: 100; }
.skip-link:focus { top: .5rem; }

/* ───────── Shell ───────── */
.site-header { border-bottom: 1px solid var(--border); background: var(--surface); }
.site-header__inner {
  max-width: var(--w-wide); margin: 0 auto; padding: .75rem var(--gutter);
  display: flex; align-items: center; gap: .75rem 1.25rem; flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: .7rem; text-decoration: none; color: var(--text); margin-right: auto; }
.brand-mark {
  width: 2.4rem; height: 2.4rem; border-radius: var(--radius-sm); background: var(--accent); color: var(--on-accent);
  display: grid; place-items: center; font: 500 .85rem var(--font-mono); letter-spacing: -.04em; flex-shrink: 0;
}
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-name { font-weight: 600; font-size: 1.05rem; letter-spacing: -.02em; }
.brand-role { font: .72rem var(--font-mono); color: var(--muted); }
.site-nav { display: flex; gap: .15rem; flex-wrap: wrap; }
.site-nav a {
  text-decoration: none; color: var(--text); font-size: .9rem; font-weight: 500;
  padding: .4rem .7rem; border-radius: var(--radius-sm);
}
.site-nav a:hover { background: var(--accent-soft); }
.site-nav a[aria-current="page"] { background: var(--accent-soft); color: var(--accent); }
.site-controls { display: flex; gap: .5rem; align-items: center; }

.seg { display: inline-flex; border: 1px solid var(--border-strong); border-radius: 999px; overflow: hidden; background: var(--surface); }
.seg > a, .seg > button {
  appearance: none; border: 0; background: transparent; color: var(--text); font: 500 .78rem var(--font-mono);
  padding: .32rem .62rem; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; gap: .3rem; line-height: 1.2;
}
.seg > * + * { border-left: 1px solid var(--border); }
.seg > a:hover, .seg > button:hover { background: var(--accent-soft); }
.seg > [aria-current="true"], .seg > [aria-pressed="true"] { background: var(--accent); color: var(--on-accent); }

.site-main { flex: 1; width: 100%; }
.shell { margin: 0 auto; padding: 2rem var(--gutter) 4rem; width: 100%; }
.shell--reading { max-width: var(--w-reading); }
.shell--hub { max-width: var(--w-content); }
.shell--app { max-width: var(--w-wide); }

.crumbs { font: .8rem var(--font-mono); margin: 0 0 1.5rem; display: flex; flex-wrap: wrap; gap: .35rem; align-items: center; color: var(--muted); }
.crumbs a { color: var(--accent); text-decoration: none; }
.crumbs a:hover { text-decoration: underline; }
.lang-only {
  display: inline-block; font: .72rem var(--font-mono); padding: .15rem .55rem; border: 1px solid var(--border-strong);
  border-radius: 999px; color: var(--muted); margin: 0 0 1rem;
}

.site-footer { border-top: 1px solid var(--border); background: var(--surface); margin-top: auto; }
.site-footer__inner {
  max-width: var(--w-wide); margin: 0 auto; padding: 1.2rem var(--gutter);
  display: flex; gap: .6rem 1.5rem; flex-wrap: wrap; justify-content: space-between; font: .78rem var(--font-mono); color: var(--muted);
}
.site-footer a { color: var(--muted); }
.site-footer a:hover { color: var(--accent); }
.site-footer__links { display: flex; gap: 1rem; flex-wrap: wrap; }

/* ───────── Componentes ───────── */
.page-title { font-size: clamp(1.7rem, 4vw, 2.4rem); margin: 0 0 .4rem; font-weight: 700; }
.page-lead { color: var(--muted); font-size: 1.08rem; margin: 0 0 2rem; max-width: 46rem; }
.section-title {
  font: 600 .74rem var(--font-mono); text-transform: uppercase; letter-spacing: .09em; color: var(--muted);
  margin: 2.6rem 0 1rem; padding-bottom: .5rem; border-bottom: 1px solid var(--border);
}
.page-lead + .section-title { margin-top: 0; }

.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(15.5rem, 1fr)); gap: .9rem; }
.card {
  display: flex; flex-direction: column; gap: .35rem; padding: 1rem 1.1rem; text-decoration: none; color: var(--text);
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); transition: border-color .15s, box-shadow .15s, transform .1s;
}
.card:hover { border-color: var(--accent); box-shadow: var(--shadow-hover); transform: translateY(-1px); }
.card__top { display: flex; align-items: flex-start; justify-content: space-between; gap: .6rem; }
.card__title { font-weight: 600; font-size: 1rem; line-height: 1.25; }
.card__desc { color: var(--muted); font-size: .87rem; line-height: 1.5; }
.badges { display: flex; gap: .3rem; flex-wrap: wrap; flex-shrink: 0; }
.badge {
  font: 500 .66rem var(--font-mono); padding: .12rem .45rem; border-radius: 999px; white-space: nowrap;
  border: 1px solid var(--border-strong); color: var(--muted); text-transform: uppercase; letter-spacing: .04em;
}
.badge--ext::after { content: " ↗"; }

.notice {
  border: 1px solid var(--border-strong); border-left-width: 4px; border-radius: var(--radius); background: var(--surface);
  padding: 1rem 1.2rem; margin: 0 0 2rem; font-size: .95rem;
}
.notice--care { border-left-color: var(--warning); }
.notice > strong:first-child { display: block; margin-bottom: .3rem; }
.notice p { margin: .3rem 0; }

.btn {
  display: inline-block; text-decoration: none; padding: .5rem 1rem; border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--text); font-weight: 500; font-size: .92rem;
}
.btn:hover { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }
.btn-row { display: flex; gap: .6rem; flex-wrap: wrap; margin: 1rem 0 0; }

table { border-collapse: collapse; }
.prose:not(.legacy) table { width: 100%; margin: 1.2rem 0; font-size: .93rem; display: block; overflow-x: auto; }
.prose:not(.legacy) th, .prose:not(.legacy) td { text-align: left; padding: .5rem .75rem; border-bottom: 1px solid var(--border); vertical-align: top; }
.prose:not(.legacy) th { font: 600 .78rem var(--font-mono); text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.prose:not(.legacy) pre { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 1rem; overflow-x: auto; font-size: .86rem; line-height: 1.55; }
.prose:not(.legacy) :not(pre) > code { background: var(--surface-2); padding: .1em .35em; border-radius: 4px; font-size: .9em; }

/* Currículo */
.job { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.2rem 1.4rem; margin-bottom: 1rem; }
.job__head { display: flex; justify-content: space-between; gap: .4rem 1rem; flex-wrap: wrap; align-items: baseline; margin-bottom: .5rem; }
.job__title { font-weight: 600; font-size: 1.1rem; }
.job__company { color: var(--accent); font-weight: 500; }
.job__date { font: .82rem var(--font-mono); color: var(--muted); }
.job ul, .bullets { margin: .5rem 0 0; padding-left: 1.2rem; }
.job li { margin-bottom: .3rem; font-size: .95rem; }
.skills { display: grid; grid-template-columns: repeat(auto-fill, minmax(12rem, 1fr)); gap: .6rem; padding: 0; margin: 0; list-style: none; }
.skills li { border: 1px solid var(--border); background: var(--surface); border-radius: var(--radius-sm); padding: .55rem .8rem; text-align: center; font-size: .9rem; font-weight: 500; }
.project { padding: 1rem 0; border-bottom: 1px solid var(--border); }
.project:last-child { border-bottom: 0; }
.project__head { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; }
.project__title { font-weight: 600; font-size: 1.05rem; }
.project__desc { color: var(--muted); margin: .25rem 0 0; font-size: .94rem; }

@media (max-width: 40rem) {
  .brand { width: 100%; }
  .site-nav { order: 3; width: 100%; }
  .site-controls { margin-left: auto; }
}
@media print {
  .site-header, .site-footer, .skip-link, .crumbs { display: none !important; }
  :root, :root[data-theme="dark"] { color-scheme: light; --bg:#fff; --surface:#fff; --surface-2:#f2f2f2; --text:#000; --muted:#333; --border:#ccc; --accent:#000; }
  body { background: #fff; color: #000; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; scroll-behavior: auto !important; } }

/* Páginas migradas: nada pode estourar a largura do celular */
.legacy { min-width: 0; }
.legacy pre { max-width: 100%; overflow-x: auto; }
.legacy iframe, .legacy video, .legacy table { max-width: 100%; }
.legacy iframe { aspect-ratio: 16 / 9; height: auto; }
.legacy table { display: block; overflow-x: auto; }
.legacy :not(pre) > code { overflow-wrap: anywhere; }
.legacy.prose :is(p, li, td) a { text-decoration: underline; text-underline-offset: .18em; }
.legacy.prose :is(nav, .sidebar-nav, .toc) a, .legacy.prose a:is(.btn, .badge, .card) { text-decoration: none; }
