/* Portfólio · Lucas Schneider
   Tokens documentados em ../DESIGN.md. Escuro por escolha: o grafo e o fundo topográfico dependem dele. */

/* Schibsted Grotesk hospedada aqui (variável, 400 a 700, só latin: cobre o português) */
@font-face {
  font-family: "Schibsted Grotesk";
  src: url("fonts/SchibstedGrotesk-latin.woff2") format("woff2");
  font-weight: 400 700;
  font-display: swap;
}
@font-face {
  font-family: "JetBrains Mono";
  src: url("fonts/JetBrainsMono-Regular.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "JetBrains Mono";
  src: url("fonts/JetBrainsMono-Medium.woff2") format("woff2");
  font-weight: 500;
  font-display: swap;
}

:root {
  color-scheme: light;

  --bg: #f7f7f5;
  --bg-2: #ffffff;
  --bg-3: #ededea;
  --fg: #121412;
  --muted: #4f534e;
  --faint: #6e726d;
  --line: #e2e3df;
  --line-strong: #c9cbc6;
  --accent: #1d5bb8;
  --accent-soft: rgba(29, 91, 184, .12);
  --accent-fg: #ffffff;
  --live-bg: #e4ecf8;
  --live-fg: #1b4a91;
  --wip-bg: #f6d34a;
  --wip-fg: #3a2d00;
  --shadow-float: 0 24px 48px -20px rgba(18, 20, 18, .22), 0 2px 6px rgba(18, 20, 18, .06);

  --font-text: "Schibsted Grotesk", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "Cascadia Code", monospace;

  /* escala 1.25 */
  --t-xs: 0.8rem;
  --t-sm: 0.875rem;
  --t-base: 1.0625rem;
  --t-md: 1.25rem;
  --t-lg: 1.5625rem;
  --t-xl: 1.953rem;
  --t-2xl: 2.441rem;
  --t-3xl: 3.052rem;

  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px;
  --s6: 32px; --s7: 48px; --s8: 64px; --s9: 96px; --s10: 128px;

  --gutter: clamp(16px, 4vw, 48px);
  --max: 1240px;

  --r-ctl: 999px;
  --r-card: 14px;
  --r-media: 6px;
  --r-portrait: 28px;

  --ease: cubic-bezier(.22, 1, .36, 1);
  --ease-in-out: cubic-bezier(.65, 0, .35, 1);
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }
@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
  @view-transition { navigation: auto; }
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-text);
  font-size: var(--t-base);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

img { display: block; max-width: 100%; height: auto; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
h1, h2, h3 { margin: 0; text-wrap: balance; font-weight: 600; }
p { margin: 0; text-wrap: pretty; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 4px;
}

::selection { background: var(--accent); color: var(--accent-fg); }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.skip {
  position: fixed; left: var(--s4); top: var(--s4); z-index: 100;
  padding: var(--s2) var(--s4); background: var(--fg); color: var(--bg);
  border-radius: var(--r-ctl); transform: translateY(-200%);
}
.skip:focus { transform: none; }

/* ------------------------------------------------------------------ fundo */

/* o fundo rola com a página (ver main.js): o wrap tem a altura do body e corta o canvas */
body { position: relative; }
.bg-wrap {
  position: absolute;
  inset: 0;
  z-index: -2;
  overflow: hidden;
  pointer-events: none;
}
.bg {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  will-change: transform;
  pointer-events: none;
}

/* vinheta + grão: escurece as bordas e tira o aspecto "digital limpo" do canvas */
.bg-veil {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background: radial-gradient(120% 90% at 50% 40%, transparent 45%, rgba(247, 247, 245, .9) 100%);
}
.bg-veil::after {
  content: "";
  position: absolute;
  inset: 0;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  opacity: .035;
}

/* ------------------------------------------------------------------ nav */

.nav {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s5);
  padding: var(--s5) var(--gutter);
  transition: background-color .3s var(--ease), border-color .3s var(--ease), padding .3s var(--ease);
  border-bottom: 1px solid transparent;
}
.nav.is-scrolled {
  /* vidro claro: o que passa por baixo fica desfocado, sem texto fantasma atrás do nome */
  background-color: rgba(247, 247, 245, .78);
  -webkit-backdrop-filter: saturate(1.4) blur(16px);
  backdrop-filter: saturate(1.4) blur(16px);
  border-bottom-color: var(--line);
  padding-block: var(--s4);
}
.nav-name {
  font-family: var(--font-mono);
  font-size: var(--t-sm);
  font-weight: 500;
  letter-spacing: 0;
}
.nav-name span { color: var(--muted); }
.nav-links {
  display: flex;
  align-items: center;
  gap: var(--s6);
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: var(--t-sm);
}
.nav-links a {
  position: relative;
  color: var(--muted);
  transition: color .2s var(--ease);
}
.nav-links a:hover, .nav-links a[aria-current="true"] { color: var(--fg); }
.nav-links a::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: -4px;
  height: 1px;
  background: currentColor;
  transform: scaleX(0);
  transform-origin: right;
  transition: transform .35s var(--ease);
}
.nav-links a:hover::after, .nav-links a[aria-current="true"]::after {
  transform: scaleX(1);
  transform-origin: left;
}
.nav-cv {
  padding: var(--s2) var(--s4);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-ctl);
  color: var(--fg) !important;
  transition: border-color .2s var(--ease), background-color .2s var(--ease) !important;
}
.nav-cv::after { display: none; }
.nav-cv:hover { border-color: var(--fg); }

@media (max-width: 640px) {
  .nav-links { gap: var(--s5); }
  .nav-links .hide-sm { display: none; }
}

/* ------------------------------------------------------------------ botões */

.btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: var(--s3);
  padding: 14px var(--s5);
  border-radius: var(--r-ctl);
  font-size: var(--t-sm);
  font-weight: 500;
  line-height: 1;
  overflow: hidden;
  isolation: isolate;
  transition: color .3s var(--ease), border-color .3s var(--ease), transform .3s var(--ease);
}
.btn svg { width: 16px; height: 16px; transition: transform .35s var(--ease); }
.btn:hover svg { transform: translateX(3px); }
.btn--down:hover svg { transform: translateY(2px); }
.btn--primary { background: var(--fg); color: var(--bg); }
.btn--primary::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: var(--accent);
  transform: translateY(101%);
  transition: transform .45s var(--ease);
}
.btn--primary:hover::before { transform: none; }
.btn--ghost { border: 1px solid var(--line-strong); color: var(--fg); }
.btn--ghost:hover { border-color: var(--fg); }
.btn:active { transform: scale(.98); }

/* ------------------------------------------------------------------ layout */

.wrap {
  width: 100%;
  max-width: calc(var(--max) + 2 * var(--gutter));
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.mono {
  font-family: var(--font-mono);
  font-size: var(--t-xs);
  letter-spacing: .02em;
  color: var(--muted);
}

/* ------------------------------------------------------------------ hero / sobre */

.hero {
  min-height: 100svh;
  display: grid;
  grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
  gap: var(--s8);
  align-items: center;
  padding-top: clamp(96px, 14vh, 128px);
  padding-bottom: clamp(48px, 8vh, 96px);
}

.hero-name {
  font-size: clamp(3.25rem, min(1.4rem + 6.2vw, 13vh), 6rem);
  line-height: .92;
  letter-spacing: -.035em;
  font-weight: 600;
  margin-bottom: var(--s6);
}
.hero-name .line { display: block; overflow: hidden; padding-bottom: .06em; }
.hero-name .line > span { display: block; }
.hero-name .line:last-child > span { color: var(--muted); }

.hero-lead {
  font-size: clamp(1.25rem, 1rem + .9vw, 1.5625rem);
  line-height: 1.35;
  letter-spacing: -.01em;
  max-width: 26ch;
  margin-bottom: var(--s5);
}
.hero-about {
  color: var(--muted);
  max-width: 64ch;
  margin-bottom: var(--s6);
}
.hero-about strong { color: var(--fg); font-weight: 500; }

.hero-meta {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: var(--s2) var(--s5);
  margin: var(--s6) 0 0;
  font-family: var(--font-mono);
  font-size: var(--t-xs);
}
.hero-meta dt { color: var(--faint); }
.hero-meta dd { margin: 0; color: var(--muted); }
.hero-meta .on { color: var(--accent); }
.hero-meta .on::before {
  content: "";
  display: inline-block;
  width: 7px; height: 7px;
  margin-right: var(--s2);
  border-radius: 50%;
  background: var(--accent);
  vertical-align: 1px;
}

.hero-actions { display: flex; flex-wrap: wrap; gap: var(--s3); }

.portrait {
  position: relative;
  margin: 0;
  justify-self: end;
  width: 100%;
  max-width: min(440px, calc((100svh - 220px) * .8));
}
.portrait-frame {
  position: relative;
  aspect-ratio: 4 / 5;
  border-radius: var(--r-portrait);
  overflow: hidden;
  background: var(--bg-2);
}
.portrait-frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scale(1.04);
  transition: transform 1.2s var(--ease);
}
.portrait:hover .portrait-frame img { transform: scale(1); }
.portrait figcaption {
  display: flex;
  justify-content: space-between;
  gap: var(--s4);
  margin-top: var(--s3);
}

@media (max-width: 900px) {
  .hero {
    grid-template-columns: 1fr;
    gap: var(--s7);
    padding-top: 112px;
    padding-bottom: var(--s8);
    align-items: start;
  }
  .portrait { order: -1; justify-self: start; max-width: 132px; }
  .portrait-frame { width: 100%; border-radius: 20px; }
  .portrait figcaption { display: none; }
  .pj-head { padding-top: 112px; padding-bottom: var(--s7); }
}

/* texto de instrução muda entre mouse e toque */
.on-touch { display: none !important; }
@media (hover: none) {
  .on-touch { display: inline !important; }
  .graph-legend .on-touch { display: inline-flex !important; }
  .on-mouse { display: none !important; }
}

/* ------------------------------------------------------------------ cabeçalho de seção */

.sec-head {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 6fr);
  gap: var(--s6);
  align-items: end;
  margin-bottom: var(--s7);
}
.sec-title {
  font-size: clamp(2.441rem, 1.6rem + 3vw, 3.815rem);
  line-height: 1;
  letter-spacing: -.03em;
}
.sec-note { color: var(--muted); max-width: 52ch; justify-self: end; }
@media (max-width: 760px) {
  .sec-head { grid-template-columns: 1fr; gap: var(--s4); }
  .sec-note { justify-self: start; }
}

/* ------------------------------------------------------------------ projetos / grafo */

.projects { padding-block: var(--s9) var(--s8); }

.graph {
  position: relative;
  height: clamp(580px, 84vh, 860px);
  margin-inline: calc(-1 * var(--gutter));
  touch-action: pan-y;
  -webkit-user-select: none;
  user-select: none;
}
.graph::before {
  /* escurece o fundo atrás do grafo para as curvas de nível não brigarem com as arestas */
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(closest-side, rgba(247, 247, 245, .92), rgba(247, 247, 245, 0));
  pointer-events: none;
}
.graph-edges {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  pointer-events: none;
}
.edge {
  stroke: var(--line-strong);
  stroke-width: 1;
  transition: stroke .3s var(--ease), opacity .3s var(--ease);
}
.edge--peer { stroke-dasharray: 2 5; }
.graph.is-focus .edge { opacity: .18; }
.graph.is-focus .edge.is-lit {
  opacity: 1;
  stroke: var(--accent);
  stroke-dasharray: 4 6;
}
@media (prefers-reduced-motion: no-preference) {
  .graph.is-focus .edge.is-lit { animation: flow 1s linear infinite; }
}
@keyframes flow { to { stroke-dashoffset: -20; } }

.node {
  position: absolute;
  left: 0;
  top: 0;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--s2);
  cursor: pointer;
  will-change: transform;
  touch-action: none;
  transition: opacity .3s var(--ease);
  -webkit-tap-highlight-color: transparent;
}
.node:focus-visible { outline: none; }
.node:focus-visible .node-dot { outline: 2px solid var(--accent); outline-offset: 4px; }
.node.is-dragging { cursor: grabbing; }

.node-dot {
  --d: 14px;
  width: var(--d);
  height: var(--d);
  border-radius: 50%;
  background: var(--fg);
  box-shadow: 0 0 0 0 rgba(29, 91, 184, 0);
  transition: transform .4s var(--ease), background-color .3s var(--ease), box-shadow .4s var(--ease);
}
.node--minor .node-dot { --d: 8px; background: var(--muted); }
.node--ai .node-dot { background: var(--bg); box-shadow: inset 0 0 0 2px var(--fg); }
.node--ai.node--minor .node-dot { box-shadow: inset 0 0 0 1.5px var(--muted); }
.node-label {
  font-size: var(--t-sm);
  font-weight: 500;
  line-height: 1.2;
  white-space: nowrap;
  color: var(--fg);
  transition: color .3s var(--ease), transform .4s var(--ease);
}
.node--minor .node-label {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 400;
  color: var(--muted);
}

.node:hover .node-dot, .node.is-active .node-dot {
  background: var(--accent);
  transform: scale(1.7);
  box-shadow: 0 0 0 6px var(--accent-soft);
}
.node--minor:hover .node-dot, .node--minor.is-active .node-dot { transform: scale(1.9); }
.node:hover .node-label, .node.is-active .node-label { color: var(--fg); transform: translateY(4px); }

.graph.is-focus .node { opacity: .2; }
.graph.is-focus .node.is-active, .graph.is-focus .node.is-near { opacity: 1; }
.graph.is-focus .node.is-near .node-dot { background: var(--fg); }

/* hub: o GitHub no centro */
.node--hub { z-index: 2; gap: var(--s3); }
.node--hub .node-dot {
  --d: 76px;
  display: grid;
  place-items: center;
  background: var(--fg);
  color: var(--bg);
}
.node--hub .node-dot svg { width: 34px; height: 34px; transition: transform .4s var(--ease); }
.node--hub:hover .node-dot, .node--hub.is-active .node-dot {
  transform: scale(1.08);
  box-shadow: 0 0 0 10px var(--accent-soft);
}
.node--hub .node-label { font-family: var(--font-mono); font-size: var(--t-xs); color: var(--muted); }
.node--hub::before {
  /* anel que pulsa devagar: o único elemento do grafo que se move sozinho, para indicar "comece por aqui" */
  content: "";
  position: absolute;
  top: 0;
  left: 50%;
  width: 76px;
  height: 76px;
  margin-left: -38px;
  border-radius: 50%;
  border: 1px solid var(--accent);
  opacity: 0;
  pointer-events: none;
}
@media (prefers-reduced-motion: no-preference) {
  .node--hub::before { animation: ring 3.2s var(--ease) infinite; }
}
@keyframes ring {
  0% { transform: scale(1); opacity: .5; }
  80%, 100% { transform: scale(1.9); opacity: 0; }
}

/* cartão de resumo que nasce do nó */
.graph-card {
  position: absolute;
  left: 0;
  top: 0;
  z-index: 5;
  width: 320px;
  padding: var(--s5);
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  box-shadow: var(--shadow-float);
  opacity: 0;
  transform: scale(.94);
  pointer-events: none;
  transition: opacity .25s var(--ease), transform .4s var(--ease);
}
.graph-card.is-open { opacity: 1; transform: none; pointer-events: auto; }
.graph-card .gc-kind { margin-bottom: var(--s2); }
.graph-card h3 { font-size: var(--t-md); letter-spacing: -.01em; margin-bottom: var(--s2); }
.graph-card .gc-sum { font-size: .9375rem; color: var(--muted); line-height: 1.55; margin-bottom: var(--s4); }
.graph-card .gc-stack { margin-bottom: var(--s4); color: var(--faint); }
.graph-card .gc-stack:last-child { margin-bottom: 0; }
.graph-card .gc-go {
  display: inline-flex;
  align-items: center;
  gap: var(--s2);
  font-size: var(--t-sm);
  font-weight: 500;
  color: var(--accent);
}
.graph-card .gc-go svg { width: 14px; height: 14px; transition: transform .3s var(--ease); }
.graph-card .gc-go:hover svg { transform: translateX(3px); }
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 9px;
  border-radius: var(--r-ctl);
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  font-weight: 500;
  line-height: 1.4;
  letter-spacing: .02em;
  white-space: nowrap;
  vertical-align: 1px;
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge--live { background: var(--live-bg); color: var(--live-fg); }
.badge--wip { background: var(--wip-bg); color: var(--wip-fg); }
.graph-card .gc-head { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2); margin-bottom: var(--s2); }
.graph-card .gc-head .gc-kind { margin: 0; }
.graph-card .gc-img {
  display: block;
  width: calc(100% + 2 * var(--s5));
  height: 150px;
  margin: calc(-1 * var(--s5)) calc(-1 * var(--s5)) var(--s4);
  max-width: none;
  object-fit: cover;
  border-radius: var(--r-card) var(--r-card) 0 0;
  border-bottom: 1px solid var(--line);
  background: var(--bg-3);
}
.graph-card .gc-none { font-size: var(--t-sm); color: var(--faint); }

@media (max-width: 700px) {
  .graph { height: 620px; }
  .node-label { font-size: 0.8125rem; }
  .node--minor .node-label { font-size: 0.6875rem; }
  .node--hub .node-dot { --d: 60px; }
  .node--hub::before { width: 60px; height: 60px; margin-left: -30px; }
}

/* toque: área de toque de ~44px em volta de cada nó, sem mudar o desenho, e o dedo rola a página */
@media (hover: none) {
  .node { touch-action: manipulation; }
  .node::after { content: ""; position: absolute; inset: -14px -10px; }
}

/* celular: o resumo vira um painel preso na base da tela, com fechar e botão grande */
.graph-card .gc-close { display: none; }
.graph-card--sheet {
  position: fixed;
  left: 12px !important;
  right: 12px;
  top: auto !important;
  bottom: calc(12px + env(safe-area-inset-bottom, 0px));
  z-index: 60;
  width: auto;
  max-height: min(74vh, 580px);
  overflow-y: auto;
  overscroll-behavior: contain;
  box-shadow: 0 -8px 40px -12px rgba(18, 20, 18, .35), 0 2px 8px rgba(18, 20, 18, .08);
  transform: translateY(28px) !important;
  transform-origin: 50% 100% !important;
}
.graph-card--sheet.is-open { transform: none !important; }
.graph-card--sheet .gc-img { height: 128px; }
.graph-card--sheet .gc-close {
  display: grid;
  place-items: center;
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 1;
  width: 40px;
  height: 40px;
  border-radius: var(--r-ctl);
  background: rgba(255, 255, 255, .92);
  color: var(--fg);
  box-shadow: 0 1px 4px rgba(18, 20, 18, .15);
}
.graph-card--sheet .gc-close svg { width: 18px; height: 18px; }
.graph-card--sheet .gc-go {
  display: flex;
  justify-content: center;
  width: 100%;
  padding: 14px var(--s5);
  border-radius: var(--r-ctl);
  background: var(--fg);
  color: var(--bg);
}


.graph-legend {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s2) var(--s6);
  margin-top: var(--s5);
}
.graph-legend span { display: inline-flex; align-items: center; gap: var(--s2); }
.lg-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--fg); }
.lg-dot--minor { width: 6px; height: 6px; background: var(--muted); }
.lg-line { width: 22px; border-top: 1px dashed var(--faint); }
.lg-dot--ai { background: var(--bg); box-shadow: inset 0 0 0 2px var(--fg); }

/* sem JS: o grafo vira uma lista legível */
.graph-data { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s4); }
.graph-data .sum { display: block; color: var(--muted); font-size: var(--t-sm); }
.js .graph-data { display: none; }

/* ------------------------------------------------------------------ contato */

.contact { padding-block: var(--s10) var(--s9); border-top: 1px solid var(--line); }
.contact-grid {
  display: grid;
  grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
  gap: var(--s8);
  align-items: start;
}
.contact-intro { color: var(--muted); max-width: 46ch; margin: var(--s5) 0 var(--s7); }

.email {
  display: inline-block;
  font-size: clamp(1.5rem, .8rem + 3.2vw, 3.052rem);
  font-weight: 600;
  letter-spacing: -.03em;
  line-height: 1.1;
  word-break: break-all;
  background: linear-gradient(var(--accent), var(--accent)) 0 100% / 0 2px no-repeat;
  transition: background-size .5s var(--ease), color .3s var(--ease);
}
.email:hover { background-size: 100% 2px; color: var(--accent); }

.contact-actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s3); margin-top: var(--s5); }
.copy-msg { color: var(--accent); min-height: 1.2em; }

.links { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.links li { border-bottom: 1px solid var(--line); }
.links a {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: var(--s4);
  padding: var(--s5) 0;
  font-size: var(--t-md);
  font-weight: 500;
  transition: padding .4s var(--ease), color .3s var(--ease);
}
.links a:hover { padding-left: var(--s3); color: var(--accent); }
.links a .mono { transition: color .3s var(--ease); }

.cv {
  margin-top: var(--s7);
  padding: var(--s5);
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  display: grid;
  grid-template-columns: auto 1fr;
  gap: var(--s4) var(--s5);
  align-items: center;
}
.cv-doc {
  display: block;
  width: 84px;
  border-radius: 3px;
  overflow: hidden;
  background: #fff;
  border: 1px solid var(--line);
  box-shadow: 0 6px 16px -6px rgba(18, 20, 18, .25);
  transform: rotate(-2deg);
  transition: transform .45s var(--ease);
}
.cv-doc img { width: 100%; height: auto; }
.cv:hover .cv-doc { transform: rotate(0) translateY(-3px); }
.cv h3 { font-size: var(--t-md); }
.cv-actions { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: var(--s3); }

@media (max-width: 900px) {
  .contact-grid { grid-template-columns: 1fr; gap: var(--s7); }
}

/* dialog do currículo */
.cv-dialog {
  width: min(920px, calc(100vw - 32px));
  height: min(92vh, 1200px);
  padding: 0;
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  background: var(--bg-2);
  color: var(--fg);
  overflow: hidden;
}
.cv-dialog::backdrop { background: rgba(18, 20, 18, .45); }
.cv-dialog[open] { display: flex; flex-direction: column; }
@media (prefers-reduced-motion: no-preference) {
  .cv-dialog[open] { animation: dlg .45s var(--ease); }
  .cv-dialog[open]::backdrop { animation: fade .3s var(--ease); }
}
@keyframes dlg { from { opacity: 0; transform: translateY(16px) scale(.98); } }
@keyframes fade { from { opacity: 0; } }
.cv-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s4);
  padding: var(--s3) var(--s3) var(--s3) var(--s5);
  border-bottom: 1px solid var(--line);
}
.cv-bar div { display: flex; gap: var(--s2); }
.cv-dialog iframe { flex: 1; width: 100%; border: 0; background: #fff; }
.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: var(--r-ctl);
  transition: background-color .2s var(--ease);
}
.icon-btn:hover { background: var(--bg-3); }
.icon-btn svg { width: 18px; height: 18px; }

/* ------------------------------------------------------------------ rodapé */

.foot {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: var(--s4);
  padding-block: var(--s6);
  border-top: 1px solid var(--line);
}
.foot-mail { display: inline-flex; align-items: baseline; gap: var(--s3); }
.foot-copy {
  padding: 2px 10px; border: 1px solid var(--line-strong); border-radius: var(--r-ctl);
  background: none; color: var(--muted); cursor: pointer; transition: border-color .2s var(--ease), color .2s var(--ease);
}
.foot-copy:hover { border-color: var(--fg); color: var(--fg); }

/* ------------------------------------------------------------------ página de projeto */

.pj-head { padding-top: 160px; padding-bottom: var(--s8); }
/* 404 */
.nf { min-height: calc(100svh - 96px); }
.nf-code { color: var(--accent); margin-bottom: var(--s4); }
.back {
  display: inline-flex;
  align-items: center;
  gap: var(--s2);
  margin-bottom: var(--s7);
  color: var(--muted);
  font-size: var(--t-sm);
  transition: color .2s var(--ease);
}
.back svg { width: 16px; height: 16px; transition: transform .3s var(--ease); }
.back:hover { color: var(--fg); }
.back:hover svg { transform: translateX(-3px); }

.pj-title {
  font-size: clamp(3rem, 1.6rem + 5.4vw, 5.6rem);
  line-height: .95;
  letter-spacing: -.035em;
  margin-bottom: var(--s5);
  view-transition-name: pj-title;
}
.pj-kind { font-size: var(--t-md); color: var(--muted); max-width: 40ch; margin-bottom: var(--s6); }
.pj-links { display: flex; flex-wrap: wrap; gap: var(--s3); }

.pj-media { margin: 0 0 var(--s9); }
.stage {
  display: grid;
  place-items: center;
  padding: clamp(24px, 5vw, 64px);
  background: var(--bg-3);
  border-radius: var(--r-card);
  overflow: hidden;
}
.stage img { max-width: 100%; height: auto; border-radius: var(--r-media); box-shadow: 0 18px 40px -18px rgba(18, 20, 18, .35); }
.stage .phones { width: 100%; }
.stage .phones img { border-radius: 18px; }
.stage--split { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s4); align-items: start; padding: clamp(12px, 2.5vw, 32px); }
.stage--split .shot-col { display: grid; gap: var(--s5); }
.stage svg { width: 100%; height: auto; max-width: 920px; }
.pj-media figcaption { margin-top: var(--s3); }
/* legendas: um passo acima do mono padrão, para não sumirem no celular */
figcaption.mono { font-size: var(--t-sm); line-height: 1.5; }
/* Galeria com uma legenda por imagem (Widgets): o nome em grafite, o detalhe em cinza. */
.shots { display: grid; gap: var(--s7); }
.shot, .inline-shot { margin: 0; }
.shot figcaption, .inline-shot figcaption { margin-top: var(--s3); }
.shot figcaption b, .inline-shot figcaption b { color: var(--fg); font-weight: 500; }
/* Imagem dentro do texto: palco mais justo, para a imagem caber no tamanho natural. */
.inline-shot { margin: var(--s5) 0 var(--s6); }
.inline-shot .stage { padding: clamp(16px, 3vw, 32px); }
/* Os widgets do Widgets direto na página (gravados do app, cada um no próprio vidro, sem palco).
   Dois por linha no tamanho médio do app a 1,5x (480 x 231); um por linha no celular. */
.wgrid { display: grid; grid-template-columns: repeat(2, minmax(0, 480px)); justify-content: center; gap: var(--s7) var(--s6); }
.wcard { margin: 0; }
.wcard img { display: block; width: 100%; height: auto; border-radius: 8.125% / 16.88%; box-shadow: 0 1px 2px rgba(18, 20, 18, .08), 0 22px 44px -22px rgba(18, 20, 18, .45); }
.wcard figcaption { margin-top: var(--s3); }
.wcard figcaption b { color: var(--fg); font-weight: 500; }
@media (max-width: 760px) { .wgrid { grid-template-columns: minmax(0, 480px); gap: var(--s6); } }
.prose > .why { font-size: .9375rem; }
.prose > .why b { color: var(--fg); font-weight: 500; }
.phones { display: grid; grid-template-columns: repeat(var(--n, 3), minmax(0, 1fr)); gap: var(--s5); max-width: calc(var(--n, 3) * 280px); margin-inline: auto; }
.phones img { border-radius: 18px; }
@media (max-width: 640px) { .phones { gap: var(--s2); } .phones img { border-radius: 10px; } .stage--split { grid-template-columns: 1fr; } }

.pj-body {
  display: grid;
  grid-template-columns: minmax(0, 4fr) minmax(0, 8fr);
  gap: var(--s8);
  padding-bottom: var(--s9);
}
.facts {
  position: sticky;
  top: 112px;
  align-self: start;
  margin: 0;
  display: grid;
  gap: var(--s5);
}
.facts div { border-top: 1px solid var(--line); padding-top: var(--s3); }
.facts dt { margin-bottom: var(--s1); }
.facts dd { margin: 0; font-size: .9375rem; }

.prose { max-width: 66ch; }
.prose h2 {
  font-size: var(--t-xl);
  letter-spacing: -.02em;
  margin: var(--s8) 0 var(--s4);
}
.prose h2:first-child { margin-top: 0; }
.prose p { color: var(--muted); margin-bottom: var(--s4); }
.prose p strong { color: var(--fg); font-weight: 500; }
.prose ul { padding-left: 1.1em; color: var(--muted); margin: 0 0 var(--s4); }
.prose li { margin-bottom: var(--s2); }
.prose li::marker { color: var(--faint); }
.prose code {
  font-family: var(--font-mono);
  font-size: .85em;
  padding: 2px 6px;
  border-radius: 4px;
  background: var(--bg-3);
  color: var(--fg);
}
.prose pre, .prose-pre {
  font-family: var(--font-mono);
  font-size: var(--t-xs);
  line-height: 1.6;
  padding: var(--s5);
  margin: 0 0 var(--s5);
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--r-media);
  overflow-x: auto;
  color: var(--muted);
}
.prose pre b { color: var(--accent); font-weight: 400; }

.decisions { list-style: none; padding: 0; margin: 0; }
.decisions li {
  padding: var(--s5) 0;
  border-top: 1px solid var(--line);
  margin: 0;
}
.decisions h3 { font-size: var(--t-md); letter-spacing: -.01em; margin-bottom: var(--s2); color: var(--fg); }
.decisions p { margin-bottom: var(--s2); }
.decisions p:last-child { margin-bottom: 0; }
.decisions .why { font-size: .9375rem; }
.decisions .why b { color: var(--fg); font-weight: 500; }

@media (max-width: 860px) {
  .pj-body { grid-template-columns: 1fr; gap: var(--s7); }
  .facts { position: static; grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

.next {
  display: block;
  padding-block: var(--s9);
  border-top: 1px solid var(--line);
}
.next .mono { display: block; margin-bottom: var(--s3); }
.next strong {
  display: inline-flex;
  align-items: center;
  gap: var(--s4);
  font-size: clamp(2.441rem, 1.4rem + 4vw, 4.768rem);
  font-weight: 600;
  letter-spacing: -.035em;
  line-height: 1;
  transition: color .3s var(--ease);
}
.next strong svg { width: .6em; height: .6em; transition: transform .45s var(--ease); }
.next:hover strong { color: var(--accent); }
.next:hover strong svg { transform: translateX(10px); }

/* ------------------------------------------------------------------ entrada e revelação */

.js [data-enter] { opacity: 0; }
.js .hero-name .line > span { transform: translateY(105%); }
.js .portrait-frame { clip-path: inset(100% 0 0 0); }

.is-ready [data-enter] {
  animation: rise .6s var(--ease) both;
  animation-delay: calc(var(--i, 0) * 90ms + 250ms);
}
.is-ready .hero-name .line > span {
  animation: mask .9s var(--ease) both;
  animation-delay: calc(var(--i, 0) * 110ms);
}
.is-ready .portrait-frame { animation: wipe 1.1s var(--ease-in-out) .15s both; }
.is-ready .portrait-frame img { animation: settle 1.6s var(--ease) .15s both; }

@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes mask { from { transform: translateY(105%); } to { transform: none; } }
@keyframes wipe { from { clip-path: inset(100% 0 0 0); } to { clip-path: inset(0 0 0 0); } }
@keyframes settle { from { transform: scale(1.18); } to { transform: scale(1.04); } }

.js [data-reveal] {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity .6s var(--ease), transform .6s var(--ease);
  transition-delay: calc(var(--i, 0) * 80ms);
}
.js [data-reveal].is-in { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  .js [data-enter], .js [data-reveal] { opacity: 1; transform: none; }
  .js .hero-name .line > span { transform: none; }
  .js .portrait-frame { clip-path: none; }
  .is-ready [data-enter], .is-ready .hero-name .line > span,
  .is-ready .portrait-frame, .is-ready .portrait-frame img { animation: none; }
  .node, .node-dot, .node-label, .graph-card, .edge, .btn, .links a, .email { transition: none; }
}

/* ------------------------------------------------------------------ diagrama (SVG inline) */
.dg-box { fill: var(--bg-2); stroke: var(--line-strong); stroke-width: 1; }
.dg-chip { fill: var(--bg-3); stroke: var(--line-strong); stroke-width: 1; }
.dg-chip--key { fill: var(--fg); stroke: var(--fg); }
.dg-t { fill: var(--fg); font-family: var(--font-text); font-size: 15px; font-weight: 600; }
.dg-chip--key + .dg-t, .dg-t--inv { fill: var(--bg-2); }
.dg-s { fill: var(--muted); font-family: var(--font-mono); font-size: 12px; }
.dg-ln { fill: none; stroke: var(--faint); stroke-width: 1.25; }
.dg-sep { fill: none; stroke: var(--line-strong); stroke-width: 1; stroke-dasharray: 3 5; }
.dg-ah { fill: var(--faint); }
.dg-dot { fill: var(--accent); }

/* imagem que já tem o fundo do palco (ex.: leque de cartas): sem moldura própria */
.stage--bleed { padding: 0; }
.stage img.flat { box-shadow: none; border-radius: 0; width: 100%; }
