/* Direção "desenho técnico": prancheta clara de dia, planta azul (blueprint) à noite.
   Cores da marca: Escuro #060E10, Normal #46828E, Claro #349FB4. Claro e Normal só em
   linhas, preenchimentos e texto grande; texto pequeno sobre o papel usa o teal fechado. */
:root {
  color-scheme: light;
  --bg: #f1f5f6;
  --surface: #ffffff;
  --ink: #060e10;
  --mute: #46575c;
  --line: #060e10;
  --rule: rgba(6, 14, 16, 0.14);
  --grid-major: rgba(70, 130, 142, 0.12);
  --grid-minor: rgba(70, 130, 142, 0.06);
  --accent: #2d6b78;
  --dim: #46828e;
  --fill: rgba(52, 159, 180, 0.16);
  --on-ink: #f1f5f6;
  --band: #060e10;
  --moon: block;
  --sun: none;
  --serif: "Instrument Serif", "Noto Serif", Georgia, serif;
  --sans: Inter, system-ui, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, monospace;
}

/* Tema escuro: o do sistema, ou o claro invertido pelo botão (checkbox lido por :has). */
@media (prefers-color-scheme: dark) {
  :root:not(:has(#theme:checked)) {
    color-scheme: dark; --bg: #060e10; --surface: #0b1719; --ink: #f1f5f6; --mute: rgba(241, 245, 246, 0.68);
    --line: rgba(241, 245, 246, 0.82); --rule: rgba(241, 245, 246, 0.14); --grid-major: rgba(70, 130, 142, 0.26);
    --grid-minor: rgba(70, 130, 142, 0.11); --accent: #349fb4; --dim: #349fb4; --fill: rgba(52, 159, 180, 0.22);
    --on-ink: #060e10; --band: #0b1719; --moon: none; --sun: block;
  }
}
@media (prefers-color-scheme: light) {
  :root:has(#theme:checked) {
    color-scheme: dark; --bg: #060e10; --surface: #0b1719; --ink: #f1f5f6; --mute: rgba(241, 245, 246, 0.68);
    --line: rgba(241, 245, 246, 0.82); --rule: rgba(241, 245, 246, 0.14); --grid-major: rgba(70, 130, 142, 0.26);
    --grid-minor: rgba(70, 130, 142, 0.11); --accent: #349fb4; --dim: #349fb4; --fill: rgba(52, 159, 180, 0.22);
    --on-ink: #060e10; --band: #0b1719; --moon: none; --sun: block;
  }
}

*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
html { scroll-behavior: smooth; scroll-padding-top: 1.5rem; }
body {
  font: 400 1rem/1.6 var(--sans);
  color: var(--ink);
  background-color: var(--bg);
  background-image:
    linear-gradient(var(--grid-major) 1px, transparent 1px), linear-gradient(90deg, var(--grid-major) 1px, transparent 1px),
    linear-gradient(var(--grid-minor) 1px, transparent 1px), linear-gradient(90deg, var(--grid-minor) 1px, transparent 1px);
  background-size: 120px 120px, 120px 120px, 24px 24px, 24px 24px;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { font-weight: 400; text-wrap: balance; }
h1, h2, .sheet__num, .sheet h3 { font-family: var(--serif); letter-spacing: -0.01em; }
h1 em, h2 em { color: var(--accent); }
p { max-width: 62ch; }
a { color: inherit; }
img, svg { display: block; max-width: 100%; height: auto; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }
.wrap { width: min(1200px, 100% - 2rem); margin-inline: auto; }
.label, .top nav span, .stamp dt, figcaption, .job, .lang summary, .menu-langs-title {
  font: 500 0.78rem/1.4 var(--mono); letter-spacing: 0.1em; text-transform: uppercase; color: var(--mute);
}
.nowrap { white-space: nowrap; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* Botões */
.actions { display: flex; flex-wrap: wrap; gap: 0.6rem; }
.btn { display: inline-flex; align-items: center; padding: 0.8rem 1.25rem; border: 1.5px solid var(--ink); border-radius: 999px; font: 500 0.95rem var(--sans); text-decoration: none; transition: background 0.15s, color 0.15s; }
.btn--solid { background: var(--ink); color: var(--bg); }
.btn--solid:hover { background: var(--accent); border-color: var(--accent); color: var(--bg); }
.btn--ghost:hover { background: var(--ink); color: var(--bg); }

/* Cabeçalho */
.top { display: flex; align-items: center; gap: 1.5rem; padding-block: 1.25rem; }
/* No computador o topo acompanha a rolagem. O fundo vai de borda a borda por um
   pseudo-elemento, sem recortar nada: a lista de idiomas abre por cima da página. */
@media (min-width: 801px) {
  html { scroll-padding-top: 6rem; }
  body { overflow-x: clip; }
  .top { position: sticky; top: 0; z-index: 40; }
  .top::before { content: ""; position: absolute; z-index: -1; inset: 0 calc(50% - 50vw); background: var(--bg); border-bottom: 1px solid var(--rule); }
}
.brand { display: flex; align-items: center; gap: 0.75rem; font: 600 0.95rem var(--sans); text-decoration: none; }
.brand__mark { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 7px; background: #060e10; box-shadow: 0 0 0 1px var(--rule); }
.top nav { display: flex; gap: 1.75rem; order: 1; margin-left: auto; }
.top nav > a { display: flex; gap: 0.45rem; font-size: 0.9rem; text-decoration: none; color: var(--mute); }
.top nav > a span { color: var(--accent); }
.top nav > a:hover { color: var(--ink); }
.top nav > .menu-button { display: none; }
.top__end { display: flex; align-items: center; gap: 0.6rem; order: 2; }
.theme-toggle { position: absolute; opacity: 0; pointer-events: none; }
.menu-button, .menu-langs-title, .menu-langs { display: none; }
.theme-button { display: grid; place-items: center; width: 40px; height: 40px; border: 1px solid var(--rule); border-radius: 999px; cursor: pointer; }
.theme-button:hover { border-color: var(--ink); }
.theme-button svg { width: 18px; fill: none; stroke: var(--ink); stroke-width: 1.6; stroke-linecap: round; }
.icon-moon { display: var(--moon); }
.icon-sun { display: var(--sun); }
.theme-toggle:focus-visible + .theme-button { outline: 2px solid var(--accent); outline-offset: 3px; }

/* Seletor de idioma, no estilo do Eterzion Studio */
.lang { position: relative; }
.lang summary { display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 12px 0 8px; border: 1px solid var(--rule); border-radius: 999px; color: var(--ink); cursor: pointer; list-style: none; user-select: none; }
.lang summary::-webkit-details-marker { display: none; }
.lang summary::after { content: ""; width: 6px; height: 6px; margin: -3px 0 0 2px; border-right: 1.5px solid var(--mute); border-bottom: 1.5px solid var(--mute); transform: rotate(45deg); }
.lang[open] summary::after { margin-top: 3px; transform: rotate(-135deg); }
.lang summary:hover, .lang[open] summary { border-color: var(--ink); }
.flag { flex: none; width: 20px; height: 20px; border-radius: 50%; object-fit: cover; box-shadow: 0 0 0 1px var(--rule); }
.lang ul { position: absolute; z-index: 30; top: calc(100% + 8px); right: 0; min-width: 220px; padding: 6px; list-style: none; background: var(--surface); border: 1.5px solid var(--line); border-radius: 10px; }
.lang ul a { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 6px; font-size: 0.92rem; text-decoration: none; white-space: nowrap; }
.lang ul a:hover, .lang ul a:focus-visible, .lang ul a[aria-current="true"] { background: var(--fill); }
.lang ul a[aria-current="true"] { font-weight: 600; }

/* Topo: folha 00 */
.hero { display: grid; grid-template-columns: 1.3fr 0.7fr; gap: 3rem; align-items: end; padding-block: clamp(3rem, 8vw, 6rem) clamp(4rem, 9vw, 7rem); }
.hero h1 { margin-top: 1.1rem; font-size: clamp(3rem, 7.4vw, 6.8rem); line-height: 0.95; }
.lead { margin: 1.75rem 0 2rem; font-size: 1.12rem; color: var(--mute); }
.job { display: inline-block; margin-bottom: 1.5rem; padding: 0.5rem 0.8rem; border: 1.5px solid var(--line); color: var(--ink); background: var(--surface); }
.drawing { width: 100%; max-width: 420px; justify-self: end; }
.drawing__part rect { fill: none; stroke: var(--line); stroke-width: 1.5; }
.drawing__part .drawing__fill { fill: var(--fill); }
.drawing__dim path { fill: none; stroke: var(--dim); stroke-width: 1; }
.drawing__text { font: 500 11px var(--mono); letter-spacing: 1px; fill: var(--accent); text-transform: uppercase; }

/* Seções */
.section { padding-block: clamp(3.5rem, 8vw, 6rem); }
.section__head { display: grid; grid-template-columns: 6rem 1fr; gap: 0.25rem 1.5rem; margin-bottom: 2.5rem; padding-top: 1.25rem; border-top: 1.5px solid var(--line); }
.section__head h2 { font-size: clamp(2.2rem, 4.6vw, 3.6rem); line-height: 1; }
.section__head .intro { grid-column: 2; color: var(--mute); margin-top: 0.75rem; }

/* Cases: folhas com carimbo */
.sheets { display: grid; gap: 2rem; }
.sheet { display: grid; grid-template-columns: 1fr 1.2fr; background: var(--surface); border: 1.5px solid var(--line); }
.sheet__text, .sheet__figure { padding: clamp(1.5rem, 3.5vw, 2.5rem); }
.sheet__figure { border-left: 1.5px solid var(--line); }
.sheet__num { display: block; font-size: 5rem; line-height: 1; color: var(--dim); }
.sheet h3 { margin: 0.75rem 0 1rem; font-size: clamp(1.8rem, 3vw, 2.5rem); line-height: 1.05; }
/* Nomes técnicos sem espaço não têm onde quebrar e empurrariam a folha para fora da tela. */
.sheet h3, .graph strong { overflow-wrap: anywhere; }
.sheet p { color: var(--mute); }
.stamp { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(3, 1fr); border-top: 1.5px solid var(--line); }
.stamp > div { padding: 0.9rem 1.25rem; border-left: 1px solid var(--line); }
.stamp > div:first-child { border-left: 0; }
.stamp dd { margin: 0.3rem 0 0; font-size: 0.95rem; }

/* Esquemas */
.figure { display: grid; gap: 1.25rem; height: 100%; align-content: center; }
figcaption { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; padding-top: 0.8rem; border-top: 1px solid var(--line); }
figcaption span:first-child { color: var(--ink); }
.sketch--steps, .sketch ul, .sketch ol { padding: 0; list-style: none; }
.sketch--balance { display: grid; grid-template-columns: 1fr 1.1fr 1fr; gap: 1.5rem; align-items: stretch; }
.sketch__side ul { display: grid; gap: 0.5rem; margin-top: 0.6rem; }
.sketch__side li { position: relative; padding: 0.55rem 0.75rem; border: 1.5px solid var(--line); border-radius: 6px; font-size: 0.92rem; }
.sketch__side li::after { content: ""; position: absolute; top: 50%; left: 100%; width: 1.5rem; border-top: 1.5px solid var(--dim); }
.sketch__side--out li::after { left: auto; right: 100%; }
.sketch__tank { display: flex; flex-direction: column; }
.sketch__tank > div { flex: 1; display: flex; align-items: flex-end; margin-top: 0.6rem; padding: 0.4rem; min-height: 9rem; border: 1.5px solid var(--line); border-radius: 8px; }
.sketch__tank span { display: grid; place-items: center; width: 100%; height: 45%; border-radius: 4px; background: var(--fill); font-size: 0.85rem; }
.sketch--steps { display: grid; grid-template-columns: repeat(5, 1fr); gap: 0.6rem; counter-reset: step; }
.sketch--steps li { position: relative; display: flex; flex-direction: column; gap: 0.3rem; min-height: 6.5rem; padding: 0.7rem; border: 1.5px solid var(--line); border-radius: 6px; font-size: 0.9rem; overflow-wrap: anywhere; }
.sketch--steps li + li::before { content: ""; position: absolute; top: 50%; right: 100%; width: 0.6rem; border-top: 1.5px solid var(--dim); }
.sketch--steps span { flex: none; font: 500 0.72rem var(--mono); color: var(--accent); }
.sketch--steps .is-flag { background: var(--fill); border-style: dashed; }
.sketch--steps em { margin-top: auto; font: 500 0.7rem var(--mono); font-style: normal; text-transform: uppercase; letter-spacing: 0.06em; color: var(--accent); }

/* Habilidades: ficha técnica */
.skills { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px; background: var(--line); border: 1.5px solid var(--line); }
/* Cinco ou seis grupos ficam em três colunas; o último ocupa o resto da linha. */
.skills:has(> .skill:nth-child(5)) { grid-template-columns: repeat(3, 1fr); }
.skill { padding: 1.5rem; background: var(--surface); }
.skill:last-child { grid-column: auto / -1; }
/* Títulos dos grupos na fonte do texto, legíveis: a mono pequena quase não se lia. */
.skill h3, .columns h3 { margin-bottom: 1rem; font: 600 0.88rem/1.4 var(--sans); letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink); }
.tags { display: grid; gap: 0.35rem; padding: 0; list-style: none; font-family: var(--serif); font-size: 1.6rem; line-height: 1.15; }

/* Trajetória */
.columns { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 3rem; }
.columns h3 { margin-bottom: 1.25rem; }
.timeline { display: grid; gap: 1.5rem; padding: 0 0 0 1.5rem; border-left: 1.5px solid var(--line); list-style: none; }
.timeline li { position: relative; }
.timeline li::before { content: ""; position: absolute; left: calc(-1.5rem - 6px); top: 0.45rem; width: 10px; height: 10px; background: var(--bg); border: 1.5px solid var(--line); }
.timeline li:first-child::before { background: var(--dim); border-color: var(--dim); }
.timeline strong { display: block; font: 400 1.5rem/1.15 var(--serif); }
.timeline span { color: var(--mute); font-size: 0.92rem; }
.timeline p { margin-top: 0.4rem; color: var(--mute); }

/* Contato: a única faixa cheia */
.section--ink { background: var(--band); color: #f1f5f6; }
.section--ink .section__head { border-color: rgba(241, 245, 246, 0.6); }
.section--ink .label, .section--ink .intro { color: rgba(241, 245, 246, 0.7); }
.section--ink .section__head h2 { font-size: clamp(2.6rem, 6vw, 4.6rem); }
.section--ink .btn { border-color: #f1f5f6; }
.section--ink .btn--solid { background: #f1f5f6; color: #060e10; }
.section--ink .btn--solid:hover { background: #349fb4; border-color: #349fb4; }
.section--ink .btn--ghost { color: #f1f5f6; }
.section--ink .btn--ghost:hover { background: #f1f5f6; color: #060e10; }

.foot { padding-block: 1.25rem 5.5rem; background: var(--band); border-top: 1px solid rgba(241, 245, 246, 0.14); font: 500 0.72rem var(--mono); letter-spacing: 0.1em; text-transform: uppercase; color: rgba(241, 245, 246, 0.6); }
.foot .wrap { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }

/* Botão do CV, fixo no canto. */
.cv-fab { position: fixed; z-index: 40; right: 1.25rem; bottom: 1.25rem; display: inline-flex; align-items: center; gap: 0.5rem; padding: 0.85rem 1.25rem; border-radius: 999px; background: var(--ink); color: var(--bg); box-shadow: 0 4px 10px rgba(6, 14, 16, 0.18), 0 14px 32px rgba(6, 14, 16, 0.22); border: 1px solid rgba(241, 245, 246, 0.2); font: 600 0.95rem/1 var(--sans); text-decoration: none; transition: background 0.15s, transform 0.15s; }
.cv-fab:hover { background: var(--accent); transform: translateY(-2px); }
.cv-fab svg { width: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
@media print { .cv-fab, .to-top-rail { display: none; } }
/* Volta ao início: só no celular. */
.to-top-rail { display: none; }
/* Com o menu aberto, os botões saem da frente. */
body:has(#menu-nav:target) .cv-fab { display: none; }
body:has(#menu-nav:target) .to-top-rail { display: none; }
/* No celular, um círculo só com o ícone: o texto longo de alguns idiomas cobria a página. */
@media (max-width: 560px) {
  /* No celular, a abertura começa logo abaixo do topo, e o texto vai justificado. */
  .hero { padding-top: 1.25rem; }
  .lead { text-align: justify; hyphens: auto; }
  .cv-fab { justify-content: center; width: 3.5rem; height: 3.5rem; padding: 0; border-radius: 50%; }
  .cv-fab svg { width: 22px; }
  .cv-fab span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  /* O trilho não ocupa espaço; gruda a 4,75rem do fim da tela, na altura do botão do CV. */
  .to-top-rail { display: block; position: sticky; z-index: 40; top: calc(100vh - 4.75rem); top: calc(100dvh - 4.75rem); height: 0; }
  .to-top { position: absolute; top: 0; left: 1.25rem; display: grid; place-items: center; width: 3.5rem; height: 3.5rem; border: 1px solid var(--line); border-radius: 50%; background: var(--surface); color: var(--ink); box-shadow: 0 4px 10px rgba(6, 14, 16, 0.14), 0 14px 32px rgba(6, 14, 16, 0.18); }
  .to-top svg { width: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
}

@media (max-width: 900px) {
  .hero, .sheet { grid-template-columns: 1fr; }
  .drawing { justify-self: start; max-width: 280px; }
  .sheet__figure { border-left: 0; border-top: 1.5px solid var(--line); }
  .skills, .skills:has(> .skill:nth-child(5)) { grid-template-columns: repeat(2, 1fr); }
  .sketch--steps { grid-template-columns: 1fr; }
  .sketch--steps li { min-height: 0; flex-direction: row; align-items: baseline; gap: 0.75rem; }
  .sketch--steps li + li::before { top: auto; bottom: 100%; right: auto; left: 1.4rem; width: 0; height: 0.6rem; border-top: 0; border-left: 1.5px solid var(--dim); }
  .sketch--steps em { margin: 0 0 0 auto; }
}

@media (max-width: 800px) {
  /* Menu hambúrguer: abre quando o <nav> é o alvo do endereço; as barras viram um X. */
  .top { flex-wrap: wrap; }
  .top__end { margin-left: auto; }
  .top .lang { display: none; }
  /* O menu abre por cima da página, sem empurrar nada: ao fechar, o layout não muda
     e a rolagem suave até a seção não é interrompida. */
  .top nav { display: none; position: absolute; z-index: 45; top: 100%; left: -1rem; right: -1rem; flex-direction: column; gap: 0; margin-left: 0; padding: 0 1rem 1rem; background: var(--bg); box-shadow: 0 14px 32px rgba(6, 14, 16, 0.18); }
  #menu-nav:target { display: flex; }
  .top nav > a { padding-block: 0.85rem; border-top: 1px solid var(--rule); color: var(--ink); font-size: 1.05rem; }
  .menu-button { display: grid; place-items: center; width: 40px; height: 40px; border: 1px solid var(--rule); border-radius: 999px; cursor: pointer; }
  .top { position: relative; }
  /* O X, dentro do menu, cobre o botão de abrir no mesmo lugar. */
  /* Abrir o menu não rola a página: a margem grande trava a rolagem no topo. */
  #menu-nav { scroll-margin-top: 12rem; }
  .top nav > .menu-button--close { position: absolute; top: -3.75rem; right: 1rem; display: grid; padding: 0; border: 1px solid var(--rule); background: var(--bg); }
  .menu-button span, .menu-button span::before, .menu-button span::after { display: block; width: 18px; height: 1.5px; background: var(--ink); transition: transform 0.2s, background 0.2s; }
  .menu-button span { position: relative; }
  .menu-button span::before, .menu-button span::after { content: ""; position: absolute; left: 0; }
  .menu-button span::before { top: -6px; }
  .menu-button span::after { top: 6px; }
  .menu-button--close span { background: transparent; }
  .menu-button--close span::before { transform: translateY(6px) rotate(45deg); }
  .menu-button--close span::after { transform: translateY(-6px) rotate(-45deg); }
  .menu-langs-title { display: block; margin-top: 1rem; padding-top: 1rem; border-top: 1px solid var(--rule); }
  .menu-langs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 2px 12px; margin-top: 0.5rem; padding-bottom: 0.5rem; }
  .menu-langs a { display: flex; align-items: center; gap: 10px; min-height: 44px; text-decoration: none; }
  .menu-langs a[aria-current="true"] { font-weight: 600; }
  .section__head { grid-template-columns: 1fr; }
  .section__head .intro { grid-column: 1; }
}

@media (max-width: 560px) {
  .sketch--balance { grid-template-columns: 1fr; gap: 1rem; }
  .sketch__side li::after { display: none; }
  .sketch__tank > div { min-height: 5rem; }
  .stamp { grid-template-columns: 1fr; }
  .stamp > div { border-left: 0; border-top: 1px solid var(--line); }
  .stamp > div:first-child { border-top: 0; }
  .skills, .skills:has(> .skill:nth-child(5)) { grid-template-columns: 1fr; }
}

/* Montagem: a abertura se monta uma vez ao carregar, em sequência; depois, cada
   folha, grupo de habilidades e linha da trajetória entra ao chegar na tela. Tudo em
   CSS (a CSP não permite JS) e só para quem não pediu menos movimento. Sem suporte a
   animation-timeline, o conteúdo simplesmente já está lá. */
@keyframes rise { from { opacity: 0; transform: translateY(16px); } }
/* Troca de tema suave: as cores deslizam em vez de piscar. Botões e links mantêm a
   própria transição, mais curta, para o hover continuar imediato. */
@media (prefers-reduced-motion: no-preference) {
  body, body *, body *::before, body *::after { transition: background-color 0.45s ease, border-color 0.45s ease, color 0.45s ease, fill 0.45s ease, stroke 0.45s ease, box-shadow 0.45s ease; }
  .btn, .cv-fab { transition: background 0.15s, color 0.15s, border-color 0.15s, transform 0.15s; }
}
@media (prefers-reduced-motion: no-preference) {
  .hero__text > *, .hero > :last-child { animation: rise 0.8s cubic-bezier(0.16, 1, 0.3, 1) both; }
  .hero__text > :nth-child(2) { animation-delay: 0.08s; }
  .hero__text > :nth-child(3) { animation-delay: 0.16s; }
  .hero__text > :nth-child(4) { animation-delay: 0.24s; }
  .hero__text > :nth-child(5) { animation-delay: 0.32s; }
  .hero > :last-child { animation-delay: 0.3s; animation-duration: 1s; }
  @supports (animation-timeline: view()) {
    .sheet, .skill, .timeline li { animation: rise linear both; animation-timeline: view(); animation-range: entry 0% entry 35%; }
  }
}

/* A rolagem até as seções fica suave sempre, a pedido: as outras animações é que
   respeitam quem pede menos movimento. */
@media (prefers-reduced-motion: reduce) {
  .btn, .cv-fab, .menu-button span, .menu-button span::before, .menu-button span::after { transition: none; }
  .cv-fab:hover { transform: none; }
}
