:root,
[data-theme="dark"] {
  --bg: #0A0A0B; --panel: #141317; --panel2: #1C1B21;
  --line: #26252D; --line-hi: #393743;
  --fg: #F5F3F0; --soft: #C4C1BC; --muted: #9A968F; --faint: #7E7A73;
  --accent: #FF8A3D; --accent-text: rgb(255,149,66); --accent-ink: #190A00;
  --accent-line: rgba(255,138,61,.34); --accent-dim: rgba(255,138,61,.11);
  --live-bg: #3FD97F; --live-ink: #062D16; --dot: rgba(255,255,255,.042);
  color-scheme: dark;
}
[data-theme="light"] {
  --bg: #FAF9F7; --panel: #FFFFFF; --panel2: #F3F1ED;
  --line: #E6E3DC; --line-hi: #CBC7BE;
  --fg: #15141A; --soft: #3C3A3E; --muted: #5C5952; --faint: #6E6B64;
  --accent-text: rgb(128,69,31); --accent-line: rgba(128,69,31,.3); --accent-dim: rgba(255,138,61,.14);
  --live-bg: #9DEFC0; --live-ink: #06351B; --dot: rgba(0,0,0,.05);
  color-scheme: light;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
/* the liquid-name canvas bleeds past the text box; never let it widen the page (clip keeps sticky working) */
html, body { overflow-x: clip; }
body {
  margin: 0; min-height: 100vh;
  background-color: var(--bg);
  background-image: radial-gradient(var(--dot) 1px, transparent 1px);
  background-size: 24px 24px;
  color: var(--fg);
  font-family: Inter, system-ui, sans-serif;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
a { color: var(--accent-text); text-decoration: none; }
a:hover { color: var(--fg); }
p, h1, h2, h3, h4 { margin: 0; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 6px; }

.mono { font-family: 'JetBrains Mono', ui-monospace, monospace; }
.display { font-family: 'Bricolage Grotesque', 'Trebuchet MS', sans-serif; }
.accent { color: var(--accent-text); }
.stack-10 { display: flex; flex-direction: column; gap: 10px; }
.stack-3 { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.row-wrap { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }

.wrap { position: relative; z-index: 1; max-width: 1240px; margin: 0 auto; padding: 0 24px 112px; }

/* header background: GradientASCII canvas, fades into the page */
.ascii-header {
  position: absolute; top: 0; left: 0; right: 0; height: 260px; z-index: 0;
  overflow: hidden; pointer-events: none;
  -webkit-mask-image: linear-gradient(to bottom, #000 18%, rgba(0,0,0,.35) 42%, transparent 62%);
  mask-image: linear-gradient(to bottom, #000 18%, rgba(0,0,0,.35) 42%, transparent 62%);
}
.gradient-ascii-canvas { position: absolute; inset: 0; display: block; width: 100%; height: 100%; }
@media (max-width: 520px) { .ascii-header { height: 220px; } }

/* top bar */
.topbar { display: flex; flex-wrap: wrap; gap: 16px; align-items: center; justify-content: space-between; padding: 24px 0 40px; }
.brand {
  display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 16px; border-radius: 999px;
  border: 1px solid var(--line-hi); background: var(--panel);
  font-size: 12px; letter-spacing: .02em; color: var(--fg);
}
.brand:hover { color: var(--accent-text); border-color: var(--accent-line); }
.topbar .ico { background: var(--panel); border-color: var(--line-hi); color: var(--fg); }
.sec-head, .profile { text-shadow: 0 0 6px var(--bg), 0 0 14px var(--bg), 0 0 24px var(--bg); }

.topbar-actions { display: flex; gap: 10px; align-items: center; }

/* language: segmented PT | EN | ES, opaque so the header effect stays behind it */
.lang-switch { display: inline-flex; padding: 3px; gap: 2px; border: 1px solid var(--line-hi); border-radius: 999px; background: var(--panel); }
.lang-switch button {
  min-width: 44px; height: 36px; padding: 0 10px; border: 0; border-radius: 999px; background: transparent;
  color: var(--muted); font: inherit; font-size: 11px; letter-spacing: .08em; cursor: pointer;
  transition: color .2s ease, background-color .2s ease;
}
.lang-switch button:hover { color: var(--fg); background: var(--panel2); }
.lang-switch button[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); }

/* icon buttons */
.ico {
  width: 44px; height: 44px; padding: 0; display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--line); border-radius: 999px; background: var(--panel); color: var(--muted); cursor: pointer;
  font-size: 11px; letter-spacing: .08em;
  transition: border-color .12s ease, color .12s ease, background-color .12s ease;
}
.ico-dashed { border-style: dashed; border-color: var(--line-hi); }
/* hover: ring + glyph take the accent, surface stays put (reference: ~120 ms, no lift) */
.ico:hover { border-color: var(--accent); color: var(--accent-text); background: var(--panel); }

/* layout */
.layout { display: flex; flex-wrap: wrap; gap: 56px; align-items: flex-start; }
.rail { flex: 1 1 290px; min-width: 0; max-width: 340px; display: flex; flex-direction: column; gap: 26px; }
.feed { flex: 999 1 560px; min-width: 0; display: flex; flex-direction: column; gap: 64px; }
@media (min-width: 960px) { .rail { position: sticky; top: 24px; } }
@media (max-width: 959px) { .rail { max-width: none; } }

/* profile */
.profile { display: flex; flex-direction: column; gap: 20px; }
.avatar { position: relative; width: 98px; height: 98px; }
.avatar-face {
  width: 98px; height: 98px; border-radius: 999px; border: 3px solid var(--panel2); background: var(--accent-dim);
  box-shadow: 0 0 0 1px var(--line); display: block; object-fit: cover;
}
.avatar-dot { position: absolute; right: 3px; bottom: 3px; width: 20px; height: 20px; border-radius: 999px; background: var(--live-bg); border: 3px solid var(--bg); }
.name { font-weight: 600; font-size: 40px; line-height: 1.02; letter-spacing: -.038em; text-wrap: balance; }
.loc { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); }
.loc svg { flex: none; }
.role { font-size: 14px; font-weight: 500; line-height: 1.45; color: var(--accent-text); }
.cv-btn { align-self: flex-start; min-height: 44px; }
.bio { font-size: 16px; line-height: 1.62; color: var(--soft); text-wrap: pretty; }
.socials { display: flex; gap: 10px; flex-wrap: wrap; }

/* nav */
.nav { display: flex; flex-direction: column; gap: 1px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 10px 0; margin-left: -10px; }
.navlink { position: relative; display: flex; gap: 14px; align-items: center; min-height: 44px; padding: 0 10px; color: var(--soft); transition: color .22s ease, padding-left .26s cubic-bezier(.22,1,.36,1); }
.navbar { position: absolute; left: 0; top: 50%; width: 2px; height: 0; background: var(--accent); border-radius: 2px; transform: translateY(-50%); transition: height .26s cubic-bezier(.22,1,.36,1); }
.navnum { font-size: 10px; letter-spacing: .1em; color: var(--faint); flex: none; transition: color .22s ease; }
.navlabel { font-weight: 500; font-size: 17px; letter-spacing: -.015em; }
.navlink:hover, .navlink.is-active { padding-left: 20px; color: var(--fg); }
.navlink:hover .navbar, .navlink.is-active .navbar { height: 20px; }
.navlink:hover .navnum, .navlink.is-active .navnum { color: var(--accent-text); }
.rail-foot { font-size: 11px; line-height: 1.85; white-space: pre-line; color: var(--faint); }

/* sections */
.section { display: flex; flex-direction: column; gap: 20px; scroll-margin-top: 24px; }
.section-tight { gap: 14px; }
.sec-head { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 20px; justify-content: space-between; }
.sec-title { display: flex; align-items: center; gap: 12px; min-width: 0; }
.sec-title h2 { font-weight: 600; font-size: 25px; letter-spacing: -.032em; }
.sec-ico { width: 32px; height: 32px; flex: none; border-radius: 10px; background: var(--panel); border: 1px solid var(--line); display: flex; align-items: center; justify-content: center; color: var(--muted); }
.sec-sub { font-size: 11px; color: var(--muted); }

/* panels */
.panel { border: 1px solid var(--line); border-radius: 22px; background: var(--panel); display: flex; flex-direction: column; }
.card-accent { border-color: var(--accent-line); }
.card { transition: border-color .2s cubic-bezier(.22,1,.36,1), background-color .2s cubic-bezier(.22,1,.36,1); }
.card:hover { border-color: var(--line-hi); background-color: var(--panel2); }

/* hero */
.hero { padding: 40px; gap: 20px; scroll-margin-top: 24px; }
.who { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; }
.badge-lg { width: 44px; height: 44px; flex: none; border-radius: 13px; background: var(--accent); color: var(--accent-ink); display: flex; align-items: center; justify-content: center; font-weight: 600; font-size: 18px; }
.who-name { font-weight: 600; font-size: 19px; letter-spacing: -.022em; }
.meta { font-size: 11.5px; color: var(--muted); display: flex; align-items: center; gap: 5px; }
.pill-live { display: inline-flex; align-items: center; gap: 6px; font-size: 11px; letter-spacing: .02em; color: var(--live-ink); background: var(--live-bg); border-radius: 999px; padding: 4px 10px; }
.live { width: 5px; height: 5px; border-radius: 999px; background: currentColor; flex: none; }
.hero-title { font-weight: 600; font-size: clamp(32px, 6vw, 48px); line-height: 1.04; letter-spacing: -.035em; text-wrap: balance; }
.hero-body { max-width: 54ch; font-size: 16.5px; line-height: 1.6; color: var(--soft); text-wrap: pretty; }
.avail { display: inline-flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); }
.avail .live { width: 6px; height: 6px; color: var(--live-bg); }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 20px 32px; margin-top: 8px; padding-top: 24px; border-top: 1px solid var(--line); }
.stat { display: flex; flex-direction: column; gap: 4px; }
.stat-n { font-weight: 600; font-variant-numeric: tabular-nums; font-size: 28px; line-height: 1; letter-spacing: -.035em; }
.stat-l { font-size: 12px; line-height: 1.5; color: var(--muted); }

/* services */
.srow { display: flex; flex-wrap: wrap; gap: 12px 40px; align-items: flex-start; padding: 24px 0; border-bottom: 1px solid var(--line); transition: border-color .2s ease; }
.srow-head { display: flex; gap: 16px; align-items: baseline; flex: 1 1 280px; min-width: 0; }
.srow-num { font-size: 11px; letter-spacing: .1em; color: var(--faint); flex: none; transition: color .26s ease; }
.srow-title { font-weight: 600; font-size: 23px; line-height: 1.16; letter-spacing: -.03em; text-wrap: balance; transition: color .26s ease; }
.srow-body { flex: 1 1 340px; max-width: 50ch; min-width: 0; font-size: 15.5px; line-height: 1.62; color: var(--soft); text-wrap: pretty; }
.srow:hover { border-color: var(--line-hi); }
.srow:hover .srow-num, .srow:hover .srow-title { color: var(--accent-text); }
.note { margin-top: 10px; font-size: 11px; line-height: 1.7; color: var(--faint); }

/* chips */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { font-size: 11px; color: var(--muted); border: 1px solid var(--line); border-radius: 8px; padding: 5px 10px; background: var(--panel2); transition: border-color .2s ease, color .2s ease, background-color .2s ease; }
.chip-lg { font-size: 12px; color: var(--soft); padding: 6px 11px; }
.chip:hover { border-color: var(--accent-line); color: var(--accent-text); background-color: var(--accent-dim); }
.tag { font-size: 11px; color: var(--muted); border: 1px solid var(--line); border-radius: 999px; padding: 4px 10px; }
.tag-sm { font-size: 11px; padding: 2px 8px; }
.tag-accent { color: var(--accent-ink); background: var(--accent); border-color: var(--accent); }

/* projects: compact cards, more per row as the list grows */
#projects { grid-template-columns: repeat(auto-fill, minmax(min(260px, 100%), 1fr)); gap: 12px; }
.proj { padding: 20px; gap: 8px; border-radius: 16px; }
.proj-head { display: flex; align-items: center; gap: 12px; margin-bottom: 4px; }
.proj-logo { width: 36px; height: 36px; flex: none; border-radius: 10px; object-fit: contain; }
.proj-head .stack-3 { flex: 1 1 auto; }
.proj-name { font-weight: 600; font-size: 16px; letter-spacing: -.015em; }
.proj-status { display: inline-flex; align-items: center; gap: 6px; font-size: 11px; color: var(--muted); }
.proj-dot { width: 6px; height: 6px; border-radius: 999px; background: var(--accent); }
.proj-link { flex: none; display: inline-flex; color: var(--muted); }
.proj-link:hover { color: var(--accent-text); }
.proj-headline { font-weight: 500; font-size: 15px; line-height: 1.4; color: var(--fg); text-wrap: balance; }
.proj-desc { font-size: 14px; line-height: 1.55; color: var(--soft); text-wrap: pretty; }
.proj .fine { margin-top: auto; padding-top: 4px; }
.body-16 { max-width: 50ch; font-size: 16px; line-height: 1.6; color: var(--soft); text-wrap: pretty; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(260px, 100%), 1fr)); gap: 16px; }
.body-sm { font-size: 14.5px; line-height: 1.58; color: var(--soft); text-wrap: pretty; }
.fine { font-size: 11px; color: var(--faint); }

/* experience */
.lead { padding: 32px; gap: 20px; }
.lead-headline { max-width: 58ch; font-size: 17px; line-height: 1.56; text-wrap: pretty; }
.points { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 11px; }
.points li { display: flex; gap: 12px; font-size: 15px; line-height: 1.6; color: var(--soft); }
.points .arrow { color: var(--accent-text); flex: none; font-size: 13px; line-height: 1.75; }
.points-sm li { font-size: 14.5px; line-height: 1.58; gap: 10px; }
.edu { flex-direction: column; gap: 4px; align-items: flex-start; }
.edu-degree { font-weight: 600; font-size: 17px; line-height: 1.3; letter-spacing: -.02em; }
.edu-school { font-size: 11.5px; color: var(--muted); }
.jobs { display: flex; flex-direction: column; gap: 10px; }
.job { display: flex; flex-direction: row; flex-wrap: wrap; gap: 16px 20px; align-items: flex-start; padding: 24px; border-radius: 18px; }
.job-ini { width: 40px; height: 40px; flex: none; border-radius: 12px; border: 1px solid var(--line); background: var(--panel2); display: flex; align-items: center; justify-content: center; font-weight: 600; font-size: 16px; color: var(--muted); }
.job-main { display: flex; flex-direction: column; gap: 7px; flex: 1 1 300px; min-width: 0; }
.job-company { font-weight: 600; font-size: 18px; letter-spacing: -.024em; }
.job-period { font-size: 11px; color: var(--muted); flex: none; }

/* stack */
.stack-box { padding: 4px 24px; }
.sgroup { display: flex; flex-wrap: wrap; gap: 14px 32px; align-items: baseline; padding: 20px 0; border-bottom: 1px solid var(--line); }
.sgroup:last-child { border-bottom: 0; }
.sgroup-label { flex: 0 0 140px; font-weight: 600; font-size: 16px; letter-spacing: -.022em; }
.sgroup .chips { flex: 1 1 300px; min-width: 0; }

/* contact */
.contact { padding: 40px 32px; gap: 20px; }
.contact-title { max-width: 16ch; font-weight: 600; font-size: clamp(34px, 7vw, 48px); line-height: 1.04; letter-spacing: -.035em; text-wrap: balance; }
.contact-body { max-width: 48ch; font-size: 16.5px; line-height: 1.6; color: var(--soft); text-wrap: pretty; }
.ctas { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin-top: 2px; }
.btn {
  position: relative; display: inline-flex; align-items: center; gap: 10px; min-height: 50px; padding: 0 22px;
  border-radius: 999px; font-size: 13px; cursor: pointer;
  transition: transform .2s cubic-bezier(.22,1,.36,1), background-color .12s ease, border-color .12s ease, color .12s ease;
}
.btn:active { transform: translateY(1px) scale(.985); }
.btn-primary { padding: 0 24px; background: var(--accent); color: var(--accent-ink); border: 1px solid var(--accent); font-family: Inter, system-ui, sans-serif; font-size: 15px; font-weight: 600; }
.btn-primary:hover { color: var(--accent-ink); }
.btn-ghost { background: var(--panel2); color: var(--fg); border: 1px solid var(--line-hi); }
/* hover: solid accent fill, dark ink (reference: ~120 ms colour swap) */
.btn-ghost:hover { border-color: var(--accent); color: var(--accent-ink); background: var(--accent); }

.flier {
  position: absolute; left: 50%; top: 4px; opacity: 0; pointer-events: none; white-space: nowrap; transform: translate(-50%, 0);
  font-size: 12px; color: var(--accent-text); background: var(--accent-dim); border: 1px solid var(--accent-line); border-radius: 999px; padding: 5px 12px;
}
.flier.is-go { animation: flyUp .9s cubic-bezier(.16,1,.3,1) forwards; }
@keyframes flyUp {
  0% { opacity: 0; transform: translate(-50%, 8px) scale(.82) rotate(0deg); }
  16% { opacity: 1; transform: translate(-50%, -14px) scale(1.06) rotate(-2deg); }
  100% { opacity: 0; transform: translate(-50%, -104px) scale(.9) rotate(-7deg); }
}

/* footer */
.footer { display: flex; flex-wrap: wrap; gap: 14px 32px; justify-content: space-between; align-items: baseline; border-top: 1px solid var(--line); padding-top: 24px; }
.footer p { font-size: 11px; line-height: 1.85; color: var(--faint); }
.footer p:first-child { max-width: 52ch; }

@media (max-width: 520px) {
  .wrap { padding: 0 16px 80px; }
  .hero, .lead, .contact, .offer { padding: 24px 20px; }
  .stack-box { padding: 4px 20px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .card, .btn, .ico, .srow, .navlink, .navbar { transition: none; }
  .flier.is-go { animation: none; }
  .reveal { opacity: 1 !important; transform: none !important; transition: none !important; }
}


/* liquid heading: canvas draws the text; the DOM text stays for screen readers and selection */
.liquid-text { position: relative; color: transparent; text-shadow: none; }
.liquid-text-canvas { position: absolute; pointer-events: none; }

[hidden] { display: none !important; }

/* services: two offers side by side, stacked on small screens */
.offers { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(300px, 100%), 1fr)); gap: 16px; }
.offer { padding: 32px; gap: 16px; }
/* odd one out on the two-column layout takes the full row */
.offer:last-child:nth-child(odd) { grid-column: 1 / -1; }
.offer-kind { font-size: 12px; color: var(--muted); }
.offer-title { font-weight: 600; font-size: 24px; line-height: 1.15; letter-spacing: -.03em; text-wrap: balance; }
.offer-foot { margin-top: auto; padding-top: 20px; border-top: 1px solid var(--line); display: flex; flex-direction: column; align-items: flex-start; gap: 12px; }
.offer-price { font-weight: 600; font-size: 32px; line-height: 1; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }

/* scroll: reading progress + one fade/rise per block as it enters */
.progress { position: fixed; top: 0; left: 0; right: 0; height: 2px; z-index: 10; background: var(--accent); transform: scaleX(0); transform-origin: 0 50%; pointer-events: none; }
.reveal { opacity: 0; transform: translateY(16px); transition: opacity .6s cubic-bezier(.22,1,.36,1), transform .6s cubic-bezier(.22,1,.36,1); }
.reveal.is-in { opacity: 1; transform: none; }

/* hugeicons slots: same box as the glyph, never shrink in flex rows */
.hi { display: inline-flex; flex: none; align-items: center; justify-content: center; line-height: 0; }

/* email compose modal; a bottom sheet on phones */
.mail-modal {
  width: min(520px, calc(100% - 32px)); max-height: calc(100% - 32px); padding: 0;
  border: 1px solid var(--line-hi); border-radius: 20px; background: var(--panel); color: var(--fg);
  box-shadow: 0 24px 64px rgba(0,0,0,.4);
}
.mail-modal::backdrop { background: rgba(0,0,0,.56); }
.mail-modal[open] { animation: sheetIn .24s cubic-bezier(.22,1,.36,1); }
@keyframes sheetIn { from { opacity: 0; transform: translateY(8px); } }
.mail-form { display: flex; flex-direction: column; gap: 16px; padding: 24px; }
.mail-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.mail-title { font-weight: 600; font-size: 22px; letter-spacing: -.02em; }
.mail-to { margin-top: -8px; font-size: 12px; color: var(--muted); }
.field { display: flex; flex-direction: column; gap: 8px; }
.field-label { font-size: 13px; color: var(--soft); }
.field-input {
  width: 100%; padding: 12px 14px; border: 1px solid var(--line-hi); border-radius: 12px;
  background: var(--panel2); color: var(--fg); font: inherit; font-size: 16px; line-height: 1.5;
  transition: border-color .15s ease;
}
textarea.field-input { resize: vertical; min-height: 140px; }
.field-input:focus { outline: none; border-color: var(--accent); }
.mail-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 16px; padding-top: 4px; }
.mail-foot .fine { flex: 1 1 200px; }
.mail-status { font-size: 13px; color: var(--soft); }
.mail-status:empty { display: none; }
.mail-status a { color: var(--accent); text-decoration: underline; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }
@media (max-width: 520px) {
  .mail-modal { width: 100%; max-width: none; margin: auto 0 0; border-radius: 20px 20px 0 0; border-bottom: 0; }
  .mail-modal[open] { animation-name: sheetUp; }
  @keyframes sheetUp { from { transform: translateY(100%); } }
  .mail-form { padding: 20px 16px calc(20px + env(safe-area-inset-bottom)); }
  .mail-foot .btn { width: 100%; justify-content: center; }
}
/* send button loading state */
.spin { display: none; width: 16px; height: 16px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; }
.is-loading .spin { display: inline-block; }
.is-loading [data-icon] { display: none; }
.btn[disabled] { opacity: .75; cursor: progress; }
@keyframes spin { to { transform: rotate(360deg); } }

/* toast (success after sending) */
.toast {
  position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); z-index: 60;
  display: flex; align-items: center; gap: 10px; max-width: calc(100% - 32px); padding: 12px 16px;
  border: 1px solid var(--line-hi); border-radius: 14px; background: var(--panel); color: var(--fg);
  font-size: 14px; box-shadow: 0 16px 40px rgba(0,0,0,.28);
  opacity: 0; pointer-events: none; transform: translate(-50%, 12px);
  transition: opacity .2s ease, transform .24s cubic-bezier(.22,1,.36,1);
}
.toast .hi { color: #22C55E; }
.toast.is-on { opacity: 1; transform: translate(-50%, 0); }
@media (prefers-reduced-motion: reduce) { .mail-modal[open] { animation: none; } .toast { transition: opacity .2s ease; transform: translate(-50%, 0); } .spin { animation-duration: 1.6s; } }
