/* ===== Tokens ===== */
:root {
  --bg: #0e0e0e;
  --bg-deep: #000000;
  --paper: #f5f5f5;
  --muted: #9a9a9a;
  --accent: #dc143c; /* carmim */
  --line: rgba(255, 255, 255, 0.18);
  --line-strong: rgba(255, 255, 255, 0.35);
  --serif: "Instrument Serif", Georgia, serif;
  --mono: "IBM Plex Mono", ui-monospace, Menlo, Consolas, monospace;
  --gutter: 56px;
  /* Heatmap do GitHub em escala de carmim */
  --heat-0: rgba(255, 255, 255, 0.06);
  --heat-1: color-mix(in srgb, var(--accent) 30%, var(--bg));
  --heat-2: color-mix(in srgb, var(--accent) 55%, var(--bg));
  --heat-3: color-mix(in srgb, var(--accent) 78%, var(--bg));
  --heat-4: var(--accent);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; scroll-padding-top: 72px; }
body {
  background: var(--bg);
  color: var(--paper);
  font-family: var(--mono);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
a { color: inherit; text-decoration: none; }
ul, ol { list-style: none; }
em { font-family: var(--serif); font-style: italic; }

.accent { color: var(--accent); }
.muted { color: var(--muted); }
.strong { color: var(--paper); }
.label {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

/* ===== Header ===== */
.header {
  position: sticky; top: 0; z-index: 50;
  display: flex; justify-content: space-between; align-items: center;
  padding: 24px var(--gutter);
  background: rgba(14, 14, 14, 0.88);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.logo, .nav a { font-size: 12px; letter-spacing: 0.14em; text-transform: uppercase; }
.logo .accent { font-size: 16px; margin-right: 6px; display: inline-block; transition: transform .6s; }
.logo:hover .accent { transform: rotate(180deg); }
.header-right { display: flex; align-items: center; gap: 32px; }
.nav { display: flex; gap: 36px; }

/* Botão de idioma em pílula */
.lang-switch {
  display: inline-flex; padding: 3px; gap: 2px;
  border: 1px solid var(--line-strong); border-radius: 999px;
  font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase;
}
.lang-switch a, .lang-switch span {
  min-width: 40px; padding: 6px 12px; border-radius: 999px; text-align: center;
  transition: background .25s, color .25s;
}
.lang-switch a { color: var(--muted); }
.lang-switch a:hover { color: var(--paper); background: rgba(255, 255, 255, 0.1); }
.lang-switch .current { background: var(--paper); color: var(--bg); font-weight: 600; }
.nav a { position: relative; padding: 4px 0; }
.nav a::after {
  content: ""; position: absolute; left: 0; bottom: 0; height: 1px; width: 100%;
  background: var(--accent); transform: scaleX(0); transform-origin: left; transition: transform .3s;
}
.nav a:hover::after, .nav a.active::after { transform: scaleX(1); }

/* ===== Hero ===== */
.hero { padding: 40px var(--gutter) 120px; display: flex; flex-direction: column; gap: 48px; }
.masthead {
  display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  padding: 12px 0; border-top: 3px solid var(--paper); border-bottom: 1px solid var(--line);
  font-size: 12px; letter-spacing: 0.14em; text-transform: uppercase;
}
.hero-title-row { display: flex; justify-content: space-between; align-items: flex-end; gap: 32px; flex-wrap: wrap; }
.hero-title {
  font-family: var(--serif); font-weight: 400;
  font-size: clamp(96px, 17.2vw, 248px); line-height: 0.95; letter-spacing: -0.04em; padding-bottom: 20px;
}
.title-aside { display: flex; flex-direction: column; gap: 10px; width: 300px; padding-bottom: 12px; }
.aside-name { font-family: var(--serif); font-style: italic; font-size: 40px; line-height: 44px; }

.hero-body { display: flex; gap: 56px; align-items: stretch; }
.hero-left { display: flex; flex-direction: column; justify-content: space-between; gap: 48px; width: 620px; flex-shrink: 0; min-height: 660px; }
.about-short { display: flex; flex-direction: column; gap: 24px; max-width: 540px; }
.lead { font-family: var(--serif); font-size: 38px; line-height: 46px; letter-spacing: -0.01em; }
.facts > div { display: flex; padding: 12px 0; border-top: 1px solid var(--line); }
.facts > div:last-child { border-bottom: 1px solid var(--line); }
.facts dt { width: 140px; flex-shrink: 0; align-self: center; }
.facts dd { font-size: 14px; }

.socials { display: flex; flex-direction: column; gap: 16px; max-width: 540px; }
.social-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.social {
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px 16px; border: 1px solid var(--paper);
  font-size: 13px; letter-spacing: 0.1em; text-transform: uppercase;
  transition: background .25s, color .25s, transform .25s;
}
.social .accent { transition: color .25s, transform .25s; }
.social:hover { background: var(--paper); color: var(--bg); transform: translateY(-2px); }
.social:hover .accent { transform: translate(3px, -3px); }
.social[aria-disabled="true"] { opacity: .55; cursor: default; pointer-events: none; }

.hero-photo {
  position: relative; flex: 1; min-height: 660px; padding: 24px;
  display: flex; flex-direction: column; justify-content: space-between;
  background: linear-gradient(160deg, #3a3a3a 0%, #1a1a1a 55%, #0a0a0a 100%);
  border: 1px solid var(--line);
  overflow: visible;
}
.photo-top { display: flex; justify-content: space-between; }
.ascii-stage { position: absolute; inset: 64px 16px 150px; display: grid; place-items: center; }
#ascii-laptop { margin: 0; font-family: var(--mono, ui-monospace, Menlo, Consolas, monospace); line-height: 1; white-space: pre; color: var(--paper); user-select: none; -webkit-user-select: none; }

.ticker-card {
  position: absolute; left: -96px; bottom: 72px; width: 560px; max-width: calc(100% + 96px);
  background: var(--paper); color: #0e0e0e; overflow: hidden;
  box-shadow: 8px 8px 0 rgba(220, 20, 60, 0.9);
}
.ticker-head { display: flex; justify-content: space-between; align-items: center; border-bottom: 2px solid #0e0e0e; }
.ticker-tag { padding: 8px 14px; background: var(--accent); color: var(--paper); font-size: 12px; font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase; }
.ticker-edition { padding: 0 14px; font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase; color: #5e5e5e; }
.ticker-line { overflow: hidden; white-space: nowrap; }
.mono-line { padding: 14px 0 4px; font-size: 13px; letter-spacing: 0.12em; text-transform: uppercase; }
.serif-line { padding: 0 0 16px; font-family: var(--serif); font-style: italic; font-size: 44px; line-height: 50px; }
.ticker-track { display: inline-flex; animation: marquee 28s linear infinite; will-change: transform; }
.ticker-track.slow { animation-duration: 40s; animation-direction: reverse; }
.ticker-card:hover .ticker-track { animation-play-state: paused; }
@keyframes marquee { to { transform: translateX(-50%); } }

/* ===== Sections ===== */
.section { padding: 120px var(--gutter) 40px; }
.section + .section { padding-top: 140px; }
.section-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 24px; margin-bottom: 56px; flex-wrap: wrap; }
.section-title { font-family: var(--serif); font-weight: 400; font-size: 72px; line-height: 72px; letter-spacing: -0.02em; }

/* GitHub */
.gh-hero { display: flex; align-items: flex-end; gap: 32px; flex-wrap: wrap; padding: 12px 0 40px; border-top: 3px solid var(--paper); }
.gh-total { font-family: var(--serif); font-size: 200px; line-height: 0.85; letter-spacing: -0.04em; }
.gh-total-label { font-family: var(--serif); font-size: 32px; line-height: 38px; max-width: 320px; padding-bottom: 12px; }
.gh-stats { display: grid; grid-template-columns: repeat(4, 1fr); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.gh-stats > div { display: flex; flex-direction: column; gap: 8px; padding: 28px 24px; }
.gh-stats > div + div { border-left: 1px solid var(--line); }
.gh-stats dd { font-family: var(--serif); font-size: 56px; line-height: 56px; }
.gh-scroll { margin-top: 48px; overflow-x: auto; padding-bottom: 8px; scrollbar-color: var(--line-strong) transparent; }
.gh-months, .gh-grid { display: grid; grid-template-columns: repeat(53, 14px); column-gap: 4px; width: max-content; }
.gh-months { margin-bottom: 10px; font-size: 10px; }
.gh-grid { grid-template-rows: repeat(7, 14px); row-gap: 4px; }
.gh-cell { border-radius: 2px; background: var(--heat-0); }
.gh-cell[data-level="1"] { background: var(--heat-1); }
.gh-cell[data-level="2"] { background: var(--heat-2); }
.gh-cell[data-level="3"] { background: var(--heat-3); }
.gh-cell[data-level="4"] { background: var(--heat-4); }
.gh-note { margin-top: 32px; }

/* Works */
.work {
  display: flex; align-items: center; padding: 36px 0; border-top: 1px solid var(--line);
  position: relative; transition: padding-left .35s, background .35s;
}
.work:last-child { border-bottom: 1px solid var(--line); }
.work .idx { width: 80px; flex-shrink: 0; }
.work-name { flex: 1; font-family: var(--serif); font-size: 64px; line-height: 64px; letter-spacing: -0.02em; transition: color .3s, transform .35s; }
.work .kind { width: 280px; flex-shrink: 0; }
.work .year { width: 100px; flex-shrink: 0; }
.work .go { width: 200px; flex-shrink: 0; text-align: right; transition: transform .3s; }
.work:hover { background: linear-gradient(90deg, rgba(220, 20, 60, 0.1), transparent 70%); padding-left: 16px; }
.work:hover .work-name { color: var(--paper); transform: translateX(8px); }
.work:hover .go { transform: translateX(-8px); }

/* Experience */
.two-cols { display: flex; gap: 56px; align-items: flex-start; }
.col { flex: 1 1 0; min-width: 0; }
.col-white { border-top: 3px solid var(--paper); }
.col-red { border-top: 3px solid var(--accent); }
.col-head { display: flex; justify-content: space-between; padding: 16px 0 24px; }
.entry { display: flex; flex-direction: column; gap: 16px; padding: 28px 0 40px; border-top: 1px solid var(--line); }
.col .entry:last-child { border-bottom: 1px solid var(--line); }
.entry-meta { display: flex; gap: 16px; }
.entry-title { font-family: var(--serif); font-weight: 400; font-size: 36px; line-height: 40px; letter-spacing: -0.01em; }
.bullets { font-size: 14px; line-height: 24px; }
.bullets li::before { content: "— "; }
.tags { display: flex; flex-wrap: wrap; gap: 8px; padding-top: 8px; }
.tag { padding: 6px 10px; border: 1px solid var(--line-strong); font-size: 12px; transition: background .25s, color .25s, border-color .25s; }
.tag.hot { border-color: var(--accent); }
.tag:hover { background: var(--paper); color: var(--bg); border-color: var(--paper); }

/* Stack */
.stack-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 32px; align-items: start; }
.stack-group { border-top: 1px solid var(--line-strong); }
.stack-group.focus { border-top: 3px solid var(--accent); }
.group-title { display: block; padding: 16px 0 20px; }
.stack-group li {
  padding: 14px 0; border-top: 1px solid var(--line);
  font-family: var(--serif); font-size: 32px; line-height: 36px;
  transition: padding-left .3s, color .3s;
}
.stack-group li:last-child { border-bottom: 1px solid var(--line); }
.stack-group li:hover { padding-left: 12px; color: var(--accent); }
.stack-group li.studying { color: var(--muted); }

/* About */
.about { display: flex; gap: 56px; padding-bottom: 140px; }
.letter { display: flex; flex-direction: column; gap: 28px; width: 520px; flex-shrink: 0; }
.principles li { display: flex; gap: 20px; padding: 20px 0; border-top: 1px solid var(--line); transition: padding-left .3s; }
.principles li:last-child { border-bottom: 1px solid var(--line); }
.principles li:hover { padding-left: 8px; }
.principles .num { width: 32px; flex-shrink: 0; padding-top: 8px; }
.principles h3 { font-family: var(--serif); font-weight: 400; font-size: 30px; line-height: 34px; letter-spacing: -0.01em; margin-bottom: 8px; }
.principles p { font-size: 14px; line-height: 22px; }
.author { display: flex; flex-direction: column; gap: 40px; flex: 1; padding-left: 56px; border-left: 1px solid var(--line); }
.author-lead { font-family: var(--serif); font-size: 52px; line-height: 58px; letter-spacing: -0.01em; max-width: 696px; }
.author-meta { display: flex; gap: 40px; flex-wrap: wrap; }
.author-meta > div { display: flex; flex-direction: column; gap: 12px; min-width: 160px; max-width: 240px; }
.author-meta p { font-size: 14px; line-height: 22px; }
.author-meta a:hover { color: var(--accent); }

/* Footer */
.footer { background: var(--bg-deep); padding: 72px var(--gutter) 40px; display: flex; flex-direction: column; gap: 80px; }
.footer-top { display: flex; justify-content: space-between; gap: 48px; flex-wrap: wrap; }
.footer-id { display: flex; flex-direction: column; gap: 14px; width: 360px; max-width: 100%; }
.footer-id .label { font-size: 11px; }
.footer-role { font-family: var(--serif); font-size: 32px; line-height: 36px; letter-spacing: -0.01em; }
.footer-info { font-size: 13px; line-height: 20px; }
.footer-cols { display: flex; gap: 72px; flex-wrap: wrap; }
.footer-cols > div { display: flex; flex-direction: column; gap: 14px; min-width: 160px; font-size: 13px; line-height: 20px; }
.footer-cols .label { font-size: 11px; }
.footer-cols a { transition: color .25s; }
.footer-cols a:hover { color: var(--accent); }
.footer-bottom { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; padding-top: 24px; border-top: 1px solid var(--line); font-size: 12px; letter-spacing: 0.1em; color: var(--muted); }

/* ===== Scroll reveal ===== */
.js .reveal {
  opacity: 0; transform: translateY(32px);
  transition: opacity .8s cubic-bezier(.2,.7,.2,1) var(--d, 0s), transform .8s cubic-bezier(.2,.7,.2,1) var(--d, 0s);
}
.js .reveal.in { opacity: 1; transform: none; }
.js .hero-title.reveal { transform: translateY(60px); transition-duration: 1.1s; }
.js .work.reveal:nth-child(2) { --d: .06s; }
.js .work.reveal:nth-child(3) { --d: .12s; }
.js .work.reveal:nth-child(4) { --d: .18s; }
.js .work.reveal:nth-child(5) { --d: .24s; }
/* a linha das colunas "desenha" ao entrar */
.js .col.reveal { border-top-color: transparent; }
.js .col.reveal.in { border-top-color: inherit; }
.js .col-white.reveal.in { border-top-color: var(--paper); }
.js .col-red.reveal.in { border-top-color: var(--accent); }

/* Works: compact two-column variant */
.works-compact .work { align-items: flex-start; padding: 28px 0; }
.works-compact .work .idx { width: 48px; padding-top: 10px; }
.work-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 10px; }
.works-compact .work-name { font-size: 40px; line-height: 44px; color: inherit; text-decoration: none; }
.work-desc { margin: 0; max-width: 46ch; opacity: .8; }
.works-compact .work .kind { width: auto; display: block; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .js .reveal { opacity: 1; transform: none; transition: none; }
  .ticker-track { animation: none; }
}

/* ===== Responsivo ===== */
@media (max-width: 1100px) {
  :root { --gutter: 32px; }
  .hero-body { flex-direction: column; }
  .hero-left { width: 100%; min-height: 0; }
  .hero-photo { min-height: 520px; }
  .ticker-card { left: 16px; max-width: calc(100% - 32px); }
  .two-cols { flex-direction: column; gap: 48px; }
  .col { width: 100%; }
  .stack-grid { grid-template-columns: repeat(2, 1fr); }
  .about { flex-direction: column; }
  .letter { width: 100%; }
  .author { padding-left: 0; border-left: 0; border-top: 1px solid var(--line); padding-top: 40px; }
  .author-lead { font-size: 40px; line-height: 46px; }
  .work-name { font-size: 48px; line-height: 52px; }
  .gh-total { font-size: 140px; }
  .gh-stats { grid-template-columns: repeat(2, 1fr); }
  .gh-stats > div:nth-child(3) { border-left: 0; }
  .gh-stats > div:nth-child(n+3) { border-top: 1px solid var(--line); }
  .work .kind { width: 200px; }
}
@media (max-width: 700px) {
  :root { --gutter: 20px; }
  .header { padding: 18px var(--gutter); }
  .header-right { width: 100%; justify-content: space-between; gap: 12px; }
  .nav { gap: 12px; }
  .nav a { font-size: 10px; letter-spacing: 0.08em; }
  .lang-switch { font-size: 10px; }
  .lang-switch a, .lang-switch span { min-width: 32px; padding: 5px 8px; }
  .logo { display: none; }
  .hero { padding-bottom: 80px; }
  .masthead span:nth-child(2) { display: none; }
  .title-aside { width: 100%; }
  .lead { font-size: 30px; line-height: 38px; }
  .social-grid { grid-template-columns: 1fr; }
  .hero-photo { min-height: 540px; }
  .ascii-stage { inset: 56px 8px 190px; }
  .serif-line { font-size: 32px; line-height: 38px; }
  .section { padding-top: 80px; }
  .section + .section { padding-top: 90px; }
  .section-title { font-size: 48px; line-height: 50px; }
  .work { flex-wrap: wrap; row-gap: 8px; }
  .work .idx { width: 40px; }
  .work-name { font-size: 36px; line-height: 40px; flex-basis: calc(100% - 40px); }
  .work .kind, .work .year { display: none; }
  .works-compact .work .kind { display: block; }
  .works-compact .work-name { font-size: 32px; line-height: 36px; flex-basis: auto; }
  .work .go { width: auto; margin-left: 40px; text-align: left; }
  .entry-title { font-size: 30px; line-height: 34px; }
  .stack-grid { grid-template-columns: 1fr; }
  .gh-total { font-size: 96px; }
  .gh-total-label { font-size: 24px; line-height: 30px; }
  .gh-stats > div { padding: 20px 16px; }
  .gh-stats dd { font-size: 40px; line-height: 40px; }
  .author-lead { font-size: 32px; line-height: 38px; }
  .footer-cols { gap: 40px; }
}
